From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olaf Hering Subject: [PATCH 06/18] xenpaging: allow only one xenpaging binary per guest Date: Fri, 15 Oct 2010 16:12:08 +0200 Message-ID: <20101015141204.419704862@aepfle.de> References: <20101015141202.309585877@aepfle.de> Return-path: Content-Disposition: inline; filename=xenpaging.xenpaging_init.patch List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Make sure only one xenpaging binary is active per domain. Print info when the host lacks the required features for xenpaging. Signed-off-by: Olaf Hering Already-Acked-by: Patrick Colp Already-Acked-by: Keir Fraser --- tools/xenpaging/xenpaging.c | 12 +++++++++++- xen/arch/x86/mm/mem_event.c | 7 +++++++ 2 files changed, 18 insertions(+), 1 deletion(-) --- xen-4.0.1-testing.orig/tools/xenpaging/xenpaging.c +++ xen-4.0.1-testing/tools/xenpaging/xenpaging.c @@ -119,7 +119,17 @@ xenpaging_t *xenpaging_init(domid_t doma 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: + ERROR("Error initialising shared page"); + break; + } goto err; } --- xen-4.0.1-testing.orig/xen/arch/x86/mm/mem_event.c +++ xen-4.0.1-testing/xen/arch/x86/mm/mem_event.c @@ -226,6 +226,13 @@ int mem_event_domctl(struct domain *d, x 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; + if ( d->mem_event.enabled ) + break; + /* Currently only EPT is supported */ rc = -ENODEV; if ( !(is_hvm_domain(d) && d->arch.hvm_domain.hap_enabled &&