2009-03-18 06:25:45

by Li Yang

[permalink] [raw]
Subject: nonboot cpu on SMP suspend

Hi all,

I'm curious why we need to un-plug all the nonboot cpus before suspend
and start them all over again after the suspend(ACPI sleep)?  I mean
if we can bring the booting cpu back to the exact state as before
suspend, why can't we just do the same for non-booting cpus?  And that
will be much faster. Any thought?  Thanks.

- Leo


2009-03-18 23:01:01

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: nonboot cpu on SMP suspend

On Wednesday 18 March 2009, Li Yang wrote:
> Hi all,
>
> I'm curious why we need to un-plug all the nonboot cpus before suspend
> and start them all over again after the suspend(ACPI sleep)? I mean
> if we can bring the booting cpu back to the exact state as before
> suspend, why can't we just do the same for non-booting cpus? And that
> will be much faster. Any thought? Thanks.

Because we need to enter the BIOS with one CPU on-line only.

Thanks,
Rafael

2009-03-19 07:04:43

by Chen, Gong

[permalink] [raw]
Subject: Re: nonboot cpu on SMP suspend

Rafael J. Wysocki 写道:
> On Wednesday 18 March 2009, Li Yang wrote:
>> Hi all,
>>
>> I'm curious why we need to un-plug all the nonboot cpus before suspend
>> and start them all over again after the suspend(ACPI sleep)? I mean
>> if we can bring the booting cpu back to the exact state as before
>> suspend, why can't we just do the same for non-booting cpus? And that
>> will be much faster. Any thought? Thanks.
>
> Because we need to enter the BIOS with one CPU on-line only.
>
You mean only one CPU can be supported by BIOS when suspend/resume ?

2009-03-19 07:18:42

by Li Yang

[permalink] [raw]
Subject: Re: nonboot cpu on SMP suspend

On Thu, Mar 19, 2009 at 3:04 PM, chen gong <[email protected]> wrote:
> Rafael J. Wysocki 写道:
>>
>> On Wednesday 18 March 2009, Li Yang wrote:
>>>
>>> Hi all,
>>>
>>> I'm curious why we need to un-plug all the nonboot cpus before suspend
>>> and start them all over again after the suspend(ACPI sleep)?  I mean
>>> if we can bring the booting cpu back to the exact state as before
>>> suspend, why can't we just do the same for non-booting cpus?  And that
>>> will be much faster.  Any thought?  Thanks.
>>
>> Because we need to enter the BIOS with one CPU on-line only.
>>
> You mean only one CPU can be supported by BIOS when suspend/resume ?

If so, is it a defect of x86 BIOS? And is it true that for other
architectures without a BIOS there won't be such a limitation if the
boot code is sane? Thanks

- Leo

2009-03-19 12:31:25

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: nonboot cpu on SMP suspend

On Thursday 19 March 2009, Li Yang wrote:
> On Thu, Mar 19, 2009 at 3:04 PM, chen gong <[email protected]> wrote:
> > Rafael J. Wysocki 写道:
> >>
> >> On Wednesday 18 March 2009, Li Yang wrote:
> >>>
> >>> Hi all,
> >>>
> >>> I'm curious why we need to un-plug all the nonboot cpus before suspend
> >>> and start them all over again after the suspend(ACPI sleep)? I mean
> >>> if we can bring the booting cpu back to the exact state as before
> >>> suspend, why can't we just do the same for non-booting cpus? And that
> >>> will be much faster. Any thought? Thanks.
> >>
> >> Because we need to enter the BIOS with one CPU on-line only.
> >>
> > You mean only one CPU can be supported by BIOS when suspend/resume ?
>
> If so, is it a defect of x86 BIOS? And is it true that for other
> architectures without a BIOS there won't be such a limitation if the
> boot code is sane? Thanks

I think that is a limitation of x86 BIOS and I don't know enough about the
other architectures to comment.

Thanks,
Rafael

2009-03-20 18:59:20

by Pavel Machek

[permalink] [raw]
Subject: Re: nonboot cpu on SMP suspend

On Wed 2009-03-18 14:25:32, Li Yang wrote:
> Hi all,
>
> I'm curious why we need to un-plug all the nonboot cpus before suspend
> and start them all over again after the suspend(ACPI sleep)?? I mean
> if we can bring the booting cpu back to the exact state as before
> suspend, why can't we just do the same for non-booting cpus?? And that
> will be much faster. Any thought?? Thanks.

Why do you think it will be faster?
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

2009-03-23 07:16:20

by Li Yang

[permalink] [raw]
Subject: Re: nonboot cpu on SMP suspend

On Sat, Mar 21, 2009 at 2:58 AM, Pavel Machek <[email protected]> wrote:
> On Wed 2009-03-18 14:25:32, Li Yang wrote:
>> Hi all,
>>
>> I'm curious why we need to un-plug all the nonboot cpus before suspend
>> and start them all over again after the suspend(ACPI sleep)?  I mean
>> if we can bring the booting cpu back to the exact state as before
>> suspend, why can't we just do the same for non-booting cpus?  And that
>> will be much faster.  Any thought?  Thanks.
>
> Why do you think it will be faster?

_cpu_down() and _cpu_up() are surely complex functions, involving
work_queues and synchronization between boot cpu and non-boot cpu. On
the contrary, to bring the cpu back to previous state is much simpler.
For standby state, you barely need to do anything. For mem state,
you only need to restore the registers and states of the CPU.

- Leo

2009-03-23 10:35:45

by Pavel Machek

[permalink] [raw]
Subject: Re: nonboot cpu on SMP suspend

On Mon 2009-03-23 15:15:57, Li Yang wrote:
> On Sat, Mar 21, 2009 at 2:58 AM, Pavel Machek <[email protected]> wrote:
> > On Wed 2009-03-18 14:25:32, Li Yang wrote:
> >> Hi all,
> >>
> >> I'm curious why we need to un-plug all the nonboot cpus before suspend
> >> and start them all over again after the suspend(ACPI sleep)?? I mean
> >> if we can bring the booting cpu back to the exact state as before
> >> suspend, why can't we just do the same for non-booting cpus?? And that
> >> will be much faster. ?Any thought?? Thanks.
> >
> > Why do you think it will be faster?
>
> _cpu_down() and _cpu_up() are surely complex functions, involving
> work_queues and synchronization between boot cpu and non-boot cpu. On
> the contrary, to bring the cpu back to previous state is much simpler.
> For standby state, you barely need to do anything. For mem state,
> you only need to restore the registers and states of the CPU.

Feel free to cook up a patch.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html