From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH] xen/arm: p2m: Restrict preemption check in apply_p2m_changes Date: Wed, 6 May 2015 11:48:51 +0100 Message-ID: <5549F193.8000103@citrix.com> References: <1430838129-21693-1-git-send-email-julien.grall@citrix.com> <20150505155041.GG31936@l.oracle.com> <5548F045.1090506@citrix.com> <1430901072.2660.141.camel@citrix.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 1YpwtJ-00007w-Vd for xen-devel@lists.xenproject.org; Wed, 06 May 2015 10:49:26 +0000 In-Reply-To: <1430901072.2660.141.camel@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: Ian Campbell , Julien Grall Cc: stefano.stabellini@citrix.com, Riku Voipio , tim@xen.org, Tamas K Lengyel , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org Hi Ian, On 06/05/15 09:31, Ian Campbell wrote: > On Tue, 2015-05-05 at 17:31 +0100, Julien Grall wrote: >> Hi Konrad, >> >> On 05/05/15 16:50, Konrad Rzeszutek Wilk wrote: >>>> --- >>>> xen/arch/arm/p2m.c | 4 +++- >>>> 1 file changed, 3 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c >>>> index 65efa94..59dd23a 100644 >>>> --- a/xen/arch/arm/p2m.c >>>> +++ b/xen/arch/arm/p2m.c >>>> @@ -948,6 +948,7 @@ static int apply_p2m_changes(struct domain *d, >>>> const unsigned long sgfn = paddr_to_pfn(start_gpaddr), >>>> egfn = paddr_to_pfn(end_gpaddr); >>>> const unsigned int preempt_count_limit = (op == MEMACCESS) ? 1 : 0x2000; >>>> + const bool_t preempt = !is_idle_vcpu(current); >>>> bool_t flush = false; >>>> bool_t flush_pt; >>>> >>>> @@ -980,7 +981,8 @@ static int apply_p2m_changes(struct domain *d, >>>> * always make at least one pass as long as preempt_count_limit is >>>> * initialized with a value >= 1. >>>> */ >>>> - if ( count >= preempt_count_limit && hypercall_preempt_check() ) >>>> + if ( preempt && count >= preempt_count_limit >>>> + && hypercall_preempt_check() ) >>> >>> Could you use the softirq_pending() check to deal when there are no domains? >> >> apply_p2m_changes will only be called with no current domain (i.e idle >> vcpu) during DOM0 construction. > > I wonder if we could/should try and switch to d0:v0 sooner during the > build process? Is that even feasible? We would hide out the problem and rely on hypercall_preempt_check to always return 0 in non-hypercall context (i.e during DOM0 construction). The problem may come back if we decide to change the behavior of local_events_need_delivery or the interrupt subsystem. I think this should be properly fix by calling hypercall_preempt_check only when it's necessary. Regards, -- Julien Grall