2010-10-20 23:00:35 +02:00
|
|
|
Subject: xenpaging: allow only one xenpaging binary per guest
|
|
|
|
|
|
|
|
Make sure only one xenpaging binary is active per domain.
|
|
|
|
Print info when the host lacks the required features for xenpaging.
|
|
|
|
|
2011-01-14 19:24:51 +01:00
|
|
|
(xen-unstable changeset: 22436:b153d3b71504)
|
|
|
|
(xen-unstable changeset: 22511:fdf95845c2f8)
|
|
|
|
|
2010-10-20 23:00:35 +02:00
|
|
|
Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
|
|
|
Already-Acked-by: Patrick Colp <pjcolp@cs.ubc.ca>
|
|
|
|
Already-Acked-by: Keir Fraser <keir.fraser@citrix.com>
|
|
|
|
|
|
|
|
---
|
|
|
|
v2: use perror for default case
|
|
|
|
|
|
|
|
tools/xenpaging/xenpaging.c | 12 +++++++++++-
|
|
|
|
xen/arch/x86/mm/mem_event.c | 7 +++++++
|
|
|
|
2 files changed, 18 insertions(+), 1 deletion(-)
|
|
|
|
|
2011-02-04 22:19:54 +01:00
|
|
|
Index: xen-4.0.2-testing/tools/xenpaging/xenpaging.c
|
|
|
|
===================================================================
|
|
|
|
--- xen-4.0.2-testing.orig/tools/xenpaging/xenpaging.c
|
|
|
|
+++ xen-4.0.2-testing/tools/xenpaging/xenpaging.c
|
|
|
|
@@ -120,7 +120,17 @@ xenpaging_t *xenpaging_init(domid_t doma
|
2010-10-20 23:00:35 +02:00
|
|
|
paging->mem_event.ring_page);
|
|
|
|
if ( rc != 0 )
|
|
|
|
{
|
|
|
|
- ERROR("Error initialising shared page");
|
|
|
|
+ switch ( errno ) {
|
|
|
|
+ case EBUSY:
|
|
|
|
+ ERROR("xenpaging is (or was) active on this domain");
|
|
|
|
+ break;
|
|
|
|
+ case ENODEV:
|
|
|
|
+ ERROR("EPT not supported for this guest");
|
|
|
|
+ break;
|
|
|
|
+ default:
|
2011-01-14 19:24:51 +01:00
|
|
|
+ ERROR("Error initialising shared page: %s", strerror(errno));
|
2010-10-20 23:00:35 +02:00
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
2011-02-04 22:19:54 +01:00
|
|
|
Index: xen-4.0.2-testing/xen/arch/x86/mm/mem_event.c
|
|
|
|
===================================================================
|
|
|
|
--- xen-4.0.2-testing.orig/xen/arch/x86/mm/mem_event.c
|
|
|
|
+++ xen-4.0.2-testing/xen/arch/x86/mm/mem_event.c
|
|
|
|
@@ -214,6 +214,13 @@ int mem_event_domctl(struct domain *d, x
|
2010-10-20 23:00:35 +02:00
|
|
|
mfn_t ring_mfn;
|
|
|
|
mfn_t shared_mfn;
|
|
|
|
|
|
|
|
+ /* Only one xenpaging at a time. If xenpaging crashed,
|
|
|
|
+ * the cache is in an undefined state and so is the guest
|
|
|
|
+ */
|
|
|
|
+ rc = -EBUSY;
|
2011-02-04 22:19:54 +01:00
|
|
|
+ if ( d->mem_event.ring_page )
|
2010-10-20 23:00:35 +02:00
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
/* Currently only EPT is supported */
|
|
|
|
rc = -ENODEV;
|
|
|
|
if ( !(is_hvm_domain(d) && d->arch.hvm_domain.hap_enabled &&
|