Wei, Gang
2010-Jun-17 07:38 UTC
[Xen-devel] [PATCH4/6] cpuidle: remove hpet access in hpet_broadcast_exit
cpuidle: remove hpet access in hpet_broadcast_exit hpet_broadcast_exit calls reprogram_hpet to stop possible hpet intr if the last deep-cstate waken up cpu is waken by unexpected intrs instead of hpet broadcast handler. This can be removed without brings much useless intrs, but bring chance for further optimization. It is a tradeoff between grace & optimization. BTW, move the cpumask set out of critial section in hpet_broadcast_enter to shorten it. Signed-off-by: Wei Gang <gang.wei@intel.com> diff -r 451a46c667c9 xen/arch/x86/hpet.c --- a/xen/arch/x86/hpet.c Sun Jun 13 07:23:26 2010 +0800 +++ b/xen/arch/x86/hpet.c Sun Jun 13 07:27:14 2010 +0800 @@ -664,14 +664,12 @@ void hpet_broadcast_enter(void) /* Disable LAPIC timer interrupts. */ disable_APIC_timer(); + cpu_set(cpu, ch->cpumask); spin_lock(&ch->lock); - - cpu_set(cpu, ch->cpumask); /* reprogram if current cpu expire time is nearer */ if ( this_cpu(timer_deadline_end) < ch->next_event ) reprogram_hpet_evt_channel(ch, this_cpu(timer_deadline_end), NOW(), 1); - spin_unlock(&ch->lock); } @@ -692,11 +690,7 @@ void hpet_broadcast_exit(void) raise_softirq(TIMER_SOFTIRQ); spin_lock_irq(&ch->lock); - cpu_clear(cpu, ch->cpumask); - if ( cpus_empty(ch->cpumask) && ch->next_event != STIME_MAX ) - reprogram_hpet_evt_channel(ch, STIME_MAX, 0, 0); - spin_unlock_irq(&ch->lock); if ( ch != &legacy_hpet_event ) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jan Beulich
2010-Jun-17 08:26 UTC
Re: [Xen-devel] [PATCH4/6] cpuidle: remove hpet access in hpet_broadcast_exit
>>> On 17.06.10 at 09:38, "Wei, Gang" <gang.wei@intel.com> wrote: > BTW, move the cpumask set out of critial section in hpet_broadcast_enter to > shorten it.Could you explain why you can move it out of the locked section for _enter(), but can''t for _exit() - this isn''t obvious to me (and would perhaps deserve a comment in the sources). Jan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Wei, Gang
2010-Jun-17 08:52 UTC
RE: [Xen-devel] [PATCH4/6] cpuidle: remove hpet access in hpet_broadcast_exit
On Thursday, 2010-6-17 4:26 PM, Jan Beulich wrote:>>>> On 17.06.10 at 09:38, "Wei, Gang" <gang.wei@intel.com> wrote: >> BTW, move the cpumask set out of critial section in >> hpet_broadcast_enter to shorten it. > > Could you explain why you can move it out of the locked section for > _enter(), but can''t for _exit() - this isn''t obvious to me (and would > perhaps deserve a comment in the sources).Keeping cpumask clear within the locked section in _exit() to avoid handle_hpet_broadcast() to access other cpu''s timer_deadline_start/end after the other cpu''s mask was cleared. For set, there are no such issue. And cpumask set/clear it self should be atom type. Jimmy _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel