From: Ian Campbell Subject: Re: [PATCH v6 14/15] xen/arm: clear pending irq queues on do_psci_cpu_on Date: Tue, 7 May 2013 13:44:00 +0100 Message-ID: <1367930640.26321.106.camel@zakaz.uk.xensource.com> References: <1367578301-32470-14-git-send-email-stefano.stabellini@eu.citrix.com> <1367581201.28742.73.camel@zakaz.uk.xensource.com> <1367915240.26321.9.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: Julien Grall , "xen-devel@lists.xensource.com" , "Tim (Xen.org)" List-Id: xen-devel@lists.xenproject.org On Tue, 2013-05-07 at 12:52 +0100, Stefano Stabellini wrote: > On Tue, 7 May 2013, Ian Campbell wrote: > > As I say, I think this stuff needs rationalising, it has become a bit > > confused as SMP host and guest have been added and as our understanding > > of the requirements has expanded etc. > > I agree, but it's something for a separate patch ACK > > vgic_clear_pending_irqs beats any possible race with a big hammer. > > > > In any case I don't think this check closes the race as you seem to > > think, the cpu_off CPU could not have yet set VPF_down. > > I am trying to prevent vgic_vcpu_inject_irq from calling vcpu_unblock > on a vcpu that is going down. > > Given that VPF_down is set before calling vcpu_sleep_nosync, I think > that the test_bit I added should be enough to prevent the race. Ah yes, I see now. Thanks for explaining. > > I don't think this is a race you can win without a big lock around > > interrupt injection & cpu up/down, but luckily I don't think it is > > necessary since clear_pending_irqs takes care of it. > > > > However I do think you need to call vgic_clear_pending_irqs before you > > clear VPF_down in cpu_up (i.e. before the call to arch_set_info_guest). > > Otherwise you will drop any interrupts sent while the processor is > > coming up. > > I guess it would make sense but keeping in mind that the vcpu is not > actually up until vcpu_wake is called, I don't think it would make a > difference. I suppose not. Ian.