Skip to contentSkip to conversation

poweroff in 3.2 and 3.3

DISCUSSION Jan Beulich 3 participants 16 messages Nov 19, 2008 – Nov 20, 2008

lore
Share & tools
lore
#0 lore raw

The hypervisor appears to make the assumption that all but the vCPU XENPF_enter_acpi_sleep is being called on are down (in 3.2 because the sender of the event check IPI assumes the remote CPU is idle, in 3.3 by and explicit check in __cpu_disable() - here we also have an incorrect comment stating that this path can only be used when entering S3).

I can't, however, see how this would be guaranteed on the kernel side (and apart from that I don't think the hypervisor should be dependent on kernel behavior here, even if it's dom0). Shouldn't therefore freeze_domains() not only freeze all DomU-s, but also all non-current vCPU-s of Dom0?

Thanks, Jan

#1 lore raw
Quoted 11 lines · Jan Beulich

The hypervisor appears to make the assumption that all but the vCPU XENPF_enter_acpi_sleep is being called on are down (in 3.2 because the sender of the event check IPI assumes the remote CPU is idle, in 3.3 by and explicit check in __cpu_disable() - here we also have an incorrect comment stating that this path can only be used when entering S3).

I can't, however, see how this would be guaranteed on the kernel side (and apart from that I don't think the hypervisor should be dependent on kernel behavior here, even if it's dom0). Shouldn't therefore freeze_domains() not only freeze all DomU-s, but also all non-current vCPU-s of Dom0?

Kevin Tian is probably best placed to answer this. I'm happy to see this added if he agrees.

-- Keir

#2 lore raw
Quoted 5 lines

From: Keir Fraser [mailto:[email protected]]
Sent: Wednesday, November 19, 2008 9:22 PM

On 19/11/08 13:18, "Jan Beulich" <[email protected]> wrote:

Quoted 8 lines
Quoted 2 lines

The hypervisor appears to make the assumption that all but the vCPU XENPF_enter_acpi_sleep is being called on are down (in 3.2

because the

Quoted 1 line

sender of the event check IPI assumes the remote CPU is

idle, in 3.3 by

Quoted 1 line

and explicit check in __cpu_disable() - here we also have an

incorrect

Quoted 1 line

comment stating that this path can only be used when entering S3).

Comment says "Only s3 is using this path", instead of "this path can only be used by s3". :-) At that time cpu online/offline is not supported and thus only s3 is the user on that path. If you look at latest xen upstream with cpu offline support, that comment went away.

Quoted 12 lines
Quoted 3 lines

I can't, however, see how this would be guaranteed on the kernel side (and apart from that I don't think the hypervisor should be

dependent on

Quoted 3 lines

kernel behavior here, even if it's dom0). Shouldn't therefore freeze_domains() not only freeze all DomU-s, but also all non-current vCPU-s of Dom0?

Kevin Tian is probably best placed to answer this. I'm happy to see this
added if he agrees.

Yes, original design depends on cooperation from dom0 kernel ( offline other vcpus) and control panels (send virtual S3 or equivalent suspend command to all domains except dom0). It's expected that adminstrator should request system S3 on top of control panel, instead of accessing raw sysfs interface. Current code gives a final brute-force action to freeze domains. I agree that such guard should be also added to dom0's vcpus if following this policy.

However I'm considering the point whether Xen can simply reject the s3 request, when observing non-current vcpus still alive. Domain can be in trouble if unaware of underlying sleep phase, such time keeping and softlockup warning. More seriously, domain with passthrough devices can't recover device state since it's even not notified to save context. Opinions?

Thanks,
Kevin

#3 lore raw
Quoted 6 lines · Kevin

However I'm considering the point whether Xen can simply reject the s3 request, when observing non-current vcpus still alive. Domain can be in trouble if unaware of underlying sleep phase, such time keeping and softlockup warning. More seriously, domain with passthrough devices can't recover device state since it's even not notified to save context. Opinions?

What would you warn on?
- VCPUs still exist?
- VCPUs still online?
- VCPUs not paused?
- VCPUs not 'paused_by_system_controller'?

I'm not sure what the WARN_ON() condition would be. A forceful domain_pause()/vcpu_pause() is a good idea anyway.

-- Keir

#4 lore raw
Quoted 10 lines

From: Keir Fraser [mailto:[email protected]]
Sent: Thursday, November 20, 2008 4:01 PM

Quoted 5 lines · Kevin

However I'm considering the point whether Xen can simply reject the s3 request, when observing non-current vcpus still alive. Domain can be in trouble if unaware of underlying sleep phase, such time keeping and softlockup warning. More seriously, domain with passthrough devices can't recover device state since it's even not

Quoted 8 lines

notified to save

Quoted 1 line

context. Opinions?

What would you warn on?
- VCPUs still exist?
- VCPUs still online?
- VCPUs not paused?
- VCPUs not 'paused_by_system_controller'?

warn on unpaused domains and online dom0 vcpus.

Quoted 5 lines

I'm not sure what the WARN_ON() condition would be. A forceful domain_pause()/vcpu_pause() is a good idea anyway.

-- Keir

I'm pretty sure that domains will be busy catching up missing ticks and throw warnings after system is waken up. Why should Xen continue the progress even when we're aware the fact that something will be hurted if doing so? Return a error with warning thrown out at least let user know current condition inapproriate for s3 (e.g. some incautious action) who can turn back to normal flow then. This is like normal OS suspend flow which simply exits if some checks fail.

Thanks,
Kevin

#5 lore raw
Quoted 5 lines · Kevin
Quoted 4 lines

I'm not sure what the WARN_ON() condition would be. A forceful domain_pause()/vcpu_pause() is a good idea anyway.

-- Keir

Quoted 7 lines

I'm pretty sure that domains will be busy catching up missing ticks and throw warnings after system is waken up. Why should Xen continue the progress even when we're aware the fact that something will be hurted if doing so? Return a error with warning thrown out at least let user know current condition inapproriate for s3 (e.g. some incautious action) who can turn back to normal flow then. This is like normal OS suspend flow which simply exits if some checks fail.

If Xen itself itself is now robust to VCPUs still being runnable/running then I'm fine with warnings only. If Xen isn't, then forceful pausing is still needed (perhaps with some warnings in addition).

-- Keir

#6 lore raw
Quoted 16 lines

From: Keir Fraser [mailto:[email protected]]
Sent: Thursday, November 20, 2008 4:17 PM

Quoted 11 lines · Kevin
Quoted 4 lines

I'm not sure what the WARN_ON() condition would be. A forceful domain_pause()/vcpu_pause() is a good idea anyway.

-- Keir

I'm pretty sure that domains will be busy catching up missing ticks and throw warnings after system is waken up. Why should Xen continue the progress even when we're aware the fact that something will be hurted if doing so? Return a error with warning thrown out at least let user know current condition inapproriate for s3 (e.g. some incautious action) who can turn back to normal flow then.

Quoted 9 lines

This is like

Quoted 1 line

normal OS suspend flow which simply exits if some checks fail.

If Xen itself itself is now robust to VCPUs still being runnable/running
then I'm fine with warnings only. If Xen isn't, then forceful pausing is
still needed (perhaps with some warnings in addition).

what do you mean by "xen itself is robust to..."?

Thanks,
Kevin

#7 lore raw
Quoted 8 lines · Kevin
Quoted 6 lines

If Xen itself itself is now robust to VCPUs still being runnable/running
then I'm fine with warnings only. If Xen isn't, then forceful pausing is
still needed (perhaps with some warnings in addition).

what do you mean by "xen itself is robust to..."?

It used to be the case that Xen CPU hotplug depended on CPUs alreayd being idle. It would just go horribly wrong if non-idle VCPUs were still running.

-- Keir

#8 lore raw
Quoted 11 lines

From: Keir Fraser [mailto:[email protected]]
Sent: Thursday, November 20, 2008 4:52 PM

Quoted 7 lines · Kevin
Quoted 6 lines

If Xen itself itself is now robust to VCPUs still being runnable/running
then I'm fine with warnings only. If Xen isn't, then forceful pausing is
still needed (perhaps with some warnings in addition).

Quoted 7 lines
Quoted 1 line

what do you mean by "xen itself is robust to..."?

It used to be the case that Xen CPU hotplug depended on CPUs alreayd being
idle. It would just go horribly wrong if non-idle VCPUs were still running.

That should be still the current case, and running vcpus will be migrated first before pulling down the CPUs (added by Haitao Shan). So I think we can just return error for S3 case if there're other running vcpus other than dom0's vcpu0.

Thanks,
Kevin

#9 lore raw
In reply to Tian, Kevin
Quoted 12 lines
Quoted 12 lines
Quoted 1 line

"Tian, Kevin" <[email protected]> 20.11.08 03:39 >>>

From: Keir Fraser [mailto:[email protected]]
Sent: Wednesday, November 19, 2008 9:22 PM

Quoted 2 lines · Jan Beulich

The hypervisor appears to make the assumption that all but the vCPU XENPF_enter_acpi_sleep is being called on are down (in 3.2

because the

Quoted 1 line

sender of the event check IPI assumes the remote CPU is

idle, in 3.3 by

Quoted 1 line

and explicit check in __cpu_disable() - here we also have an

Quoted 8 lines
Quoted 2 lines

incorrect

Quoted 1 line

comment stating that this path can only be used when entering S3).

Comment says "Only s3 is using this path", instead of "this path can only be used by s3". :-) At that time cpu online/offline is not supported and thus only s3 is the user on that path. If you look at latest xen upstream with cpu offline support, that comment went away.

But my point is that this is wrong (no matter how it's worded): entering S5 also uses this path, and in that case there's nothing that stops non-current vCPU-s of dom0.

Quoted 12 lines
Quoted 11 lines
Quoted 2 lines

I can't, however, see how this would be guaranteed on the kernel side (and apart from that I don't think the hypervisor should be

dependent on

Quoted 3 lines

kernel behavior here, even if it's dom0). Shouldn't therefore freeze_domains() not only freeze all DomU-s, but also all non-current vCPU-s of Dom0?

Kevin Tian is probably best placed to answer this. I'm happy to see this
added if he agrees.

Quoted 7 lines

Yes, original design depends on cooperation from dom0 kernel ( offline other vcpus) and control panels (send virtual S3 or equivalent suspend command to all domains except dom0). It's expected that adminstrator should request system S3 on top of control panel, instead of accessing raw sysfs interface. Current code gives a final brute-force action to freeze domains. I agree that such guard should be also added to dom0's vcpus if following this policy.

I'll prepare a patch for this then.

Quoted 6 lines

However I'm considering the point whether Xen can simply reject the s3 request, when observing non-current vcpus still alive. Domain can be in trouble if unaware of underlying sleep phase, such time keeping and softlockup warning. More seriously, domain with passthrough devices can't recover device state since it's even not notified to save context. Opinions?

I agree to this. But as per above, S3 (and S4 if ever supported) must be distinguished from S5 in this regard.

Jan

#10 lore raw
Quoted 9 lines · Jan Beulich
Quoted 5 lines

Comment says "Only s3 is using this path", instead of "this path can only be used by s3". :-) At that time cpu online/offline is not supported and thus only s3 is the user on that path. If you look at latest xen upstream with cpu offline support, that comment went away.

But my point is that this is wrong (no matter how it's worded): entering S5 also uses this path, and in that case there's nothing that stops non-current vCPU-s of dom0.

If you're powering off, why does it matter if VCPUs are paused or not?

-- Keir

#11 lore raw
Quoted 9 lines
Quoted 1 line
Quoted 1 line

Keir Fraser <[email protected]> 20.11.08 09:18 >>>

Quoted 6 lines · Jan Beulich
Quoted 5 lines

Comment says "Only s3 is using this path", instead of "this path can only be used by s3". :-) At that time cpu online/offline is not supported and thus only s3 is the user on that path. If you look at latest xen upstream with cpu offline support, that comment went away.

Quoted 5 lines
Quoted 3 lines

But my point is that this is wrong (no matter how it's worded): entering S5 also uses this path, and in that case there's nothing that stops non-current vCPU-s of dom0.

If you're powering off, why does it matter if VCPUs are paused or not?

Because they can prevent the idle vCPU-s from being entered as needed in order to fully bring down pCPU-s. This is what a customer is reporting (on 3.2), prompting the start of this mail thread. And I've too seen occasional problems with pCPU-s going down prior to power off, just not as bad as they do (where things end up in a panic).

Jan

#12 lore raw
Quoted 17 lines

From: Jan Beulich
Sent: Thursday, November 20, 2008 4:31 PM

Quoted 10 lines
Quoted 1 line
Quoted 1 line

Keir Fraser <[email protected]> 20.11.08 09:18 >>>

Quoted 7 lines · Jan Beulich
Quoted 5 lines

Comment says "Only s3 is using this path", instead of "this path can only be used by s3". :-) At that time cpu online/offline is not supported and thus only s3 is the user on that path. If you look at latest xen upstream with cpu offline support, that comment went away.

But my point is that this is wrong (no matter how it's

worded): entering

Quoted 3 lines
Quoted 2 lines

S5 also uses this path, and in that case there's nothing that stops non-current vCPU-s of dom0.

Quoted 9 lines
Quoted 1 line

If you're powering off, why does it matter if VCPUs are paused or not?

Because they can prevent the idle vCPU-s from being entered as needed in order to fully bring down pCPU-s. This is what a customer is reporting
(on 3.2), prompting the start of this mail thread. And I've too seen occasional problems with pCPU-s going down prior to power off, just not as bad as they do (where things end up in a panic).

Well, then probably we need check domains/dom0-vcpus for both, and then only forcefully freeze them for S5.

Thanks,
Kevin

#13 lore raw
In reply to Jan Beulich
Quoted 9 lines

From: Jan Beulich [mailto:[email protected]]
Sent: Thursday, November 20, 2008 4:18 PM

Quoted 6 lines

Comment says "Only s3 is using this path", instead of "this path can only be used by s3". :-) At that time cpu online/offline is not supported and thus only s3 is the user on that path. If you look at latest xen upstream with cpu offline support, that comment went away.

Quoted 4 lines

But my point is that this is wrong (no matter how it's worded): entering
S5 also uses this path, and in that case there's nothing that stops non-current vCPU-s of dom0.

I see. You're right. But that seems not matter as you're doing S5. :-)

Thanks,
Kevin

#14 lore raw
Quoted 7 lines
Quoted 5 lines
Quoted 1 line

"Tian, Kevin" <[email protected]> 20.11.08 09:19 >>>

But my point is that this is wrong (no matter how it's worded): entering
S5 also uses this path, and in that case there's nothing that stops non-current vCPU-s of dom0.

I see. You're right. But that seems not matter as you're doing S5. :-)

See my other reply just sent to Keir's similar question.

Jan

#15 lore raw
In reply to Jan Beulich
Quoted 7 lines

From: Jan Beulich [mailto:[email protected]]
Sent: Thursday, November 20, 2008 4:18 PM

Quoted 5 lines

However I'm considering the point whether Xen can simply reject the s3 request, when observing non-current vcpus still alive. Domain can be in trouble if unaware of underlying sleep phase, such time keeping and softlockup warning. More seriously, domain with passthrough devices can't recover device state since it's even not

Quoted 7 lines

notified to save

Quoted 1 line

context. Opinions?

I agree to this. But as per above, S3 (and S4 if ever supported) must be
distinguished from S5 in this regard.

Why is distinguish required here? You just want a machine poweroff with S5, and it doesn't matter to reuse same main path as S3.

Thanks,
Kevin