From: "Jan Beulich" Subject: Re: [Patch v5 2/5] x86/hpet: Use singe apic vector rather than irq_descs for HPET interrupts Date: Mon, 25 Nov 2013 07:52:16 +0000 Message-ID: <52930FC00200007800106568@nat28.tlf.novell.com> References: <20131114155203.GD42238@deinos.phlegethon.org> <1384444914-10215-1-git-send-email-andrew.cooper3@citrix.com> <528F8A1A0200007800105F6E@nat28.tlf.novell.com> <528F84FC.8000001@citrix.com> <528F993B0200007800106067@nat28.tlf.novell.com> <528F9680.30501@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Vkqyn-0007ar-D3 for xen-devel@lists.xenproject.org; Mon, 25 Nov 2013 07:53:13 +0000 In-Reply-To: <528F9680.30501@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: xen-devel , Keir Fraser List-Id: xen-devel@lists.xenproject.org >>> On 22.11.13 at 18:38, Andrew Cooper wrote: > On 22/11/13 16:49, Jan Beulich wrote: >>>>> On 22.11.13 at 17:23, Andrew Cooper wrote: >>> On 22/11/13 15:45, Jan Beulich wrote: >>>>>>> On 14.11.13 at 17:01, Andrew Cooper wrote: >>>>> +/* Wake up all cpus in the channel mask. Lock should be held. */ >>>>> +static void hpet_wake_cpus(struct hpet_event_channel *ch) >>>>> { >>>>> - unsigned int cpu = smp_processor_id(); >>>>> + cpuidle_wakeup_mwait(ch->cpumask); >>>>> >>>>> - if ( cpumask_test_and_clear_cpu(cpu, mask) ) >>>>> - raise_softirq(TIMER_SOFTIRQ); >>>>> - >>>>> - cpuidle_wakeup_mwait(mask); >>>>> - >>>>> - if ( !cpumask_empty(mask) ) >>>>> - cpumask_raise_softirq(mask, TIMER_SOFTIRQ); >>>>> + if ( !cpumask_empty(ch->cpumask) ) >>>>> + cpumask_raise_softirq(ch->cpumask, TIMER_SOFTIRQ); >>>> Looks like the cpumask_empty() check isn't really needed here? >>> cpuidle_wakeup_mwait(mask) will only wake cpus who have set their bit in >>> cpuidle_mwait_flags. >>> >>> There might be cpus who have registered for waking up who have not yet >>> set their bit in cpuidle_mwait_flags. >>> >>> Out of caution, I did by best to avoid playing with the guts of the >>> timing code, as it seems quite fragile. >> Some misunderstanding? The cpumask_empty() check doesn't >> guard the call to cpuidle_wakeup_mwait(), but the one to >> cpumask_raise_softirq() (which appears to be prepared to be >> called with an empty mask). > > cpuidle_wakeup_mwait() clears bits out of mask. The result is the set > of cpus who were not set in cpuidle_mwait_flags. Sure - but there's still no big gain from doing the cpumask_empty() check here. Unless I'm missing something... Jan