Skip to contentSkip to conversation

apm_emulation regression

DISCUSSION Benjamin Herrenschmidt 3 participants 9 messages Dec 12, 2007 – Dec 15, 2007

lore
Share & tools
lore
#0 lore raw

I only just noticed a huge regression that was introduced when we moved PowerPC to the generic APM emulation code instead of our own. I'm in large part to blame since I acked the patch...

Basically, what we lost is the mechanism for notifying user applications and waiting for their ACK before proceeding to system suspend. The new generic code will still do that ... only when the actual suspend request initiates from an APM suspend ioctl.

For any other suspend (via our private PMU ioctl or via the sysfs interface), userspace will -not- be notified.

That basically means X will break. That's why X broke on the latest ubuntu until I whacked some new scripts in them to force console switching, among other things. Possibly other apps that relied on /dev/apm_bios to be notified of system suspend/resume broke as well.

Now the question is that is it still work trying to fix it ? That would probably require APM emulation hooking at a fairly high level into the generic PM code to trigger the signaling & waiting of processes before freeze & device suspend among others...

Cheers,
Ben.

#1 lore raw
Quoted 8 lines · Benjamin Herrenschmidt

I only just noticed a huge regression that was introduced when we moved PowerPC to the generic APM emulation code instead of our own. I'm in large part to blame since I acked the patch...

Basically, what we lost is the mechanism for notifying user applications and waiting for their ACK before proceeding to system suspend. The new generic code will still do that ... only when the actual suspend request initiates from an APM suspend ioctl.

Indeed.

Quoted 2 lines

For any other suspend (via our private PMU ioctl or via the sysfs interface), userspace will -not- be notified.

Right.

Quoted 4 lines

That basically means X will break. That's why X broke on the latest ubuntu until I whacked some new scripts in them to force console switching, among other things. Possibly other apps that relied on /dev/apm_bios to be notified of system suspend/resume broke as well.

Ah. I guess I never noticed because I had the scripts to do console switching all along.

Quoted 4 lines

Now the question is that is it still work trying to fix it ? That would probably require APM emulation hooking at a fairly high level into the generic PM code to trigger the signaling & waiting of processes before freeze & device suspend among others...

Yeah, bit icky... but doable. Rafael, any ideas?

johannes

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

#2 lore raw
Quoted 8 lines
Quoted 5 lines

That basically means X will break. That's why X broke on the latest ubuntu until I whacked some new scripts in them to force console switching, among other things. Possibly other apps that relied on /dev/apm_bios to be notified of system suspend/resume broke as well.

Ah. I guess I never noticed because I had the scripts to do console switching all along.

Actually, it just occurred to me that the *kernel* does a console switch when we use /sys/power/state, so maybe that is why I never had a problem rather than userspace doing a console switch (which it only started doing very recently)

johannes

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

#3 lore raw
Quoted 5 lines · Johannes Berg
Quoted 5 lines
Quoted 4 lines

That basically means X will break. That's why X broke on the latest ubuntu until I whacked some new scripts in them to force console switching, among other things. Possibly other apps that relied on /dev/apm_bios to be notified of system suspend/resume broke as well.

Quoted 7 lines
Quoted 2 lines

Ah. I guess I never noticed because I had the scripts to do console switching all along.

Actually, it just occurred to me that the *kernel* does a console switch when we use /sys/power/state, so maybe that is why I never had a problem rather than userspace doing a console switch (which it only started doing very recently)

The kernel console switching can be disabled and -is- by some distros. For example, the problem I was having was when testing Gutsy before it was final, the script to console switch wasn't in the right place for powermac and didn't work. X wouldn't be suspended properly and the machine would lockup.

In general, we should try to fix that, as other things might rely on /dev/apm_bios doing the right thing.

Ben.

#4 lore raw
In reply to Johannes Berg
Quoted 26 lines · Johannes Berg
Quoted 8 lines · Benjamin Herrenschmidt

I only just noticed a huge regression that was introduced when we moved PowerPC to the generic APM emulation code instead of our own. I'm in large part to blame since I acked the patch...

Basically, what we lost is the mechanism for notifying user applications and waiting for their ACK before proceeding to system suspend. The new generic code will still do that ... only when the actual suspend request initiates from an APM suspend ioctl.

Indeed.

Quoted 2 lines

For any other suspend (via our private PMU ioctl or via the sysfs interface), userspace will -not- be notified.

Right.

Quoted 4 lines

That basically means X will break. That's why X broke on the latest ubuntu until I whacked some new scripts in them to force console switching, among other things. Possibly other apps that relied on /dev/apm_bios to be notified of system suspend/resume broke as well.

Ah. I guess I never noticed because I had the scripts to do console switching all along.

Quoted 6 lines
Quoted 4 lines

Now the question is that is it still work trying to fix it ? That would probably require APM emulation hooking at a fairly high level into the generic PM code to trigger the signaling & waiting of processes before freeze & device suspend among others...

Yeah, bit icky... but doable. Rafael, any ideas?

Hmm.

I'm not that familiar with the APM emulation code, but the description of the problem above suggests that the APM emulation can install a suspend notifier for this purpose.

Greetings,
Rafael

#5 lore raw
Quoted 7 lines · Rafael J. Wysocki

Hmm.

I'm not that familiar with the APM emulation code, but the description of the
problem above suggests that the APM emulation can install a suspend notifier for this purpose.

It can use the new notifier that happens before freezing yes. Johannes, I think that's pretty much what my old powermac implementation did (using my private notifier scheme I had there), might be worth reviving that bit and sticking it into the generic apm_emu ...

Ben.

#6 lore raw
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 7 lines · Rafael J. Wysocki

Hmm.

I'm not that familiar with the APM emulation code, but the description of the
problem above suggests that the APM emulation can install a suspend notifier for this purpose.

Quoted 4 lines

It can use the new notifier that happens before freezing yes. Johannes, I think that's pretty much what my old powermac implementation did (using my private notifier scheme I had there), might be worth reviving that bit and sticking it into the generic apm_emu ...

Note that you may want to improve on it with a timeout in case userspace doesn't ack...

Ben.

#7 lore raw
Quoted 8 lines
Quoted 5 lines

It can use the new notifier that happens before freezing yes. Johannes, I think that's pretty much what my old powermac implementation did (using my private notifier scheme I had there), might be worth reviving that bit and sticking it into the generic apm_emu ...

Note that you may want to improve on it with a timeout in case userspace doesn't ack...

Yeah heh. I'll take a look, shouldn't be too hard. Except I'm not exactly sure how to test it.

johannes

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

#8 lore raw
Quoted 11 lines · Johannes Berg
Quoted 8 lines
Quoted 5 lines

It can use the new notifier that happens before freezing yes. Johannes, I think that's pretty much what my old powermac implementation did (using my private notifier scheme I had there), might be worth reviving that bit and sticking it into the generic apm_emu ...

Note that you may want to improve on it with a timeout in case userspace doesn't ack...

Yeah heh. I'll take a look, shouldn't be too hard. Except I'm not exactly sure how to test it.

Create an artificially malicious application? ;-)

Rafael