Automatic suspend
Hi,
The recent descussion about the Android PM patches sent by Arve shows that there is a need to introduce a mechanism allowing us to:
(1) automatically put the system as a whole into a sleep state (eg. suspend to RAM) when it is found to be "idle", where the meaning of "idle" has to be defined too,
(2) put given subset of devices into low power states whenever they are not used, without putting the entire system into a sleep state.
To allow these two things to happen, the Andriod patches introduced the wakelocks with the associated infrastructure and the "early suspend" mechanism. However, quite a number of reviewers did not like these patches, for various reasons, so they cannot be regarded as generally acceptable. For this reason, I think, we should discuss the problem in detail from the beginning and try to find a solution that everyone interested will be comfortable with.
For this purpose, IMO, we should at least reach an agreement on what the kernel's and the userland's roles in (1) and (2) are going to be. There also are quite a few questions that need to be answered. For instance, what conditions are going to be used to decide whether or not the system is idle enough so that we can put it into a sleep state? How are we going to check these conditions? What is going to happen if one (or more) of them changes while a system-wide power transition (eg. suspend) is in progress? Are we going to allow the user space to take part in this and if so, to what extent? What mechanisms are going be used to put devices into low power states at run time (ie. before starting any system-wide power transition) and how are they going to be related to the suspend-resume infrastructure used during system-wide power transitions? The answers to these (and other related) questions will likely affect all of the future Linux PM developlent, so IMO this is a very important matter.
Opinions and comments welcome.
Thanks,
Rafael
Quoted 9 lines · On Mon, 16 Feb 2009 00:10:15 +0100 "Rafael J. Wysocki" <[email protected]> wrote:
Hi,
The recent descussion about the Android PM patches sent by Arve shows that there is a need to introduce a mechanism allowing us to:
(1) automatically put the system as a whole into a sleep state (eg. suspend to RAM) when it is found to be "idle", where the meaning of "idle" has to be defined too,
(2) put given subset of devices into low power states whenever they are not used, without putting the entire system into a sleep state.
For (2), for me the answer is very obvious:
The Device Driver needs to make the decision to put the device to sleep. There are no ifs and buts about this.
It's the driver who
a) knows if there's any activity, such as open users and
b) is in the right position to know how to put things to sleep.
Of course, the subsystem the driver belongs to can provide helpers (such as generic activity timeout handlers etc).
For many cases, the drivers do this today already.
There are cases where doing this has side effects, mostly in terms of latency. It is reasonable to have a general mechanism that provides a central mechanism to track tolerable latencies; in fact PMQOS provides this on a high level, and I can imagine that PMQOS needs to be extended to provide a wider range of type of latencies.
Userland should never ever control the state of a device like this directly. It should do so by a) closing the device and b) setting latency / functional requirements.
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 9 lines · On Mon, 16 Feb 2009 00:10:15 +0100 "Rafael J. Wysocki" <[email protected]> wrote:
Hi,
The recent descussion about the Android PM patches sent by Arve shows that there is a need to introduce a mechanism allowing us to:
(1) automatically put the system as a whole into a sleep state (eg. suspend to RAM) when it is found to be "idle", where the meaning of "idle" has to be defined too,
(2) put given subset of devices into low power states whenever they are not used, without putting the entire system into a sleep state.
For (2), for me the answer is very obvious:
The Device Driver needs to make the decision to put the device to sleep. There are no ifs and buts about this.
It's the driver who
a) knows if there's any activity, such as open users and
b) is in the right position to know how to put things to sleep.
Of course, the subsystem the driver belongs to can provide helpers (such as generic activity timeout handlers etc).
For many cases, the drivers do this today already.
There are cases where doing this has side effects, mostly in terms of latency. It is reasonable to have a general mechanism that provides a central mechanism to track tolerable latencies; in fact PMQOS provides this on a high level, and I can imagine that PMQOS needs to be extended to provide a wider range of type of latencies.
Userland should never ever control the state of a device like this directly. It should do so by a) closing the device and b) setting latency / functional requirements.
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 14 lines · Arjan van de Ven
Quoted 9 lines · On Mon, 16 Feb 2009 00:10:15 +0100 "Rafael J. Wysocki" <[email protected]> wrote:
Hi,
The recent descussion about the Android PM patches sent by Arve shows that there is a need to introduce a mechanism allowing us to:
(1) automatically put the system as a whole into a sleep state (eg. suspend to RAM) when it is found to be "idle", where the meaning of "idle" has to be defined too,
(2) put given subset of devices into low power states whenever they are not used, without putting the entire system into a sleep state.
Quoted 1 line
For (2), for me the answer is very obvious:
.../...
I agree with pretty much everything Arjan wrote here.
Quoted 3 lines
Userland should never ever control the state of a device like this directly. It should do so by a) closing the device and b) setting latency / functional requirements
With the possible exception of things like wifi/bt killswitch or network or similar where the driver cannot shut the device down without losing the ability to detect activity (ie, switch your PHY off is nice but you lose the ability to monitor the link for example).
Cheers,
Ben.
Quoted 14 lines · Arjan van de Ven
Quoted 9 lines · On Mon, 16 Feb 2009 00:10:15 +0100 "Rafael J. Wysocki" <[email protected]> wrote:
Hi,
The recent descussion about the Android PM patches sent by Arve shows that there is a need to introduce a mechanism allowing us to:
(1) automatically put the system as a whole into a sleep state (eg. suspend to RAM) when it is found to be "idle", where the meaning of "idle" has to be defined too,
(2) put given subset of devices into low power states whenever they are not used, without putting the entire system into a sleep state.
Quoted 1 line
For (2), for me the answer is very obvious:
.../...
I agree with pretty much everything Arjan wrote here.
Quoted 3 lines
Userland should never ever control the state of a device like this directly. It should do so by a) closing the device and b) setting latency / functional requirements
With the possible exception of things like wifi/bt killswitch or network or similar where the driver cannot shut the device down without losing the ability to detect activity (ie, switch your PHY off is nice but you lose the ability to monitor the link for example).
Cheers,
Ben.
Quoted 20 lines · On Mon, 16 Feb 2009 13:12:40 +1100 Benjamin Herrenschmidt…
Quoted 15 lines · Arjan van de Ven
Quoted 10 lines · On Mon, 16 Feb 2009 00:10:15 +0100 "Rafael J. Wysocki" <[email protected]> wrote:
Hi,
The recent descussion about the Android PM patches sent by Arve shows that there is a need to introduce a mechanism allowing us
to: (1) automatically put the system as a whole into a sleep state (eg. suspend to RAM) when it is found to be "idle", where the meaning of "idle" has to be defined too,
(2) put given subset of devices into low power states whenever they are not used, without putting the entire system into a sleep state.Quoted 1 line
For (2), for me the answer is very obvious:
.../...
Quoted 7 lines
I agree with pretty much everything Arjan wrote here.
Quoted 3 lines
Userland should never ever control the state of a device like this directly. It should do so by a) closing the device and b) setting latency / functional requirements
With the possible exception of things like wifi/bt killswitch
this is a functional switch; but yeah it is a little bit of an odd-one out. rfkill is also not REALLY for power, it's more for FAA stuff.
Quoted 4 lines
or
network or similar where the driver cannot shut the device down without losing the ability to detect activity (ie, switch your PHY off is nice but you lose the ability to monitor the link for example).
what this needs is a separation between "interface down, all off" and "interface down enough so that link detection works".
Some NICs can go all the way down and still do link detection, others cannot. This is obviously something the driver will know, nothing else in the system should know.
Quoted 4 lines
Cheers,
Ben.
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 20 lines · On Mon, 16 Feb 2009 13:12:40 +1100 Benjamin Herrenschmidt…
Quoted 15 lines · Arjan van de Ven
Quoted 10 lines · On Mon, 16 Feb 2009 00:10:15 +0100 "Rafael J. Wysocki" <[email protected]> wrote:
Hi,
The recent descussion about the Android PM patches sent by Arve shows that there is a need to introduce a mechanism allowing us
to: (1) automatically put the system as a whole into a sleep state (eg. suspend to RAM) when it is found to be "idle", where the meaning of "idle" has to be defined too,
(2) put given subset of devices into low power states whenever they are not used, without putting the entire system into a sleep state.Quoted 1 line
For (2), for me the answer is very obvious:
.../...
Quoted 7 lines
I agree with pretty much everything Arjan wrote here.
Quoted 3 lines
Userland should never ever control the state of a device like this directly. It should do so by a) closing the device and b) setting latency / functional requirements
With the possible exception of things like wifi/bt killswitch
this is a functional switch; but yeah it is a little bit of an odd-one out. rfkill is also not REALLY for power, it's more for FAA stuff.
Quoted 4 lines
or
network or similar where the driver cannot shut the device down without losing the ability to detect activity (ie, switch your PHY off is nice but you lose the ability to monitor the link for example).
what this needs is a separation between "interface down, all off" and "interface down enough so that link detection works".
Some NICs can go all the way down and still do link detection, others cannot. This is obviously something the driver will know, nothing else in the system should know.
Quoted 4 lines
Cheers,
Ben.
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 5 lines · Arjan van de Ven
what this needs is a separation between "interface down, all off" and "interface down enough so that link detection works".
Some NICs can go all the way down and still do link detection, others cannot. This is obviously something the driver will know, nothing else in the system should know.
Sure, my point was just that the driver cannot make the decision to go all-off (and thus not detect link) without some kind of user setting allowing it to do so.
Cheers,
Ben.
Quoted 5 lines · Arjan van de Ven
what this needs is a separation between "interface down, all off" and "interface down enough so that link detection works".
Some NICs can go all the way down and still do link detection, others cannot. This is obviously something the driver will know, nothing else in the system should know.
Sure, my point was just that the driver cannot make the decision to go all-off (and thus not detect link) without some kind of user setting allowing it to do so.
Cheers,
Ben.
Quoted 10 lines · On Mon, 16 Feb 2009 14:23:41 +1100 Benjamin Herrenschmidt…
Quoted 5 lines · Arjan van de Ven
what this needs is a separation between "interface down, all off" and "interface down enough so that link detection works". Some NICs can go all the way down and still do link detection, others cannot. This is obviously something the driver will know, nothing else in the system should know.
Sure, my point was just that the driver cannot make the decision to go all-off (and thus not detect link) without some kind of user setting allowing it to do so.
to a very large degree, "want linkdetection" is a form of keeping the device open.. even if the current code doesn't quite work that way (maybe it should)
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 10 lines · On Mon, 16 Feb 2009 14:23:41 +1100 Benjamin Herrenschmidt…
Quoted 5 lines · Arjan van de Ven
what this needs is a separation between "interface down, all off" and "interface down enough so that link detection works". Some NICs can go all the way down and still do link detection, others cannot. This is obviously something the driver will know, nothing else in the system should know.
Sure, my point was just that the driver cannot make the decision to go all-off (and thus not detect link) without some kind of user setting allowing it to do so.
to a very large degree, "want linkdetection" is a form of keeping the device open.. even if the current code doesn't quite work that way (maybe it should)
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 5 lines · Arjan van de Ven
what this needs is a separation between "interface down, all off" and "interface down enough so that link detection works".
Some NICs can go all the way down and still do link detection, others cannot. This is obviously something the driver will know, nothing else in the system should know.Sure, my point was just that the driver cannot make the decision to go all-off (and thus not detect link) without some kind of user setting allowing it to do so.
Maybe we need ifconfig eth0 reallyreallydown ?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 5 lines · Arjan van de Ven
what this needs is a separation between "interface down, all off" and "interface down enough so that link detection works".
Some NICs can go all the way down and still do link detection, others cannot. This is obviously something the driver will know, nothing else in the system should know.Sure, my point was just that the driver cannot make the decision to go all-off (and thus not detect link) without some kind of user setting allowing it to do so.
Maybe we need ifconfig eth0 reallyreallydown ?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Am Monday 16 February 2009 03:20:12 schrieb Arjan van de Ven:
Quoted 10 lines
Quoted 4 lines
or
network or similar where the driver cannot shut the device down without losing the ability to detect activity (ie, switch your PHY off is nice but you lose the ability to monitor the link for example).what this needs is a separation between "interface down, all off" and "interface down enough so that link detection works".
Some NICs can go all the way down and still do link detection, others cannot. This is obviously something the driver will know, nothing else in the system should know.
Why shouldn't user space know the consequences of still requesting a service and be able to decide on that basis which services to request?
Regards
Oliver
Quoted 13 lines · On Mon, 16 Feb 2009 08:06:13 +0100 Oliver Neukum <[email protected]> wrote:
Am Monday 16 February 2009 03:20:12 schrieb Arjan van de Ven:
Quoted 11 lines
Quoted 5 lines
or
network or similar where the driver cannot shut the device down without losing the ability to detect activity (ie, switch your PHY off is nice but you lose the ability to monitor the link for example).what this needs is a separation between "interface down, all off" and "interface down enough so that link detection works". Some NICs can go all the way down and still do link detection, others cannot. This is obviously something the driver will know, nothing else in the system should know.
Quoted 3 lines
Why shouldn't user space know the consequences of still requesting a service and be able to decide on that basis which services to request?
That's not what I said. Userspace should not be the part that goes "oh this is a realtek not an intel nic, so ..."
That is the drivers job.
Userspace should just be the part that says "I'm interested in link notifications". The driver then just goes to the lowest power state for its device that still gives those notifications.
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 13 lines · On Mon, 16 Feb 2009 08:06:13 +0100 Oliver Neukum <[email protected]> wrote:
Am Monday 16 February 2009 03:20:12 schrieb Arjan van de Ven:
Quoted 11 lines
Quoted 5 lines
or
network or similar where the driver cannot shut the device down without losing the ability to detect activity (ie, switch your PHY off is nice but you lose the ability to monitor the link for example).what this needs is a separation between "interface down, all off" and "interface down enough so that link detection works". Some NICs can go all the way down and still do link detection, others cannot. This is obviously something the driver will know, nothing else in the system should know.
Quoted 3 lines
Why shouldn't user space know the consequences of still requesting a service and be able to decide on that basis which services to request?
That's not what I said. Userspace should not be the part that goes "oh this is a realtek not an intel nic, so ..."
That is the drivers job.
Userspace should just be the part that says "I'm interested in link notifications". The driver then just goes to the lowest power state for its device that still gives those notifications.
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Am Monday 16 February 2009 16:40:48 schrieb Arjan van de Ven:
Quoted 7 lines
Quoted 3 lines
Why shouldn't user space know the consequences of still requesting a service and be able to decide on that basis which services to request?
That's not what I said. Userspace should not be the part that goes "oh this is a realtek not an intel nic, so ..."
That is the drivers job.
True.
Quoted 3 lines
Userspace should just be the part that says "I'm interested in link notifications". The driver then just goes to the lowest power state for its device that still gives those notifications.
Should there be a channel through which drivers can tell user space what the consequences in terms of reaching a sleep state are if a service is requested?
Regards
Oliver
Quoted 7 lines · On Mon, 16 Feb 2009 17:48:06 +0100 Oliver Neukum <[email protected]> wrote:
Quoted 3 lines
Userspace should just be the part that says "I'm interested in link notifications". The driver then just goes to the lowest power state for its device that still gives those notifications.
Should there be a channel through which drivers can tell user space what the consequences in terms of reaching a sleep state are if a service is requested?
Personally, I don't think so.
Think about it: what would userspace do?
Not ask for the functionality if it means no sleep state? Maybe it should just never ask for it then as a required functionality!
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 7 lines · On Mon, 16 Feb 2009 17:48:06 +0100 Oliver Neukum <[email protected]> wrote:
Quoted 3 lines
Userspace should just be the part that says "I'm interested in link notifications". The driver then just goes to the lowest power state for its device that still gives those notifications.
Should there be a channel through which drivers can tell user space what the consequences in terms of reaching a sleep state are if a service is requested?
Personally, I don't think so.
Think about it: what would userspace do?
Not ask for the functionality if it means no sleep state? Maybe it should just never ask for it then as a required functionality!
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 9 lines · Arjan van de Ven
Quoted 3 lines · On Mon, 16 Feb 2009 17:48:06 +0100 Oliver Neukum <[email protected]> wrote:
Should there be a channel through which drivers can tell user space what the consequences in terms of reaching a sleep state are if a service is requested?
Personally, I don't think so.
Think about it: what would userspace do?
Not ask for the functionality if it means no sleep state? Maybe it should just never ask for it then as a required functionality!
Userspace may not have a useful decision-making capability regarding functionality versus power-saving, but the user it's talking to might!
I think it would be very useful to have a mechanism for userspace to find out "Link detection on this NIC costs ~50mW" and "No link has been detected for the last 15 minutes", so that it can compile all that sort of information and prompt the user what devices they would like to disable. Perhaps an "airline mode" sort of thing?
Cheers,
Kyle Moffett
Quoted 9 lines · Arjan van de Ven
Quoted 3 lines · On Mon, 16 Feb 2009 17:48:06 +0100 Oliver Neukum <[email protected]> wrote:
Should there be a channel through which drivers can tell user space what the consequences in terms of reaching a sleep state are if a service is requested?
Personally, I don't think so.
Think about it: what would userspace do?
Not ask for the functionality if it means no sleep state? Maybe it should just never ask for it then as a required functionality!
Userspace may not have a useful decision-making capability regarding functionality versus power-saving, but the user it's talking to might!
I think it would be very useful to have a mechanism for userspace to find out "Link detection on this NIC costs ~50mW" and "No link has been detected for the last 15 minutes", so that it can compile all that sort of information and prompt the user what devices they would like to disable. Perhaps an "airline mode" sort of thing?
Cheers,
Kyle Moffett
Quoted 5 lines · On Mon, 16 Feb 2009 15:08:09 -0500 Kyle Moffett <[email protected]> wrote:
I think it would be very useful to have a mechanism for userspace to find out "Link detection on this NIC costs ~50mW" and "No link has been detected for the last 15 minutes", so that it can compile all that sort of information and prompt the user what devices they would like to disable. Perhaps an "airline mode" sort of thing
modes suck... they're very much the wrong concept for power management (but that's a different story)
if the user (or something on its behalf) doesn't need link detection, he can turn it off. Really. He doesn't need to know that maybe on machine one this saves some power, and on machine two that power was already mostly saved while on machine three it doesn't save anything at all. Not to mention that the driver is extremely unlikely to know how much actual power will be saved...
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 5 lines · On Mon, 16 Feb 2009 15:08:09 -0500 Kyle Moffett <[email protected]> wrote:
I think it would be very useful to have a mechanism for userspace to find out "Link detection on this NIC costs ~50mW" and "No link has been detected for the last 15 minutes", so that it can compile all that sort of information and prompt the user what devices they would like to disable. Perhaps an "airline mode" sort of thing
modes suck... they're very much the wrong concept for power management (but that's a different story)
if the user (or something on its behalf) doesn't need link detection, he can turn it off. Really. He doesn't need to know that maybe on machine one this saves some power, and on machine two that power was already mostly saved while on machine three it doesn't save anything at all. Not to mention that the driver is extremely unlikely to know how much actual power will be saved...
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 8 lines · Kyle Moffett
Userspace may not have a useful decision-making capability regarding functionality versus power-saving, but the user it's talking to might!
I think it would be very useful to have a mechanism for userspace to find out "Link detection on this NIC costs ~50mW" and "No link has been detected for the last 15 minutes", so that it can compile all that sort of information and prompt the user what devices they would like to disable. Perhaps an "airline mode" sort of thing?
Even if drivers don't know how much power their devices consume (and generally I wouldn't expect them to), it still makes sense to offer userspace the discretionary power to force devices into a low-power mode. USB does this.
Alan Stern
Quoted 8 lines · Kyle Moffett
Userspace may not have a useful decision-making capability regarding functionality versus power-saving, but the user it's talking to might!
I think it would be very useful to have a mechanism for userspace to find out "Link detection on this NIC costs ~50mW" and "No link has been detected for the last 15 minutes", so that it can compile all that sort of information and prompt the user what devices they would like to disable. Perhaps an "airline mode" sort of thing?
Even if drivers don't know how much power their devices consume (and generally I wouldn't expect them to), it still makes sense to offer userspace the discretionary power to force devices into a low-power mode. USB does this.
Alan Stern
Quoted 12 lines · On Mon, 16 Feb 2009 15:39:15 -0500 (EST) Alan Stern…
Quoted 9 lines · Kyle Moffett
Userspace may not have a useful decision-making capability regarding functionality versus power-saving, but the user it's talking to might!
I think it would be very useful to have a mechanism for userspace to find out "Link detection on this NIC costs ~50mW" and "No link has been detected for the last 15 minutes", so that it can compile all that sort of information and prompt the user what devices they would like to disable. Perhaps an "airline mode" sort of thing?
Quoted 4 lines
Even if drivers don't know how much power their devices consume (and generally I wouldn't expect them to), it still makes sense to offer userspace the discretionary power to force devices into a low-power mode. USB does this.
"stop using it" isn't this discretionary power ?
(for NICs this is "ifconfig .. down")
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 12 lines · On Mon, 16 Feb 2009 15:39:15 -0500 (EST) Alan Stern…
Quoted 9 lines · Kyle Moffett
Userspace may not have a useful decision-making capability regarding functionality versus power-saving, but the user it's talking to might!
I think it would be very useful to have a mechanism for userspace to find out "Link detection on this NIC costs ~50mW" and "No link has been detected for the last 15 minutes", so that it can compile all that sort of information and prompt the user what devices they would like to disable. Perhaps an "airline mode" sort of thing?
Quoted 4 lines
Even if drivers don't know how much power their devices consume (and generally I wouldn't expect them to), it still makes sense to offer userspace the discretionary power to force devices into a low-power mode. USB does this.
"stop using it" isn't this discretionary power ?
(for NICs this is "ifconfig .. down")
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 19 lines
From: Arjan van de Ven [mailto:[email protected]]
Sent: Monday, February 16, 2009 2:45 PMQuoted 12 lines · On Mon, 16 Feb 2009 15:39:15 -0500 (EST) Alan Stern…
Quoted 9 lines · Kyle Moffett
Userspace may not have a useful decision-making capability regarding functionality versus power-saving, but the user it's talking to might!
I think it would be very useful to have a mechanism for userspace to find out "Link detection on this NIC costs ~50mW" and "No link has been detected for the last 15 minutes", so that it can compile all that sort of information and prompt the user what devices they would like to disable. Perhaps an "airline mode" sort of thing?
Quoted 7 lines
Quoted 4 lines
Even if drivers don't know how much power their devices consume (and generally I wouldn't expect them to), it still makes sense to offer userspace the discretionary power to force devices into a low-power mode. USB does this.
"stop using it" isn't this discretionary power ?
(for NICs this is "ifconfig .. down")
Allowing a trusted user space process some hook in kernel PM has turned out useful for us.
- It gives a way for frame works which load codecs into DSPs a way to specify needs before loading. The DSP has its own internal dynamic predictor but it is not always good enough. Feeding this info in from user space is easy as it knows everything about the DSP algorithm it is loading. There isn't a reason to re-export all of that back into the kernel and might hurt DSP performance if it ran on it natively.
- It provides a way to handle overdrive/turbo operating points out of band from the generically tuned cpufreq governors like ondemand. The way we characterize overdrive is stricter then what Intel has talked about for x86.
In TI-reference code we effectively export sysfs knobs which influence system p-state and c-state choices (we borrowed Intel terms here as they are useful). This was done before pmqos was available. We would have considered extending pmqos but a couple things stopped this. One being it wasn't in kernel at the time and two being any change picks up a year of disagreements. As such we put some front end wrappers on the calls which use it to some degree.
There is a community-reference targeting kernel merging but I think it is only now reaching the point of the user space interface. People working there have expressed interest in a direct pmqos interface and removing our wrapping calls.
What we have done more follows what happens when you have a complex driver/subsystem which has pieces in both users and kernel space. It works ok for this.
This is ok for making sure the complex driver works well. It doesn't address all the other user space things going on which also need some kind of management so they don't sink system power. This is where wakelocks start to do something more generically useful.
Right now it seems no one is willing to own the whole system. It is easier to just say user space sucks and someone else should fix it...or my driver is fine it is someone else's problem. However, by not giving some kind of useful constraints interface to help control bad (or uncontrollable) elements the end result are non-competitive Linux systems or ugly out of tree vendor hacks. This is where wakelocks actually stand out. They actually try and do something useful generically.
It seems the perfect is often the enemy of the good when it comes to Linux PM discussions.
Regards,
Richard W.
Quoted 19 lines
From: Arjan van de Ven [mailto:[email protected]]
Sent: Monday, February 16, 2009 2:45 PMQuoted 12 lines · On Mon, 16 Feb 2009 15:39:15 -0500 (EST) Alan Stern…
Quoted 9 lines · Kyle Moffett
Userspace may not have a useful decision-making capability regarding functionality versus power-saving, but the user it's talking to might!
I think it would be very useful to have a mechanism for userspace to find out "Link detection on this NIC costs ~50mW" and "No link has been detected for the last 15 minutes", so that it can compile all that sort of information and prompt the user what devices they would like to disable. Perhaps an "airline mode" sort of thing?
Quoted 7 lines
Quoted 4 lines
Even if drivers don't know how much power their devices consume (and generally I wouldn't expect them to), it still makes sense to offer userspace the discretionary power to force devices into a low-power mode. USB does this.
"stop using it" isn't this discretionary power ?
(for NICs this is "ifconfig .. down")
Allowing a trusted user space process some hook in kernel PM has turned out useful for us.
- It gives a way for frame works which load codecs into DSPs a way to specify needs before loading. The DSP has its own internal dynamic predictor but it is not always good enough. Feeding this info in from user space is easy as it knows everything about the DSP algorithm it is loading. There isn't a reason to re-export all of that back into the kernel and might hurt DSP performance if it ran on it natively.
- It provides a way to handle overdrive/turbo operating points out of band from the generically tuned cpufreq governors like ondemand. The way we characterize overdrive is stricter then what Intel has talked about for x86.
In TI-reference code we effectively export sysfs knobs which influence system p-state and c-state choices (we borrowed Intel terms here as they are useful). This was done before pmqos was available. We would have considered extending pmqos but a couple things stopped this. One being it wasn't in kernel at the time and two being any change picks up a year of disagreements. As such we put some front end wrappers on the calls which use it to some degree.
There is a community-reference targeting kernel merging but I think it is only now reaching the point of the user space interface. People working there have expressed interest in a direct pmqos interface and removing our wrapping calls.
What we have done more follows what happens when you have a complex driver/subsystem which has pieces in both users and kernel space. It works ok for this.
This is ok for making sure the complex driver works well. It doesn't address all the other user space things going on which also need some kind of management so they don't sink system power. This is where wakelocks start to do something more generically useful.
Right now it seems no one is willing to own the whole system. It is easier to just say user space sucks and someone else should fix it...or my driver is fine it is someone else's problem. However, by not giving some kind of useful constraints interface to help control bad (or uncontrollable) elements the end result are non-competitive Linux systems or ugly out of tree vendor hacks. This is where wakelocks actually stand out. They actually try and do something useful generically.
It seems the perfect is often the enemy of the good when it comes to Linux PM discussions.
Regards,
Richard W.
Quoted 5 lines · Richard
- It provides a way to handle overdrive/turbo operating points out of band from the generically tuned cpufreq governors like ondemand. The way we characterize overdrive is stricter then what Intel has talked about for x86.
if you have an improved-for-your-systems governor then I'm sure that is very welcome in the kernel.
I agree that perfect is the enemy of good.
I think just about all of us agree that the final decision needs to be in the driver (possibly followed by something that gets various device requests and combines it into hw settings); we're just talking about what inputs feed into that decision ;)
And for different types of devices that's guaranteed to be different... and sometimes we'll be hampered by existing interfaces, so we might end up with hacky stuff.
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 5 lines · Richard
- It provides a way to handle overdrive/turbo operating points out of band from the generically tuned cpufreq governors like ondemand. The way we characterize overdrive is stricter then what Intel has talked about for x86.
if you have an improved-for-your-systems governor then I'm sure that is very welcome in the kernel.
I agree that perfect is the enemy of good.
I think just about all of us agree that the final decision needs to be in the driver (possibly followed by something that gets various device requests and combines it into hw settings); we're just talking about what inputs feed into that decision ;)
And for different types of devices that's guaranteed to be different... and sometimes we'll be hampered by existing interfaces, so we might end up with hacky stuff.
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 6 lines
From: Arjan van de Ven [mailto:[email protected]]
Sent: Monday, February 16, 2009 3:52 PMQuoted 1 line · Richard
Quoted 7 lines
Quoted 4 lines
- It provides a way to handle overdrive/turbo operating points out of band from the generically tuned cpufreq governors like ondemand. The way we characterize overdrive is stricter then what Intel has talked about for x86.
if you have an improved-for-your-systems governor then I'm sure that is very welcome in the kernel.
No, the generic governors were not substantially improved. Not every customer is using cpufreq for DVFS. As such we went underneath it. If we had more community presence at the start time we might have also tried that.
Quoted 8 lines
I think just about all of us agree that the final decision needs to be in the driver (possibly followed by something that gets various device requests and combines it into hw settings); we're just talking about what inputs feed into that decision ;)
And for different types of devices that's guaranteed to be different... and sometimes we'll be hampered by existing interfaces, so we might end up with hacky stuff.
Is there some kind of roadmap which can be plotted which goes from course to more granular control?
Phase 1 (all or nothing): like wakelocks (minus back light): system-auto-suspend-on, system-auto-suspend-off. The drivers can still veto as they do today.
Phase 2: Subsystem generic tunable, on say latency + bandwidth. Start with CPU then move to classes like USB.
Phase 3: ??? if needed add direct device control, hints on an extended fadvise(), and explicit control left to open/close and direct ioctls?
I don't know that 1,2,3 above even make sense. However, the notion of actually plotting out a course with goals does as it will take a long time and it is good to get some benefit along the way.
Thanks,
Richard W.
Quoted 6 lines
From: Arjan van de Ven [mailto:[email protected]]
Sent: Monday, February 16, 2009 3:52 PMQuoted 1 line · Richard
Quoted 7 lines
Quoted 4 lines
- It provides a way to handle overdrive/turbo operating points out of band from the generically tuned cpufreq governors like ondemand. The way we characterize overdrive is stricter then what Intel has talked about for x86.
if you have an improved-for-your-systems governor then I'm sure that is very welcome in the kernel.
No, the generic governors were not substantially improved. Not every customer is using cpufreq for DVFS. As such we went underneath it. If we had more community presence at the start time we might have also tried that.
Quoted 8 lines
I think just about all of us agree that the final decision needs to be in the driver (possibly followed by something that gets various device requests and combines it into hw settings); we're just talking about what inputs feed into that decision ;)
And for different types of devices that's guaranteed to be different... and sometimes we'll be hampered by existing interfaces, so we might end up with hacky stuff.
Is there some kind of roadmap which can be plotted which goes from course to more granular control?
Phase 1 (all or nothing): like wakelocks (minus back light): system-auto-suspend-on, system-auto-suspend-off. The drivers can still veto as they do today.
Phase 2: Subsystem generic tunable, on say latency + bandwidth. Start with CPU then move to classes like USB.
Phase 3: ??? if needed add direct device control, hints on an extended fadvise(), and explicit control left to open/close and direct ioctls?
I don't know that 1,2,3 above even make sense. However, the notion of actually plotting out a course with goals does as it will take a long time and it is good to get some benefit along the way.
Thanks,
Richard W.
Quoted 31 lines · Richard
Quoted 6 lines
From: Arjan van de Ven [mailto:[email protected]]
Sent: Monday, February 16, 2009 3:52 PMQuoted 1 line · Richard
Quoted 7 lines
Quoted 4 lines
- It provides a way to handle overdrive/turbo operating points out of band from the generically tuned cpufreq governors like ondemand. The way we characterize overdrive is stricter then what Intel has talked about for x86.
if you have an improved-for-your-systems governor then I'm sure that is very welcome in the kernel.
No, the generic governors were not substantially improved. Not every customer is using cpufreq for DVFS. As such we went underneath it. If we had more community presence at the start time we might have also tried that.
Quoted 8 lines
I think just about all of us agree that the final decision needs to be in the driver (possibly followed by something that gets various device requests and combines it into hw settings); we're just talking about what inputs feed into that decision ;)
And for different types of devices that's guaranteed to be different... and sometimes we'll be hampered by existing interfaces, so we might end up with hacky stuff.
Is there some kind of roadmap which can be plotted which goes from course to more granular control?
Quoted 6 lines
Phase 1 (all or nothing): like wakelocks (minus back light):
system-auto-suspend-on, system-auto-suspend-off. The drivers can still veto as they do today.Phase 2: Subsystem generic tunable, on say latency + bandwidth. Start with CPU then move to classes like USB.
I think your phases are the wrong way around.
Phase 2 is already in progress and many of the "good" drivers and subsystems already do them.
Whole system suspend is a much more drastic thing; I don't see that happen generically in 2009 to be honest (not to mention how fragile linux suspend is). In addition, in hardware there does seem to be the trend where idle and suspend are converging (just look at the OLPC)... with chipsets powering down all unused pieces, and cpus in idle taking basically no power, there no longer is much of a difference in reality between suspend and good-idle...
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 31 lines · Richard
Quoted 6 lines
From: Arjan van de Ven [mailto:[email protected]]
Sent: Monday, February 16, 2009 3:52 PMQuoted 1 line · Richard
Quoted 7 lines
Quoted 4 lines
- It provides a way to handle overdrive/turbo operating points out of band from the generically tuned cpufreq governors like ondemand. The way we characterize overdrive is stricter then what Intel has talked about for x86.
if you have an improved-for-your-systems governor then I'm sure that is very welcome in the kernel.
No, the generic governors were not substantially improved. Not every customer is using cpufreq for DVFS. As such we went underneath it. If we had more community presence at the start time we might have also tried that.
Quoted 8 lines
I think just about all of us agree that the final decision needs to be in the driver (possibly followed by something that gets various device requests and combines it into hw settings); we're just talking about what inputs feed into that decision ;)
And for different types of devices that's guaranteed to be different... and sometimes we'll be hampered by existing interfaces, so we might end up with hacky stuff.
Is there some kind of roadmap which can be plotted which goes from course to more granular control?
Quoted 6 lines
Phase 1 (all or nothing): like wakelocks (minus back light):
system-auto-suspend-on, system-auto-suspend-off. The drivers can still veto as they do today.Phase 2: Subsystem generic tunable, on say latency + bandwidth. Start with CPU then move to classes like USB.
I think your phases are the wrong way around.
Phase 2 is already in progress and many of the "good" drivers and subsystems already do them.
Whole system suspend is a much more drastic thing; I don't see that happen generically in 2009 to be honest (not to mention how fragile linux suspend is). In addition, in hardware there does seem to be the trend where idle and suspend are converging (just look at the OLPC)... with chipsets powering down all unused pieces, and cpus in idle taking basically no power, there no longer is much of a difference in reality between suspend and good-idle...
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 41 lines · Arjan van de Ven
Quoted 31 lines · Richard
Quoted 6 lines
From: Arjan van de Ven [mailto:[email protected]]
Sent: Monday, February 16, 2009 3:52 PMQuoted 1 line · Richard
Quoted 7 lines
Quoted 4 lines
- It provides a way to handle overdrive/turbo operating points out of band from the generically tuned cpufreq governors like ondemand. The way we characterize overdrive is stricter then what Intel has talked about for x86.
if you have an improved-for-your-systems governor then I'm sure that is very welcome in the kernel.
No, the generic governors were not substantially improved. Not every customer is using cpufreq for DVFS. As such we went underneath it. If we had more community presence at the start time we might have also tried that.
Quoted 8 lines
I think just about all of us agree that the final decision needs to be in the driver (possibly followed by something that gets various device requests and combines it into hw settings); we're just talking about what inputs feed into that decision ;)
And for different types of devices that's guaranteed to be different... and sometimes we'll be hampered by existing interfaces, so we might end up with hacky stuff.
Is there some kind of roadmap which can be plotted which goes from course to more granular control?
Quoted 6 lines
Phase 1 (all or nothing): like wakelocks (minus back light):
system-auto-suspend-on, system-auto-suspend-off. The drivers can still veto as they do today.Phase 2: Subsystem generic tunable, on say latency + bandwidth. Start with CPU then move to classes like USB.
Quoted 8 lines
I think your phases are the wrong way around.
Phase 2 is already in progress and many of the "good" drivers and subsystems already do them.Whole system suspend is a much more drastic thing; I don't see that happen generically in 2009 to be honest (not to mention how fragile linux suspend is).
This applies to x86/ACPI mostly, IMO. Embedded platforms appear to be much more controllable and tend to work better w/ system-wide sleep states.
Quoted 4 lines
In addition, in hardware there does seem to be the trend where idle and
suspend are converging (just look at the OLPC)... with chipsets powering
down all unused pieces, and cpus in idle taking basically no power, there no longer is much of a difference in reality between suspend and good-idle...
This, again, seems to be a bit x86-centric. :-) The Android people are telling us that on the hardware they deal with it does make sense to put the entire system to sleep even for relatively short periods of time, since the latencies involved are not too bad.
While I agree that on a PC it would probably make more sense to go towards fine-grained run-time power management, maybe even without using system-wide suspend at all (I don't see this happen any time soon, though), I'm not sure about the other platforms.
Thanks,
Rafael
Quoted 41 lines · Arjan van de Ven
Quoted 31 lines · Richard
Quoted 6 lines
From: Arjan van de Ven [mailto:[email protected]]
Sent: Monday, February 16, 2009 3:52 PMQuoted 1 line · Richard
Quoted 7 lines
Quoted 4 lines
- It provides a way to handle overdrive/turbo operating points out of band from the generically tuned cpufreq governors like ondemand. The way we characterize overdrive is stricter then what Intel has talked about for x86.
if you have an improved-for-your-systems governor then I'm sure that is very welcome in the kernel.
No, the generic governors were not substantially improved. Not every customer is using cpufreq for DVFS. As such we went underneath it. If we had more community presence at the start time we might have also tried that.
Quoted 8 lines
I think just about all of us agree that the final decision needs to be in the driver (possibly followed by something that gets various device requests and combines it into hw settings); we're just talking about what inputs feed into that decision ;)
And for different types of devices that's guaranteed to be different... and sometimes we'll be hampered by existing interfaces, so we might end up with hacky stuff.
Is there some kind of roadmap which can be plotted which goes from course to more granular control?
Quoted 6 lines
Phase 1 (all or nothing): like wakelocks (minus back light):
system-auto-suspend-on, system-auto-suspend-off. The drivers can still veto as they do today.Phase 2: Subsystem generic tunable, on say latency + bandwidth. Start with CPU then move to classes like USB.
Quoted 8 lines
I think your phases are the wrong way around.
Phase 2 is already in progress and many of the "good" drivers and subsystems already do them.Whole system suspend is a much more drastic thing; I don't see that happen generically in 2009 to be honest (not to mention how fragile linux suspend is).
This applies to x86/ACPI mostly, IMO. Embedded platforms appear to be much more controllable and tend to work better w/ system-wide sleep states.
Quoted 4 lines
In addition, in hardware there does seem to be the trend where idle and
suspend are converging (just look at the OLPC)... with chipsets powering
down all unused pieces, and cpus in idle taking basically no power, there no longer is much of a difference in reality between suspend and good-idle...
This, again, seems to be a bit x86-centric. :-) The Android people are telling us that on the hardware they deal with it does make sense to put the entire system to sleep even for relatively short periods of time, since the latencies involved are not too bad.
While I agree that on a PC it would probably make more sense to go towards fine-grained run-time power management, maybe even without using system-wide suspend at all (I don't see this happen any time soon, though), I'm not sure about the other platforms.
Thanks,
Rafael
Quoted 4 lines · Rafael J. Wysocki
This, again, seems to be a bit x86-centric. :-) The Android people are telling us that on the hardware they deal with it does make sense to put the entire system to sleep even for relatively short periods of time, since the latencies involved are not too bad.
Arve said that the power state was equivalent in idle and suspend, but that they preferred suspend because it stopped any periodic timers. I'd be more interested in making sure that unnecessary timers aren't running than focusing on automatically entering system-wide suspend - Nokia have been managing this since 2005 with good results.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 4 lines · Rafael J. Wysocki
This, again, seems to be a bit x86-centric. :-) The Android people are telling us that on the hardware they deal with it does make sense to put the entire system to sleep even for relatively short periods of time, since the latencies involved are not too bad.
Arve said that the power state was equivalent in idle and suspend, but that they preferred suspend because it stopped any periodic timers. I'd be more interested in making sure that unnecessary timers aren't running than focusing on automatically entering system-wide suspend - Nokia have been managing this since 2005 with good results.
Signature · 1 line
Matthew Garrett | [email protected]
Am Tuesday 17 February 2009 00:23:30 schrieb Matthew Garrett:
Quoted 7 lines · Rafael J. Wysocki
Quoted 5 lines
This, again, seems to be a bit x86-centric. :-) The Android people are telling us that on the hardware they deal with it does make sense to put the entire system to sleep even for relatively short periods of time, since the latencies involved are not too bad.
Quoted 5 lines
Arve said that the power state was equivalent in idle and suspend, but that they preferred suspend because it stopped any periodic timers. I'd be more interested in making sure that unnecessary timers aren't running than focusing on automatically entering system-wide suspend - Nokia have been managing this since 2005 with good results.
I agree. For a general purpose system it would be very hard to call some timers unnecessary and others necessary.
Regards
Oliver
Am Tuesday 17 February 2009 00:23:30 schrieb Matthew Garrett:
Quoted 7 lines · Rafael J. Wysocki
Quoted 5 lines
This, again, seems to be a bit x86-centric. :-) The Android people are telling us that on the hardware they deal with it does make sense to put the entire system to sleep even for relatively short periods of time, since the latencies involved are not too bad.
Quoted 5 lines
Arve said that the power state was equivalent in idle and suspend, but that they preferred suspend because it stopped any periodic timers. I'd be more interested in making sure that unnecessary timers aren't running than focusing on automatically entering system-wide suspend - Nokia have been managing this since 2005 with good results.
I agree. For a general purpose system it would be very hard to call some timers unnecessary and others necessary.
Regards
Oliver
Quoted 5 lines · Matthew Garrett
Arve said that the power state was equivalent in idle and suspend, but that they preferred suspend because it stopped any periodic timers. I'd be more interested in making sure that unnecessary timers aren't running than focusing on automatically entering system-wide suspend - Nokia have been managing this since 2005 with good results.
Definitely. Even in the embedded case there is hardware which takes a relatively long time to fully power down and resume without winning an enormous amount on the power front (analogue stuff is a common culprit here, it can take a noticable amount of time to bring it up cleanly).
Quoted 5 lines · Matthew Garrett
Arve said that the power state was equivalent in idle and suspend, but that they preferred suspend because it stopped any periodic timers. I'd be more interested in making sure that unnecessary timers aren't running than focusing on automatically entering system-wide suspend - Nokia have been managing this since 2005 with good results.
Definitely. Even in the embedded case there is hardware which takes a relatively long time to fully power down and resume without winning an enormous amount on the power front (analogue stuff is a common culprit here, it can take a noticable amount of time to bring it up cleanly).
[Matthew Garrett <[email protected]>]
Quoted 7 lines · Rafael J. Wysocki
Quoted 5 lines
This, again, seems to be a bit x86-centric. :-) The Android people are telling us that on the hardware they deal with it does make sense to put the entire system to sleep even for relatively short periods of time, since the latencies involved are not too bad.
Quoted 5 lines
Arve said that the power state was equivalent in idle and suspend, but that they preferred suspend because it stopped any periodic timers. I'd be more interested in making sure that unnecessary timers aren't running than focusing on automatically entering system-wide suspend - Nokia have been managing this since 2005 with good results.
We'd totally agree that doing something about periodic timers would be a big win. There's also the situation that the longest ARM linux can sit in idle right now is ~2s at a time (Arve can expand on the exact issue relating to a 32bit signed nanosecond value somewhere iirc), which we'd want to sort out as well.
Of course that still doesn't address userspace. Aggressively going to suspend lets us compensate for userspace programs that do somewhat silly things (I agree that it would be best if they didn't but they do and getting *everyone* to write their userspace code to avoid spinning or avoid waking up on short-duration timers to poll is a losing battle).
Brian
[Matthew Garrett <[email protected]>]
Quoted 7 lines · Rafael J. Wysocki
Quoted 5 lines
This, again, seems to be a bit x86-centric. :-) The Android people are telling us that on the hardware they deal with it does make sense to put the entire system to sleep even for relatively short periods of time, since the latencies involved are not too bad.
Quoted 5 lines
Arve said that the power state was equivalent in idle and suspend, but that they preferred suspend because it stopped any periodic timers. I'd be more interested in making sure that unnecessary timers aren't running than focusing on automatically entering system-wide suspend - Nokia have been managing this since 2005 with good results.
We'd totally agree that doing something about periodic timers would be a big win. There's also the situation that the longest ARM linux can sit in idle right now is ~2s at a time (Arve can expand on the exact issue relating to a 32bit signed nanosecond value somewhere iirc), which we'd want to sort out as well.
Of course that still doesn't address userspace. Aggressively going to suspend lets us compensate for userspace programs that do somewhat silly things (I agree that it would be best if they didn't but they do and getting *everyone* to write their userspace code to avoid spinning or avoid waking up on short-duration timers to poll is a losing battle).
Brian
Quoted 5 lines · Brian Swetland
Of course that still doesn't address userspace. Aggressively going to suspend lets us compensate for userspace programs that do somewhat silly things (I agree that it would be best if they didn't but they do and getting *everyone* to write their userspace code to avoid spinning or avoid waking up on short-duration timers to poll is a losing battle).
Like Pavel pointed out, you could (in principle) handle this by sending a SIGSTOP to everything. The obvious problem with doing so is that this wouldn't result in the processes letting go of the devices, so you wouldn't neccessarily actually get to enter the runtime idle state as a result. Hmm. I'll think about this.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 5 lines · Brian Swetland
Of course that still doesn't address userspace. Aggressively going to suspend lets us compensate for userspace programs that do somewhat silly things (I agree that it would be best if they didn't but they do and getting *everyone* to write their userspace code to avoid spinning or avoid waking up on short-duration timers to poll is a losing battle).
Like Pavel pointed out, you could (in principle) handle this by sending a SIGSTOP to everything. The obvious problem with doing so is that this wouldn't result in the processes letting go of the devices, so you wouldn't neccessarily actually get to enter the runtime idle state as a result. Hmm. I'll think about this.
Signature · 1 line
Matthew Garrett | [email protected]
Am Tuesday 17 February 2009 15:24:53 schrieb Matthew Garrett:
Quoted 8 lines · Brian Swetland
Quoted 6 lines
Of course that still doesn't address userspace. Aggressively going to suspend lets us compensate for userspace programs that do somewhat silly things (I agree that it would be best if they didn't but they do and getting *everyone* to write their userspace code to avoid spinning or avoid waking up on short-duration timers to poll is a losing battle).
Quoted 5 lines
Like Pavel pointed out, you could (in principle) handle this by sending a SIGSTOP to everything. The obvious problem with doing so is that this wouldn't result in the processes letting go of the devices, so you wouldn't neccessarily actually get to enter the runtime idle state as a result. Hmm. I'll think about this.
They don't let go of the devices if you suspend either. If you want that you need active cooperation from user space. In fact if you suspend you give drivers the guarantee of not getting any output without prior notification, making their lives easier.
Regards
Oliver
Am Tuesday 17 February 2009 15:24:53 schrieb Matthew Garrett:
Quoted 8 lines · Brian Swetland
Quoted 6 lines
Of course that still doesn't address userspace. Aggressively going to suspend lets us compensate for userspace programs that do somewhat silly things (I agree that it would be best if they didn't but they do and getting *everyone* to write their userspace code to avoid spinning or avoid waking up on short-duration timers to poll is a losing battle).
Quoted 5 lines
Like Pavel pointed out, you could (in principle) handle this by sending a SIGSTOP to everything. The obvious problem with doing so is that this wouldn't result in the processes letting go of the devices, so you wouldn't neccessarily actually get to enter the runtime idle state as a result. Hmm. I'll think about this.
They don't let go of the devices if you suspend either. If you want that you need active cooperation from user space. In fact if you suspend you give drivers the guarantee of not getting any output without prior notification, making their lives easier.
Regards
Oliver
Quoted 6 lines · On Tue, 17 Feb 2009 06:20:01 -0800 Brian Swetland <[email protected]> wrote:
Of course that still doesn't address userspace. Aggressively going to suspend lets us compensate for userspace programs that do somewhat silly things (I agree that it would be best if they didn't but they do and getting *everyone* to write their userspace code to avoid spinning or avoid waking up on short-duration timers to poll is a losing battle).
actually with powertop... on the open source side things are actually won. It took all of 6 months...
I don't see that as a valid excuse. In fact, if this kind of solution makes real userspace scheduled timers to be missed then I consider it a serious functionality misfeature.
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 6 lines · On Tue, 17 Feb 2009 06:20:01 -0800 Brian Swetland <[email protected]> wrote:
Of course that still doesn't address userspace. Aggressively going to suspend lets us compensate for userspace programs that do somewhat silly things (I agree that it would be best if they didn't but they do and getting *everyone* to write their userspace code to avoid spinning or avoid waking up on short-duration timers to poll is a losing battle).
actually with powertop... on the open source side things are actually won. It took all of 6 months...
I don't see that as a valid excuse. In fact, if this kind of solution makes real userspace scheduled timers to be missed then I consider it a serious functionality misfeature.
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 5 lines · Arjan van de Ven
actually with powertop... on the open source side things are actually won. It took all of 6 months...
I don't see that as a valid excuse. In fact, if this kind of solution makes real userspace scheduled timers to be missed then I consider it a serious functionality misfeature.
Remember that Android has an open marketplace designed to appeal to Java programmers - users are going to end up downloading code from there and then blaming the platform if their battery life heads towards zero. I think "We can't trust our userland not to be dumb" is a valid concern.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 5 lines · Arjan van de Ven
actually with powertop... on the open source side things are actually won. It took all of 6 months...
I don't see that as a valid excuse. In fact, if this kind of solution makes real userspace scheduled timers to be missed then I consider it a serious functionality misfeature.
Remember that Android has an open marketplace designed to appeal to Java programmers - users are going to end up downloading code from there and then blaming the platform if their battery life heads towards zero. I think "We can't trust our userland not to be dumb" is a valid concern.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 8 lines · On Tue, 17 Feb 2009 14:51:41 +0000 Matthew Garrett <[email protected]> wrote:
Quoted 5 lines · Arjan van de Ven
actually with powertop... on the open source side things are actually won. It took all of 6 months...
I don't see that as a valid excuse. In fact, if this kind of solution makes real userspace scheduled timers to be missed then I consider it a serious functionality misfeature.
Quoted 5 lines
Remember that Android has an open marketplace designed to appeal to Java programmers - users are going to end up downloading code from there and then blaming the platform if their battery life heads towards zero. I think "We can't trust our userland not to be dumb" is a valid concern.
so use range timers / timer slack for those apps that you do not trust. That is not a big deal, and solves the issue of timer wakeups...
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 8 lines · On Tue, 17 Feb 2009 14:51:41 +0000 Matthew Garrett <[email protected]> wrote:
Quoted 5 lines · Arjan van de Ven
actually with powertop... on the open source side things are actually won. It took all of 6 months...
I don't see that as a valid excuse. In fact, if this kind of solution makes real userspace scheduled timers to be missed then I consider it a serious functionality misfeature.
Quoted 5 lines
Remember that Android has an open marketplace designed to appeal to Java programmers - users are going to end up downloading code from there and then blaming the platform if their battery life heads towards zero. I think "We can't trust our userland not to be dumb" is a valid concern.
so use range timers / timer slack for those apps that you do not trust. That is not a big deal, and solves the issue of timer wakeups...
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 14 lines
From: Arjan van de Ven [mailto:[email protected]]
Sent: Tuesday, February 17, 2009 8:56 AMQuoted 7 lines · On Tue, 17 Feb 2009 14:51:41 +0000 Matthew Garrett <[email protected]> wrote:
Quoted 5 lines · Arjan van de Ven
actually with powertop... on the open source side things are actually won. It took all of 6 months...
I don't see that as a valid excuse. In fact, if this kind of solution makes real userspace scheduled timers to be missed then I consider it a serious functionality misfeature.
Maybe for the optimization time scales x86 is targeting. User space across OS still throws off our MHz a good distance from ideal estimates.
I still hear complaints about frequent wakes even when using a bare minimum user space which can get 95+% lowest C-state residency with average 700mS. If you frequency scale in lowest C-State YMMV if your external power chip is slow. Waiting on voltage ramp times is lost power.
One of our Application people (application is low level here) went though and tweaked kernel in a few spots with minimum user space and could get (this is with out a meaningful UI on NFS root mounted system):
1st set of hacks got:
Cn Avg residency
C0 (cpu running) ( 0.0%)
C1 0.0ms ( 0.0%)
C2 0.0ms ( 0.0%)
C3 217.2ms ( 1.8%)
C4 0.0ms ( 0.0%)
C5 0.0ms ( 0.0%)
C6 354.9ms ( 0.3%)
C7 1953.4ms (97.8%)
Second set got:
# powertop -d -t 300 PowerTOP 1.10 (C) 2007 Intel Corporation Collecting data for 300 seconds Cn Avg residency C0 (cpu running) ( 0.0%) C1 0.0ms ( 0.0%) C2 0.2ms ( 0.0%) C3 3.8ms ( 0.0%) C4 0.0ms ( 0.0%) C5 0.0ms ( 0.0%) C6 0.0ms ( 0.0%) C7 73165.9ms (100.0%)
I'll see about posting his change write up. Not all probably can be done but several could.
Quoted 8 lines
Quoted 5 lines
Remember that Android has an open marketplace designed to appeal to Java programmers - users are going to end up downloading code from there and then blaming the platform if their battery life heads towards zero. I think "We can't trust our userland not to be dumb" is a valid concern.
so use range timers / timer slack for those apps that you do not trust. That is not a big deal, and solves the issue of timer wakeups...
I not so sure it is that straight forward in practice. End systems integrate a lot of 3rd party software who view performance 1st and have no thought of power.
It might be android has a better chance to control more of those api's being exported but its coverage isn't complete and others gluing pieces together won't.
Regards,
Richard W.
Quoted 14 lines
From: Arjan van de Ven [mailto:[email protected]]
Sent: Tuesday, February 17, 2009 8:56 AMQuoted 7 lines · On Tue, 17 Feb 2009 14:51:41 +0000 Matthew Garrett <[email protected]> wrote:
Quoted 5 lines · Arjan van de Ven
actually with powertop... on the open source side things are actually won. It took all of 6 months...
I don't see that as a valid excuse. In fact, if this kind of solution makes real userspace scheduled timers to be missed then I consider it a serious functionality misfeature.
Maybe for the optimization time scales x86 is targeting. User space across OS still throws off our MHz a good distance from ideal estimates.
I still hear complaints about frequent wakes even when using a bare minimum user space which can get 95+% lowest C-state residency with average 700mS. If you frequency scale in lowest C-State YMMV if your external power chip is slow. Waiting on voltage ramp times is lost power.
One of our Application people (application is low level here) went though and tweaked kernel in a few spots with minimum user space and could get (this is with out a meaningful UI on NFS root mounted system):
1st set of hacks got:
Cn Avg residency
C0 (cpu running) ( 0.0%)
C1 0.0ms ( 0.0%)
C2 0.0ms ( 0.0%)
C3 217.2ms ( 1.8%)
C4 0.0ms ( 0.0%)
C5 0.0ms ( 0.0%)
C6 354.9ms ( 0.3%)
C7 1953.4ms (97.8%)
Second set got:
# powertop -d -t 300 PowerTOP 1.10 (C) 2007 Intel Corporation Collecting data for 300 seconds Cn Avg residency C0 (cpu running) ( 0.0%) C1 0.0ms ( 0.0%) C2 0.2ms ( 0.0%) C3 3.8ms ( 0.0%) C4 0.0ms ( 0.0%) C5 0.0ms ( 0.0%) C6 0.0ms ( 0.0%) C7 73165.9ms (100.0%)
I'll see about posting his change write up. Not all probably can be done but several could.
Quoted 8 lines
Quoted 5 lines
Remember that Android has an open marketplace designed to appeal to Java programmers - users are going to end up downloading code from there and then blaming the platform if their battery life heads towards zero. I think "We can't trust our userland not to be dumb" is a valid concern.
so use range timers / timer slack for those apps that you do not trust. That is not a big deal, and solves the issue of timer wakeups...
I not so sure it is that straight forward in practice. End systems integrate a lot of 3rd party software who view performance 1st and have no thought of power.
It might be android has a better chance to control more of those api's being exported but its coverage isn't complete and others gluing pieces together won't.
Regards,
Richard W.
Quoted 7 lines · Richard
Quoted 3 lines
so use range timers / timer slack for those apps that you do not trust. That is not a big deal, and solves the issue of timer wakeups...
I not so sure it is that straight forward in practice. End systems integrate a lot of 3rd party software who view performance 1st and have no thought of power.
you know that with the range timers/slack, you can control the "rounding" of the timer of the application, right?
You can *directly* throttle the number of wakeups an application causes that way to a value you set.
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 7 lines · Richard
Quoted 3 lines
so use range timers / timer slack for those apps that you do not trust. That is not a big deal, and solves the issue of timer wakeups...
I not so sure it is that straight forward in practice. End systems integrate a lot of 3rd party software who view performance 1st and have no thought of power.
you know that with the range timers/slack, you can control the "rounding" of the timer of the application, right?
You can *directly* throttle the number of wakeups an application causes that way to a value you set.
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 7 lines
Quoted 4 lines · Richard
Quoted 3 lines
so use range timers / timer slack for those apps that you do not trust. That is not a big deal, and solves the issue of timer wakeups...
Quoted 6 lines
Quoted 3 lines
I not so sure it is that straight forward in practice. End systems integrate a lot of 3rd party software who view performance 1st and have no thought of power.
you know that with the range timers/slack, you can control the "rounding" of the timer of the application, right?
I've not explored user space for this.
Can on a per-application basis some controlling application cause timers of a target process to be rounded or is it global? Or do you need to link the new application to use special glib variants (as described in OLS papers a few years ago)?
Quoted 2 lines
You can *directly* throttle the number of wakeups an application causes that way to a value you set.
Are you talking about your work as seen in lwn.net summary?
http://lwn.net/Articles/296578/
Your change here does look like something which could be used to control timers. Don't you still need some dynamic way to set the fuzz/slack if its globally applied? It seems like you might want some timers precise and others fuzzy.
Would the holding of a wakelock or some activity counter be a good trigger for switching rounding time? If wakelocks held "minor adjustment" else "major adjustment"
Thanks for the good pointer assuming I understood it in quick scan.
Thanks,
Richard W.
Quoted 7 lines
Quoted 4 lines · Richard
Quoted 3 lines
so use range timers / timer slack for those apps that you do not trust. That is not a big deal, and solves the issue of timer wakeups...
Quoted 6 lines
Quoted 3 lines
I not so sure it is that straight forward in practice. End systems integrate a lot of 3rd party software who view performance 1st and have no thought of power.
you know that with the range timers/slack, you can control the "rounding" of the timer of the application, right?
I've not explored user space for this.
Can on a per-application basis some controlling application cause timers of a target process to be rounded or is it global? Or do you need to link the new application to use special glib variants (as described in OLS papers a few years ago)?
Quoted 2 lines
You can *directly* throttle the number of wakeups an application causes that way to a value you set.
Are you talking about your work as seen in lwn.net summary?
http://lwn.net/Articles/296578/
Your change here does look like something which could be used to control timers. Don't you still need some dynamic way to set the fuzz/slack if its globally applied? It seems like you might want some timers precise and others fuzzy.
Would the holding of a wakelock or some activity counter be a good trigger for switching rounding time? If wakelocks held "minor adjustment" else "major adjustment"
Thanks for the good pointer assuming I understood it in quick scan.
Thanks,
Richard W.
Quoted 11 lines · Richard
Quoted 11 lines
Quoted 7 lines · Richard
Quoted 3 lines
so use range timers / timer slack for those apps that you do not trust. That is not a big deal, and solves the issue of timer wakeups...
I not so sure it is that straight forward in practice. End systems integrate a lot of 3rd party software who view performance 1st and have no thought of power.
Quoted 7 lines
Quoted 2 lines
you know that with the range timers/slack, you can control the "rounding" of the timer of the application, right?
I've not explored user space for this.
Can on a per-application basis some controlling application cause timers of a target process to be rounded or is it global?
it is actually per thread.. so rather fine grained
Quoted 3 lines
Or do you
need to link the new application to use special glib variants (as described in OLS papers a few years ago)?
no you can do it for 100% existing binary
Quoted 5 lines
Your change here does look like something which could be used to control timers. Don't you still need some dynamic way to set the fuzz/slack if its globally applied? It seems like you might want some timers precise and others fuzzy.
right now it's prctl() based. We have been looking for a good use case for making it per syscall.. but haven't found a convincing one yet.
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 11 lines · Richard
Quoted 11 lines
Quoted 7 lines · Richard
Quoted 3 lines
so use range timers / timer slack for those apps that you do not trust. That is not a big deal, and solves the issue of timer wakeups...
I not so sure it is that straight forward in practice. End systems integrate a lot of 3rd party software who view performance 1st and have no thought of power.
Quoted 7 lines
Quoted 2 lines
you know that with the range timers/slack, you can control the "rounding" of the timer of the application, right?
I've not explored user space for this.
Can on a per-application basis some controlling application cause timers of a target process to be rounded or is it global?
it is actually per thread.. so rather fine grained
Quoted 3 lines
Or do you
need to link the new application to use special glib variants (as described in OLS papers a few years ago)?
no you can do it for 100% existing binary
Quoted 5 lines
Your change here does look like something which could be used to control timers. Don't you still need some dynamic way to set the fuzz/slack if its globally applied? It seems like you might want some timers precise and others fuzzy.
right now it's prctl() based. We have been looking for a good use case for making it per syscall.. but haven't found a convincing one yet.
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 7 lines · Arjan van de Ven
Quoted 4 lines · Richard
Quoted 3 lines
so use range timers / timer slack for those apps that you do not trust. That is not a big deal, and solves the issue of timer wakeups...
Quoted 9 lines
Quoted 3 lines
I not so sure it is that straight forward in practice. End systems integrate a lot of 3rd party software who view performance 1st and have no thought of power.
you know that with the range timers/slack, you can control the "rounding" of the timer of the application, right?
You can *directly* throttle the number of wakeups an application causes that way to a value you set.
As the application code is mostly managed it should be a slam dunk to make range timers work withing the android framework or Dalvik layers.
--mgross
Quoted 7 lines · Arjan van de Ven
Quoted 4 lines · Richard
Quoted 3 lines
so use range timers / timer slack for those apps that you do not trust. That is not a big deal, and solves the issue of timer wakeups...
Quoted 9 lines
Quoted 3 lines
I not so sure it is that straight forward in practice. End systems integrate a lot of 3rd party software who view performance 1st and have no thought of power.
you know that with the range timers/slack, you can control the "rounding" of the timer of the application, right?
You can *directly* throttle the number of wakeups an application causes that way to a value you set.
As the application code is mostly managed it should be a slam dunk to make range timers work withing the android framework or Dalvik layers.
--mgross
Quoted 7 lines · Arjan van de Ven
Quoted 4 lines · Richard
Quoted 3 lines
so use range timers / timer slack for those apps that you do not trust. That is not a big deal, and solves the issue of timer wakeups...
Quoted 8 lines
Quoted 3 lines
I not so sure it is that straight forward in practice. End systems integrate a lot of 3rd party software who view performance 1st and have no thought of power.
you know that with the range timers/slack, you can control the "rounding" of the timer of the application, right?
You can *directly* throttle the number of wakeups an application causes that way to a value you set.
I thought the point of range timers was to align multiple timers so they wakeup at the same time, not to throttle individual timers.
Signature · 1 line
Arve Hjønnevåg
Quoted 7 lines · Arjan van de Ven
Quoted 4 lines · Richard
Quoted 3 lines
so use range timers / timer slack for those apps that you do not trust. That is not a big deal, and solves the issue of timer wakeups...
Quoted 8 lines
Quoted 3 lines
I not so sure it is that straight forward in practice. End systems integrate a lot of 3rd party software who view performance 1st and have no thought of power.
you know that with the range timers/slack, you can control the "rounding" of the timer of the application, right?
You can *directly* throttle the number of wakeups an application causes that way to a value you set.
I thought the point of range timers was to align multiple timers so they wakeup at the same time, not to throttle individual timers.
Signature · 1 line
Arve Hjønnevåg
Quoted 13 lines · On Tue, 17 Feb 2009 21:11:31 -0800 Arve Hjønnevåg <[email protected]> wrote:
Quoted 11 lines · Arjan van de Ven
Quoted 7 lines · Richard
Quoted 3 lines
so use range timers / timer slack for those apps that you do not trust. That is not a big deal, and solves the issue of timer wakeups...
I not so sure it is that straight forward in practice. End systems integrate a lot of 3rd party software who view performance 1st and have no thought of power.
Quoted 7 lines
Quoted 4 lines
you know that with the range timers/slack, you can control the "rounding" of the timer of the application, right?
You can *directly* throttle the number of wakeups an application causes that way to a value you set.I thought the point of range timers was to align multiple timers so they wakeup at the same time, not to throttle individual timers.
it works both ways.
Signature · 7 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 13 lines · On Tue, 17 Feb 2009 21:11:31 -0800 Arve Hjønnevåg <[email protected]> wrote:
Quoted 11 lines · Arjan van de Ven
Quoted 7 lines · Richard
Quoted 3 lines
so use range timers / timer slack for those apps that you do not trust. That is not a big deal, and solves the issue of timer wakeups...
I not so sure it is that straight forward in practice. End systems integrate a lot of 3rd party software who view performance 1st and have no thought of power.
Quoted 7 lines
Quoted 4 lines
you know that with the range timers/slack, you can control the "rounding" of the timer of the application, right?
You can *directly* throttle the number of wakeups an application causes that way to a value you set.I thought the point of range timers was to align multiple timers so they wakeup at the same time, not to throttle individual timers.
it works both ways.
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 2 lines · Arjan van de Ven
so use range timers / timer slack for those apps that you do not trust. That is not a big deal, and solves the issue of timer wakeups...
So have userspace say something like "The screen is turned off now, change the timer precision on all untrusted userland to sub 10 seconds"? That would work.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 2 lines · Arjan van de Ven
so use range timers / timer slack for those apps that you do not trust. That is not a big deal, and solves the issue of timer wakeups...
So have userspace say something like "The screen is turned off now, change the timer precision on all untrusted userland to sub 10 seconds"? That would work.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 6 lines
Quoted 2 lines
so use range timers / timer slack for those apps that you do not trust. That is not a big deal, and solves the issue of timer wakeups...
So have userspace say something like "The screen is turned off now, change the timer precision on all untrusted userland to sub 10 seconds"? That would work.
I also made a similar comment in thread to Arjan yesterday.
He did respond saying there was a pctrl to hit this. If it's a big list it might be messy. Unless it can be global. Probably would be good to look at code rather than speculate.
Quoted 6 lines
Quoted 2 lines
so use range timers / timer slack for those apps that you do not trust. That is not a big deal, and solves the issue of timer wakeups...
So have userspace say something like "The screen is turned off now, change the timer precision on all untrusted userland to sub 10 seconds"? That would work.
I also made a similar comment in thread to Arjan yesterday.
He did respond saying there was a pctrl to hit this. If it's a big list it might be messy. Unless it can be global. Probably would be good to look at code rather than speculate.
Hi,
Quoted 6 lines · ext Matthew Garrett
On Tue, Feb 17, 2009 at 06:46:30AM -0800, Arjan van de Ven wrote:
Remember that Android has an open marketplace designed to appeal to Java programmers - users are going to end up downloading code from there and then blaming the platform if their battery life heads towards zero. I think "We can't trust our userland not to be dumb" is a valid concern.
It took few years of preaching but eventually our (admittedly small) userbase did start to see the truth and not blame the platform but rather the applications they had installed on top of it.
Powertop is a good tool.
Maybe slamming a nice GUI on top of that would turn all the userbase into a horde of bug reporters for the offending apps.
Or maybe it's just wishful thinking .... :)
Signature · 6 lines
Cheers, Igor --- Igor Stoppa Maemo Software - Nokia Devices R&D - Helsinki
Hi,
Quoted 6 lines · ext Matthew Garrett
On Tue, Feb 17, 2009 at 06:46:30AM -0800, Arjan van de Ven wrote:
Remember that Android has an open marketplace designed to appeal to Java programmers - users are going to end up downloading code from there and then blaming the platform if their battery life heads towards zero. I think "We can't trust our userland not to be dumb" is a valid concern.
It took few years of preaching but eventually our (admittedly small) userbase did start to see the truth and not blame the platform but rather the applications they had installed on top of it.
Powertop is a good tool.
Maybe slamming a nice GUI on top of that would turn all the userbase into a horde of bug reporters for the offending apps.
Or maybe it's just wishful thinking .... :)
Signature · 6 lines
Cheers, Igor --- Igor Stoppa Maemo Software - Nokia Devices R&D - Helsinki
[Arjan van de Ven <[email protected]>]
Quoted 10 lines
Quoted 6 lines · On Tue, 17 Feb 2009 06:20:01 -0800 Brian Swetland <[email protected]> wrote:
Of course that still doesn't address userspace. Aggressively going to suspend lets us compensate for userspace programs that do somewhat silly things (I agree that it would be best if they didn't but they do and getting *everyone* to write their userspace code to avoid spinning or avoid waking up on short-duration timers to poll is a losing battle).
Quoted 5 lines
actually with powertop... on the open source side things are actually won. It took all of 6 months...
I don't see that as a valid excuse. In fact, if this kind of solution makes real userspace scheduled timers to be missed then I consider it a serious functionality misfeature.
While you can't expect the kernel to solve all the problems of userspace, here's the broad situation one could end up in (note this specific sequence is generic and not based on any one specific product experience):
- carrier deploys a device
- carrier agrees to allow installation of arbitrary third party apps without some horrible certification program requiring app authors to jump through hoops, wait ages for approval, etc
- users rejoice and install all kinds of apps
- some apps are poorly written and impact battery life
- users complain to carrier about battery life
You will end up with some crappy apps that do really dumb things. However, even if they're badly written users may still install and use these apps because hey, they do something the user likes.
Quoted 1 line
From the Android standpoint, we're trying to balance protecting the
system from poorly designed apps and somehow letting the user know "hey app X is chewing up a lot of power" (work in progress on this).
While I'd love for every app developer to actively tune their apps for a good mobile experience, I am skeptical that this is going to happen.
Brian
[Arjan van de Ven <[email protected]>]
Quoted 10 lines
Quoted 6 lines · On Tue, 17 Feb 2009 06:20:01 -0800 Brian Swetland <[email protected]> wrote:
Of course that still doesn't address userspace. Aggressively going to suspend lets us compensate for userspace programs that do somewhat silly things (I agree that it would be best if they didn't but they do and getting *everyone* to write their userspace code to avoid spinning or avoid waking up on short-duration timers to poll is a losing battle).
Quoted 5 lines
actually with powertop... on the open source side things are actually won. It took all of 6 months...
I don't see that as a valid excuse. In fact, if this kind of solution makes real userspace scheduled timers to be missed then I consider it a serious functionality misfeature.
While you can't expect the kernel to solve all the problems of userspace, here's the broad situation one could end up in (note this specific sequence is generic and not based on any one specific product experience):
- carrier deploys a device
- carrier agrees to allow installation of arbitrary third party apps without some horrible certification program requiring app authors to jump through hoops, wait ages for approval, etc
- users rejoice and install all kinds of apps
- some apps are poorly written and impact battery life
- users complain to carrier about battery life
You will end up with some crappy apps that do really dumb things. However, even if they're badly written users may still install and use these apps because hey, they do something the user likes.
Quoted 1 line
From the Android standpoint, we're trying to balance protecting the
system from poorly designed apps and somehow letting the user know "hey app X is chewing up a lot of power" (work in progress on this).
While I'd love for every app developer to actively tune their apps for a good mobile experience, I am skeptical that this is going to happen.
Brian
Quoted 22 lines · Brian Swetland
[Arjan van de Ven <[email protected]>]
Quoted 10 lines
Quoted 6 lines · On Tue, 17 Feb 2009 06:20:01 -0800 Brian Swetland <[email protected]> wrote:
Of course that still doesn't address userspace. Aggressively going to suspend lets us compensate for userspace programs that do somewhat silly things (I agree that it would be best if they didn't but they do and getting *everyone* to write their userspace code to avoid spinning or avoid waking up on short-duration timers to poll is a losing battle).
Quoted 5 lines
actually with powertop... on the open source side things are actually won. It took all of 6 months...
I don't see that as a valid excuse. In fact, if this kind of solution makes real userspace scheduled timers to be missed then I consider it a serious functionality misfeature.While you can't expect the kernel to solve all the problems of userspace, here's the broad situation one could end up in (note this specific sequence is generic and not based on any one specific product experience):
Quoted 7 lines
- carrier deploys a device
- carrier agrees to allow installation of arbitrary third party apps without some horrible certification program requiring app authors to jump through hoops, wait ages for approval, etc
- users rejoice and install all kinds of apps
- some apps are poorly written and impact battery life
- users complain to carrier about battery life
Carrier pushes ISV for fix app, and updates that don't suck are deployed.
Where is the problem?
--mgross
Quoted 13 lines
You will end up with some crappy apps that do really dumb things. However, even if they're badly written users may still install and use these apps because hey, they do something the user likes.
Quoted 1 line
From the Android standpoint, we're trying to balance protecting the
system from poorly designed apps and somehow letting the user know "hey app X is chewing up a lot of power" (work in progress on this).
While I'd love for every app developer to actively tune their apps for a good mobile experience, I am skeptical that this is going to happen.
Brian
Quoted 22 lines · Brian Swetland
[Arjan van de Ven <[email protected]>]
Quoted 10 lines
Quoted 6 lines · On Tue, 17 Feb 2009 06:20:01 -0800 Brian Swetland <[email protected]> wrote:
Of course that still doesn't address userspace. Aggressively going to suspend lets us compensate for userspace programs that do somewhat silly things (I agree that it would be best if they didn't but they do and getting *everyone* to write their userspace code to avoid spinning or avoid waking up on short-duration timers to poll is a losing battle).
Quoted 5 lines
actually with powertop... on the open source side things are actually won. It took all of 6 months...
I don't see that as a valid excuse. In fact, if this kind of solution makes real userspace scheduled timers to be missed then I consider it a serious functionality misfeature.While you can't expect the kernel to solve all the problems of userspace, here's the broad situation one could end up in (note this specific sequence is generic and not based on any one specific product experience):
Quoted 7 lines
- carrier deploys a device
- carrier agrees to allow installation of arbitrary third party apps without some horrible certification program requiring app authors to jump through hoops, wait ages for approval, etc
- users rejoice and install all kinds of apps
- some apps are poorly written and impact battery life
- users complain to carrier about battery life
Carrier pushes ISV for fix app, and updates that don't suck are deployed.
Where is the problem?
--mgross
Quoted 13 lines
You will end up with some crappy apps that do really dumb things. However, even if they're badly written users may still install and use these apps because hey, they do something the user likes.
Quoted 1 line
From the Android standpoint, we're trying to balance protecting the
system from poorly designed apps and somehow letting the user know "hey app X is chewing up a lot of power" (work in progress on this).
While I'd love for every app developer to actively tune their apps for a good mobile experience, I am skeptical that this is going to happen.
Brian
Quoted 11 lines
You will end up with some crappy apps that do really dumb things. However, even if they're badly written users may still install and use these apps because hey, they do something the user likes.
Quoted 1 line
From the Android standpoint, we're trying to balance protecting the
system from poorly designed apps and somehow letting the user know "hey app X is chewing up a lot of power" (work in progress on this).
While I'd love for every app developer to actively tune their apps for a good mobile experience, I am skeptical that this is going to happen.
One idea I've been toying around was to have powertune as some kind of background thingy, and have it pop an icon in the notification area when some app seems to behave badly (of course, defining "badly" is hard but heh...). IE. actively inform the user "this application is sucking the life out of your battery".
Cheers,
Ben.
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 9 lines
You will end up with some crappy apps that do really dumb things. However, even if they're badly written users may still install and use these apps because hey, they do something the user likes.
Quoted 1 line
From the Android standpoint, we're trying to balance protecting the
system from poorly designed apps and somehow letting the user know "hey app X is chewing up a lot of power" (work in progress on this).
Quoted 8 lines
Quoted 2 lines
While I'd love for every app developer to actively tune their apps for a good mobile experience, I am skeptical that this is going to happen.
One idea I've been toying around was to have powertune as some kind of background thingy, and have it pop an icon in the notification area when some app seems to behave badly (of course, defining "badly" is hard but heh...). IE. actively inform the user "this application is sucking the life out of your battery".
I think "powernag" would be a better name, and it would probably work pretty well. Users would be notified that certain apps should probably be shut down while they're on battery, and nag the authors to fix it.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 9 lines
You will end up with some crappy apps that do really dumb things. However, even if they're badly written users may still install and use these apps because hey, they do something the user likes.
Quoted 1 line
From the Android standpoint, we're trying to balance protecting the
system from poorly designed apps and somehow letting the user know "hey app X is chewing up a lot of power" (work in progress on this).
Quoted 8 lines
Quoted 2 lines
While I'd love for every app developer to actively tune their apps for a good mobile experience, I am skeptical that this is going to happen.
One idea I've been toying around was to have powertune as some kind of background thingy, and have it pop an icon in the notification area when some app seems to behave badly (of course, defining "badly" is hard but heh...). IE. actively inform the user "this application is sucking the life out of your battery".
I think "powernag" would be a better name, and it would probably work pretty well. Users would be notified that certain apps should probably be shut down while they're on battery, and nag the authors to fix it.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Quoted 3 lines · Jesse Barnes
I think "powernag" would be a better name, and it would probably work pretty well. Users would be notified that certain apps should probably be shut down while they're on battery, and nag the authors to fix it.
How do you usefully tell the difference between an application that's waking up a lot because it's dumb and an application that's waking up a lot because it's doing something useful? One downside of powertop is that it's resulted in a lot of "How do I reduce the number of wakeups caused by i8042 whenever I use the mouse"-type questions. We don't want innocent app writers to be hit by this kind of thing.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 3 lines · Jesse Barnes
I think "powernag" would be a better name, and it would probably work pretty well. Users would be notified that certain apps should probably be shut down while they're on battery, and nag the authors to fix it.
How do you usefully tell the difference between an application that's waking up a lot because it's dumb and an application that's waking up a lot because it's doing something useful? One downside of powertop is that it's resulted in a lot of "How do I reduce the number of wakeups caused by i8042 whenever I use the mouse"-type questions. We don't want innocent app writers to be hit by this kind of thing.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 11 lines · Matthew Garrett
Quoted 3 lines · Jesse Barnes
I think "powernag" would be a better name, and it would probably work pretty well. Users would be notified that certain apps should probably be shut down while they're on battery, and nag the authors to fix it.
How do you usefully tell the difference between an application that's waking up a lot because it's dumb and an application that's waking up a lot because it's doing something useful? One downside of powertop is that it's resulted in a lot of "How do I reduce the number of wakeups caused by i8042 whenever I use the mouse"-type questions. We don't want innocent app writers to be hit by this kind of thing.
Well Ben did mention that it would be hard to figure out a good set of heuristics, but a userspace app could be pretty flexible, allowing the user to whitelist apps they know are fine, average the data over a period of time, etc. Challenging, sure, but it should be possible to come up with something that's useful in many cases.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Quoted 11 lines · Matthew Garrett
Quoted 3 lines · Jesse Barnes
I think "powernag" would be a better name, and it would probably work pretty well. Users would be notified that certain apps should probably be shut down while they're on battery, and nag the authors to fix it.
How do you usefully tell the difference between an application that's waking up a lot because it's dumb and an application that's waking up a lot because it's doing something useful? One downside of powertop is that it's resulted in a lot of "How do I reduce the number of wakeups caused by i8042 whenever I use the mouse"-type questions. We don't want innocent app writers to be hit by this kind of thing.
Well Ben did mention that it would be hard to figure out a good set of heuristics, but a userspace app could be pretty flexible, allowing the user to whitelist apps they know are fine, average the data over a period of time, etc. Challenging, sure, but it should be possible to come up with something that's useful in many cases.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Quoted 6 lines · Matthew Garrett
Quoted 3 lines · Jesse Barnes
I think "powernag" would be a better name, and it would probably work pretty well. Users would be notified that certain apps should probably be shut down while they're on battery, and nag the authors to fix it.
Quoted 6 lines
How do you usefully tell the difference between an application that's waking up a lot because it's dumb and an application that's waking up a lot because it's doing something useful? One downside of powertop is that it's resulted in a lot of "How do I reduce the number of wakeups caused by i8042 whenever I use the mouse"-type questions. We don't want innocent app writers to be hit by this kind of thing.
Which is why nagging might not be the best thing... One thing I quite liked was something i had on MacOS 9 which was a watt-meter. I could basically see at any time what my consumption was. If the needle wasn't all the way to the left while I was expecting it to, I would dig for the culprit.
Maybe we can try to do something similar, and when clicking on it, you get an ordered list of apps from the biggest consumer down).
The main problem of course is for that "meter" to work, one need to have an idea of what min and max are on a given machine... Absolute watt numbers or things like that are a lot less telling to Joe average.
Cheers,
Ben.
HI!
Quoted 26 lines
Quoted 7 lines
Quoted 6 lines
Of course that still doesn't address userspace. Aggressively going to suspend lets us compensate for userspace programs that do somewhat silly things (I agree that it would be best if they didn't but they do and getting *everyone* to write their userspace code to avoid spinning or avoid waking up on short-duration timers to poll is a losing battle).
Quoted 5 lines
actually with powertop... on the open source side things are actually won. It took all of 6 months...
I don't see that as a valid excuse. In fact, if this kind of solution makes real userspace scheduled timers to be missed then I consider it a serious functionality misfeature.While you can't expect the kernel to solve all the problems of userspace, here's the broad situation one could end up in (note this specific sequence is generic and not based on any one specific product experience):
- carrier deploys a device
- carrier agrees to allow installation of arbitrary third party apps without some horrible certification program requiring app authors to jump through hoops, wait ages for approval, etc
- users rejoice and install all kinds of apps
- some apps are poorly written and impact battery life
- users complain to carrier about battery life
Quoted 3 lines
You will end up with some crappy apps that do really dumb things. However, even if they're badly written users may still install and use these apps because hey, they do something the user likes.
Yes, crappy apps exist. Fortunately for you, they are written in Java, so you can do all the magic in the JVM, no need to hack it into kernel.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
HI!
Quoted 26 lines
Quoted 7 lines
Quoted 6 lines
Of course that still doesn't address userspace. Aggressively going to suspend lets us compensate for userspace programs that do somewhat silly things (I agree that it would be best if they didn't but they do and getting *everyone* to write their userspace code to avoid spinning or avoid waking up on short-duration timers to poll is a losing battle).
Quoted 5 lines
actually with powertop... on the open source side things are actually won. It took all of 6 months...
I don't see that as a valid excuse. In fact, if this kind of solution makes real userspace scheduled timers to be missed then I consider it a serious functionality misfeature.While you can't expect the kernel to solve all the problems of userspace, here's the broad situation one could end up in (note this specific sequence is generic and not based on any one specific product experience):
- carrier deploys a device
- carrier agrees to allow installation of arbitrary third party apps without some horrible certification program requiring app authors to jump through hoops, wait ages for approval, etc
- users rejoice and install all kinds of apps
- some apps are poorly written and impact battery life
- users complain to carrier about battery life
Quoted 3 lines
You will end up with some crappy apps that do really dumb things. However, even if they're badly written users may still install and use these apps because hey, they do something the user likes.
Yes, crappy apps exist. Fortunately for you, they are written in Java, so you can do all the magic in the JVM, no need to hack it into kernel.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi!
Quoted 12 lines
Quoted 5 lines
Arve said that the power state was equivalent in idle and suspend, but that they preferred suspend because it stopped any periodic timers. I'd be more interested in making sure that unnecessary timers aren't running than focusing on automatically entering system-wide suspend - Nokia have been managing this since 2005 with good results.
We'd totally agree that doing something about periodic timers would be a big win. There's also the situation that the longest ARM linux can sit in idle right now is ~2s at a time (Arve can expand on the exact issue relating to a 32bit signed nanosecond value somewhere iirc), which we'd want to sort out as well.
Quoted 5 lines
Of course that still doesn't address userspace. Aggressively going to suspend lets us compensate for userspace programs that do somewhat silly things (I agree that it would be best if they didn't but they do and getting *everyone* to write their userspace code to avoid spinning or avoid waking up on short-duration timers to poll is a losing battle).
Well, really? AFAICS, we can either
1) Android solution: let the polling code live, and modify everyone that _really_ wants to run to use wakelocks.
2) Solution proposed here: fix the polling code.
IMNSHO 1) means modifying many applications, too... See android marked, 50%+ apps request "keep system woke up" capability. Plus it means modifying _good_ code, and leaving _bad_ code unfixed. So I'd prefer 2). I believe ammount of work is pretty similar.
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi!
Quoted 12 lines
Quoted 5 lines
Arve said that the power state was equivalent in idle and suspend, but that they preferred suspend because it stopped any periodic timers. I'd be more interested in making sure that unnecessary timers aren't running than focusing on automatically entering system-wide suspend - Nokia have been managing this since 2005 with good results.
We'd totally agree that doing something about periodic timers would be a big win. There's also the situation that the longest ARM linux can sit in idle right now is ~2s at a time (Arve can expand on the exact issue relating to a 32bit signed nanosecond value somewhere iirc), which we'd want to sort out as well.
Quoted 5 lines
Of course that still doesn't address userspace. Aggressively going to suspend lets us compensate for userspace programs that do somewhat silly things (I agree that it would be best if they didn't but they do and getting *everyone* to write their userspace code to avoid spinning or avoid waking up on short-duration timers to poll is a losing battle).
Well, really? AFAICS, we can either
1) Android solution: let the polling code live, and modify everyone that _really_ wants to run to use wakelocks.
2) Solution proposed here: fix the polling code.
IMNSHO 1) means modifying many applications, too... See android marked, 50%+ apps request "keep system woke up" capability. Plus it means modifying _good_ code, and leaving _bad_ code unfixed. So I'd prefer 2). I believe ammount of work is pretty similar.
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 7 lines · Matthew Garrett
Quoted 4 lines · Rafael J. Wysocki
This, again, seems to be a bit x86-centric. :-) The Android people are telling us that on the hardware they deal with it does make sense to put the entire system to sleep even for relatively short periods of time, since the latencies involved are not too bad.
Quoted 6 lines
Arve said that the power state was equivalent in idle and suspend, but that they preferred suspend because it stopped any periodic timers. I'd be more interested in making sure that unnecessary timers aren't running than focusing on automatically entering system-wide suspend - Nokia have been managing this since 2005 with good results.
I think they where talking timers as hardware devices pulling electrons, not SW timers triggering wake ups. I guess the timer hardware could be running, and pulling power, even when not programmed to trigger any event or IRQ.
--mgross
Quoted 7 lines · Matthew Garrett
Quoted 4 lines · Rafael J. Wysocki
This, again, seems to be a bit x86-centric. :-) The Android people are telling us that on the hardware they deal with it does make sense to put the entire system to sleep even for relatively short periods of time, since the latencies involved are not too bad.
Quoted 6 lines
Arve said that the power state was equivalent in idle and suspend, but that they preferred suspend because it stopped any periodic timers. I'd be more interested in making sure that unnecessary timers aren't running than focusing on automatically entering system-wide suspend - Nokia have been managing this since 2005 with good results.
I think they where talking timers as hardware devices pulling electrons, not SW timers triggering wake ups. I guess the timer hardware could be running, and pulling power, even when not programmed to trigger any event or IRQ.
--mgross
Quoted 7 lines · Matthew Garrett
Quoted 4 lines · Rafael J. Wysocki
This, again, seems to be a bit x86-centric. :-) The Android people are telling us that on the hardware they deal with it does make sense to put the entire system to sleep even for relatively short periods of time, since the latencies involved are not too bad.
Quoted 5 lines
Arve said that the power state was equivalent in idle and suspend, but that they preferred suspend because it stopped any periodic timers. I'd be more interested in making sure that unnecessary timers aren't running than focusing on automatically entering system-wide suspend - Nokia have been managing this since 2005 with good results.
I'm sure you can build a product with acceptable battery life without suspend. The average power draw on the G1 while idle with everything off is less than the power draw was in suspend on our previous hardware. However, on the same hardware you get 40 days standby using suspend versus 20 days using idle. If you turn on the radio and use the device every day, this starts to become irrelevant since you are lucky to get more than a few days standby time. However, if you install an application that wakes up 60 times a second (to check if it need to draw something on the screen) the difference between idle and suspend becomes 10 hours versus 40 days, or 10 hours versus 3 days with my use.
Signature · 1 line
Arve Hjønnevåg
Quoted 7 lines · Matthew Garrett
Quoted 4 lines · Rafael J. Wysocki
This, again, seems to be a bit x86-centric. :-) The Android people are telling us that on the hardware they deal with it does make sense to put the entire system to sleep even for relatively short periods of time, since the latencies involved are not too bad.
Quoted 5 lines
Arve said that the power state was equivalent in idle and suspend, but that they preferred suspend because it stopped any periodic timers. I'd be more interested in making sure that unnecessary timers aren't running than focusing on automatically entering system-wide suspend - Nokia have been managing this since 2005 with good results.
I'm sure you can build a product with acceptable battery life without suspend. The average power draw on the G1 while idle with everything off is less than the power draw was in suspend on our previous hardware. However, on the same hardware you get 40 days standby using suspend versus 20 days using idle. If you turn on the radio and use the device every day, this starts to become irrelevant since you are lucky to get more than a few days standby time. However, if you install an application that wakes up 60 times a second (to check if it need to draw something on the screen) the difference between idle and suspend becomes 10 hours versus 40 days, or 10 hours versus 3 days with my use.
Signature · 1 line
Arve Hjønnevåg
Quoted 5 lines · On Thu, 19 Feb 2009 21:35:39 -0800 Arve Hjønnevåg <[email protected]> wrote:
However, if you
install an application that wakes up 60 times a second (to check if it need to draw something on the screen) the difference between idle and suspend becomes 10 hours versus 40 days, or 10 hours versus 3 days with my use.
then that is the point where you use the timerslack to throttle such non-system applications.... that's very obvious and there today..
Signature · 7 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 5 lines · On Thu, 19 Feb 2009 21:35:39 -0800 Arve Hjønnevåg <[email protected]> wrote:
However, if you
install an application that wakes up 60 times a second (to check if it need to draw something on the screen) the difference between idle and suspend becomes 10 hours versus 40 days, or 10 hours versus 3 days with my use.
then that is the point where you use the timerslack to throttle such non-system applications.... that's very obvious and there today..
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 8 lines · Matthew Garrett
Quoted 4 lines · Rafael J. Wysocki
This, again, seems to be a bit x86-centric. :-) The Android people are telling us that on the hardware they deal with it does make sense to put the entire system to sleep even for relatively short periods of time, since the latencies involved are not too bad.
Arve said that the power state was equivalent in idle and suspend, but
...for Arve's hardware. Not all embedded systems are like that, and OLPC / PCs are definitely not like that.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 8 lines · Matthew Garrett
Quoted 4 lines · Rafael J. Wysocki
This, again, seems to be a bit x86-centric. :-) The Android people are telling us that on the hardware they deal with it does make sense to put the entire system to sleep even for relatively short periods of time, since the latencies involved are not too bad.
Arve said that the power state was equivalent in idle and suspend, but
...for Arve's hardware. Not all embedded systems are like that, and OLPC / PCs are definitely not like that.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 8 lines · Pavel Machek
Quoted 7 lines · Matthew Garrett
Quoted 4 lines · Rafael J. Wysocki
This, again, seems to be a bit x86-centric. :-) The Android people are telling us that on the hardware they deal with it does make sense to put the entire system to sleep even for relatively short periods of time, since the latencies involved are not too bad.
Quoted 4 lines
Quoted 1 line
Arve said that the power state was equivalent in idle and suspend, but
...for Arve's hardware. Not all embedded systems are like that, and OLPC / PCs are definitely not like that.
And PCs have enough latency over suspend/resume that we can't do it automatically in a non-intrusive manner anyway, so runtime pm is more interesting there as well.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 8 lines · Pavel Machek
Quoted 7 lines · Matthew Garrett
Quoted 4 lines · Rafael J. Wysocki
This, again, seems to be a bit x86-centric. :-) The Android people are telling us that on the hardware they deal with it does make sense to put the entire system to sleep even for relatively short periods of time, since the latencies involved are not too bad.
Quoted 4 lines
Quoted 1 line
Arve said that the power state was equivalent in idle and suspend, but
...for Arve's hardware. Not all embedded systems are like that, and OLPC / PCs are definitely not like that.
And PCs have enough latency over suspend/resume that we can't do it automatically in a non-intrusive manner anyway, so runtime pm is more interesting there as well.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 9 lines · Matthew Garrett
Quoted 8 lines · Pavel Machek
Quoted 7 lines · Matthew Garrett
Quoted 4 lines · Rafael J. Wysocki
This, again, seems to be a bit x86-centric. :-) The Android people are telling us that on the hardware they deal with it does make sense to put the entire system to sleep even for relatively short periods of time, since the latencies involved are not too bad.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Arve said that the power state was equivalent in idle and suspend, but
...for Arve's hardware. Not all embedded systems are like that, and OLPC / PCs are definitely not like that.
And PCs have enough latency over suspend/resume that we can't do it automatically in a non-intrusive manner anyway, so runtime pm is more interesting there as well.
Agreed.
Thanks,
Rafael
Quoted 9 lines · Matthew Garrett
Quoted 8 lines · Pavel Machek
Quoted 7 lines · Matthew Garrett
Quoted 4 lines · Rafael J. Wysocki
This, again, seems to be a bit x86-centric. :-) The Android people are telling us that on the hardware they deal with it does make sense to put the entire system to sleep even for relatively short periods of time, since the latencies involved are not too bad.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Arve said that the power state was equivalent in idle and suspend, but
...for Arve's hardware. Not all embedded systems are like that, and OLPC / PCs are definitely not like that.
And PCs have enough latency over suspend/resume that we can't do it automatically in a non-intrusive manner anyway, so runtime pm is more interesting there as well.
Agreed.
Thanks,
Rafael
Quoted 12 lines · Rafael J. Wysocki
Quoted 11 lines · Matthew Garrett
Quoted 10 lines · Pavel Machek
Quoted 8 lines · Matthew Garrett
Quoted 4 lines · Rafael J. Wysocki
This, again, seems to be a bit x86-centric. :-) The Android people are telling us that on the hardware they deal with it does make sense to put the entire system to sleep even for relatively short periods of time, since the latencies involved are not too bad.
Arve said that the power state was equivalent in idle and suspend, but
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
...for Arve's hardware. Not all embedded systems are like that, and OLPC / PCs are definitely not like that.
And PCs have enough latency over suspend/resume that we can't do it automatically in a non-intrusive manner anyway, so runtime pm is more interesting there as well.
Agreed.
That high latency is coupled to a large difference in power use. If the latency of the lowest power state is too high to use from idle, it makes it more important, not less important, to enter suspend when possible.
Signature · 1 line
Arve Hjønnevåg
Quoted 12 lines · Rafael J. Wysocki
Quoted 11 lines · Matthew Garrett
Quoted 10 lines · Pavel Machek
Quoted 8 lines · Matthew Garrett
Quoted 4 lines · Rafael J. Wysocki
This, again, seems to be a bit x86-centric. :-) The Android people are telling us that on the hardware they deal with it does make sense to put the entire system to sleep even for relatively short periods of time, since the latencies involved are not too bad.
Arve said that the power state was equivalent in idle and suspend, but
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
...for Arve's hardware. Not all embedded systems are like that, and OLPC / PCs are definitely not like that.
And PCs have enough latency over suspend/resume that we can't do it automatically in a non-intrusive manner anyway, so runtime pm is more interesting there as well.
Agreed.
That high latency is coupled to a large difference in power use. If the latency of the lowest power state is too high to use from idle, it makes it more important, not less important, to enter suspend when possible.
Signature · 1 line
Arve Hjønnevåg
Quoted 7 lines · On Tue, 17 Feb 2009 00:19:38 +0100 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 5 lines
In addition, in hardware there does seem to be the trend where idle
and suspend are converging (just look at the OLPC)... with
chipsets powering down all unused pieces, and cpus in idle taking basically no power, there no longer is much of a difference in reality between suspend and good-idle...This, again, seems to be a bit x86-centric. :-)
actually absolutely not. To the contrary. It is, as you said, the embedded systems that have, and increasingly get, finer grained per device controls. (x86 embedded and otherwise). The more fine grained control you have, the less a system wide state will give you in additional power savings. This is pretty much the industry trend for all power sensitive systems.
Android might be using last years hardware. I'm not saying we shouldn't support that, but we need to be careful to not design the system only looking backwards.
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 7 lines · On Tue, 17 Feb 2009 00:19:38 +0100 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 5 lines
In addition, in hardware there does seem to be the trend where idle
and suspend are converging (just look at the OLPC)... with
chipsets powering down all unused pieces, and cpus in idle taking basically no power, there no longer is much of a difference in reality between suspend and good-idle...This, again, seems to be a bit x86-centric. :-)
actually absolutely not. To the contrary. It is, as you said, the embedded systems that have, and increasingly get, finer grained per device controls. (x86 embedded and otherwise). The more fine grained control you have, the less a system wide state will give you in additional power savings. This is pretty much the industry trend for all power sensitive systems.
Android might be using last years hardware. I'm not saying we shouldn't support that, but we need to be careful to not design the system only looking backwards.
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 31 lines · Richard
Quoted 6 lines
From: Arjan van de Ven [mailto:[email protected]]
Sent: Monday, February 16, 2009 3:52 PMQuoted 1 line · Richard
Quoted 7 lines
Quoted 4 lines
- It provides a way to handle overdrive/turbo operating points out of band from the generically tuned cpufreq governors like ondemand. The way we characterize overdrive is stricter then what Intel has talked about for x86.
if you have an improved-for-your-systems governor then I'm sure that is very welcome in the kernel.
No, the generic governors were not substantially improved. Not every customer is using cpufreq for DVFS. As such we went underneath it. If we had more community presence at the start time we might have also tried that.
Quoted 8 lines
I think just about all of us agree that the final decision needs to be in the driver (possibly followed by something that gets various device requests and combines it into hw settings); we're just talking about what inputs feed into that decision ;)
And for different types of devices that's guaranteed to be different... and sometimes we'll be hampered by existing interfaces, so we might end up with hacky stuff.
Is there some kind of roadmap which can be plotted which goes from course to more granular control?
Phase 1 (all or nothing): like wakelocks (minus back light):
system-auto-suspend-on, system-auto-suspend-off. The drivers can still veto as they do today.
Quoted 7 lines
Phase 2: Subsystem generic tunable, on say latency + bandwidth. Start with CPU then move to classes like USB.
Phase 3: ??? if needed add direct device control, hints on an extended
fadvise(), and explicit control left to open/close and direct ioctls?I don't know that 1,2,3 above even make sense.
I'd like to talk about this.
Phase 1: I agree that system-auto-suspend-on, system-auto-suspend-off would be useful, but I don't like the wakelocks interface. Do you think there is an alternative way/mechanism of doing this?
Phase 2: I'm not sure. We may want to introduce such things for various subsystems in parallel (eg. USB already has such things).
Phase 3: Probably explicit control left to open/close.
Quoted 2 lines
However, the notion of actually plotting out a course with goals does as it will take a long time and it is good to get some benefit along the way.
Agreed.
Thanks,
Rafael
Quoted 31 lines · Richard
Quoted 6 lines
From: Arjan van de Ven [mailto:[email protected]]
Sent: Monday, February 16, 2009 3:52 PMQuoted 1 line · Richard
Quoted 7 lines
Quoted 4 lines
- It provides a way to handle overdrive/turbo operating points out of band from the generically tuned cpufreq governors like ondemand. The way we characterize overdrive is stricter then what Intel has talked about for x86.
if you have an improved-for-your-systems governor then I'm sure that is very welcome in the kernel.
No, the generic governors were not substantially improved. Not every customer is using cpufreq for DVFS. As such we went underneath it. If we had more community presence at the start time we might have also tried that.
Quoted 8 lines
I think just about all of us agree that the final decision needs to be in the driver (possibly followed by something that gets various device requests and combines it into hw settings); we're just talking about what inputs feed into that decision ;)
And for different types of devices that's guaranteed to be different... and sometimes we'll be hampered by existing interfaces, so we might end up with hacky stuff.
Is there some kind of roadmap which can be plotted which goes from course to more granular control?
Phase 1 (all or nothing): like wakelocks (minus back light):
system-auto-suspend-on, system-auto-suspend-off. The drivers can still veto as they do today.
Quoted 7 lines
Phase 2: Subsystem generic tunable, on say latency + bandwidth. Start with CPU then move to classes like USB.
Phase 3: ??? if needed add direct device control, hints on an extended
fadvise(), and explicit control left to open/close and direct ioctls?I don't know that 1,2,3 above even make sense.
I'd like to talk about this.
Phase 1: I agree that system-auto-suspend-on, system-auto-suspend-off would be useful, but I don't like the wakelocks interface. Do you think there is an alternative way/mechanism of doing this?
Phase 2: I'm not sure. We may want to introduce such things for various subsystems in parallel (eg. USB already has such things).
Phase 3: Probably explicit control left to open/close.
Quoted 2 lines
However, the notion of actually plotting out a course with goals does as it will take a long time and it is good to get some benefit along the way.
Agreed.
Thanks,
Rafael
Quoted 3 lines · Rafael J. Wysocki
Phase 1: I agree that system-auto-suspend-on, system-auto-suspend-off would be useful, but I don't like the wakelocks interface. Do you think there is an alternative way/mechanism of doing this?
I rather like the suggestions Matthew Garrett has been making. They show how to improve the wakelock interface without losing any function.
Really, the idea behind wakelocks comes down to the question of how to determine when the system is sufficiently idle to go into auto-suspend. There may be occasions when no task is runnable but userspace knows that the system should not go to sleep because some work will be done in the near future. (Arve's example of a non-empty input buffer is such a case.) How should userspace let the kernel know whether it's okay to suspend at these times? That is the problem userspace wakelocks are meant to solve.
Kernel wakelocks are a separate matter. They are more like a form of optimization, preventing the kernel from starting an auto-suspend when some driver knows beforehand that it will return -EBUSY.
Quoted 1 line
Phase 3: Probably explicit control left to open/close.
While that's generally a good idea, it's important to recognize that some devices should be runtime-suspended even while they are open. Basically, any device that is "always open" falls in this category. Some examples are the screen, the keyboard, the mouse, and disk drives. And of course, some of these things already have runtime power management.
Alan Stern
Quoted 3 lines · Rafael J. Wysocki
Phase 1: I agree that system-auto-suspend-on, system-auto-suspend-off would be useful, but I don't like the wakelocks interface. Do you think there is an alternative way/mechanism of doing this?
I rather like the suggestions Matthew Garrett has been making. They show how to improve the wakelock interface without losing any function.
Really, the idea behind wakelocks comes down to the question of how to determine when the system is sufficiently idle to go into auto-suspend. There may be occasions when no task is runnable but userspace knows that the system should not go to sleep because some work will be done in the near future. (Arve's example of a non-empty input buffer is such a case.) How should userspace let the kernel know whether it's okay to suspend at these times? That is the problem userspace wakelocks are meant to solve.
Kernel wakelocks are a separate matter. They are more like a form of optimization, preventing the kernel from starting an auto-suspend when some driver knows beforehand that it will return -EBUSY.
Quoted 1 line
Phase 3: Probably explicit control left to open/close.
While that's generally a good idea, it's important to recognize that some devices should be runtime-suspended even while they are open. Basically, any device that is "always open" falls in this category. Some examples are the screen, the keyboard, the mouse, and disk drives. And of course, some of these things already have runtime power management.
Alan Stern
Quoted 9 lines · Alan Stern
Quoted 3 lines · Rafael J. Wysocki
Phase 1: I agree that system-auto-suspend-on, system-auto-suspend-off would be useful, but I don't like the wakelocks interface. Do you think there is an alternative way/mechanism of doing this?
I rather like the suggestions Matthew Garrett has been making. They show how to improve the wakelock interface without losing any function.
Quoted 8 lines
Really, the idea behind wakelocks comes down to the question of how to determine when the system is sufficiently idle to go into auto-suspend. There may be occasions when no task is runnable but userspace knows that the system should not go to sleep because some work will be done in the near future. (Arve's example of a non-empty input buffer is such a case.) How should userspace let the kernel know whether it's okay to suspend at these times? That is the problem userspace wakelocks are meant to solve.
Still, do we really need multiple user space wakelocks (I'd prefer to call them sleeplocks)? It seems that one such lock and a user space manager controlling it should be sufficient.
Quoted 3 lines
Kernel wakelocks are a separate matter. They are more like a form of optimization, preventing the kernel from starting an auto-suspend when some driver knows beforehand that it will return
-EBUSY.
I think kernel-side autosuspend (or rather autosleep) should only happen after certain subset of devices have been suspended using a per-device run-time autosuspend mechanism.
Quoted 6 lines
Quoted 1 line
Phase 3: Probably explicit control left to open/close.
While that's generally a good idea, it's important to recognize that some devices should be runtime-suspended even while they are open.
From the kernel side, yes (and that should be transparent to the user space
having them open). By the user space, no.
Quoted 4 lines
Basically, any device that is "always open" falls in this category. Some examples are the screen, the keyboard, the mouse, and disk drives. And of course, some of these things already have runtime power management.
Thanks,
Rafael
Quoted 9 lines · Alan Stern
Quoted 3 lines · Rafael J. Wysocki
Phase 1: I agree that system-auto-suspend-on, system-auto-suspend-off would be useful, but I don't like the wakelocks interface. Do you think there is an alternative way/mechanism of doing this?
I rather like the suggestions Matthew Garrett has been making. They show how to improve the wakelock interface without losing any function.
Quoted 8 lines
Really, the idea behind wakelocks comes down to the question of how to determine when the system is sufficiently idle to go into auto-suspend. There may be occasions when no task is runnable but userspace knows that the system should not go to sleep because some work will be done in the near future. (Arve's example of a non-empty input buffer is such a case.) How should userspace let the kernel know whether it's okay to suspend at these times? That is the problem userspace wakelocks are meant to solve.
Still, do we really need multiple user space wakelocks (I'd prefer to call them sleeplocks)? It seems that one such lock and a user space manager controlling it should be sufficient.
Quoted 3 lines
Kernel wakelocks are a separate matter. They are more like a form of optimization, preventing the kernel from starting an auto-suspend when some driver knows beforehand that it will return
-EBUSY.
I think kernel-side autosuspend (or rather autosleep) should only happen after certain subset of devices have been suspended using a per-device run-time autosuspend mechanism.
Quoted 6 lines
Quoted 1 line
Phase 3: Probably explicit control left to open/close.
While that's generally a good idea, it's important to recognize that some devices should be runtime-suspended even while they are open.
From the kernel side, yes (and that should be transparent to the user space
having them open). By the user space, no.
Quoted 4 lines
Basically, any device that is "always open" falls in this category. Some examples are the screen, the keyboard, the mouse, and disk drives. And of course, some of these things already have runtime power management.
Thanks,
Rafael
Quoted 19 lines · Rafael J. Wysocki
Quoted 9 lines · Alan Stern
Quoted 3 lines · Rafael J. Wysocki
Phase 1: I agree that system-auto-suspend-on, system-auto-suspend-off would be useful, but I don't like the wakelocks interface. Do you think there is an alternative way/mechanism of doing this?
I rather like the suggestions Matthew Garrett has been making. They show how to improve the wakelock interface without losing any function.
Quoted 8 lines
Really, the idea behind wakelocks comes down to the question of how to determine when the system is sufficiently idle to go into auto-suspend. There may be occasions when no task is runnable but userspace knows that the system should not go to sleep because some work will be done in the near future. (Arve's example of a non-empty input buffer is such a case.) How should userspace let the kernel know whether it's okay to suspend at these times? That is the problem userspace wakelocks are meant to solve.
Quoted 3 lines
Still, do we really need multiple user space wakelocks (I'd prefer to call them sleeplocks)? It seems that one such lock and a user space manager controlling it should be sufficient.
Yes, we could have a user space manager that all userspace wakelocks go through, but it would have to start before any other processes that need wakelocks and it would need a blocking ipc mechanism. The wakelock api that is provided to android applications does all this, but it is only available to java code. Supporting multiple userspace wakelocks in the kernel is simpler than adding another userspace wakelock layer.
Quoted 7 lines
Quoted 3 lines
Kernel wakelocks are a separate matter. They are more like a form of optimization, preventing the kernel from starting an auto-suspend when some driver knows beforehand that it will return
-EBUSY.I think kernel-side autosuspend (or rather autosleep) should only happen after certain subset of devices have been suspended using a per-device run-time autosuspend mechanism.
When the last wakelock is released the task that we woke up to perform has finished. Why wait to re-enter suspend.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Phase 3: Probably explicit control left to open/close.
While that's generally a good idea, it's important to recognize that some devices should be runtime-suspended even while they are open.
From the kernel side, yes (and that should be transparent to the user space having them open). By the user space, no.
Allowing user space to suspend input devices while they are still open is useful. The user-space code that reads from the input devices does not need to know if the device is suspended or not, and the kernel cannot auto suspend input devices based on inactivity.
Signature · 1 line
Arve Hjønnevåg
Quoted 19 lines · Rafael J. Wysocki
Quoted 9 lines · Alan Stern
Quoted 3 lines · Rafael J. Wysocki
Phase 1: I agree that system-auto-suspend-on, system-auto-suspend-off would be useful, but I don't like the wakelocks interface. Do you think there is an alternative way/mechanism of doing this?
I rather like the suggestions Matthew Garrett has been making. They show how to improve the wakelock interface without losing any function.
Quoted 8 lines
Really, the idea behind wakelocks comes down to the question of how to determine when the system is sufficiently idle to go into auto-suspend. There may be occasions when no task is runnable but userspace knows that the system should not go to sleep because some work will be done in the near future. (Arve's example of a non-empty input buffer is such a case.) How should userspace let the kernel know whether it's okay to suspend at these times? That is the problem userspace wakelocks are meant to solve.
Quoted 3 lines
Still, do we really need multiple user space wakelocks (I'd prefer to call them sleeplocks)? It seems that one such lock and a user space manager controlling it should be sufficient.
Yes, we could have a user space manager that all userspace wakelocks go through, but it would have to start before any other processes that need wakelocks and it would need a blocking ipc mechanism. The wakelock api that is provided to android applications does all this, but it is only available to java code. Supporting multiple userspace wakelocks in the kernel is simpler than adding another userspace wakelock layer.
Quoted 7 lines
Quoted 3 lines
Kernel wakelocks are a separate matter. They are more like a form of optimization, preventing the kernel from starting an auto-suspend when some driver knows beforehand that it will return
-EBUSY.I think kernel-side autosuspend (or rather autosleep) should only happen after certain subset of devices have been suspended using a per-device run-time autosuspend mechanism.
When the last wakelock is released the task that we woke up to perform has finished. Why wait to re-enter suspend.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Phase 3: Probably explicit control left to open/close.
While that's generally a good idea, it's important to recognize that some devices should be runtime-suspended even while they are open.
From the kernel side, yes (and that should be transparent to the user space having them open). By the user space, no.
Allowing user space to suspend input devices while they are still open is useful. The user-space code that reads from the input devices does not need to know if the device is suspended or not, and the kernel cannot auto suspend input devices based on inactivity.
Signature · 1 line
Arve Hjønnevåg
Quoted 36 lines · Arve Hjønnevåg
Quoted 19 lines · Rafael J. Wysocki
Quoted 9 lines · Alan Stern
Quoted 3 lines · Rafael J. Wysocki
Phase 1: I agree that system-auto-suspend-on, system-auto-suspend-off would be useful, but I don't like the wakelocks interface. Do you think there is an alternative way/mechanism of doing this?
I rather like the suggestions Matthew Garrett has been making. They show how to improve the wakelock interface without losing any function.
Quoted 8 lines
Really, the idea behind wakelocks comes down to the question of how to determine when the system is sufficiently idle to go into auto-suspend. There may be occasions when no task is runnable but userspace knows that the system should not go to sleep because some work will be done in the near future. (Arve's example of a non-empty input buffer is such a case.) How should userspace let the kernel know whether it's okay to suspend at these times? That is the problem userspace wakelocks are meant to solve.
Quoted 3 lines
Still, do we really need multiple user space wakelocks (I'd prefer to call them sleeplocks)? It seems that one such lock and a user space manager controlling it should be sufficient.
Yes, we could have a user space manager that all userspace wakelocks go through, but it would have to start before any other processes that need wakelocks and it would need a blocking ipc mechanism. The wakelock api that is provided to android applications does all this, but it is only available to java code. Supporting multiple userspace wakelocks in the kernel is simpler than adding another userspace wakelock layer.
Quoted 4 lines
Quoted 3 lines
Kernel wakelocks are a separate matter. They are more like a form of optimization, preventing the kernel from starting an auto-suspend when some driver knows beforehand that it will return
-EBUSY.
Quoted 6 lines
Quoted 3 lines
I think kernel-side autosuspend (or rather autosleep) should only happen after certain subset of devices have been suspended using a per-device run-time autosuspend mechanism.
When the last wakelock is released the task that we woke up to perform has finished. Why wait to re-enter suspend.
I don't really understand this comment. Could you please explain a bit?
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
Phase 3: Probably explicit control left to open/close.
While that's generally a good idea, it's important to recognize that some devices should be runtime-suspended even while they are open.
Quoted 7 lines
Quoted 2 lines
From the kernel side, yes (and that should be transparent to the user space having them open). By the user space, no.
Allowing user space to suspend input devices while they are still open is useful. The user-space code that reads from the input devices does not need to know if the device is suspended or not, and the kernel cannot auto suspend input devices based on inactivity.
Hmm. Why can't it?
Rafael
Quoted 36 lines · Arve Hjønnevåg
Quoted 19 lines · Rafael J. Wysocki
Quoted 9 lines · Alan Stern
Quoted 3 lines · Rafael J. Wysocki
Phase 1: I agree that system-auto-suspend-on, system-auto-suspend-off would be useful, but I don't like the wakelocks interface. Do you think there is an alternative way/mechanism of doing this?
I rather like the suggestions Matthew Garrett has been making. They show how to improve the wakelock interface without losing any function.
Quoted 8 lines
Really, the idea behind wakelocks comes down to the question of how to determine when the system is sufficiently idle to go into auto-suspend. There may be occasions when no task is runnable but userspace knows that the system should not go to sleep because some work will be done in the near future. (Arve's example of a non-empty input buffer is such a case.) How should userspace let the kernel know whether it's okay to suspend at these times? That is the problem userspace wakelocks are meant to solve.
Quoted 3 lines
Still, do we really need multiple user space wakelocks (I'd prefer to call them sleeplocks)? It seems that one such lock and a user space manager controlling it should be sufficient.
Yes, we could have a user space manager that all userspace wakelocks go through, but it would have to start before any other processes that need wakelocks and it would need a blocking ipc mechanism. The wakelock api that is provided to android applications does all this, but it is only available to java code. Supporting multiple userspace wakelocks in the kernel is simpler than adding another userspace wakelock layer.
Quoted 4 lines
Quoted 3 lines
Kernel wakelocks are a separate matter. They are more like a form of optimization, preventing the kernel from starting an auto-suspend when some driver knows beforehand that it will return
-EBUSY.
Quoted 6 lines
Quoted 3 lines
I think kernel-side autosuspend (or rather autosleep) should only happen after certain subset of devices have been suspended using a per-device run-time autosuspend mechanism.
When the last wakelock is released the task that we woke up to perform has finished. Why wait to re-enter suspend.
I don't really understand this comment. Could you please explain a bit?
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
Phase 3: Probably explicit control left to open/close.
While that's generally a good idea, it's important to recognize that some devices should be runtime-suspended even while they are open.
Quoted 7 lines
Quoted 2 lines
From the kernel side, yes (and that should be transparent to the user space having them open). By the user space, no.
Allowing user space to suspend input devices while they are still open is useful. The user-space code that reads from the input devices does not need to know if the device is suspended or not, and the kernel cannot auto suspend input devices based on inactivity.
Hmm. Why can't it?
Rafael
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Arve Hjønnevåg
Quoted 6 lines · Rafael J. Wysocki
Quoted 3 lines · Alan Stern
Kernel wakelocks are a separate matter. They are more like a form of optimization, preventing the kernel from starting an auto-suspend when some driver knows beforehand that it will return
-EBUSY.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
I think kernel-side autosuspend (or rather autosleep) should only happen after certain subset of devices have been suspended using a per-device run-time autosuspend mechanism.
When the last wakelock is released the task that we woke up to perform has finished. Why wait to re-enter suspend.
I don't really understand this comment. Could you please explain a bit?
If some devices are autosuspended after a local inactivity timeout, I don't want to wait for those devices to autosuspend if I know the code that needed to run is done. This could cause delays in the normal case, and it could prevent suspend if a background process (not using wakelocks) is accessing a disk more frequently than its idle timeout.
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Phase 3: Probably explicit control left to open/close.
While that's generally a good idea, it's important to recognize that some devices should be runtime-suspended even while they are open.
From the kernel side, yes (and that should be transparent to the user space having them open). By the user space, no.
Quoted 6 lines
Quoted 4 lines
Allowing user space to suspend input devices while they are still open is useful. The user-space code that reads from the input devices does not need to know if the device is suspended or not, and the kernel cannot auto suspend input devices based on inactivity.
Hmm. Why can't it?
Because they stop working. It is OK for us to turn off the touchscreen when the screen is off, but when the screen is on the user will touch items on the screen and expect them to respond. (We could also turn off the touchscreen when the keyguard is on, but we don't currently do this.)
Signature · 1 line
Arve Hjønnevåg
Am Wednesday 18 February 2009 23:35:26 schrieb Arve Hjønnevåg:
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Allowing user space to suspend input devices while they are still open is useful. The user-space code that reads from the input devices does not need to know if the device is suspended or not, and the kernel cannot auto suspend input devices based on inactivity.
Quoted 7 lines
Quoted 1 line
Hmm. Why can't it?
Because they stop working. It is OK for us to turn off the touchscreen when the screen is off, but when the screen is on the user will touch items on the screen and expect them to respond. (We could also turn off the touchscreen when the keyguard is on, but we don't currently do this.)
This depends on the capabilities of the input device in question. Some USB keyboards can be autosuspended under these conditions because they can do remote wakeup.
Regards
Oliver
Quoted 16 lines · Arve Hjønnevåg
Quoted 15 lines · Rafael J. Wysocki
Quoted 13 lines · Arve Hjønnevåg
Quoted 9 lines · Rafael J. Wysocki
Quoted 3 lines · Alan Stern
Kernel wakelocks are a separate matter. They are more like a form of optimization, preventing the kernel from starting an auto-suspend when some driver knows beforehand that it will return
-EBUSY.I think kernel-side autosuspend (or rather autosleep) should only happen after certain subset of devices have been suspended using a per-device run-time autosuspend mechanism.
When the last wakelock is released the task that we woke up to perform has finished. Why wait to re-enter suspend.
Quoted 6 lines
Quoted 1 line
I don't really understand this comment. Could you please explain a bit?
If some devices are autosuspended after a local inactivity timeout, I don't want to wait for those devices to autosuspend if I know the code that needed to run is done. This could cause delays in the normal case,
Isn't it a matter of adjusting the inactivity timeouts in a suitable way?
Quoted 2 lines
and it could prevent suspend if a background process (not using wakelocks) is accessing a disk more frequently than its idle timeout.
Well, actually, shouldn't it prevent suspend from happening? Arguably, it just means that the disk is continuously being accessed with respect to the inactive timeout granularity.
Rafael
Quoted 16 lines · Arve Hjønnevåg
Quoted 15 lines · Rafael J. Wysocki
Quoted 13 lines · Arve Hjønnevåg
Quoted 9 lines · Rafael J. Wysocki
Quoted 3 lines · Alan Stern
Kernel wakelocks are a separate matter. They are more like a form of optimization, preventing the kernel from starting an auto-suspend when some driver knows beforehand that it will return
-EBUSY.I think kernel-side autosuspend (or rather autosleep) should only happen after certain subset of devices have been suspended using a per-device run-time autosuspend mechanism.
When the last wakelock is released the task that we woke up to perform has finished. Why wait to re-enter suspend.
Quoted 6 lines
Quoted 1 line
I don't really understand this comment. Could you please explain a bit?
If some devices are autosuspended after a local inactivity timeout, I don't want to wait for those devices to autosuspend if I know the code that needed to run is done. This could cause delays in the normal case,
Isn't it a matter of adjusting the inactivity timeouts in a suitable way?
Quoted 2 lines
and it could prevent suspend if a background process (not using wakelocks) is accessing a disk more frequently than its idle timeout.
Well, actually, shouldn't it prevent suspend from happening? Arguably, it just means that the disk is continuously being accessed with respect to the inactive timeout granularity.
Rafael
Quoted 6 lines · Rafael J. Wysocki
Quoted 4 lines
If some devices are autosuspended after a local inactivity timeout, I don't want to wait for those devices to autosuspend if I know the code that needed to run is done. This could cause delays in the normal case,
Isn't it a matter of adjusting the inactivity timeouts in a suitable way?
It's not that simple. A single device driver has a very local view, not suitable for deciding whether the entire system should go to sleep.
So for example, a disk driver might think it's appropriate to spin down the disk after 10 seconds of inactivity. But an overall system monitor might realize that nothing is going on right now and want to put the system to sleep immediately, without waiting the 10 seconds for the disk to autosuspend.
Quoted 6 lines
Quoted 2 lines
and it could prevent suspend if a background process (not using wakelocks) is accessing a disk more frequently than its idle timeout.
Well, actually, shouldn't it prevent suspend from happening? Arguably, it just means that the disk is continuously being accessed with respect to the inactive timeout granularity.
That's true, but it shows the problem of making the autosleep decision based on disk activity. An auto-sleep should not have to wait for every device (or some suitable subset) to become idle for some minimum time; it should be able to kick in at short notice.
Alan Stern
Quoted 6 lines · Rafael J. Wysocki
Quoted 4 lines
If some devices are autosuspended after a local inactivity timeout, I don't want to wait for those devices to autosuspend if I know the code that needed to run is done. This could cause delays in the normal case,
Isn't it a matter of adjusting the inactivity timeouts in a suitable way?
It's not that simple. A single device driver has a very local view, not suitable for deciding whether the entire system should go to sleep.
So for example, a disk driver might think it's appropriate to spin down the disk after 10 seconds of inactivity. But an overall system monitor might realize that nothing is going on right now and want to put the system to sleep immediately, without waiting the 10 seconds for the disk to autosuspend.
Quoted 6 lines
Quoted 2 lines
and it could prevent suspend if a background process (not using wakelocks) is accessing a disk more frequently than its idle timeout.
Well, actually, shouldn't it prevent suspend from happening? Arguably, it just means that the disk is continuously being accessed with respect to the inactive timeout granularity.
That's true, but it shows the problem of making the autosleep decision based on disk activity. An auto-sleep should not have to wait for every device (or some suitable subset) to become idle for some minimum time; it should be able to kick in at short notice.
Alan Stern
Quoted 9 lines · Alan Stern
Quoted 6 lines · Rafael J. Wysocki
Quoted 4 lines
If some devices are autosuspended after a local inactivity timeout, I don't want to wait for those devices to autosuspend if I know the code that needed to run is done. This could cause delays in the normal case,
Isn't it a matter of adjusting the inactivity timeouts in a suitable way?
Quoted 8 lines
It's not that simple. A single device driver has a very local view, not suitable for deciding whether the entire system should go to sleep.
So for example, a disk driver might think it's appropriate to spin down the disk after 10 seconds of inactivity. But an overall system monitor might realize that nothing is going on right now and want to put the system to sleep immediately, without waiting the 10 seconds for the disk to autosuspend.
Now, the question is what criteria would the overall system monitor use to make such a decision.
Quoted 11 lines
Quoted 6 lines
Quoted 2 lines
and it could prevent suspend if a background process (not using wakelocks) is accessing a disk more frequently than its idle timeout.
Well, actually, shouldn't it prevent suspend from happening? Arguably, it just means that the disk is continuously being accessed with respect to the inactive timeout granularity.
That's true, but it shows the problem of making the autosleep decision based on disk activity. An auto-sleep should not have to wait for every device (or some suitable subset) to become idle for some minimum time; it should be able to kick in at short notice.
Again, the decision to trigger automatic suspend has to be based on some well defined criteria and the (in)activity of devices seems to be one of them.
Thanks,
Rafael
Quoted 9 lines · Alan Stern
Quoted 6 lines · Rafael J. Wysocki
Quoted 4 lines
If some devices are autosuspended after a local inactivity timeout, I don't want to wait for those devices to autosuspend if I know the code that needed to run is done. This could cause delays in the normal case,
Isn't it a matter of adjusting the inactivity timeouts in a suitable way?
Quoted 8 lines
It's not that simple. A single device driver has a very local view, not suitable for deciding whether the entire system should go to sleep.
So for example, a disk driver might think it's appropriate to spin down the disk after 10 seconds of inactivity. But an overall system monitor might realize that nothing is going on right now and want to put the system to sleep immediately, without waiting the 10 seconds for the disk to autosuspend.
Now, the question is what criteria would the overall system monitor use to make such a decision.
Quoted 11 lines
Quoted 6 lines
Quoted 2 lines
and it could prevent suspend if a background process (not using wakelocks) is accessing a disk more frequently than its idle timeout.
Well, actually, shouldn't it prevent suspend from happening? Arguably, it just means that the disk is continuously being accessed with respect to the inactive timeout granularity.
That's true, but it shows the problem of making the autosleep decision based on disk activity. An auto-sleep should not have to wait for every device (or some suitable subset) to become idle for some minimum time; it should be able to kick in at short notice.
Again, the decision to trigger automatic suspend has to be based on some well defined criteria and the (in)activity of devices seems to be one of them.
Thanks,
Rafael
Quoted 29 lines · Rafael J. Wysocki
Quoted 9 lines · Alan Stern
Quoted 6 lines · Rafael J. Wysocki
Quoted 4 lines
If some devices are autosuspended after a local inactivity timeout, I don't want to wait for those devices to autosuspend if I know the code that needed to run is done. This could cause delays in the normal case,
Isn't it a matter of adjusting the inactivity timeouts in a suitable way?
Quoted 8 lines
It's not that simple. A single device driver has a very local view, not suitable for deciding whether the entire system should go to sleep.
So for example, a disk driver might think it's appropriate to spin down the disk after 10 seconds of inactivity. But an overall system monitor might realize that nothing is going on right now and want to put the system to sleep immediately, without waiting the 10 seconds for the disk to autosuspend.
Now, the question is what criteria would the overall system monitor use to make such a decision.
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
and it could prevent suspend if a background process (not using wakelocks) is accessing a disk more frequently than its idle timeout.
Well, actually, shouldn't it prevent suspend from happening? Arguably, it just means that the disk is continuously being accessed with respect to the inactive timeout granularity.
Quoted 7 lines
Quoted 4 lines
That's true, but it shows the problem of making the autosleep decision based on disk activity. An auto-sleep should not have to wait for every device (or some suitable subset) to become idle for some minimum time; it should be able to kick in at short notice.
Again, the decision to trigger automatic suspend has to be based on some well defined criteria and the (in)activity of devices seems to be one of them.
I don't know what criteria the system monitor would use. It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
Inactivity of devices isn't always a good criterion. There might be a background task which wakes up every few seconds to do something as long as the system is awake, thereby keeping some device always active. The activity from this background task shouldn't prevent an auto-sleep.
Alan Stern
Quoted 29 lines · Rafael J. Wysocki
Quoted 9 lines · Alan Stern
Quoted 6 lines · Rafael J. Wysocki
Quoted 4 lines
If some devices are autosuspended after a local inactivity timeout, I don't want to wait for those devices to autosuspend if I know the code that needed to run is done. This could cause delays in the normal case,
Isn't it a matter of adjusting the inactivity timeouts in a suitable way?
Quoted 8 lines
It's not that simple. A single device driver has a very local view, not suitable for deciding whether the entire system should go to sleep.
So for example, a disk driver might think it's appropriate to spin down the disk after 10 seconds of inactivity. But an overall system monitor might realize that nothing is going on right now and want to put the system to sleep immediately, without waiting the 10 seconds for the disk to autosuspend.
Now, the question is what criteria would the overall system monitor use to make such a decision.
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
and it could prevent suspend if a background process (not using wakelocks) is accessing a disk more frequently than its idle timeout.
Well, actually, shouldn't it prevent suspend from happening? Arguably, it just means that the disk is continuously being accessed with respect to the inactive timeout granularity.
Quoted 7 lines
Quoted 4 lines
That's true, but it shows the problem of making the autosleep decision based on disk activity. An auto-sleep should not have to wait for every device (or some suitable subset) to become idle for some minimum time; it should be able to kick in at short notice.
Again, the decision to trigger automatic suspend has to be based on some well defined criteria and the (in)activity of devices seems to be one of them.
I don't know what criteria the system monitor would use. It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
Inactivity of devices isn't always a good criterion. There might be a background task which wakes up every few seconds to do something as long as the system is awake, thereby keeping some device always active. The activity from this background task shouldn't prevent an auto-sleep.
Alan Stern
Quoted 36 lines · Alan Stern
Quoted 34 lines · Rafael J. Wysocki
Quoted 9 lines · Alan Stern
Quoted 6 lines · Rafael J. Wysocki
Quoted 4 lines
If some devices are autosuspended after a local inactivity timeout, I don't want to wait for those devices to autosuspend if I know the code that needed to run is done. This could cause delays in the normal case,
Isn't it a matter of adjusting the inactivity timeouts in a suitable way?
Quoted 8 lines
It's not that simple. A single device driver has a very local view, not suitable for deciding whether the entire system should go to sleep.
So for example, a disk driver might think it's appropriate to spin down the disk after 10 seconds of inactivity. But an overall system monitor might realize that nothing is going on right now and want to put the system to sleep immediately, without waiting the 10 seconds for the disk to autosuspend.
Now, the question is what criteria would the overall system monitor use to make such a decision.
Quoted 11 lines
Quoted 6 lines
Quoted 2 lines
and it could prevent suspend if a background process (not using wakelocks) is accessing a disk more frequently than its idle timeout.
Well, actually, shouldn't it prevent suspend from happening? Arguably, it just means that the disk is continuously being accessed with respect to the inactive timeout granularity.
That's true, but it shows the problem of making the autosleep decision based on disk activity. An auto-sleep should not have to wait for every device (or some suitable subset) to become idle for some minimum time; it should be able to kick in at short notice.
Quoted 4 lines
Quoted 2 lines
Again, the decision to trigger automatic suspend has to be based on some well defined criteria and the (in)activity of devices seems to be one of them.
I don't know what criteria the system monitor would use.
I don't know either and this is the whole point. They need to be specified somehow and I'm not sure if "we suspend if no one is holding a wakelock" is the right approach.
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
Quoted 4 lines
Inactivity of devices isn't always a good criterion. There might be a background task which wakes up every few seconds to do something as long as the system is awake, thereby keeping some device always active. The activity from this background task shouldn't prevent an auto-sleep.
In fact there are two problems here. First, there may be a task preventing some devices from becoming inactive (like syslog). Second, there may be a task waiting for something important to happen, such that automatic suspend cannot be triggered while it's waiting. In both cases, IMO, the kernel is not in a point to decide whether to suspend or not, because the user space knows better.
Thanks,
Rafael
Quoted 36 lines · Alan Stern
Quoted 34 lines · Rafael J. Wysocki
Quoted 9 lines · Alan Stern
Quoted 6 lines · Rafael J. Wysocki
Quoted 4 lines
If some devices are autosuspended after a local inactivity timeout, I don't want to wait for those devices to autosuspend if I know the code that needed to run is done. This could cause delays in the normal case,
Isn't it a matter of adjusting the inactivity timeouts in a suitable way?
Quoted 8 lines
It's not that simple. A single device driver has a very local view, not suitable for deciding whether the entire system should go to sleep.
So for example, a disk driver might think it's appropriate to spin down the disk after 10 seconds of inactivity. But an overall system monitor might realize that nothing is going on right now and want to put the system to sleep immediately, without waiting the 10 seconds for the disk to autosuspend.
Now, the question is what criteria would the overall system monitor use to make such a decision.
Quoted 11 lines
Quoted 6 lines
Quoted 2 lines
and it could prevent suspend if a background process (not using wakelocks) is accessing a disk more frequently than its idle timeout.
Well, actually, shouldn't it prevent suspend from happening? Arguably, it just means that the disk is continuously being accessed with respect to the inactive timeout granularity.
That's true, but it shows the problem of making the autosleep decision based on disk activity. An auto-sleep should not have to wait for every device (or some suitable subset) to become idle for some minimum time; it should be able to kick in at short notice.
Quoted 4 lines
Quoted 2 lines
Again, the decision to trigger automatic suspend has to be based on some well defined criteria and the (in)activity of devices seems to be one of them.
I don't know what criteria the system monitor would use.
I don't know either and this is the whole point. They need to be specified somehow and I'm not sure if "we suspend if no one is holding a wakelock" is the right approach.
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
Quoted 4 lines
Inactivity of devices isn't always a good criterion. There might be a background task which wakes up every few seconds to do something as long as the system is awake, thereby keeping some device always active. The activity from this background task shouldn't prevent an auto-sleep.
In fact there are two problems here. First, there may be a task preventing some devices from becoming inactive (like syslog). Second, there may be a task waiting for something important to happen, such that automatic suspend cannot be triggered while it's waiting. In both cases, IMO, the kernel is not in a point to decide whether to suspend or not, because the user space knows better.
Thanks,
Rafael
["Rafael J. Wysocki" <[email protected]>]
Quoted 6 lines
Quoted 3 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
Currently, whenever the display is off (after the user-selectable timeout), we aggressively enter suspend -- wakelocks are used to prevent suspend when a driver or userspace entity needs the CPU to actually be awake.
Brian
["Rafael J. Wysocki" <[email protected]>]
Quoted 6 lines
Quoted 3 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
Currently, whenever the display is off (after the user-selectable timeout), we aggressively enter suspend -- wakelocks are used to prevent suspend when a driver or userspace entity needs the CPU to actually be awake.
Brian
Quoted 8 lines · Rafael J. Wysocki
Quoted 4 lines
Quoted 2 lines
Again, the decision to trigger automatic suspend has to be based on some well defined criteria and the (in)activity of devices seems to be one of them.
I don't know what criteria the system monitor would use.
I don't know either and this is the whole point. They need to be specified somehow and I'm not sure if "we suspend if no one is holding a wakelock" is the right approach.
That isn't really a criterion; it's just a mechanism. All it does is push the problem back one level. Now the question becomes: When is it appropriate/necessary to hold a wakelock?
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
Quoted 7 lines
Quoted 4 lines
Inactivity of devices isn't always a good criterion. There might be a background task which wakes up every few seconds to do something as long as the system is awake, thereby keeping some device always active. The activity from this background task shouldn't prevent an auto-sleep.
In fact there are two problems here. First, there may be a task preventing some devices from becoming inactive (like syslog).
Which means that device inactivity isn't always a good indicator for auto-sleep. (But then there can be different levels of activity: A disk should always block auto-sleep while it is carrying out I/O, but it might not block auto-sleep just because it is spinning.)
Quoted 5 lines
Second, there may be
a task waiting for something important to happen, such that automatic suspend cannot be triggered while it's waiting. In both cases, IMO, the kernel is not in a point to decide whether to suspend or not, because the user space knows better.
That's the whole point behind userspace wakelocks! They provide a mechanism for userspace to tell the kernel when (as far as userspace is concerned) it is or is not okay to auto-sleep.
Alan Stern
Quoted 8 lines · Rafael J. Wysocki
Quoted 4 lines
Quoted 2 lines
Again, the decision to trigger automatic suspend has to be based on some well defined criteria and the (in)activity of devices seems to be one of them.
I don't know what criteria the system monitor would use.
I don't know either and this is the whole point. They need to be specified somehow and I'm not sure if "we suspend if no one is holding a wakelock" is the right approach.
That isn't really a criterion; it's just a mechanism. All it does is push the problem back one level. Now the question becomes: When is it appropriate/necessary to hold a wakelock?
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
Quoted 7 lines
Quoted 4 lines
Inactivity of devices isn't always a good criterion. There might be a background task which wakes up every few seconds to do something as long as the system is awake, thereby keeping some device always active. The activity from this background task shouldn't prevent an auto-sleep.
In fact there are two problems here. First, there may be a task preventing some devices from becoming inactive (like syslog).
Which means that device inactivity isn't always a good indicator for auto-sleep. (But then there can be different levels of activity: A disk should always block auto-sleep while it is carrying out I/O, but it might not block auto-sleep just because it is spinning.)
Quoted 5 lines
Second, there may be
a task waiting for something important to happen, such that automatic suspend cannot be triggered while it's waiting. In both cases, IMO, the kernel is not in a point to decide whether to suspend or not, because the user space knows better.
That's the whole point behind userspace wakelocks! They provide a mechanism for userspace to tell the kernel when (as far as userspace is concerned) it is or is not okay to auto-sleep.
Alan Stern
Quoted 8 lines · Rafael J. Wysocki
Quoted 4 lines
Quoted 2 lines
Again, the decision to trigger automatic suspend has to be based on some well defined criteria and the (in)activity of devices seems to be one of them.
I don't know what criteria the system monitor would use.
I don't know either and this is the whole point. They need to be specified somehow and I'm not sure if "we suspend if no one is holding a wakelock" is the right approach.
That isn't really a criterion; it's just a mechanism. All it does is push the problem back one level. Now the question becomes: When is it appropriate/necessary to hold a wakelock?
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
Quoted 7 lines
Quoted 4 lines
Inactivity of devices isn't always a good criterion. There might be a background task which wakes up every few seconds to do something as long as the system is awake, thereby keeping some device always active. The activity from this background task shouldn't prevent an auto-sleep.
In fact there are two problems here. First, there may be a task preventing some devices from becoming inactive (like syslog).
Which means that device inactivity isn't always a good indicator for auto-sleep. (But then there can be different levels of activity: A disk should always block auto-sleep while it is carrying out I/O, but it might not block auto-sleep just because it is spinning.)
Quoted 5 lines
Second, there may be
a task waiting for something important to happen, such that automatic suspend cannot be triggered while it's waiting. In both cases, IMO, the kernel is not in a point to decide whether to suspend or not, because the user space knows better.
That's the whole point behind userspace wakelocks! They provide a mechanism for userspace to tell the kernel when (as far as userspace is concerned) it is or is not okay to auto-sleep.
Alan Stern
Quoted 8 lines · Rafael J. Wysocki
Quoted 4 lines
Quoted 2 lines
Again, the decision to trigger automatic suspend has to be based on some well defined criteria and the (in)activity of devices seems to be one of them.
I don't know what criteria the system monitor would use.
I don't know either and this is the whole point. They need to be specified somehow and I'm not sure if "we suspend if no one is holding a wakelock" is the right approach.
That isn't really a criterion; it's just a mechanism. All it does is push the problem back one level. Now the question becomes: When is it appropriate/necessary to hold a wakelock?
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
Quoted 7 lines
Quoted 4 lines
Inactivity of devices isn't always a good criterion. There might be a background task which wakes up every few seconds to do something as long as the system is awake, thereby keeping some device always active. The activity from this background task shouldn't prevent an auto-sleep.
In fact there are two problems here. First, there may be a task preventing some devices from becoming inactive (like syslog).
Which means that device inactivity isn't always a good indicator for auto-sleep. (But then there can be different levels of activity: A disk should always block auto-sleep while it is carrying out I/O, but it might not block auto-sleep just because it is spinning.)
Quoted 5 lines
Second, there may be
a task waiting for something important to happen, such that automatic suspend cannot be triggered while it's waiting. In both cases, IMO, the kernel is not in a point to decide whether to suspend or not, because the user space knows better.
That's the whole point behind userspace wakelocks! They provide a mechanism for userspace to tell the kernel when (as far as userspace is concerned) it is or is not okay to auto-sleep.
Alan Stern
Quoted 45 lines · Alan Stern
Quoted 8 lines · Rafael J. Wysocki
Quoted 4 lines
Quoted 2 lines
Again, the decision to trigger automatic suspend has to be based on some well defined criteria and the (in)activity of devices seems to be one of them.
I don't know what criteria the system monitor would use.
I don't know either and this is the whole point. They need to be specified somehow and I'm not sure if "we suspend if no one is holding a wakelock" is the right approach.
That isn't really a criterion; it's just a mechanism. All it does is push the problem back one level. Now the question becomes: When is it appropriate/necessary to hold a wakelock?
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
Quoted 7 lines
Quoted 4 lines
Inactivity of devices isn't always a good criterion. There might be a background task which wakes up every few seconds to do something as long as the system is awake, thereby keeping some device always active. The activity from this background task shouldn't prevent an auto-sleep.
In fact there are two problems here. First, there may be a task preventing some devices from becoming inactive (like syslog).
Which means that device inactivity isn't always a good indicator for auto-sleep. (But then there can be different levels of activity: A disk should always block auto-sleep while it is carrying out I/O, but it might not block auto-sleep just because it is spinning.)
Quoted 5 lines
Second, there may be
a task waiting for something important to happen, such that automatic suspend cannot be triggered while it's waiting. In both cases, IMO, the kernel is not in a point to decide whether to suspend or not, because the user space knows better.
Quoted 3 lines
That's the whole point behind userspace wakelocks! They provide a mechanism for userspace to tell the kernel when (as far as userspace is concerned) it is or is not okay to auto-sleep.
Still, one can go further and observe that the user space can in fact start automatic suspend by itself whenever it knows it's appropriate ...
Thanks,
Rafael
Quoted 45 lines · Alan Stern
Quoted 8 lines · Rafael J. Wysocki
Quoted 4 lines
Quoted 2 lines
Again, the decision to trigger automatic suspend has to be based on some well defined criteria and the (in)activity of devices seems to be one of them.
I don't know what criteria the system monitor would use.
I don't know either and this is the whole point. They need to be specified somehow and I'm not sure if "we suspend if no one is holding a wakelock" is the right approach.
That isn't really a criterion; it's just a mechanism. All it does is push the problem back one level. Now the question becomes: When is it appropriate/necessary to hold a wakelock?
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
Quoted 7 lines
Quoted 4 lines
Inactivity of devices isn't always a good criterion. There might be a background task which wakes up every few seconds to do something as long as the system is awake, thereby keeping some device always active. The activity from this background task shouldn't prevent an auto-sleep.
In fact there are two problems here. First, there may be a task preventing some devices from becoming inactive (like syslog).
Which means that device inactivity isn't always a good indicator for auto-sleep. (But then there can be different levels of activity: A disk should always block auto-sleep while it is carrying out I/O, but it might not block auto-sleep just because it is spinning.)
Quoted 5 lines
Second, there may be
a task waiting for something important to happen, such that automatic suspend cannot be triggered while it's waiting. In both cases, IMO, the kernel is not in a point to decide whether to suspend or not, because the user space knows better.
Quoted 3 lines
That's the whole point behind userspace wakelocks! They provide a mechanism for userspace to tell the kernel when (as far as userspace is concerned) it is or is not okay to auto-sleep.
Still, one can go further and observe that the user space can in fact start automatic suspend by itself whenever it knows it's appropriate ...
Thanks,
Rafael
Quoted 45 lines · Alan Stern
Quoted 8 lines · Rafael J. Wysocki
Quoted 4 lines
Quoted 2 lines
Again, the decision to trigger automatic suspend has to be based on some well defined criteria and the (in)activity of devices seems to be one of them.
I don't know what criteria the system monitor would use.
I don't know either and this is the whole point. They need to be specified somehow and I'm not sure if "we suspend if no one is holding a wakelock" is the right approach.
That isn't really a criterion; it's just a mechanism. All it does is push the problem back one level. Now the question becomes: When is it appropriate/necessary to hold a wakelock?
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
Quoted 7 lines
Quoted 4 lines
Inactivity of devices isn't always a good criterion. There might be a background task which wakes up every few seconds to do something as long as the system is awake, thereby keeping some device always active. The activity from this background task shouldn't prevent an auto-sleep.
In fact there are two problems here. First, there may be a task preventing some devices from becoming inactive (like syslog).
Which means that device inactivity isn't always a good indicator for auto-sleep. (But then there can be different levels of activity: A disk should always block auto-sleep while it is carrying out I/O, but it might not block auto-sleep just because it is spinning.)
Quoted 5 lines
Second, there may be
a task waiting for something important to happen, such that automatic suspend cannot be triggered while it's waiting. In both cases, IMO, the kernel is not in a point to decide whether to suspend or not, because the user space knows better.
Quoted 3 lines
That's the whole point behind userspace wakelocks! They provide a mechanism for userspace to tell the kernel when (as far as userspace is concerned) it is or is not okay to auto-sleep.
Still, one can go further and observe that the user space can in fact start automatic suspend by itself whenever it knows it's appropriate ...
Thanks,
Rafael
Quoted 45 lines · Alan Stern
Quoted 8 lines · Rafael J. Wysocki
Quoted 4 lines
Quoted 2 lines
Again, the decision to trigger automatic suspend has to be based on some well defined criteria and the (in)activity of devices seems to be one of them.
I don't know what criteria the system monitor would use.
I don't know either and this is the whole point. They need to be specified somehow and I'm not sure if "we suspend if no one is holding a wakelock" is the right approach.
That isn't really a criterion; it's just a mechanism. All it does is push the problem back one level. Now the question becomes: When is it appropriate/necessary to hold a wakelock?
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
Quoted 7 lines
Quoted 4 lines
Inactivity of devices isn't always a good criterion. There might be a background task which wakes up every few seconds to do something as long as the system is awake, thereby keeping some device always active. The activity from this background task shouldn't prevent an auto-sleep.
In fact there are two problems here. First, there may be a task preventing some devices from becoming inactive (like syslog).
Which means that device inactivity isn't always a good indicator for auto-sleep. (But then there can be different levels of activity: A disk should always block auto-sleep while it is carrying out I/O, but it might not block auto-sleep just because it is spinning.)
Quoted 5 lines
Second, there may be
a task waiting for something important to happen, such that automatic suspend cannot be triggered while it's waiting. In both cases, IMO, the kernel is not in a point to decide whether to suspend or not, because the user space knows better.
Quoted 3 lines
That's the whole point behind userspace wakelocks! They provide a mechanism for userspace to tell the kernel when (as far as userspace is concerned) it is or is not okay to auto-sleep.
Still, one can go further and observe that the user space can in fact start automatic suspend by itself whenever it knows it's appropriate ...
Thanks,
Rafael
Am Donnerstag 19 Februar 2009 23:21:46 schrieb Rafael J. Wysocki:
Quoted 2 lines
Quoted 2 lines
That's the whole point behind userspace wakelocks! They provide a mechanism for userspace to tell the kernel when (as far as userspace
is
Quoted 4 lines
Quoted 1 line
concerned) it is or is not okay to auto-sleep.
Still, one can go further and observe that the user space can in fact start automatic suspend by itself whenever it knows it's appropriate ...
User space initiating this is a race condition.
Regards
Oliver
Quoted 10 lines · Oliver Neukum
Am Donnerstag 19 Februar 2009 23:21:46 schrieb Rafael J. Wysocki:
Quoted 2 lines
Quoted 2 lines
That's the whole point behind userspace wakelocks! They provide a mechanism for userspace to tell the kernel when (as far as userspace
is
Quoted 4 lines
Quoted 1 line
concerned) it is or is not okay to auto-sleep.
Still, one can go further and observe that the user space can in fact start automatic suspend by itself whenever it knows it's appropriate ...
User space initiating this is a race condition.
Do you mean a race with the other user space processes or with the kernel?
Rafael
Quoted 10 lines · Oliver Neukum
Am Donnerstag 19 Februar 2009 23:21:46 schrieb Rafael J. Wysocki:
Quoted 2 lines
Quoted 2 lines
That's the whole point behind userspace wakelocks! They provide a mechanism for userspace to tell the kernel when (as far as userspace
is
Quoted 4 lines
Quoted 1 line
concerned) it is or is not okay to auto-sleep.
Still, one can go further and observe that the user space can in fact start automatic suspend by itself whenever it knows it's appropriate ...
User space initiating this is a race condition.
Do you mean a race with the other user space processes or with the kernel?
Rafael
Am Freitag 20 Februar 2009 11:46:55 schrieb Rafael J. Wysocki:
Quoted 9 lines · Oliver Neukum
Quoted 8 lines
Am Donnerstag 19 Februar 2009 23:21:46 schrieb Rafael J. Wysocki:
Quoted 2 lines
Quoted 2 lines
That's the whole point behind userspace wakelocks! They provide a mechanism for userspace to tell the kernel when (as far as userspace
is
Quoted 2 lines
Quoted 1 line
concerned) it is or is not okay to auto-sleep.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Still, one can go further and observe that the user space can in fact start automatic suspend by itself whenever it knows it's appropriate
...User space initiating this is a race condition.
Do you mean a race with the other user space processes or with the kernel?
With the set of runnable processes.There's always a window between evaluating the current set of runnable tasks and telling the kernel to sleep. IMO the most elegant solution would be a task attribute that would signal the kernel that a task should not count as keeping the system busy even if it is runnable and trigger the sleep in kernel space.
Regards
Oliver
Quoted 16 lines · Oliver Neukum
Am Freitag 20 Februar 2009 11:46:55 schrieb Rafael J. Wysocki:
Quoted 15 lines · Oliver Neukum
Quoted 13 lines
Am Donnerstag 19 Februar 2009 23:21:46 schrieb Rafael J. Wysocki:
Quoted 2 lines
Quoted 2 lines
That's the whole point behind userspace wakelocks! They provide a mechanism for userspace to tell the kernel when (as far as userspace
is
Quoted 5 lines
Quoted 1 line
concerned) it is or is not okay to auto-sleep.
Still, one can go further and observe that the user space can in fact start automatic suspend by itself whenever it knows it's appropriate
...User space initiating this is a race condition.
Quoted 7 lines
Quoted 1 line
Do you mean a race with the other user space processes or with the kernel?
With the set of runnable processes.There's always a window between evaluating the current set of runnable tasks and telling the kernel to sleep. IMO the most elegant solution would be a task attribute that would signal the kernel that a task should not count as keeping the system busy even if it is runnable and trigger the sleep in kernel space.
Please see my last reply to Arve (http://lkml.org/lkml/2009/2/20/182) and tell me what you think.
Best,
Rafael
Quoted 16 lines · Oliver Neukum
Am Freitag 20 Februar 2009 11:46:55 schrieb Rafael J. Wysocki:
Quoted 15 lines · Oliver Neukum
Quoted 13 lines
Am Donnerstag 19 Februar 2009 23:21:46 schrieb Rafael J. Wysocki:
Quoted 2 lines
Quoted 2 lines
That's the whole point behind userspace wakelocks! They provide a mechanism for userspace to tell the kernel when (as far as userspace
is
Quoted 5 lines
Quoted 1 line
concerned) it is or is not okay to auto-sleep.
Still, one can go further and observe that the user space can in fact start automatic suspend by itself whenever it knows it's appropriate
...User space initiating this is a race condition.
Quoted 7 lines
Quoted 1 line
Do you mean a race with the other user space processes or with the kernel?
With the set of runnable processes.There's always a window between evaluating the current set of runnable tasks and telling the kernel to sleep. IMO the most elegant solution would be a task attribute that would signal the kernel that a task should not count as keeping the system busy even if it is runnable and trigger the sleep in kernel space.
Please see my last reply to Arve (http://lkml.org/lkml/2009/2/20/182) and tell me what you think.
Best,
Rafael
Quoted 16 lines · Oliver Neukum
Am Freitag 20 Februar 2009 11:46:55 schrieb Rafael J. Wysocki:
Quoted 15 lines · Oliver Neukum
Quoted 13 lines
Am Donnerstag 19 Februar 2009 23:21:46 schrieb Rafael J. Wysocki:
Quoted 2 lines
Quoted 2 lines
That's the whole point behind userspace wakelocks! They provide a mechanism for userspace to tell the kernel when (as far as userspace
is
Quoted 5 lines
Quoted 1 line
concerned) it is or is not okay to auto-sleep.
Still, one can go further and observe that the user space can in fact start automatic suspend by itself whenever it knows it's appropriate
...User space initiating this is a race condition.
Quoted 7 lines
Quoted 1 line
Do you mean a race with the other user space processes or with the kernel?
With the set of runnable processes.There's always a window between evaluating the current set of runnable tasks and telling the kernel to sleep. IMO the most elegant solution would be a task attribute that would signal the kernel that a task should not count as keeping the system busy even if it is runnable and trigger the sleep in kernel space.
It is not always safe to enter suspend when no tasks are runnable. For instance, a key event could be on a user space queue, but the code that reads from that queue has been paged out.
Signature · 1 line
Arve Hjønnevåg
Am Samstag 21 Februar 2009 00:11:28 schrieb Arve Hjønnevåg:
Quoted 10 lines · Oliver Neukum
Quoted 8 lines
Am Freitag 20 Februar 2009 11:46:55 schrieb Rafael J. Wysocki:
Quoted 1 line · Oliver Neukum
With the set of runnable processes.There's always a window between evaluating the current set of runnable tasks and telling the kernel to sleep. IMO the most elegant solution would be a task attribute that would signal the kernel that a task should not count as keeping the system busy even if it is runnable and trigger the sleep in kernel space.
Quoted 3 lines
It is not always safe to enter suspend when no tasks are runnable. For instance, a key event could be on a user space queue, but the code that reads from that queue has been paged out.
In that case you'd have a task waiting for IO. The driver should refuse to suspend or wake up the system as IO is completed. It may be inefficient to suspend for such a presumably short time, but it is not a correctness issue.
Regards
Oliver
Quoted 11 lines · Oliver Neukum
Am Samstag 21 Februar 2009 00:11:28 schrieb Arve Hjønnevåg:
Quoted 10 lines · Oliver Neukum
Quoted 8 lines
Am Freitag 20 Februar 2009 11:46:55 schrieb Rafael J. Wysocki:
Quoted 1 line · Oliver Neukum
With the set of runnable processes.There's always a window between evaluating the current set of runnable tasks and telling the kernel to sleep. IMO the most elegant solution would be a task attribute that would signal the kernel that a task should not count as keeping the system busy even if it is runnable and trigger the sleep in kernel space.
Quoted 8 lines
Quoted 3 lines
It is not always safe to enter suspend when no tasks are runnable. For instance, a key event could be on a user space queue, but the code that reads from that queue has been paged out.
In that case you'd have a task waiting for IO. The driver should refuse to suspend or wake up the system as IO is completed. It may be inefficient to suspend for such a presumably short time, but it is not a correctness issue.
In that case, yes. My point was that no-runnable-tasks is not a sufficient indicator of whether suspend should fail or not. We have no control of what a user space thread is waiting for though. It could be waiting on a mutex that is locked by a thread that is marked not to prevent suspend.
Signature · 1 line
Arve Hjønnevåg
Quoted 11 lines · Oliver Neukum
Am Samstag 21 Februar 2009 00:11:28 schrieb Arve Hjønnevåg:
Quoted 10 lines · Oliver Neukum
Quoted 8 lines
Am Freitag 20 Februar 2009 11:46:55 schrieb Rafael J. Wysocki:
Quoted 1 line · Oliver Neukum
With the set of runnable processes.There's always a window between evaluating the current set of runnable tasks and telling the kernel to sleep. IMO the most elegant solution would be a task attribute that would signal the kernel that a task should not count as keeping the system busy even if it is runnable and trigger the sleep in kernel space.
Quoted 8 lines
Quoted 3 lines
It is not always safe to enter suspend when no tasks are runnable. For instance, a key event could be on a user space queue, but the code that reads from that queue has been paged out.
In that case you'd have a task waiting for IO. The driver should refuse to suspend or wake up the system as IO is completed. It may be inefficient to suspend for such a presumably short time, but it is not a correctness issue.
In that case, yes. My point was that no-runnable-tasks is not a sufficient indicator of whether suspend should fail or not. We have no control of what a user space thread is waiting for though. It could be waiting on a mutex that is locked by a thread that is marked not to prevent suspend.
Signature · 1 line
Arve Hjønnevåg
Am Samstag 21 Februar 2009 00:11:28 schrieb Arve Hjønnevåg:
Quoted 10 lines · Oliver Neukum
Quoted 8 lines
Am Freitag 20 Februar 2009 11:46:55 schrieb Rafael J. Wysocki:
Quoted 1 line · Oliver Neukum
With the set of runnable processes.There's always a window between evaluating the current set of runnable tasks and telling the kernel to sleep. IMO the most elegant solution would be a task attribute that would signal the kernel that a task should not count as keeping the system busy even if it is runnable and trigger the sleep in kernel space.
Quoted 3 lines
It is not always safe to enter suspend when no tasks are runnable. For instance, a key event could be on a user space queue, but the code that reads from that queue has been paged out.
In that case you'd have a task waiting for IO. The driver should refuse to suspend or wake up the system as IO is completed. It may be inefficient to suspend for such a presumably short time, but it is not a correctness issue.
Regards
Oliver
Am Freitag 20 Februar 2009 11:46:55 schrieb Rafael J. Wysocki:
Quoted 9 lines · Oliver Neukum
Quoted 8 lines
Am Donnerstag 19 Februar 2009 23:21:46 schrieb Rafael J. Wysocki:
Quoted 2 lines
Quoted 2 lines
That's the whole point behind userspace wakelocks! They provide a mechanism for userspace to tell the kernel when (as far as userspace
is
Quoted 2 lines
Quoted 1 line
concerned) it is or is not okay to auto-sleep.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Still, one can go further and observe that the user space can in fact start automatic suspend by itself whenever it knows it's appropriate
...User space initiating this is a race condition.
Do you mean a race with the other user space processes or with the kernel?
With the set of runnable processes.There's always a window between evaluating the current set of runnable tasks and telling the kernel to sleep. IMO the most elegant solution would be a task attribute that would signal the kernel that a task should not count as keeping the system busy even if it is runnable and trigger the sleep in kernel space.
Regards
Oliver
Am Donnerstag 19 Februar 2009 23:21:46 schrieb Rafael J. Wysocki:
Quoted 2 lines
Quoted 2 lines
That's the whole point behind userspace wakelocks! They provide a mechanism for userspace to tell the kernel when (as far as userspace
is
Quoted 4 lines
Quoted 1 line
concerned) it is or is not okay to auto-sleep.
Still, one can go further and observe that the user space can in fact start automatic suspend by itself whenever it knows it's appropriate ...
User space initiating this is a race condition.
Regards
Oliver
Quoted 10 lines · Alan Stern
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
On an android phone, any code that needs to run when the screen is off must hold a wakelock (directly or indirectly). In general if an application or the system is processing an event that may cause a user notification (new email, incoming phone call, alarm, etc.) it needs to prevent suspend. But, we also use wakelocks to upload stats or download system updates in the background, and for media player or (gps) data logging applications.
Signature · 1 line
Arve Hjønnevåg
Quoted 10 lines · Alan Stern
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
On an android phone, any code that needs to run when the screen is off must hold a wakelock (directly or indirectly). In general if an application or the system is processing an event that may cause a user notification (new email, incoming phone call, alarm, etc.) it needs to prevent suspend. But, we also use wakelocks to upload stats or download system updates in the background, and for media player or (gps) data logging applications.
Signature · 1 line
Arve Hjønnevåg
Quoted 12 lines · Arve Hjønnevåg
Quoted 10 lines · Alan Stern
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
Quoted 7 lines
On an android phone, any code that needs to run when the screen is off must hold a wakelock (directly or indirectly). In general if an application or the system is processing an event that may cause a user notification (new email, incoming phone call, alarm, etc.) it needs to prevent suspend. But, we also use wakelocks to upload stats or download system updates in the background, and for media player or (gps) data logging applications.
All of this doesn't seem to require wakelocks acuired from kernel space. What do you need those wakelocks for?
Rafael
Quoted 21 lines · Rafael J. Wysocki
Quoted 12 lines · Arve Hjønnevåg
Quoted 10 lines · Alan Stern
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
Quoted 7 lines
On an android phone, any code that needs to run when the screen is off must hold a wakelock (directly or indirectly). In general if an application or the system is processing an event that may cause a user notification (new email, incoming phone call, alarm, etc.) it needs to prevent suspend. But, we also use wakelocks to upload stats or download system updates in the background, and for media player or (gps) data logging applications.
Quoted 2 lines
All of this doesn't seem to require wakelocks acuired from kernel space. What do you need those wakelocks for?
Most events do not originate in user-space. Alarms start in our alarm driver which locks a wakelock when its timer interrupt occurs. This wakelock stays locked until the user-space alarm manager calls the driver to wait for the next alarm. I've described how input events are handled before. Without kernel wakelocks, if the user space power manager had already turned off the screen and decided to suspend right before a wakeup key is pressed, then that key could sit in the in-kernel input queue until another key is pressed. Even if the user-space thread read the key event before being frozen, it cannot abort the suspend operation that was already started.
Signature · 1 line
Arve Hjønnevåg
Quoted 21 lines · Rafael J. Wysocki
Quoted 12 lines · Arve Hjønnevåg
Quoted 10 lines · Alan Stern
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
Quoted 7 lines
On an android phone, any code that needs to run when the screen is off must hold a wakelock (directly or indirectly). In general if an application or the system is processing an event that may cause a user notification (new email, incoming phone call, alarm, etc.) it needs to prevent suspend. But, we also use wakelocks to upload stats or download system updates in the background, and for media player or (gps) data logging applications.
Quoted 2 lines
All of this doesn't seem to require wakelocks acuired from kernel space. What do you need those wakelocks for?
Most events do not originate in user-space. Alarms start in our alarm driver which locks a wakelock when its timer interrupt occurs. This wakelock stays locked until the user-space alarm manager calls the driver to wait for the next alarm. I've described how input events are handled before. Without kernel wakelocks, if the user space power manager had already turned off the screen and decided to suspend right before a wakeup key is pressed, then that key could sit in the in-kernel input queue until another key is pressed. Even if the user-space thread read the key event before being frozen, it cannot abort the suspend operation that was already started.
Signature · 1 line
Arve Hjønnevåg
Quoted 25 lines · Arve Hjønnevåg
Quoted 21 lines · Rafael J. Wysocki
Quoted 12 lines · Arve Hjønnevåg
Quoted 10 lines · Alan Stern
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
Quoted 7 lines
On an android phone, any code that needs to run when the screen is off must hold a wakelock (directly or indirectly). In general if an application or the system is processing an event that may cause a user notification (new email, incoming phone call, alarm, etc.) it needs to prevent suspend. But, we also use wakelocks to upload stats or download system updates in the background, and for media player or (gps) data logging applications.
Quoted 2 lines
All of this doesn't seem to require wakelocks acuired from kernel space. What do you need those wakelocks for?
Quoted 10 lines
Most events do not originate in user-space. Alarms start in our alarm driver which locks a wakelock when its timer interrupt occurs. This wakelock stays locked until the user-space alarm manager calls the driver to wait for the next alarm. I've described how input events are handled before. Without kernel wakelocks, if the user space power manager had already turned off the screen and decided to suspend right before a wakeup key is pressed, then that key could sit in the in-kernel input queue until another key is pressed. Even if the user-space thread read the key event before being frozen, it cannot abort the suspend operation that was already started.
OK, so what about the following approach:
* Keep the decision making logic (power manager etc.) in user space. Reasons:
- It may be arbitrarily complicated
- It may include such things as s2ram quirks or hal quirks needed for some graphics adapters
* Have a per-process (per-task or per-thread group, but the former would be easier IMO) "I_do_not_want_automatic_suspend_to_occur" flag.
* Add a new callback, say ->acknowledge(), to the set of each driver's PM operations, that will be called to check if the driver has anything against automatic suspend (true - suspend can happen right now, false - suspend can't happen).
* Introduce /sys/power/sleep that will work like /sys/power/state, but:
- First, it will call ->acknowledge() for each driver (via bus types) to check if any of them wants to postpone the suspend (this will prevent tasks from being frozen unnecessarily if it is known in advance that the suspend should not happen at the moment).
- Next, it will check the "I_do_not_want_automatic_suspend_to_occur" flag of each process and the suspend will be aborted if it is true for any of them (quite frankly, I think that should be integrated with the freezer, in particular the tasks that have TIF_FREEZE set shouldn't be able to set this flag and it should be checked in the freezer loop for every task with TIF_FREEZE unset).
- Next, it will proceed with suspending just like /sys/power/state does (the
drivers that missed the opportunity to abort the suspend by returning
'false' from ->acknowledge() can still abort the suspend by failing their
->suspend() routines).Then, the decision making logic will be able to use /sys/power/sleep whenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.
It seems to be flexible enough to me.
Thanks,
Rafael
Quoted 25 lines · Arve Hjønnevåg
Quoted 21 lines · Rafael J. Wysocki
Quoted 12 lines · Arve Hjønnevåg
Quoted 10 lines · Alan Stern
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
Quoted 7 lines
On an android phone, any code that needs to run when the screen is off must hold a wakelock (directly or indirectly). In general if an application or the system is processing an event that may cause a user notification (new email, incoming phone call, alarm, etc.) it needs to prevent suspend. But, we also use wakelocks to upload stats or download system updates in the background, and for media player or (gps) data logging applications.
Quoted 2 lines
All of this doesn't seem to require wakelocks acuired from kernel space. What do you need those wakelocks for?
Quoted 10 lines
Most events do not originate in user-space. Alarms start in our alarm driver which locks a wakelock when its timer interrupt occurs. This wakelock stays locked until the user-space alarm manager calls the driver to wait for the next alarm. I've described how input events are handled before. Without kernel wakelocks, if the user space power manager had already turned off the screen and decided to suspend right before a wakeup key is pressed, then that key could sit in the in-kernel input queue until another key is pressed. Even if the user-space thread read the key event before being frozen, it cannot abort the suspend operation that was already started.
OK, so what about the following approach:
* Keep the decision making logic (power manager etc.) in user space. Reasons:
- It may be arbitrarily complicated
- It may include such things as s2ram quirks or hal quirks needed for some graphics adapters
* Have a per-process (per-task or per-thread group, but the former would be easier IMO) "I_do_not_want_automatic_suspend_to_occur" flag.
* Add a new callback, say ->acknowledge(), to the set of each driver's PM operations, that will be called to check if the driver has anything against automatic suspend (true - suspend can happen right now, false - suspend can't happen).
* Introduce /sys/power/sleep that will work like /sys/power/state, but:
- First, it will call ->acknowledge() for each driver (via bus types) to check if any of them wants to postpone the suspend (this will prevent tasks from being frozen unnecessarily if it is known in advance that the suspend should not happen at the moment).
- Next, it will check the "I_do_not_want_automatic_suspend_to_occur" flag of each process and the suspend will be aborted if it is true for any of them (quite frankly, I think that should be integrated with the freezer, in particular the tasks that have TIF_FREEZE set shouldn't be able to set this flag and it should be checked in the freezer loop for every task with TIF_FREEZE unset).
- Next, it will proceed with suspending just like /sys/power/state does (the
drivers that missed the opportunity to abort the suspend by returning
'false' from ->acknowledge() can still abort the suspend by failing their
->suspend() routines).Then, the decision making logic will be able to use /sys/power/sleep whenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.
It seems to be flexible enough to me.
Thanks,
Rafael
Quoted 16 lines · Rafael J. Wysocki
* Introduce
/sys/power/sleepthat will work like/sys/power/state, but:
- First, it will call ->acknowledge() for each driver (via bus types) to check if any of them wants to postpone the suspend (this will prevent tasks from being frozen unnecessarily if it is known in advance that the suspend should not happen at the moment).
- Next, it will check the "I_do_not_want_automatic_suspend_to_occur" flag of each process and the suspend will be aborted if it is true for any of them (quite frankly, I think that should be integrated with the freezer, in particular the tasks that haveTIF_FREEZEset shouldn't be able to set this flag and it should be checked in the freezer loop for every task withTIF_FREEZEunset).
- Next, it will proceed with suspending just like/sys/power/statedoes (the drivers that missed the opportunity to abort the suspend by returning 'false' from ->acknowledge() can still abort the suspend by failing their ->suspend() routines).
Quoted 3 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.
Then, for a userspace process handling input events:
1) Unset "no-suspend flag" 2) Poll event device 3) When the poll returns true, set the "no-suspend flag" 4) Read the event device and process the event(s) 5) Go back to step 1
The event driver would responsible for atomically preventing suspend from the moment a button is pressed until it is actually delivered to a userspace process. Since at that time the userspace process will be preventing suspend, there will be no window in which we could go to sleep with pending events.
Cheers,
Kyle Moffett
Quoted 16 lines · Rafael J. Wysocki
* Introduce
/sys/power/sleepthat will work like/sys/power/state, but:
- First, it will call ->acknowledge() for each driver (via bus types) to check if any of them wants to postpone the suspend (this will prevent tasks from being frozen unnecessarily if it is known in advance that the suspend should not happen at the moment).
- Next, it will check the "I_do_not_want_automatic_suspend_to_occur" flag of each process and the suspend will be aborted if it is true for any of them (quite frankly, I think that should be integrated with the freezer, in particular the tasks that haveTIF_FREEZEset shouldn't be able to set this flag and it should be checked in the freezer loop for every task withTIF_FREEZEunset).
- Next, it will proceed with suspending just like/sys/power/statedoes (the drivers that missed the opportunity to abort the suspend by returning 'false' from ->acknowledge() can still abort the suspend by failing their ->suspend() routines).
Quoted 3 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.
Then, for a userspace process handling input events:
1) Unset "no-suspend flag" 2) Poll event device 3) When the poll returns true, set the "no-suspend flag" 4) Read the event device and process the event(s) 5) Go back to step 1
The event driver would responsible for atomically preventing suspend from the moment a button is pressed until it is actually delivered to a userspace process. Since at that time the userspace process will be preventing suspend, there will be no window in which we could go to sleep with pending events.
Cheers,
Kyle Moffett
Quoted 29 lines · Kyle Moffett
Quoted 16 lines · Rafael J. Wysocki
* Introduce
/sys/power/sleepthat will work like/sys/power/state, but:
- First, it will call ->acknowledge() for each driver (via bus types) to check if any of them wants to postpone the suspend (this will prevent tasks from being frozen unnecessarily if it is known in advance that the suspend should not happen at the moment).
- Next, it will check the "I_do_not_want_automatic_suspend_to_occur" flag of each process and the suspend will be aborted if it is true for any of them (quite frankly, I think that should be integrated with the freezer, in particular the tasks that haveTIF_FREEZEset shouldn't be able to set this flag and it should be checked in the freezer loop for every task withTIF_FREEZEunset).
- Next, it will proceed with suspending just like/sys/power/statedoes (the drivers that missed the opportunity to abort the suspend by returning 'false' from ->acknowledge() can still abort the suspend by failing their ->suspend() routines).Quoted 3 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.Then, for a userspace process handling input events:
1) Unset "no-suspend flag" 2) Poll event device 3) When the poll returns true, set the "no-suspend flag" 4) Read the event device and process the event(s) 5) Go back to step 1
Quoted 5 lines
The event driver would responsible for atomically preventing suspend from the moment a button is pressed until it is actually delivered to a userspace process. Since at that time the userspace process will be preventing suspend, there will be no window in which we could go to sleep with pending events.
That's correct.
How would you like to prevent it from happening?
Rafael
Quoted 29 lines · Kyle Moffett
Quoted 16 lines · Rafael J. Wysocki
* Introduce
/sys/power/sleepthat will work like/sys/power/state, but:
- First, it will call ->acknowledge() for each driver (via bus types) to check if any of them wants to postpone the suspend (this will prevent tasks from being frozen unnecessarily if it is known in advance that the suspend should not happen at the moment).
- Next, it will check the "I_do_not_want_automatic_suspend_to_occur" flag of each process and the suspend will be aborted if it is true for any of them (quite frankly, I think that should be integrated with the freezer, in particular the tasks that haveTIF_FREEZEset shouldn't be able to set this flag and it should be checked in the freezer loop for every task withTIF_FREEZEunset).
- Next, it will proceed with suspending just like/sys/power/statedoes (the drivers that missed the opportunity to abort the suspend by returning 'false' from ->acknowledge() can still abort the suspend by failing their ->suspend() routines).Quoted 3 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.Then, for a userspace process handling input events:
1) Unset "no-suspend flag" 2) Poll event device 3) When the poll returns true, set the "no-suspend flag" 4) Read the event device and process the event(s) 5) Go back to step 1
Quoted 5 lines
The event driver would responsible for atomically preventing suspend from the moment a button is pressed until it is actually delivered to a userspace process. Since at that time the userspace process will be preventing suspend, there will be no window in which we could go to sleep with pending events.
That's correct.
How would you like to prevent it from happening?
Rafael
Quoted 36 lines · Rafael J. Wysocki
Quoted 29 lines · Kyle Moffett
Quoted 16 lines · Rafael J. Wysocki
* Introduce
/sys/power/sleepthat will work like/sys/power/state, but:
- First, it will call ->acknowledge() for each driver (via bus types) to check if any of them wants to postpone the suspend (this will prevent tasks from being frozen unnecessarily if it is known in advance that the suspend should not happen at the moment).
- Next, it will check the "I_do_not_want_automatic_suspend_to_occur" flag of each process and the suspend will be aborted if it is true for any of them (quite frankly, I think that should be integrated with the freezer, in particular the tasks that haveTIF_FREEZEset shouldn't be able to set this flag and it should be checked in the freezer loop for every task withTIF_FREEZEunset).
- Next, it will proceed with suspending just like/sys/power/statedoes (the drivers that missed the opportunity to abort the suspend by returning 'false' from ->acknowledge() can still abort the suspend by failing their ->suspend() routines).Quoted 3 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.Then, for a userspace process handling input events:
1) Unset "no-suspend flag" 2) Poll event device 3) When the poll returns true, set the "no-suspend flag" 4) Read the event device and process the event(s) 5) Go back to step 1Quoted 5 lines
The event driver would responsible for atomically preventing suspend from the moment a button is pressed until it is actually delivered to a userspace process. Since at that time the userspace process will be preventing suspend, there will be no window in which we could go to sleep with pending events.
Quoted 3 lines
That's correct.
How would you like to prevent it from happening?
To clarify, we're talking about automatic suspend only. The "old" suspend interface is going to stay so that one can force suspend (or hibernation) to happen.
Thanks,
Rafael
Quoted 37 lines · Rafael J. Wysocki
Quoted 25 lines · Arve Hjønnevåg
Quoted 21 lines · Rafael J. Wysocki
Quoted 12 lines · Arve Hjønnevåg
Quoted 10 lines · Alan Stern
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
Quoted 7 lines
On an android phone, any code that needs to run when the screen is off must hold a wakelock (directly or indirectly). In general if an application or the system is processing an event that may cause a user notification (new email, incoming phone call, alarm, etc.) it needs to prevent suspend. But, we also use wakelocks to upload stats or download system updates in the background, and for media player or (gps) data logging applications.
Quoted 2 lines
All of this doesn't seem to require wakelocks acuired from kernel space. What do you need those wakelocks for?
Quoted 10 lines
Most events do not originate in user-space. Alarms start in our alarm driver which locks a wakelock when its timer interrupt occurs. This wakelock stays locked until the user-space alarm manager calls the driver to wait for the next alarm. I've described how input events are handled before. Without kernel wakelocks, if the user space power manager had already turned off the screen and decided to suspend right before a wakeup key is pressed, then that key could sit in the in-kernel input queue until another key is pressed. Even if the user-space thread read the key event before being frozen, it cannot abort the suspend operation that was already started.
Quoted 6 lines
OK, so what about the following approach:
* Keep the decision making logic (power manager etc.) in user space. Reasons:
- It may be arbitrarily complicated
- It may include such things as s2ram quirks or hal quirks needed for some graphics adapters
I don't using wakelocks in any different in this respect. When user space decides that it is ok for the kernel to suspend it should have performed all theses steps in both cases.
Quoted 3 lines
* Have a per-process (per-task or per-thread group, but the former would be easier IMO) "
I_do_not_want_automatic_suspend_to_occur" flag.
A per-process (thread group) flag allows wakelocks to be implemented in a user space library. A per-thread flag does not. However, I don't see much benefit in tying this to a process instead of using a file descriptor.
Quoted 22 lines
* Add a new callback, say ->acknowledge(), to the set of each driver's PM operations, that will be called to check if the driver has anything against automatic suspend (true - suspend can happen right now, false - suspend can't happen).
* Introduce
/sys/power/sleepthat will work like/sys/power/state, but:
- First, it will call ->acknowledge() for each driver (via bus types) to check if any of them wants to postpone the suspend (this will prevent tasks from being frozen unnecessarily if it is known in advance that the suspend should not happen at the moment).
- Next, it will check the "I_do_not_want_automatic_suspend_to_occur" flag of each process and the suspend will be aborted if it is true for any of them (quite frankly, I think that should be integrated with the freezer, in particular the tasks that haveTIF_FREEZEset shouldn't be able to set this flag and it should be checked in the freezer loop for every task withTIF_FREEZEunset).
- Next, it will proceed with suspending just like/sys/power/statedoes (the drivers that missed the opportunity to abort the suspend by returning 'false' from ->acknowledge() can still abort the suspend by failing their ->suspend() routines).
Quoted 5 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.It seems to be flexible enough to me.
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend. Also, like my original wakelock patches, it breaks sleep requests through /sys/power/state when there are input events queued.
Signature · 1 line
Arve Hjønnevåg
Quoted 37 lines · Rafael J. Wysocki
Quoted 25 lines · Arve Hjønnevåg
Quoted 21 lines · Rafael J. Wysocki
Quoted 12 lines · Arve Hjønnevåg
Quoted 10 lines · Alan Stern
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
Quoted 7 lines
On an android phone, any code that needs to run when the screen is off must hold a wakelock (directly or indirectly). In general if an application or the system is processing an event that may cause a user notification (new email, incoming phone call, alarm, etc.) it needs to prevent suspend. But, we also use wakelocks to upload stats or download system updates in the background, and for media player or (gps) data logging applications.
Quoted 2 lines
All of this doesn't seem to require wakelocks acuired from kernel space. What do you need those wakelocks for?
Quoted 10 lines
Most events do not originate in user-space. Alarms start in our alarm driver which locks a wakelock when its timer interrupt occurs. This wakelock stays locked until the user-space alarm manager calls the driver to wait for the next alarm. I've described how input events are handled before. Without kernel wakelocks, if the user space power manager had already turned off the screen and decided to suspend right before a wakeup key is pressed, then that key could sit in the in-kernel input queue until another key is pressed. Even if the user-space thread read the key event before being frozen, it cannot abort the suspend operation that was already started.
Quoted 6 lines
OK, so what about the following approach:
* Keep the decision making logic (power manager etc.) in user space. Reasons:
- It may be arbitrarily complicated
- It may include such things as s2ram quirks or hal quirks needed for some graphics adapters
I don't using wakelocks in any different in this respect. When user space decides that it is ok for the kernel to suspend it should have performed all theses steps in both cases.
Quoted 3 lines
* Have a per-process (per-task or per-thread group, but the former would be easier IMO) "
I_do_not_want_automatic_suspend_to_occur" flag.
A per-process (thread group) flag allows wakelocks to be implemented in a user space library. A per-thread flag does not. However, I don't see much benefit in tying this to a process instead of using a file descriptor.
Quoted 22 lines
* Add a new callback, say ->acknowledge(), to the set of each driver's PM operations, that will be called to check if the driver has anything against automatic suspend (true - suspend can happen right now, false - suspend can't happen).
* Introduce
/sys/power/sleepthat will work like/sys/power/state, but:
- First, it will call ->acknowledge() for each driver (via bus types) to check if any of them wants to postpone the suspend (this will prevent tasks from being frozen unnecessarily if it is known in advance that the suspend should not happen at the moment).
- Next, it will check the "I_do_not_want_automatic_suspend_to_occur" flag of each process and the suspend will be aborted if it is true for any of them (quite frankly, I think that should be integrated with the freezer, in particular the tasks that haveTIF_FREEZEset shouldn't be able to set this flag and it should be checked in the freezer loop for every task withTIF_FREEZEunset).
- Next, it will proceed with suspending just like/sys/power/statedoes (the drivers that missed the opportunity to abort the suspend by returning 'false' from ->acknowledge() can still abort the suspend by failing their ->suspend() routines).
Quoted 5 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.It seems to be flexible enough to me.
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend. Also, like my original wakelock patches, it breaks sleep requests through /sys/power/state when there are input events queued.
Signature · 1 line
Arve Hjønnevåg
Quoted 40 lines · Arve Hjønnevåg
Quoted 39 lines · Rafael J. Wysocki
Quoted 25 lines · Arve Hjønnevåg
Quoted 21 lines · Rafael J. Wysocki
Quoted 12 lines · Arve Hjønnevåg
Quoted 10 lines · Alan Stern
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
Quoted 7 lines
On an android phone, any code that needs to run when the screen is off must hold a wakelock (directly or indirectly). In general if an application or the system is processing an event that may cause a user notification (new email, incoming phone call, alarm, etc.) it needs to prevent suspend. But, we also use wakelocks to upload stats or download system updates in the background, and for media player or (gps) data logging applications.
Quoted 2 lines
All of this doesn't seem to require wakelocks acuired from kernel space. What do you need those wakelocks for?
Quoted 10 lines
Most events do not originate in user-space. Alarms start in our alarm driver which locks a wakelock when its timer interrupt occurs. This wakelock stays locked until the user-space alarm manager calls the driver to wait for the next alarm. I've described how input events are handled before. Without kernel wakelocks, if the user space power manager had already turned off the screen and decided to suspend right before a wakeup key is pressed, then that key could sit in the in-kernel input queue until another key is pressed. Even if the user-space thread read the key event before being frozen, it cannot abort the suspend operation that was already started.
OK, so what about the following approach:
Quoted 8 lines
Quoted 4 lines
* Keep the decision making logic (power manager etc.) in user space. Reasons:
- It may be arbitrarily complicated
- It may include such things as s2ram quirks or hal quirks needed for some graphics adaptersI don't using wakelocks in any different in this respect. When user space decides that it is ok for the kernel to suspend it should have performed all theses steps in both cases.
If automatic suspend is to be started by the kernel, you have to make sure that at least one wakelock is held until these steps are completed. That may be somewhat tricky in general.
Quoted 7 lines
Quoted 2 lines
* Have a per-process (per-task or per-thread group, but the former would be easier IMO) "
I_do_not_want_automatic_suspend_to_occur" flag.A per-process (thread group) flag allows wakelocks to be implemented in a user space library. A per-thread flag does not. However, I don't see much benefit in tying this to a process instead of using a file descriptor.
Using a flag would allow us to remove the window between checking the wakelocks and freezing tasks (in principle a task may take a wakelock just before it's frozen).
Quoted 22 lines
Quoted 22 lines
* Add a new callback, say ->acknowledge(), to the set of each driver's PM operations, that will be called to check if the driver has anything against automatic suspend (true - suspend can happen right now, false - suspend can't happen).
* Introduce
/sys/power/sleepthat will work like/sys/power/state, but:
- First, it will call ->acknowledge() for each driver (via bus types) to check if any of them wants to postpone the suspend (this will prevent tasks from being frozen unnecessarily if it is known in advance that the suspend should not happen at the moment).
- Next, it will check the "I_do_not_want_automatic_suspend_to_occur" flag of each process and the suspend will be aborted if it is true for any of them (quite frankly, I think that should be integrated with the freezer, in particular the tasks that haveTIF_FREEZEset shouldn't be able to set this flag and it should be checked in the freezer loop for every task withTIF_FREEZEunset).
- Next, it will proceed with suspending just like/sys/power/statedoes (the drivers that missed the opportunity to abort the suspend by returning 'false' from ->acknowledge() can still abort the suspend by failing their ->suspend() routines).
Quoted 8 lines
Quoted 5 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.It seems to be flexible enough to me.
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend.
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
Quoted 2 lines
Also, like my original wakelock patches, it breaks sleep requests through
/sys/power/statewhen there are input events queued.
The idea is to have both /sys/power/state and /sys/power/sleep at the same time, where /sys/power/state will work just like it does right now. Sure, there must be mutual exclusion between the two, but that's a matter of implementation IMO.
Thanks,
Rafael
Quoted 40 lines · Arve Hjønnevåg
Quoted 39 lines · Rafael J. Wysocki
Quoted 25 lines · Arve Hjønnevåg
Quoted 21 lines · Rafael J. Wysocki
Quoted 12 lines · Arve Hjønnevåg
Quoted 10 lines · Alan Stern
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
Quoted 7 lines
On an android phone, any code that needs to run when the screen is off must hold a wakelock (directly or indirectly). In general if an application or the system is processing an event that may cause a user notification (new email, incoming phone call, alarm, etc.) it needs to prevent suspend. But, we also use wakelocks to upload stats or download system updates in the background, and for media player or (gps) data logging applications.
Quoted 2 lines
All of this doesn't seem to require wakelocks acuired from kernel space. What do you need those wakelocks for?
Quoted 10 lines
Most events do not originate in user-space. Alarms start in our alarm driver which locks a wakelock when its timer interrupt occurs. This wakelock stays locked until the user-space alarm manager calls the driver to wait for the next alarm. I've described how input events are handled before. Without kernel wakelocks, if the user space power manager had already turned off the screen and decided to suspend right before a wakeup key is pressed, then that key could sit in the in-kernel input queue until another key is pressed. Even if the user-space thread read the key event before being frozen, it cannot abort the suspend operation that was already started.
OK, so what about the following approach:
Quoted 8 lines
Quoted 4 lines
* Keep the decision making logic (power manager etc.) in user space. Reasons:
- It may be arbitrarily complicated
- It may include such things as s2ram quirks or hal quirks needed for some graphics adaptersI don't using wakelocks in any different in this respect. When user space decides that it is ok for the kernel to suspend it should have performed all theses steps in both cases.
If automatic suspend is to be started by the kernel, you have to make sure that at least one wakelock is held until these steps are completed. That may be somewhat tricky in general.
Quoted 7 lines
Quoted 2 lines
* Have a per-process (per-task or per-thread group, but the former would be easier IMO) "
I_do_not_want_automatic_suspend_to_occur" flag.A per-process (thread group) flag allows wakelocks to be implemented in a user space library. A per-thread flag does not. However, I don't see much benefit in tying this to a process instead of using a file descriptor.
Using a flag would allow us to remove the window between checking the wakelocks and freezing tasks (in principle a task may take a wakelock just before it's frozen).
Quoted 22 lines
Quoted 22 lines
* Add a new callback, say ->acknowledge(), to the set of each driver's PM operations, that will be called to check if the driver has anything against automatic suspend (true - suspend can happen right now, false - suspend can't happen).
* Introduce
/sys/power/sleepthat will work like/sys/power/state, but:
- First, it will call ->acknowledge() for each driver (via bus types) to check if any of them wants to postpone the suspend (this will prevent tasks from being frozen unnecessarily if it is known in advance that the suspend should not happen at the moment).
- Next, it will check the "I_do_not_want_automatic_suspend_to_occur" flag of each process and the suspend will be aborted if it is true for any of them (quite frankly, I think that should be integrated with the freezer, in particular the tasks that haveTIF_FREEZEset shouldn't be able to set this flag and it should be checked in the freezer loop for every task withTIF_FREEZEunset).
- Next, it will proceed with suspending just like/sys/power/statedoes (the drivers that missed the opportunity to abort the suspend by returning 'false' from ->acknowledge() can still abort the suspend by failing their ->suspend() routines).
Quoted 8 lines
Quoted 5 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.It seems to be flexible enough to me.
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend.
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
Quoted 2 lines
Also, like my original wakelock patches, it breaks sleep requests through
/sys/power/statewhen there are input events queued.
The idea is to have both /sys/power/state and /sys/power/sleep at the same time, where /sys/power/state will work just like it does right now. Sure, there must be mutual exclusion between the two, but that's a matter of implementation IMO.
Thanks,
Rafael
Quoted 46 lines · Rafael J. Wysocki
Quoted 45 lines · Arve Hjønnevåg
Quoted 43 lines · Rafael J. Wysocki
Quoted 25 lines · Arve Hjønnevåg
Quoted 21 lines · Rafael J. Wysocki
Quoted 12 lines · Arve Hjønnevåg
Quoted 10 lines · Alan Stern
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
Quoted 7 lines
On an android phone, any code that needs to run when the screen is off must hold a wakelock (directly or indirectly). In general if an application or the system is processing an event that may cause a user notification (new email, incoming phone call, alarm, etc.) it needs to prevent suspend. But, we also use wakelocks to upload stats or download system updates in the background, and for media player or (gps) data logging applications.
Quoted 2 lines
All of this doesn't seem to require wakelocks acuired from kernel space. What do you need those wakelocks for?
Quoted 10 lines
Most events do not originate in user-space. Alarms start in our alarm driver which locks a wakelock when its timer interrupt occurs. This wakelock stays locked until the user-space alarm manager calls the driver to wait for the next alarm. I've described how input events are handled before. Without kernel wakelocks, if the user space power manager had already turned off the screen and decided to suspend right before a wakeup key is pressed, then that key could sit in the in-kernel input queue until another key is pressed. Even if the user-space thread read the key event before being frozen, it cannot abort the suspend operation that was already started.
OK, so what about the following approach:
* Keep the decision making logic (power manager etc.) in user space. Reasons:
- It may be arbitrarily complicated
- It may include such things as s2ram quirks or hal quirks needed for some graphics adapters
Quoted 7 lines
Quoted 3 lines
I don't using wakelocks in any different in this respect. When user space decides that it is ok for the kernel to suspend it should have performed all theses steps in both cases.
If automatic suspend is to be started by the kernel, you have to make sure that at least one wakelock is held until these steps are completed. That may be somewhat tricky in general.
That is not tricky. If your code holds a wakelock, then at least one wakelock is held.
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
* Have a per-process (per-task or per-thread group, but the former would be easier IMO) "
I_do_not_want_automatic_suspend_to_occur" flag.
Quoted 8 lines
Quoted 4 lines
A per-process (thread group) flag allows wakelocks to be implemented in a user space library. A per-thread flag does not. However, I don't see much benefit in tying this to a process instead of using a file descriptor.
Using a flag would allow us to remove the window between checking the wakelocks and freezing tasks (in principle a task may take a wakelock just before it's frozen).
You can check if there are wakelocks held from the same spot as you check your flag.
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
* Add a new callback, say ->acknowledge(), to the set of each driver's PM operations, that will be called to check if the driver has anything against automatic suspend (true - suspend can happen right now, false - suspend can't happen).
* Introduce
/sys/power/sleepthat will work like/sys/power/state, but:
- First, it will call ->acknowledge() for each driver (via bus types) to check if any of them wants to postpone the suspend (this will prevent tasks from being frozen unnecessarily if it is known in advance that the suspend should not happen at the moment).
- Next, it will check the "I_do_not_want_automatic_suspend_to_occur" flag of each process and the suspend will be aborted if it is true for any of them (quite frankly, I think that should be integrated with the freezer, in particular the tasks that haveTIF_FREEZEset shouldn't be able to set this flag and it should be checked in the freezer loop for every task withTIF_FREEZEunset).
- Next, it will proceed with suspending just like/sys/power/statedoes (the drivers that missed the opportunity to abort the suspend by returning 'false' from ->acknowledge() can still abort the suspend by failing their ->suspend() routines).Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
It seems to be flexible enough to me.
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend.
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
What is better about polling in userspace?
Quoted 8 lines
Quoted 3 lines
Also, like my original wakelock patches, it breaks sleep requests through
/sys/power/statewhen there are input events queued.The idea is to have both
/sys/power/stateand/sys/power/sleepat the same time, where/sys/power/statewill work just like it does right now. Sure, there must be mutual exclusion between the two, but that's a matter of implementation IMO.
If you want to only prevent suspend though one interface, you have to also pass information to the driver about its suspend hook is being called so it can conditionally return -EBUSY. The wakelock interface requires less code in each driver.
Signature · 1 line
Arve Hjønnevåg
Quoted 46 lines · Rafael J. Wysocki
Quoted 45 lines · Arve Hjønnevåg
Quoted 43 lines · Rafael J. Wysocki
Quoted 25 lines · Arve Hjønnevåg
Quoted 21 lines · Rafael J. Wysocki
Quoted 12 lines · Arve Hjønnevåg
Quoted 10 lines · Alan Stern
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
Quoted 7 lines
On an android phone, any code that needs to run when the screen is off must hold a wakelock (directly or indirectly). In general if an application or the system is processing an event that may cause a user notification (new email, incoming phone call, alarm, etc.) it needs to prevent suspend. But, we also use wakelocks to upload stats or download system updates in the background, and for media player or (gps) data logging applications.
Quoted 2 lines
All of this doesn't seem to require wakelocks acuired from kernel space. What do you need those wakelocks for?
Quoted 10 lines
Most events do not originate in user-space. Alarms start in our alarm driver which locks a wakelock when its timer interrupt occurs. This wakelock stays locked until the user-space alarm manager calls the driver to wait for the next alarm. I've described how input events are handled before. Without kernel wakelocks, if the user space power manager had already turned off the screen and decided to suspend right before a wakeup key is pressed, then that key could sit in the in-kernel input queue until another key is pressed. Even if the user-space thread read the key event before being frozen, it cannot abort the suspend operation that was already started.
OK, so what about the following approach:
* Keep the decision making logic (power manager etc.) in user space. Reasons:
- It may be arbitrarily complicated
- It may include such things as s2ram quirks or hal quirks needed for some graphics adapters
Quoted 7 lines
Quoted 3 lines
I don't using wakelocks in any different in this respect. When user space decides that it is ok for the kernel to suspend it should have performed all theses steps in both cases.
If automatic suspend is to be started by the kernel, you have to make sure that at least one wakelock is held until these steps are completed. That may be somewhat tricky in general.
That is not tricky. If your code holds a wakelock, then at least one wakelock is held.
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
* Have a per-process (per-task or per-thread group, but the former would be easier IMO) "
I_do_not_want_automatic_suspend_to_occur" flag.
Quoted 8 lines
Quoted 4 lines
A per-process (thread group) flag allows wakelocks to be implemented in a user space library. A per-thread flag does not. However, I don't see much benefit in tying this to a process instead of using a file descriptor.
Using a flag would allow us to remove the window between checking the wakelocks and freezing tasks (in principle a task may take a wakelock just before it's frozen).
You can check if there are wakelocks held from the same spot as you check your flag.
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
* Add a new callback, say ->acknowledge(), to the set of each driver's PM operations, that will be called to check if the driver has anything against automatic suspend (true - suspend can happen right now, false - suspend can't happen).
* Introduce
/sys/power/sleepthat will work like/sys/power/state, but:
- First, it will call ->acknowledge() for each driver (via bus types) to check if any of them wants to postpone the suspend (this will prevent tasks from being frozen unnecessarily if it is known in advance that the suspend should not happen at the moment).
- Next, it will check the "I_do_not_want_automatic_suspend_to_occur" flag of each process and the suspend will be aborted if it is true for any of them (quite frankly, I think that should be integrated with the freezer, in particular the tasks that haveTIF_FREEZEset shouldn't be able to set this flag and it should be checked in the freezer loop for every task withTIF_FREEZEunset).
- Next, it will proceed with suspending just like/sys/power/statedoes (the drivers that missed the opportunity to abort the suspend by returning 'false' from ->acknowledge() can still abort the suspend by failing their ->suspend() routines).Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
It seems to be flexible enough to me.
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend.
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
What is better about polling in userspace?
Quoted 8 lines
Quoted 3 lines
Also, like my original wakelock patches, it breaks sleep requests through
/sys/power/statewhen there are input events queued.The idea is to have both
/sys/power/stateand/sys/power/sleepat the same time, where/sys/power/statewill work just like it does right now. Sure, there must be mutual exclusion between the two, but that's a matter of implementation IMO.
If you want to only prevent suspend though one interface, you have to also pass information to the driver about its suspend hook is being called so it can conditionally return -EBUSY. The wakelock interface requires less code in each driver.
Signature · 1 line
Arve Hjønnevåg
Quoted 51 lines · Arve Hjønnevåg
Quoted 50 lines · Rafael J. Wysocki
Quoted 48 lines · Arve Hjønnevåg
Quoted 37 lines · Rafael J. Wysocki
Quoted 25 lines · Arve Hjønnevåg
Quoted 21 lines · Rafael J. Wysocki
Quoted 12 lines · Arve Hjønnevåg
Quoted 10 lines · Alan Stern
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
Quoted 7 lines
On an android phone, any code that needs to run when the screen is off must hold a wakelock (directly or indirectly). In general if an application or the system is processing an event that may cause a user notification (new email, incoming phone call, alarm, etc.) it needs to prevent suspend. But, we also use wakelocks to upload stats or download system updates in the background, and for media player or (gps) data logging applications.
Quoted 2 lines
All of this doesn't seem to require wakelocks acuired from kernel space. What do you need those wakelocks for?
Quoted 10 lines
Most events do not originate in user-space. Alarms start in our alarm driver which locks a wakelock when its timer interrupt occurs. This wakelock stays locked until the user-space alarm manager calls the driver to wait for the next alarm. I've described how input events are handled before. Without kernel wakelocks, if the user space power manager had already turned off the screen and decided to suspend right before a wakeup key is pressed, then that key could sit in the in-kernel input queue until another key is pressed. Even if the user-space thread read the key event before being frozen, it cannot abort the suspend operation that was already started.
Quoted 6 lines
OK, so what about the following approach:
* Keep the decision making logic (power manager etc.) in user space. Reasons:
- It may be arbitrarily complicated
- It may include such things as s2ram quirks or hal quirks needed for some graphics adaptersI don't using wakelocks in any different in this respect. When user space decides that it is ok for the kernel to suspend it should have performed all theses steps in both cases.
Quoted 6 lines
Quoted 3 lines
If automatic suspend is to be started by the kernel, you have to make sure that at least one wakelock is held until these steps are completed. That may be somewhat tricky in general.
That is not tricky. If your code holds a wakelock, then at least one wakelock is held.
I meant, if one task releases its wakelock and another one takes a wakelock, you have to make sure there's no window between those events. Of course, you can have a single task holding a wakelock all the time and releasing it when it makes sure everything is ready, but then it would act as a user space power manager anyway.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
* Have a per-process (per-task or per-thread group, but the former would be easier IMO) "
I_do_not_want_automatic_suspend_to_occur" flag.A per-process (thread group) flag allows wakelocks to be implemented in a user space library. A per-thread flag does not. However, I don't see much benefit in tying this to a process instead of using a file descriptor.
Quoted 6 lines
Quoted 3 lines
Using a flag would allow us to remove the window between checking the wakelocks and freezing tasks (in principle a task may take a wakelock just before it's frozen).
You can check if there are wakelocks held from the same spot as you check your flag.
That would be _much_ more complicated and much less efficient (browsing a list vs checking a flag). And it would require additional locking if it's to be done in a non-racy way.
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
Quoted 26 lines
* Add a new callback, say ->acknowledge(), to the set of each driver's PM operations, that will be called to check if the driver has anything against automatic suspend (true - suspend can happen right now, false - suspend can't happen).
* Introduce
/sys/power/sleepthat will work like/sys/power/state, but:
- First, it will call ->acknowledge() for each driver (via bus types) to check if any of them wants to postpone the suspend (this will prevent tasks from being frozen unnecessarily if it is known in advance that the suspend should not happen at the moment).
- Next, it will check the "I_do_not_want_automatic_suspend_to_occur" flag of each process and the suspend will be aborted if it is true for any of them (quite frankly, I think that should be integrated with the freezer, in particular the tasks that haveTIF_FREEZEset shouldn't be able to set this flag and it should be checked in the freezer loop for every task withTIF_FREEZEunset).
- Next, it will proceed with suspending just like/sys/power/statedoes (the drivers that missed the opportunity to abort the suspend by returning 'false' from ->acknowledge() can still abort the suspend by failing their ->suspend() routines).Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.It seems to be flexible enough to me.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend.
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
What is better about polling in userspace?
One kernel thread less, for example?
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
Also, like my original wakelock patches, it breaks sleep requests through
/sys/power/statewhen there are input events queued.The idea is to have both
/sys/power/stateand/sys/power/sleepat the same time, where/sys/power/statewill work just like it does right now. Sure, there must be mutual exclusion between the two, but that's a matter of implementation IMO.
Quoted 4 lines
If you want to only prevent suspend though one interface, you have to also pass information to the driver about its suspend hook is being called so it can conditionally return
-EBUSY. The wakelock interface requires less code in each driver.
Well, I don't think so. Moreover, it requires you to spread wakelocks all over the place if you don't use the timeouted ones which, let's face it, is hardly acceptable.
Thanks,
Rafael
Quoted 51 lines · Arve Hjønnevåg
Quoted 50 lines · Rafael J. Wysocki
Quoted 48 lines · Arve Hjønnevåg
Quoted 37 lines · Rafael J. Wysocki
Quoted 25 lines · Arve Hjønnevåg
Quoted 21 lines · Rafael J. Wysocki
Quoted 12 lines · Arve Hjønnevåg
Quoted 10 lines · Alan Stern
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
Quoted 7 lines
On an android phone, any code that needs to run when the screen is off must hold a wakelock (directly or indirectly). In general if an application or the system is processing an event that may cause a user notification (new email, incoming phone call, alarm, etc.) it needs to prevent suspend. But, we also use wakelocks to upload stats or download system updates in the background, and for media player or (gps) data logging applications.
Quoted 2 lines
All of this doesn't seem to require wakelocks acuired from kernel space. What do you need those wakelocks for?
Quoted 10 lines
Most events do not originate in user-space. Alarms start in our alarm driver which locks a wakelock when its timer interrupt occurs. This wakelock stays locked until the user-space alarm manager calls the driver to wait for the next alarm. I've described how input events are handled before. Without kernel wakelocks, if the user space power manager had already turned off the screen and decided to suspend right before a wakeup key is pressed, then that key could sit in the in-kernel input queue until another key is pressed. Even if the user-space thread read the key event before being frozen, it cannot abort the suspend operation that was already started.
Quoted 6 lines
OK, so what about the following approach:
* Keep the decision making logic (power manager etc.) in user space. Reasons:
- It may be arbitrarily complicated
- It may include such things as s2ram quirks or hal quirks needed for some graphics adaptersI don't using wakelocks in any different in this respect. When user space decides that it is ok for the kernel to suspend it should have performed all theses steps in both cases.
Quoted 6 lines
Quoted 3 lines
If automatic suspend is to be started by the kernel, you have to make sure that at least one wakelock is held until these steps are completed. That may be somewhat tricky in general.
That is not tricky. If your code holds a wakelock, then at least one wakelock is held.
I meant, if one task releases its wakelock and another one takes a wakelock, you have to make sure there's no window between those events. Of course, you can have a single task holding a wakelock all the time and releasing it when it makes sure everything is ready, but then it would act as a user space power manager anyway.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
* Have a per-process (per-task or per-thread group, but the former would be easier IMO) "
I_do_not_want_automatic_suspend_to_occur" flag.A per-process (thread group) flag allows wakelocks to be implemented in a user space library. A per-thread flag does not. However, I don't see much benefit in tying this to a process instead of using a file descriptor.
Quoted 6 lines
Quoted 3 lines
Using a flag would allow us to remove the window between checking the wakelocks and freezing tasks (in principle a task may take a wakelock just before it's frozen).
You can check if there are wakelocks held from the same spot as you check your flag.
That would be _much_ more complicated and much less efficient (browsing a list vs checking a flag). And it would require additional locking if it's to be done in a non-racy way.
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
Quoted 26 lines
* Add a new callback, say ->acknowledge(), to the set of each driver's PM operations, that will be called to check if the driver has anything against automatic suspend (true - suspend can happen right now, false - suspend can't happen).
* Introduce
/sys/power/sleepthat will work like/sys/power/state, but:
- First, it will call ->acknowledge() for each driver (via bus types) to check if any of them wants to postpone the suspend (this will prevent tasks from being frozen unnecessarily if it is known in advance that the suspend should not happen at the moment).
- Next, it will check the "I_do_not_want_automatic_suspend_to_occur" flag of each process and the suspend will be aborted if it is true for any of them (quite frankly, I think that should be integrated with the freezer, in particular the tasks that haveTIF_FREEZEset shouldn't be able to set this flag and it should be checked in the freezer loop for every task withTIF_FREEZEunset).
- Next, it will proceed with suspending just like/sys/power/statedoes (the drivers that missed the opportunity to abort the suspend by returning 'false' from ->acknowledge() can still abort the suspend by failing their ->suspend() routines).Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.It seems to be flexible enough to me.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend.
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
What is better about polling in userspace?
One kernel thread less, for example?
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
Also, like my original wakelock patches, it breaks sleep requests through
/sys/power/statewhen there are input events queued.The idea is to have both
/sys/power/stateand/sys/power/sleepat the same time, where/sys/power/statewill work just like it does right now. Sure, there must be mutual exclusion between the two, but that's a matter of implementation IMO.
Quoted 4 lines
If you want to only prevent suspend though one interface, you have to also pass information to the driver about its suspend hook is being called so it can conditionally return
-EBUSY. The wakelock interface requires less code in each driver.
Well, I don't think so. Moreover, it requires you to spread wakelocks all over the place if you don't use the timeouted ones which, let's face it, is hardly acceptable.
Thanks,
Rafael
Quoted 56 lines · Rafael J. Wysocki
Quoted 55 lines · Arve Hjønnevåg
Quoted 53 lines · Rafael J. Wysocki
Quoted 40 lines · Arve Hjønnevåg
Quoted 39 lines · Rafael J. Wysocki
Quoted 25 lines · Arve Hjønnevåg
Quoted 21 lines · Rafael J. Wysocki
Quoted 12 lines · Arve Hjønnevåg
Quoted 10 lines · Alan Stern
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
Quoted 7 lines
On an android phone, any code that needs to run when the screen is off must hold a wakelock (directly or indirectly). In general if an application or the system is processing an event that may cause a user notification (new email, incoming phone call, alarm, etc.) it needs to prevent suspend. But, we also use wakelocks to upload stats or download system updates in the background, and for media player or (gps) data logging applications.
Quoted 2 lines
All of this doesn't seem to require wakelocks acuired from kernel space. What do you need those wakelocks for?
Quoted 10 lines
Most events do not originate in user-space. Alarms start in our alarm driver which locks a wakelock when its timer interrupt occurs. This wakelock stays locked until the user-space alarm manager calls the driver to wait for the next alarm. I've described how input events are handled before. Without kernel wakelocks, if the user space power manager had already turned off the screen and decided to suspend right before a wakeup key is pressed, then that key could sit in the in-kernel input queue until another key is pressed. Even if the user-space thread read the key event before being frozen, it cannot abort the suspend operation that was already started.
OK, so what about the following approach:
Quoted 8 lines
Quoted 4 lines
* Keep the decision making logic (power manager etc.) in user space. Reasons:
- It may be arbitrarily complicated
- It may include such things as s2ram quirks or hal quirks needed for some graphics adaptersI don't using wakelocks in any different in this respect. When user space decides that it is ok for the kernel to suspend it should have performed all theses steps in both cases.
If automatic suspend is to be started by the kernel, you have to make sure that at least one wakelock is held until these steps are completed. That may be somewhat tricky in general.
Quoted 8 lines
Quoted 2 lines
That is not tricky. If your code holds a wakelock, then at least one wakelock is held.
I meant, if one task releases its wakelock and another one takes a wakelock, you have to make sure there's no window between those events. Of course, you can have a single task holding a wakelock all the time and releasing it when it makes sure everything is ready, but then it would act as a user space power manager anyway.
If you are turning on and off hardware in user space that cannot survive a kernel suspend while it is on, then you hold a wakelock when this hardware is on. It should not matter how many times the kernel enter and exit suspend while your hardware is off.
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 8 lines
Quoted 3 lines
* Have a per-process (per-task or per-thread group, but the former would be easier IMO) "
I_do_not_want_automatic_suspend_to_occur" flag.A per-process (thread group) flag allows wakelocks to be implemented in a user space library. A per-thread flag does not. However, I don't see much benefit in tying this to a process instead of using a file descriptor.
Using a flag would allow us to remove the window between checking the wakelocks and freezing tasks (in principle a task may take a wakelock just before it's frozen).
Quoted 6 lines
Quoted 2 lines
You can check if there are wakelocks held from the same spot as you check your flag.
That would be _much_ more complicated and much less efficient (browsing a list vs checking a flag). And it would require additional locking if it's to be done in a non-racy way.
Browsing an empty list is not that inefficient. If you are concerned about the overhead of the extra spinlock, you could check if the list is empty before locking the spinlock.
Quoted 47 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 27 lines
* Add a new callback, say ->acknowledge(), to the set of each driver's PM operations, that will be called to check if the driver has anything against automatic suspend (true - suspend can happen right now, false - suspend can't happen).
* Introduce
/sys/power/sleepthat will work like/sys/power/state, but:
- First, it will call ->acknowledge() for each driver (via bus types) to check if any of them wants to postpone the suspend (this will prevent tasks from being frozen unnecessarily if it is known in advance that the suspend should not happen at the moment).
- Next, it will check the "I_do_not_want_automatic_suspend_to_occur" flag of each process and the suspend will be aborted if it is true for any of them (quite frankly, I think that should be integrated with the freezer, in particular the tasks that haveTIF_FREEZEset shouldn't be able to set this flag and it should be checked in the freezer loop for every task withTIF_FREEZEunset).
- Next, it will proceed with suspending just like/sys/power/statedoes (the drivers that missed the opportunity to abort the suspend by returning 'false' from ->acknowledge() can still abort the suspend by failing their ->suspend() routines).Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.It seems to be flexible enough to me.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend.
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
What is better about polling in userspace?
One kernel thread less, for example?
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
Also, like my original wakelock patches, it breaks sleep requests through
/sys/power/statewhen there are input events queued.The idea is to have both
/sys/power/stateand/sys/power/sleepat the same time, where/sys/power/statewill work just like it does right now. Sure, there must be mutual exclusion between the two, but that's a matter of implementation IMO.
Quoted 8 lines
Quoted 4 lines
If you want to only prevent suspend though one interface, you have to also pass information to the driver about its suspend hook is being called so it can conditionally return
-EBUSY. The wakelock interface requires less code in each driver.Well, I don't think so. Moreover, it requires you to spread wakelocks all over the place if you don't use the timeouted ones which, let's face it, is hardly acceptable.
Your method does not reduce the number of places that has to be modified. Any component where we add a wakelock, you have to add a suspend handler to abort suspend when we would have held a wakelock.
Signature · 1 line
Arve Hjønnevåg
Quoted 56 lines · Rafael J. Wysocki
Quoted 55 lines · Arve Hjønnevåg
Quoted 53 lines · Rafael J. Wysocki
Quoted 40 lines · Arve Hjønnevåg
Quoted 39 lines · Rafael J. Wysocki
Quoted 25 lines · Arve Hjønnevåg
Quoted 21 lines · Rafael J. Wysocki
Quoted 12 lines · Arve Hjønnevåg
Quoted 10 lines · Alan Stern
Quoted 5 lines
Quoted 2 lines
It might have to be platform-specific. The Android people seem to have a pretty good idea of what criteria will work for them.
I'd really like to know in what situations Androind is supposed to suspend automatically.
It might be better to ask in what situations Android is _not_ supposed to sleep automatically. In other words, in what situations is a wakelock acquired? Since the whole system is only a phone, this question should have a reasonably well-defined answer.
Quoted 7 lines
On an android phone, any code that needs to run when the screen is off must hold a wakelock (directly or indirectly). In general if an application or the system is processing an event that may cause a user notification (new email, incoming phone call, alarm, etc.) it needs to prevent suspend. But, we also use wakelocks to upload stats or download system updates in the background, and for media player or (gps) data logging applications.
Quoted 2 lines
All of this doesn't seem to require wakelocks acuired from kernel space. What do you need those wakelocks for?
Quoted 10 lines
Most events do not originate in user-space. Alarms start in our alarm driver which locks a wakelock when its timer interrupt occurs. This wakelock stays locked until the user-space alarm manager calls the driver to wait for the next alarm. I've described how input events are handled before. Without kernel wakelocks, if the user space power manager had already turned off the screen and decided to suspend right before a wakeup key is pressed, then that key could sit in the in-kernel input queue until another key is pressed. Even if the user-space thread read the key event before being frozen, it cannot abort the suspend operation that was already started.
OK, so what about the following approach:
Quoted 8 lines
Quoted 4 lines
* Keep the decision making logic (power manager etc.) in user space. Reasons:
- It may be arbitrarily complicated
- It may include such things as s2ram quirks or hal quirks needed for some graphics adaptersI don't using wakelocks in any different in this respect. When user space decides that it is ok for the kernel to suspend it should have performed all theses steps in both cases.
If automatic suspend is to be started by the kernel, you have to make sure that at least one wakelock is held until these steps are completed. That may be somewhat tricky in general.
Quoted 8 lines
Quoted 2 lines
That is not tricky. If your code holds a wakelock, then at least one wakelock is held.
I meant, if one task releases its wakelock and another one takes a wakelock, you have to make sure there's no window between those events. Of course, you can have a single task holding a wakelock all the time and releasing it when it makes sure everything is ready, but then it would act as a user space power manager anyway.
If you are turning on and off hardware in user space that cannot survive a kernel suspend while it is on, then you hold a wakelock when this hardware is on. It should not matter how many times the kernel enter and exit suspend while your hardware is off.
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 8 lines
Quoted 3 lines
* Have a per-process (per-task or per-thread group, but the former would be easier IMO) "
I_do_not_want_automatic_suspend_to_occur" flag.A per-process (thread group) flag allows wakelocks to be implemented in a user space library. A per-thread flag does not. However, I don't see much benefit in tying this to a process instead of using a file descriptor.
Using a flag would allow us to remove the window between checking the wakelocks and freezing tasks (in principle a task may take a wakelock just before it's frozen).
Quoted 6 lines
Quoted 2 lines
You can check if there are wakelocks held from the same spot as you check your flag.
That would be _much_ more complicated and much less efficient (browsing a list vs checking a flag). And it would require additional locking if it's to be done in a non-racy way.
Browsing an empty list is not that inefficient. If you are concerned about the overhead of the extra spinlock, you could check if the list is empty before locking the spinlock.
Quoted 47 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 27 lines
* Add a new callback, say ->acknowledge(), to the set of each driver's PM operations, that will be called to check if the driver has anything against automatic suspend (true - suspend can happen right now, false - suspend can't happen).
* Introduce
/sys/power/sleepthat will work like/sys/power/state, but:
- First, it will call ->acknowledge() for each driver (via bus types) to check if any of them wants to postpone the suspend (this will prevent tasks from being frozen unnecessarily if it is known in advance that the suspend should not happen at the moment).
- Next, it will check the "I_do_not_want_automatic_suspend_to_occur" flag of each process and the suspend will be aborted if it is true for any of them (quite frankly, I think that should be integrated with the freezer, in particular the tasks that haveTIF_FREEZEset shouldn't be able to set this flag and it should be checked in the freezer loop for every task withTIF_FREEZEunset).
- Next, it will proceed with suspending just like/sys/power/statedoes (the drivers that missed the opportunity to abort the suspend by returning 'false' from ->acknowledge() can still abort the suspend by failing their ->suspend() routines).Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.It seems to be flexible enough to me.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend.
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
What is better about polling in userspace?
One kernel thread less, for example?
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
Also, like my original wakelock patches, it breaks sleep requests through
/sys/power/statewhen there are input events queued.The idea is to have both
/sys/power/stateand/sys/power/sleepat the same time, where/sys/power/statewill work just like it does right now. Sure, there must be mutual exclusion between the two, but that's a matter of implementation IMO.
Quoted 8 lines
Quoted 4 lines
If you want to only prevent suspend though one interface, you have to also pass information to the driver about its suspend hook is being called so it can conditionally return
-EBUSY. The wakelock interface requires less code in each driver.Well, I don't think so. Moreover, it requires you to spread wakelocks all over the place if you don't use the timeouted ones which, let's face it, is hardly acceptable.
Your method does not reduce the number of places that has to be modified. Any component where we add a wakelock, you have to add a suspend handler to abort suspend when we would have held a wakelock.
Signature · 1 line
Arve Hjønnevåg
Quoted 9 lines · Arve Hjønnevåg
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Arve Hjønnevåg
Quoted 6 lines · Rafael J. Wysocki
Quoted 5 lines · Arve Hjønnevåg
Quoted 4 lines · Rafael J. Wysocki
Quoted 3 lines · Arve Hjønnevåg
Quoted 2 lines · Rafael J. Wysocki
Quoted 1 line · Arve Hjønnevåg
On Thu, Feb 19, 2009 at 2:08 PM, Alan Stern <[email protected]> wrote:
[--snip--]
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines
The idea is to have both
/sys/power/stateand/sys/power/sleepat the same time, where/sys/power/statewill work just like it does right now. Sure, there must be mutual exclusion between the two, but that's a matter of implementation IMO.If you want to only prevent suspend though one interface, you have to also pass information to the driver about its suspend hook is being called so it can conditionally return
-EBUSY. The wakelock interface requires less code in each driver.
Quoted 7 lines
Quoted 3 lines
Well, I don't think so. Moreover, it requires you to spread wakelocks all over the place if you don't use the timeouted ones which, let's face it, is hardly acceptable.
Your method does not reduce the number of places that has to be modified. Any component where we add a wakelock, you have to add a suspend handler to abort suspend when we would have held a wakelock.
Well, maybe not, but it doesn't introduce entirely new API for device drivers. Instead, it extends the existing interfaces which I think is more appropriate.
Thanks,
Rafael
Quoted 9 lines · Arve Hjønnevåg
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Arve Hjønnevåg
Quoted 6 lines · Rafael J. Wysocki
Quoted 5 lines · Arve Hjønnevåg
Quoted 4 lines · Rafael J. Wysocki
Quoted 3 lines · Arve Hjønnevåg
Quoted 2 lines · Rafael J. Wysocki
Quoted 1 line · Arve Hjønnevåg
On Thu, Feb 19, 2009 at 2:08 PM, Alan Stern <[email protected]> wrote:
[--snip--]
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines
The idea is to have both
/sys/power/stateand/sys/power/sleepat the same time, where/sys/power/statewill work just like it does right now. Sure, there must be mutual exclusion between the two, but that's a matter of implementation IMO.If you want to only prevent suspend though one interface, you have to also pass information to the driver about its suspend hook is being called so it can conditionally return
-EBUSY. The wakelock interface requires less code in each driver.
Quoted 7 lines
Quoted 3 lines
Well, I don't think so. Moreover, it requires you to spread wakelocks all over the place if you don't use the timeouted ones which, let's face it, is hardly acceptable.
Your method does not reduce the number of places that has to be modified. Any component where we add a wakelock, you have to add a suspend handler to abort suspend when we would have held a wakelock.
Well, maybe not, but it doesn't introduce entirely new API for device drivers. Instead, it extends the existing interfaces which I think is more appropriate.
Thanks,
Rafael
Quoted 25 lines · Rafael J. Wysocki
Quoted 9 lines · Arve Hjønnevåg
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Arve Hjønnevåg
Quoted 6 lines · Rafael J. Wysocki
Quoted 5 lines · Arve Hjønnevåg
Quoted 4 lines · Rafael J. Wysocki
Quoted 3 lines · Arve Hjønnevåg
Quoted 2 lines · Rafael J. Wysocki
Quoted 1 line · Arve Hjønnevåg
On Thu, Feb 19, 2009 at 2:08 PM, Alan Stern <[email protected]> wrote:
[--snip--]
Quoted 14 lines
Quoted 13 lines
Quoted 9 lines
Quoted 4 lines
The idea is to have both
/sys/power/stateand/sys/power/sleepat the same time, where/sys/power/statewill work just like it does right now. Sure, there must be mutual exclusion between the two, but that's a matter of implementation IMO.If you want to only prevent suspend though one interface, you have to also pass information to the driver about its suspend hook is being called so it can conditionally return
-EBUSY. The wakelock interface requires less code in each driver.Well, I don't think so. Moreover, it requires you to spread wakelocks all over the place if you don't use the timeouted ones which, let's face it, is hardly acceptable.
Quoted 6 lines
Quoted 3 lines
Your method does not reduce the number of places that has to be modified. Any component where we add a wakelock, you have to add a suspend handler to abort suspend when we would have held a wakelock.
Well, maybe not, but it doesn't introduce entirely new API for device drivers. Instead, it extends the existing interfaces which I think is more appropriate.
The existing interfaces require polling. I don't think extending these interfaces to make the polling faster is a better solution than adding an interface to avoid polling.
Also, with your solution, how would you modify evdev.c to prevent suspend while the event queue is not empty. This code does not have any suspend hooks and the queue is not tied to any thread.
Signature · 1 line
Arve Hjønnevåg
Quoted 25 lines · Rafael J. Wysocki
Quoted 9 lines · Arve Hjønnevåg
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Arve Hjønnevåg
Quoted 6 lines · Rafael J. Wysocki
Quoted 5 lines · Arve Hjønnevåg
Quoted 4 lines · Rafael J. Wysocki
Quoted 3 lines · Arve Hjønnevåg
Quoted 2 lines · Rafael J. Wysocki
Quoted 1 line · Arve Hjønnevåg
On Thu, Feb 19, 2009 at 2:08 PM, Alan Stern <[email protected]> wrote:
[--snip--]
Quoted 14 lines
Quoted 13 lines
Quoted 9 lines
Quoted 4 lines
The idea is to have both
/sys/power/stateand/sys/power/sleepat the same time, where/sys/power/statewill work just like it does right now. Sure, there must be mutual exclusion between the two, but that's a matter of implementation IMO.If you want to only prevent suspend though one interface, you have to also pass information to the driver about its suspend hook is being called so it can conditionally return
-EBUSY. The wakelock interface requires less code in each driver.Well, I don't think so. Moreover, it requires you to spread wakelocks all over the place if you don't use the timeouted ones which, let's face it, is hardly acceptable.
Quoted 6 lines
Quoted 3 lines
Your method does not reduce the number of places that has to be modified. Any component where we add a wakelock, you have to add a suspend handler to abort suspend when we would have held a wakelock.
Well, maybe not, but it doesn't introduce entirely new API for device drivers. Instead, it extends the existing interfaces which I think is more appropriate.
The existing interfaces require polling. I don't think extending these interfaces to make the polling faster is a better solution than adding an interface to avoid polling.
Also, with your solution, how would you modify evdev.c to prevent suspend while the event queue is not empty. This code does not have any suspend hooks and the queue is not tied to any thread.
Signature · 1 line
Arve Hjønnevåg
Quoted 33 lines · Arve Hjønnevåg
Quoted 25 lines · Rafael J. Wysocki
Quoted 9 lines · Arve Hjønnevåg
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Arve Hjønnevåg
Quoted 6 lines · Rafael J. Wysocki
Quoted 5 lines · Arve Hjønnevåg
Quoted 4 lines · Rafael J. Wysocki
Quoted 3 lines · Arve Hjønnevåg
Quoted 2 lines · Rafael J. Wysocki
Quoted 1 line · Arve Hjønnevåg
On Thu, Feb 19, 2009 at 2:08 PM, Alan Stern <[email protected]> wrote:
[--snip--]
Quoted 14 lines
Quoted 13 lines
Quoted 9 lines
Quoted 4 lines
The idea is to have both
/sys/power/stateand/sys/power/sleepat the same time, where/sys/power/statewill work just like it does right now. Sure, there must be mutual exclusion between the two, but that's a matter of implementation IMO.If you want to only prevent suspend though one interface, you have to also pass information to the driver about its suspend hook is being called so it can conditionally return
-EBUSY. The wakelock interface requires less code in each driver.Well, I don't think so. Moreover, it requires you to spread wakelocks all over the place if you don't use the timeouted ones which, let's face it, is hardly acceptable.
Quoted 6 lines
Quoted 3 lines
Your method does not reduce the number of places that has to be modified. Any component where we add a wakelock, you have to add a suspend handler to abort suspend when we would have held a wakelock.
Well, maybe not, but it doesn't introduce entirely new API for device drivers. Instead, it extends the existing interfaces which I think is more appropriate.
Quoted 7 lines
The existing interfaces require polling. I don't think extending these interfaces to make the polling faster is a better solution than adding an interface to avoid polling.
Also, with your solution, how would you modify
evdev.cto prevent suspend while the event queue is not empty. This code does not have any suspend hooks and the queue is not tied to any thread.
Well, why do you need to modify evdev.c in the first place?
Rafael
Quoted 33 lines · Arve Hjønnevåg
Quoted 25 lines · Rafael J. Wysocki
Quoted 9 lines · Arve Hjønnevåg
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Arve Hjønnevåg
Quoted 6 lines · Rafael J. Wysocki
Quoted 5 lines · Arve Hjønnevåg
Quoted 4 lines · Rafael J. Wysocki
Quoted 3 lines · Arve Hjønnevåg
Quoted 2 lines · Rafael J. Wysocki
Quoted 1 line · Arve Hjønnevåg
On Thu, Feb 19, 2009 at 2:08 PM, Alan Stern <[email protected]> wrote:
[--snip--]
Quoted 14 lines
Quoted 13 lines
Quoted 9 lines
Quoted 4 lines
The idea is to have both
/sys/power/stateand/sys/power/sleepat the same time, where/sys/power/statewill work just like it does right now. Sure, there must be mutual exclusion between the two, but that's a matter of implementation IMO.If you want to only prevent suspend though one interface, you have to also pass information to the driver about its suspend hook is being called so it can conditionally return
-EBUSY. The wakelock interface requires less code in each driver.Well, I don't think so. Moreover, it requires you to spread wakelocks all over the place if you don't use the timeouted ones which, let's face it, is hardly acceptable.
Quoted 6 lines
Quoted 3 lines
Your method does not reduce the number of places that has to be modified. Any component where we add a wakelock, you have to add a suspend handler to abort suspend when we would have held a wakelock.
Well, maybe not, but it doesn't introduce entirely new API for device drivers. Instead, it extends the existing interfaces which I think is more appropriate.
Quoted 7 lines
The existing interfaces require polling. I don't think extending these interfaces to make the polling faster is a better solution than adding an interface to avoid polling.
Also, with your solution, how would you modify
evdev.cto prevent suspend while the event queue is not empty. This code does not have any suspend hooks and the queue is not tied to any thread.
Well, why do you need to modify evdev.c in the first place?
Rafael
Quoted 38 lines · Rafael J. Wysocki
Quoted 37 lines · Arve Hjønnevåg
Quoted 25 lines · Rafael J. Wysocki
Quoted 9 lines · Arve Hjønnevåg
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Arve Hjønnevåg
Quoted 6 lines · Rafael J. Wysocki
Quoted 5 lines · Arve Hjønnevåg
Quoted 4 lines · Rafael J. Wysocki
Quoted 3 lines · Arve Hjønnevåg
Quoted 2 lines · Rafael J. Wysocki
Quoted 1 line · Arve Hjønnevåg
On Thu, Feb 19, 2009 at 2:08 PM, Alan Stern <[email protected]> wrote:
[--snip--]
Quoted 14 lines
Quoted 13 lines
Quoted 9 lines
Quoted 4 lines
The idea is to have both
/sys/power/stateand/sys/power/sleepat the same time, where/sys/power/statewill work just like it does right now. Sure, there must be mutual exclusion between the two, but that's a matter of implementation IMO.If you want to only prevent suspend though one interface, you have to also pass information to the driver about its suspend hook is being called so it can conditionally return
-EBUSY. The wakelock interface requires less code in each driver.Well, I don't think so. Moreover, it requires you to spread wakelocks all over the place if you don't use the timeouted ones which, let's face it, is hardly acceptable.
Quoted 6 lines
Quoted 3 lines
Your method does not reduce the number of places that has to be modified. Any component where we add a wakelock, you have to add a suspend handler to abort suspend when we would have held a wakelock.
Well, maybe not, but it doesn't introduce entirely new API for device drivers. Instead, it extends the existing interfaces which I think is more appropriate.
The existing interfaces require polling. I don't think extending these interfaces to make the polling faster is a better solution than adding an interface to avoid polling.
Quoted 5 lines
Quoted 3 lines
Also, with your solution, how would you modify
evdev.cto prevent suspend while the event queue is not empty. This code does not have any suspend hooks and the queue is not tied to any thread.Well, why do you need to modify
evdev.cin the first place?
It is the only code that knows that there are unprocessed input events.
Signature · 1 line
Arve Hjønnevåg
Quoted 38 lines · Rafael J. Wysocki
Quoted 37 lines · Arve Hjønnevåg
Quoted 25 lines · Rafael J. Wysocki
Quoted 9 lines · Arve Hjønnevåg
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Arve Hjønnevåg
Quoted 6 lines · Rafael J. Wysocki
Quoted 5 lines · Arve Hjønnevåg
Quoted 4 lines · Rafael J. Wysocki
Quoted 3 lines · Arve Hjønnevåg
Quoted 2 lines · Rafael J. Wysocki
Quoted 1 line · Arve Hjønnevåg
On Thu, Feb 19, 2009 at 2:08 PM, Alan Stern <[email protected]> wrote:
[--snip--]
Quoted 14 lines
Quoted 13 lines
Quoted 9 lines
Quoted 4 lines
The idea is to have both
/sys/power/stateand/sys/power/sleepat the same time, where/sys/power/statewill work just like it does right now. Sure, there must be mutual exclusion between the two, but that's a matter of implementation IMO.If you want to only prevent suspend though one interface, you have to also pass information to the driver about its suspend hook is being called so it can conditionally return
-EBUSY. The wakelock interface requires less code in each driver.Well, I don't think so. Moreover, it requires you to spread wakelocks all over the place if you don't use the timeouted ones which, let's face it, is hardly acceptable.
Quoted 6 lines
Quoted 3 lines
Your method does not reduce the number of places that has to be modified. Any component where we add a wakelock, you have to add a suspend handler to abort suspend when we would have held a wakelock.
Well, maybe not, but it doesn't introduce entirely new API for device drivers. Instead, it extends the existing interfaces which I think is more appropriate.
The existing interfaces require polling. I don't think extending these interfaces to make the polling faster is a better solution than adding an interface to avoid polling.
Quoted 5 lines
Quoted 3 lines
Also, with your solution, how would you modify
evdev.cto prevent suspend while the event queue is not empty. This code does not have any suspend hooks and the queue is not tied to any thread.Well, why do you need to modify
evdev.cin the first place?
It is the only code that knows that there are unprocessed input events.
Signature · 1 line
Arve Hjønnevåg
Hi!
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
What is better about polling in userspace?
One kernel thread less, for example?
One kernel thread is about as costly as one userland thread. And I believe we should not design new code that _needs_ polling.
I think it is better to have kernel thread than userland polling us all the time.
Now... on PC it will be "interesting". Your solution has great advantage of being able to work with s2ram quirks... But s2ram quirks are not an issue on embedded hardware or OLPC, and hopefully kernel mode setting will fix it on PCs, too...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi!
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
What is better about polling in userspace?
One kernel thread less, for example?
One kernel thread is about as costly as one userland thread. And I believe we should not design new code that _needs_ polling.
I think it is better to have kernel thread than userland polling us all the time.
Now... on PC it will be "interesting". Your solution has great advantage of being able to work with s2ram quirks... But s2ram quirks are not an issue on embedded hardware or OLPC, and hopefully kernel mode setting will fix it on PCs, too...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi!
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
It seems to be flexible enough to me.
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend.
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
polling is evil -- it keeps CPU wake up => wastes power.
Wakelocks done right are single atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 15 lines · Pavel Machek
Hi!
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.Quoted 8 lines
Quoted 4 lines
Quoted 1 line
It seems to be flexible enough to me.
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend.
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
Quoted 5 lines
polling is evil -- it keeps CPU wake up => wastes power.
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...
Except that you have to check all of the wakelocks periodically in a loop => polling. So?
Rafael
Quoted 15 lines · Pavel Machek
Hi!
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.Quoted 8 lines
Quoted 4 lines
Quoted 1 line
It seems to be flexible enough to me.
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend.
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
Quoted 5 lines
polling is evil -- it keeps CPU wake up => wastes power.
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...
Except that you have to check all of the wakelocks periodically in a loop => polling. So?
Rafael
Quoted 7 lines · Rafael J. Wysocki
Quoted 3 lines · Pavel Machek
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...Except that you have to check all of the wakelocks periodically in a loop => polling. So?
Why do you need to check them? If you're taking this approach you just have something like:
suspend_unblock() {
if (atomc_dec_and_test(&suspend_lock))
suspend();
}and then check that the lock count is still 0 after device_suspend(). There's no need to poll.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 7 lines · Rafael J. Wysocki
Quoted 3 lines · Pavel Machek
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...Except that you have to check all of the wakelocks periodically in a loop => polling. So?
Why do you need to check them? If you're taking this approach you just have something like:
suspend_unblock() {
if (atomc_dec_and_test(&suspend_lock))
suspend();
}and then check that the lock count is still 0 after device_suspend(). There's no need to poll.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 12 lines · Matthew Garrett
Quoted 7 lines · Rafael J. Wysocki
Quoted 3 lines · Pavel Machek
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...Except that you have to check all of the wakelocks periodically in a loop => polling. So?
Why do you need to check them? If you're taking this approach you just have something like:
Quoted 7 lines
suspend_unblock() { if (atomc_dec_and_test(&suspend_lock)) suspend(); }and then check that the lock count is still 0 after
device_suspend(). There's no need to poll.
I was talking about wakelocks as originally proposed.
Using a refcount along with per-driver and per-process flags (probably two refcounts would be more efficient in fact) is the latest idea and I agree it wouldn't require polling. However, if you refer to that, please don't use the name "wakelock". :-)
Thanks,
Rafael
Quoted 12 lines · Matthew Garrett
Quoted 7 lines · Rafael J. Wysocki
Quoted 3 lines · Pavel Machek
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...Except that you have to check all of the wakelocks periodically in a loop => polling. So?
Why do you need to check them? If you're taking this approach you just have something like:
Quoted 7 lines
suspend_unblock() { if (atomc_dec_and_test(&suspend_lock)) suspend(); }and then check that the lock count is still 0 after
device_suspend(). There's no need to poll.
I was talking about wakelocks as originally proposed.
Using a refcount along with per-driver and per-process flags (probably two refcounts would be more efficient in fact) is the latest idea and I agree it wouldn't require polling. However, if you refer to that, please don't use the name "wakelock". :-)
Thanks,
Rafael
Quoted 18 lines · Rafael J. Wysocki
Quoted 17 lines · Matthew Garrett
Quoted 7 lines · Rafael J. Wysocki
Quoted 3 lines · Pavel Machek
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...Except that you have to check all of the wakelocks periodically in a loop => polling. So?
Why do you need to check them? If you're taking this approach you just have something like:
suspend_unblock(){
if (atomc_dec_and_test(&suspend_lock))
suspend();
}
Quoted 4 lines
Quoted 2 lines
and then check that the lock count is still 0 after
device_suspend(). There's no need to poll.I was talking about wakelocks as originally proposed.
Can you be more specific? My wakelock implementation triggers suspend when the active list becomes empty. No polling required.
Signature · 1 line
Arve Hjønnevåg
Quoted 18 lines · Rafael J. Wysocki
Quoted 17 lines · Matthew Garrett
Quoted 7 lines · Rafael J. Wysocki
Quoted 3 lines · Pavel Machek
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...Except that you have to check all of the wakelocks periodically in a loop => polling. So?
Why do you need to check them? If you're taking this approach you just have something like:
suspend_unblock(){
if (atomc_dec_and_test(&suspend_lock))
suspend();
}
Quoted 4 lines
Quoted 2 lines
and then check that the lock count is still 0 after
device_suspend(). There's no need to poll.I was talking about wakelocks as originally proposed.
Can you be more specific? My wakelock implementation triggers suspend when the active list becomes empty. No polling required.
Signature · 1 line
Arve Hjønnevåg
Quoted 19 lines · Arve Hjønnevåg
Quoted 18 lines · Rafael J. Wysocki
Quoted 17 lines · Matthew Garrett
Quoted 7 lines · Rafael J. Wysocki
Quoted 3 lines · Pavel Machek
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...Except that you have to check all of the wakelocks periodically in a loop => polling. So?
Why do you need to check them? If you're taking this approach you just have something like:
suspend_unblock() { if (atomc_dec_and_test(&suspend_lock)) suspend(); }
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
and then check that the lock count is still 0 after
device_suspend(). There's no need to poll.I was talking about wakelocks as originally proposed.
Can you be more specific? My wakelock implementation triggers suspend when the active list becomes empty. No polling required.
Sorry, I overlooked and/or didn't remember that. My bad.
Rafael
Quoted 19 lines · Arve Hjønnevåg
Quoted 18 lines · Rafael J. Wysocki
Quoted 17 lines · Matthew Garrett
Quoted 7 lines · Rafael J. Wysocki
Quoted 3 lines · Pavel Machek
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...Except that you have to check all of the wakelocks periodically in a loop => polling. So?
Why do you need to check them? If you're taking this approach you just have something like:
suspend_unblock() { if (atomc_dec_and_test(&suspend_lock)) suspend(); }
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
and then check that the lock count is still 0 after
device_suspend(). There's no need to poll.I was talking about wakelocks as originally proposed.
Can you be more specific? My wakelock implementation triggers suspend when the active list becomes empty. No polling required.
Sorry, I overlooked and/or didn't remember that. My bad.
Rafael
Quoted 16 lines · Rafael J. Wysocki
Quoted 15 lines · Pavel Machek
Hi!
Quoted 12 lines
Quoted 8 lines
Quoted 5 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.It seems to be flexible enough to me.
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend.
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
Quoted 8 lines
Quoted 5 lines
polling is evil -- it keeps CPU wake up => wastes power.
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...Except that you have to check all of the wakelocks periodically in a loop => polling. So?
No. I want to have single atomic_t for all the wakelocks... at least in non-debug version. Debug version will be slower. I believe you originally suggested that.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 16 lines · Rafael J. Wysocki
Quoted 15 lines · Pavel Machek
Hi!
Quoted 12 lines
Quoted 8 lines
Quoted 5 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.It seems to be flexible enough to me.
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend.
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
Quoted 8 lines
Quoted 5 lines
polling is evil -- it keeps CPU wake up => wastes power.
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...Except that you have to check all of the wakelocks periodically in a loop => polling. So?
No. I want to have single atomic_t for all the wakelocks... at least in non-debug version. Debug version will be slower. I believe you originally suggested that.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 23 lines · Pavel Machek
Quoted 22 lines · Rafael J. Wysocki
Quoted 20 lines · Pavel Machek
Hi!
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.Quoted 8 lines
Quoted 4 lines
Quoted 1 line
It seems to be flexible enough to me.
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend.
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
polling is evil -- it keeps CPU wake up => wastes power.
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...
Quoted 6 lines
Quoted 2 lines
Except that you have to check all of the wakelocks periodically in a loop => polling. So?
No. I want to have single
atomic_tfor all the wakelocks... at least in non-debug version. Debug version will be slower. I believe you originally suggested that.
I did, but please don't call it "wakelocks". It's confusing.
Thanks,
Rafael
Quoted 23 lines · Pavel Machek
Quoted 22 lines · Rafael J. Wysocki
Quoted 20 lines · Pavel Machek
Hi!
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.Quoted 8 lines
Quoted 4 lines
Quoted 1 line
It seems to be flexible enough to me.
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend.
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
polling is evil -- it keeps CPU wake up => wastes power.
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...
Quoted 6 lines
Quoted 2 lines
Except that you have to check all of the wakelocks periodically in a loop => polling. So?
No. I want to have single
atomic_tfor all the wakelocks... at least in non-debug version. Debug version will be slower. I believe you originally suggested that.
I did, but please don't call it "wakelocks". It's confusing.
Thanks,
Rafael
Quoted 24 lines · Rafael J. Wysocki
Quoted 23 lines · Pavel Machek
Quoted 22 lines · Rafael J. Wysocki
Quoted 20 lines · Pavel Machek
Hi!
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.Quoted 8 lines
Quoted 4 lines
Quoted 1 line
It seems to be flexible enough to me.
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend.
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
polling is evil -- it keeps CPU wake up => wastes power.
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Except that you have to check all of the wakelocks periodically in a loop => polling. So?
No. I want to have single
atomic_tfor all the wakelocks... at least in non-debug version. Debug version will be slower. I believe you originally suggested that.I did, but please don't call it "wakelocks". It's confusing.
What you are talking about here is mostly an optimization of the wakelock api. You have removed timeout support and made each wakelock reference counted. If you ignore wakelocks with timeouts, the current wakelock interface can be implemented with a global atomic_t to prevent suspend, and a per wakelock atomic_t to prevent a single client from changing the global reference count by more than one.
There are a couple of reasons that I have not done this. It removes the ability to easily inspect the system when it is not suspending. I do provide an option to turn off the wakelock stats, which makes wake_lock/unlock significantly faster, but we never run with wakelock stats off. Also, it pushes timeout handling to the drivers. I know may of you don't like timeout support, but ignoring the problem is not a solution. If each driver that needs timeouts uses its own timer, then you will often wakeup from idle just to unlock a wakelock that will not trigger suspend. This wakeup is a thousand times as costly on the msm platform as a wakelock/unlock pair (with wakelock stats enabled).
I just checked my phone, and over a 24 hour awake time (370 hours uptime) period, it acquired about 5 million wakelocks (mostly for input events). If these were cache hits, and took as long as my benchmark did, that accounts for 20 seconds of overhead (0.023% of awake, 0.1% of not-idle (5.5h).
Signature · 1 line
Arve Hjønnevåg
Quoted 24 lines · Rafael J. Wysocki
Quoted 23 lines · Pavel Machek
Quoted 22 lines · Rafael J. Wysocki
Quoted 20 lines · Pavel Machek
Hi!
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.Quoted 8 lines
Quoted 4 lines
Quoted 1 line
It seems to be flexible enough to me.
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend.
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
polling is evil -- it keeps CPU wake up => wastes power.
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Except that you have to check all of the wakelocks periodically in a loop => polling. So?
No. I want to have single
atomic_tfor all the wakelocks... at least in non-debug version. Debug version will be slower. I believe you originally suggested that.I did, but please don't call it "wakelocks". It's confusing.
What you are talking about here is mostly an optimization of the wakelock api. You have removed timeout support and made each wakelock reference counted. If you ignore wakelocks with timeouts, the current wakelock interface can be implemented with a global atomic_t to prevent suspend, and a per wakelock atomic_t to prevent a single client from changing the global reference count by more than one.
There are a couple of reasons that I have not done this. It removes the ability to easily inspect the system when it is not suspending. I do provide an option to turn off the wakelock stats, which makes wake_lock/unlock significantly faster, but we never run with wakelock stats off. Also, it pushes timeout handling to the drivers. I know may of you don't like timeout support, but ignoring the problem is not a solution. If each driver that needs timeouts uses its own timer, then you will often wakeup from idle just to unlock a wakelock that will not trigger suspend. This wakeup is a thousand times as costly on the msm platform as a wakelock/unlock pair (with wakelock stats enabled).
I just checked my phone, and over a 24 hour awake time (370 hours uptime) period, it acquired about 5 million wakelocks (mostly for input events). If these were cache hits, and took as long as my benchmark did, that accounts for 20 seconds of overhead (0.023% of awake, 0.1% of not-idle (5.5h).
Signature · 1 line
Arve Hjønnevåg
Hi!
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...Except that you have to check all of the wakelocks periodically in a loop => polling. So?
No. I want to have single
atomic_tfor all the wakelocks... at least in non-debug version. Debug version will be slower. I believe you originally suggested that.
Quoted 8 lines
Quoted 1 line
I did, but please don't call it "wakelocks". It's confusing.
What you are talking about here is mostly an optimization of the wakelock api. You have removed timeout support and made each wakelock reference counted. If you ignore wakelocks with timeouts, the current wakelock interface can be implemented with a global
atomic_tto prevent suspend, and a per wakelockatomic_tto prevent a single client from changing the global reference count by more than one.
Actually I'd go to global atomic_t to prevent suspend, and make sure single client only changes it once by design.
Quoted 5 lines
There are a couple of reasons that I have not done this. It removes the ability to easily inspect the system when it is not suspending. I do provide an option to turn off the wakelock stats, which makes wake_lock/unlock significantly faster, but we never run with wakelock stats off.
It seems wrong to design for the "debugging" case. ... even if you run with debugging enabled.
Quoted 8 lines
Also, it pushes timeout handling to the drivers. I know may
of you don't like timeout support, but ignoring the problem is not a solution. If each driver that needs timeouts uses its own timer, then you will often wakeup from idle just to unlock a wakelock that will not trigger suspend. This wakeup is a thousand times as costly on the msm platform as a wakelock/unlock pair (with wakelock stats enabled).
Well, you are free to have a library (or something) those broken drivers can use. But you have to understand that those drivers are broken... and please don't make it part of core API.
It should also make the merging easier; merge non-contraversial parts first (single atomic_t), then add debugging infrastructure, then maybe add timeout handling if those drivers can really not be fixed in a nicer way...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 22 lines · Pavel Machek
Hi!
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...Except that you have to check all of the wakelocks periodically in a loop => polling. So?
No. I want to have single
atomic_tfor all the wakelocks... at least in non-debug version. Debug version will be slower. I believe you originally suggested that.Quoted 8 lines
Quoted 1 line
I did, but please don't call it "wakelocks". It's confusing.
What you are talking about here is mostly an optimization of the wakelock api. You have removed timeout support and made each wakelock reference counted. If you ignore wakelocks with timeouts, the current wakelock interface can be implemented with a global
atomic_tto prevent suspend, and a per wakelockatomic_tto prevent a single client from changing the global reference count by more than one.
Quoted 2 lines
Actually I'd go to global
atomic_tto prevent suspend, and make sure single client only changes it once by design.
If you go with only a global atomic_t then you automatically allow clients to change the count by more than one. Our userland api calls this a reference counted wakelock, and reference counted wakelocks have been a frequent source of bugs. We have code that calls wake_lock every time an item is added to a queue and wake_unlock when it gets a notification that item was removed. If you miss a notification the lock is never released. With non reference counted wakelocks, can unlock every time the queue is empty, and lock either when adding the first item or every time you add an item (useful when combined with timeouts).
I could extend the wakelock api to allow reference counted wakelocks, but I have not come across any drivers where it would be beneficial (to the driver, not the wakelock implementation), and causes conflicts with timeouts.
Quoted 8 lines
Quoted 5 lines
There are a couple of reasons that I have not done this. It removes the ability to easily inspect the system when it is not suspending. I do provide an option to turn off the wakelock stats, which makes wake_lock/unlock significantly faster, but we never run with wakelock stats off.
It seems wrong to design for the "debugging" case. ... even if you run with debugging enabled.
I'm not sure I would call wakelock stats purely a debugging feature. Either way, designing the api to pass in an object, allows stats and debugging features to be implemented. Designing the api to be a global reference count without an object prevents both.
I realize that some of the proposed alternatives allow the same stats and debugging information to be added to other kernel objects (tasks and devices), but I prefer a separate wakelock object. We have drivers that use more then one wakelock per device, and many wakelocks do not have any association with a task either.
Quoted 10 lines
Quoted 9 lines
Also, it pushes timeout handling to the drivers. I know may
of you don't like timeout support, but ignoring the problem is not a solution. If each driver that needs timeouts uses its own timer, then you will often wakeup from idle just to unlock a wakelock that will not trigger suspend. This wakeup is a thousand times as costly on the msm platform as a wakelock/unlock pair (with wakelock stats enabled).
Quoted 3 lines
Well, you are free to have a library (or something) those broken drivers can use. But you have to understand that those drivers are broken... and please don't make it part of core API.
I don't agree. Not all the timeout uses are broken. The unknown-wakeup wakelock that is used if suspend fails preserved compatibility with existing drivers without introducing any race conditions. I also use a wakelock with a one second timeout if the alarm driver is suspended less than a second before the alarm is supposed to expire. I could probably rewrite this driver to not use a timeout, but the current implementation is not broken.
Quoted 4 lines
It should also make the merging easier; merge non-contraversial parts first (single
atomic_t), then add debugging infrastructure, then maybe add timeout handling if those drivers can really not be fixed in a nicer way...
Why is a single atomic_t less controversial? It is just as invasive as the wakelock interface and it provides no help in interacting with unmodified subsystems.
I'm more interested in getting code merged that can easily be used in a fully functional system, than code that only works for test systems, but if the implementation details of the wakelock interface is the only thing that prevents it from being merged, I can change it. I do find it odd that this is what is objectionable though, as it is already more efficient than the pm_qos interface that people want us to use instead of idle wakelocks.
Signature · 1 line
Arve Hjønnevåg
Quoted 22 lines · Pavel Machek
Hi!
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...Except that you have to check all of the wakelocks periodically in a loop => polling. So?
No. I want to have single
atomic_tfor all the wakelocks... at least in non-debug version. Debug version will be slower. I believe you originally suggested that.Quoted 8 lines
Quoted 1 line
I did, but please don't call it "wakelocks". It's confusing.
What you are talking about here is mostly an optimization of the wakelock api. You have removed timeout support and made each wakelock reference counted. If you ignore wakelocks with timeouts, the current wakelock interface can be implemented with a global
atomic_tto prevent suspend, and a per wakelockatomic_tto prevent a single client from changing the global reference count by more than one.
Quoted 2 lines
Actually I'd go to global
atomic_tto prevent suspend, and make sure single client only changes it once by design.
If you go with only a global atomic_t then you automatically allow clients to change the count by more than one. Our userland api calls this a reference counted wakelock, and reference counted wakelocks have been a frequent source of bugs. We have code that calls wake_lock every time an item is added to a queue and wake_unlock when it gets a notification that item was removed. If you miss a notification the lock is never released. With non reference counted wakelocks, can unlock every time the queue is empty, and lock either when adding the first item or every time you add an item (useful when combined with timeouts).
I could extend the wakelock api to allow reference counted wakelocks, but I have not come across any drivers where it would be beneficial (to the driver, not the wakelock implementation), and causes conflicts with timeouts.
Quoted 8 lines
Quoted 5 lines
There are a couple of reasons that I have not done this. It removes the ability to easily inspect the system when it is not suspending. I do provide an option to turn off the wakelock stats, which makes wake_lock/unlock significantly faster, but we never run with wakelock stats off.
It seems wrong to design for the "debugging" case. ... even if you run with debugging enabled.
I'm not sure I would call wakelock stats purely a debugging feature. Either way, designing the api to pass in an object, allows stats and debugging features to be implemented. Designing the api to be a global reference count without an object prevents both.
I realize that some of the proposed alternatives allow the same stats and debugging information to be added to other kernel objects (tasks and devices), but I prefer a separate wakelock object. We have drivers that use more then one wakelock per device, and many wakelocks do not have any association with a task either.
Quoted 10 lines
Quoted 9 lines
Also, it pushes timeout handling to the drivers. I know may
of you don't like timeout support, but ignoring the problem is not a solution. If each driver that needs timeouts uses its own timer, then you will often wakeup from idle just to unlock a wakelock that will not trigger suspend. This wakeup is a thousand times as costly on the msm platform as a wakelock/unlock pair (with wakelock stats enabled).
Quoted 3 lines
Well, you are free to have a library (or something) those broken drivers can use. But you have to understand that those drivers are broken... and please don't make it part of core API.
I don't agree. Not all the timeout uses are broken. The unknown-wakeup wakelock that is used if suspend fails preserved compatibility with existing drivers without introducing any race conditions. I also use a wakelock with a one second timeout if the alarm driver is suspended less than a second before the alarm is supposed to expire. I could probably rewrite this driver to not use a timeout, but the current implementation is not broken.
Quoted 4 lines
It should also make the merging easier; merge non-contraversial parts first (single
atomic_t), then add debugging infrastructure, then maybe add timeout handling if those drivers can really not be fixed in a nicer way...
Why is a single atomic_t less controversial? It is just as invasive as the wakelock interface and it provides no help in interacting with unmodified subsystems.
I'm more interested in getting code merged that can easily be used in a fully functional system, than code that only works for test systems, but if the implementation details of the wakelock interface is the only thing that prevents it from being merged, I can change it. I do find it odd that this is what is objectionable though, as it is already more efficient than the pm_qos interface that people want us to use instead of idle wakelocks.
Signature · 1 line
Arve Hjønnevåg
Hi!
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...Except that you have to check all of the wakelocks periodically in a loop => polling. So?
No. I want to have single
atomic_tfor all the wakelocks... at least in non-debug version. Debug version will be slower. I believe you originally suggested that.
Quoted 8 lines
Quoted 1 line
I did, but please don't call it "wakelocks". It's confusing.
What you are talking about here is mostly an optimization of the wakelock api. You have removed timeout support and made each wakelock reference counted. If you ignore wakelocks with timeouts, the current wakelock interface can be implemented with a global
atomic_tto prevent suspend, and a per wakelockatomic_tto prevent a single client from changing the global reference count by more than one.
Actually I'd go to global atomic_t to prevent suspend, and make sure single client only changes it once by design.
Quoted 5 lines
There are a couple of reasons that I have not done this. It removes the ability to easily inspect the system when it is not suspending. I do provide an option to turn off the wakelock stats, which makes wake_lock/unlock significantly faster, but we never run with wakelock stats off.
It seems wrong to design for the "debugging" case. ... even if you run with debugging enabled.
Quoted 8 lines
Also, it pushes timeout handling to the drivers. I know may
of you don't like timeout support, but ignoring the problem is not a solution. If each driver that needs timeouts uses its own timer, then you will often wakeup from idle just to unlock a wakelock that will not trigger suspend. This wakeup is a thousand times as costly on the msm platform as a wakelock/unlock pair (with wakelock stats enabled).
Well, you are free to have a library (or something) those broken drivers can use. But you have to understand that those drivers are broken... and please don't make it part of core API.
It should also make the merging easier; merge non-contraversial parts first (single atomic_t), then add debugging infrastructure, then maybe add timeout handling if those drivers can really not be fixed in a nicer way...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 32 lines · Arve Hjønnevåg
Quoted 31 lines · Rafael J. Wysocki
Quoted 29 lines · Pavel Machek
Quoted 16 lines · Rafael J. Wysocki
Quoted 15 lines · Pavel Machek
Hi!
Quoted 12 lines
Quoted 8 lines
Quoted 5 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.It seems to be flexible enough to me.
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend.
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
Quoted 8 lines
Quoted 5 lines
polling is evil -- it keeps CPU wake up => wastes power.
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...Except that you have to check all of the wakelocks periodically in a loop => polling. So?
No. I want to have single
atomic_tfor all the wakelocks... at least in non-debug version. Debug version will be slower. I believe you originally suggested that.
Quoted 5 lines
Quoted 1 line
I did, but please don't call it "wakelocks". It's confusing.
What you are talking about here is mostly an optimization of the wakelock api. You have removed timeout support and made each wakelock reference counted.
I also removed the arbitrary number of wakelocks (I really _hate_ the name, can we please stop using it from now on?).
Quoted 7 lines
If you ignore wakelocks with timeouts, the current wakelock interface can be implemented with a global
atomic_tto prevent suspend, and a per wakelockatomic_tto prevent a single client from changing the global reference count by more than one.There are a couple of reasons that I have not done this. It removes the ability to easily inspect the system when it is not suspending.
Care to elaborate?
Quoted 8 lines
I do provide an option to turn off the wakelock stats, which makes wake_lock/unlock significantly faster, but we never run with wakelock stats off. Also, it pushes timeout handling to the drivers. I know may of you don't like timeout support, but ignoring the problem is not a solution. If each driver that needs timeouts uses its own timer, then you will often wakeup from idle just to unlock a wakelock that will not trigger suspend. This wakeup is a thousand times as costly on the msm platform as a wakelock/unlock pair (with wakelock stats enabled).
Well, at least a couple of people told you that the timeouts are hardly acceptable and they told you why. Please stop repeating the same arguments you have given already for a couple of times. They're not convincing.
Instead of trying to convince everyone to accept your solution that you're not willing to change, please try to listen and think how to do things differently so that everyone is comfortable with them. I'm sure you're more than capable of doing that.
I do realize that you consider your current solution as the best thing since the sliced bread, but please accept the fact that the other people think differently.
Quoted 5 lines
I just checked my phone, and over a 24 hour awake time (370 hours uptime) period, it acquired about 5 million wakelocks (mostly for input events). If these were cache hits, and took as long as my benchmark did, that accounts for 20 seconds of overhead (0.023% of awake, 0.1% of not-idle (5.5h).
Which proves what exactly?
Rafael
Quoted 32 lines · Arve Hjønnevåg
Quoted 31 lines · Rafael J. Wysocki
Quoted 29 lines · Pavel Machek
Quoted 16 lines · Rafael J. Wysocki
Quoted 15 lines · Pavel Machek
Hi!
Quoted 12 lines
Quoted 8 lines
Quoted 5 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.It seems to be flexible enough to me.
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend.
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
Quoted 8 lines
Quoted 5 lines
polling is evil -- it keeps CPU wake up => wastes power.
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...Except that you have to check all of the wakelocks periodically in a loop => polling. So?
No. I want to have single
atomic_tfor all the wakelocks... at least in non-debug version. Debug version will be slower. I believe you originally suggested that.
Quoted 5 lines
Quoted 1 line
I did, but please don't call it "wakelocks". It's confusing.
What you are talking about here is mostly an optimization of the wakelock api. You have removed timeout support and made each wakelock reference counted.
I also removed the arbitrary number of wakelocks (I really _hate_ the name, can we please stop using it from now on?).
Quoted 7 lines
If you ignore wakelocks with timeouts, the current wakelock interface can be implemented with a global
atomic_tto prevent suspend, and a per wakelockatomic_tto prevent a single client from changing the global reference count by more than one.There are a couple of reasons that I have not done this. It removes the ability to easily inspect the system when it is not suspending.
Care to elaborate?
Quoted 8 lines
I do provide an option to turn off the wakelock stats, which makes wake_lock/unlock significantly faster, but we never run with wakelock stats off. Also, it pushes timeout handling to the drivers. I know may of you don't like timeout support, but ignoring the problem is not a solution. If each driver that needs timeouts uses its own timer, then you will often wakeup from idle just to unlock a wakelock that will not trigger suspend. This wakeup is a thousand times as costly on the msm platform as a wakelock/unlock pair (with wakelock stats enabled).
Well, at least a couple of people told you that the timeouts are hardly acceptable and they told you why. Please stop repeating the same arguments you have given already for a couple of times. They're not convincing.
Instead of trying to convince everyone to accept your solution that you're not willing to change, please try to listen and think how to do things differently so that everyone is comfortable with them. I'm sure you're more than capable of doing that.
I do realize that you consider your current solution as the best thing since the sliced bread, but please accept the fact that the other people think differently.
Quoted 5 lines
I just checked my phone, and over a 24 hour awake time (370 hours uptime) period, it acquired about 5 million wakelocks (mostly for input events). If these were cache hits, and took as long as my benchmark did, that accounts for 20 seconds of overhead (0.023% of awake, 0.1% of not-idle (5.5h).
Which proves what exactly?
Rafael
Quoted 33 lines · Rafael J. Wysocki
Quoted 32 lines · Arve Hjønnevåg
Quoted 31 lines · Rafael J. Wysocki
Quoted 29 lines · Pavel Machek
Quoted 16 lines · Rafael J. Wysocki
Quoted 15 lines · Pavel Machek
Hi!
Quoted 12 lines
Quoted 8 lines
Quoted 5 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.It seems to be flexible enough to me.
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend.
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
Quoted 8 lines
Quoted 5 lines
polling is evil -- it keeps CPU wake up => wastes power.
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...Except that you have to check all of the wakelocks periodically in a loop => polling. So?
No. I want to have single
atomic_tfor all the wakelocks... at least in non-debug version. Debug version will be slower. I believe you originally suggested that.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
I did, but please don't call it "wakelocks". It's confusing.
What you are talking about here is mostly an optimization of the wakelock api. You have removed timeout support and made each wakelock reference counted.
I also removed the arbitrary number of wakelocks (I really _hate_ the name, can we please stop using it from now on?).
What do you mean by this? You removed the struct wake_lock?
Quoted 10 lines
Quoted 8 lines
If you ignore wakelocks with timeouts, the current wakelock interface can be implemented with a global
atomic_tto prevent suspend, and a per wakelockatomic_tto prevent a single client from changing the global reference count by more than one.There are a couple of reasons that I have not done this. It removes the ability to easily inspect the system when it is not suspending.
Care to elaborate?
If you have a single atomic_t and it is not 0, you do not know who incremented it.
Quoted 9 lines
Quoted 8 lines
I do provide an option to turn off the wakelock stats, which makes wake_lock/unlock significantly faster, but we never run with wakelock stats off. Also, it pushes timeout handling to the drivers. I know may of you don't like timeout support, but ignoring the problem is not a solution. If each driver that needs timeouts uses its own timer, then you will often wakeup from idle just to unlock a wakelock that will not trigger suspend. This wakeup is a thousand times as costly on the msm platform as a wakelock/unlock pair (with wakelock stats enabled).
Quoted 3 lines
Well, at least a couple of people told you that the timeouts are hardly acceptable and they told you why. Please stop repeating the same arguments you have given already for a couple of times. They're not convincing.
And you keep ignoring them.
Quoted 4 lines
Instead of trying to convince everyone to accept your solution that you're not willing to change, please try to listen and think how to do things differently so that everyone is comfortable with them. I'm sure you're more than capable of doing that.
Can you summarize what the problems with my current api are? I get the impression that you think the overhead of using a list is too high, and that timeout support should be removed because you think all drivers that use it are broken.
Quoted 3 lines
I do realize that you consider your current solution as the best thing since the sliced bread, but please accept the fact that the other people think differently.
I certainly do not think my current solution is the best, it is very invasive. I do however think your proposed solution is worse. The only proposed alternative that we could actually ship a product on today is to not use suspend at all.
Quoted 8 lines
Quoted 6 lines
I just checked my phone, and over a 24 hour awake time (370 hours uptime) period, it acquired about 5 million wakelocks (mostly for input events). If these were cache hits, and took as long as my benchmark did, that accounts for 20 seconds of overhead (0.023% of awake, 0.1% of not-idle (5.5h).
Which proves what exactly?
You seem to be mainly focused on the overhead of the lock/unlock path, so I thought some numbers would be useful.
Signature · 1 line
Arve Hjønnevåg
Quoted 33 lines · Rafael J. Wysocki
Quoted 32 lines · Arve Hjønnevåg
Quoted 31 lines · Rafael J. Wysocki
Quoted 29 lines · Pavel Machek
Quoted 16 lines · Rafael J. Wysocki
Quoted 15 lines · Pavel Machek
Hi!
Quoted 12 lines
Quoted 8 lines
Quoted 5 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.It seems to be flexible enough to me.
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend.
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
Quoted 8 lines
Quoted 5 lines
polling is evil -- it keeps CPU wake up => wastes power.
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...Except that you have to check all of the wakelocks periodically in a loop => polling. So?
No. I want to have single
atomic_tfor all the wakelocks... at least in non-debug version. Debug version will be slower. I believe you originally suggested that.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
I did, but please don't call it "wakelocks". It's confusing.
What you are talking about here is mostly an optimization of the wakelock api. You have removed timeout support and made each wakelock reference counted.
I also removed the arbitrary number of wakelocks (I really _hate_ the name, can we please stop using it from now on?).
What do you mean by this? You removed the struct wake_lock?
Quoted 10 lines
Quoted 8 lines
If you ignore wakelocks with timeouts, the current wakelock interface can be implemented with a global
atomic_tto prevent suspend, and a per wakelockatomic_tto prevent a single client from changing the global reference count by more than one.There are a couple of reasons that I have not done this. It removes the ability to easily inspect the system when it is not suspending.
Care to elaborate?
If you have a single atomic_t and it is not 0, you do not know who incremented it.
Quoted 9 lines
Quoted 8 lines
I do provide an option to turn off the wakelock stats, which makes wake_lock/unlock significantly faster, but we never run with wakelock stats off. Also, it pushes timeout handling to the drivers. I know may of you don't like timeout support, but ignoring the problem is not a solution. If each driver that needs timeouts uses its own timer, then you will often wakeup from idle just to unlock a wakelock that will not trigger suspend. This wakeup is a thousand times as costly on the msm platform as a wakelock/unlock pair (with wakelock stats enabled).
Quoted 3 lines
Well, at least a couple of people told you that the timeouts are hardly acceptable and they told you why. Please stop repeating the same arguments you have given already for a couple of times. They're not convincing.
And you keep ignoring them.
Quoted 4 lines
Instead of trying to convince everyone to accept your solution that you're not willing to change, please try to listen and think how to do things differently so that everyone is comfortable with them. I'm sure you're more than capable of doing that.
Can you summarize what the problems with my current api are? I get the impression that you think the overhead of using a list is too high, and that timeout support should be removed because you think all drivers that use it are broken.
Quoted 3 lines
I do realize that you consider your current solution as the best thing since the sliced bread, but please accept the fact that the other people think differently.
I certainly do not think my current solution is the best, it is very invasive. I do however think your proposed solution is worse. The only proposed alternative that we could actually ship a product on today is to not use suspend at all.
Quoted 8 lines
Quoted 6 lines
I just checked my phone, and over a 24 hour awake time (370 hours uptime) period, it acquired about 5 million wakelocks (mostly for input events). If these were cache hits, and took as long as my benchmark did, that accounts for 20 seconds of overhead (0.023% of awake, 0.1% of not-idle (5.5h).
Which proves what exactly?
You seem to be mainly focused on the overhead of the lock/unlock path, so I thought some numbers would be useful.
Signature · 1 line
Arve Hjønnevåg
Quoted 36 lines · Arve Hjønnevåg
Quoted 35 lines · Rafael J. Wysocki
Quoted 34 lines · Arve Hjønnevåg
Quoted 32 lines · Rafael J. Wysocki
Quoted 23 lines · Pavel Machek
Quoted 22 lines · Rafael J. Wysocki
Quoted 20 lines · Pavel Machek
Hi!
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.Quoted 8 lines
Quoted 4 lines
Quoted 1 line
It seems to be flexible enough to me.
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend.
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
polling is evil -- it keeps CPU wake up => wastes power.
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...Quoted 6 lines
Quoted 2 lines
Except that you have to check all of the wakelocks periodically in a loop => polling. So?
No. I want to have single
atomic_tfor all the wakelocks... at least in non-debug version. Debug version will be slower. I believe you originally suggested that.I did, but please don't call it "wakelocks". It's confusing.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
What you are talking about here is mostly an optimization of the wakelock api. You have removed timeout support and made each wakelock reference counted.
I also removed the arbitrary number of wakelocks (I really _hate_ the name, can we please stop using it from now on?).
What do you mean by this? You removed the struct
wake_lock?
Basically, yes.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
If you ignore wakelocks with timeouts, the current wakelock interface can be implemented with a global
atomic_tto prevent suspend, and a per wakelockatomic_tto prevent a single client from changing the global reference count by more than one.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
There are a couple of reasons that I have not done this. It removes the ability to easily inspect the system when it is not suspending.
Care to elaborate?
If you have a single
atomic_tand it is not 0, you do not know who incremented it.
That's why it was proposed to use per-process and per-driver flags in addition to the refcount.
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
I do provide an option to turn off the wakelock stats, which makes wake_lock/unlock significantly faster, but we never run with wakelock stats off. Also, it pushes timeout handling to the drivers. I know may of you don't like timeout support, but ignoring the problem is not a solution. If each driver that needs timeouts uses its own timer, then you will often wakeup from idle just to unlock a wakelock that will not trigger suspend. This wakeup is a thousand times as costly on the msm platform as a wakelock/unlock pair (with wakelock stats enabled).
Quoted 5 lines
Quoted 3 lines
Well, at least a couple of people told you that the timeouts are hardly acceptable and they told you why. Please stop repeating the same arguments you have given already for a couple of times. They're not convincing.
And you keep ignoring them.
Not ignoring, but considering them as insufficient. And since they've already been considered as insufficient, there's no point repeating them over and over again. That doesn't make them any better.
Quoted 9 lines
Quoted 4 lines
Instead of trying to convince everyone to accept your solution that you're not willing to change, please try to listen and think how to do things differently so that everyone is comfortable with them. I'm sure you're more than capable of doing that.
Can you summarize what the problems with my current api are? I get the impression that you think the overhead of using a list is too high, and that timeout support should be removed because you think all drivers that use it are broken.
In no particular order:
1. One user space process can create an unlimited number of wakelocks. This shouldn't be possible. Moreover, it is not even necessary for any process to have more than one wakelock held at any time.
2. Timeouts are wrong, because they don't really _solve_ any problem. They are useful for working around the fact that you can't or you don't want to modify every piece of code that in principle should take a wakelock and that's it. However, entire concept of having one code path acting on behalf of another one on a hunch that it might be doing something making suspend undesirable is conceptually broken IMO.
3. The overhead of using a list is unnecessary and _therefore_ too high (not just too high).
4. There seems to be a race between user space wakelocks and the freezer (perhaps I overlooked something, in which case please disregard this item).
5. The name "wakelocks" is confusing, because they aren't locks and they affect suspend, not wake.
6. Last time I saw the patches they were barely commented and the changelogs didn't describe the code well (if at all).
7. There's no clear distinction between debug/stats code and the basic functionality.
I'm sure the other people could add something to the list.
Quoted 8 lines
Quoted 3 lines
I do realize that you consider your current solution as the best thing since the sliced bread, but please accept the fact that the other people think differently.
I certainly do not think my current solution is the best, it is very invasive. I do however think your proposed solution is worse. The only proposed alternative that we could actually ship a product on today is to not use suspend at all.
Well, I'm sure your code is useful for the Android platform, but the question is whether we want this code in the mainline kernel. For now, the answer is "no, we don't". Moreover, since you're the one who wants the code to be merged, it's your burden to make it acceptable for us. However you're going to do it is up to you, but certainly trying to force your current code on us is not going to work.
BTW, I think you handled the thing wrong. If I were you, I wouldn't even try to push the code as you did. I would instead make it as simple as reasonably possible so that the basic idea was clear and understandable to everyone. Then, if there were any doubts with respect to the basic idea, I'd try to clarify them and I'd consider modifying the code to address objections. I'd only try to add more features after the basic idea had been accepted.
Thanks,
Rafael
Quoted 36 lines · Arve Hjønnevåg
Quoted 35 lines · Rafael J. Wysocki
Quoted 34 lines · Arve Hjønnevåg
Quoted 32 lines · Rafael J. Wysocki
Quoted 23 lines · Pavel Machek
Quoted 22 lines · Rafael J. Wysocki
Quoted 20 lines · Pavel Machek
Hi!
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Then, the decision making logic will be able to use
/sys/power/sleepwhenever it wishes to and the kernel will be able to refuse to suspend if it's not desirable at the moment.Quoted 8 lines
Quoted 4 lines
Quoted 1 line
It seems to be flexible enough to me.
This seems flexible enough to avoid race conditions, but it forces the user space power manager to poll when the kernel refuse suspend.
And if the kernel is supposed to start automatic suspend, it has to monitor all of the wakelocks. IMO, it's better to allow the power manager to poll the kernel if it refuses to suspend.
polling is evil -- it keeps CPU wake up => wastes power.
Wakelocks done right are single
atomic_t... and if you set it to 0, you just unblock "sleeper" thread or something. Zero polling and very simple...Quoted 6 lines
Quoted 2 lines
Except that you have to check all of the wakelocks periodically in a loop => polling. So?
No. I want to have single
atomic_tfor all the wakelocks... at least in non-debug version. Debug version will be slower. I believe you originally suggested that.I did, but please don't call it "wakelocks". It's confusing.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
What you are talking about here is mostly an optimization of the wakelock api. You have removed timeout support and made each wakelock reference counted.
I also removed the arbitrary number of wakelocks (I really _hate_ the name, can we please stop using it from now on?).
What do you mean by this? You removed the struct
wake_lock?
Basically, yes.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
If you ignore wakelocks with timeouts, the current wakelock interface can be implemented with a global
atomic_tto prevent suspend, and a per wakelockatomic_tto prevent a single client from changing the global reference count by more than one.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
There are a couple of reasons that I have not done this. It removes the ability to easily inspect the system when it is not suspending.
Care to elaborate?
If you have a single
atomic_tand it is not 0, you do not know who incremented it.
That's why it was proposed to use per-process and per-driver flags in addition to the refcount.
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
I do provide an option to turn off the wakelock stats, which makes wake_lock/unlock significantly faster, but we never run with wakelock stats off. Also, it pushes timeout handling to the drivers. I know may of you don't like timeout support, but ignoring the problem is not a solution. If each driver that needs timeouts uses its own timer, then you will often wakeup from idle just to unlock a wakelock that will not trigger suspend. This wakeup is a thousand times as costly on the msm platform as a wakelock/unlock pair (with wakelock stats enabled).
Quoted 5 lines
Quoted 3 lines
Well, at least a couple of people told you that the timeouts are hardly acceptable and they told you why. Please stop repeating the same arguments you have given already for a couple of times. They're not convincing.
And you keep ignoring them.
Not ignoring, but considering them as insufficient. And since they've already been considered as insufficient, there's no point repeating them over and over again. That doesn't make them any better.
Quoted 9 lines
Quoted 4 lines
Instead of trying to convince everyone to accept your solution that you're not willing to change, please try to listen and think how to do things differently so that everyone is comfortable with them. I'm sure you're more than capable of doing that.
Can you summarize what the problems with my current api are? I get the impression that you think the overhead of using a list is too high, and that timeout support should be removed because you think all drivers that use it are broken.
In no particular order:
1. One user space process can create an unlimited number of wakelocks. This shouldn't be possible. Moreover, it is not even necessary for any process to have more than one wakelock held at any time.
2. Timeouts are wrong, because they don't really _solve_ any problem. They are useful for working around the fact that you can't or you don't want to modify every piece of code that in principle should take a wakelock and that's it. However, entire concept of having one code path acting on behalf of another one on a hunch that it might be doing something making suspend undesirable is conceptually broken IMO.
3. The overhead of using a list is unnecessary and _therefore_ too high (not just too high).
4. There seems to be a race between user space wakelocks and the freezer (perhaps I overlooked something, in which case please disregard this item).
5. The name "wakelocks" is confusing, because they aren't locks and they affect suspend, not wake.
6. Last time I saw the patches they were barely commented and the changelogs didn't describe the code well (if at all).
7. There's no clear distinction between debug/stats code and the basic functionality.
I'm sure the other people could add something to the list.
Quoted 8 lines
Quoted 3 lines
I do realize that you consider your current solution as the best thing since the sliced bread, but please accept the fact that the other people think differently.
I certainly do not think my current solution is the best, it is very invasive. I do however think your proposed solution is worse. The only proposed alternative that we could actually ship a product on today is to not use suspend at all.
Well, I'm sure your code is useful for the Android platform, but the question is whether we want this code in the mainline kernel. For now, the answer is "no, we don't". Moreover, since you're the one who wants the code to be merged, it's your burden to make it acceptable for us. However you're going to do it is up to you, but certainly trying to force your current code on us is not going to work.
BTW, I think you handled the thing wrong. If I were you, I wouldn't even try to push the code as you did. I would instead make it as simple as reasonably possible so that the basic idea was clear and understandable to everyone. Then, if there were any doubts with respect to the basic idea, I'd try to clarify them and I'd consider modifying the code to address objections. I'd only try to add more features after the basic idea had been accepted.
Thanks,
Rafael
Quoted 10 lines · Rafael J. Wysocki
Quoted 4 lines · Arve Hjønnevåg
Can you summarize what the problems with my current api are? I get the impression that you think the overhead of using a list is too high, and that timeout support should be removed because you think all drivers that use it are broken.
In no particular order:
1. One user space process can create an unlimited number of wakelocks. This shouldn't be possible. Moreover, it is not even necessary for any process to have more than one wakelock held at any time.
This has been addressed. A user space process cannot create more wakelocks than it has filedescriptors.
Quoted 4 lines
2. Timeouts are wrong, because they don't really _solve_ any problem. They are useful for working around the fact that you can't or you don't want to modify every piece of code that in principle should take a wakelock and that's it.
Yes, timeouts are sometimes wrong, but they are not always wrong. I gave two examples where the use of timeouts was not incorrect.
Quoted 3 lines
However, entire concept of having one code path acting on behalf of another one on a hunch that it might be doing something making suspend undesirable is conceptually broken IMO.
OK. Do you have an alternative?
I my opinion this is how the entire system works if you do autosuspend without a mechanism like wakelocks.
Quoted 2 lines
3. The overhead of using a list is unnecessary and _therefore_ too high (not just too high).
It is only unnecessary if you do not want accounting or timeouts. The overhead of a timer going off when it is not needed (if you push timeouts to the drivers) is way higher then the overhead putting wakelocks on a list.
Quoted 2 lines
4. There seems to be a race between user space wakelocks and the freezer (perhaps I overlooked something, in which case please disregard this item).
You are missing something. Wakelocks overlap.
Quoted 2 lines
5. The name "wakelocks" is confusing, because they aren't locks and they affect suspend, not wake.
I can change the name. Currently suspend_blocker seems to be acceptable many people, but some don't like this name either.
Quoted 2 lines
6. Last time I saw the patches they were barely commented and the changelogs didn't describe the code well (if at all).
I have not added many inline comments, but I did add the kerneldoc comments you requested, and a lot of documentation since the first patches.
Quoted 2 lines
7. There's no clear distinction between debug/stats code and the basic functionality.
I don't think this is still true.
Signature · 1 line
Arve Hjønnevåg
Quoted 10 lines · Rafael J. Wysocki
Quoted 4 lines · Arve Hjønnevåg
Can you summarize what the problems with my current api are? I get the impression that you think the overhead of using a list is too high, and that timeout support should be removed because you think all drivers that use it are broken.
In no particular order:
1. One user space process can create an unlimited number of wakelocks. This shouldn't be possible. Moreover, it is not even necessary for any process to have more than one wakelock held at any time.
This has been addressed. A user space process cannot create more wakelocks than it has filedescriptors.
Quoted 4 lines
2. Timeouts are wrong, because they don't really _solve_ any problem. They are useful for working around the fact that you can't or you don't want to modify every piece of code that in principle should take a wakelock and that's it.
Yes, timeouts are sometimes wrong, but they are not always wrong. I gave two examples where the use of timeouts was not incorrect.
Quoted 3 lines
However, entire concept of having one code path acting on behalf of another one on a hunch that it might be doing something making suspend undesirable is conceptually broken IMO.
OK. Do you have an alternative?
I my opinion this is how the entire system works if you do autosuspend without a mechanism like wakelocks.
Quoted 2 lines
3. The overhead of using a list is unnecessary and _therefore_ too high (not just too high).
It is only unnecessary if you do not want accounting or timeouts. The overhead of a timer going off when it is not needed (if you push timeouts to the drivers) is way higher then the overhead putting wakelocks on a list.
Quoted 2 lines
4. There seems to be a race between user space wakelocks and the freezer (perhaps I overlooked something, in which case please disregard this item).
You are missing something. Wakelocks overlap.
Quoted 2 lines
5. The name "wakelocks" is confusing, because they aren't locks and they affect suspend, not wake.
I can change the name. Currently suspend_blocker seems to be acceptable many people, but some don't like this name either.
Quoted 2 lines
6. Last time I saw the patches they were barely commented and the changelogs didn't describe the code well (if at all).
I have not added many inline comments, but I did add the kerneldoc comments you requested, and a lot of documentation since the first patches.
Quoted 2 lines
7. There's no clear distinction between debug/stats code and the basic functionality.
I don't think this is still true.
Signature · 1 line
Arve Hjønnevåg
Quoted 15 lines · Arve Hjønnevåg
Quoted 10 lines · Rafael J. Wysocki
Quoted 4 lines · Arve Hjønnevåg
Can you summarize what the problems with my current api are? I get the impression that you think the overhead of using a list is too high, and that timeout support should be removed because you think all drivers that use it are broken.
In no particular order:
1. One user space process can create an unlimited number of wakelocks. This shouldn't be possible. Moreover, it is not even necessary for any process to have more than one wakelock held at any time.This has been addressed. A user space process cannot create more wakelocks than it has filedescriptors.
Quoted 7 lines
Quoted 4 lines
2. Timeouts are wrong, because they don't really _solve_ any problem. They are useful for working around the fact that you can't or you don't want to modify every piece of code that in principle should take a wakelock and that's it.
Yes, timeouts are sometimes wrong, but they are not always wrong. I gave two examples where the use of timeouts was not incorrect.
There still is a problem that the same operation can take time X on one platform and time Y on another, so how are you going to determine the timeouts that will be suitable for all platforms?
Quoted 5 lines
Quoted 3 lines
However, entire concept of having one code path acting on
behalf of another one on a hunch that it might be doing something making suspend undesirable is conceptually broken IMO.OK. Do you have an alternative?
Well, IMO every code path doing something that makes automatic suspend undesirable should use a suspend blocker of some sort. I'm afraid any other approach will be unreliable and racy.
Quoted 2 lines
I my opinion this is how the entire system works if you do autosuspend without a mechanism like wakelocks.
It surely hasn't been designed with automatic suspend in mind.
Thanks,
Rafael
Quoted 15 lines · Arve Hjønnevåg
Quoted 10 lines · Rafael J. Wysocki
Quoted 4 lines · Arve Hjønnevåg
Can you summarize what the problems with my current api are? I get the impression that you think the overhead of using a list is too high, and that timeout support should be removed because you think all drivers that use it are broken.
In no particular order:
1. One user space process can create an unlimited number of wakelocks. This shouldn't be possible. Moreover, it is not even necessary for any process to have more than one wakelock held at any time.This has been addressed. A user space process cannot create more wakelocks than it has filedescriptors.
Quoted 7 lines
Quoted 4 lines
2. Timeouts are wrong, because they don't really _solve_ any problem. They are useful for working around the fact that you can't or you don't want to modify every piece of code that in principle should take a wakelock and that's it.
Yes, timeouts are sometimes wrong, but they are not always wrong. I gave two examples where the use of timeouts was not incorrect.
There still is a problem that the same operation can take time X on one platform and time Y on another, so how are you going to determine the timeouts that will be suitable for all platforms?
Quoted 5 lines
Quoted 3 lines
However, entire concept of having one code path acting on
behalf of another one on a hunch that it might be doing something making suspend undesirable is conceptually broken IMO.OK. Do you have an alternative?
Well, IMO every code path doing something that makes automatic suspend undesirable should use a suspend blocker of some sort. I'm afraid any other approach will be unreliable and racy.
Quoted 2 lines
I my opinion this is how the entire system works if you do autosuspend without a mechanism like wakelocks.
It surely hasn't been designed with automatic suspend in mind.
Thanks,
Rafael
Quoted 21 lines · Rafael J. Wysocki
Quoted 20 lines · Arve Hjønnevåg
Quoted 10 lines · Rafael J. Wysocki
Quoted 4 lines · Arve Hjønnevåg
Can you summarize what the problems with my current api are? I get the impression that you think the overhead of using a list is too high, and that timeout support should be removed because you think all drivers that use it are broken.
In no particular order:
1. One user space process can create an unlimited number of wakelocks. This shouldn't be possible. Moreover, it is not even necessary for any process to have more than one wakelock held at any time.This has been addressed. A user space process cannot create more wakelocks than it has filedescriptors.
Quoted 4 lines
2. Timeouts are wrong, because they don't really _solve_ any problem. They are useful for working around the fact that you can't or you don't want to modify every piece of code that in principle should take a wakelock and that's it.
Quoted 6 lines
Quoted 2 lines
Yes, timeouts are sometimes wrong, but they are not always wrong. I gave two examples where the use of timeouts was not incorrect.
There still is a problem that the same operation can take time X on one platform and time Y on another, so how are you going to determine the timeouts that will be suitable for all platforms?
This only applies to the timeouts that fall into the wrong category. The timeout used when a driver returns -EBUSY is arbitrary, but any value is technically correct. The one second timeout in the alarm driver is not platform specific. It is one second because the resolution of the rtc api is only one second.
For the timeouts that do fall into the wrong category (use a timeout when passing data to a unmodified subsystem), the drivers are mostly (if not all) platform specific.
Quoted 10 lines
Quoted 6 lines
Quoted 4 lines
However, entire concept of having one code path acting on behalf of another one on a hunch that it might be doing something making suspend undesirable is conceptually broken IMO.
OK. Do you have an alternative?
Well, IMO every code path doing something that makes automatic suspend undesirable should use a suspend blocker of some sort. I'm afraid any other approach will be unreliable and racy.
I agree with this, but I cannot change every code path at once. I also don't know if every code path can be easily fixed. Using a timeout in this case is a compromise. It is not as good as protecting every code path, but it is much better than doing nothing. The race condition you have when preventing suspend with a timeout is the same as every code using a timeout. If the system is busy it can fail. The race condition that you have with no protection happens with any load. If the system decides to go to sleep at the same time as a wakeup event occur, the system will sleep.
Signature · 1 line
Arve Hjønnevåg
Quoted 21 lines · Rafael J. Wysocki
Quoted 20 lines · Arve Hjønnevåg
Quoted 10 lines · Rafael J. Wysocki
Quoted 4 lines · Arve Hjønnevåg
Can you summarize what the problems with my current api are? I get the impression that you think the overhead of using a list is too high, and that timeout support should be removed because you think all drivers that use it are broken.
In no particular order:
1. One user space process can create an unlimited number of wakelocks. This shouldn't be possible. Moreover, it is not even necessary for any process to have more than one wakelock held at any time.This has been addressed. A user space process cannot create more wakelocks than it has filedescriptors.
Quoted 4 lines
2. Timeouts are wrong, because they don't really _solve_ any problem. They are useful for working around the fact that you can't or you don't want to modify every piece of code that in principle should take a wakelock and that's it.
Quoted 6 lines
Quoted 2 lines
Yes, timeouts are sometimes wrong, but they are not always wrong. I gave two examples where the use of timeouts was not incorrect.
There still is a problem that the same operation can take time X on one platform and time Y on another, so how are you going to determine the timeouts that will be suitable for all platforms?
This only applies to the timeouts that fall into the wrong category. The timeout used when a driver returns -EBUSY is arbitrary, but any value is technically correct. The one second timeout in the alarm driver is not platform specific. It is one second because the resolution of the rtc api is only one second.
For the timeouts that do fall into the wrong category (use a timeout when passing data to a unmodified subsystem), the drivers are mostly (if not all) platform specific.
Quoted 10 lines
Quoted 6 lines
Quoted 4 lines
However, entire concept of having one code path acting on behalf of another one on a hunch that it might be doing something making suspend undesirable is conceptually broken IMO.
OK. Do you have an alternative?
Well, IMO every code path doing something that makes automatic suspend undesirable should use a suspend blocker of some sort. I'm afraid any other approach will be unreliable and racy.
I agree with this, but I cannot change every code path at once. I also don't know if every code path can be easily fixed. Using a timeout in this case is a compromise. It is not as good as protecting every code path, but it is much better than doing nothing. The race condition you have when preventing suspend with a timeout is the same as every code using a timeout. If the system is busy it can fail. The race condition that you have with no protection happens with any load. If the system decides to go to sleep at the same time as a wakeup event occur, the system will sleep.
Signature · 1 line
Arve Hjønnevåg
Quoted 35 lines · Arve Hjønnevåg
Quoted 21 lines · Rafael J. Wysocki
Quoted 20 lines · Arve Hjønnevåg
Quoted 10 lines · Rafael J. Wysocki
Quoted 4 lines · Arve Hjønnevåg
Can you summarize what the problems with my current api are? I get the impression that you think the overhead of using a list is too high, and that timeout support should be removed because you think all drivers that use it are broken.
In no particular order:
1. One user space process can create an unlimited number of wakelocks. This shouldn't be possible. Moreover, it is not even necessary for any process to have more than one wakelock held at any time.This has been addressed. A user space process cannot create more wakelocks than it has filedescriptors.
Quoted 4 lines
2. Timeouts are wrong, because they don't really _solve_ any problem. They are useful for working around the fact that you can't or you don't want to modify every piece of code that in principle should take a wakelock and that's it.
Quoted 6 lines
Quoted 2 lines
Yes, timeouts are sometimes wrong, but they are not always wrong. I gave two examples where the use of timeouts was not incorrect.
There still is a problem that the same operation can take time X on one platform and time Y on another, so how are you going to determine the timeouts that will be suitable for all platforms?
This only applies to the timeouts that fall into the wrong category. The timeout used when a driver returns
-EBUSYis arbitrary, but any value is technically correct. The one second timeout in the alarm driver is not platform specific. It is one second because the resolution of the rtc api is only one second.
Quoted 3 lines
For the timeouts that do fall into the wrong category (use a timeout when passing data to a unmodified subsystem), the drivers are mostly (if not all) platform specific.
What drivers are they?
Quoted 11 lines
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
However, entire concept of having one code path acting on
behalf of another one on a hunch that it might be doing something making suspend undesirable is conceptually broken IMO.OK. Do you have an alternative?
Well, IMO every code path doing something that makes automatic suspend undesirable should use a suspend blocker of some sort. I'm afraid any other approach will be unreliable and racy.
I agree with this,
Good.
Quoted 1 line
but I cannot change every code path at once.
That need not happen at once (eg. in one patch or something). Once we've introduced the basics, the changes can be made gradually wherever necessary, step by step.
Quoted 8 lines
I also don't know if every code path can be easily fixed. Using a timeout in this case is a compromise. It is not as good as protecting every code path, but it is much better than doing nothing. The race condition you have when preventing suspend with a timeout is the same as every code using a timeout. If the system is busy it can fail. The race condition that you have with no protection happens with any load. If the system decides to go to sleep at the same time as a wakeup event occur, the system will sleep.
Well, if you have strictly limited time (eg. you want to ship a product at specific date), you have to go for compromises like this, but we're not in a hurry (or are we for some unspecified reason?). There's no deadline etc., so we can afford to do it right from the start (which BTW is likely to save us time in future).
So, I'd suggest to just separate the timeouted suspend blockers from the basic code and introduce the latter first.
IOW, let's first try to merge things that everybody is comfortable with and postpone the merging of the rest. I don't think we're going to lose anything by doing it this way.
Thanks,
Rafael
Quoted 35 lines · Arve Hjønnevåg
Quoted 21 lines · Rafael J. Wysocki
Quoted 20 lines · Arve Hjønnevåg
Quoted 10 lines · Rafael J. Wysocki
Quoted 4 lines · Arve Hjønnevåg
Can you summarize what the problems with my current api are? I get the impression that you think the overhead of using a list is too high, and that timeout support should be removed because you think all drivers that use it are broken.
In no particular order:
1. One user space process can create an unlimited number of wakelocks. This shouldn't be possible. Moreover, it is not even necessary for any process to have more than one wakelock held at any time.This has been addressed. A user space process cannot create more wakelocks than it has filedescriptors.
Quoted 4 lines
2. Timeouts are wrong, because they don't really _solve_ any problem. They are useful for working around the fact that you can't or you don't want to modify every piece of code that in principle should take a wakelock and that's it.
Quoted 6 lines
Quoted 2 lines
Yes, timeouts are sometimes wrong, but they are not always wrong. I gave two examples where the use of timeouts was not incorrect.
There still is a problem that the same operation can take time X on one platform and time Y on another, so how are you going to determine the timeouts that will be suitable for all platforms?
This only applies to the timeouts that fall into the wrong category. The timeout used when a driver returns
-EBUSYis arbitrary, but any value is technically correct. The one second timeout in the alarm driver is not platform specific. It is one second because the resolution of the rtc api is only one second.
Quoted 3 lines
For the timeouts that do fall into the wrong category (use a timeout when passing data to a unmodified subsystem), the drivers are mostly (if not all) platform specific.
What drivers are they?
Quoted 11 lines
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
However, entire concept of having one code path acting on
behalf of another one on a hunch that it might be doing something making suspend undesirable is conceptually broken IMO.OK. Do you have an alternative?
Well, IMO every code path doing something that makes automatic suspend undesirable should use a suspend blocker of some sort. I'm afraid any other approach will be unreliable and racy.
I agree with this,
Good.
Quoted 1 line
but I cannot change every code path at once.
That need not happen at once (eg. in one patch or something). Once we've introduced the basics, the changes can be made gradually wherever necessary, step by step.
Quoted 8 lines
I also don't know if every code path can be easily fixed. Using a timeout in this case is a compromise. It is not as good as protecting every code path, but it is much better than doing nothing. The race condition you have when preventing suspend with a timeout is the same as every code using a timeout. If the system is busy it can fail. The race condition that you have with no protection happens with any load. If the system decides to go to sleep at the same time as a wakeup event occur, the system will sleep.
Well, if you have strictly limited time (eg. you want to ship a product at specific date), you have to go for compromises like this, but we're not in a hurry (or are we for some unspecified reason?). There's no deadline etc., so we can afford to do it right from the start (which BTW is likely to save us time in future).
So, I'd suggest to just separate the timeouted suspend blockers from the basic code and introduce the latter first.
IOW, let's first try to merge things that everybody is comfortable with and postpone the merging of the rest. I don't think we're going to lose anything by doing it this way.
Thanks,
Rafael
Quoted 36 lines · Rafael J. Wysocki
Quoted 35 lines · Arve Hjønnevåg
Quoted 21 lines · Rafael J. Wysocki
Quoted 20 lines · Arve Hjønnevåg
Quoted 10 lines · Rafael J. Wysocki
Quoted 4 lines · Arve Hjønnevåg
Can you summarize what the problems with my current api are? I get the impression that you think the overhead of using a list is too high, and that timeout support should be removed because you think all drivers that use it are broken.
In no particular order:
1. One user space process can create an unlimited number of wakelocks. This shouldn't be possible. Moreover, it is not even necessary for any process to have more than one wakelock held at any time.This has been addressed. A user space process cannot create more wakelocks than it has filedescriptors.
Quoted 4 lines
2. Timeouts are wrong, because they don't really _solve_ any problem. They are useful for working around the fact that you can't or you don't want to modify every piece of code that in principle should take a wakelock and that's it.
Quoted 6 lines
Quoted 2 lines
Yes, timeouts are sometimes wrong, but they are not always wrong. I gave two examples where the use of timeouts was not incorrect.
There still is a problem that the same operation can take time X on one platform and time Y on another, so how are you going to determine the timeouts that will be suitable for all platforms?
This only applies to the timeouts that fall into the wrong category. The timeout used when a driver returns
-EBUSYis arbitrary, but any value is technically correct. The one second timeout in the alarm driver is not platform specific. It is one second because the resolution of the rtc api is only one second.
Quoted 5 lines
Quoted 3 lines
For the timeouts that do fall into the wrong category (use a timeout when passing data to a unmodified subsystem), the drivers are mostly (if not all) platform specific.
What drivers are they?
Serial driver used for bluetooth, wifi driver and battery driver for usb. The msm smd code also need a wakelock with a timeout before passing data to the tty and network layers, but I did not find this.
Quoted 12 lines
Quoted 11 lines
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
However, entire concept of having one code path acting on behalf of another one on a hunch that it might be doing something making suspend undesirable is conceptually broken IMO.
OK. Do you have an alternative?
Well, IMO every code path doing something that makes automatic suspend undesirable should use a suspend blocker of some sort. I'm afraid any other approach will be unreliable and racy.
I agree with this,
Quoted 7 lines
Good.
Quoted 1 line
but I cannot change every code path at once.
That need not happen at once (eg. in one patch or something). Once we've introduced the basics, the changes can be made gradually wherever necessary, step by step.
If you are OK with merging an unfinished system then this may work.
Quoted 9 lines
Quoted 8 lines
I also don't know if every code path can be easily fixed. Using a timeout in this case is a compromise. It is not as good as protecting every code path, but it is much better than doing nothing. The race condition you have when preventing suspend with a timeout is the same as every code using a timeout. If the system is busy it can fail. The race condition that you have with no protection happens with any load. If the system decides to go to sleep at the same time as a wakeup event occur, the system will sleep.
Quoted 8 lines
Well, if you have strictly limited time (eg. you want to ship a product at specific date), you have to go for compromises like this, but we're not in a hurry (or are we for some unspecified reason?). There's no deadline etc., so we can afford to do it right from the start (which BTW is likely to save us time in future).
So, I'd suggest to just separate the timeouted suspend blockers from the basic code and introduce the latter first.
How do you want to handle drivers that return -EBUSY from suspend. The basic code uses a wakelock with a timeout to handle this now. Without this we can either try suspend again immediately, or activate a suspend blocker and use a timer to release it.
Quoted 3 lines
IOW, let's first try to merge things that everybody is comfortable with and postpone the merging of the rest. I don't think we're going to lose anything by doing it this way.
I think we do loose some flexibility by leaving out timeout support, but I'll try to separate it from the first patch.
Signature · 1 line
Arve Hjønnevåg
Quoted 36 lines · Rafael J. Wysocki
Quoted 35 lines · Arve Hjønnevåg
Quoted 21 lines · Rafael J. Wysocki
Quoted 20 lines · Arve Hjønnevåg
Quoted 10 lines · Rafael J. Wysocki
Quoted 4 lines · Arve Hjønnevåg
Can you summarize what the problems with my current api are? I get the impression that you think the overhead of using a list is too high, and that timeout support should be removed because you think all drivers that use it are broken.
In no particular order:
1. One user space process can create an unlimited number of wakelocks. This shouldn't be possible. Moreover, it is not even necessary for any process to have more than one wakelock held at any time.This has been addressed. A user space process cannot create more wakelocks than it has filedescriptors.
Quoted 4 lines
2. Timeouts are wrong, because they don't really _solve_ any problem. They are useful for working around the fact that you can't or you don't want to modify every piece of code that in principle should take a wakelock and that's it.
Quoted 6 lines
Quoted 2 lines
Yes, timeouts are sometimes wrong, but they are not always wrong. I gave two examples where the use of timeouts was not incorrect.
There still is a problem that the same operation can take time X on one platform and time Y on another, so how are you going to determine the timeouts that will be suitable for all platforms?
This only applies to the timeouts that fall into the wrong category. The timeout used when a driver returns
-EBUSYis arbitrary, but any value is technically correct. The one second timeout in the alarm driver is not platform specific. It is one second because the resolution of the rtc api is only one second.
Quoted 5 lines
Quoted 3 lines
For the timeouts that do fall into the wrong category (use a timeout when passing data to a unmodified subsystem), the drivers are mostly (if not all) platform specific.
What drivers are they?
Serial driver used for bluetooth, wifi driver and battery driver for usb. The msm smd code also need a wakelock with a timeout before passing data to the tty and network layers, but I did not find this.
Quoted 12 lines
Quoted 11 lines
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
However, entire concept of having one code path acting on behalf of another one on a hunch that it might be doing something making suspend undesirable is conceptually broken IMO.
OK. Do you have an alternative?
Well, IMO every code path doing something that makes automatic suspend undesirable should use a suspend blocker of some sort. I'm afraid any other approach will be unreliable and racy.
I agree with this,
Quoted 7 lines
Good.
Quoted 1 line
but I cannot change every code path at once.
That need not happen at once (eg. in one patch or something). Once we've introduced the basics, the changes can be made gradually wherever necessary, step by step.
If you are OK with merging an unfinished system then this may work.
Quoted 9 lines
Quoted 8 lines
I also don't know if every code path can be easily fixed. Using a timeout in this case is a compromise. It is not as good as protecting every code path, but it is much better than doing nothing. The race condition you have when preventing suspend with a timeout is the same as every code using a timeout. If the system is busy it can fail. The race condition that you have with no protection happens with any load. If the system decides to go to sleep at the same time as a wakeup event occur, the system will sleep.
Quoted 8 lines
Well, if you have strictly limited time (eg. you want to ship a product at specific date), you have to go for compromises like this, but we're not in a hurry (or are we for some unspecified reason?). There's no deadline etc., so we can afford to do it right from the start (which BTW is likely to save us time in future).
So, I'd suggest to just separate the timeouted suspend blockers from the basic code and introduce the latter first.
How do you want to handle drivers that return -EBUSY from suspend. The basic code uses a wakelock with a timeout to handle this now. Without this we can either try suspend again immediately, or activate a suspend blocker and use a timer to release it.
Quoted 3 lines
IOW, let's first try to merge things that everybody is comfortable with and postpone the merging of the rest. I don't think we're going to lose anything by doing it this way.
I think we do loose some flexibility by leaving out timeout support, but I'll try to separate it from the first patch.
Signature · 1 line
Arve Hjønnevåg
Hi!
Quoted 5 lines
Quoted 3 lines
That need not happen at once (eg. in one patch or something). Once we've introduced the basics, the changes can be made gradually wherever necessary, step by step.
If you are OK with merging an unfinished system then this may work.
Good.
Quoted 7 lines
Quoted 2 lines
So, I'd suggest to just separate the timeouted suspend blockers from the basic code and introduce the latter first.
How do you want to handle drivers that return
-EBUSYfrom suspend. The basic code uses a wakelock with a timeout to handle this now. Without this we can either try suspend again immediately, or activate a suspend blocker and use a timer to release it.
Just printk() and complain. That should be good enough solution for now... (Those drivers are arguably buggy already. If user told machine to go to sleep, it should not randomly refuse to do that.)
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi!
Quoted 5 lines
Quoted 3 lines
That need not happen at once (eg. in one patch or something). Once we've introduced the basics, the changes can be made gradually wherever necessary, step by step.
If you are OK with merging an unfinished system then this may work.
Good.
Quoted 7 lines
Quoted 2 lines
So, I'd suggest to just separate the timeouted suspend blockers from the basic code and introduce the latter first.
How do you want to handle drivers that return
-EBUSYfrom suspend. The basic code uses a wakelock with a timeout to handle this now. Without this we can either try suspend again immediately, or activate a suspend blocker and use a timer to release it.
Just printk() and complain. That should be good enough solution for now... (Those drivers are arguably buggy already. If user told machine to go to sleep, it should not randomly refuse to do that.)
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 10 lines · Rafael J. Wysocki
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
What you are talking about here is mostly an optimization of the wakelock api. You have removed timeout support and made each wakelock reference counted.
I also removed the arbitrary number of wakelocks (I really _hate_ the name, can we please stop using it from now on?).
What do you mean by this? You removed the struct
wake_lock?Basically, yes.
Why is this better? If you move the stats into devices and tasks, this may take up more space than adding an object to the structures or tasks that you are protecting.
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 8 lines
I do provide an option to turn off the wakelock stats, which makes wake_lock/unlock significantly faster, but we never run with wakelock stats off. Also, it pushes timeout handling to the drivers. I know may of you don't like timeout support, but ignoring the problem is not a solution. If each driver that needs timeouts uses its own timer, then you will often wakeup from idle just to unlock a wakelock that will not trigger suspend. This wakeup is a thousand times as costly on the msm platform as a wakelock/unlock pair (with wakelock stats enabled).
Well, at least a couple of people told you that the timeouts are hardly acceptable and they told you why. Please stop repeating the same arguments you have given already for a couple of times. They're not convincing.
Quoted 5 lines
Quoted 1 line
And you keep ignoring them.
Not ignoring, but considering them as insufficient. And since they've already been considered as insufficient, there's no point repeating them over and over again. That doesn't make them any better.
The problem is that what you consider insufficient is what allows us to ship a product.
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
I do realize that you consider your current solution as the best thing since the sliced bread, but please accept the fact that the other people think differently.
I certainly do not think my current solution is the best, it is very invasive. I do however think your proposed solution is worse. The only proposed alternative that we could actually ship a product on today is to not use suspend at all.
Quoted 6 lines
Well, I'm sure your code is useful for the Android platform, but the question is whether we want this code in the mainline kernel. For now, the answer is "no, we don't". Moreover, since you're the one who wants the code to be merged, it's your burden to make it acceptable for us. However you're going to do it is up to you, but certainly trying to force your current code on us is not going to work.
I don't think I am the only one who want this code in the mainline kernel. Many people want to use the android platform, and support in the mainline kernel would be beneficial to some of them. I made many requested changes to my code that provides no benefit to us, but I have not made any changes that breaks our own use.
Quoted 6 lines
BTW, I think you handled the thing wrong. If I were you, I wouldn't even try to push the code as you did. I would instead make it as simple as reasonably possible so that the basic idea was clear and understandable to everyone. Then, if there were any doubts with respect to the basic idea, I'd try to clarify them and I'd consider modifying the code to address objections. I'd only try to add more features after the basic idea had been accepted.
The basic concept was developed long before android was a public project.
Signature · 1 line
Arve Hjønnevåg
Quoted 10 lines · Rafael J. Wysocki
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
What you are talking about here is mostly an optimization of the wakelock api. You have removed timeout support and made each wakelock reference counted.
I also removed the arbitrary number of wakelocks (I really _hate_ the name, can we please stop using it from now on?).
What do you mean by this? You removed the struct
wake_lock?Basically, yes.
Why is this better? If you move the stats into devices and tasks, this may take up more space than adding an object to the structures or tasks that you are protecting.
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 8 lines
I do provide an option to turn off the wakelock stats, which makes wake_lock/unlock significantly faster, but we never run with wakelock stats off. Also, it pushes timeout handling to the drivers. I know may of you don't like timeout support, but ignoring the problem is not a solution. If each driver that needs timeouts uses its own timer, then you will often wakeup from idle just to unlock a wakelock that will not trigger suspend. This wakeup is a thousand times as costly on the msm platform as a wakelock/unlock pair (with wakelock stats enabled).
Well, at least a couple of people told you that the timeouts are hardly acceptable and they told you why. Please stop repeating the same arguments you have given already for a couple of times. They're not convincing.
Quoted 5 lines
Quoted 1 line
And you keep ignoring them.
Not ignoring, but considering them as insufficient. And since they've already been considered as insufficient, there's no point repeating them over and over again. That doesn't make them any better.
The problem is that what you consider insufficient is what allows us to ship a product.
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
I do realize that you consider your current solution as the best thing since the sliced bread, but please accept the fact that the other people think differently.
I certainly do not think my current solution is the best, it is very invasive. I do however think your proposed solution is worse. The only proposed alternative that we could actually ship a product on today is to not use suspend at all.
Quoted 6 lines
Well, I'm sure your code is useful for the Android platform, but the question is whether we want this code in the mainline kernel. For now, the answer is "no, we don't". Moreover, since you're the one who wants the code to be merged, it's your burden to make it acceptable for us. However you're going to do it is up to you, but certainly trying to force your current code on us is not going to work.
I don't think I am the only one who want this code in the mainline kernel. Many people want to use the android platform, and support in the mainline kernel would be beneficial to some of them. I made many requested changes to my code that provides no benefit to us, but I have not made any changes that breaks our own use.
Quoted 6 lines
BTW, I think you handled the thing wrong. If I were you, I wouldn't even try to push the code as you did. I would instead make it as simple as reasonably possible so that the basic idea was clear and understandable to everyone. Then, if there were any doubts with respect to the basic idea, I'd try to clarify them and I'd consider modifying the code to address objections. I'd only try to add more features after the basic idea had been accepted.
The basic concept was developed long before android was a public project.
Signature · 1 line
Arve Hjønnevåg
On Sat, 2009-02-28 at 16:06 -0800, Arve Hjønnevåg wrote:
I'm not taking a position on the merit of the wakelocks per se nor whether Rafael is right or wrong here, I haven't looked at the problem closely enough. I just want to react to this:
Quoted 2 lines
The basic concept was developed long before android was a public project.
This isn't going to bring you any good will. We don't care what was done before it was a public project. That has strictly no relevance to how it should be submitted upstream.
How long the code has been simmering internally to company X or Y or even in a public tree doesn't matter. Some times, yes, we do take something as a whole, when it makes no sense to do otherwise (a driver, a filesystem, ...).
But something like what you propose, it seems, could easily be broken down into a basic concept, on which features are added one after the other, and in this case, it's the right way to go, simply because it's easier to argue for the basic concept alone if you don't have to handle comments froms people who don't agree with aspect A B or C of the other features involved.
And if the basic concept doesn't get accepted in the first place, then the whole point is moot...
Cheers,
Ben.
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 25 lines · Benjamin Herrenschmidt
On Sat, 2009-02-28 at 16:06 -0800, Arve Hjønnevåg wrote:
I'm not taking a position on the merit of the wakelocks per se nor whether Rafael is right or wrong here, I haven't looked at the problem closely enough. I just want to react to this:
Quoted 2 lines
The basic concept was developed long before android was a public project.
This isn't going to bring you any good will. We don't care what was done before it was a public project. That has strictly no relevance to how it should be submitted upstream.
How long the code has been simmering internally to company X or Y or even in a public tree doesn't matter. Some times, yes, we do take something as a whole, when it makes no sense to do otherwise (a driver, a filesystem, ...).
But something like what you propose, it seems, could easily be broken down into a basic concept, on which features are added one after the other, and in this case, it's the right way to go, simply because it's easier to argue for the basic concept alone if you don't have to handle comments froms people who don't agree with aspect A B or C of the other features involved.
Quoted 2 lines
And if the basic concept doesn't get accepted in the first place, then the whole point is moot...
Exactly. This is what I've been trying to say for some time now.
Thanks Ben!
Rafael
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 25 lines · Benjamin Herrenschmidt
On Sat, 2009-02-28 at 16:06 -0800, Arve Hjønnevåg wrote:
I'm not taking a position on the merit of the wakelocks per se nor whether Rafael is right or wrong here, I haven't looked at the problem closely enough. I just want to react to this:
Quoted 2 lines
The basic concept was developed long before android was a public project.
This isn't going to bring you any good will. We don't care what was done before it was a public project. That has strictly no relevance to how it should be submitted upstream.
How long the code has been simmering internally to company X or Y or even in a public tree doesn't matter. Some times, yes, we do take something as a whole, when it makes no sense to do otherwise (a driver, a filesystem, ...).
But something like what you propose, it seems, could easily be broken down into a basic concept, on which features are added one after the other, and in this case, it's the right way to go, simply because it's easier to argue for the basic concept alone if you don't have to handle comments froms people who don't agree with aspect A B or C of the other features involved.
Quoted 2 lines
And if the basic concept doesn't get accepted in the first place, then the whole point is moot...
Exactly. This is what I've been trying to say for some time now.
Thanks Ben!
Rafael
Quoted 8 lines · Arve Hjønnevåg
Quoted 7 lines · Rafael J. Wysocki
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
What you are talking about here is mostly an optimization of the wakelock api. You have removed timeout support and made each wakelock reference counted.
I also removed the arbitrary number of wakelocks (I really _hate_ the name, can we please stop using it from now on?).
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
What do you mean by this? You removed the struct
wake_lock?Basically, yes.
Why is this better? If you move the stats into devices and tasks, this may take up more space than adding an object to the structures or tasks that you are protecting.
OK, this is a valid point as long as we're going to use the stats in the original form (which I'm not sure we want).
Still, as far as the number of "locks" one process can take is limited, it's fine.
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 8 lines
I do provide an option to turn off the wakelock stats, which makes wake_lock/unlock significantly faster, but we never run with wakelock stats off. Also, it pushes timeout handling to the drivers. I know may of you don't like timeout support, but ignoring the problem is not a solution. If each driver that needs timeouts uses its own timer, then you will often wakeup from idle just to unlock a wakelock that will not trigger suspend. This wakeup is a thousand times as costly on the msm platform as a wakelock/unlock pair (with wakelock stats enabled).
Well, at least a couple of people told you that the timeouts are hardly acceptable and they told you why. Please stop repeating the same arguments you have given already for a couple of times. They're not convincing.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
And you keep ignoring them.
Not ignoring, but considering them as insufficient. And since they've already been considered as insufficient, there's no point repeating them over and over again. That doesn't make them any better.
The problem is that what you consider insufficient is what allows us to ship a product.
This doesn't matter a whit, because the mainline kernel is not just your product.
By the same rule you could say that every working vendor driver is worth merging into the mainline kernel, which clearly is not the case.
Quoted 16 lines
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
I do realize that you consider your current solution as the best thing since the sliced bread, but please accept the fact that the other people think differently.
I certainly do not think my current solution is the best, it is very invasive. I do however think your proposed solution is worse. The only proposed alternative that we could actually ship a product on today is to not use suspend at all.
Quoted 6 lines
Well, I'm sure your code is useful for the Android platform, but the question is whether we want this code in the mainline kernel. For now, the answer is "no, we don't". Moreover, since you're the one who wants the code to be merged, it's your burden to make it acceptable for us. However you're going to do it is up to you, but certainly trying to force your current code on us is not going to work.
Quoted 5 lines
I don't think I am the only one who want this code in the mainline kernel. Many people want to use the android platform, and support in the mainline kernel would be beneficial to some of them. I made many requested changes to my code that provides no benefit to us, but I have not made any changes that breaks our own use.
OK, please resubmit the patches, then.
Quoted 8 lines
Quoted 6 lines
BTW, I think you handled the thing wrong. If I were you, I wouldn't even try to push the code as you did. I would instead make it as simple as reasonably possible so that the basic idea was clear and understandable to everyone. Then, if there were any doubts with respect to the basic idea, I'd try to clarify them and I'd consider modifying the code to address objections. I'd only try to add more features after the basic idea had been accepted.
The basic concept was developed long before android was a public project.
Please refer to the Ben's message for a good answer to this.
Thanks,
Rafael
Quoted 8 lines · Arve Hjønnevåg
Quoted 7 lines · Rafael J. Wysocki
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
What you are talking about here is mostly an optimization of the wakelock api. You have removed timeout support and made each wakelock reference counted.
I also removed the arbitrary number of wakelocks (I really _hate_ the name, can we please stop using it from now on?).
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
What do you mean by this? You removed the struct
wake_lock?Basically, yes.
Why is this better? If you move the stats into devices and tasks, this may take up more space than adding an object to the structures or tasks that you are protecting.
OK, this is a valid point as long as we're going to use the stats in the original form (which I'm not sure we want).
Still, as far as the number of "locks" one process can take is limited, it's fine.
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 8 lines
I do provide an option to turn off the wakelock stats, which makes wake_lock/unlock significantly faster, but we never run with wakelock stats off. Also, it pushes timeout handling to the drivers. I know may of you don't like timeout support, but ignoring the problem is not a solution. If each driver that needs timeouts uses its own timer, then you will often wakeup from idle just to unlock a wakelock that will not trigger suspend. This wakeup is a thousand times as costly on the msm platform as a wakelock/unlock pair (with wakelock stats enabled).
Well, at least a couple of people told you that the timeouts are hardly acceptable and they told you why. Please stop repeating the same arguments you have given already for a couple of times. They're not convincing.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
And you keep ignoring them.
Not ignoring, but considering them as insufficient. And since they've already been considered as insufficient, there's no point repeating them over and over again. That doesn't make them any better.
The problem is that what you consider insufficient is what allows us to ship a product.
This doesn't matter a whit, because the mainline kernel is not just your product.
By the same rule you could say that every working vendor driver is worth merging into the mainline kernel, which clearly is not the case.
Quoted 16 lines
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
I do realize that you consider your current solution as the best thing since the sliced bread, but please accept the fact that the other people think differently.
I certainly do not think my current solution is the best, it is very invasive. I do however think your proposed solution is worse. The only proposed alternative that we could actually ship a product on today is to not use suspend at all.
Quoted 6 lines
Well, I'm sure your code is useful for the Android platform, but the question is whether we want this code in the mainline kernel. For now, the answer is "no, we don't". Moreover, since you're the one who wants the code to be merged, it's your burden to make it acceptable for us. However you're going to do it is up to you, but certainly trying to force your current code on us is not going to work.
Quoted 5 lines
I don't think I am the only one who want this code in the mainline kernel. Many people want to use the android platform, and support in the mainline kernel would be beneficial to some of them. I made many requested changes to my code that provides no benefit to us, but I have not made any changes that breaks our own use.
OK, please resubmit the patches, then.
Quoted 8 lines
Quoted 6 lines
BTW, I think you handled the thing wrong. If I were you, I wouldn't even try to push the code as you did. I would instead make it as simple as reasonably possible so that the basic idea was clear and understandable to everyone. Then, if there were any doubts with respect to the basic idea, I'd try to clarify them and I'd consider modifying the code to address objections. I'd only try to add more features after the basic idea had been accepted.
The basic concept was developed long before android was a public project.
Please refer to the Ben's message for a good answer to this.
Thanks,
Rafael
Quoted 19 lines · Rafael J. Wysocki
Quoted 19 lines
Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
I do provide an option to turn off the wakelock stats, which makes wake_lock/unlock significantly faster, but we never run with wakelock stats off. Also, it pushes timeout handling to the drivers. I know may of you don't like timeout support, but ignoring the problem is not a solution. If each driver that needs timeouts uses its own timer, then you will often wakeup from idle just to unlock a wakelock that will not trigger suspend. This wakeup is a thousand times as costly on the msm platform as a wakelock/unlock pair (with wakelock stats enabled).
Quoted 5 lines
Quoted 3 lines
Well, at least a couple of people told you that the timeouts are hardly acceptable and they told you why. Please stop repeating the same arguments you have given already for a couple of times. They're not convincing.
And you keep ignoring them.
Not ignoring, but considering them as insufficient. And since they've already been considered as insufficient, there's no point repeating them over and over again. That doesn't make them any better.
Quoted 5 lines
Quoted 2 lines
The problem is that what you consider insufficient is what allows us to ship a product.
This doesn't matter a whit, because the mainline kernel is not just your product.
Unless you are saying that changes in the mainline kernel does not need be usable in practice, then it does matter. If we remove the feature that allows us to interact with existing code, it will take much longer before it is usable by anyone.
Quoted 2 lines
By the same rule you could say that every working vendor driver is worth merging into the mainline kernel, which clearly is not the case.
Some people seem to think they are.
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 9 lines
Quoted 4 lines
I do realize that you consider your current solution as the best thing since the sliced bread, but please accept the fact that the other people think differently.
I certainly do not think my current solution is the best, it is very invasive. I do however think your proposed solution is worse. The only proposed alternative that we could actually ship a product on today is to not use suspend at all.
Well, I'm sure your code is useful for the Android platform, but the question is whether we want this code in the mainline kernel. For now, the answer is "no, we don't". Moreover, since you're the one who wants the code to be merged, it's your burden to make it acceptable for us. However you're going to do it is up to you, but certainly trying to force your current code on us is not going to work.
Quoted 7 lines
Quoted 5 lines
I don't think I am the only one who want this code in the mainline kernel. Many people want to use the android platform, and support in the mainline kernel would be beneficial to some of them. I made many requested changes to my code that provides no benefit to us, but I have not made any changes that breaks our own use.
OK, please resubmit the patches, then.
I submitted them three weeks ago. I'll submit a new set after I rename the api (presumably to suspend_block(er)) but I would like more agreement on the timeout issue first.
Signature · 1 line
Arve Hjønnevåg
Quoted 19 lines · Rafael J. Wysocki
Quoted 19 lines
Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
I do provide an option to turn off the wakelock stats, which makes wake_lock/unlock significantly faster, but we never run with wakelock stats off. Also, it pushes timeout handling to the drivers. I know may of you don't like timeout support, but ignoring the problem is not a solution. If each driver that needs timeouts uses its own timer, then you will often wakeup from idle just to unlock a wakelock that will not trigger suspend. This wakeup is a thousand times as costly on the msm platform as a wakelock/unlock pair (with wakelock stats enabled).
Quoted 5 lines
Quoted 3 lines
Well, at least a couple of people told you that the timeouts are hardly acceptable and they told you why. Please stop repeating the same arguments you have given already for a couple of times. They're not convincing.
And you keep ignoring them.
Not ignoring, but considering them as insufficient. And since they've already been considered as insufficient, there's no point repeating them over and over again. That doesn't make them any better.
Quoted 5 lines
Quoted 2 lines
The problem is that what you consider insufficient is what allows us to ship a product.
This doesn't matter a whit, because the mainline kernel is not just your product.
Unless you are saying that changes in the mainline kernel does not need be usable in practice, then it does matter. If we remove the feature that allows us to interact with existing code, it will take much longer before it is usable by anyone.
Quoted 2 lines
By the same rule you could say that every working vendor driver is worth merging into the mainline kernel, which clearly is not the case.
Some people seem to think they are.
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 9 lines
Quoted 4 lines
I do realize that you consider your current solution as the best thing since the sliced bread, but please accept the fact that the other people think differently.
I certainly do not think my current solution is the best, it is very invasive. I do however think your proposed solution is worse. The only proposed alternative that we could actually ship a product on today is to not use suspend at all.
Well, I'm sure your code is useful for the Android platform, but the question is whether we want this code in the mainline kernel. For now, the answer is "no, we don't". Moreover, since you're the one who wants the code to be merged, it's your burden to make it acceptable for us. However you're going to do it is up to you, but certainly trying to force your current code on us is not going to work.
Quoted 7 lines
Quoted 5 lines
I don't think I am the only one who want this code in the mainline kernel. Many people want to use the android platform, and support in the mainline kernel would be beneficial to some of them. I made many requested changes to my code that provides no benefit to us, but I have not made any changes that breaks our own use.
OK, please resubmit the patches, then.
I submitted them three weeks ago. I'll submit a new set after I rename the api (presumably to suspend_block(er)) but I would like more agreement on the timeout issue first.
Signature · 1 line
Arve Hjønnevåg
Hi!
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Not ignoring, but considering them as insufficient. And since they've already been considered as insufficient, there's no point repeating them over and over again. That doesn't make them any better.
The problem is that what you consider insufficient is what allows us to ship a product.
Quoted 7 lines
Quoted 2 lines
This doesn't matter a whit, because the mainline kernel is not just your product.
Unless you are saying that changes in the mainline kernel does not need be usable in practice, then it does matter. If we remove the feature that allows us to interact with existing code, it will take much longer before it is usable by anyone.
Well, taking longer before "being usable" is good tradeoff if it means "we get cleaner/actually correct system in mainline sooner".
Quoted 11 lines
Quoted 7 lines
Quoted 5 lines
I don't think I am the only one who want this code in the mainline kernel. Many people want to use the android platform, and support in the mainline kernel would be beneficial to some of them. I made many requested changes to my code that provides no benefit to us, but I have not made any changes that breaks our own use.
OK, please resubmit the patches, then.
I submitted them three weeks ago. I'll submit a new set after I rename the api (presumably to
suspend_block(er)) but I would like more agreement on the timeout issue first.
I do believe that everyone (including you :-) agrees that timeouts are ugly hack. So just reorder the series so they come at the end.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 12 lines · Pavel Machek
Hi!
Quoted 10 lines
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Not ignoring, but considering them as insufficient. And since they've already been considered as insufficient, there's no point repeating them over and over again. That doesn't make them any better.
The problem is that what you consider insufficient is what allows us to ship a product.
This doesn't matter a whit, because the mainline kernel is not just your product.
Quoted 7 lines
Quoted 4 lines
Unless you are saying that changes in the mainline kernel does not need be usable in practice, then it does matter. If we remove the feature that allows us to interact with existing code, it will take much longer before it is usable by anyone.
Well, taking longer before "being usable" is good tradeoff if it means "we get cleaner/actually correct system in mainline sooner".
I think this could go either way. If the system is usable, it may get more use from developers that know how to improve a specific subsystem to not use timeouts. Or, it may be considered good enough, and nobody bothers coming up with a correct solution. I think the latter is what you are worried will happen.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
I don't think I am the only one who want this code in the mainline kernel. Many people want to use the android platform, and support in the mainline kernel would be beneficial to some of them. I made many requested changes to my code that provides no benefit to us, but I have not made any changes that breaks our own use.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
OK, please resubmit the patches, then.
I submitted them three weeks ago. I'll submit a new set after I rename the api (presumably to
suspend_block(er)) but I would like more agreement on the timeout issue first.I do believe that everyone (including you :-) agrees that timeouts are ugly hack. So just reorder the series so they come at the end.
No, I think many uses of timeouts are a ugly hack, not all, but OK I will try to move timeout support to a separate patch.
Signature · 1 line
Arve Hjønnevåg
Quoted 18 lines · Arve Hj?nnev?g
Quoted 17 lines · Pavel Machek
Hi!
Quoted 14 lines
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Not ignoring, but considering them as insufficient. And since they've already been considered as insufficient, there's no point repeating them over and over again. That doesn't make them any better.
The problem is that what you consider insufficient is what allows us to ship a product.
This doesn't matter a whit, because the mainline kernel is not just your product.
Unless you are saying that changes in the mainline kernel does not need be usable in practice, then it does matter. If we remove the feature that allows us to interact with existing code, it will take much longer before it is usable by anyone.
Quoted 8 lines
Quoted 2 lines
Well, taking longer before "being usable" is good tradeoff if it means "we get cleaner/actually correct system in mainline sooner".
I think this could go either way. If the system is usable, it may get more use from developers that know how to improve a specific subsystem to not use timeouts. Or, it may be considered good enough, and nobody bothers coming up with a correct solution. I think the latter is what you are worried will happen.
Yep.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
I submitted them three weeks ago. I'll submit a new set after I rename the api (presumably to
suspend_block(er)) but I would like more agreement on the timeout issue first.I do believe that everyone (including you :-) agrees that timeouts are ugly hack. So just reorder the series so they come at the end.
No, I think many uses of timeouts are a ugly hack, not all, but OK I will try to move timeout support to a separate patch.
Thanks.
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 18 lines · Arve Hj?nnev?g
Quoted 17 lines · Pavel Machek
Hi!
Quoted 14 lines
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Not ignoring, but considering them as insufficient. And since they've already been considered as insufficient, there's no point repeating them over and over again. That doesn't make them any better.
The problem is that what you consider insufficient is what allows us to ship a product.
This doesn't matter a whit, because the mainline kernel is not just your product.
Unless you are saying that changes in the mainline kernel does not need be usable in practice, then it does matter. If we remove the feature that allows us to interact with existing code, it will take much longer before it is usable by anyone.
Quoted 8 lines
Quoted 2 lines
Well, taking longer before "being usable" is good tradeoff if it means "we get cleaner/actually correct system in mainline sooner".
I think this could go either way. If the system is usable, it may get more use from developers that know how to improve a specific subsystem to not use timeouts. Or, it may be considered good enough, and nobody bothers coming up with a correct solution. I think the latter is what you are worried will happen.
Yep.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
I submitted them three weeks ago. I'll submit a new set after I rename the api (presumably to
suspend_block(er)) but I would like more agreement on the timeout issue first.I do believe that everyone (including you :-) agrees that timeouts are ugly hack. So just reorder the series so they come at the end.
No, I think many uses of timeouts are a ugly hack, not all, but OK I will try to move timeout support to a separate patch.
Thanks.
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi!
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Not ignoring, but considering them as insufficient. And since they've already been considered as insufficient, there's no point repeating them over and over again. That doesn't make them any better.
The problem is that what you consider insufficient is what allows us to ship a product.
Quoted 7 lines
Quoted 2 lines
This doesn't matter a whit, because the mainline kernel is not just your product.
Unless you are saying that changes in the mainline kernel does not need be usable in practice, then it does matter. If we remove the feature that allows us to interact with existing code, it will take much longer before it is usable by anyone.
Well, taking longer before "being usable" is good tradeoff if it means "we get cleaner/actually correct system in mainline sooner".
Quoted 11 lines
Quoted 7 lines
Quoted 5 lines
I don't think I am the only one who want this code in the mainline kernel. Many people want to use the android platform, and support in the mainline kernel would be beneficial to some of them. I made many requested changes to my code that provides no benefit to us, but I have not made any changes that breaks our own use.
OK, please resubmit the patches, then.
I submitted them three weeks ago. I'll submit a new set after I rename the api (presumably to
suspend_block(er)) but I would like more agreement on the timeout issue first.
I do believe that everyone (including you :-) agrees that timeouts are ugly hack. So just reorder the series so they come at the end.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi!
Quoted 16 lines
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
I do realize that you consider your current solution as the best thing since the sliced bread, but please accept the fact that the other people think differently.
I certainly do not think my current solution is the best, it is very invasive. I do however think your proposed solution is worse. The only proposed alternative that we could actually ship a product on today is to not use suspend at all.
Quoted 6 lines
Well, I'm sure your code is useful for the Android platform, but the question is whether we want this code in the mainline kernel. For now, the answer is "no, we don't". Moreover, since you're the one who wants the code to be merged, it's your burden to make it acceptable for us. However you're going to do it is up to you, but certainly trying to force your current code on us is not going to work.
Quoted 5 lines
I don't think I am the only one who want this code in the mainline kernel. Many people want to use the android platform, and support in the mainline kernel would be beneficial to some of them. I made many requested changes to my code that provides no benefit to us, but I have not made any changes that breaks our own use.
No, you are not the only one. OTOH... that can't be used as an argument to get it into kernel "as is".
Yes, I'd like to see it in but yes, I understand and agree with (most) Rafaels's concerns.
Quoted 8 lines
Quoted 6 lines
BTW, I think you handled the thing wrong. If I were you, I wouldn't even try to push the code as you did. I would instead make it as simple as reasonably possible so that the basic idea was clear and understandable to everyone. Then, if there were any doubts with respect to the basic idea, I'd try to clarify them and I'd consider modifying the code to address objections. I'd only try to add more features after the basic idea had been accepted.
The basic concept was developed long before android was a public project.
That's not our fault...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi!
Quoted 16 lines
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
I do realize that you consider your current solution as the best thing since the sliced bread, but please accept the fact that the other people think differently.
I certainly do not think my current solution is the best, it is very invasive. I do however think your proposed solution is worse. The only proposed alternative that we could actually ship a product on today is to not use suspend at all.
Quoted 6 lines
Well, I'm sure your code is useful for the Android platform, but the question is whether we want this code in the mainline kernel. For now, the answer is "no, we don't". Moreover, since you're the one who wants the code to be merged, it's your burden to make it acceptable for us. However you're going to do it is up to you, but certainly trying to force your current code on us is not going to work.
Quoted 5 lines
I don't think I am the only one who want this code in the mainline kernel. Many people want to use the android platform, and support in the mainline kernel would be beneficial to some of them. I made many requested changes to my code that provides no benefit to us, but I have not made any changes that breaks our own use.
No, you are not the only one. OTOH... that can't be used as an argument to get it into kernel "as is".
Yes, I'd like to see it in but yes, I understand and agree with (most) Rafaels's concerns.
Quoted 8 lines
Quoted 6 lines
BTW, I think you handled the thing wrong. If I were you, I wouldn't even try to push the code as you did. I would instead make it as simple as reasonably possible so that the basic idea was clear and understandable to everyone. Then, if there were any doubts with respect to the basic idea, I'd try to clarify them and I'd consider modifying the code to address objections. I'd only try to add more features after the basic idea had been accepted.
The basic concept was developed long before android was a public project.
That's not our fault...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html