From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: [PATCH 2/4] x86/PoD: Identify when a domain has already been killed from PoD exhaustion Date: Fri, 30 Oct 2015 18:33:40 +0000 Message-ID: <1446230022-8349-3-git-send-email-andrew.cooper3@citrix.com> References: <1446230022-8349-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1446230022-8349-1-git-send-email-andrew.cooper3@citrix.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: Xen-devel Cc: George Dunlap , Andrew Cooper , Jan Beulich List-Id: xen-devel@lists.xenproject.org p2m_pod_demand_populate() can be entered repeatedly during a single path through the hypervisor, e.g. on a toolstack batch map operation. The domain might be crashed, but the interface currently lacks a way of passing an error back through the generic p2m layer. Longterm the p2m layer needs reworking to allow errors to be returned, but in the short term, avoid repeatedly re-sweeping the domain after it has already been crashed from PoD exhaustion. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: George Dunlap --- xen/arch/x86/mm/p2m-pod.c | 3 ++- xen/include/asm-x86/p2m.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c index be15cf3..6fb054f 100644 --- a/xen/arch/x86/mm/p2m-pod.c +++ b/xen/arch/x86/mm/p2m-pod.c @@ -1048,7 +1048,7 @@ p2m_pod_demand_populate(struct p2m_domain *p2m, unsigned long gfn, /* This check is done with the pod lock held. This will make sure that * even if d->is_dying changes under our feet, p2m_pod_empty_cache() * won't start until we're done. */ - if ( unlikely(d->is_dying) ) + if ( unlikely(d->is_dying) || p2m->pod.dead ) goto out_fail; @@ -1129,6 +1129,7 @@ p2m_pod_demand_populate(struct p2m_domain *p2m, unsigned long gfn, pod_unlock(p2m); return 0; out_of_memory: + p2m->pod.dead = 1; pod_unlock(p2m); printk("%s: Dom%d out of PoD memory! (tot=%"PRIu32" ents=%ld dom%d)\n", diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h index d748557..6faf9d6 100644 --- a/xen/include/asm-x86/p2m.h +++ b/xen/include/asm-x86/p2m.h @@ -308,6 +308,8 @@ struct p2m_domain { } mrp; mm_lock_t lock; /* Locking of private pod structs, * * not relying on the p2m lock. */ + bool_t dead; /* Emergency sweep has failed and * + * the domain has been crashed. */ } pod; union { struct ept_data ept; -- 2.1.4