From: Konrad Rzeszutek Wilk Subject: Re: -EINTR return in domain_relinquish_resources Date: Thu, 22 Jan 2015 11:38:40 -0500 Message-ID: <20150122163840.GB32691@l.oracle.com> References: <20150121212720.GA24555@l.oracle.com> <54C0D8530200007800057FEB@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YEKmM-0000bn-Og for xen-devel@lists.xenproject.org; Thu, 22 Jan 2015 16:38:46 +0000 Content-Disposition: inline In-Reply-To: <54C0D8530200007800057FEB@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On Thu, Jan 22, 2015 at 10:00:35AM +0000, Jan Beulich wrote: > >>> On 21.01.15 at 22:27, wrote: > > As I was looking at some of the XSA I realized that the > > call-chain of: > > > > domain_relinquish_resources > > ->vcpu_destroy_pagetables > > -> put_page_and_type_preemptible > > -> __put_page_type > > returns -EINTR > > [...] > > b). Or should the hypervisor convert the -EINTR to -ERESTART > > (or -EAGAIN) - which most of the code (see users of > > get_page_type_preemptible) do right now? > > This one, in vcpu_destroy_pagetables(). I'm afraid I overlooked > this when adding the preemption capability here. OK. Would this RFC patch be OK? (I can send it off as normal - just want to make sure you are OK with this being put there) >From 1558a9870f438df949a8ad09a27825bd35a9f4ea Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Thu, 22 Jan 2015 11:34:21 -0500 Subject: [PATCH] domain: In vcpu_destroy_pagetables we can return -EINTR instead of -EAGAIN which has the side effect that domain_relinquish_resources will stop and return to user-space -EINTR - which it is not equipped to deal with. The preemption mechanism we have to domain destruction is to return -EAGAIN and as such we need to catch the case of: domain_relinquish_resources ->vcpu_destroy_pagetables -> put_page_and_type_preemptible -> __put_page_type returns -EINTR and convert it to the proper type. Signed-off-by: Konrad Rzeszutek Wilk --- xen/arch/x86/mm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 6e9c2c0..3ac2ae5 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -2677,6 +2677,9 @@ int vcpu_destroy_pagetables(struct vcpu *v) v->arch.cr3 = 0; + if ( rc == -EINTR ) + rc = -EAGAIN; + return rc; } -- 2.1.0