X86: Fix possible S3 suspend hangs It is possible for cpu to become offlined before irq disabled in idle loop, which will cause this cpu stay in C state and can''t wakeup to play dead. Signed-off-by: Wei Gang <gang.wei@intel.com> Signed-off-by: Yu Ke <ke.yu@intel.com> diff -r 132ac04cbdba xen/arch/x86/acpi/cpu_idle.c --- a/xen/arch/x86/acpi/cpu_idle.c Tue Mar 09 18:18:19 2010 +0000 +++ b/xen/arch/x86/acpi/cpu_idle.c Fri Mar 12 11:07:43 2010 +0800 @@ -268,7 +268,8 @@ static void acpi_processor_idle(void) */ local_irq_disable(); - if ( softirq_pending(smp_processor_id()) ) + if ( softirq_pending(smp_processor_id()) || + cpu_is_offline(smp_processor_id()) ) { local_irq_enable(); sched_tick_resume(); diff -r 132ac04cbdba xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Tue Mar 09 18:18:19 2010 +0000 +++ b/xen/arch/x86/domain.c Fri Mar 12 11:12:24 2010 +0800 @@ -82,7 +82,8 @@ static void default_idle(void) static void default_idle(void) { local_irq_disable(); - if ( !softirq_pending(smp_processor_id()) ) + if ( !softirq_pending(smp_processor_id()) && + cpu_online(smp_processor_id()) ) safe_halt(); else local_irq_enable(); _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2010-Mar-12 07:20 UTC
[Xen-devel] Re: [PATCH]x86: Fix possible S3 suspend hangs
Not doubting this race exists, but could you briefly give an example of an offlining scenario that would hit the hang? And explain the result: is it that the offliner thinks the operation doesn''t complete and spins forever in __cpu_die()? -- Keir On 12/03/2010 03:42, "Wei, Gang" <gang.wei@intel.com> wrote:> X86: Fix possible S3 suspend hangs > > It is possible for cpu to become offlined before irq disabled in idle loop, > which will cause this cpu stay in C state and can''t wakeup to play dead. > > Signed-off-by: Wei Gang <gang.wei@intel.com> > Signed-off-by: Yu Ke <ke.yu@intel.com> > > diff -r 132ac04cbdba xen/arch/x86/acpi/cpu_idle.c > --- a/xen/arch/x86/acpi/cpu_idle.c Tue Mar 09 18:18:19 2010 +0000 > +++ b/xen/arch/x86/acpi/cpu_idle.c Fri Mar 12 11:07:43 2010 +0800 > @@ -268,7 +268,8 @@ static void acpi_processor_idle(void) > */ > local_irq_disable(); > > - if ( softirq_pending(smp_processor_id()) ) > + if ( softirq_pending(smp_processor_id()) || > + cpu_is_offline(smp_processor_id()) ) > { > local_irq_enable(); > sched_tick_resume(); > diff -r 132ac04cbdba xen/arch/x86/domain.c > --- a/xen/arch/x86/domain.c Tue Mar 09 18:18:19 2010 +0000 > +++ b/xen/arch/x86/domain.c Fri Mar 12 11:12:24 2010 +0800 > @@ -82,7 +82,8 @@ static void default_idle(void) > static void default_idle(void) > { > local_irq_disable(); > - if ( !softirq_pending(smp_processor_id()) ) > + if ( !softirq_pending(smp_processor_id()) && > + cpu_online(smp_processor_id()) ) > safe_halt(); > else > local_irq_enable();_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2010-Mar-12 07:28 UTC
[Xen-devel] Re: [PATCH]x86: Fix possible S3 suspend hangs
Oh, don''t worry about it. It''s more obvious than I first thought! -- Keir On 12/03/2010 07:20, "Keir Fraser" <keir.fraser@eu.citrix.com> wrote:> Not doubting this race exists, but could you briefly give an example of an > offlining scenario that would hit the hang? And explain the result: is it > that the offliner thinks the operation doesn''t complete and spins forever in > __cpu_die()? > > -- Keir > > On 12/03/2010 03:42, "Wei, Gang" <gang.wei@intel.com> wrote: > >> X86: Fix possible S3 suspend hangs >> >> It is possible for cpu to become offlined before irq disabled in idle loop, >> which will cause this cpu stay in C state and can''t wakeup to play dead. >> >> Signed-off-by: Wei Gang <gang.wei@intel.com> >> Signed-off-by: Yu Ke <ke.yu@intel.com> >> >> diff -r 132ac04cbdba xen/arch/x86/acpi/cpu_idle.c >> --- a/xen/arch/x86/acpi/cpu_idle.c Tue Mar 09 18:18:19 2010 +0000 >> +++ b/xen/arch/x86/acpi/cpu_idle.c Fri Mar 12 11:07:43 2010 +0800 >> @@ -268,7 +268,8 @@ static void acpi_processor_idle(void) >> */ >> local_irq_disable(); >> >> - if ( softirq_pending(smp_processor_id()) ) >> + if ( softirq_pending(smp_processor_id()) || >> + cpu_is_offline(smp_processor_id()) ) >> { >> local_irq_enable(); >> sched_tick_resume(); >> diff -r 132ac04cbdba xen/arch/x86/domain.c >> --- a/xen/arch/x86/domain.c Tue Mar 09 18:18:19 2010 +0000 >> +++ b/xen/arch/x86/domain.c Fri Mar 12 11:12:24 2010 +0800 >> @@ -82,7 +82,8 @@ static void default_idle(void) >> static void default_idle(void) >> { >> local_irq_disable(); >> - if ( !softirq_pending(smp_processor_id()) ) >> + if ( !softirq_pending(smp_processor_id()) && >> + cpu_online(smp_processor_id()) ) >> safe_halt(); >> else >> local_irq_enable(); >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel