Attempted summary of suspend-blockers LKML thread
Subsystems (4)
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Ted Ts'oQuoted 17 lines · Ted Ts'o
Quoted 9 lines · On Fri, Aug 06, 2010 at 08:14:09PM -0700, [email protected] wrote:
that description sounds far more like normal sleep power management that suspending. especially since they want to set timers to wake the system up and the defining characteristic of suspend (according to this thread) is that timers don't fire while suspended.
as I am seeing it, there are two reasons why this don't "just work"
1. sleeping can't currently save as much power as suspending
No, I don't think that's the case at all. The key thing here is that *most* applications don't need to be modified to use suspend locks, because even though they might be in an event loop, when the user user turns off the display, the user generally doesn't want it doing things on their behalf.
Quoted 10 lines
Again, take for example the Mac Book, since Apple has gotten this right for most users' use cases. When you close the lid, you even if the application is under the misguided belief that it should be checking every five seconds to see whether or not the web page has reloaded --- actually, that's not what you want. You probably want the application to be forcibly put to sleep. So the whole point of the suspend blocker design is that you don't have to modify most applications; they just simply get put to sleep when you close the MacBook lid, or, in the case of the Android device, you push the button that turns off the screen.
this doesn't require wakelocks or anything else new. all it takes is setting the policy that you don't want anything to run when the lid is closed and a switch to detect the lid being closed. Laptops have been doing this for years.
Quoted 9 lines
So the reason why this doesn't work is that power management for small mobile devices *is* different from power management for laptops and data center servers, and if you want a rich application ecosystem, it's best if you don't require them to be specially tuned to use the absolute minimum power. (And that means waking up every 30 seconds might be too much; as Brian and Arve have pointed out, with the G1 in airplane mode, the CPU might be waking up once every half hour or more --- and at that rate, powertop will be waking up the CPU more than Android system would be doing so.)
note that nothing that I have proposed would wake up a sleeping system. the 'every several seconds' thing that I proposed was that on a system that's fully awake, busy and doesn't want to sleep, there would be a context switch periodically by a privilaged process so that the system would not end up deciding it was idle and halt everything. Now that I think about this more, it's not needed if you want to override this to keep everything running for a significant amount of time, just change the power saving mode from "sleep if a privilaged task isn't running" to "disable suspend". This can be done today by changing the right sysfs value. normal privilaged processes would never need to do this, only gatekeeper daemons that want to let unprivilaged processes run even if no privilaged processes want to run would need to do this (i.e. in the current system, whatever process controls the screen would probably be right)
Quoted 8 lines
So the real key here is to take most applications, which may be written using techniques that might be considered well written from a laptop point of view, but not for a cell phone, and not require modifications. Even though the application writer might think it's doing well by waking up every 15 seconds, if the laptop lid is down, or if the screen is off, for **most** applications, it should be forcibly put to sleep.
Quoted 9 lines
It's only the rare applications that should really be allowed to run while screen is off. And it's only those applications that need modifications to use suspend blocker. From your earlier comments, it seems that this is the key point which you are missing. (No doubt, some of these applications that do need to know about suspend blockers are important ones; ones that make sure the battery isn't about to blow up, or ones which silently wake up every 10-15 minutes to pull down fresh mail for you from your mail server. But those applications are the exception, not the rule.)
the question is what it takes to make an application privilaged like this.
what I proposed was to make it possible for the user/admin to select what applications are allowed to keep the system awake.
wakelocks require that the application developer decide that they want to keep the system awake as well as the user/admin
take your example of a mail client waking up every 15 min.
with Android it needs to be privilaged to grab the wakelock while fetching the mail, it also needs to use a privilaged API to set the wakeups to wake it up at those times.
with what I proposed all you need to do is to tag the application as power privilaged and then if the application sleeps for 15 min between doing thing the system will wake up every 15 min, work for a short time, then go back to sleep.
if you want to put everything to sleep when the screen blanks, that's trivial to do.
the fun starts when you want to say that there are some things you don't want to put to sleep.
do you let some processes run while halting others?
in which case how do you prevent deadlocks?
on the other hand, sleeping again is simple, you sleep when there
is nothing more to run
or do you let wasteful processes run while you are awake?
this avoids deadlocks, but how do you decide when to sleep again?
Android approaches this by requiring that any program that a user may want to keep running must be modified to use wakelocks.
My suggestion was that the system ignore other processes when deciding if the system is idle enough to put to sleep.
Yes the Android approach works reasonably well on the phones where everything must currently be custom developed anyway (due to screen and UI constraints), but as Android starts getting used on laptops and other larger devices is that really still the right approach? or would it be better to have something that could use standard software in the privilaged mode?
to use your example of a mail client, why should someone not be able to use fetchmail to get their mail instead of requiring that fetchmail be modified to use wavelocks (or a substatute written)?
the theoretical best approach would probably look nothing like either of these. Instead it would probably either
forbid privilaged processes from having blocking dependancies on unprivilaged processes (you can then just halt the unprivilaged processes when you blank the screen and let idle sleep deal with the privilged processes)
or
use something like priority inheritance through userspace so that if a privilaged process blocks on something where it's waiting for an unprivilaged process, that unprivilaged process gets woken up and allowed to run until it unblocks the privilaged process.
both of these have been deemed too hard
David Lang
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Ted Ts'oQuoted 17 lines · Ted Ts'o
Quoted 9 lines · On Fri, Aug 06, 2010 at 08:14:09PM -0700, [email protected] wrote:
that description sounds far more like normal sleep power management that suspending. especially since they want to set timers to wake the system up and the defining characteristic of suspend (according to this thread) is that timers don't fire while suspended.
as I am seeing it, there are two reasons why this don't "just work"
1. sleeping can't currently save as much power as suspending
No, I don't think that's the case at all. The key thing here is that *most* applications don't need to be modified to use suspend locks, because even though they might be in an event loop, when the user user turns off the display, the user generally doesn't want it doing things on their behalf.
Quoted 10 lines
Again, take for example the Mac Book, since Apple has gotten this right for most users' use cases. When you close the lid, you even if the application is under the misguided belief that it should be checking every five seconds to see whether or not the web page has reloaded --- actually, that's not what you want. You probably want the application to be forcibly put to sleep. So the whole point of the suspend blocker design is that you don't have to modify most applications; they just simply get put to sleep when you close the MacBook lid, or, in the case of the Android device, you push the button that turns off the screen.
this doesn't require wakelocks or anything else new. all it takes is setting the policy that you don't want anything to run when the lid is closed and a switch to detect the lid being closed. Laptops have been doing this for years.
Quoted 9 lines
So the reason why this doesn't work is that power management for small mobile devices *is* different from power management for laptops and data center servers, and if you want a rich application ecosystem, it's best if you don't require them to be specially tuned to use the absolute minimum power. (And that means waking up every 30 seconds might be too much; as Brian and Arve have pointed out, with the G1 in airplane mode, the CPU might be waking up once every half hour or more --- and at that rate, powertop will be waking up the CPU more than Android system would be doing so.)
note that nothing that I have proposed would wake up a sleeping system. the 'every several seconds' thing that I proposed was that on a system that's fully awake, busy and doesn't want to sleep, there would be a context switch periodically by a privilaged process so that the system would not end up deciding it was idle and halt everything. Now that I think about this more, it's not needed if you want to override this to keep everything running for a significant amount of time, just change the power saving mode from "sleep if a privilaged task isn't running" to "disable suspend". This can be done today by changing the right sysfs value. normal privilaged processes would never need to do this, only gatekeeper daemons that want to let unprivilaged processes run even if no privilaged processes want to run would need to do this (i.e. in the current system, whatever process controls the screen would probably be right)
Quoted 8 lines
So the real key here is to take most applications, which may be written using techniques that might be considered well written from a laptop point of view, but not for a cell phone, and not require modifications. Even though the application writer might think it's doing well by waking up every 15 seconds, if the laptop lid is down, or if the screen is off, for **most** applications, it should be forcibly put to sleep.
Quoted 9 lines
It's only the rare applications that should really be allowed to run while screen is off. And it's only those applications that need modifications to use suspend blocker. From your earlier comments, it seems that this is the key point which you are missing. (No doubt, some of these applications that do need to know about suspend blockers are important ones; ones that make sure the battery isn't about to blow up, or ones which silently wake up every 10-15 minutes to pull down fresh mail for you from your mail server. But those applications are the exception, not the rule.)
the question is what it takes to make an application privilaged like this.
what I proposed was to make it possible for the user/admin to select what applications are allowed to keep the system awake.
wakelocks require that the application developer decide that they want to keep the system awake as well as the user/admin
take your example of a mail client waking up every 15 min.
with Android it needs to be privilaged to grab the wakelock while fetching the mail, it also needs to use a privilaged API to set the wakeups to wake it up at those times.
with what I proposed all you need to do is to tag the application as power privilaged and then if the application sleeps for 15 min between doing thing the system will wake up every 15 min, work for a short time, then go back to sleep.
if you want to put everything to sleep when the screen blanks, that's trivial to do.
the fun starts when you want to say that there are some things you don't want to put to sleep.
do you let some processes run while halting others?
in which case how do you prevent deadlocks?
on the other hand, sleeping again is simple, you sleep when there
is nothing more to run
or do you let wasteful processes run while you are awake?
this avoids deadlocks, but how do you decide when to sleep again?
Android approaches this by requiring that any program that a user may want to keep running must be modified to use wakelocks.
My suggestion was that the system ignore other processes when deciding if the system is idle enough to put to sleep.
Yes the Android approach works reasonably well on the phones where everything must currently be custom developed anyway (due to screen and UI constraints), but as Android starts getting used on laptops and other larger devices is that really still the right approach? or would it be better to have something that could use standard software in the privilaged mode?
to use your example of a mail client, why should someone not be able to use fetchmail to get their mail instead of requiring that fetchmail be modified to use wavelocks (or a substatute written)?
the theoretical best approach would probably look nothing like either of these. Instead it would probably either
forbid privilaged processes from having blocking dependancies on unprivilaged processes (you can then just halt the unprivilaged processes when you blank the screen and let idle sleep deal with the privilged processes)
or
use something like priority inheritance through userspace so that if a privilaged process blocks on something where it's waiting for an unprivilaged process, that unprivilaged process gets woken up and allowed to run until it unblocks the privilaged process.
both of these have been deemed too hard
David Lang
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 30 lines · On Sat, Aug 07, 2010 at 02:38:35AM -0700, [email protected] wrote:
Quoted 17 lines · Ted Ts'o
Quoted 9 lines · On Fri, Aug 06, 2010 at 08:14:09PM -0700, [email protected] wrote:
that description sounds far more like normal sleep power management that suspending. especially since they want to set timers to wake the system up and the defining characteristic of suspend (according to this thread) is that timers don't fire while suspended.
as I am seeing it, there are two reasons why this don't "just work"
1. sleeping can't currently save as much power as suspending
No, I don't think that's the case at all. The key thing here is that *most* applications don't need to be modified to use suspend locks, because even though they might be in an event loop, when the user user turns off the display, the user generally doesn't want it doing things on their behalf.
Quoted 10 lines
Again, take for example the Mac Book, since Apple has gotten this right for most users' use cases. When you close the lid, you even if the application is under the misguided belief that it should be checking every five seconds to see whether or not the web page has reloaded --- actually, that's not what you want. You probably want the application to be forcibly put to sleep. So the whole point of the suspend blocker design is that you don't have to modify most applications; they just simply get put to sleep when you close the MacBook lid, or, in the case of the Android device, you push the button that turns off the screen.
Quoted 4 lines
this doesn't require wakelocks or anything else new. all it takes is setting the policy that you don't want anything to run when the lid is closed and a switch to detect the lid being closed. Laptops have been doing this for years.
Please re-read Ted's paragraph above, but carefully this time. You will then see that the desired policy is -not- "you don't want anything to run when the lid is closed."
Quoted 44 lines
Quoted 9 lines
So the reason why this doesn't work is that power management for small mobile devices *is* different from power management for laptops and data center servers, and if you want a rich application ecosystem, it's best if you don't require them to be specially tuned to use the absolute minimum power. (And that means waking up every 30 seconds might be too much; as Brian and Arve have pointed out, with the G1 in airplane mode, the CPU might be waking up once every half hour or more --- and at that rate, powertop will be waking up the CPU more than Android system would be doing so.)
note that nothing that I have proposed would wake up a sleeping system. the 'every several seconds' thing that I proposed was that on a system that's fully awake, busy and doesn't want to sleep, there would be a context switch periodically by a privilaged process so that the system would not end up deciding it was idle and halt everything. Now that I think about this more, it's not needed if you want to override this to keep everything running for a significant amount of time, just change the power saving mode from "sleep if a privilaged task isn't running" to "disable suspend". This can be done today by changing the right sysfs value. normal privilaged processes would never need to do this, only gatekeeper daemons that want to let unprivilaged processes run even if no privilaged processes want to run would need to do this (i.e. in the current system, whatever process controls the screen would probably be right)
Quoted 8 lines
So the real key here is to take most applications, which may be written using techniques that might be considered well written from a laptop point of view, but not for a cell phone, and not require modifications. Even though the application writer might think it's doing well by waking up every 15 seconds, if the laptop lid is down, or if the screen is off, for **most** applications, it should be forcibly put to sleep.
Quoted 9 lines
It's only the rare applications that should really be allowed to run while screen is off. And it's only those applications that need modifications to use suspend blocker. From your earlier comments, it seems that this is the key point which you are missing. (No doubt, some of these applications that do need to know about suspend blockers are important ones; ones that make sure the battery isn't about to blow up, or ones which silently wake up every 10-15 minutes to pull down fresh mail for you from your mail server. But those applications are the exception, not the rule.)
Quoted 4 lines
the question is what it takes to make an application privilaged like this.
what I proposed was to make it possible for the user/admin to select what applications are allowed to keep the system awake.
The Android guys do the same.
Quoted 2 lines
wakelocks require that the application developer decide that they want to keep the system awake as well as the user/admin
Whereas you require that the application developer redesign/rewrite applications to decide when to keep the system awake, e.g., by carefully determining when to idle themselves. The difference is that the Android developer need only release a suspend blocker. In contrast, you are requiring that the developer rewrite all the code that follows the point where the Android developer would release a suspend blocker.
Your way seems to require that the developer do more work for the same result. Why?
Now, I do agree that a safe way to freeze the power-oblivious applications could be valuable, as it might reduce power consumption while the screen was blanked but while a PM-driving application was holding a suspend blocker. However, as we have discussed, you have to be very careful not to freeze any app holding a user-level resource.
Quoted 12 lines
take your example of a mail client waking up every 15 min.
with Android it needs to be privilaged to grab the wakelock while fetching the mail, it also needs to use a privilaged API to set the wakeups to wake it up at those times.
with what I proposed all you need to do is to tag the application as power privilaged and then if the application sleeps for 15 min between doing thing the system will wake up every 15 min, work for a short time, then go back to sleep.
Quoted 5 lines
if you want to put everything to sleep when the screen blanks, that's trivial to do.
the fun starts when you want to say that there are some things you don't want to put to sleep.
Which is in fact a critical requirement that you appear to have been ignoring in your words above.
Quoted 8 lines
do you let some processes run while halting others?
in which case how do you prevent deadlocks?
on the other hand, sleeping again is simple, you sleep when
there is nothing more to run
or do you let wasteful processes run while you are awake?
this avoids deadlocks, but how do you decide when to sleep again?
Quoted 5 lines
Android approaches this by requiring that any program that a user may want to keep running must be modified to use wakelocks.
My suggestion was that the system ignore other processes when deciding if the system is idle enough to put to sleep.
But your suggestion seems to require quite a bit more coding effort for little gain. The Android developer can just release a suspend blocker, and in contrast, a developer using your proposal needs to rewrite all the code following the point at which the Android developer released the suspend blocker. So why are you saying that your is approach better? ;-)
Quoted 21 lines
Yes the Android approach works reasonably well on the phones where everything must currently be custom developed anyway (due to screen and UI constraints), but as Android starts getting used on laptops and other larger devices is that really still the right approach? or would it be better to have something that could use standard software in the privilaged mode?
to use your example of a mail client, why should someone not be able to use fetchmail to get their mail instead of requiring that fetchmail be modified to use wavelocks (or a substatute written)?
the theoretical best approach would probably look nothing like either of these. Instead it would probably either
forbid privilaged processes from having blocking dependancies on unprivilaged processes (you can then just halt the unprivilaged processes when you blank the screen and let idle sleep deal with the privilged processes)
Quoted 8 lines
or
use something like priority inheritance through userspace so that if a privilaged process blocks on something where it's waiting for an unprivilaged process, that unprivilaged process gets woken up and allowed to run until it unblocks the privilaged process.
both of these have been deemed too hard
And for good reason.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to [email protected]Quoted 30 lines · On Sat, Aug 07, 2010 at 02:38:35AM -0700, [email protected] wrote:
Quoted 17 lines · Ted Ts'o
Quoted 9 lines · On Fri, Aug 06, 2010 at 08:14:09PM -0700, [email protected] wrote:
that description sounds far more like normal sleep power management that suspending. especially since they want to set timers to wake the system up and the defining characteristic of suspend (according to this thread) is that timers don't fire while suspended.
as I am seeing it, there are two reasons why this don't "just work"
1. sleeping can't currently save as much power as suspending
No, I don't think that's the case at all. The key thing here is that *most* applications don't need to be modified to use suspend locks, because even though they might be in an event loop, when the user user turns off the display, the user generally doesn't want it doing things on their behalf.
Quoted 10 lines
Again, take for example the Mac Book, since Apple has gotten this right for most users' use cases. When you close the lid, you even if the application is under the misguided belief that it should be checking every five seconds to see whether or not the web page has reloaded --- actually, that's not what you want. You probably want the application to be forcibly put to sleep. So the whole point of the suspend blocker design is that you don't have to modify most applications; they just simply get put to sleep when you close the MacBook lid, or, in the case of the Android device, you push the button that turns off the screen.
Quoted 4 lines
this doesn't require wakelocks or anything else new. all it takes is setting the policy that you don't want anything to run when the lid is closed and a switch to detect the lid being closed. Laptops have been doing this for years.
Please re-read Ted's paragraph above, but carefully this time. You will then see that the desired policy is -not- "you don't want anything to run when the lid is closed."
Quoted 44 lines
Quoted 9 lines
So the reason why this doesn't work is that power management for small mobile devices *is* different from power management for laptops and data center servers, and if you want a rich application ecosystem, it's best if you don't require them to be specially tuned to use the absolute minimum power. (And that means waking up every 30 seconds might be too much; as Brian and Arve have pointed out, with the G1 in airplane mode, the CPU might be waking up once every half hour or more --- and at that rate, powertop will be waking up the CPU more than Android system would be doing so.)
note that nothing that I have proposed would wake up a sleeping system. the 'every several seconds' thing that I proposed was that on a system that's fully awake, busy and doesn't want to sleep, there would be a context switch periodically by a privilaged process so that the system would not end up deciding it was idle and halt everything. Now that I think about this more, it's not needed if you want to override this to keep everything running for a significant amount of time, just change the power saving mode from "sleep if a privilaged task isn't running" to "disable suspend". This can be done today by changing the right sysfs value. normal privilaged processes would never need to do this, only gatekeeper daemons that want to let unprivilaged processes run even if no privilaged processes want to run would need to do this (i.e. in the current system, whatever process controls the screen would probably be right)
Quoted 8 lines
So the real key here is to take most applications, which may be written using techniques that might be considered well written from a laptop point of view, but not for a cell phone, and not require modifications. Even though the application writer might think it's doing well by waking up every 15 seconds, if the laptop lid is down, or if the screen is off, for **most** applications, it should be forcibly put to sleep.
Quoted 9 lines
It's only the rare applications that should really be allowed to run while screen is off. And it's only those applications that need modifications to use suspend blocker. From your earlier comments, it seems that this is the key point which you are missing. (No doubt, some of these applications that do need to know about suspend blockers are important ones; ones that make sure the battery isn't about to blow up, or ones which silently wake up every 10-15 minutes to pull down fresh mail for you from your mail server. But those applications are the exception, not the rule.)
Quoted 4 lines
the question is what it takes to make an application privilaged like this.
what I proposed was to make it possible for the user/admin to select what applications are allowed to keep the system awake.
The Android guys do the same.
Quoted 2 lines
wakelocks require that the application developer decide that they want to keep the system awake as well as the user/admin
Whereas you require that the application developer redesign/rewrite applications to decide when to keep the system awake, e.g., by carefully determining when to idle themselves. The difference is that the Android developer need only release a suspend blocker. In contrast, you are requiring that the developer rewrite all the code that follows the point where the Android developer would release a suspend blocker.
Your way seems to require that the developer do more work for the same result. Why?
Now, I do agree that a safe way to freeze the power-oblivious applications could be valuable, as it might reduce power consumption while the screen was blanked but while a PM-driving application was holding a suspend blocker. However, as we have discussed, you have to be very careful not to freeze any app holding a user-level resource.
Quoted 12 lines
take your example of a mail client waking up every 15 min.
with Android it needs to be privilaged to grab the wakelock while fetching the mail, it also needs to use a privilaged API to set the wakeups to wake it up at those times.
with what I proposed all you need to do is to tag the application as power privilaged and then if the application sleeps for 15 min between doing thing the system will wake up every 15 min, work for a short time, then go back to sleep.
Quoted 5 lines
if you want to put everything to sleep when the screen blanks, that's trivial to do.
the fun starts when you want to say that there are some things you don't want to put to sleep.
Which is in fact a critical requirement that you appear to have been ignoring in your words above.
Quoted 8 lines
do you let some processes run while halting others?
in which case how do you prevent deadlocks?
on the other hand, sleeping again is simple, you sleep when
there is nothing more to run
or do you let wasteful processes run while you are awake?
this avoids deadlocks, but how do you decide when to sleep again?
Quoted 5 lines
Android approaches this by requiring that any program that a user may want to keep running must be modified to use wakelocks.
My suggestion was that the system ignore other processes when deciding if the system is idle enough to put to sleep.
But your suggestion seems to require quite a bit more coding effort for little gain. The Android developer can just release a suspend blocker, and in contrast, a developer using your proposal needs to rewrite all the code following the point at which the Android developer released the suspend blocker. So why are you saying that your is approach better? ;-)
Quoted 21 lines
Yes the Android approach works reasonably well on the phones where everything must currently be custom developed anyway (due to screen and UI constraints), but as Android starts getting used on laptops and other larger devices is that really still the right approach? or would it be better to have something that could use standard software in the privilaged mode?
to use your example of a mail client, why should someone not be able to use fetchmail to get their mail instead of requiring that fetchmail be modified to use wavelocks (or a substatute written)?
the theoretical best approach would probably look nothing like either of these. Instead it would probably either
forbid privilaged processes from having blocking dependancies on unprivilaged processes (you can then just halt the unprivilaged processes when you blank the screen and let idle sleep deal with the privilged processes)
Quoted 8 lines
or
use something like priority inheritance through userspace so that if a privilaged process blocks on something where it's waiting for an unprivilaged process, that unprivilaged process gets woken up and allowed to run until it unblocks the privilaged process.
both of these have been deemed too hard
And for good reason.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 40 lines · Paul E. McKenney
Quoted 22 lines · On Sat, Aug 07, 2010 at 02:38:35AM -0700, [email protected] wrote:
Quoted 10 lines · Ted Ts'o
On Fri, Aug 06, 2010 at 08:14:09PM -0700, [email protected] wrote:
So the real key here is to take most applications, which may be written using techniques that might be considered well written from a laptop point of view, but not for a cell phone, and not require modifications. Even though the application writer might think it's doing well by waking up every 15 seconds, if the laptop lid is down, or if the screen is off, for **most** applications, it should be forcibly put to sleep.
Quoted 9 lines
It's only the rare applications that should really be allowed to run while screen is off. And it's only those applications that need modifications to use suspend blocker. From your earlier comments, it seems that this is the key point which you are missing. (No doubt, some of these applications that do need to know about suspend blockers are important ones; ones that make sure the battery isn't about to blow up, or ones which silently wake up every 10-15 minutes to pull down fresh mail for you from your mail server. But those applications are the exception, not the rule.)
Quoted 4 lines
the question is what it takes to make an application privilaged like this.
what I proposed was to make it possible for the user/admin to select what applications are allowed to keep the system awake.
The Android guys do the same.
Quoted 2 lines
wakelocks require that the application developer decide that they want to keep the system awake as well as the user/admin
Whereas you require that the application developer redesign/rewrite applications to decide when to keep the system awake, e.g., by carefully determining when to idle themselves. The difference is that the Android developer need only release a suspend blocker. In contrast, you are requiring that the developer rewrite all the code that follows the point where the Android developer would release a suspend blocker.
Quoted 2 lines
Your way seems to require that the developer do more work for the same result. Why?
portability, and the fact that it will save more power even when the system is prevented from suspending.
Quoted 12 lines
Quoted 12 lines
take your example of a mail client waking up every 15 min.
with Android it needs to be privilaged to grab the wakelock while fetching the mail, it also needs to use a privilaged API to set the wakeups to wake it up at those times.
with what I proposed all you need to do is to tag the application as power privilaged and then if the application sleeps for 15 min between doing thing the system will wake up every 15 min, work for a short time, then go back to sleep.
Quoted 8 lines
Quoted 5 lines
if you want to put everything to sleep when the screen blanks, that's trivial to do.
the fun starts when you want to say that there are some things you don't want to put to sleep.
Which is in fact a critical requirement that you appear to have been ignoring in your words above.
I admit that the way I wrote this is confusing, but I don't think I am ignoring this requirement. the example above was how an application that the system is not wanting to put to sleep would run with the two mechansims.
Quoted 11 lines
Quoted 11 lines
do you let some processes run while halting others?
in which case how do you prevent deadlocks?
on the other hand, sleeping again is simple, you sleep when
there is nothing more to run
or do you let wasteful processes run while you are awake?
this avoids deadlocks, but how do you decide when to sleep again?Android approaches this by requiring that any program that a user may want to keep running must be modified to use wakelocks.
Quoted 8 lines
Quoted 2 lines
My suggestion was that the system ignore other processes when deciding if the system is idle enough to put to sleep.
But your suggestion seems to require quite a bit more coding effort for little gain. The Android developer can just release a suspend blocker, and in contrast, a developer using your proposal needs to rewrite all the code following the point at which the Android developer released the suspend blocker. So why are you saying that your is approach better? ;-)
no, the coder needs to make his code not do unnessasary things. Even with a wakelock this is needed for the system to be able to use lower power modes while the system is not going to do a suspend anyway.
I am say that if the coder does that, the coder should not also have to code in wakelocks.
I want it to be as easy as possible to port applications between mobile platforms. On most platforms wakelocks are not needed because standard idle/sleep/suspend mechanisms are good enough. Android allows other applications to run that confuse the idle/sleep/suspend mechanisms, so something needs to be done to cut through the confusion. Android does this by creating a new API to control this, I'm suggesting that there should be a way to tell the system to ignore the other applications so that the existing mechanisms can make good decisions again.
David Lang
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Ted Ts'oQuoted 8 lines · Ted Ts'o
Quoted 1 line · On Fri, Aug 06, 2010 at 08:14:09PM -0700, [email protected] wrote:
1. sleeping can't currently save as much power as suspending
No, I don't think that's the case at all. The key thing here is that *most* applications don't need to be modified to use suspend locks, because even though they might be in an event loop, when the user user turns off the display, the user generally doesn't want it doing things on their behalf.
You are overgeneralizing; there are many applications that run in the background, and you want to keep them running even when the display is off.
You seen to be concentrating on UI-only applications, for those it's worth noting that Android provides separate mechanisms for power saving. Since Android doesn't have true multi-tasking, the applications must serialize their states so that the next time they are opened they seem to have not been closed. So, the current active UI application can be closed while turning off the display, and re-opened later.
User-space suspend blockers are relevant for background services, and as it has been discussed before; suspend blockers (not activating them) might actually degrade power usage.
Signature · 5 lines
Felipe Contreras _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Ted Ts'oQuoted 8 lines · Ted Ts'o
Quoted 1 line · On Fri, Aug 06, 2010 at 08:14:09PM -0700, [email protected] wrote:
1. sleeping can't currently save as much power as suspending
No, I don't think that's the case at all. The key thing here is that *most* applications don't need to be modified to use suspend locks, because even though they might be in an event loop, when the user user turns off the display, the user generally doesn't want it doing things on their behalf.
You are overgeneralizing; there are many applications that run in the background, and you want to keep them running even when the display is off.
You seen to be concentrating on UI-only applications, for those it's worth noting that Android provides separate mechanisms for power saving. Since Android doesn't have true multi-tasking, the applications must serialize their states so that the next time they are opened they seem to have not been closed. So, the current active UI application can be closed while turning off the display, and re-opened later.
User-space suspend blockers are relevant for background services, and as it has been discussed before; suspend blockers (not activating them) might actually degrade power usage.
Signature · 1 line
Felipe Contreras
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 4 lines · Felipe Contreras
You are overgeneralizing; there are many applications that run in the background, and you want to keep them running even when the display is off.
Really? How many do you really expect will be running at the same time on a mobile platform with a 800-1000 mWh battery? And what percentage of the applications that might be in a Android or Moblin or Maemo app store will have things running in the background? 10%? 20%? 50%? 80%?
Quoted 7 lines
You seen to be concentrating on UI-only applications, for those it's worth noting that Android provides separate mechanisms for power saving. Since Android doesn't have true multi-tasking, the applications must serialize their states so that the next time they are opened they seem to have not been closed. So, the current active UI application can be closed while turning off the display, and re-opened later.
Actually in practice, the process or processes which comprise current active UI application generally won't actually be killed when you turn off the display. It *might* happen, if one of the rare backround applications needs more memory than is available without closing some of the more recently open applications. In practice, the last 2-3 most recently used applications are still loaded in memory so you can switch back and forth between them simply and easily. It is true they have to be ready to be killed at any time in case their memory is needed for the currently active application, but that generally does't happen right away. The design is to keep this transparent to the user so the user does't have to keep track of how many apps currently running on the system.
In any case, the key thing to keep in mind is that when you deal with extreme power savings, very often you end up making compromises that probably make sense for other reasons anyway (such as the small screen size). It's not at all clear that supporting generalized multi-tasking applications makes sense just from a screen real-estate issue and user experience POV, never mind battery lifetime.
Quoted 3 lines
User-space suspend blockers are relevant for background services, and as it has been discussed before; suspend blockers (not activating them) might actually degrade power usage.
Yes, absolutely. Note though that with the iPhone, Apple has decided that the only background services that will be allowed is audio, VOIP, location/navigation, and push notifications. iOS developers don't get access to anything else, and the argument is that nothing else is really *needed*. Android is more flexible in that it allows for non-Apple developers to create new background services, but it's not clear how many you really *need*.
This goes back to your first assertion that there are *many* applications that need to run in the background. I just don't think that's true. There will be a few, and probably more than just the restricted set allowed (and programmed) by Apple. But not *many*.
- Ted
P.S. Although you won't see Apple admitting it, their "fast app switching" is basically what Android has had all along, and most mobile developers are quite happy to call this multi-tasking. Yes, it's not the same as trying to compile the kernel using "make -j 16" in the background. But are you really going to do that on a cell phone battery? I think not.
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasQuoted 4 lines · Felipe Contreras
You are overgeneralizing; there are many applications that run in the background, and you want to keep them running even when the display is off.
Really? How many do you really expect will be running at the same time on a mobile platform with a 800-1000 mWh battery? And what percentage of the applications that might be in a Android or Moblin or Maemo app store will have things running in the background? 10%? 20%? 50%? 80%?
Quoted 7 lines
You seen to be concentrating on UI-only applications, for those it's worth noting that Android provides separate mechanisms for power saving. Since Android doesn't have true multi-tasking, the applications must serialize their states so that the next time they are opened they seem to have not been closed. So, the current active UI application can be closed while turning off the display, and re-opened later.
Actually in practice, the process or processes which comprise current active UI application generally won't actually be killed when you turn off the display. It *might* happen, if one of the rare backround applications needs more memory than is available without closing some of the more recently open applications. In practice, the last 2-3 most recently used applications are still loaded in memory so you can switch back and forth between them simply and easily. It is true they have to be ready to be killed at any time in case their memory is needed for the currently active application, but that generally does't happen right away. The design is to keep this transparent to the user so the user does't have to keep track of how many apps currently running on the system.
In any case, the key thing to keep in mind is that when you deal with extreme power savings, very often you end up making compromises that probably make sense for other reasons anyway (such as the small screen size). It's not at all clear that supporting generalized multi-tasking applications makes sense just from a screen real-estate issue and user experience POV, never mind battery lifetime.
Quoted 3 lines
User-space suspend blockers are relevant for background services, and as it has been discussed before; suspend blockers (not activating them) might actually degrade power usage.
Yes, absolutely. Note though that with the iPhone, Apple has decided that the only background services that will be allowed is audio, VOIP, location/navigation, and push notifications. iOS developers don't get access to anything else, and the argument is that nothing else is really *needed*. Android is more flexible in that it allows for non-Apple developers to create new background services, but it's not clear how many you really *need*.
This goes back to your first assertion that there are *many* applications that need to run in the background. I just don't think that's true. There will be a few, and probably more than just the restricted set allowed (and programmed) by Apple. But not *many*.
- Ted
P.S. Although you won't see Apple admitting it, their "fast app switching" is basically what Android has had all along, and most mobile developers are quite happy to call this multi-tasking. Yes, it's not the same as trying to compile the kernel using "make -j 16" in the background. But are you really going to do that on a cell phone battery? I think not.
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 11 lines · Ted Ts'o
Quoted 4 lines · Felipe Contreras
You are overgeneralizing; there are many applications that run in the background, and you want to keep them running even when the display is off.
Really? How many do you really expect will be running at the same time on a mobile platform with a 800-1000 mWh battery? And what percentage of the applications that might be in a Android or Moblin or Maemo app store will have things running in the background? 10%? 20%? 50%? 80%?
At any given time most of the applications are running on the background, how much exactly depends on the platform. In my N900 I can see that at least 90% of the process are running on the background right now.
Quoted 8 lines
Quoted 7 lines
You seen to be concentrating on UI-only applications, for those it's worth noting that Android provides separate mechanisms for power saving. Since Android doesn't have true multi-tasking, the applications must serialize their states so that the next time they are opened they seem to have not been closed. So, the current active UI application can be closed while turning off the display, and re-opened later.
Quoted 12 lines
Actually in practice, the process or processes which comprise current active UI application generally won't actually be killed when you turn off the display. It *might* happen, if one of the rare backround applications needs more memory than is available without closing some of the more recently open applications. In practice, the last 2-3 most recently used applications are still loaded in memory so you can switch back and forth between them simply and easily. It is true they have to be ready to be killed at any time in case their memory is needed for the currently active application, but that generally does't happen right away. The design is to keep this transparent to the user so the user does't have to keep track of how many apps currently running on the system.
My last experience using an Android system was that switching applications wasn't done "simply and easily".
But supposing it is, Android's UI is completely different to anything else; you cannot take a GNOME/KDE app and expect it to run on Android. Since UI applications are written for Android anyway, then they should be written with PM in mind, and should not rely on suspend blockers.
Quoted 6 lines
In any case, the key thing to keep in mind is that when you deal with extreme power savings, very often you end up making compromises that probably make sense for other reasons anyway (such as the small screen size). It's not at all clear that supporting generalized multi-tasking applications makes sense just from a screen real-estate issue and user experience POV, never mind battery lifetime.
My guess is you haven't used a truly multi-tasking device like the N900; now that I've got used to it, I consider that functionality *essential*.
Multi-tasking and good PM is possible, and the N900 is a good example. Rather than giving up multi-tasking to see how much longer the battery can last, I would rather like to see how to improve batter life for the multi-tasking case.
Quoted 12 lines
Quoted 3 lines
User-space suspend blockers are relevant for background services, and as it has been discussed before; suspend blockers (not activating them) might actually degrade power usage.
Yes, absolutely. Note though that with the iPhone, Apple has decided that the only background services that will be allowed is audio, VOIP, location/navigation, and push notifications. iOS developers don't get access to anything else, and the argument is that nothing else is really *needed*. Android is more flexible in that it allows for non-Apple developers to create new background services, but it's not clear how many you really *need*.
Quoted 4 lines
This goes back to your first assertion that there are *many* applications that need to run in the background. I just don't think that's true. There will be a few, and probably more than just the restricted set allowed (and programmed) by Apple. But not *many*.
The argument in favor of suspend blockers is that you could take applications that are not designed for embedded, and make them run on an embedded device without draining excessive battery life; those applications would have to be background services not conflicting with Android's design.
I agree there probably would not be that many background apps, and probably even less ported background apps, but that is actually an argument against suspend blockers.
The rest of the apps (UI apps), cannot be ported, but have to be written specifically for Android, and therefore should have PM in mind, and not require suspend blockers to have good power usage.
Signature · 5 lines
Felipe Contreras _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Ted Ts'oQuoted 11 lines · Ted Ts'o
Quoted 4 lines · Felipe Contreras
You are overgeneralizing; there are many applications that run in the background, and you want to keep them running even when the display is off.
Really? How many do you really expect will be running at the same time on a mobile platform with a 800-1000 mWh battery? And what percentage of the applications that might be in a Android or Moblin or Maemo app store will have things running in the background? 10%? 20%? 50%? 80%?
At any given time most of the applications are running on the background, how much exactly depends on the platform. In my N900 I can see that at least 90% of the process are running on the background right now.
Quoted 8 lines
Quoted 7 lines
You seen to be concentrating on UI-only applications, for those it's worth noting that Android provides separate mechanisms for power saving. Since Android doesn't have true multi-tasking, the applications must serialize their states so that the next time they are opened they seem to have not been closed. So, the current active UI application can be closed while turning off the display, and re-opened later.
Quoted 12 lines
Actually in practice, the process or processes which comprise current active UI application generally won't actually be killed when you turn off the display. It *might* happen, if one of the rare backround applications needs more memory than is available without closing some of the more recently open applications. In practice, the last 2-3 most recently used applications are still loaded in memory so you can switch back and forth between them simply and easily. It is true they have to be ready to be killed at any time in case their memory is needed for the currently active application, but that generally does't happen right away. The design is to keep this transparent to the user so the user does't have to keep track of how many apps currently running on the system.
My last experience using an Android system was that switching applications wasn't done "simply and easily".
But supposing it is, Android's UI is completely different to anything else; you cannot take a GNOME/KDE app and expect it to run on Android. Since UI applications are written for Android anyway, then they should be written with PM in mind, and should not rely on suspend blockers.
Quoted 6 lines
In any case, the key thing to keep in mind is that when you deal with extreme power savings, very often you end up making compromises that probably make sense for other reasons anyway (such as the small screen size). It's not at all clear that supporting generalized multi-tasking applications makes sense just from a screen real-estate issue and user experience POV, never mind battery lifetime.
My guess is you haven't used a truly multi-tasking device like the N900; now that I've got used to it, I consider that functionality *essential*.
Multi-tasking and good PM is possible, and the N900 is a good example. Rather than giving up multi-tasking to see how much longer the battery can last, I would rather like to see how to improve batter life for the multi-tasking case.
Quoted 12 lines
Quoted 3 lines
User-space suspend blockers are relevant for background services, and as it has been discussed before; suspend blockers (not activating them) might actually degrade power usage.
Yes, absolutely. Note though that with the iPhone, Apple has decided that the only background services that will be allowed is audio, VOIP, location/navigation, and push notifications. iOS developers don't get access to anything else, and the argument is that nothing else is really *needed*. Android is more flexible in that it allows for non-Apple developers to create new background services, but it's not clear how many you really *need*.
Quoted 4 lines
This goes back to your first assertion that there are *many* applications that need to run in the background. I just don't think that's true. There will be a few, and probably more than just the restricted set allowed (and programmed) by Apple. But not *many*.
The argument in favor of suspend blockers is that you could take applications that are not designed for embedded, and make them run on an embedded device without draining excessive battery life; those applications would have to be background services not conflicting with Android's design.
I agree there probably would not be that many background apps, and probably even less ported background apps, but that is actually an argument against suspend blockers.
The rest of the apps (UI apps), cannot be ported, but have to be written specifically for Android, and therefore should have PM in mind, and not require suspend blockers to have good power usage.
Signature · 1 line
Felipe Contreras
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 11 lines · Felipe Contreras
Quoted 4 lines
This goes back to your first assertion that there are *many* applications that need to run in the background. I just don't think that's true. There will be a few, and probably more than just the restricted set allowed (and programmed) by Apple. But not *many*.
The argument in favor of suspend blockers is that you could take applications that are not designed for embedded, and make them run on an embedded device without draining excessive battery life; those applications would have to be background services not conflicting with Android's design.
Quoted 7 lines
I agree there probably would not be that many background apps, and probably even less ported background apps, but that is actually an argument against suspend blockers.
The rest of the apps (UI apps), cannot be ported, but have to be written specifically for Android, and therefore should have PM in mind, and not require suspend blockers to have good power usage.
I think there's some confusion here.
The default operating mode for Android is to aggressively reach the lowest possible power state (typically full suspend). suspend blockers are used by applications to inform the system that they are currently doing work which requires immediate processing, so the system will avoid fully suspending until that work is done. You could think of it as setting your laptop power management settings to be "blank screen after 60 seconds, power down 5 seconds after blanking", except that there's also a mechanism for apps to hold off on that power down if they're doing important work, and a lot more ways to wakeup beyond opening the lid or pushing the power button.
Straight-forward UI apps don't actually require much special handling -- it's preferable that they do busy-wait on things, but even when power is not an issue, wasting cpu spinning needlessly is frowned upon, so this isn't a special request. There's nothing stopping somebody from writing an Android app that acts as a bridge to X11 apps (embedding an X server, etc) and making it possible for native X11 apps to coexist with the Android composition model. I'm a little surprised nobody has done so, actually. I figured *somebody* would decide that they like their phone but absolutely need to run xclock or something locally as a first class app.
The Android app model does say that if you're not in the foreground (from a UI standpoint) you should save your state, as you may be terminated if the system runs low on resources. The system only does this when it has to -- generally when we bottom out on memory. On devices with sufficient memory, it's quite common for many apps to remain resident for days-weeks -- I've seen as many as 45-50 apps running on my nexus one.
I am a little puzzled by the assertion that Android lasks "true multitasking", but that's another discussion entirely. We certainly don't lack for many concurrent processes and threads...
Brian
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasQuoted 11 lines · Felipe Contreras
Quoted 4 lines
This goes back to your first assertion that there are *many* applications that need to run in the background. I just don't think that's true. There will be a few, and probably more than just the restricted set allowed (and programmed) by Apple. But not *many*.
The argument in favor of suspend blockers is that you could take applications that are not designed for embedded, and make them run on an embedded device without draining excessive battery life; those applications would have to be background services not conflicting with Android's design.
Quoted 7 lines
I agree there probably would not be that many background apps, and probably even less ported background apps, but that is actually an argument against suspend blockers.
The rest of the apps (UI apps), cannot be ported, but have to be written specifically for Android, and therefore should have PM in mind, and not require suspend blockers to have good power usage.
I think there's some confusion here.
The default operating mode for Android is to aggressively reach the lowest possible power state (typically full suspend). suspend blockers are used by applications to inform the system that they are currently doing work which requires immediate processing, so the system will avoid fully suspending until that work is done. You could think of it as setting your laptop power management settings to be "blank screen after 60 seconds, power down 5 seconds after blanking", except that there's also a mechanism for apps to hold off on that power down if they're doing important work, and a lot more ways to wakeup beyond opening the lid or pushing the power button.
Straight-forward UI apps don't actually require much special handling -- it's preferable that they do busy-wait on things, but even when power is not an issue, wasting cpu spinning needlessly is frowned upon, so this isn't a special request. There's nothing stopping somebody from writing an Android app that acts as a bridge to X11 apps (embedding an X server, etc) and making it possible for native X11 apps to coexist with the Android composition model. I'm a little surprised nobody has done so, actually. I figured *somebody* would decide that they like their phone but absolutely need to run xclock or something locally as a first class app.
The Android app model does say that if you're not in the foreground (from a UI standpoint) you should save your state, as you may be terminated if the system runs low on resources. The system only does this when it has to -- generally when we bottom out on memory. On devices with sufficient memory, it's quite common for many apps to remain resident for days-weeks -- I've seen as many as 45-50 apps running on my nexus one.
I am a little puzzled by the assertion that Android lasks "true multitasking", but that's another discussion entirely. We certainly don't lack for many concurrent processes and threads...
Brian
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasQuoted 4 lines · Felipe Contreras
My guess is you haven't used a truly multi-tasking device like the N900; now that I've got used to it, I consider that functionality *essential*.
I've used an N800, and I wasn't impressed; if anything, the fact that I have to worry about manually killing off applications when memory gets low, I actually thought it was incredibly sucky. It was a miniature, badly done laptop.
Maybe the N900 is different, but the bigger question is what do you mean by "multi-tasking"? Definitions are critical here, which is why Paul was so careful in his definitions section of his document.
Do you mean:
* allowing multiple processes running at the same time?
* allowing some applications to be able to update mail, play audio, upload location information so your friends know where you are?
* allowing arbitrary applications that users can interact with simultaneously (which implies a window manager, the need to have the concept of window focus for keyboard input), etc?
or something else?
Quoted 6 lines
The argument in favor of suspend blockers is that you could take applications that are not designed for embedded, and make them run on an embedded device without draining excessive battery life; those applications would have to be background services not conflicting with Android's design.
Quoted 7 lines
I agree there probably would not be that many background apps, and probably even less ported background apps, but that is actually an argument against suspend blockers.
The rest of the apps (UI apps), cannot be ported, but have to be written specifically for Android, and therefore should have PM in mind, and not require suspend blockers to have good power usage.
If you are using a GUI framework which is optimized for a single- application-focus-at-a-time UI that isn't GNOME or KDE, then that will require the applications to be written. However, that's not because of suspend-blockers.
If you assume a GUI framework which is flexible enough --- maybe Qt falls into this category, maybe not --- for the rest of the applications, they don't need to *know* about suspend blockers, and they certainly do't have to be rewritten or modified specifically for suspend blockers. So if your argument is that applications that don't need bacground services (which you've admitted comprises majority of applicatios) need to be modified or written specifically to support suspend blockers, that's simply not true. They don't need to be modified at all.
As far as whether they *should* require suspend blockers to be in the kernel to get power usage that is suitable for cell phone batteries, I would agree that in the ideal world, it would be nice if you could have applications that make the correct performance/battery utilization tradeoff for devices running on 800 mWh batteries, 94,000 mWh batteries, and while running on the AC mains. But I don't believe that it's likely to be true, and if you want to try to beat up on application writers one at a time to be power optimized --- as far as I'm concerned, that's an argument *for* suspend blockers, since I'm not big believer in plans that begin, "First, you command the tides of the sea to go back", King Canute style. :-)
- Ted
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasQuoted 4 lines · Felipe Contreras
My guess is you haven't used a truly multi-tasking device like the N900; now that I've got used to it, I consider that functionality *essential*.
I've used an N800, and I wasn't impressed; if anything, the fact that I have to worry about manually killing off applications when memory gets low, I actually thought it was incredibly sucky. It was a miniature, badly done laptop.
Maybe the N900 is different, but the bigger question is what do you mean by "multi-tasking"? Definitions are critical here, which is why Paul was so careful in his definitions section of his document.
Do you mean:
* allowing multiple processes running at the same time?
* allowing some applications to be able to update mail, play audio, upload location information so your friends know where you are?
* allowing arbitrary applications that users can interact with simultaneously (which implies a window manager, the need to have the concept of window focus for keyboard input), etc?
or something else?
Quoted 6 lines
The argument in favor of suspend blockers is that you could take applications that are not designed for embedded, and make them run on an embedded device without draining excessive battery life; those applications would have to be background services not conflicting with Android's design.
Quoted 7 lines
I agree there probably would not be that many background apps, and probably even less ported background apps, but that is actually an argument against suspend blockers.
The rest of the apps (UI apps), cannot be ported, but have to be written specifically for Android, and therefore should have PM in mind, and not require suspend blockers to have good power usage.
If you are using a GUI framework which is optimized for a single- application-focus-at-a-time UI that isn't GNOME or KDE, then that will require the applications to be written. However, that's not because of suspend-blockers.
If you assume a GUI framework which is flexible enough --- maybe Qt falls into this category, maybe not --- for the rest of the applications, they don't need to *know* about suspend blockers, and they certainly do't have to be rewritten or modified specifically for suspend blockers. So if your argument is that applications that don't need bacground services (which you've admitted comprises majority of applicatios) need to be modified or written specifically to support suspend blockers, that's simply not true. They don't need to be modified at all.
As far as whether they *should* require suspend blockers to be in the kernel to get power usage that is suitable for cell phone batteries, I would agree that in the ideal world, it would be nice if you could have applications that make the correct performance/battery utilization tradeoff for devices running on 800 mWh batteries, 94,000 mWh batteries, and while running on the AC mains. But I don't believe that it's likely to be true, and if you want to try to beat up on application writers one at a time to be power optimized --- as far as I'm concerned, that's an argument *for* suspend blockers, since I'm not big believer in plans that begin, "First, you command the tides of the sea to go back", King Canute style. :-)
- Ted
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 3 lines
I have to worry about manually killing off applications when memory gets low, I actually thought it was incredibly sucky. It was a miniature, badly done laptop.
Likewise I thought the lack of proper multi-tasking apps in Android was comically bad. Nice device completely wrecked by the inability to flip between running apps each with their own screen - something that was old tech in 1990.
It's no use looking at this from an "In my opinion" angle. A proper solution works for most if not all opinions except maybe around corner cases.
Quoted 3 lines
* allowing arbitrary applications that users can interact with simultaneously (which implies a window manager, the need to have the concept of window focus for keyboard input), etc?
That's also untrue as anyone who has worked in industrial control or entertainment systems will tell you. You may well have fourteen apps driving fourteen display/input devices and no window manager.
Quoted 9 lines
would agree that in the ideal world, it would be nice if you could have applications that make the correct performance/battery utilization tradeoff for devices running on 800 mWh batteries, 94,000 mWh batteries, and while running on the AC mains. But I don't believe that it's likely to be true, and if you want to try to beat up on application writers one at a time to be power optimized --- as far as I'm concerned, that's an argument *for* suspend blockers, since I'm not big believer in plans that begin, "First, you command the tides of the sea to go back", King Canute style. :-)
Suspend blockers drive the system policy part way into the apps, that in turn makes the apps very vulnerable to change in their environment because you've specialised them. I am sure that in the Android world it's considered fine, and that the marketing and business people even like this binding together - but it doesn't generalise and will blow up in people's faces in the future.
To consider your tide analogy - suspend blockers is like trying to program the waves individually. Show me a suspend blocker aware open office patch 8)
Re: Attempted summary of suspend-blockers LKML thread, take three
On Mon, Aug 09, 2010 at 11:24:53AM +0100, Alan Cox wrote:
[ . . . ]
Quoted 17 lines
Quoted 9 lines
would agree that in the ideal world, it would be nice if you could have applications that make the correct performance/battery utilization tradeoff for devices running on 800 mWh batteries, 94,000 mWh batteries, and while running on the AC mains. But I don't believe that it's likely to be true, and if you want to try to beat up on application writers one at a time to be power optimized --- as far as I'm concerned, that's an argument *for* suspend blockers, since I'm not big believer in plans that begin, "First, you command the tides of the sea to go back", King Canute style. :-)
Suspend blockers drive the system policy part way into the apps, that in turn makes the apps very vulnerable to change in their environment because you've specialised them. I am sure that in the Android world it's considered fine, and that the marketing and business people even like this binding together - but it doesn't generalise and will blow up in people's faces in the future.
Quoted 3 lines
To consider your tide analogy - suspend blockers is like trying to program the waves individually. Show me a suspend blocker aware open office patch 8)
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when the screen is turned off, so these the applications do not need to use suspend blockers. That said, I could easily imagine that significant work would be required to make OpenOffice run on Android, not due to suspend blockers, but rather due to Android's unusual user space.
On devices that do not have suspend blockers, a normal application runs in a manner similar to a hypothetical Android application that acquires a suspend blocker when it starts and holds that suspend blocker until it exits. In contrast with Android, this situation requires that each and every application be carefully written to avoid battery drain, which I suspect is what Ted is getting at with his King Canute analogy.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Alan CoxOn Mon, Aug 09, 2010 at 11:24:53AM +0100, Alan Cox wrote:
[ . . . ]
Quoted 17 lines
Quoted 9 lines
would agree that in the ideal world, it would be nice if you could have applications that make the correct performance/battery utilization tradeoff for devices running on 800 mWh batteries, 94,000 mWh batteries, and while running on the AC mains. But I don't believe that it's likely to be true, and if you want to try to beat up on application writers one at a time to be power optimized --- as far as I'm concerned, that's an argument *for* suspend blockers, since I'm not big believer in plans that begin, "First, you command the tides of the sea to go back", King Canute style. :-)
Suspend blockers drive the system policy part way into the apps, that in turn makes the apps very vulnerable to change in their environment because you've specialised them. I am sure that in the Android world it's considered fine, and that the marketing and business people even like this binding together - but it doesn't generalise and will blow up in people's faces in the future.
Quoted 3 lines
To consider your tide analogy - suspend blockers is like trying to program the waves individually. Show me a suspend blocker aware open office patch 8)
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when the screen is turned off, so these the applications do not need to use suspend blockers. That said, I could easily imagine that significant work would be required to make OpenOffice run on Android, not due to suspend blockers, but rather due to Android's unusual user space.
On devices that do not have suspend blockers, a normal application runs in a manner similar to a hypothetical Android application that acquires a suspend blocker when it starts and holds that suspend blocker until it exits. In contrast with Android, this situation requires that each and every application be carefully written to avoid battery drain, which I suspect is what Ted is getting at with his King Canute analogy.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 25 lines · Paul E. McKenney
On Mon, Aug 09, 2010 at 11:24:53AM +0100, Alan Cox wrote:
[ . . . ]
Quoted 17 lines
Quoted 9 lines
would agree that in the ideal world, it would be nice if you could have applications that make the correct performance/battery utilization tradeoff for devices running on 800 mWh batteries, 94,000 mWh batteries, and while running on the AC mains. But I don't believe that it's likely to be true, and if you want to try to beat up on application writers one at a time to be power optimized --- as far as I'm concerned, that's an argument *for* suspend blockers, since I'm not big believer in plans that begin, "First, you command the tides of the sea to go back", King Canute style. :-)
Suspend blockers drive the system policy part way into the apps, that in turn makes the apps very vulnerable to change in their environment because you've specialised them. I am sure that in the Android world it's considered fine, and that the marketing and business people even like this binding together - but it doesn't generalise and will blow up in people's faces in the future.
Quoted 3 lines
To consider your tide analogy - suspend blockers is like trying to program the waves individually. Show me a suspend blocker aware open office patch 8)
Quoted 6 lines
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when the screen is turned off, so these the applications do not need to use suspend blockers. That said, I could easily imagine that significant work would be required to make OpenOffice run on Android, not due to suspend blockers, but rather due to Android's unusual user space.
pick your application if you don't like the example.
but also, which android system should the applicaton be written for? the phone with a 800maH battery or a larger device with a 94,000maH battery?
well bahaved applications (not doing unnecessary wakeups, etc) are well bahaved, no matter what system they are on (explicitly setting allowable timer fuzz is linux specific, but will again help on any system)
David Lang
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 27 lines · On Mon, Aug 09, 2010 at 11:28:02AM -0700, [email protected] wrote:
Quoted 25 lines · Paul E. McKenney
On Mon, Aug 09, 2010 at 11:24:53AM +0100, Alan Cox wrote:
[ . . . ]
Quoted 20 lines
Quoted 9 lines
would agree that in the ideal world, it would be nice if you could have applications that make the correct performance/battery utilization tradeoff for devices running on 800 mWh batteries, 94,000 mWh batteries, and while running on the AC mains. But I don't believe that it's likely to be true, and if you want to try to beat up on application writers one at a time to be power optimized --- as far as I'm concerned, that's an argument *for* suspend blockers, since I'm not big believer in plans that begin, "First, you command the tides of the sea to go back", King Canute style. :-)
Suspend blockers drive the system policy part way into the apps, that in turn makes the apps very vulnerable to change in their environment because you've specialised them. I am sure that in the Android world it's considered fine, and that the marketing and business people even like this binding together - but it doesn't generalise and will blow up in people's faces in the future.
To consider your tide analogy - suspend blockers is like trying to program the waves individually. Show me a suspend blocker aware open office patch 8)
Quoted 8 lines
Quoted 6 lines
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when the screen is turned off, so these the applications do not need to use suspend blockers. That said, I could easily imagine that significant work would be required to make OpenOffice run on Android, not due to suspend blockers, but rather due to Android's unusual user space.
pick your application if you don't like the example.
I like the office-suite example just fine.
Quoted 3 lines
but also, which android system should the applicaton be written for? the phone with a 800maH battery or a larger device with a 94,000maH battery?
Does battery size make a difference in this particular case?
Quoted 2 lines
well bahaved applications (not doing unnecessary wakeups, etc) are well bahaved, no matter what system they are on
Yep. Your point being what exactly? That all applications should be required to be power-optimized, and that any technology that automates energy efficiency should be rejected out of hand? If so, please justify your position.
Quoted 3 lines
(explicitly setting
allowable timer fuzz is linux specific, but will again help on any system)
Setting aside the question of how timer fuzz will help on non-Linux systems if timer fuzz is specific to Linux...
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Paul E. McKenneyQuoted 2 lines
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when
I was waiting for soemone to leap down the pit I dug Office suites have some quite important background activities. Consider the case of a power oblivious Open Office. You type a critical document, you suspend, your phone battery dies a bit later, you lost your document. Office suites do timed backing up as one simple obvious example. That could become a power aware behaviour but the truely power oblivious office suite is a myth.
Quoted 4 lines
the screen is turned off, so these the applications do not need to use suspend blockers. That said, I could easily imagine that significant work would be required to make OpenOffice run on Android, not due to suspend blockers, but rather due to Android's unusual user space.
You are tightly linking suspend blockers with Android. If they were a sensible general solution they would be generic not tied closely to Android
Some of the other bad assumptions being made in this discussion:
- That the phone is special. Todays Android phones are up with the PC's of some years back (but with better graphics and more faster storage), in a few more generations of the technology what will they look like ? I'm sure that within a few years there will be people playing Warcraft or similar on their phone in the train.
- That Android will continue to tbe offering the same services in future as today. If it does it'll go the way of PalmOS and Symbian. Equally you can't just bust all the apps as it changes
As devices get more complex and varied you cannot afford to put the detailed awareness of platform behaviour in the applications. It doesn't scale. Android developers are haivng enough fun coping with all the OS variants, customisations and new phones - and thats far less variety than PC hardware. Generally the PC app folks are not having the same level of problem - so ask why ?
Quoted 6 lines
On devices that do not have suspend blockers, a normal application runs in a manner similar to a hypothetical Android application that acquires a suspend blocker when it starts and holds that suspend blocker until it exits. In contrast with Android, this situation requires that each and every application be carefully written to avoid battery drain, which I suspect is what Ted is getting at with his King Canute analogy.
Which is flawed and not the case. The same argument could be made for multi-tasking
DOS "Each application implements its own internal
multitasking/polling if needed"
Windows 3.x "Each application has an event loop and is built
in a certain way" (the 'suspend blocker' mentality)
Real OS "The scheduler operates in a manner which prevents
CPU hogs breaking the system or abusing it sufficiently to threaten its functionality"
The same applies to power. Only the OS has the big picture and can hide the hardware and general policy variety from the application.
OpenOffice runs on netbooks, laptops, servers, even big non x86 boxes. It runs on virtual machines, it runs in power sensitive environments, it runs in thermally constrained environments, it runs in I/O constrained environments, it runs in latency constrained environments etc etc
All the same code, true some work has been done to make it behave politely but the rest is down to the OS doing its job - deploying the resources available while considering and obeying the constraints present, in a manner which makes best use of the resources to achieve the policy goals of the system.
And not unsurprisingly that all starts to look like Stafford Beer's good old viable systems model.
Alan
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 10 lines · Alan Cox
Quoted 2 lines
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when
I was waiting for soemone to leap down the pit I dug Office suites have some quite important background activities. Consider the case of a power oblivious Open Office. You type a critical document, you suspend, your phone battery dies a bit later, you lost your document. Office suites do timed backing up as one simple obvious example. That could become a power aware behaviour but the truely power oblivious office suite is a myth.
Quoted 8 lines
Quoted 4 lines
the screen is turned off, so these the applications do not need to use suspend blockers. That said, I could easily imagine that significant work would be required to make OpenOffice run on Android, not due to suspend blockers, but rather due to Android's unusual user space.
You are tightly linking suspend blockers with Android. If they were a sensible general solution they would be generic not tied closely to Android
Doesn't the same problem exist on my linux laptop? I write out my manifesto in open office, close the lid of my laptop, the system suspends before my huge document finishes writing out, later my battery dies or I foolishly remove it or whatnot... the main difference seems to be that laptops, with their big 'ol batteries, are less aggressive about power management and the result is wider windows before and less frequent wakeups from suspend and thus better odds at missing the race condition.
As Arve has pointed out previously, there are a number of uses for suspend blockers, even on plugged-into-the-wall systems -- take his example of wanting his mythtv backend to power down when not busy, but never power down when he happens to be using it on console, or issues with multiple services that want to wake up and keep the device awake while working.
Brian
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Alan CoxQuoted 10 lines · Alan Cox
Quoted 2 lines
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when
I was waiting for soemone to leap down the pit I dug Office suites have some quite important background activities. Consider the case of a power oblivious Open Office. You type a critical document, you suspend, your phone battery dies a bit later, you lost your document. Office suites do timed backing up as one simple obvious example. That could become a power aware behaviour but the truely power oblivious office suite is a myth.
Quoted 8 lines
Quoted 4 lines
the screen is turned off, so these the applications do not need to use suspend blockers. That said, I could easily imagine that significant work would be required to make OpenOffice run on Android, not due to suspend blockers, but rather due to Android's unusual user space.
You are tightly linking suspend blockers with Android. If they were a sensible general solution they would be generic not tied closely to Android
Doesn't the same problem exist on my linux laptop? I write out my manifesto in open office, close the lid of my laptop, the system suspends before my huge document finishes writing out, later my battery dies or I foolishly remove it or whatnot... the main difference seems to be that laptops, with their big 'ol batteries, are less aggressive about power management and the result is wider windows before and less frequent wakeups from suspend and thus better odds at missing the race condition.
As Arve has pointed out previously, there are a number of uses for suspend blockers, even on plugged-into-the-wall systems -- take his example of wanting his mythtv backend to power down when not busy, but never power down when he happens to be using it on console, or issues with multiple services that want to wake up and keep the device awake while working.
Brian
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Alan CoxQuoted 9 lines · Alan Cox
Quoted 2 lines
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when
I was waiting for soemone to leap down the pit I dug Office suites have some quite important background activities. Consider the case of a power oblivious Open Office. You type a critical document, you suspend, your phone battery dies a bit later, you lost your document. Office suites do timed backing up as one simple obvious example. That could become a power aware behaviour but the truely power oblivious office suite is a myth.
this is a good example of why the office suite should be a privilaged application. If the system were to consider it privilaged, it could wake up when the timer is scheduled to fire to save the document.
the office suite probably has a periodic timer that would fire every 10 min no matter what, but if there was a reason to change it, it could be modified to only setup the timer when the document is changed. If no changes can take place because the system is asleep, the timer never gets setup.
David Lang
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Alan CoxQuoted 9 lines · Alan Cox
Quoted 2 lines
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when
I was waiting for soemone to leap down the pit I dug Office suites have some quite important background activities. Consider the case of a power oblivious Open Office. You type a critical document, you suspend, your phone battery dies a bit later, you lost your document. Office suites do timed backing up as one simple obvious example. That could become a power aware behaviour but the truely power oblivious office suite is a myth.
this is a good example of why the office suite should be a privilaged application. If the system were to consider it privilaged, it could wake up when the timer is scheduled to fire to save the document.
the office suite probably has a periodic timer that would fire every 10 min no matter what, but if there was a reason to change it, it could be modified to only setup the timer when the document is changed. If no changes can take place because the system is asleep, the timer never gets setup.
David Lang
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Alan CoxQuoted 9 lines · Alan Cox
Quoted 2 lines
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when
I was waiting for soemone to leap down the pit I dug Office suites have some quite important background activities. Consider the case of a power oblivious Open Office. You type a critical document, you suspend, your phone battery dies a bit later, you lost your document. Office suites do timed backing up as one simple obvious example. That could become a power aware behaviour but the truely power oblivious office suite is a myth.
It is a sad day on LKML when we are busy digging pits for each other. On the other hand, I have seen far sadder days, and the pit you dug happens to lead somewhere useful. As Brian noted in his reply, the situation you call out can occur with manual suspend-to-RAM already:
the fact is that this is a design choice. You could indeed make a PM-driving office application if you wished, or run the same application as a power-oblivious application. There is a slight difference in the contract with the user. Of course, it is quite clear which one -you- prefer, but preferences can vary.
Quoted 8 lines
Quoted 4 lines
the screen is turned off, so these the applications do not need to use suspend blockers. That said, I could easily imagine that significant work would be required to make OpenOffice run on Android, not due to suspend blockers, but rather due to Android's unusual user space.
You are tightly linking suspend blockers with Android. If they were a sensible general solution they would be generic not tied closely to Android
Android is certainly where suspend blockers originated, and is to the best of my knowledge is still the only platform that uses them. But there is a first user of every new mechanism, and for some time that first user will by definition be the only user of that mechanism. So the fact that Android is most probably the only user of suspend blockers does not prove anything about whether or not suspend blockers are sensible.
Quoted 7 lines
Some of the other bad assumptions being made in this discussion:
- That the phone is special. Todays Android phones are up with the PC's of some years back (but with better graphics and more faster storage), in a few more generations of the technology what will they look like ? I'm sure that within a few years there will be people playing Warcraft or similar on their phone in the train.
Indeed, people have played games on their cellphones for some years. Not sure whether any of the games resembles World of Warcraft, but they probably soon will. If so, perhaps they will make use of significant hardware acceleration -- most other embedded systems do so.
But that doesn't guarantee that solutions developed for PCs and laptops will be optimal (or even usable) on cellphones. Sufficient difference in scale can easily change the form of the optimal solution, so you have not yet made your case. (For that matter, you also haven't proven that adoption of suspend blockers or something like them depends on the assumption that cellphones are special.)
Quoted 3 lines
- That Android will continue to tbe offering the same services in future as today. If it does it'll go the way of PalmOS and Symbian. Equally you can't just bust all the apps as it changes
I hope that no one is arguing that Android will remain unchanged, just as I hope no one would argue that Linux will remain unchanged. In fact, I am quite confident that both Linux and Android will continue to change. So exactly what point were you attempting to make here?
As to busting all apps, lthough there have been situations where busting all the apps turned out to be the right thing to do, I agree that these situations are extremely rare. Such situations are usually associated with the emergence of a new high-volume platform.
Quoted 8 lines
As devices get more complex and varied you cannot afford to put the detailed awareness of platform behaviour in the applications. It doesn't scale. Android developers are haivng enough fun coping with all the OS variants, customisations and new phones - and thats far less variety than PC hardware. Generally the PC app folks are not having the same level of problem - so ask why ?
From what I can see, the Android developers are suffering less than
the PC developers were suffering when the PC was the same age that Android is now. For that matter, suspend blockers don't put detailed awareness of platform behavior into apps. You must look to the heavily power-optimized apps to find that kind of awareness.
Quoted 8 lines
Quoted 6 lines
On devices that do not have suspend blockers, a normal application runs in a manner similar to a hypothetical Android application that acquires a suspend blocker when it starts and holds that suspend blocker until it exits. In contrast with Android, this situation requires that each and every application be carefully written to avoid battery drain, which I suspect is what Ted is getting at with his King Canute analogy.
Which is flawed and not the case.
Hmmm... Exactly which part do you consider flawed? Let's take it one sentence at a time. The devices that I know of that lack suspend blockers also lack opportunistic suspend. Therefore, all applications on such devices run as would an application that acquired a suspend blocker when it started and did not release that suspend blocker until it exited. Pretty straightforward.
As for the first part of the second sentence, you yourself have argued that each and every application should be carefully written to avoid battery drain (or, equivalently, to promote energy efficiency), so presumably the flaw does not reside there. That leaves the second half of that sentence, for which we both must defer to Ted. But Ted's intended meaning of his King Canute analogy does not affect the argument as to whether or not suspend blockers (or, again, something like them) are useful.
Quoted 6 lines
The same argument could be made for
multi-taskingDOS "Each application implements its own internal
multitasking/polling if needed"
Quoted 6 lines
Windows 3.x "Each application has an event loop and is built
in a certain way" (the 'suspend blocker' mentality)Real OS "The scheduler operates in a manner which prevents
CPU hogs breaking the system or abusing it sufficiently to threaten its functionality"
I really do like this progression. I will return to it further down.
Quoted 2 lines
The same applies to power. Only the OS has the big picture and can hide the hardware and general policy variety from the application.
The OS can be said to possess the full picture only if the applications communicate their portion of the picture to the OS. Linux has quite a few APIs devoted to this sort of communication, many of them mandated by POSIX. Some people are proposing suspend blockers (or something like them) as another member of this set of APIs.
Quoted 4 lines
OpenOffice runs on netbooks, laptops, servers, even big non x86 boxes. It runs on virtual machines, it runs in power sensitive environments, it runs in thermally constrained environments, it runs in I/O constrained environments, it runs in latency constrained environments etc etc
And there are numerous environments in which it will not run. So what?
Quoted 5 lines
All the same code, true some work has been done to make it behave politely but the rest is down to the OS doing its job - deploying the resources available while considering and obeying the constraints present, in a manner which makes best use of the resources to achieve the policy goals of the system.
And if the work has not been done on the application, and if there is nothing like suspend blockers, the OS cannot do its job. So how exactly does this support your position?
Which brings us to the progression from DOS to Windows 3.x to Real OS. Why can the Real OS's scheduler can operate "in a manner which prevents CPU hogs from breaking the system or abusing it sufficiently to threaten its functionality" while still allowing applications with special requirements to operate correctly? One reason is the advent of any number of APIs that communicate special properties of specific applications to the OS, including the old nice() system call, POSIX realtime, numerous facilities to communicate application properties to the VM system, and so on.
Given this context, are you sure that suspend blockers are not the next step in the Real OS progression? Or some QoS mechanism that subsumes suspend blockers? However, there is a lot of negative experience around general-purpose QoS mechanisms -- you have to be quite careful in order to avoid spending more energy computing QoS than you would otherwise spend on the application's computations. The usual way out of this trap is to abandon generality in favor of exploiting the commonly occurring special cases. For all I know, raw suspend blockers might be the appropriate special case.
Quoted 2 lines
And not unsurprisingly that all starts to look like Stafford Beer's good old viable systems model.
Hmmm... I do like "Absolutum Obsoletum", especially if it really does translate to "If it works it's out of date." However, I am not at all convinced that it supports your position! ;-)
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Alan CoxQuoted 9 lines · Alan Cox
Quoted 2 lines
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when
I was waiting for soemone to leap down the pit I dug Office suites have some quite important background activities. Consider the case of a power oblivious Open Office. You type a critical document, you suspend, your phone battery dies a bit later, you lost your document. Office suites do timed backing up as one simple obvious example. That could become a power aware behaviour but the truely power oblivious office suite is a myth.
It is a sad day on LKML when we are busy digging pits for each other. On the other hand, I have seen far sadder days, and the pit you dug happens to lead somewhere useful. As Brian noted in his reply, the situation you call out can occur with manual suspend-to-RAM already:
the fact is that this is a design choice. You could indeed make a PM-driving office application if you wished, or run the same application as a power-oblivious application. There is a slight difference in the contract with the user. Of course, it is quite clear which one -you- prefer, but preferences can vary.
Quoted 8 lines
Quoted 4 lines
the screen is turned off, so these the applications do not need to use suspend blockers. That said, I could easily imagine that significant work would be required to make OpenOffice run on Android, not due to suspend blockers, but rather due to Android's unusual user space.
You are tightly linking suspend blockers with Android. If they were a sensible general solution they would be generic not tied closely to Android
Android is certainly where suspend blockers originated, and is to the best of my knowledge is still the only platform that uses them. But there is a first user of every new mechanism, and for some time that first user will by definition be the only user of that mechanism. So the fact that Android is most probably the only user of suspend blockers does not prove anything about whether or not suspend blockers are sensible.
Quoted 7 lines
Some of the other bad assumptions being made in this discussion:
- That the phone is special. Todays Android phones are up with the PC's of some years back (but with better graphics and more faster storage), in a few more generations of the technology what will they look like ? I'm sure that within a few years there will be people playing Warcraft or similar on their phone in the train.
Indeed, people have played games on their cellphones for some years. Not sure whether any of the games resembles World of Warcraft, but they probably soon will. If so, perhaps they will make use of significant hardware acceleration -- most other embedded systems do so.
But that doesn't guarantee that solutions developed for PCs and laptops will be optimal (or even usable) on cellphones. Sufficient difference in scale can easily change the form of the optimal solution, so you have not yet made your case. (For that matter, you also haven't proven that adoption of suspend blockers or something like them depends on the assumption that cellphones are special.)
Quoted 3 lines
- That Android will continue to tbe offering the same services in future as today. If it does it'll go the way of PalmOS and Symbian. Equally you can't just bust all the apps as it changes
I hope that no one is arguing that Android will remain unchanged, just as I hope no one would argue that Linux will remain unchanged. In fact, I am quite confident that both Linux and Android will continue to change. So exactly what point were you attempting to make here?
As to busting all apps, lthough there have been situations where busting all the apps turned out to be the right thing to do, I agree that these situations are extremely rare. Such situations are usually associated with the emergence of a new high-volume platform.
Quoted 8 lines
As devices get more complex and varied you cannot afford to put the detailed awareness of platform behaviour in the applications. It doesn't scale. Android developers are haivng enough fun coping with all the OS variants, customisations and new phones - and thats far less variety than PC hardware. Generally the PC app folks are not having the same level of problem - so ask why ?
From what I can see, the Android developers are suffering less than
the PC developers were suffering when the PC was the same age that Android is now. For that matter, suspend blockers don't put detailed awareness of platform behavior into apps. You must look to the heavily power-optimized apps to find that kind of awareness.
Quoted 8 lines
Quoted 6 lines
On devices that do not have suspend blockers, a normal application runs in a manner similar to a hypothetical Android application that acquires a suspend blocker when it starts and holds that suspend blocker until it exits. In contrast with Android, this situation requires that each and every application be carefully written to avoid battery drain, which I suspect is what Ted is getting at with his King Canute analogy.
Which is flawed and not the case.
Hmmm... Exactly which part do you consider flawed? Let's take it one sentence at a time. The devices that I know of that lack suspend blockers also lack opportunistic suspend. Therefore, all applications on such devices run as would an application that acquired a suspend blocker when it started and did not release that suspend blocker until it exited. Pretty straightforward.
As for the first part of the second sentence, you yourself have argued that each and every application should be carefully written to avoid battery drain (or, equivalently, to promote energy efficiency), so presumably the flaw does not reside there. That leaves the second half of that sentence, for which we both must defer to Ted. But Ted's intended meaning of his King Canute analogy does not affect the argument as to whether or not suspend blockers (or, again, something like them) are useful.
Quoted 6 lines
The same argument could be made for
multi-taskingDOS "Each application implements its own internal
multitasking/polling if needed"
Quoted 6 lines
Windows 3.x "Each application has an event loop and is built
in a certain way" (the 'suspend blocker' mentality)Real OS "The scheduler operates in a manner which prevents
CPU hogs breaking the system or abusing it sufficiently to threaten its functionality"
I really do like this progression. I will return to it further down.
Quoted 2 lines
The same applies to power. Only the OS has the big picture and can hide the hardware and general policy variety from the application.
The OS can be said to possess the full picture only if the applications communicate their portion of the picture to the OS. Linux has quite a few APIs devoted to this sort of communication, many of them mandated by POSIX. Some people are proposing suspend blockers (or something like them) as another member of this set of APIs.
Quoted 4 lines
OpenOffice runs on netbooks, laptops, servers, even big non x86 boxes. It runs on virtual machines, it runs in power sensitive environments, it runs in thermally constrained environments, it runs in I/O constrained environments, it runs in latency constrained environments etc etc
And there are numerous environments in which it will not run. So what?
Quoted 5 lines
All the same code, true some work has been done to make it behave politely but the rest is down to the OS doing its job - deploying the resources available while considering and obeying the constraints present, in a manner which makes best use of the resources to achieve the policy goals of the system.
And if the work has not been done on the application, and if there is nothing like suspend blockers, the OS cannot do its job. So how exactly does this support your position?
Which brings us to the progression from DOS to Windows 3.x to Real OS. Why can the Real OS's scheduler can operate "in a manner which prevents CPU hogs from breaking the system or abusing it sufficiently to threaten its functionality" while still allowing applications with special requirements to operate correctly? One reason is the advent of any number of APIs that communicate special properties of specific applications to the OS, including the old nice() system call, POSIX realtime, numerous facilities to communicate application properties to the VM system, and so on.
Given this context, are you sure that suspend blockers are not the next step in the Real OS progression? Or some QoS mechanism that subsumes suspend blockers? However, there is a lot of negative experience around general-purpose QoS mechanisms -- you have to be quite careful in order to avoid spending more energy computing QoS than you would otherwise spend on the application's computations. The usual way out of this trap is to abandon generality in favor of exploiting the commonly occurring special cases. For all I know, raw suspend blockers might be the appropriate special case.
Quoted 2 lines
And not unsurprisingly that all starts to look like Stafford Beer's good old viable systems model.
Hmmm... I do like "Absolutum Obsoletum", especially if it really does translate to "If it works it's out of date." However, I am not at all convinced that it supports your position! ;-)
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 2 lines
situation you call out can occur with manual suspend-to-RAM already:
the fact is that this is a design choice. You could indeed make a
Losing data is a design choice ? The application set a timer, the OS shouldn't be ignoring it in that situation. It might want to delay it, it might want to warn the user its hogging things it shouldnt (powertop, battery usage monitors in Android etc)
Quoted 3 lines
will by definition be the only user of that mechanism. So the fact that Android is most probably the only user of suspend blockers does not prove anything about whether or not suspend blockers are sensible.
They don't appear to solve the constraints on power management that you have in other environments, nor do they happen to be conveniently backward compatible or available on other platforms - which makes code hard to port.
Quoted 2 lines
But that doesn't guarantee that solutions developed for PCs and laptops will be optimal (or even usable) on cellphones. Sufficient difference
Your cellphone is to all intents a laptop from ten years ago, it even has a similar display resolution and internet availability. The underlying difference between the two is solely form factor - the laptop had a better keyboard.
Quoted 4 lines
I hope that no one is arguing that Android will remain unchanged, just as I hope no one would argue that Linux will remain unchanged. In fact, I am quite confident that both Linux and Android will continue to change. So exactly what point were you attempting to make here?
That anything which ties to a particular style of behaviour and set of current usage assumptions is broken. If you rewrite all the apps to Android 2.1 and design in a single tasking model then you'll have to unrewrite half of it again when Android grows up. Ditto suspend blockers
- encode too much policy in your apps and you lose the ability to change the environment under them. See the mess Microsoft got into with Win16 on Win32. Compare with Linux 32bit on Linux 64bit.
Quoted 4 lines
As to busting all apps, lthough there have been situations where busting all the apps turned out to be the right thing to do, I agree that these situations are extremely rare. Such situations are usually associated with the emergence of a new high-volume platform.
Like Microsoft Windows 16bit co-operative multi-tasking ? It's rarely right. It's merely that in certain cases the value in the market is large enough that it can be used as a big stick to beat people into doing lots of usually wasted work.
Quoted 6 lines
Hmmm... Exactly which part do you consider flawed? Let's take it one sentence at a time. The devices that I know of that lack suspend blockers also lack opportunistic suspend. Therefore, all applications on such devices run as would an application that acquired a suspend blocker when it started and did not release that suspend blocker until it exited. Pretty straightforward.
What do you mean by "opportunistic suspend", lots of systems drop into lowest power states whenever they can. "Suspend is different" is a bit of Android religion that I am dubious has any basis in reality as seen from the application end of the universe.
You may also wish to review the earlier parts of the discussion where it was explicitly stated by several developers that they were using "suspend" type modes as power states already and not using suspend blockers. So it's being done, today on ARM and your statement is directly contradicting the code. Modern ARM processors and x86 MID devices can suspend and resume extremely fast (fast enough that the fact Linux x86 rewriting all the SMP alternatives on suspend/resume is a measurable problem). If this same property doesn't end up on big PC boxes in time then I'd be very surprised. At that point the openoffice with suspend blockers or oracle with suspend blockers question becomes rather relevant.
Quoted 3 lines
As for the first part of the second sentence, you yourself have argued that each and every application should be carefully written to avoid battery drain (or, equivalently, to promote energy efficiency), so
No. I've argued that applications need to be generally well behaved, not keep waking up, not burn cpu - which is a generic property applicable on all environments not a specialisation.
Quoted 6 lines
Quoted 4 lines
OpenOffice runs on netbooks, laptops, servers, even big non x86 boxes. It runs on virtual machines, it runs in power sensitive environments, it runs in thermally constrained environments, it runs in I/O constrained environments, it runs in latency constrained environments etc etc
And there are numerous environments in which it will not run. So what?
It's one codebase for all of them and furthermore almost all of that was done by modifying only the OS. Linux learned to do power throttling without the app being involved, it learned to do virtualisation without the app being changed, it is learning (with -rt) to handle to do real time this way.
Quoted 8 lines
Quoted 5 lines
All the same code, true some work has been done to make it behave politely but the rest is down to the OS doing its job - deploying the resources available while considering and obeying the constraints present, in a manner which makes best use of the resources to achieve the policy goals of the system.
And if the work has not been done on the application, and if there is nothing like suspend blockers, the OS cannot do its job.
I don't see any evidence to support that claim. I see evidence that there are cases where apps wish to communicate their intentions around power more clearly but a suspend blocker is a crude single case hammer. Today most applications communicate their sleep/wake requirements fairly well by sleeping, by executing code and by setting timers/alarms.
Quoted 9 lines
Given this context, are you sure that suspend blockers are not the next step in the Real OS progression? Or some QoS mechanism that subsumes suspend blockers? However, there is a lot of negative experience around general-purpose QoS mechanisms -- you have to be quite careful in order to avoid spending more energy computing QoS than you would otherwise spend on the application's computations. The usual way out of this trap is to abandon generality in favor of exploiting the commonly occurring special cases. For all I know, raw suspend blockers might be the appropriate special case.
For Android possibly and I've never had any objection to Android keeping suspend blockers in private patches. The claim is only a small number are needed in their kernel so its a tiddly patch and the patch context will no doubt keep it applying between releases and easy for them to maintain.
For the rest of us - I see no evidence it's generally useful. A QoS API does appear to be generally useful but as you say you need to get the performance right. However you can also tackle that the way we tackle several other examples of one interface/many needs - such as schedulers, security models and the like.
One interface to applications and one interface to drivers so that its easy to maintain and you don't end up with hooks all over the place for different things, then if it proves neccessary different implementations. So yes maybe Android would use a "qos_basic" which returns -EOPNOTSUPP to anything but a suspend blocker behaviour. The important thing about that is that my device drivers, my applications and my other platforms don't have to care that Android made this choice - they can still be generic code.
That is why I used the Win16 example. The Win16 model encapsulated an implementation into the API. Had they followed a more conventional interface based around yielding then like MacOS they'd have had a far smoother move to pre-emptive MT.
Alan
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 7 lines · Alan Cox
Quoted 2 lines
situation you call out can occur with manual suspend-to-RAM already:
the fact is that this is a design choice. You could indeed make aLosing data is a design choice ? The application set a timer, the OS shouldn't be ignoring it in that situation. It might want to delay it, it might want to warn the user its hogging things it shouldnt (powertop, battery usage monitors in Android etc)
So we should remove explicit system suspend from the kernel?
Quoted 12 lines
Quoted 6 lines
Hmmm... Exactly which part do you consider flawed? Let's take it one sentence at a time. The devices that I know of that lack suspend blockers also lack opportunistic suspend. Therefore, all applications on such devices run as would an application that acquired a suspend blocker when it started and did not release that suspend blocker until it exited. Pretty straightforward.
What do you mean by "opportunistic suspend", lots of systems drop into lowest power states whenever they can. "Suspend is different" is a bit of Android religion that I am dubious has any basis in reality as seen from the application end of the universe.
Quoted 10 lines
You may also wish to review the earlier parts of the discussion where it was explicitly stated by several developers that they were using "suspend" type modes as power states already and not using suspend blockers. So it's being done, today on ARM and your statement is directly contradicting the code. Modern ARM processors and x86 MID devices can suspend and resume extremely fast (fast enough that the fact Linux x86 rewriting all the SMP alternatives on suspend/resume is a measurable problem). If this same property doesn't end up on big PC boxes in time then I'd be very surprised. At that point the openoffice with suspend blockers or oracle with suspend blockers question becomes rather relevant.
There's a clear and absolute difference between system suspend and entering the same hardware state from the idle loop. That difference is that processes aren't scheduled until an explicit wakeup event occurs. Android is entirely capable of entering the same low power state at idle (it's done with a hardcoded idle loop on Qualcomm, cpuidle on omap), but if you have more than 0 scheduling wakeups a second then your power draw is going to be greater.
I agree that we should be targetting 0 wakeups per second. I don't agree that it's realistic to insist that a use model that assumes imperfect software is an invalid use model.
Signature · 1 line
Matthew Garrett | [email protected]
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Alan CoxQuoted 7 lines · Alan Cox
Quoted 2 lines
situation you call out can occur with manual suspend-to-RAM already:
the fact is that this is a design choice. You could indeed make aLosing data is a design choice ? The application set a timer, the OS shouldn't be ignoring it in that situation. It might want to delay it, it might want to warn the user its hogging things it shouldnt (powertop, battery usage monitors in Android etc)
So we should remove explicit system suspend from the kernel?
Quoted 12 lines
Quoted 6 lines
Hmmm... Exactly which part do you consider flawed? Let's take it one sentence at a time. The devices that I know of that lack suspend blockers also lack opportunistic suspend. Therefore, all applications on such devices run as would an application that acquired a suspend blocker when it started and did not release that suspend blocker until it exited. Pretty straightforward.
What do you mean by "opportunistic suspend", lots of systems drop into lowest power states whenever they can. "Suspend is different" is a bit of Android religion that I am dubious has any basis in reality as seen from the application end of the universe.
Quoted 10 lines
You may also wish to review the earlier parts of the discussion where it was explicitly stated by several developers that they were using "suspend" type modes as power states already and not using suspend blockers. So it's being done, today on ARM and your statement is directly contradicting the code. Modern ARM processors and x86 MID devices can suspend and resume extremely fast (fast enough that the fact Linux x86 rewriting all the SMP alternatives on suspend/resume is a measurable problem). If this same property doesn't end up on big PC boxes in time then I'd be very surprised. At that point the openoffice with suspend blockers or oracle with suspend blockers question becomes rather relevant.
There's a clear and absolute difference between system suspend and entering the same hardware state from the idle loop. That difference is that processes aren't scheduled until an explicit wakeup event occurs. Android is entirely capable of entering the same low power state at idle (it's done with a hardcoded idle loop on Qualcomm, cpuidle on omap), but if you have more than 0 scheduling wakeups a second then your power draw is going to be greater.
I agree that we should be targetting 0 wakeups per second. I don't agree that it's realistic to insist that a use model that assumes imperfect software is an invalid use model.
Signature · 1 line
Matthew Garrett | [email protected]
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 6 lines
Quoted 4 lines
Losing data is a design choice ? The application set a timer, the OS shouldn't be ignoring it in that situation. It might want to delay it, it might want to warn the user its hogging things it shouldnt (powertop, battery usage monitors in Android etc)
So we should remove explicit system suspend from the kernel?
Explicit suspend is user triggered - in the laptop case its a bit different. I don't btw like the fact that a laptop explicit suspend doesn't end up as a dbus "save data" and openoffice save (or it didn't last time I looked which is a while ago).
Quoted 7 lines
There's a clear and absolute difference between system suspend and entering the same hardware state from the idle loop. That difference is that processes aren't scheduled until an explicit wakeup event occurs. Android is entirely capable of entering the same low power state at idle (it's done with a hardcoded idle loop on Qualcomm, cpuidle on omap), but if you have more than 0 scheduling wakeups a second then your power draw is going to be greater.
And nothing stops you also implementing a 'forced' suspend, although you can do that nicely by simply stopping the process group that contains the stuff you don't want to stop suspend and dropping into suspend when you idle.
Quoted 3 lines
I agree that we should be targetting 0 wakeups per second. I don't agree that it's realistic to insist that a use model that assumes imperfect software is an invalid use model.
No argument.
The question is what applications should be expressing to the kernel which is not tied to assumptions like 'suspend mode' and which is generic.
We don't have xfs stuff for example splattered all over userspace and in lots of drivers - we have generic interfaces. That way user community A doesn't have to care about user community B's choices, and JFFS flash fs people don't offend big data centre people and vice versa.
Alan
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 11 lines · Alan Cox
Quoted 6 lines
Quoted 4 lines
Losing data is a design choice ? The application set a timer, the OS shouldn't be ignoring it in that situation. It might want to delay it, it might want to warn the user its hogging things it shouldnt (powertop, battery usage monitors in Android etc)
So we should remove explicit system suspend from the kernel?
Explicit suspend is user triggered - in the laptop case its a bit different. I don't btw like the fact that a laptop explicit suspend doesn't end up as a dbus "save data" and openoffice save (or it didn't last time I looked which is a while ago).
It's not inherently user triggered. Machines typically have an idle timeout that triggers suspend. This differs from the Android opportunistic suspend approach only in that the timeout is significantly larger, primarily due to the greater latency involved.
Quoted 8 lines
Quoted 7 lines
There's a clear and absolute difference between system suspend and entering the same hardware state from the idle loop. That difference is that processes aren't scheduled until an explicit wakeup event occurs. Android is entirely capable of entering the same low power state at idle (it's done with a hardcoded idle loop on Qualcomm, cpuidle on omap), but if you have more than 0 scheduling wakeups a second then your power draw is going to be greater.
Quoted 4 lines
And nothing stops you also implementing a 'forced' suspend, although you can do that nicely by simply stopping the process group that contains the stuff you don't want to stop suspend and dropping into suspend when you idle.
We've already had the discussion about this resulting in potential deadlocks if there's any intercommunication between the trusted and untrusted apps, and if untrusted apps can be the consumers of wakeup events then you still end up with the wake event race condition. If we want to avoid the case where system suspend can cause wakeup events to be lost, we're pretty much required to implement something like suspend blocks (and, in fact, Rafael's implementation of this is already mainline).
Quoted 6 lines
Quoted 3 lines
I agree that we should be targetting 0 wakeups per second. I don't agree that it's realistic to insist that a use model that assumes imperfect software is an invalid use model.
No argument.
Quoted 7 lines
The question is what applications should be expressing to the kernel which is not tied to assumptions like 'suspend mode' and which is generic.
We don't have xfs stuff for example splattered all over userspace and in lots of drivers - we have generic interfaces. That way user community A doesn't have to care about user community B's choices, and JFFS flash fs people don't offend big data centre people and vice versa.
I wholeheartedly agree. But nobody has yet provided a generic approach to avoiding the loss of wakeup events, and that's an issue you can hit whenever you use full-system suspend - it's not a problem that's unique to Android.
Signature · 1 line
Matthew Garrett | [email protected]
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Alan CoxQuoted 11 lines · Alan Cox
Quoted 6 lines
Quoted 4 lines
Losing data is a design choice ? The application set a timer, the OS shouldn't be ignoring it in that situation. It might want to delay it, it might want to warn the user its hogging things it shouldnt (powertop, battery usage monitors in Android etc)
So we should remove explicit system suspend from the kernel?
Explicit suspend is user triggered - in the laptop case its a bit different. I don't btw like the fact that a laptop explicit suspend doesn't end up as a dbus "save data" and openoffice save (or it didn't last time I looked which is a while ago).
It's not inherently user triggered. Machines typically have an idle timeout that triggers suspend. This differs from the Android opportunistic suspend approach only in that the timeout is significantly larger, primarily due to the greater latency involved.
Quoted 8 lines
Quoted 7 lines
There's a clear and absolute difference between system suspend and entering the same hardware state from the idle loop. That difference is that processes aren't scheduled until an explicit wakeup event occurs. Android is entirely capable of entering the same low power state at idle (it's done with a hardcoded idle loop on Qualcomm, cpuidle on omap), but if you have more than 0 scheduling wakeups a second then your power draw is going to be greater.
Quoted 4 lines
And nothing stops you also implementing a 'forced' suspend, although you can do that nicely by simply stopping the process group that contains the stuff you don't want to stop suspend and dropping into suspend when you idle.
We've already had the discussion about this resulting in potential deadlocks if there's any intercommunication between the trusted and untrusted apps, and if untrusted apps can be the consumers of wakeup events then you still end up with the wake event race condition. If we want to avoid the case where system suspend can cause wakeup events to be lost, we're pretty much required to implement something like suspend blocks (and, in fact, Rafael's implementation of this is already mainline).
Quoted 6 lines
Quoted 3 lines
I agree that we should be targetting 0 wakeups per second. I don't agree that it's realistic to insist that a use model that assumes imperfect software is an invalid use model.
No argument.
Quoted 7 lines
The question is what applications should be expressing to the kernel which is not tied to assumptions like 'suspend mode' and which is generic.
We don't have xfs stuff for example splattered all over userspace and in lots of drivers - we have generic interfaces. That way user community A doesn't have to care about user community B's choices, and JFFS flash fs people don't offend big data centre people and vice versa.
I wholeheartedly agree. But nobody has yet provided a generic approach to avoiding the loss of wakeup events, and that's an issue you can hit whenever you use full-system suspend - it's not a problem that's unique to Android.
Signature · 1 line
Matthew Garrett | [email protected]
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Matthew GarrettWhich reminds me. I forgot a very important way that user space signals the kernel as to its intents.
The kernel can see whether code is sleeping by choice or sleeping because someone blocked it (eg a page fault). The kernel also knows a lot about the event being waited for (much more so in -rt than base).
We don't capture all of that info but it seems it would advance progress in the right direction to do so better.
Alan
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 9 lines · Alan Cox
Which reminds me. I forgot a very important way that user space signals the kernel as to its intents.
The kernel can see whether code is sleeping by choice or sleeping because someone blocked it (eg a page fault). The kernel also knows a lot about the event being waited for (much more so in -rt than base).
We don't capture all of that info but it seems it would advance progress in the right direction to do so better.
As one approach of many, this makes a great deal of sense.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Alan CoxQuoted 9 lines · Alan Cox
Which reminds me. I forgot a very important way that user space signals the kernel as to its intents.
The kernel can see whether code is sleeping by choice or sleeping because someone blocked it (eg a page fault). The kernel also knows a lot about the event being waited for (much more so in -rt than base).
We don't capture all of that info but it seems it would advance progress in the right direction to do so better.
As one approach of many, this makes a great deal of sense.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Matthew GarrettWhich reminds me. I forgot a very important way that user space signals the kernel as to its intents.
The kernel can see whether code is sleeping by choice or sleeping because someone blocked it (eg a page fault). The kernel also knows a lot about the event being waited for (much more so in -rt than base).
We don't capture all of that info but it seems it would advance progress in the right direction to do so better.
Alan
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Matthew GarrettQuoted 32 lines · Matthew Garrett
Quoted 12 lines · Alan Cox
Quoted 6 lines
Hmmm... Exactly which part do you consider flawed? Let's take it one sentence at a time. The devices that I know of that lack suspend blockers also lack opportunistic suspend. Therefore, all applications on such devices run as would an application that acquired a suspend blocker when it started and did not release that suspend blocker until it exited. Pretty straightforward.
What do you mean by "opportunistic suspend", lots of systems drop into lowest power states whenever they can. "Suspend is different" is a bit of Android religion that I am dubious has any basis in reality as seen from the application end of the universe.
Quoted 10 lines
You may also wish to review the earlier parts of the discussion where it was explicitly stated by several developers that they were using "suspend" type modes as power states already and not using suspend blockers. So it's being done, today on ARM and your statement is directly contradicting the code. Modern ARM processors and x86 MID devices can suspend and resume extremely fast (fast enough that the fact Linux x86 rewriting all the SMP alternatives on suspend/resume is a measurable problem). If this same property doesn't end up on big PC boxes in time then I'd be very surprised. At that point the openoffice with suspend blockers or oracle with suspend blockers question becomes rather relevant.
There's a clear and absolute difference between system suspend and entering the same hardware state from the idle loop. That difference is that processes aren't scheduled until an explicit wakeup event occurs. Android is entirely capable of entering the same low power state at idle (it's done with a hardcoded idle loop on Qualcomm, cpuidle on omap), but if you have more than 0 scheduling wakeups a second then your power draw is going to be greater.
Quoted 3 lines
I agree that we should be targetting 0 wakeups per second. I don't agree that it's realistic to insist that a use model that assumes imperfect software is an invalid use model.
If the primary difference between sleep and suspend is not scheduling processes, instead of messing with oppurtinistic suspend/suspend blockers/wakelocks/etc, why not just 'temporarily' change the timer fuzz value to a very large value (say an hour). That would still let things like openoffice saves ahve a fair chance to trigger before the battery died completely, but would wake the system so infrequently that it will be effectivly the same as a full suspend.
David Lang
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 7 lines · On Tue, Aug 10, 2010 at 11:07:20AM -0700, [email protected] wrote:
If the primary difference between sleep and suspend is not scheduling processes, instead of messing with oppurtinistic suspend/suspend blockers/wakelocks/etc, why not just 'temporarily' change the timer fuzz value to a very large value (say an hour). That would still let things like openoffice saves ahve a fair chance to trigger before the battery died completely, but would wake the system so infrequently that it will be effectivly the same as a full suspend.
Because it only affects processes that sleep. It's a question of how much pathology you want to be able to tolerate.
Signature · 1 line
Matthew Garrett | [email protected]
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to [email protected]Quoted 7 lines · On Tue, Aug 10, 2010 at 11:07:20AM -0700, [email protected] wrote:
If the primary difference between sleep and suspend is not scheduling processes, instead of messing with oppurtinistic suspend/suspend blockers/wakelocks/etc, why not just 'temporarily' change the timer fuzz value to a very large value (say an hour). That would still let things like openoffice saves ahve a fair chance to trigger before the battery died completely, but would wake the system so infrequently that it will be effectivly the same as a full suspend.
Because it only affects processes that sleep. It's a question of how much pathology you want to be able to tolerate.
Signature · 1 line
Matthew Garrett | [email protected]
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 10 lines · Matthew Garrett
Quoted 7 lines · On Tue, Aug 10, 2010 at 11:07:20AM -0700, [email protected] wrote:
If the primary difference between sleep and suspend is not scheduling processes, instead of messing with oppurtinistic suspend/suspend blockers/wakelocks/etc, why not just 'temporarily' change the timer fuzz value to a very large value (say an hour). That would still let things like openoffice saves ahve a fair chance to trigger before the battery died completely, but would wake the system so infrequently that it will be effectivly the same as a full suspend.
Quoted 2 lines
Because it only affects processes that sleep. It's a question of how much pathology you want to be able to tolerate.
Standard system stats will show you hogs like this. The Android people claim that wakelock stats will let the user identify processes that prevent the system from suspending properly and then remove them. If this is the case, a process that never sleeps will be even easier to identify and even more obvious an offender.
If that isn't enough, then you can go back to the other idea I advanced, having some way to tell the system not to consider some processes when trying to decide if the system should sleep or not.
David Lang
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Matthew GarrettQuoted 10 lines · Matthew Garrett
Quoted 7 lines · On Tue, Aug 10, 2010 at 11:07:20AM -0700, [email protected] wrote:
If the primary difference between sleep and suspend is not scheduling processes, instead of messing with oppurtinistic suspend/suspend blockers/wakelocks/etc, why not just 'temporarily' change the timer fuzz value to a very large value (say an hour). That would still let things like openoffice saves ahve a fair chance to trigger before the battery died completely, but would wake the system so infrequently that it will be effectivly the same as a full suspend.
Quoted 2 lines
Because it only affects processes that sleep. It's a question of how much pathology you want to be able to tolerate.
Standard system stats will show you hogs like this. The Android people claim that wakelock stats will let the user identify processes that prevent the system from suspending properly and then remove them. If this is the case, a process that never sleeps will be even easier to identify and even more obvious an offender.
If that isn't enough, then you can go back to the other idea I advanced, having some way to tell the system not to consider some processes when trying to decide if the system should sleep or not.
David Lang
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Alan CoxQuoted 7 lines · Alan Cox
Quoted 2 lines
situation you call out can occur with manual suspend-to-RAM already:
the fact is that this is a design choice. You could indeed make aLosing data is a design choice ? The application set a timer, the OS shouldn't be ignoring it in that situation. It might want to delay it, it might want to warn the user its hogging things it shouldnt (powertop, battery usage monitors in Android etc)
Hmmm... Let's put the two approaches side by side so that we can compare them more easily:
Opportunistic Suspend Idle + Timer Jitter
Set timer Set timer
Suspend OS delays timer
Resume OS continues delaying timer
Timer fires Timer fires
These two cases look quite similar to me.
But as you say, the battery can run out. So let's add that to the comparison:
Opportunistic Suspend Idle + Timer Jitter
Set timer Set timer
Suspend OS delays timer
Battery runs out Battery runs out
Data loss Data loss
The two cases still look quite similar. You might note, quite correctly, that the time between suspend and resume might be quite a bit longer than the typical time that the OS delays a timer. But the power consumption on some platforms is quite a bit lower in the suspend case than it is in the delayed-timer case.
Quoted 8 lines
Quoted 3 lines
will by definition be the only user of that mechanism. So the fact that Android is most probably the only user of suspend blockers does not prove anything about whether or not suspend blockers are sensible.
They don't appear to solve the constraints on power management that you have in other environments, nor do they happen to be conveniently backward compatible or available on other platforms - which makes code hard to port.
There does seem to be some debate (if you can call it that) over whether suspend blockers (or something like them) apply to non-Android environments, though I do understand that you believe that suspend blockers are relevant only to Android. And indeed, adding features to a particular platform can degrade portability, but the same is true of any number of pre-existing Linux-specific features.
Quoted 7 lines
Quoted 2 lines
But that doesn't guarantee that solutions developed for PCs and laptops will be optimal (or even usable) on cellphones. Sufficient difference
Your cellphone is to all intents a laptop from ten years ago, it even has a similar display resolution and internet availability. The underlying difference between the two is solely form factor - the laptop had a better keyboard.
There are similarities and differences. You have called out some of the similarities. Differences include the more-aggressive hardware power management on cellphones, the greater number and variety of hardware accelerators on cellphones, battery capacity, and, as you say, physical size. People currently use cellphones differently than they do laptops or desktops. The usage might converge, but we will see. There is as much reason to expect increasing specialization as there is to expect increasing convergence.
Quoted 5 lines
Quoted 4 lines
I hope that no one is arguing that Android will remain unchanged, just as I hope no one would argue that Linux will remain unchanged. In fact, I am quite confident that both Linux and Android will continue to change. So exactly what point were you attempting to make here?
Quoted 7 lines
That anything which ties to a particular style of behaviour and set of current usage assumptions is broken. If you rewrite all the apps to Android 2.1 and design in a single tasking model then you'll have to unrewrite half of it again when Android grows up. Ditto suspend blockers
- encode too much policy in your apps and you lose the ability to change the environment under them. See the mess Microsoft got into with Win16 on Win32. Compare with Linux 32bit on Linux 64bit.
Yes, sooner or later, changes in environment and usage will break our assumptions. This includes your assumptions, my assumptions, the Android folks' assumptions, and everyone else's assumptions. We nevertheless build things anyway.
A better comparison for Win16->Win32 would be UNIX's move from 16-bit PDP-11 to 32-bit VAX. There was plenty of screaming over that one.
Quoted 9 lines
Quoted 4 lines
As to busting all apps, lthough there have been situations where busting all the apps turned out to be the right thing to do, I agree that these situations are extremely rare. Such situations are usually associated with the emergence of a new high-volume platform.
Like Microsoft Windows 16bit co-operative multi-tasking ? It's rarely right. It's merely that in certain cases the value in the market is large enough that it can be used as a big stick to beat people into doing lots of usually wasted work.
Interesting choice of example. I do well remember the Sequent hardware guys' frustration when the old printer driver would monopolize the desktop while printing their large documents. The fact was that Microsoft's co-operative multi-tasking required all applications to be well behaved, just as does your approach to power efficiency.
Quoted 11 lines
Quoted 6 lines
Hmmm... Exactly which part do you consider flawed? Let's take it one sentence at a time. The devices that I know of that lack suspend blockers also lack opportunistic suspend. Therefore, all applications on such devices run as would an application that acquired a suspend blocker when it started and did not release that suspend blocker until it exited. Pretty straightforward.
What do you mean by "opportunistic suspend", lots of systems drop into lowest power states whenever they can. "Suspend is different" is a bit of Android religion that I am dubious has any basis in reality as seen from the application end of the universe.
Opportunistic suspend has been well defined in this discussion. I do understand that you don't like opportunistic suspend, but your distaste for it does not undefine it.
Quoted 10 lines
You may also wish to review the earlier parts of the discussion where it was explicitly stated by several developers that they were using "suspend" type modes as power states already and not using suspend blockers. So it's being done, today on ARM and your statement is directly contradicting the code. Modern ARM processors and x86 MID devices can suspend and resume extremely fast (fast enough that the fact Linux x86 rewriting all the SMP alternatives on suspend/resume is a measurable problem). If this same property doesn't end up on big PC boxes in time then I'd be very surprised. At that point the openoffice with suspend blockers or oracle with suspend blockers question becomes rather relevant.
Here is the list of properties distinguishing idle from suspend:
1. Idle states are entered by a given CPU only there are no runnable
tasks for that CPU. In contrast, opportunistic suspend can halt the entire system even when there are tasks that are ready, willing, and able to run. (But please note that this might not apply to real-time tasks.)
2. There can be a set of input events that do not bring the system
out of suspend, but which would bring the system out of idle. Exactly which events are in this set depends both on hardware capabilities and on the platform/application policy. For example, on one of the Android-based smartphones, touchscreen input is ignored when the system is suspended, but is handled when idle.
3. The system comes out of idle when a timer expires. In contrast,
timers might or might not bring the system out of suspend, depending on both hardware capabilities and platform/application policy.
4. Suspend generally forces devices to go into their low-power
states immediately. In contrast, idle generally leaves unused devices at full power, relying on timers to shut down these devices. Idle thus has shorter average wakeup latencies, but worse energy efficiency.
5. Suspend usually has longer wakeup latency than does idle.
This list was compiled from this thread.
It is the above semantics rather than the particular C-state that makes the difference between idle and suspend. Yes, you have claimed that idle will render suspend obsolete, but you have not yet convinced me.
Quoted 7 lines
Quoted 3 lines
As for the first part of the second sentence, you yourself have argued that each and every application should be carefully written to avoid battery drain (or, equivalently, to promote energy efficiency), so
No. I've argued that applications need to be generally well behaved, not keep waking up, not burn cpu - which is a generic property applicable on all environments not a specialisation.
Either way you prefer to word it is fine by me -- I am fine with either "carefully written" or "generally well behaved". Alternatively, if you were trying to say something different than what I said, I failed to spot the difference.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
OpenOffice runs on netbooks, laptops, servers, even big non x86 boxes. It runs on virtual machines, it runs in power sensitive environments, it runs in thermally constrained environments, it runs in I/O constrained environments, it runs in latency constrained environments etc etc
And there are numerous environments in which it will not run. So what?
It's one codebase for all of them
Yes, and there are still numerous environments where it does not run.
Quoted 5 lines
and furthermore almost all of that was
done by modifying only the OS. Linux learned to do power throttling without the app being involved, it learned to do virtualisation without the app being changed, it is learning (with -rt) to handle to do real time this way.
Except that you do modify the app to more effectively throttle power. Which is fine; I have no problem with that. I also have no problem with things that reduce the need to modify the apps to more effectively throttle power.
Real time indeed allows unmodified non-real-time apps to stay out of the way of very carefully written real-time apps, so I do like that example.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
All the same code, true some work has been done to make it behave politely but the rest is down to the OS doing its job - deploying the resources available while considering and obeying the constraints present, in a manner which makes best use of the resources to achieve the policy goals of the system.
Quoted 8 lines
Quoted 2 lines
And if the work has not been done on the application, and if there is nothing like suspend blockers, the OS cannot do its job.
I don't see any evidence to support that claim. I see evidence that there are cases where apps wish to communicate their intentions around power more clearly but a suspend blocker is a crude single case hammer. Today most applications communicate their sleep/wake requirements fairly well by sleeping, by executing code and by setting timers/alarms.
I will take your "there are cases where apps wish to communicate their intentions around power more clearly", thank you very much. And yes, there is much debate over exactly what form that communication might take.
Quoted 15 lines
Quoted 9 lines
Given this context, are you sure that suspend blockers are not the next step in the Real OS progression? Or some QoS mechanism that subsumes suspend blockers? However, there is a lot of negative experience around general-purpose QoS mechanisms -- you have to be quite careful in order to avoid spending more energy computing QoS than you would otherwise spend on the application's computations. The usual way out of this trap is to abandon generality in favor of exploiting the commonly occurring special cases. For all I know, raw suspend blockers might be the appropriate special case.
For Android possibly and I've never had any objection to Android keeping suspend blockers in private patches. The claim is only a small number are needed in their kernel so its a tiddly patch and the patch context will no doubt keep it applying between releases and easy for them to maintain.
Quoted 5 lines
For the rest of us - I see no evidence it's generally useful. A QoS API does appear to be generally useful but as you say you need to get the performance right. However you can also tackle that the way we tackle several other examples of one interface/many needs - such as schedulers, security models and the like.
No one will know whether or not suspend blockers are generally useful until they are willing to try them.
Quoted 8 lines
One interface to applications and one interface to drivers so that its easy to maintain and you don't end up with hooks all over the place for different things, then if it proves neccessary different implementations. So yes maybe Android would use a "
qos_basic" which returns-EOPNOTSUPPto anything but a suspend blocker behaviour. The important thing about that is that my device drivers, my applications and my other platforms don't have to care that Android made this choice - they can still be generic code.
If this can actually happen, I would consider it a good thing.
Of course, we might well find out some years down the road that the qos_basic piece is the only part that was actually in common use. Then again, it would not be the first time. System-V semaphores, anyone? ;-)
Quoted 4 lines
That is why I used the Win16 example. The Win16 model encapsulated an implementation into the API. Had they followed a more conventional interface based around yielding then like MacOS they'd have had a far smoother move to pre-emptive MT.
I am certainly no fan of Win16. That said, if there is a qos_basic that maps nicely to suspend blockers, the risk of adding suspend blockers in their current form seems to me to be rather low.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Alan CoxQuoted 7 lines · Alan Cox
Quoted 2 lines
situation you call out can occur with manual suspend-to-RAM already:
the fact is that this is a design choice. You could indeed make aLosing data is a design choice ? The application set a timer, the OS shouldn't be ignoring it in that situation. It might want to delay it, it might want to warn the user its hogging things it shouldnt (powertop, battery usage monitors in Android etc)
Hmmm... Let's put the two approaches side by side so that we can compare them more easily:
Opportunistic Suspend Idle + Timer Jitter
Set timer Set timer
Suspend OS delays timer
Resume OS continues delaying timer
Timer fires Timer fires
These two cases look quite similar to me.
But as you say, the battery can run out. So let's add that to the comparison:
Opportunistic Suspend Idle + Timer Jitter
Set timer Set timer
Suspend OS delays timer
Battery runs out Battery runs out
Data loss Data loss
The two cases still look quite similar. You might note, quite correctly, that the time between suspend and resume might be quite a bit longer than the typical time that the OS delays a timer. But the power consumption on some platforms is quite a bit lower in the suspend case than it is in the delayed-timer case.
Quoted 8 lines
Quoted 3 lines
will by definition be the only user of that mechanism. So the fact that Android is most probably the only user of suspend blockers does not prove anything about whether or not suspend blockers are sensible.
They don't appear to solve the constraints on power management that you have in other environments, nor do they happen to be conveniently backward compatible or available on other platforms - which makes code hard to port.
There does seem to be some debate (if you can call it that) over whether suspend blockers (or something like them) apply to non-Android environments, though I do understand that you believe that suspend blockers are relevant only to Android. And indeed, adding features to a particular platform can degrade portability, but the same is true of any number of pre-existing Linux-specific features.
Quoted 7 lines
Quoted 2 lines
But that doesn't guarantee that solutions developed for PCs and laptops will be optimal (or even usable) on cellphones. Sufficient difference
Your cellphone is to all intents a laptop from ten years ago, it even has a similar display resolution and internet availability. The underlying difference between the two is solely form factor - the laptop had a better keyboard.
There are similarities and differences. You have called out some of the similarities. Differences include the more-aggressive hardware power management on cellphones, the greater number and variety of hardware accelerators on cellphones, battery capacity, and, as you say, physical size. People currently use cellphones differently than they do laptops or desktops. The usage might converge, but we will see. There is as much reason to expect increasing specialization as there is to expect increasing convergence.
Quoted 5 lines
Quoted 4 lines
I hope that no one is arguing that Android will remain unchanged, just as I hope no one would argue that Linux will remain unchanged. In fact, I am quite confident that both Linux and Android will continue to change. So exactly what point were you attempting to make here?
Quoted 7 lines
That anything which ties to a particular style of behaviour and set of current usage assumptions is broken. If you rewrite all the apps to Android 2.1 and design in a single tasking model then you'll have to unrewrite half of it again when Android grows up. Ditto suspend blockers
- encode too much policy in your apps and you lose the ability to change the environment under them. See the mess Microsoft got into with Win16 on Win32. Compare with Linux 32bit on Linux 64bit.
Yes, sooner or later, changes in environment and usage will break our assumptions. This includes your assumptions, my assumptions, the Android folks' assumptions, and everyone else's assumptions. We nevertheless build things anyway.
A better comparison for Win16->Win32 would be UNIX's move from 16-bit PDP-11 to 32-bit VAX. There was plenty of screaming over that one.
Quoted 9 lines
Quoted 4 lines
As to busting all apps, lthough there have been situations where busting all the apps turned out to be the right thing to do, I agree that these situations are extremely rare. Such situations are usually associated with the emergence of a new high-volume platform.
Like Microsoft Windows 16bit co-operative multi-tasking ? It's rarely right. It's merely that in certain cases the value in the market is large enough that it can be used as a big stick to beat people into doing lots of usually wasted work.
Interesting choice of example. I do well remember the Sequent hardware guys' frustration when the old printer driver would monopolize the desktop while printing their large documents. The fact was that Microsoft's co-operative multi-tasking required all applications to be well behaved, just as does your approach to power efficiency.
Quoted 11 lines
Quoted 6 lines
Hmmm... Exactly which part do you consider flawed? Let's take it one sentence at a time. The devices that I know of that lack suspend blockers also lack opportunistic suspend. Therefore, all applications on such devices run as would an application that acquired a suspend blocker when it started and did not release that suspend blocker until it exited. Pretty straightforward.
What do you mean by "opportunistic suspend", lots of systems drop into lowest power states whenever they can. "Suspend is different" is a bit of Android religion that I am dubious has any basis in reality as seen from the application end of the universe.
Opportunistic suspend has been well defined in this discussion. I do understand that you don't like opportunistic suspend, but your distaste for it does not undefine it.
Quoted 10 lines
You may also wish to review the earlier parts of the discussion where it was explicitly stated by several developers that they were using "suspend" type modes as power states already and not using suspend blockers. So it's being done, today on ARM and your statement is directly contradicting the code. Modern ARM processors and x86 MID devices can suspend and resume extremely fast (fast enough that the fact Linux x86 rewriting all the SMP alternatives on suspend/resume is a measurable problem). If this same property doesn't end up on big PC boxes in time then I'd be very surprised. At that point the openoffice with suspend blockers or oracle with suspend blockers question becomes rather relevant.
Here is the list of properties distinguishing idle from suspend:
1. Idle states are entered by a given CPU only there are no runnable
tasks for that CPU. In contrast, opportunistic suspend can halt the entire system even when there are tasks that are ready, willing, and able to run. (But please note that this might not apply to real-time tasks.)
2. There can be a set of input events that do not bring the system
out of suspend, but which would bring the system out of idle. Exactly which events are in this set depends both on hardware capabilities and on the platform/application policy. For example, on one of the Android-based smartphones, touchscreen input is ignored when the system is suspended, but is handled when idle.
3. The system comes out of idle when a timer expires. In contrast,
timers might or might not bring the system out of suspend, depending on both hardware capabilities and platform/application policy.
4. Suspend generally forces devices to go into their low-power
states immediately. In contrast, idle generally leaves unused devices at full power, relying on timers to shut down these devices. Idle thus has shorter average wakeup latencies, but worse energy efficiency.
5. Suspend usually has longer wakeup latency than does idle.
This list was compiled from this thread.
It is the above semantics rather than the particular C-state that makes the difference between idle and suspend. Yes, you have claimed that idle will render suspend obsolete, but you have not yet convinced me.
Quoted 7 lines
Quoted 3 lines
As for the first part of the second sentence, you yourself have argued that each and every application should be carefully written to avoid battery drain (or, equivalently, to promote energy efficiency), so
No. I've argued that applications need to be generally well behaved, not keep waking up, not burn cpu - which is a generic property applicable on all environments not a specialisation.
Either way you prefer to word it is fine by me -- I am fine with either "carefully written" or "generally well behaved". Alternatively, if you were trying to say something different than what I said, I failed to spot the difference.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
OpenOffice runs on netbooks, laptops, servers, even big non x86 boxes. It runs on virtual machines, it runs in power sensitive environments, it runs in thermally constrained environments, it runs in I/O constrained environments, it runs in latency constrained environments etc etc
And there are numerous environments in which it will not run. So what?
It's one codebase for all of them
Yes, and there are still numerous environments where it does not run.
Quoted 5 lines
and furthermore almost all of that was
done by modifying only the OS. Linux learned to do power throttling without the app being involved, it learned to do virtualisation without the app being changed, it is learning (with -rt) to handle to do real time this way.
Except that you do modify the app to more effectively throttle power. Which is fine; I have no problem with that. I also have no problem with things that reduce the need to modify the apps to more effectively throttle power.
Real time indeed allows unmodified non-real-time apps to stay out of the way of very carefully written real-time apps, so I do like that example.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
All the same code, true some work has been done to make it behave politely but the rest is down to the OS doing its job - deploying the resources available while considering and obeying the constraints present, in a manner which makes best use of the resources to achieve the policy goals of the system.
Quoted 8 lines
Quoted 2 lines
And if the work has not been done on the application, and if there is nothing like suspend blockers, the OS cannot do its job.
I don't see any evidence to support that claim. I see evidence that there are cases where apps wish to communicate their intentions around power more clearly but a suspend blocker is a crude single case hammer. Today most applications communicate their sleep/wake requirements fairly well by sleeping, by executing code and by setting timers/alarms.
I will take your "there are cases where apps wish to communicate their intentions around power more clearly", thank you very much. And yes, there is much debate over exactly what form that communication might take.
Quoted 15 lines
Quoted 9 lines
Given this context, are you sure that suspend blockers are not the next step in the Real OS progression? Or some QoS mechanism that subsumes suspend blockers? However, there is a lot of negative experience around general-purpose QoS mechanisms -- you have to be quite careful in order to avoid spending more energy computing QoS than you would otherwise spend on the application's computations. The usual way out of this trap is to abandon generality in favor of exploiting the commonly occurring special cases. For all I know, raw suspend blockers might be the appropriate special case.
For Android possibly and I've never had any objection to Android keeping suspend blockers in private patches. The claim is only a small number are needed in their kernel so its a tiddly patch and the patch context will no doubt keep it applying between releases and easy for them to maintain.
Quoted 5 lines
For the rest of us - I see no evidence it's generally useful. A QoS API does appear to be generally useful but as you say you need to get the performance right. However you can also tackle that the way we tackle several other examples of one interface/many needs - such as schedulers, security models and the like.
No one will know whether or not suspend blockers are generally useful until they are willing to try them.
Quoted 8 lines
One interface to applications and one interface to drivers so that its easy to maintain and you don't end up with hooks all over the place for different things, then if it proves neccessary different implementations. So yes maybe Android would use a "
qos_basic" which returns-EOPNOTSUPPto anything but a suspend blocker behaviour. The important thing about that is that my device drivers, my applications and my other platforms don't have to care that Android made this choice - they can still be generic code.
If this can actually happen, I would consider it a good thing.
Of course, we might well find out some years down the road that the qos_basic piece is the only part that was actually in common use. Then again, it would not be the first time. System-V semaphores, anyone? ;-)
Quoted 4 lines
That is why I used the Win16 example. The Win16 model encapsulated an implementation into the API. Had they followed a more conventional interface based around yielding then like MacOS they'd have had a far smoother move to pre-emptive MT.
I am certainly no fan of Win16. That said, if there is a qos_basic that maps nicely to suspend blockers, the risk of adding suspend blockers in their current form seems to me to be rather low.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 31 lines · Paul E. McKenney
Quoted 7 lines · Alan Cox
Quoted 2 lines
situation you call out can occur with manual suspend-to-RAM already:
the fact is that this is a design choice. You could indeed make aLosing data is a design choice ? The application set a timer, the OS shouldn't be ignoring it in that situation. It might want to delay it, it might want to warn the user its hogging things it shouldnt (powertop, battery usage monitors in Android etc)
Hmmm... Let's put the two approaches side by side so that we can compare them more easily:
Opportunistic Suspend Idle + Timer Jitter
Set timer Set timer
Suspend OS delays timer
Resume OS continues delaying timer
Timer fires Timer firesThese two cases look quite similar to me.
But as you say, the battery can run out. So let's add that to the comparison:
Opportunistic Suspend Idle + Timer Jitter
Set timer Set timer
Suspend OS delays timer
Battery runs out Battery runs out
Data loss Data loss
Quoted 5 lines
The two cases still look quite similar. You might note, quite correctly, that the time between suspend and resume might be quite a bit longer than the typical time that the OS delays a timer. But the power consumption on some platforms is quite a bit lower in the suspend case than it is in the delayed-timer case.
it has been stated that the android can hit the exact same power state either with sleep or suspend, and that the same clock can wake it up (it appears as a timer expiring for sleep, or an alarm for suspend, but it's the same clock firing the signal)
so in at least some cases the hardware supports doing both with equal efficiency.
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
But that doesn't guarantee that solutions developed for PCs and laptops will be optimal (or even usable) on cellphones. Sufficient difference
Your cellphone is to all intents a laptop from ten years ago, it even has a similar display resolution and internet availability. The underlying difference between the two is solely form factor - the laptop had a better keyboard.
Quoted 8 lines
There are similarities and differences. You have called out some of the similarities. Differences include the more-aggressive hardware power management on cellphones, the greater number and variety of hardware accelerators on cellphones, battery capacity, and, as you say, physical size. People currently use cellphones differently than they do laptops or desktops. The usage might converge, but we will see. There is as much reason to expect increasing specialization as there is to expect increasing convergence.
You are talking about Android as if it was a cell phone only thing, it's not. there are shipping tablets (and I believe netbooks, i.e. laptops) running andoid.
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines
As to busting all apps, lthough there have been situations where busting all the apps turned out to be the right thing to do, I agree that these situations are extremely rare. Such situations are usually associated with the emergence of a new high-volume platform.
Like Microsoft Windows 16bit co-operative multi-tasking ? It's rarely right. It's merely that in certain cases the value in the market is large enough that it can be used as a big stick to beat people into doing lots of usually wasted work.
Quoted 5 lines
Interesting choice of example. I do well remember the Sequent hardware guys' frustration when the old printer driver would monopolize the desktop while printing their large documents. The fact was that Microsoft's co-operative multi-tasking required all applications to be well behaved, just as does your approach to power efficiency.
and wakelocks require all applications that can take a wakelock be well behaved. and applications that do nt take a wakelock directly cannot expect to run unless something else takes a wakelock on their behalf
David Lang
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Paul E. McKenneyQuoted 31 lines · Paul E. McKenney
Quoted 7 lines · Alan Cox
Quoted 2 lines
situation you call out can occur with manual suspend-to-RAM already:
the fact is that this is a design choice. You could indeed make aLosing data is a design choice ? The application set a timer, the OS shouldn't be ignoring it in that situation. It might want to delay it, it might want to warn the user its hogging things it shouldnt (powertop, battery usage monitors in Android etc)
Hmmm... Let's put the two approaches side by side so that we can compare them more easily:
Opportunistic Suspend Idle + Timer Jitter
Set timer Set timer
Suspend OS delays timer
Resume OS continues delaying timer
Timer fires Timer firesThese two cases look quite similar to me.
But as you say, the battery can run out. So let's add that to the comparison:
Opportunistic Suspend Idle + Timer Jitter
Set timer Set timer
Suspend OS delays timer
Battery runs out Battery runs out
Data loss Data loss
Quoted 5 lines
The two cases still look quite similar. You might note, quite correctly, that the time between suspend and resume might be quite a bit longer than the typical time that the OS delays a timer. But the power consumption on some platforms is quite a bit lower in the suspend case than it is in the delayed-timer case.
it has been stated that the android can hit the exact same power state either with sleep or suspend, and that the same clock can wake it up (it appears as a timer expiring for sleep, or an alarm for suspend, but it's the same clock firing the signal)
so in at least some cases the hardware supports doing both with equal efficiency.
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
But that doesn't guarantee that solutions developed for PCs and laptops will be optimal (or even usable) on cellphones. Sufficient difference
Your cellphone is to all intents a laptop from ten years ago, it even has a similar display resolution and internet availability. The underlying difference between the two is solely form factor - the laptop had a better keyboard.
Quoted 8 lines
There are similarities and differences. You have called out some of the similarities. Differences include the more-aggressive hardware power management on cellphones, the greater number and variety of hardware accelerators on cellphones, battery capacity, and, as you say, physical size. People currently use cellphones differently than they do laptops or desktops. The usage might converge, but we will see. There is as much reason to expect increasing specialization as there is to expect increasing convergence.
You are talking about Android as if it was a cell phone only thing, it's not. there are shipping tablets (and I believe netbooks, i.e. laptops) running andoid.
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines
As to busting all apps, lthough there have been situations where busting all the apps turned out to be the right thing to do, I agree that these situations are extremely rare. Such situations are usually associated with the emergence of a new high-volume platform.
Like Microsoft Windows 16bit co-operative multi-tasking ? It's rarely right. It's merely that in certain cases the value in the market is large enough that it can be used as a big stick to beat people into doing lots of usually wasted work.
Quoted 5 lines
Interesting choice of example. I do well remember the Sequent hardware guys' frustration when the old printer driver would monopolize the desktop while printing their large documents. The fact was that Microsoft's co-operative multi-tasking required all applications to be well behaved, just as does your approach to power efficiency.
and wakelocks require all applications that can take a wakelock be well behaved. and applications that do nt take a wakelock directly cannot expect to run unless something else takes a wakelock on their behalf
David Lang
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 39 lines · On Tue, Aug 10, 2010 at 06:28:39PM -0700, [email protected] wrote:
Quoted 31 lines · Paul E. McKenney
Quoted 7 lines · Alan Cox
Quoted 2 lines
situation you call out can occur with manual suspend-to-RAM already:
the fact is that this is a design choice. You could indeed make aLosing data is a design choice ? The application set a timer, the OS shouldn't be ignoring it in that situation. It might want to delay it, it might want to warn the user its hogging things it shouldnt (powertop, battery usage monitors in Android etc)
Hmmm... Let's put the two approaches side by side so that we can compare them more easily:
Opportunistic Suspend Idle + Timer Jitter
Set timer Set timer
Suspend OS delays timer
Resume OS continues delaying timer
Timer fires Timer firesThese two cases look quite similar to me.
But as you say, the battery can run out. So let's add that to the comparison:
Opportunistic Suspend Idle + Timer Jitter
Set timer Set timer
Suspend OS delays timer
Battery runs out Battery runs out
Data loss Data lossQuoted 5 lines
The two cases still look quite similar. You might note, quite correctly, that the time between suspend and resume might be quite a bit longer than the typical time that the OS delays a timer. But the power consumption on some platforms is quite a bit lower in the suspend case than it is in the delayed-timer case.
Quoted 7 lines
it has been stated that the android can hit the exact same power state either with sleep or suspend, and that the same clock can wake it up (it appears as a timer expiring for sleep, or an alarm for suspend, but it's the same clock firing the signal)
so in at least some cases the hardware supports doing both with equal efficiency.
It indeed has been so stated. But in this section we were discussing data loss, not hardware power-state capabilities.
Quoted 17 lines
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
But that doesn't guarantee that solutions developed for PCs and laptops will be optimal (or even usable) on cellphones. Sufficient difference
Your cellphone is to all intents a laptop from ten years ago, it even has a similar display resolution and internet availability. The underlying difference between the two is solely form factor - the laptop had a better keyboard.
Quoted 8 lines
There are similarities and differences. You have called out some of the similarities. Differences include the more-aggressive hardware power management on cellphones, the greater number and variety of hardware accelerators on cellphones, battery capacity, and, as you say, physical size. People currently use cellphones differently than they do laptops or desktops. The usage might converge, but we will see. There is as much reason to expect increasing specialization as there is to expect increasing convergence.
Quoted 3 lines
You are talking about Android as if it was a cell phone only thing, it's not. there are shipping tablets (and I believe netbooks, i.e. laptops) running andoid.
I was talking about cellphones. But yes, Android (and thus suspend blockers) are used for tablets as well as cellphones, thank you for reminding me!
Quoted 16 lines
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines
As to busting all apps, lthough there have been situations where busting all the apps turned out to be the right thing to do, I agree that these situations are extremely rare. Such situations are usually associated with the emergence of a new high-volume platform.
Like Microsoft Windows 16bit co-operative multi-tasking ? It's rarely right. It's merely that in certain cases the value in the market is large enough that it can be used as a big stick to beat people into doing lots of usually wasted work.
Quoted 5 lines
Interesting choice of example. I do well remember the Sequent hardware guys' frustration when the old printer driver would monopolize the desktop while printing their large documents. The fact was that Microsoft's co-operative multi-tasking required all applications to be well behaved, just as does your approach to power efficiency.
Quoted 4 lines
and wakelocks require all applications that can take a wakelock be well behaved. and applications that do nt take a wakelock directly cannot expect to run unless something else takes a wakelock on their behalf
Almost. Suspend blockers require that only those portions of a PM-driving application that hold a suspend blocker be carefully written to avoid wasting power.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to [email protected]Quoted 39 lines · On Tue, Aug 10, 2010 at 06:28:39PM -0700, [email protected] wrote:
Quoted 31 lines · Paul E. McKenney
Quoted 7 lines · Alan Cox
Quoted 2 lines
situation you call out can occur with manual suspend-to-RAM already:
the fact is that this is a design choice. You could indeed make aLosing data is a design choice ? The application set a timer, the OS shouldn't be ignoring it in that situation. It might want to delay it, it might want to warn the user its hogging things it shouldnt (powertop, battery usage monitors in Android etc)
Hmmm... Let's put the two approaches side by side so that we can compare them more easily:
Opportunistic Suspend Idle + Timer Jitter
Set timer Set timer
Suspend OS delays timer
Resume OS continues delaying timer
Timer fires Timer firesThese two cases look quite similar to me.
But as you say, the battery can run out. So let's add that to the comparison:
Opportunistic Suspend Idle + Timer Jitter
Set timer Set timer
Suspend OS delays timer
Battery runs out Battery runs out
Data loss Data lossQuoted 5 lines
The two cases still look quite similar. You might note, quite correctly, that the time between suspend and resume might be quite a bit longer than the typical time that the OS delays a timer. But the power consumption on some platforms is quite a bit lower in the suspend case than it is in the delayed-timer case.
Quoted 7 lines
it has been stated that the android can hit the exact same power state either with sleep or suspend, and that the same clock can wake it up (it appears as a timer expiring for sleep, or an alarm for suspend, but it's the same clock firing the signal)
so in at least some cases the hardware supports doing both with equal efficiency.
It indeed has been so stated. But in this section we were discussing data loss, not hardware power-state capabilities.
Quoted 17 lines
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
But that doesn't guarantee that solutions developed for PCs and laptops will be optimal (or even usable) on cellphones. Sufficient difference
Your cellphone is to all intents a laptop from ten years ago, it even has a similar display resolution and internet availability. The underlying difference between the two is solely form factor - the laptop had a better keyboard.
Quoted 8 lines
There are similarities and differences. You have called out some of the similarities. Differences include the more-aggressive hardware power management on cellphones, the greater number and variety of hardware accelerators on cellphones, battery capacity, and, as you say, physical size. People currently use cellphones differently than they do laptops or desktops. The usage might converge, but we will see. There is as much reason to expect increasing specialization as there is to expect increasing convergence.
Quoted 3 lines
You are talking about Android as if it was a cell phone only thing, it's not. there are shipping tablets (and I believe netbooks, i.e. laptops) running andoid.
I was talking about cellphones. But yes, Android (and thus suspend blockers) are used for tablets as well as cellphones, thank you for reminding me!
Quoted 16 lines
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines
As to busting all apps, lthough there have been situations where busting all the apps turned out to be the right thing to do, I agree that these situations are extremely rare. Such situations are usually associated with the emergence of a new high-volume platform.
Like Microsoft Windows 16bit co-operative multi-tasking ? It's rarely right. It's merely that in certain cases the value in the market is large enough that it can be used as a big stick to beat people into doing lots of usually wasted work.
Quoted 5 lines
Interesting choice of example. I do well remember the Sequent hardware guys' frustration when the old printer driver would monopolize the desktop while printing their large documents. The fact was that Microsoft's co-operative multi-tasking required all applications to be well behaved, just as does your approach to power efficiency.
Quoted 4 lines
and wakelocks require all applications that can take a wakelock be well behaved. and applications that do nt take a wakelock directly cannot expect to run unless something else takes a wakelock on their behalf
Almost. Suspend blockers require that only those portions of a PM-driving application that hold a suspend blocker be carefully written to avoid wasting power.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 47 lines · Paul E. McKenney
Subject: Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 44 lines · On Tue, Aug 10, 2010 at 06:28:39PM -0700, [email protected] wrote:
Quoted 31 lines · Paul E. McKenney
Quoted 7 lines · Alan Cox
Quoted 2 lines
situation you call out can occur with manual suspend-to-RAM already:
the fact is that this is a design choice. You could indeed make aLosing data is a design choice ? The application set a timer, the OS shouldn't be ignoring it in that situation. It might want to delay it, it might want to warn the user its hogging things it shouldnt (powertop, battery usage monitors in Android etc)
Hmmm... Let's put the two approaches side by side so that we can compare them more easily:
Opportunistic Suspend Idle + Timer Jitter
Set timer Set timer
Suspend OS delays timer
Resume OS continues delaying timer
Timer fires Timer firesThese two cases look quite similar to me.
But as you say, the battery can run out. So let's add that to the comparison:
Opportunistic Suspend Idle + Timer Jitter
Set timer Set timer
Suspend OS delays timer
Battery runs out Battery runs out
Data loss Data lossQuoted 5 lines
The two cases still look quite similar. You might note, quite correctly, that the time between suspend and resume might be quite a bit longer than the typical time that the OS delays a timer. But the power consumption on some platforms is quite a bit lower in the suspend case than it is in the delayed-timer case.
it has been stated that the android can hit the exact same power state either with sleep or suspend, and that the same clock can wake it up (it appears as a timer expiring for sleep, or an alarm for suspend, but it's the same clock firing the signal)
Quoted 5 lines
Quoted 2 lines
so in at least some cases the hardware supports doing both with equal efficiency.
It indeed has been so stated. But in this section we were discussing data loss, not hardware power-state capabilities.
you specifically stated that suspend would use less power. I am pointing out that ther is info posed in this thread to say that's not always the case.
in either case it is possible for the system to wake up again later to let the timer fire and the application save it's work. It's arguably easier in the idle case as it doesn't require application modification
for example
Idle + Timer Jitter
set timer
OS sets timer jitter to 1 hour
system sleeps for 1 hour with no wakeups timer fires, applications wake and process data system sleeps (for 1 hour or more with no wakeups)
(repeat as needed until battery runs out)
much less chance for data loss as there is _far_ more of a chance that the timer
waking up once per hour for a short time is not going to make a noticable difference in your total battery life of a cell phone due to the significant idle power draw needed for the cell circuitry. On something like a e-reader with no radio link and a month-long idle time it could make a difference.
note that this is with a badly written app running that is trying to wakeup repeatedly. If the app is well behaved and only schedule a timer when they will have work to do, they may not schedule a timer at all after the data is saved, and so would have the data safe and just as long a standby time.
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 7 lines
Quoted 2 lines
But that doesn't guarantee that solutions developed for PCs and laptops will be optimal (or even usable) on cellphones. Sufficient difference
Your cellphone is to all intents a laptop from ten years ago, it even has a similar display resolution and internet availability. The underlying difference between the two is solely form factor - the laptop had a better keyboard.
There are similarities and differences. You have called out some of the similarities. Differences include the more-aggressive hardware power management on cellphones, the greater number and variety of hardware accelerators on cellphones, battery capacity, and, as you say, physical size. People currently use cellphones differently than they do laptops or desktops. The usage might converge, but we will see. There is as much reason to expect increasing specialization as there is to expect increasing convergence.
Quoted 7 lines
Quoted 3 lines
You are talking about Android as if it was a cell phone only thing, it's not. there are shipping tablets (and I believe netbooks, i.e. laptops) running andoid.
I was talking about cellphones. But yes, Android (and thus suspend blockers) are used for tablets as well as cellphones, thank you for reminding me!
the fact that it's used there means that you can't argue that it's difference because cell phones are so different (unless you are saying that Android is really not appropriate for those uses)
On the other hand, lots of things are used in places where it is inappropriate, Windows CE is used on phones, tablets, etc but I think most people would say that the use of windows there isn't appropriate.
David Lang
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 52 lines · On Tue, Aug 10, 2010 at 08:00:53PM -0700, [email protected] wrote:
Quoted 50 lines · Paul E. McKenney
Subject: Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 46 lines · On Tue, Aug 10, 2010 at 06:28:39PM -0700, [email protected] wrote:
Quoted 31 lines · Paul E. McKenney
Quoted 7 lines · Alan Cox
Quoted 2 lines
situation you call out can occur with manual suspend-to-RAM already:
the fact is that this is a design choice. You could indeed make aLosing data is a design choice ? The application set a timer, the OS shouldn't be ignoring it in that situation. It might want to delay it, it might want to warn the user its hogging things it shouldnt (powertop, battery usage monitors in Android etc)
Hmmm... Let's put the two approaches side by side so that we can compare them more easily:
Opportunistic Suspend Idle + Timer Jitter
Set timer Set timer
Suspend OS delays timer
Resume OS continues delaying timer
Timer fires Timer firesThese two cases look quite similar to me.
But as you say, the battery can run out. So let's add that to the comparison:
Opportunistic Suspend Idle + Timer Jitter
Set timer Set timer
Suspend OS delays timer
Battery runs out Battery runs out
Data loss Data lossQuoted 5 lines
The two cases still look quite similar. You might note, quite correctly, that the time between suspend and resume might be quite a bit longer than the typical time that the OS delays a timer. But the power consumption on some platforms is quite a bit lower in the suspend case than it is in the delayed-timer case.
it has been stated that the android can hit the exact same power state either with sleep or suspend, and that the same clock can wake it up (it appears as a timer expiring for sleep, or an alarm for suspend, but it's the same clock firing the signal)
so in at least some cases the hardware supports doing both with equal efficiency.
Quoted 6 lines
Quoted 2 lines
It indeed has been so stated. But in this section we were discussing data loss, not hardware power-state capabilities.
you specifically stated that suspend would use less power. I am pointing out that ther is info posed in this thread to say that's not always the case.
I specifically stated something different, and if you specifically look up a few paragraph, you will specifically see that I specifically used a specific qualifier, which you specifically seem to have lost track of.
;-), Paul
Quoted 65 lines
in either case it is possible for the system to wake up again later to let the timer fire and the application save it's work. It's arguably easier in the idle case as it doesn't require application modification
for example
Idle + Timer Jitter
set timer
OS sets timer jitter to 1 hour
system sleeps for 1 hour with no wakeups timer fires, applications wake and process data system sleeps (for 1 hour or more with no wakeups)
(repeat as needed until battery runs out)much less chance for data loss as there is _far_ more of a chance that the timer
waking up once per hour for a short time is not going to make a noticable difference in your total battery life of a cell phone due to the significant idle power draw needed for the cell circuitry. On something like a e-reader with no radio link and a month-long idle time it could make a difference.
note that this is with a badly written app running that is trying to wakeup repeatedly. If the app is well behaved and only schedule a timer when they will have work to do, they may not schedule a timer at all after the data is saved, and so would have the data safe and just as long a standby time.
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 7 lines
Quoted 2 lines
But that doesn't guarantee that solutions developed for PCs and laptops will be optimal (or even usable) on cellphones. Sufficient difference
Your cellphone is to all intents a laptop from ten years ago, it even has a similar display resolution and internet availability. The underlying difference between the two is solely form factor - the laptop had a better keyboard.
There are similarities and differences. You have called out some of the similarities. Differences include the more-aggressive hardware power management on cellphones, the greater number and variety of hardware accelerators on cellphones, battery capacity, and, as you say, physical size. People currently use cellphones differently than they do laptops or desktops. The usage might converge, but we will see. There is as much reason to expect increasing specialization as there is to expect increasing convergence.
Quoted 7 lines
Quoted 3 lines
You are talking about Android as if it was a cell phone only thing, it's not. there are shipping tablets (and I believe netbooks, i.e. laptops) running andoid.
I was talking about cellphones. But yes, Android (and thus suspend blockers) are used for tablets as well as cellphones, thank you for reminding me!
the fact that it's used there means that you can't argue that it's difference because cell phones are so different (unless you are saying that Android is really not appropriate for those uses)
On the other hand, lots of things are used in places where it is inappropriate, Windows CE is used on phones, tablets, etc but I think most people would say that the use of windows there isn't appropriate.
David Lang
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to [email protected]Quoted 52 lines · On Tue, Aug 10, 2010 at 08:00:53PM -0700, [email protected] wrote:
Quoted 50 lines · Paul E. McKenney
Subject: Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 46 lines · On Tue, Aug 10, 2010 at 06:28:39PM -0700, [email protected] wrote:
Quoted 31 lines · Paul E. McKenney
Quoted 7 lines · Alan Cox
Quoted 2 lines
situation you call out can occur with manual suspend-to-RAM already:
the fact is that this is a design choice. You could indeed make aLosing data is a design choice ? The application set a timer, the OS shouldn't be ignoring it in that situation. It might want to delay it, it might want to warn the user its hogging things it shouldnt (powertop, battery usage monitors in Android etc)
Hmmm... Let's put the two approaches side by side so that we can compare them more easily:
Opportunistic Suspend Idle + Timer Jitter
Set timer Set timer
Suspend OS delays timer
Resume OS continues delaying timer
Timer fires Timer firesThese two cases look quite similar to me.
But as you say, the battery can run out. So let's add that to the comparison:
Opportunistic Suspend Idle + Timer Jitter
Set timer Set timer
Suspend OS delays timer
Battery runs out Battery runs out
Data loss Data lossQuoted 5 lines
The two cases still look quite similar. You might note, quite correctly, that the time between suspend and resume might be quite a bit longer than the typical time that the OS delays a timer. But the power consumption on some platforms is quite a bit lower in the suspend case than it is in the delayed-timer case.
it has been stated that the android can hit the exact same power state either with sleep or suspend, and that the same clock can wake it up (it appears as a timer expiring for sleep, or an alarm for suspend, but it's the same clock firing the signal)
so in at least some cases the hardware supports doing both with equal efficiency.
Quoted 6 lines
Quoted 2 lines
It indeed has been so stated. But in this section we were discussing data loss, not hardware power-state capabilities.
you specifically stated that suspend would use less power. I am pointing out that ther is info posed in this thread to say that's not always the case.
I specifically stated something different, and if you specifically look up a few paragraph, you will specifically see that I specifically used a specific qualifier, which you specifically seem to have lost track of.
;-), Paul
Quoted 65 lines
in either case it is possible for the system to wake up again later to let the timer fire and the application save it's work. It's arguably easier in the idle case as it doesn't require application modification
for example
Idle + Timer Jitter
set timer
OS sets timer jitter to 1 hour
system sleeps for 1 hour with no wakeups timer fires, applications wake and process data system sleeps (for 1 hour or more with no wakeups)
(repeat as needed until battery runs out)much less chance for data loss as there is _far_ more of a chance that the timer
waking up once per hour for a short time is not going to make a noticable difference in your total battery life of a cell phone due to the significant idle power draw needed for the cell circuitry. On something like a e-reader with no radio link and a month-long idle time it could make a difference.
note that this is with a badly written app running that is trying to wakeup repeatedly. If the app is well behaved and only schedule a timer when they will have work to do, they may not schedule a timer at all after the data is saved, and so would have the data safe and just as long a standby time.
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 7 lines
Quoted 2 lines
But that doesn't guarantee that solutions developed for PCs and laptops will be optimal (or even usable) on cellphones. Sufficient difference
Your cellphone is to all intents a laptop from ten years ago, it even has a similar display resolution and internet availability. The underlying difference between the two is solely form factor - the laptop had a better keyboard.
There are similarities and differences. You have called out some of the similarities. Differences include the more-aggressive hardware power management on cellphones, the greater number and variety of hardware accelerators on cellphones, battery capacity, and, as you say, physical size. People currently use cellphones differently than they do laptops or desktops. The usage might converge, but we will see. There is as much reason to expect increasing specialization as there is to expect increasing convergence.
Quoted 7 lines
Quoted 3 lines
You are talking about Android as if it was a cell phone only thing, it's not. there are shipping tablets (and I believe netbooks, i.e. laptops) running andoid.
I was talking about cellphones. But yes, Android (and thus suspend blockers) are used for tablets as well as cellphones, thank you for reminding me!
the fact that it's used there means that you can't argue that it's difference because cell phones are so different (unless you are saying that Android is really not appropriate for those uses)
On the other hand, lots of things are used in places where it is inappropriate, Windows CE is used on phones, tablets, etc but I think most people would say that the use of windows there isn't appropriate.
David Lang
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Paul E. McKenneyQuoted 12 lines · Paul E. McKenney
Quoted 10 lines · Alan Cox
You may also wish to review the earlier parts of the discussion where it was explicitly stated by several developers that they were using "suspend" type modes as power states already and not using suspend blockers. So it's being done, today on ARM and your statement is directly contradicting the code. Modern ARM processors and x86 MID devices can suspend and resume extremely fast (fast enough that the fact Linux x86 rewriting all the SMP alternatives on suspend/resume is a measurable problem). If this same property doesn't end up on big PC boxes in time then I'd be very surprised. At that point the openoffice with suspend blockers or oracle with suspend blockers question becomes rather relevant.
Quoted 7 lines
Here is the list of properties distinguishing idle from suspend:
1. Idle states are entered by a given CPU only there are no runnable tasks for that CPU. In contrast, opportunistic suspend can halt the entire system even when there are tasks that are ready, willing, and able to run. (But please note that this might not apply to real-time tasks.)
But if there are no runnable tasks (which is the target), they behave the same.
Quoted 6 lines
2. There can be a set of input events that do not bring the system out of suspend, but which would bring the system out of idle. Exactly which events are in this set depends both on hardware capabilities and on the platform/application policy. For example, on one of the Android-based smartphones, touchscreen input is ignored when the system is suspended, but is handled when idle.
And in N900 touching the screen doesn't bring the device out of idle, I guess because it's off.
What devices do what on which circumstances on what platform is completely irrelevant.
Quoted 4 lines
3. The system comes out of idle when a timer expires. In contrast, timers might or might not bring the system out of suspend, depending on both hardware capabilities and platform/application policy.
Isn't this solved by range timers?
Quoted 5 lines
4. Suspend generally forces devices to go into their low-power states immediately. In contrast, idle generally leaves unused devices at full power, relying on timers to shut down these devices. Idle thus has shorter average wakeup latencies, but worse energy efficiency.
Only if you make these assumptions
1) All the applications use suspend-blockers only when they absolutely must
2) The user has given the right applications the right access
If not, you'll see much worst energy efficiency. So in theory maybe, but in practice you can't say that.
Signature · 5 lines
Felipe Contreras _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Paul E. McKenneyQuoted 12 lines · Paul E. McKenney
Quoted 10 lines · Alan Cox
You may also wish to review the earlier parts of the discussion where it was explicitly stated by several developers that they were using "suspend" type modes as power states already and not using suspend blockers. So it's being done, today on ARM and your statement is directly contradicting the code. Modern ARM processors and x86 MID devices can suspend and resume extremely fast (fast enough that the fact Linux x86 rewriting all the SMP alternatives on suspend/resume is a measurable problem). If this same property doesn't end up on big PC boxes in time then I'd be very surprised. At that point the openoffice with suspend blockers or oracle with suspend blockers question becomes rather relevant.
Quoted 7 lines
Here is the list of properties distinguishing idle from suspend:
1. Idle states are entered by a given CPU only there are no runnable tasks for that CPU. In contrast, opportunistic suspend can halt the entire system even when there are tasks that are ready, willing, and able to run. (But please note that this might not apply to real-time tasks.)
But if there are no runnable tasks (which is the target), they behave the same.
Quoted 6 lines
2. There can be a set of input events that do not bring the system out of suspend, but which would bring the system out of idle. Exactly which events are in this set depends both on hardware capabilities and on the platform/application policy. For example, on one of the Android-based smartphones, touchscreen input is ignored when the system is suspended, but is handled when idle.
And in N900 touching the screen doesn't bring the device out of idle, I guess because it's off.
What devices do what on which circumstances on what platform is completely irrelevant.
Quoted 4 lines
3. The system comes out of idle when a timer expires. In contrast, timers might or might not bring the system out of suspend, depending on both hardware capabilities and platform/application policy.
Isn't this solved by range timers?
Quoted 5 lines
4. Suspend generally forces devices to go into their low-power states immediately. In contrast, idle generally leaves unused devices at full power, relying on timers to shut down these devices. Idle thus has shorter average wakeup latencies, but worse energy efficiency.
Only if you make these assumptions
1) All the applications use suspend-blockers only when they absolutely must
2) The user has given the right applications the right access
If not, you'll see much worst energy efficiency. So in theory maybe, but in practice you can't say that.
Signature · 1 line
Felipe Contreras
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 16 lines · Felipe Contreras
Quoted 14 lines · Paul E. McKenney
Quoted 10 lines · Alan Cox
You may also wish to review the earlier parts of the discussion where it was explicitly stated by several developers that they were using "suspend" type modes as power states already and not using suspend blockers. So it's being done, today on ARM and your statement is directly contradicting the code. Modern ARM processors and x86 MID devices can suspend and resume extremely fast (fast enough that the fact Linux x86 rewriting all the SMP alternatives on suspend/resume is a measurable problem). If this same property doesn't end up on big PC boxes in time then I'd be very surprised. At that point the openoffice with suspend blockers or oracle with suspend blockers question becomes rather relevant.
Here is the list of properties distinguishing idle from suspend:
Quoted 7 lines
Quoted 5 lines
1. Idle states are entered by a given CPU only there are no runnable tasks for that CPU. In contrast, opportunistic suspend can halt the entire system even when there are tasks that are ready, willing, and able to run. (But please note that this might not apply to real-time tasks.)
But if there are no runnable tasks (which is the target), they behave the same.
And if there are runnable tasks, then then don't behave the same. Apparently different people in this debate have different targets.
Quoted 9 lines
Quoted 6 lines
2. There can be a set of input events that do not bring the system out of suspend, but which would bring the system out of idle. Exactly which events are in this set depends both on hardware capabilities and on the platform/application policy. For example, on one of the Android-based smartphones, touchscreen input is ignored when the system is suspended, but is handled when idle.
And in N900 touching the screen doesn't bring the device out of idle, I guess because it's off.
As long as touching the N900 screen doesn't bring the device out of suspend, its behavior is not a counterexample to #2 above.
Quoted 2 lines
What devices do what on which circumstances on what platform is completely irrelevant.
Do you -really- want me to start listing counterexamples to that brave statement? ;-)
Quoted 6 lines
Quoted 4 lines
3. The system comes out of idle when a timer expires. In contrast, timers might or might not bring the system out of suspend, depending on both hardware capabilities and platform/application policy.
Isn't this solved by range timers?
Ahem. This is a list of differences between idle and suspend, not a list of problems to be solved. But to answer your question, if a timer does not bring a given device out of suspend, then a range timer is not likely to, either. Don't get me wrong, I do believe that range timers have an important part to play in the energy-efficiency arena, but I have not been convinced that they are any kind of silver bullet.
Quoted 9 lines
Quoted 5 lines
4. Suspend generally forces devices to go into their low-power states immediately. In contrast, idle generally leaves unused devices at full power, relying on timers to shut down these devices. Idle thus has shorter average wakeup latencies, but worse energy efficiency.
Only if you make these assumptions
1) All the applications use suspend-blockers only when they absolutely must
2) The user has given the right applications the right access
You believe that these assumptions are unreasonable? Compared to the assumption that all applications are carefully written to conserve power? If so, on what grounds?
It seems to me that the same social-engineering approaches work in both cases.
Quoted 2 lines
If not, you'll see much worst energy efficiency. So in theory maybe, but in practice you can't say that.
Really? What makes you say that?
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasQuoted 16 lines · Felipe Contreras
Quoted 14 lines · Paul E. McKenney
Quoted 10 lines · Alan Cox
You may also wish to review the earlier parts of the discussion where it was explicitly stated by several developers that they were using "suspend" type modes as power states already and not using suspend blockers. So it's being done, today on ARM and your statement is directly contradicting the code. Modern ARM processors and x86 MID devices can suspend and resume extremely fast (fast enough that the fact Linux x86 rewriting all the SMP alternatives on suspend/resume is a measurable problem). If this same property doesn't end up on big PC boxes in time then I'd be very surprised. At that point the openoffice with suspend blockers or oracle with suspend blockers question becomes rather relevant.
Here is the list of properties distinguishing idle from suspend:
Quoted 7 lines
Quoted 5 lines
1. Idle states are entered by a given CPU only there are no runnable tasks for that CPU. In contrast, opportunistic suspend can halt the entire system even when there are tasks that are ready, willing, and able to run. (But please note that this might not apply to real-time tasks.)
But if there are no runnable tasks (which is the target), they behave the same.
And if there are runnable tasks, then then don't behave the same. Apparently different people in this debate have different targets.
Quoted 9 lines
Quoted 6 lines
2. There can be a set of input events that do not bring the system out of suspend, but which would bring the system out of idle. Exactly which events are in this set depends both on hardware capabilities and on the platform/application policy. For example, on one of the Android-based smartphones, touchscreen input is ignored when the system is suspended, but is handled when idle.
And in N900 touching the screen doesn't bring the device out of idle, I guess because it's off.
As long as touching the N900 screen doesn't bring the device out of suspend, its behavior is not a counterexample to #2 above.
Quoted 2 lines
What devices do what on which circumstances on what platform is completely irrelevant.
Do you -really- want me to start listing counterexamples to that brave statement? ;-)
Quoted 6 lines
Quoted 4 lines
3. The system comes out of idle when a timer expires. In contrast, timers might or might not bring the system out of suspend, depending on both hardware capabilities and platform/application policy.
Isn't this solved by range timers?
Ahem. This is a list of differences between idle and suspend, not a list of problems to be solved. But to answer your question, if a timer does not bring a given device out of suspend, then a range timer is not likely to, either. Don't get me wrong, I do believe that range timers have an important part to play in the energy-efficiency arena, but I have not been convinced that they are any kind of silver bullet.
Quoted 9 lines
Quoted 5 lines
4. Suspend generally forces devices to go into their low-power states immediately. In contrast, idle generally leaves unused devices at full power, relying on timers to shut down these devices. Idle thus has shorter average wakeup latencies, but worse energy efficiency.
Only if you make these assumptions
1) All the applications use suspend-blockers only when they absolutely must
2) The user has given the right applications the right access
You believe that these assumptions are unreasonable? Compared to the assumption that all applications are carefully written to conserve power? If so, on what grounds?
It seems to me that the same social-engineering approaches work in both cases.
Quoted 2 lines
If not, you'll see much worst energy efficiency. So in theory maybe, but in practice you can't say that.
Really? What makes you say that?
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 23 lines · Paul E. McKenney
Quoted 22 lines · Felipe Contreras
Quoted 19 lines · Paul E. McKenney
Quoted 10 lines · Alan Cox
You may also wish to review the earlier parts of the discussion where it was explicitly stated by several developers that they were using "suspend" type modes as power states already and not using suspend blockers. So it's being done, today on ARM and your statement is directly contradicting the code. Modern ARM processors and x86 MID devices can suspend and resume extremely fast (fast enough that the fact Linux x86 rewriting all the SMP alternatives on suspend/resume is a measurable problem). If this same property doesn't end up on big PC boxes in time then I'd be very surprised. At that point the openoffice with suspend blockers or oracle with suspend blockers question becomes rather relevant.
Here is the list of properties distinguishing idle from suspend:
1. Idle states are entered by a given CPU only there are no runnable tasks for that CPU. In contrast, opportunistic suspend can halt the entire system even when there are tasks that are ready, willing, and able to run. (But please note that this might not apply to real-time tasks.)
Quoted 3 lines
Quoted 1 line
But if there are no runnable tasks (which is the target), they behave the same.
And if there are runnable tasks, then then don't behave the same.
Unless they have blocked suspend.
Anyway, Alan was picturing a hypothetical point in time when x86 can suspend/resume as fast as ARM, and thus the question of whether or not to enable suspend-blockers in a system that runs openoffice becomes relevant. If applications have been fixed by that time to not wake the system unnecessarily, as many of them have already been tanks to tools like powertop, then suspend-blockers would not make that much of a difference, therefore the effort required to implement suspend-blockers properly on all applications in the system, including openoffice might not be worth the gain.
Quoted 1 line
Apparently different people in this debate have different targets.
I remember clearly Android people explaining that dynamic PM is orthogonal to suspend-blockers; if a suspend is blocked, you still want dynamic PM to reach the lower power state. Therefore the target of not having unneeded runnable tasks is shared by Android folks.
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
2. There can be a set of input events that do not bring the system out of suspend, but which would bring the system out of idle. Exactly which events are in this set depends both on hardware capabilities and on the platform/application policy. For example, on one of the Android-based smartphones, touchscreen input is ignored when the system is suspended, but is handled when idle.
Quoted 5 lines
Quoted 2 lines
And in N900 touching the screen doesn't bring the device out of idle, I guess because it's off.
As long as touching the N900 screen doesn't bring the device out of suspend, its behavior is not a counterexample to #2 above.
You said "there can be a set of input events that do not bring the system out of suspend, but which would bring the system out of idle". There's no suspend (in the Android sense) in N900, only idle, and the events that bring N900 out of idle can be mapped to the set of events that bring Android out of suspend.
IOW. Alan wasn't talking about idle vs suspend on the same device, he was talking about opportunistic suspend vs dynamic PM.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
3. The system comes out of idle when a timer expires. In contrast, timers might or might not bring the system out of suspend, depending on both hardware capabilities and platform/application policy.
Quoted 8 lines
Quoted 1 line
Isn't this solved by range timers?
Ahem. This is a list of differences between idle and suspend, not a list of problems to be solved. But to answer your question, if a timer does not bring a given device out of suspend, then a range timer is not likely to, either. Don't get me wrong, I do believe that range timers have an important part to play in the energy-efficiency arena, but I have not been convinced that they are any kind of silver bullet.
Certainly, but the context is the set of differences that would aid in the decision of whether or not to go for suspend-blockers in a general purpose system where openoffice would run.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
4. Suspend generally forces devices to go into their low-power states immediately. In contrast, idle generally leaves unused devices at full power, relying on timers to shut down these devices. Idle thus has shorter average wakeup latencies, but worse energy efficiency.
Quoted 7 lines
Quoted 3 lines
Only if you make these assumptions
1) All the applications use suspend-blockers only when they absolutely must
2) The user has given the right applications the right accessYou believe that these assumptions are unreasonable? Compared to the assumption that all applications are carefully written to conserve power? If so, on what grounds?
No, I think both (for opportunistic suspend and dynamic PM) are completely reasonable. But think again; if you have the assumptions met on both, then both work fine, if you don't meet them, then both don't work correctly.
My point is that suspend-blockers don't magically reduce power usage, just like dynamic PM, it depends on what user-space actually does. You made it look as it *always* reached better energy efficiency.
Quoted 2 lines
It seems to me that the same social-engineering approaches work in both cases.
Yes, but if dynamic PM works as advertised, you don't need opportunistic suspend.
Quoted 4 lines
Quoted 2 lines
If not, you'll see much worst energy efficiency. So in theory maybe, but in practice you can't say that.
Really? What makes you say that?
For starters an application might be holding the wakelock more than it should, also, an application might miss a timer due to not having PM permissions to hold the lock, and thus might need an expensive initialization when it runs again.
Signature · 5 lines
Felipe Contreras _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Paul E. McKenneyQuoted 23 lines · Paul E. McKenney
Quoted 22 lines · Felipe Contreras
Quoted 19 lines · Paul E. McKenney
Quoted 10 lines · Alan Cox
You may also wish to review the earlier parts of the discussion where it was explicitly stated by several developers that they were using "suspend" type modes as power states already and not using suspend blockers. So it's being done, today on ARM and your statement is directly contradicting the code. Modern ARM processors and x86 MID devices can suspend and resume extremely fast (fast enough that the fact Linux x86 rewriting all the SMP alternatives on suspend/resume is a measurable problem). If this same property doesn't end up on big PC boxes in time then I'd be very surprised. At that point the openoffice with suspend blockers or oracle with suspend blockers question becomes rather relevant.
Here is the list of properties distinguishing idle from suspend:
1. Idle states are entered by a given CPU only there are no runnable tasks for that CPU. In contrast, opportunistic suspend can halt the entire system even when there are tasks that are ready, willing, and able to run. (But please note that this might not apply to real-time tasks.)
Quoted 3 lines
Quoted 1 line
But if there are no runnable tasks (which is the target), they behave the same.
And if there are runnable tasks, then then don't behave the same.
Unless they have blocked suspend.
Anyway, Alan was picturing a hypothetical point in time when x86 can suspend/resume as fast as ARM, and thus the question of whether or not to enable suspend-blockers in a system that runs openoffice becomes relevant. If applications have been fixed by that time to not wake the system unnecessarily, as many of them have already been tanks to tools like powertop, then suspend-blockers would not make that much of a difference, therefore the effort required to implement suspend-blockers properly on all applications in the system, including openoffice might not be worth the gain.
Quoted 1 line
Apparently different people in this debate have different targets.
I remember clearly Android people explaining that dynamic PM is orthogonal to suspend-blockers; if a suspend is blocked, you still want dynamic PM to reach the lower power state. Therefore the target of not having unneeded runnable tasks is shared by Android folks.
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
2. There can be a set of input events that do not bring the system out of suspend, but which would bring the system out of idle. Exactly which events are in this set depends both on hardware capabilities and on the platform/application policy. For example, on one of the Android-based smartphones, touchscreen input is ignored when the system is suspended, but is handled when idle.
Quoted 5 lines
Quoted 2 lines
And in N900 touching the screen doesn't bring the device out of idle, I guess because it's off.
As long as touching the N900 screen doesn't bring the device out of suspend, its behavior is not a counterexample to #2 above.
You said "there can be a set of input events that do not bring the system out of suspend, but which would bring the system out of idle". There's no suspend (in the Android sense) in N900, only idle, and the events that bring N900 out of idle can be mapped to the set of events that bring Android out of suspend.
IOW. Alan wasn't talking about idle vs suspend on the same device, he was talking about opportunistic suspend vs dynamic PM.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
3. The system comes out of idle when a timer expires. In contrast, timers might or might not bring the system out of suspend, depending on both hardware capabilities and platform/application policy.
Quoted 8 lines
Quoted 1 line
Isn't this solved by range timers?
Ahem. This is a list of differences between idle and suspend, not a list of problems to be solved. But to answer your question, if a timer does not bring a given device out of suspend, then a range timer is not likely to, either. Don't get me wrong, I do believe that range timers have an important part to play in the energy-efficiency arena, but I have not been convinced that they are any kind of silver bullet.
Certainly, but the context is the set of differences that would aid in the decision of whether or not to go for suspend-blockers in a general purpose system where openoffice would run.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
4. Suspend generally forces devices to go into their low-power states immediately. In contrast, idle generally leaves unused devices at full power, relying on timers to shut down these devices. Idle thus has shorter average wakeup latencies, but worse energy efficiency.
Quoted 7 lines
Quoted 3 lines
Only if you make these assumptions
1) All the applications use suspend-blockers only when they absolutely must
2) The user has given the right applications the right accessYou believe that these assumptions are unreasonable? Compared to the assumption that all applications are carefully written to conserve power? If so, on what grounds?
No, I think both (for opportunistic suspend and dynamic PM) are completely reasonable. But think again; if you have the assumptions met on both, then both work fine, if you don't meet them, then both don't work correctly.
My point is that suspend-blockers don't magically reduce power usage, just like dynamic PM, it depends on what user-space actually does. You made it look as it *always* reached better energy efficiency.
Quoted 2 lines
It seems to me that the same social-engineering approaches work in both cases.
Yes, but if dynamic PM works as advertised, you don't need opportunistic suspend.
Quoted 4 lines
Quoted 2 lines
If not, you'll see much worst energy efficiency. So in theory maybe, but in practice you can't say that.
Really? What makes you say that?
For starters an application might be holding the wakelock more than it should, also, an application might miss a timer due to not having PM permissions to hold the lock, and thus might need an expensive initialization when it runs again.
Signature · 1 line
Felipe Contreras
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 25 lines · Felipe Contreras
Quoted 23 lines · Paul E. McKenney
Quoted 22 lines · Felipe Contreras
Quoted 19 lines · Paul E. McKenney
Quoted 10 lines · Alan Cox
You may also wish to review the earlier parts of the discussion where it was explicitly stated by several developers that they were using "suspend" type modes as power states already and not using suspend blockers. So it's being done, today on ARM and your statement is directly contradicting the code. Modern ARM processors and x86 MID devices can suspend and resume extremely fast (fast enough that the fact Linux x86 rewriting all the SMP alternatives on suspend/resume is a measurable problem). If this same property doesn't end up on big PC boxes in time then I'd be very surprised. At that point the openoffice with suspend blockers or oracle with suspend blockers question becomes rather relevant.
Here is the list of properties distinguishing idle from suspend:
1. Idle states are entered by a given CPU only there are no runnable tasks for that CPU. In contrast, opportunistic suspend can halt the entire system even when there are tasks that are ready, willing, and able to run. (But please note that this might not apply to real-time tasks.)
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
But if there are no runnable tasks (which is the target), they behave the same.
And if there are runnable tasks, then then don't behave the same.
Unless they have blocked suspend.
You are quite correct. I should have said something like "But if there are runnable tasks, none of which is holding a suspend blocker, then they don't behave the same."
Quoted 9 lines
Anyway, Alan was picturing a hypothetical point in time when x86 can suspend/resume as fast as ARM, and thus the question of whether or not to enable suspend-blockers in a system that runs openoffice becomes relevant. If applications have been fixed by that time to not wake the system unnecessarily, as many of them have already been tanks to tools like powertop, then suspend-blockers would not make that much of a difference, therefore the effort required to implement suspend-blockers properly on all applications in the system, including openoffice might not be worth the gain.
One more time, this time with feeling. ;-)
Only PM-driving applications need concern themselves with suspend blockers, and experience thus far indicates that PM-driving applications are a very small fraction of the total.
Quoted 6 lines
Quoted 1 line
Apparently different people in this debate have different targets.
I remember clearly Android people explaining that dynamic PM is orthogonal to suspend-blockers; if a suspend is blocked, you still want dynamic PM to reach the lower power state. Therefore the target of not having unneeded runnable tasks is shared by Android folks.
And I have not seen anyone argue that suspend blockers are a replacement for dynamic power management. Many people instead seem to be advocating using them both -- dynamic power management for when at least one PM-driving application or kernel driver is keeping the system awake, and suspend blockers for when only power-oblivious applications are running.
In contrast, you are advocating dynamic power management to the exclusion of other mechanisms.
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 6 lines
2. There can be a set of input events that do not bring the system out of suspend, but which would bring the system out of idle. Exactly which events are in this set depends both on hardware capabilities and on the platform/application policy. For example, on one of the Android-based smartphones, touchscreen input is ignored when the system is suspended, but is handled when idle.
And in N900 touching the screen doesn't bring the device out of idle, I guess because it's off.
Quoted 8 lines
Quoted 2 lines
As long as touching the N900 screen doesn't bring the device out of suspend, its behavior is not a counterexample to #2 above.
You said "there can be a set of input events that do not bring the system out of suspend, but which would bring the system out of idle". There's no suspend (in the Android sense) in N900, only idle, and the events that bring N900 out of idle can be mapped to the set of events that bring Android out of suspend.
We do seem to be in violent agreement.
Quoted 2 lines
IOW. Alan wasn't talking about idle vs suspend on the same device, he was talking about opportunistic suspend vs dynamic PM.
The most convincing comparisons will be of suspend vs. idle on the same device. If multiple devices are involved, then the most convincing experiments would compare suspend vs. idle separately on each device.
So, are you sure that you are correctly interpreting Alan's words?
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
3. The system comes out of idle when a timer expires. In contrast, timers might or might not bring the system out of suspend, depending on both hardware capabilities and platform/application policy.
Quoted 8 lines
Quoted 1 line
Isn't this solved by range timers?
Ahem. This is a list of differences between idle and suspend, not a list of problems to be solved. But to answer your question, if a timer does not bring a given device out of suspend, then a range timer is not likely to, either. Don't get me wrong, I do believe that range timers have an important part to play in the energy-efficiency arena, but I have not been convinced that they are any kind of silver bullet.
Quoted 3 lines
Certainly, but the context is the set of differences that would aid in the decision of whether or not to go for suspend-blockers in a general purpose system where openoffice would run.
Again, I am in no way arguing for suspend blockers to the exclusion of other approaches. Heck, I am mostly just trying to get a clear statement of the problem. In contrast, you do seem to be advocating for dynamic power management to the exclusion of other approaches.
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines
4. Suspend generally forces devices to go into their low-power states immediately. In contrast, idle generally leaves unused devices at full power, relying on timers to shut down these devices. Idle thus has shorter average wakeup latencies, but worse energy efficiency.
Only if you make these assumptions
1) All the applications use suspend-blockers only when they absolutely must
2) The user has given the right applications the right access
Quoted 8 lines
Quoted 3 lines
You believe that these assumptions are unreasonable? Compared to the assumption that all applications are carefully written to conserve power? If so, on what grounds?
No, I think both (for opportunistic suspend and dynamic PM) are completely reasonable. But think again; if you have the assumptions met on both, then both work fine, if you don't meet them, then both don't work correctly.
That is true of any artifact, software or otherwise: if you don't meet the assumptions inherent in its design and construction, the artifact might fail. Of course, you argument also applies to dynamic power management:
and in fact it takes just one power-oblivious application to drain your battery -- especially if that application goes into an infinite loop. And if that application goes into an infinite loop only under some unusual set of conditions, it might have passed your test suite with flying colors, so that you might even have given it a power-management gold star, right?
And yes, you can get the same effect with an infinite loop in a PM-driving application that happens to be holding suspend blockers at the time. However, in the suspend-blocker case, one need only inspect that code that holds suspend blockers. In the dynamic power management case, one must inspect -all- the code. There is a very real difference between those two tasks.
So are you sure that dynamic power management will turn out to be the right tool for every job out there? If so, on what grounds?
Quoted 3 lines
My point is that suspend-blockers don't magically reduce power usage, just like dynamic PM, it depends on what user-space actually does. You made it look as it *always* reached better energy efficiency.
I do? Really??? Exactly what did I say to give you that impression?
I am not saying that suspend blockers are the right tool for every power management job, instead, I am asking whether there are some power management jobs for which it is the best tool.
Quoted 5 lines
Quoted 2 lines
It seems to me that the same social-engineering approaches work in both cases.
Yes, but if dynamic PM works as advertised, you don't need opportunistic suspend.
For dynamic power management to totally eliminate the need for something like suspend blockers, you are having to make some brave assumptions. Yes, dynamic power management is quite useful, but there is a big difference between something being useful and something doing everything for everyone. You have not yet convinced me that dynamic power management will make it to the "doing everything for everyone" stage.
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
If not, you'll see much worst energy efficiency. So in theory maybe, but in practice you can't say that.
Really? What makes you say that?
For starters an application might be holding the wakelock more than it should, also, an application might miss a timer due to not having PM permissions to hold the lock, and thus might need an expensive initialization when it runs again.
Just as an application might run continuously without blocking, which would defeat the dynamic power management scheme that have thus far been put forward. And just as an application might miss a timer due to dynamic power management having decided that it didn't need that timer to fire at the desired time.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasQuoted 25 lines · Felipe Contreras
Quoted 23 lines · Paul E. McKenney
Quoted 22 lines · Felipe Contreras
Quoted 19 lines · Paul E. McKenney
Quoted 10 lines · Alan Cox
You may also wish to review the earlier parts of the discussion where it was explicitly stated by several developers that they were using "suspend" type modes as power states already and not using suspend blockers. So it's being done, today on ARM and your statement is directly contradicting the code. Modern ARM processors and x86 MID devices can suspend and resume extremely fast (fast enough that the fact Linux x86 rewriting all the SMP alternatives on suspend/resume is a measurable problem). If this same property doesn't end up on big PC boxes in time then I'd be very surprised. At that point the openoffice with suspend blockers or oracle with suspend blockers question becomes rather relevant.
Here is the list of properties distinguishing idle from suspend:
1. Idle states are entered by a given CPU only there are no runnable tasks for that CPU. In contrast, opportunistic suspend can halt the entire system even when there are tasks that are ready, willing, and able to run. (But please note that this might not apply to real-time tasks.)
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
But if there are no runnable tasks (which is the target), they behave the same.
And if there are runnable tasks, then then don't behave the same.
Unless they have blocked suspend.
You are quite correct. I should have said something like "But if there are runnable tasks, none of which is holding a suspend blocker, then they don't behave the same."
Quoted 9 lines
Anyway, Alan was picturing a hypothetical point in time when x86 can suspend/resume as fast as ARM, and thus the question of whether or not to enable suspend-blockers in a system that runs openoffice becomes relevant. If applications have been fixed by that time to not wake the system unnecessarily, as many of them have already been tanks to tools like powertop, then suspend-blockers would not make that much of a difference, therefore the effort required to implement suspend-blockers properly on all applications in the system, including openoffice might not be worth the gain.
One more time, this time with feeling. ;-)
Only PM-driving applications need concern themselves with suspend blockers, and experience thus far indicates that PM-driving applications are a very small fraction of the total.
Quoted 6 lines
Quoted 1 line
Apparently different people in this debate have different targets.
I remember clearly Android people explaining that dynamic PM is orthogonal to suspend-blockers; if a suspend is blocked, you still want dynamic PM to reach the lower power state. Therefore the target of not having unneeded runnable tasks is shared by Android folks.
And I have not seen anyone argue that suspend blockers are a replacement for dynamic power management. Many people instead seem to be advocating using them both -- dynamic power management for when at least one PM-driving application or kernel driver is keeping the system awake, and suspend blockers for when only power-oblivious applications are running.
In contrast, you are advocating dynamic power management to the exclusion of other mechanisms.
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 6 lines
2. There can be a set of input events that do not bring the system out of suspend, but which would bring the system out of idle. Exactly which events are in this set depends both on hardware capabilities and on the platform/application policy. For example, on one of the Android-based smartphones, touchscreen input is ignored when the system is suspended, but is handled when idle.
And in N900 touching the screen doesn't bring the device out of idle, I guess because it's off.
Quoted 8 lines
Quoted 2 lines
As long as touching the N900 screen doesn't bring the device out of suspend, its behavior is not a counterexample to #2 above.
You said "there can be a set of input events that do not bring the system out of suspend, but which would bring the system out of idle". There's no suspend (in the Android sense) in N900, only idle, and the events that bring N900 out of idle can be mapped to the set of events that bring Android out of suspend.
We do seem to be in violent agreement.
Quoted 2 lines
IOW. Alan wasn't talking about idle vs suspend on the same device, he was talking about opportunistic suspend vs dynamic PM.
The most convincing comparisons will be of suspend vs. idle on the same device. If multiple devices are involved, then the most convincing experiments would compare suspend vs. idle separately on each device.
So, are you sure that you are correctly interpreting Alan's words?
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
3. The system comes out of idle when a timer expires. In contrast, timers might or might not bring the system out of suspend, depending on both hardware capabilities and platform/application policy.
Quoted 8 lines
Quoted 1 line
Isn't this solved by range timers?
Ahem. This is a list of differences between idle and suspend, not a list of problems to be solved. But to answer your question, if a timer does not bring a given device out of suspend, then a range timer is not likely to, either. Don't get me wrong, I do believe that range timers have an important part to play in the energy-efficiency arena, but I have not been convinced that they are any kind of silver bullet.
Quoted 3 lines
Certainly, but the context is the set of differences that would aid in the decision of whether or not to go for suspend-blockers in a general purpose system where openoffice would run.
Again, I am in no way arguing for suspend blockers to the exclusion of other approaches. Heck, I am mostly just trying to get a clear statement of the problem. In contrast, you do seem to be advocating for dynamic power management to the exclusion of other approaches.
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines
4. Suspend generally forces devices to go into their low-power states immediately. In contrast, idle generally leaves unused devices at full power, relying on timers to shut down these devices. Idle thus has shorter average wakeup latencies, but worse energy efficiency.
Only if you make these assumptions
1) All the applications use suspend-blockers only when they absolutely must
2) The user has given the right applications the right access
Quoted 8 lines
Quoted 3 lines
You believe that these assumptions are unreasonable? Compared to the assumption that all applications are carefully written to conserve power? If so, on what grounds?
No, I think both (for opportunistic suspend and dynamic PM) are completely reasonable. But think again; if you have the assumptions met on both, then both work fine, if you don't meet them, then both don't work correctly.
That is true of any artifact, software or otherwise: if you don't meet the assumptions inherent in its design and construction, the artifact might fail. Of course, you argument also applies to dynamic power management:
and in fact it takes just one power-oblivious application to drain your battery -- especially if that application goes into an infinite loop. And if that application goes into an infinite loop only under some unusual set of conditions, it might have passed your test suite with flying colors, so that you might even have given it a power-management gold star, right?
And yes, you can get the same effect with an infinite loop in a PM-driving application that happens to be holding suspend blockers at the time. However, in the suspend-blocker case, one need only inspect that code that holds suspend blockers. In the dynamic power management case, one must inspect -all- the code. There is a very real difference between those two tasks.
So are you sure that dynamic power management will turn out to be the right tool for every job out there? If so, on what grounds?
Quoted 3 lines
My point is that suspend-blockers don't magically reduce power usage, just like dynamic PM, it depends on what user-space actually does. You made it look as it *always* reached better energy efficiency.
I do? Really??? Exactly what did I say to give you that impression?
I am not saying that suspend blockers are the right tool for every power management job, instead, I am asking whether there are some power management jobs for which it is the best tool.
Quoted 5 lines
Quoted 2 lines
It seems to me that the same social-engineering approaches work in both cases.
Yes, but if dynamic PM works as advertised, you don't need opportunistic suspend.
For dynamic power management to totally eliminate the need for something like suspend blockers, you are having to make some brave assumptions. Yes, dynamic power management is quite useful, but there is a big difference between something being useful and something doing everything for everyone. You have not yet convinced me that dynamic power management will make it to the "doing everything for everyone" stage.
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
If not, you'll see much worst energy efficiency. So in theory maybe, but in practice you can't say that.
Really? What makes you say that?
For starters an application might be holding the wakelock more than it should, also, an application might miss a timer due to not having PM permissions to hold the lock, and thus might need an expensive initialization when it runs again.
Just as an application might run continuously without blocking, which would defeat the dynamic power management scheme that have thus far been put forward. And just as an application might miss a timer due to dynamic power management having decided that it didn't need that timer to fire at the desired time.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 11 lines · Paul E. McKenney
Quoted 9 lines · Felipe Contreras
Anyway, Alan was picturing a hypothetical point in time when x86 can suspend/resume as fast as ARM, and thus the question of whether or not to enable suspend-blockers in a system that runs openoffice becomes relevant. If applications have been fixed by that time to not wake the system unnecessarily, as many of them have already been tanks to tools like powertop, then suspend-blockers would not make that much of a difference, therefore the effort required to implement suspend-blockers properly on all applications in the system, including openoffice might not be worth the gain.
Quoted 5 lines
One more time, this time with feeling. ;-)
Only PM-driving applications need concern themselves with suspend blockers, and experience thus far indicates that PM-driving applications are a very small fraction of the total.
There's no experience on this. Have you tried to run a small debian system with suspend blockers enabled? I can image at least all cron daemons need modifications, probably dbus, links, lftp, wget, rsync and a bunch of applications that download data too.
It's easy to speculate one way or the other, but the fact of the matter is that we don't really know how many changes are needed in order to have a functional system that actually benefits from suspend blockers.
What we know is that if an application is not analyzed to see if it needs suspend blockers, and implement them if needed, it might get broken.
Quoted 9 lines
Quoted 6 lines
Quoted 1 line
Apparently different people in this debate have different targets.
I remember clearly Android people explaining that dynamic PM is orthogonal to suspend-blockers; if a suspend is blocked, you still want dynamic PM to reach the lower power state. Therefore the target of not having unneeded runnable tasks is shared by Android folks.
And I have not seen anyone argue that suspend blockers are a replacement for dynamic power management.
That's exactly what I'm saying: they are orthogonal.
Quoted 2 lines
In contrast, you are advocating dynamic power management to the exclusion of other mechanisms.
* if dynamic PM was perfect, spend-blockers would *not* be not needed
* if suspend-blockers were perfect, dynamic *will* still be needed
All I said in that sentence you are replying is that dynamic PM will improve; it's a shared goal of everyone.
Quoted 8 lines
Quoted 2 lines
IOW. Alan wasn't talking about idle vs suspend on the same device, he was talking about opportunistic suspend vs dynamic PM.
The most convincing comparisons will be of suspend vs. idle on the same device. If multiple devices are involved, then the most convincing experiments would compare suspend vs. idle separately on each device.
So, are you sure that you are correctly interpreting Alan's words?
The point you are trying to highlight is to which events the system reacts, that has nothing to do with dynamic PM vs opportunistic suspend.
Quoted 4 lines
Again, I am in no way arguing for suspend blockers to the exclusion of other approaches. Heck, I am mostly just trying to get a clear statement of the problem. In contrast, you do seem to be advocating for dynamic power management to the exclusion of other approaches.
What you are doing is copy pasting a definition of what is opportunistic suspend and making it pass as an advantage.
This particular point (3.) is not an advantage, over dynamic PM, it's just a difference.
Quoted 8 lines
Quoted 4 lines
No, I think both (for opportunistic suspend and dynamic PM) are completely reasonable. But think again; if you have the assumptions met on both, then both work fine, if you don't meet them, then both don't work correctly.
That is true of any artifact, software or otherwise: if you don't meet the assumptions inherent in its design and construction, the artifact might fail.
[...]
Quoted 2 lines
There is
a very real difference between those two tasks.
I've cut most of your explanation. If I understand correctly what you are saying is that suspend blockers are harder to get wrong. I agree, but my point against 4. remains the same: suspend-blockers don't automatically get you more efficient power usage.
Quoted 2 lines
So are you sure that dynamic power management will turn out to be the right tool for every job out there? If so, on what grounds?
I don't understand this question. Dynamic PM is needed regardless. We are discussing your point 4 where you say suspend blockers inevitably lead to more efficient power usage (I say not necessarily).
Quoted 5 lines
Quoted 3 lines
My point is that suspend-blockers don't magically reduce power usage, just like dynamic PM, it depends on what user-space actually does. You made it look as it *always* reached better energy efficiency.
I do? Really??? Exactly what did I say to give you that impression?
Here's your point 4 again:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
4. Suspend generally forces devices to go into their low-power
states immediately. In contrast, idle generally leaves unused devices at full power, relying on timers to shut down these devices. Idle thus has shorter average wakeup latencies, but worse energy efficiency.
Remove "but worse energy efficiency" and I think that point would be correct, albeit it's not really an argument in favor of opportunistic suspend.
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
It seems to me that the same social-engineering approaches work in both cases.
Yes, but if dynamic PM works as advertised, you don't need opportunistic suspend.
Quoted 6 lines
For dynamic power management to totally eliminate the need for something like suspend blockers, you are having to make some brave assumptions. Yes, dynamic power management is quite useful, but there is a big difference between something being useful and something doing everything for everyone. You have not yet convinced me that dynamic power management will make it to the "doing everything for everyone" stage.
As it has been explained before, there's a sweet-spot of idleness:
http://article.gmane.org/gmane.linux.kernel/995525
http://article.gmane.org/gmane.linux.ports.arm.omap/37982
Do you agree that there's such a thing, and if so, do you agree that the benefits of opportunistic suspend are much less once that point is reached?
Quoted 15 lines
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
If not, you'll see much worst energy efficiency. So in theory maybe, but in practice you can't say that.
Really? What makes you say that?
For starters an application might be holding the wakelock more than it should, also, an application might miss a timer due to not having PM permissions to hold the lock, and thus might need an expensive initialization when it runs again.
Just as an application might run continuously without blocking, which would defeat the dynamic power management scheme that have thus far been put forward. And just as an application might miss a timer due to dynamic power management having decided that it didn't need that timer to fire at the desired time.
Quoted 2 lines · concentrate on what I
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
If not, you'll see much worst energy efficiency. So in theory maybe, but in practice you can't say that.
I just proved to you that in certain cases opportunistic suspend might actually hurt. Thus you should accept my premise that you can't say that in practice opportunistic suspend _always_ leads to better results, because that's not the case.
And in order to try to avoid going back to the same points:
1) yes, there are advantages of opportunistic suspend
2) yes, there are cases where it works as it should
3) no, it's not a silver bullet that will inevitably improve power usage
4) no, we can't say anything about what opportunistic suspend means in practice
Signature · 5 lines
Felipe Contreras _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Paul E. McKenneyQuoted 11 lines · Paul E. McKenney
Quoted 9 lines · Felipe Contreras
Anyway, Alan was picturing a hypothetical point in time when x86 can suspend/resume as fast as ARM, and thus the question of whether or not to enable suspend-blockers in a system that runs openoffice becomes relevant. If applications have been fixed by that time to not wake the system unnecessarily, as many of them have already been tanks to tools like powertop, then suspend-blockers would not make that much of a difference, therefore the effort required to implement suspend-blockers properly on all applications in the system, including openoffice might not be worth the gain.
Quoted 5 lines
One more time, this time with feeling. ;-)
Only PM-driving applications need concern themselves with suspend blockers, and experience thus far indicates that PM-driving applications are a very small fraction of the total.
There's no experience on this. Have you tried to run a small debian system with suspend blockers enabled? I can image at least all cron daemons need modifications, probably dbus, links, lftp, wget, rsync and a bunch of applications that download data too.
It's easy to speculate one way or the other, but the fact of the matter is that we don't really know how many changes are needed in order to have a functional system that actually benefits from suspend blockers.
What we know is that if an application is not analyzed to see if it needs suspend blockers, and implement them if needed, it might get broken.
Quoted 9 lines
Quoted 6 lines
Quoted 1 line
Apparently different people in this debate have different targets.
I remember clearly Android people explaining that dynamic PM is orthogonal to suspend-blockers; if a suspend is blocked, you still want dynamic PM to reach the lower power state. Therefore the target of not having unneeded runnable tasks is shared by Android folks.
And I have not seen anyone argue that suspend blockers are a replacement for dynamic power management.
That's exactly what I'm saying: they are orthogonal.
Quoted 2 lines
In contrast, you are advocating dynamic power management to the exclusion of other mechanisms.
* if dynamic PM was perfect, spend-blockers would *not* be not needed
* if suspend-blockers were perfect, dynamic *will* still be needed
All I said in that sentence you are replying is that dynamic PM will improve; it's a shared goal of everyone.
Quoted 8 lines
Quoted 2 lines
IOW. Alan wasn't talking about idle vs suspend on the same device, he was talking about opportunistic suspend vs dynamic PM.
The most convincing comparisons will be of suspend vs. idle on the same device. If multiple devices are involved, then the most convincing experiments would compare suspend vs. idle separately on each device.
So, are you sure that you are correctly interpreting Alan's words?
The point you are trying to highlight is to which events the system reacts, that has nothing to do with dynamic PM vs opportunistic suspend.
Quoted 4 lines
Again, I am in no way arguing for suspend blockers to the exclusion of other approaches. Heck, I am mostly just trying to get a clear statement of the problem. In contrast, you do seem to be advocating for dynamic power management to the exclusion of other approaches.
What you are doing is copy pasting a definition of what is opportunistic suspend and making it pass as an advantage.
This particular point (3.) is not an advantage, over dynamic PM, it's just a difference.
Quoted 8 lines
Quoted 4 lines
No, I think both (for opportunistic suspend and dynamic PM) are completely reasonable. But think again; if you have the assumptions met on both, then both work fine, if you don't meet them, then both don't work correctly.
That is true of any artifact, software or otherwise: if you don't meet the assumptions inherent in its design and construction, the artifact might fail.
[...]
Quoted 2 lines
There is
a very real difference between those two tasks.
I've cut most of your explanation. If I understand correctly what you are saying is that suspend blockers are harder to get wrong. I agree, but my point against 4. remains the same: suspend-blockers don't automatically get you more efficient power usage.
Quoted 2 lines
So are you sure that dynamic power management will turn out to be the right tool for every job out there? If so, on what grounds?
I don't understand this question. Dynamic PM is needed regardless. We are discussing your point 4 where you say suspend blockers inevitably lead to more efficient power usage (I say not necessarily).
Quoted 5 lines
Quoted 3 lines
My point is that suspend-blockers don't magically reduce power usage, just like dynamic PM, it depends on what user-space actually does. You made it look as it *always* reached better energy efficiency.
I do? Really??? Exactly what did I say to give you that impression?
Here's your point 4 again:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
4. Suspend generally forces devices to go into their low-power
states immediately. In contrast, idle generally leaves unused devices at full power, relying on timers to shut down these devices. Idle thus has shorter average wakeup latencies, but worse energy efficiency.
Remove "but worse energy efficiency" and I think that point would be correct, albeit it's not really an argument in favor of opportunistic suspend.
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
It seems to me that the same social-engineering approaches work in both cases.
Yes, but if dynamic PM works as advertised, you don't need opportunistic suspend.
Quoted 6 lines
For dynamic power management to totally eliminate the need for something like suspend blockers, you are having to make some brave assumptions. Yes, dynamic power management is quite useful, but there is a big difference between something being useful and something doing everything for everyone. You have not yet convinced me that dynamic power management will make it to the "doing everything for everyone" stage.
As it has been explained before, there's a sweet-spot of idleness:
http://article.gmane.org/gmane.linux.kernel/995525
http://article.gmane.org/gmane.linux.ports.arm.omap/37982
Do you agree that there's such a thing, and if so, do you agree that the benefits of opportunistic suspend are much less once that point is reached?
Quoted 15 lines
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
If not, you'll see much worst energy efficiency. So in theory maybe, but in practice you can't say that.
Really? What makes you say that?
For starters an application might be holding the wakelock more than it should, also, an application might miss a timer due to not having PM permissions to hold the lock, and thus might need an expensive initialization when it runs again.
Just as an application might run continuously without blocking, which would defeat the dynamic power management scheme that have thus far been put forward. And just as an application might miss a timer due to dynamic power management having decided that it didn't need that timer to fire at the desired time.
Quoted 2 lines · concentrate on what I
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
If not, you'll see much worst energy efficiency. So in theory maybe, but in practice you can't say that.
I just proved to you that in certain cases opportunistic suspend might actually hurt. Thus you should accept my premise that you can't say that in practice opportunistic suspend _always_ leads to better results, because that's not the case.
And in order to try to avoid going back to the same points:
1) yes, there are advantages of opportunistic suspend
2) yes, there are cases where it works as it should
3) no, it's not a silver bullet that will inevitably improve power usage
4) no, we can't say anything about what opportunistic suspend means in practice
Signature · 1 line
Felipe Contreras
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 2 lines · Felipe Contreras
On Thu, Aug 12, 2010 at 7:19 PM, Paul E. McKenney
<[email protected]> wrote:
[ . . . ] (For now, anyway. I might respond to the rest later.)
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
My point is that suspend-blockers don't magically reduce power usage, just like dynamic PM, it depends on what user-space actually does. You made it look as it *always* reached better energy efficiency.
I do? Really??? Exactly what did I say to give you that impression?
Here's your point 4 again:
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
4. Suspend generally forces devices to go into their low-power
states immediately. In contrast, idle generally leaves unused devices at full power, relying on timers to shut down these devices. Idle thus has shorter average wakeup latencies, but worse energy efficiency.Remove "but worse energy efficiency" and I think that point would be correct,
Now this is much more like it!!! Thank you!!!
You are quite correct, my last sentence does in fact assume that suspend will always have lower power consumption than does the deepest idle state. This of course sentence must be fixed. How about the following, which makes this assumption explicit, and adds words ("often", "might") that indicate that one's mileage might vary?
4. Suspend generally forces devices to go into their
low-power states immediately. In contrast, idle generally leaves unused devices at full power, relying on timers to shut down these devices. Idle thus often has shorter average wakeup latencies, but on systems where suspend can use deeper sleep states than can idle, idle might have worse energy efficiency.
Quoted 2 lines
albeit it's not really an argument in favor of opportunistic
suspend.
It never was intended to be an argument of any kind. It was instead supposed to help clarify the difference between idle and suspend, in response to people stating that there is no difference between suspend and idle. If my mistake in the wording of the last sentence made you think otherwise, please accept my apologies.
[ . . . ] (For now, anyway. I might respond to the rest later.)
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasQuoted 2 lines · Felipe Contreras
On Thu, Aug 12, 2010 at 7:19 PM, Paul E. McKenney
<[email protected]> wrote:
[ . . . ] (For now, anyway. I might respond to the rest later.)
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
My point is that suspend-blockers don't magically reduce power usage, just like dynamic PM, it depends on what user-space actually does. You made it look as it *always* reached better energy efficiency.
I do? Really??? Exactly what did I say to give you that impression?
Here's your point 4 again:
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
4. Suspend generally forces devices to go into their low-power
states immediately. In contrast, idle generally leaves unused devices at full power, relying on timers to shut down these devices. Idle thus has shorter average wakeup latencies, but worse energy efficiency.Remove "but worse energy efficiency" and I think that point would be correct,
Now this is much more like it!!! Thank you!!!
You are quite correct, my last sentence does in fact assume that suspend will always have lower power consumption than does the deepest idle state. This of course sentence must be fixed. How about the following, which makes this assumption explicit, and adds words ("often", "might") that indicate that one's mileage might vary?
4. Suspend generally forces devices to go into their
low-power states immediately. In contrast, idle generally leaves unused devices at full power, relying on timers to shut down these devices. Idle thus often has shorter average wakeup latencies, but on systems where suspend can use deeper sleep states than can idle, idle might have worse energy efficiency.
Quoted 2 lines
albeit it's not really an argument in favor of opportunistic
suspend.
It never was intended to be an argument of any kind. It was instead supposed to help clarify the difference between idle and suspend, in response to people stating that there is no difference between suspend and idle. If my mistake in the wording of the last sentence made you think otherwise, please accept my apologies.
[ . . . ] (For now, anyway. I might respond to the rest later.)
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasQuoted 15 lines · Felipe Contreras
Quoted 13 lines · Paul E. McKenney
Quoted 9 lines · Felipe Contreras
Anyway, Alan was picturing a hypothetical point in time when x86 can suspend/resume as fast as ARM, and thus the question of whether or not to enable suspend-blockers in a system that runs openoffice becomes relevant. If applications have been fixed by that time to not wake the system unnecessarily, as many of them have already been tanks to tools like powertop, then suspend-blockers would not make that much of a difference, therefore the effort required to implement suspend-blockers properly on all applications in the system, including openoffice might not be worth the gain.
One more time, this time with feeling. ;-)
Quoted 8 lines
Quoted 3 lines
Only PM-driving applications need concern themselves with suspend blockers, and experience thus far indicates that PM-driving applications are a very small fraction of the total.
There's no experience on this. Have you tried to run a small debian system with suspend blockers enabled? I can image at least all cron daemons need modifications, probably dbus, links, lftp, wget, rsync and a bunch of applications that download data too.
I have not. I would be surprised if anyone else did that work unless suspend blockers were in mainline. I would be very happy to be proven wrong, of course!
Quoted 8 lines
It's easy to speculate one way or the other, but the fact of the matter is that we don't really know how many changes are needed in order to have a functional system that actually benefits from suspend blockers.
What we know is that if an application is not analyzed to see if it needs suspend blockers, and implement them if needed, it might get broken.
That would be your speculation. Perhaps you are correct, but it seems more likely that some large sets applications can be considered as a group rather than one at a time.
Quoted 11 lines
Quoted 9 lines
Quoted 6 lines
Quoted 1 line
Apparently different people in this debate have different targets.
I remember clearly Android people explaining that dynamic PM is orthogonal to suspend-blockers; if a suspend is blocked, you still want dynamic PM to reach the lower power state. Therefore the target of not having unneeded runnable tasks is shared by Android folks.
And I have not seen anyone argue that suspend blockers are a replacement for dynamic power management.
That's exactly what I'm saying: they are orthogonal.
OK, good to know! Please understand that your sentence "Therefore the target of not having unneeded runnable tasks is shared by Android folks" can be interpreted as meaning "the Android guys really don't need suspend blockers", which is how I interpreted it.
Quoted 8 lines
Quoted 2 lines
In contrast, you are advocating dynamic power management to the exclusion of other mechanisms.
* if dynamic PM was perfect, spend-blockers would *not* be not needed
* if suspend-blockers were perfect, dynamic *will* still be neededAll I said in that sentence you are replying is that dynamic PM will improve; it's a shared goal of everyone.
That is certainly not the way I read the sentence I was replying to, but I will accept that this was what you were really trying to say.
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
IOW. Alan wasn't talking about idle vs suspend on the same device, he was talking about opportunistic suspend vs dynamic PM.
The most convincing comparisons will be of suspend vs. idle on the same device. If multiple devices are involved, then the most convincing experiments would compare suspend vs. idle separately on each device.
Quoted 5 lines
Quoted 1 line
So, are you sure that you are correctly interpreting Alan's words?
The point you are trying to highlight is to which events the system reacts, that has nothing to do with dynamic PM vs opportunistic suspend.
Ahem. I -do- know what -I- was trying to say. ;-)
Quoted 7 lines
Quoted 4 lines
Again, I am in no way arguing for suspend blockers to the exclusion of other approaches. Heck, I am mostly just trying to get a clear statement of the problem. In contrast, you do seem to be advocating for dynamic power management to the exclusion of other approaches.
What you are doing is copy pasting a definition of what is opportunistic suspend and making it pass as an advantage.
No, I was copy pasting a definition of a difference between idle and suspend and making it pass as a difference between idle and suspend.
Quoted 2 lines
This particular point (3.) is not an advantage, over dynamic PM, it's just a difference.
Yep. I never claimed otherwise.
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
No, I think both (for opportunistic suspend and dynamic PM) are completely reasonable. But think again; if you have the assumptions met on both, then both work fine, if you don't meet them, then both don't work correctly.
That is true of any artifact, software or otherwise: if you don't meet the assumptions inherent in its design and construction, the artifact might fail.
Quoted 6 lines
[...]
Quoted 2 lines
There is
a very real difference between those two tasks.I've cut most of your explanation.
Indeed you have! But you should be safe in doing so, as most people probably won't bother to do the web search that would lead them to
http://lkml.org/lkml/2010/8/12/198 and then search that page for the word "artifact". ;-)
Quoted 4 lines
If I understand correctly what you
are saying is that suspend blockers are harder to get wrong. I agree, but my point against 4. remains the same: suspend-blockers don't automatically get you more efficient power usage.
I am glad you agree that suspend blockers might be harder to get wrong. As to point #4, you were correct that I badly worded the last sentence, which is now hopefully fixed to your satisfaction.
Quoted 6 lines
Quoted 2 lines
So are you sure that dynamic power management will turn out to be the right tool for every job out there? If so, on what grounds?
I don't understand this question. Dynamic PM is needed regardless. We are discussing your point 4 where you say suspend blockers inevitably lead to more efficient power usage (I say not necessarily).
But can dynamic power management do everything optimally? If not, some other approach may be needed in addition to dynamic power management. If you really are arguing that the Linux kernel should support no power-management mechanism other than dynamic power management, you should be prepared to justify that position.
Quoted 14 lines
Quoted 5 lines
Quoted 3 lines
My point is that suspend-blockers don't magically reduce power usage, just like dynamic PM, it depends on what user-space actually does. You made it look as it *always* reached better energy efficiency.
I do? Really??? Exactly what did I say to give you that impression?
Here's your point 4 again:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
4. Suspend generally forces devices to go into their low-power
states immediately. In contrast, idle generally leaves unused devices at full power, relying on timers to shut down these devices. Idle thus has shorter average wakeup latencies, but worse energy efficiency.
Quoted 3 lines
Remove "but worse energy efficiency" and I think that point would be correct, albeit it's not really an argument in favor of opportunistic suspend.
Fix put forward in earlier email. Again, thank you -- good catch!!!
Quoted 13 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
It seems to me that the same social-engineering approaches work in both cases.
Yes, but if dynamic PM works as advertised, you don't need opportunistic suspend.
Quoted 6 lines
For dynamic power management to totally eliminate the need for something like suspend blockers, you are having to make some brave assumptions. Yes, dynamic power management is quite useful, but there is a big difference between something being useful and something doing everything for everyone. You have not yet convinced me that dynamic power management will make it to the "doing everything for everyone" stage.
Quoted 7 lines
As it has been explained before, there's a sweet-spot of idleness:
http://article.gmane.org/gmane.linux.kernel/995525
http://article.gmane.org/gmane.linux.ports.arm.omap/37982Do you agree that there's such a thing, and if so, do you agree that the benefits of opportunistic suspend are much less once that point is reached?
I agree that there will be a sweet spot of idleness (though I would call it a "point of diminishing returns"), but only if all the applications are power-optimized. The advantage of opportunistic suspend is instead its tolerance of power-oblivious applications with minimal degradation of battery life.
Quoted 16 lines
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
If not, you'll see much worst energy efficiency. So in theory maybe, but in practice you can't say that.
Really? What makes you say that?
For starters an application might be holding the wakelock more than it should, also, an application might miss a timer due to not having PM permissions to hold the lock, and thus might need an expensive initialization when it runs again.
Quoted 5 lines
Just as an application might run continuously without blocking, which would defeat the dynamic power management scheme that have thus far been put forward. And just as an application might miss a timer due to dynamic power management having decided that it didn't need that timer to fire at the desired time.
Quoted 8 lines
Quoted 2 lines · concentrate on what I
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
If not, you'll see much worst energy efficiency. So in theory maybe, but in practice you can't say that.
I just proved to you that in certain cases opportunistic suspend might actually hurt. Thus you should accept my premise that you can't say that in practice opportunistic suspend _always_ leads to better results, because that's not the case.
And in the paragraph above, I proved to you that relying solely on dynamic power management might actually hurt. And I am not trying to prove that opportunistic suspend always leads to better results -- that is a strawman that you set up. And yes, you might have been led to set up that strawman because I messed up the wording of one of the suspend-vs.-idle definitions. Of course, had you called out that sentence to start with, we would likely have spent much less time arguing generalities. ;-)
Quoted 2 lines
And in order to try to avoid going back to the same points:
1) yes, there are advantages of opportunistic suspend
Good, agreed.
Quoted 1 line
2) yes, there are cases where it works as it should
Good, agreed.
Quoted 1 line
3) no, it's not a silver bullet that will inevitably improve power usage
Agreed. This is no surprise, as there are very few silver bullets to be had in this field. Of course, dynamic power management is not a silver bullet, either.
Quoted 1 line
4) no, we can't say anything about what opportunistic suspend means in practice
Here I disagree. The Android folks have used it for quite some time. We might not be able to apply their experience directly to other software stacks, but we should nevertheless be able to learn quite a bit from it.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasQuoted 15 lines · Felipe Contreras
Quoted 13 lines · Paul E. McKenney
Quoted 9 lines · Felipe Contreras
Anyway, Alan was picturing a hypothetical point in time when x86 can suspend/resume as fast as ARM, and thus the question of whether or not to enable suspend-blockers in a system that runs openoffice becomes relevant. If applications have been fixed by that time to not wake the system unnecessarily, as many of them have already been tanks to tools like powertop, then suspend-blockers would not make that much of a difference, therefore the effort required to implement suspend-blockers properly on all applications in the system, including openoffice might not be worth the gain.
One more time, this time with feeling. ;-)
Quoted 8 lines
Quoted 3 lines
Only PM-driving applications need concern themselves with suspend blockers, and experience thus far indicates that PM-driving applications are a very small fraction of the total.
There's no experience on this. Have you tried to run a small debian system with suspend blockers enabled? I can image at least all cron daemons need modifications, probably dbus, links, lftp, wget, rsync and a bunch of applications that download data too.
I have not. I would be surprised if anyone else did that work unless suspend blockers were in mainline. I would be very happy to be proven wrong, of course!
Quoted 8 lines
It's easy to speculate one way or the other, but the fact of the matter is that we don't really know how many changes are needed in order to have a functional system that actually benefits from suspend blockers.
What we know is that if an application is not analyzed to see if it needs suspend blockers, and implement them if needed, it might get broken.
That would be your speculation. Perhaps you are correct, but it seems more likely that some large sets applications can be considered as a group rather than one at a time.
Quoted 11 lines
Quoted 9 lines
Quoted 6 lines
Quoted 1 line
Apparently different people in this debate have different targets.
I remember clearly Android people explaining that dynamic PM is orthogonal to suspend-blockers; if a suspend is blocked, you still want dynamic PM to reach the lower power state. Therefore the target of not having unneeded runnable tasks is shared by Android folks.
And I have not seen anyone argue that suspend blockers are a replacement for dynamic power management.
That's exactly what I'm saying: they are orthogonal.
OK, good to know! Please understand that your sentence "Therefore the target of not having unneeded runnable tasks is shared by Android folks" can be interpreted as meaning "the Android guys really don't need suspend blockers", which is how I interpreted it.
Quoted 8 lines
Quoted 2 lines
In contrast, you are advocating dynamic power management to the exclusion of other mechanisms.
* if dynamic PM was perfect, spend-blockers would *not* be not needed
* if suspend-blockers were perfect, dynamic *will* still be neededAll I said in that sentence you are replying is that dynamic PM will improve; it's a shared goal of everyone.
That is certainly not the way I read the sentence I was replying to, but I will accept that this was what you were really trying to say.
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
IOW. Alan wasn't talking about idle vs suspend on the same device, he was talking about opportunistic suspend vs dynamic PM.
The most convincing comparisons will be of suspend vs. idle on the same device. If multiple devices are involved, then the most convincing experiments would compare suspend vs. idle separately on each device.
Quoted 5 lines
Quoted 1 line
So, are you sure that you are correctly interpreting Alan's words?
The point you are trying to highlight is to which events the system reacts, that has nothing to do with dynamic PM vs opportunistic suspend.
Ahem. I -do- know what -I- was trying to say. ;-)
Quoted 7 lines
Quoted 4 lines
Again, I am in no way arguing for suspend blockers to the exclusion of other approaches. Heck, I am mostly just trying to get a clear statement of the problem. In contrast, you do seem to be advocating for dynamic power management to the exclusion of other approaches.
What you are doing is copy pasting a definition of what is opportunistic suspend and making it pass as an advantage.
No, I was copy pasting a definition of a difference between idle and suspend and making it pass as a difference between idle and suspend.
Quoted 2 lines
This particular point (3.) is not an advantage, over dynamic PM, it's just a difference.
Yep. I never claimed otherwise.
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
No, I think both (for opportunistic suspend and dynamic PM) are completely reasonable. But think again; if you have the assumptions met on both, then both work fine, if you don't meet them, then both don't work correctly.
That is true of any artifact, software or otherwise: if you don't meet the assumptions inherent in its design and construction, the artifact might fail.
Quoted 6 lines
[...]
Quoted 2 lines
There is
a very real difference between those two tasks.I've cut most of your explanation.
Indeed you have! But you should be safe in doing so, as most people probably won't bother to do the web search that would lead them to
http://lkml.org/lkml/2010/8/12/198 and then search that page for the word "artifact". ;-)
Quoted 4 lines
If I understand correctly what you
are saying is that suspend blockers are harder to get wrong. I agree, but my point against 4. remains the same: suspend-blockers don't automatically get you more efficient power usage.
I am glad you agree that suspend blockers might be harder to get wrong. As to point #4, you were correct that I badly worded the last sentence, which is now hopefully fixed to your satisfaction.
Quoted 6 lines
Quoted 2 lines
So are you sure that dynamic power management will turn out to be the right tool for every job out there? If so, on what grounds?
I don't understand this question. Dynamic PM is needed regardless. We are discussing your point 4 where you say suspend blockers inevitably lead to more efficient power usage (I say not necessarily).
But can dynamic power management do everything optimally? If not, some other approach may be needed in addition to dynamic power management. If you really are arguing that the Linux kernel should support no power-management mechanism other than dynamic power management, you should be prepared to justify that position.
Quoted 14 lines
Quoted 5 lines
Quoted 3 lines
My point is that suspend-blockers don't magically reduce power usage, just like dynamic PM, it depends on what user-space actually does. You made it look as it *always* reached better energy efficiency.
I do? Really??? Exactly what did I say to give you that impression?
Here's your point 4 again:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
4. Suspend generally forces devices to go into their low-power
states immediately. In contrast, idle generally leaves unused devices at full power, relying on timers to shut down these devices. Idle thus has shorter average wakeup latencies, but worse energy efficiency.
Quoted 3 lines
Remove "but worse energy efficiency" and I think that point would be correct, albeit it's not really an argument in favor of opportunistic suspend.
Fix put forward in earlier email. Again, thank you -- good catch!!!
Quoted 13 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
It seems to me that the same social-engineering approaches work in both cases.
Yes, but if dynamic PM works as advertised, you don't need opportunistic suspend.
Quoted 6 lines
For dynamic power management to totally eliminate the need for something like suspend blockers, you are having to make some brave assumptions. Yes, dynamic power management is quite useful, but there is a big difference between something being useful and something doing everything for everyone. You have not yet convinced me that dynamic power management will make it to the "doing everything for everyone" stage.
Quoted 7 lines
As it has been explained before, there's a sweet-spot of idleness:
http://article.gmane.org/gmane.linux.kernel/995525
http://article.gmane.org/gmane.linux.ports.arm.omap/37982Do you agree that there's such a thing, and if so, do you agree that the benefits of opportunistic suspend are much less once that point is reached?
I agree that there will be a sweet spot of idleness (though I would call it a "point of diminishing returns"), but only if all the applications are power-optimized. The advantage of opportunistic suspend is instead its tolerance of power-oblivious applications with minimal degradation of battery life.
Quoted 16 lines
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
If not, you'll see much worst energy efficiency. So in theory maybe, but in practice you can't say that.
Really? What makes you say that?
For starters an application might be holding the wakelock more than it should, also, an application might miss a timer due to not having PM permissions to hold the lock, and thus might need an expensive initialization when it runs again.
Quoted 5 lines
Just as an application might run continuously without blocking, which would defeat the dynamic power management scheme that have thus far been put forward. And just as an application might miss a timer due to dynamic power management having decided that it didn't need that timer to fire at the desired time.
Quoted 8 lines
Quoted 2 lines · concentrate on what I
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
If not, you'll see much worst energy efficiency. So in theory maybe, but in practice you can't say that.
I just proved to you that in certain cases opportunistic suspend might actually hurt. Thus you should accept my premise that you can't say that in practice opportunistic suspend _always_ leads to better results, because that's not the case.
And in the paragraph above, I proved to you that relying solely on dynamic power management might actually hurt. And I am not trying to prove that opportunistic suspend always leads to better results -- that is a strawman that you set up. And yes, you might have been led to set up that strawman because I messed up the wording of one of the suspend-vs.-idle definitions. Of course, had you called out that sentence to start with, we would likely have spent much less time arguing generalities. ;-)
Quoted 2 lines
And in order to try to avoid going back to the same points:
1) yes, there are advantages of opportunistic suspend
Good, agreed.
Quoted 1 line
2) yes, there are cases where it works as it should
Good, agreed.
Quoted 1 line
3) no, it's not a silver bullet that will inevitably improve power usage
Agreed. This is no surprise, as there are very few silver bullets to be had in this field. Of course, dynamic power management is not a silver bullet, either.
Quoted 1 line
4) no, we can't say anything about what opportunistic suspend means in practice
Here I disagree. The Android folks have used it for quite some time. We might not be able to apply their experience directly to other software stacks, but we should nevertheless be able to learn quite a bit from it.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 6 lines · Paul E. McKenney
Quoted 1 line · Felipe Contreras
4) no, we can't say anything about what opportunistic suspend means in practice
Here I disagree. The Android folks have used it for quite some time. We might not be able to apply their experience directly to other software stacks, but we should nevertheless be able to learn quite a bit from it.
So when it comes to practice you are relying solely on what Android people say.
If it's true that it's easy to spot the "PM-driving applications", then it shouldn't be hard for a guy from the Android team to assemble a basic typical system (X.org, dbus, etc.) with suspend-blockers in a couple of days.
Signature · 5 lines
Felipe Contreras _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Paul E. McKenneyQuoted 6 lines · Paul E. McKenney
Quoted 1 line · Felipe Contreras
4) no, we can't say anything about what opportunistic suspend means in practice
Here I disagree. The Android folks have used it for quite some time. We might not be able to apply their experience directly to other software stacks, but we should nevertheless be able to learn quite a bit from it.
So when it comes to practice you are relying solely on what Android people say.
If it's true that it's easy to spot the "PM-driving applications", then it shouldn't be hard for a guy from the Android team to assemble a basic typical system (X.org, dbus, etc.) with suspend-blockers in a couple of days.
Signature · 1 line
Felipe Contreras
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 10 lines · Felipe Contreras
Quoted 6 lines · Paul E. McKenney
Quoted 1 line · Felipe Contreras
4) no, we can't say anything about what opportunistic suspend means in practice
Here I disagree. The Android folks have used it for quite some time. We might not be able to apply their experience directly to other software stacks, but we should nevertheless be able to learn quite a bit from it.
So when it comes to practice you are relying solely on what Android people say.
So when it comes to practice with suspend blockers, only the Android people have any experience, so theirs is the only experience with suspend blockers that there is to rely on. ;-) ;-) ;-)
Quoted 4 lines
If it's true that it's easy to spot the "PM-driving applications", then it shouldn't be hard for a guy from the Android team to assemble a basic typical system (X.org, dbus, etc.) with suspend-blockers in a couple of days.
I am happy to let the Android guys determine the best use for their time.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasQuoted 10 lines · Felipe Contreras
Quoted 6 lines · Paul E. McKenney
Quoted 1 line · Felipe Contreras
4) no, we can't say anything about what opportunistic suspend means in practice
Here I disagree. The Android folks have used it for quite some time. We might not be able to apply their experience directly to other software stacks, but we should nevertheless be able to learn quite a bit from it.
So when it comes to practice you are relying solely on what Android people say.
So when it comes to practice with suspend blockers, only the Android people have any experience, so theirs is the only experience with suspend blockers that there is to rely on. ;-) ;-) ;-)
Quoted 4 lines
If it's true that it's easy to spot the "PM-driving applications", then it shouldn't be hard for a guy from the Android team to assemble a basic typical system (X.org, dbus, etc.) with suspend-blockers in a couple of days.
I am happy to let the Android guys determine the best use for their time.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Paul E. McKenneyQuoted 25 lines · Paul E. McKenney
Quoted 16 lines · Felipe Contreras
Quoted 7 lines · Paul E. McKenney
Quoted 5 lines · Felipe Contreras
Quoted 2 lines
It seems to me that the same social-engineering approaches work in both cases.
Yes, but if dynamic PM works as advertised, you don't need opportunistic suspend.
Quoted 6 lines
For dynamic power management to totally eliminate the need for something like suspend blockers, you are having to make some brave assumptions. Yes, dynamic power management is quite useful, but there is a big difference between something being useful and something doing everything for everyone. You have not yet convinced me that dynamic power management will make it to the "doing everything for everyone" stage.
Quoted 7 lines
As it has been explained before, there's a sweet-spot of idleness:
http://article.gmane.org/gmane.linux.kernel/995525
http://article.gmane.org/gmane.linux.ports.arm.omap/37982Do you agree that there's such a thing, and if so, do you agree that the benefits of opportunistic suspend are much less once that point is reached?
Quoted 5 lines
I agree that there will be a sweet spot of idleness (though I would call it a "point of diminishing returns"), but only if all the applications are power-optimized. The advantage of opportunistic suspend is instead its tolerance of power-oblivious applications with minimal degradation of battery life.
sorry for the late response, the last week has been very hectic.
I just wanted to note that there is already a tool in the kernel to deal with this, the timer jitter/fuzz control. This can be set by an application for itself, or it can be set by some other process for an application (I don't remember the details of all the ways this can be set)
This could be used in a way similar to how userspace wakelocks are set today, if the power management process (that holds the wakelock and keep sthe screen lit today) thinks the system should be awake, let the jitter/fuzz be small, if that process thinks the system should probably be asleep, set the jitter/fuzz to a larger value. If other things are running anyway, the timers can fire and be serviced normally, otherwise the kernel is free to delay the timer going off even for badly written processes.
David Lang
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 41 lines · On Thu, Aug 19, 2010 at 04:10:10PM -0700, [email protected] wrote:
Quoted 25 lines · Paul E. McKenney
Quoted 16 lines · Felipe Contreras
Quoted 7 lines · Paul E. McKenney
Quoted 5 lines · Felipe Contreras
Quoted 2 lines
It seems to me that the same social-engineering approaches work in both cases.
Yes, but if dynamic PM works as advertised, you don't need opportunistic suspend.
Quoted 6 lines
For dynamic power management to totally eliminate the need for something like suspend blockers, you are having to make some brave assumptions. Yes, dynamic power management is quite useful, but there is a big difference between something being useful and something doing everything for everyone. You have not yet convinced me that dynamic power management will make it to the "doing everything for everyone" stage.
Quoted 7 lines
As it has been explained before, there's a sweet-spot of idleness:
http://article.gmane.org/gmane.linux.kernel/995525
http://article.gmane.org/gmane.linux.ports.arm.omap/37982Do you agree that there's such a thing, and if so, do you agree that the benefits of opportunistic suspend are much less once that point is reached?
Quoted 5 lines
I agree that there will be a sweet spot of idleness (though I would call it a "point of diminishing returns"), but only if all the applications are power-optimized. The advantage of opportunistic suspend is instead its tolerance of power-oblivious applications with minimal degradation of battery life.
sorry for the late response, the last week has been very hectic.
I just wanted to note that there is already a tool in the kernel to deal with this, the timer jitter/fuzz control. This can be set by an application for itself, or it can be set by some other process for an application (I don't remember the details of all the ways this can be set)
Quoted 8 lines
This could be used in a way similar to how userspace wakelocks are set today, if the power management process (that holds the wakelock and keep sthe screen lit today) thinks the system should be awake, let the jitter/fuzz be small, if that process thinks the system should probably be asleep, set the jitter/fuzz to a larger value. If other things are running anyway, the timers can fire and be serviced normally, otherwise the kernel is free to delay the timer going off even for badly written processes.
Indeed, Rafael and Alan Stern are working to make pm_qos do what the Android guys need, which could (very roughly) be thought of as extending the jitter/fuzz such that it meets Android's requirements.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to [email protected]Quoted 41 lines · On Thu, Aug 19, 2010 at 04:10:10PM -0700, [email protected] wrote:
Quoted 25 lines · Paul E. McKenney
Quoted 16 lines · Felipe Contreras
Quoted 7 lines · Paul E. McKenney
Quoted 5 lines · Felipe Contreras
Quoted 2 lines
It seems to me that the same social-engineering approaches work in both cases.
Yes, but if dynamic PM works as advertised, you don't need opportunistic suspend.
Quoted 6 lines
For dynamic power management to totally eliminate the need for something like suspend blockers, you are having to make some brave assumptions. Yes, dynamic power management is quite useful, but there is a big difference between something being useful and something doing everything for everyone. You have not yet convinced me that dynamic power management will make it to the "doing everything for everyone" stage.
Quoted 7 lines
As it has been explained before, there's a sweet-spot of idleness:
http://article.gmane.org/gmane.linux.kernel/995525
http://article.gmane.org/gmane.linux.ports.arm.omap/37982Do you agree that there's such a thing, and if so, do you agree that the benefits of opportunistic suspend are much less once that point is reached?
Quoted 5 lines
I agree that there will be a sweet spot of idleness (though I would call it a "point of diminishing returns"), but only if all the applications are power-optimized. The advantage of opportunistic suspend is instead its tolerance of power-oblivious applications with minimal degradation of battery life.
sorry for the late response, the last week has been very hectic.
I just wanted to note that there is already a tool in the kernel to deal with this, the timer jitter/fuzz control. This can be set by an application for itself, or it can be set by some other process for an application (I don't remember the details of all the ways this can be set)
Quoted 8 lines
This could be used in a way similar to how userspace wakelocks are set today, if the power management process (that holds the wakelock and keep sthe screen lit today) thinks the system should be awake, let the jitter/fuzz be small, if that process thinks the system should probably be asleep, set the jitter/fuzz to a larger value. If other things are running anyway, the timers can fire and be serviced normally, otherwise the kernel is free to delay the timer going off even for badly written processes.
Indeed, Rafael and Alan Stern are working to make pm_qos do what the Android guys need, which could (very roughly) be thought of as extending the jitter/fuzz such that it meets Android's requirements.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Paul E. McKenneyQuoted 11 lines · Paul E. McKenney
Quoted 3 lines · Alan Cox
You are tightly linking suspend blockers with Android. If they were a sensible general solution they would be generic not tied closely to Android
Android is certainly where suspend blockers originated, and is to the best of my knowledge is still the only platform that uses them. But there is a first user of every new mechanism, and for some time that first user will by definition be the only user of that mechanism. So the fact that Android is most probably the only user of suspend blockers does not prove anything about whether or not suspend blockers are sensible.
No, it's the fact that *nobody* else has said: hey, that looks like a good idea, we should use that in our mobile platform (or any platform).
Signature · 5 lines
Felipe Contreras _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Paul E. McKenneyQuoted 11 lines · Paul E. McKenney
Quoted 3 lines · Alan Cox
You are tightly linking suspend blockers with Android. If they were a sensible general solution they would be generic not tied closely to Android
Android is certainly where suspend blockers originated, and is to the best of my knowledge is still the only platform that uses them. But there is a first user of every new mechanism, and for some time that first user will by definition be the only user of that mechanism. So the fact that Android is most probably the only user of suspend blockers does not prove anything about whether or not suspend blockers are sensible.
No, it's the fact that *nobody* else has said: hey, that looks like a good idea, we should use that in our mobile platform (or any platform).
Signature · 1 line
Felipe Contreras
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 9 lines · Felipe Contreras
On Tue, Aug 10, 2010 at 7:45 AM, Paul E. McKenney
Quoted 6 lines
Android is certainly where suspend blockers originated, and is to the best of my knowledge is still the only platform that uses them. ??But there is a first user of every new mechanism, and for some time that first user will by definition be the only user of that mechanism. ??So the fact that Android is most probably the only user of suspend blockers does not prove anything about whether or not suspend blockers are sensible.
Quoted 3 lines
No, it's the fact that *nobody* else has said: hey, that looks like a good idea, we should use that in our mobile platform (or any platform).
I don't think lack of external adoption is a terribly useful data point either way at the minute. While the feature is controversial a lot of the OSs will probably hold off on it (because it's effort to handle out of tree stuff and folks are really busy) and there's not that many out there which support random externally written packages (which is the major push for exporting the feature to userspace) in the first place.
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasQuoted 9 lines · Felipe Contreras
On Tue, Aug 10, 2010 at 7:45 AM, Paul E. McKenney
Quoted 6 lines
Android is certainly where suspend blockers originated, and is to the best of my knowledge is still the only platform that uses them. ??But there is a first user of every new mechanism, and for some time that first user will by definition be the only user of that mechanism. ??So the fact that Android is most probably the only user of suspend blockers does not prove anything about whether or not suspend blockers are sensible.
Quoted 3 lines
No, it's the fact that *nobody* else has said: hey, that looks like a good idea, we should use that in our mobile platform (or any platform).
I don't think lack of external adoption is a terribly useful data point either way at the minute. While the feature is controversial a lot of the OSs will probably hold off on it (because it's effort to handle out of tree stuff and folks are really busy) and there's not that many out there which support random externally written packages (which is the major push for exporting the feature to userspace) in the first place.
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Paul E. McKenneyQuoted 2 lines
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when
I was waiting for soemone to leap down the pit I dug Office suites have some quite important background activities. Consider the case of a power oblivious Open Office. You type a critical document, you suspend, your phone battery dies a bit later, you lost your document. Office suites do timed backing up as one simple obvious example. That could become a power aware behaviour but the truely power oblivious office suite is a myth.
Quoted 4 lines
the screen is turned off, so these the applications do not need to use suspend blockers. That said, I could easily imagine that significant work would be required to make OpenOffice run on Android, not due to suspend blockers, but rather due to Android's unusual user space.
You are tightly linking suspend blockers with Android. If they were a sensible general solution they would be generic not tied closely to Android
Some of the other bad assumptions being made in this discussion:
- That the phone is special. Todays Android phones are up with the PC's of some years back (but with better graphics and more faster storage), in a few more generations of the technology what will they look like ? I'm sure that within a few years there will be people playing Warcraft or similar on their phone in the train.
- That Android will continue to tbe offering the same services in future as today. If it does it'll go the way of PalmOS and Symbian. Equally you can't just bust all the apps as it changes
As devices get more complex and varied you cannot afford to put the detailed awareness of platform behaviour in the applications. It doesn't scale. Android developers are haivng enough fun coping with all the OS variants, customisations and new phones - and thats far less variety than PC hardware. Generally the PC app folks are not having the same level of problem - so ask why ?
Quoted 6 lines
On devices that do not have suspend blockers, a normal application runs in a manner similar to a hypothetical Android application that acquires a suspend blocker when it starts and holds that suspend blocker until it exits. In contrast with Android, this situation requires that each and every application be carefully written to avoid battery drain, which I suspect is what Ted is getting at with his King Canute analogy.
Which is flawed and not the case. The same argument could be made for multi-tasking
DOS "Each application implements its own internal
multitasking/polling if needed"
Windows 3.x "Each application has an event loop and is built
in a certain way" (the 'suspend blocker' mentality)
Real OS "The scheduler operates in a manner which prevents
CPU hogs breaking the system or abusing it sufficiently to threaten its functionality"
The same applies to power. Only the OS has the big picture and can hide the hardware and general policy variety from the application.
OpenOffice runs on netbooks, laptops, servers, even big non x86 boxes. It runs on virtual machines, it runs in power sensitive environments, it runs in thermally constrained environments, it runs in I/O constrained environments, it runs in latency constrained environments etc etc
All the same code, true some work has been done to make it behave politely but the rest is down to the OS doing its job - deploying the resources available while considering and obeying the constraints present, in a manner which makes best use of the resources to achieve the policy goals of the system.
And not unsurprisingly that all starts to look like Stafford Beer's good old viable systems model.
Alan
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Paul E. McKenneyQuoted 4 lines · Paul E. McKenney
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when the screen is turned off, so these the applications do not need to use suspend blockers.
Ideally the system would be suspended even when the screen is on. If there are no "trusted" applications running at the same time, then openoffice wouldn't load at all. Right?
Signature · 5 lines
Felipe Contreras _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Paul E. McKenneyQuoted 4 lines · Paul E. McKenney
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when the screen is turned off, so these the applications do not need to use suspend blockers.
Ideally the system would be suspended even when the screen is on. If there are no "trusted" applications running at the same time, then openoffice wouldn't load at all. Right?
Signature · 1 line
Felipe Contreras
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 10 lines · Felipe Contreras
Quoted 4 lines · Paul E. McKenney
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when the screen is turned off, so these the applications do not need to use suspend blockers.
Ideally the system would be suspended even when the screen is on. If there are no "trusted" applications running at the same time, then openoffice wouldn't load at all. Right?
My understanding is that Android systems in fact do not suspend when the screen is on, and that most (perhaps all) other systems do not opportunistically suspend at all. There has been some speculation about what a hypothetical Android having a non-volatile display might do, but as far as I know, this is just speculation.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasQuoted 10 lines · Felipe Contreras
Quoted 4 lines · Paul E. McKenney
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when the screen is turned off, so these the applications do not need to use suspend blockers.
Ideally the system would be suspended even when the screen is on. If there are no "trusted" applications running at the same time, then openoffice wouldn't load at all. Right?
My understanding is that Android systems in fact do not suspend when the screen is on, and that most (perhaps all) other systems do not opportunistically suspend at all. There has been some speculation about what a hypothetical Android having a non-volatile display might do, but as far as I know, this is just speculation.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 12 lines · Paul E. McKenney
Quoted 10 lines · Felipe Contreras
Quoted 4 lines · Paul E. McKenney
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when the screen is turned off, so these the applications do not need to use suspend blockers.
Ideally the system would be suspended even when the screen is on. If there are no "trusted" applications running at the same time, then openoffice wouldn't load at all. Right?
Quoted 5 lines
My understanding is that Android systems in fact do not suspend when the screen is on, and that most (perhaps all) other systems do not opportunistically suspend at all. There has been some speculation about what a hypothetical Android having a non-volatile display might do, but as far as I know, this is just speculation.
I have a desktop system in mind. If opportunistic suspend is only triggered when the display is off, then it's no good for normal usage, and therefore dynamic PC needs to get its act together... specially for laptops.
Signature · 5 lines
Felipe Contreras _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Paul E. McKenneyQuoted 12 lines · Paul E. McKenney
Quoted 10 lines · Felipe Contreras
Quoted 4 lines · Paul E. McKenney
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when the screen is turned off, so these the applications do not need to use suspend blockers.
Ideally the system would be suspended even when the screen is on. If there are no "trusted" applications running at the same time, then openoffice wouldn't load at all. Right?
Quoted 5 lines
My understanding is that Android systems in fact do not suspend when the screen is on, and that most (perhaps all) other systems do not opportunistically suspend at all. There has been some speculation about what a hypothetical Android having a non-volatile display might do, but as far as I know, this is just speculation.
I have a desktop system in mind. If opportunistic suspend is only triggered when the display is off, then it's no good for normal usage, and therefore dynamic PC needs to get its act together... specially for laptops.
Signature · 1 line
Felipe Contreras
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 20 lines · Felipe Contreras
Quoted 12 lines · Paul E. McKenney
Quoted 10 lines · Felipe Contreras
Quoted 4 lines · Paul E. McKenney
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when the screen is turned off, so these the applications do not need to use suspend blockers.
Ideally the system would be suspended even when the screen is on. If there are no "trusted" applications running at the same time, then openoffice wouldn't load at all. Right?
Quoted 5 lines
My understanding is that Android systems in fact do not suspend when the screen is on, and that most (perhaps all) other systems do not opportunistically suspend at all. There has been some speculation about what a hypothetical Android having a non-volatile display might do, but as far as I know, this is just speculation.
Quoted 4 lines
I have a desktop system in mind. If opportunistic suspend is only triggered when the display is off, then it's no good for normal usage, and therefore dynamic PC needs to get its act together... specially for laptops.
If I understand you correctly, you are saying that both opportunistic suspend and dynamic power control should be used together, with dynamic power control being used for short non-busy periods (as in between keystrokes) and opportunistic suspend being used for longer non-busy periods (as in while grabbing a coffee). That combination of usage sounds promising to me.
That said, I don't know that anyone has really sat down and thought through how one might apply suspend blockers to a desktop system. I suspect that there are several ways to go about it.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasQuoted 20 lines · Felipe Contreras
Quoted 12 lines · Paul E. McKenney
Quoted 10 lines · Felipe Contreras
Quoted 4 lines · Paul E. McKenney
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when the screen is turned off, so these the applications do not need to use suspend blockers.
Ideally the system would be suspended even when the screen is on. If there are no "trusted" applications running at the same time, then openoffice wouldn't load at all. Right?
Quoted 5 lines
My understanding is that Android systems in fact do not suspend when the screen is on, and that most (perhaps all) other systems do not opportunistically suspend at all. There has been some speculation about what a hypothetical Android having a non-volatile display might do, but as far as I know, this is just speculation.
Quoted 4 lines
I have a desktop system in mind. If opportunistic suspend is only triggered when the display is off, then it's no good for normal usage, and therefore dynamic PC needs to get its act together... specially for laptops.
If I understand you correctly, you are saying that both opportunistic suspend and dynamic power control should be used together, with dynamic power control being used for short non-busy periods (as in between keystrokes) and opportunistic suspend being used for longer non-busy periods (as in while grabbing a coffee). That combination of usage sounds promising to me.
That said, I don't know that anyone has really sat down and thought through how one might apply suspend blockers to a desktop system. I suspect that there are several ways to go about it.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 26 lines · Paul E. McKenney
Quoted 20 lines · Felipe Contreras
Quoted 12 lines · Paul E. McKenney
Quoted 10 lines · Felipe Contreras
Quoted 4 lines · Paul E. McKenney
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when the screen is turned off, so these the applications do not need to use suspend blockers.
Ideally the system would be suspended even when the screen is on. If there are no "trusted" applications running at the same time, then openoffice wouldn't load at all. Right?
Quoted 5 lines
My understanding is that Android systems in fact do not suspend when the screen is on, and that most (perhaps all) other systems do not opportunistically suspend at all. There has been some speculation about what a hypothetical Android having a non-volatile display might do, but as far as I know, this is just speculation.
Quoted 4 lines
I have a desktop system in mind. If opportunistic suspend is only triggered when the display is off, then it's no good for normal usage, and therefore dynamic PC needs to get its act together... specially for laptops.
Quoted 6 lines
If I understand you correctly, you are saying that both opportunistic suspend and dynamic power control should be used together, with dynamic power control being used for short non-busy periods (as in between keystrokes) and opportunistic suspend being used for longer non-busy periods (as in while grabbing a coffee). That combination of usage sounds promising to me.
No. In the future x86 will be fixed, but for now let's imagine an ARM laptop.
Quoted 3 lines
That said, I don't know that anyone has really sat down and thought through how one might apply suspend blockers to a desktop system. I suspect that there are several ways to go about it.
Think in terms of an ARM laptop. What good is opportunistic suspend if it's not going to help when the laptop is being used?
Signature · 5 lines
Felipe Contreras _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Paul E. McKenneyQuoted 26 lines · Paul E. McKenney
Quoted 20 lines · Felipe Contreras
Quoted 12 lines · Paul E. McKenney
Quoted 10 lines · Felipe Contreras
Quoted 4 lines · Paul E. McKenney
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when the screen is turned off, so these the applications do not need to use suspend blockers.
Ideally the system would be suspended even when the screen is on. If there are no "trusted" applications running at the same time, then openoffice wouldn't load at all. Right?
Quoted 5 lines
My understanding is that Android systems in fact do not suspend when the screen is on, and that most (perhaps all) other systems do not opportunistically suspend at all. There has been some speculation about what a hypothetical Android having a non-volatile display might do, but as far as I know, this is just speculation.
Quoted 4 lines
I have a desktop system in mind. If opportunistic suspend is only triggered when the display is off, then it's no good for normal usage, and therefore dynamic PC needs to get its act together... specially for laptops.
Quoted 6 lines
If I understand you correctly, you are saying that both opportunistic suspend and dynamic power control should be used together, with dynamic power control being used for short non-busy periods (as in between keystrokes) and opportunistic suspend being used for longer non-busy periods (as in while grabbing a coffee). That combination of usage sounds promising to me.
No. In the future x86 will be fixed, but for now let's imagine an ARM laptop.
Quoted 3 lines
That said, I don't know that anyone has really sat down and thought through how one might apply suspend blockers to a desktop system. I suspect that there are several ways to go about it.
Think in terms of an ARM laptop. What good is opportunistic suspend if it's not going to help when the laptop is being used?
Signature · 1 line
Felipe Contreras
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 28 lines · Felipe Contreras
Quoted 26 lines · Paul E. McKenney
Quoted 24 lines · Felipe Contreras
Quoted 12 lines · Paul E. McKenney
Quoted 10 lines · Felipe Contreras
Quoted 4 lines · Paul E. McKenney
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when the screen is turned off, so these the applications do not need to use suspend blockers.
Ideally the system would be suspended even when the screen is on. If there are no "trusted" applications running at the same time, then openoffice wouldn't load at all. Right?
Quoted 5 lines
My understanding is that Android systems in fact do not suspend when the screen is on, and that most (perhaps all) other systems do not opportunistically suspend at all. There has been some speculation about what a hypothetical Android having a non-volatile display might do, but as far as I know, this is just speculation.
I have a desktop system in mind. If opportunistic suspend is only triggered when the display is off, then it's no good for normal usage, and therefore dynamic PC needs to get its act together... specially for laptops.
Quoted 8 lines
Quoted 6 lines
If I understand you correctly, you are saying that both opportunistic suspend and dynamic power control should be used together, with dynamic power control being used for short non-busy periods (as in between keystrokes) and opportunistic suspend being used for longer non-busy periods (as in while grabbing a coffee). That combination of usage sounds promising to me.
No. In the future x86 will be fixed, but for now let's imagine an ARM laptop.
Hmmm... OK...
Quoted 6 lines
Quoted 3 lines
That said, I don't know that anyone has really sat down and thought through how one might apply suspend blockers to a desktop system. I suspect that there are several ways to go about it.
Think in terms of an ARM laptop. What good is opportunistic suspend if it's not going to help when the laptop is being used?
For when the laptop is not being used, presumably.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasQuoted 28 lines · Felipe Contreras
Quoted 26 lines · Paul E. McKenney
Quoted 24 lines · Felipe Contreras
Quoted 12 lines · Paul E. McKenney
Quoted 10 lines · Felipe Contreras
Quoted 4 lines · Paul E. McKenney
But wouldn't an office suite run as a power-oblivious application on an Android device? After all, office applications do not need to run when the screen is turned off, so these the applications do not need to use suspend blockers.
Ideally the system would be suspended even when the screen is on. If there are no "trusted" applications running at the same time, then openoffice wouldn't load at all. Right?
Quoted 5 lines
My understanding is that Android systems in fact do not suspend when the screen is on, and that most (perhaps all) other systems do not opportunistically suspend at all. There has been some speculation about what a hypothetical Android having a non-volatile display might do, but as far as I know, this is just speculation.
I have a desktop system in mind. If opportunistic suspend is only triggered when the display is off, then it's no good for normal usage, and therefore dynamic PC needs to get its act together... specially for laptops.
Quoted 8 lines
Quoted 6 lines
If I understand you correctly, you are saying that both opportunistic suspend and dynamic power control should be used together, with dynamic power control being used for short non-busy periods (as in between keystrokes) and opportunistic suspend being used for longer non-busy periods (as in while grabbing a coffee). That combination of usage sounds promising to me.
No. In the future x86 will be fixed, but for now let's imagine an ARM laptop.
Hmmm... OK...
Quoted 6 lines
Quoted 3 lines
That said, I don't know that anyone has really sat down and thought through how one might apply suspend blockers to a desktop system. I suspect that there are several ways to go about it.
Think in terms of an ARM laptop. What good is opportunistic suspend if it's not going to help when the laptop is being used?
For when the laptop is not being used, presumably.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 5 lines · Paul E. McKenney
Quoted 2 lines · Felipe Contreras
Think in terms of an ARM laptop. What good is opportunistic suspend if it's not going to help when the laptop is being used?
For when the laptop is not being used, presumably.
Right, but if you have to optimize for dynamic PM anyway for normal usage, how much would you gain by opportunistic suspend?
As it has been explained before, there's a point of diminishing returns:
http://article.gmane.org/gmane.linux.kernel/995525
http://article.gmane.org/gmane.linux.ports.arm.omap/37982
Now, how much would dynamic PM have progressed by the time we start thinking on opportunistic suspend on laptops (ARM, or fixed PM), 10 seconds idle? 1 minute idle? Would it make sense to rewrite *all* user-space in order to archive that little extra performance, *or* would it make more sense to keep investing on dynamic PM which we have to do anyway?
All this has already been explained.
BTW, the gain is even less if you consider that laptops already automatically go to suspend after a while, so the gains of opportunistic suspend would have to be measured only for a small period of time (like 30 min or so).
Signature · 1 line
Felipe Contreras
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Paul E. McKenneyQuoted 5 lines · Paul E. McKenney
Quoted 2 lines · Felipe Contreras
Think in terms of an ARM laptop. What good is opportunistic suspend if it's not going to help when the laptop is being used?
For when the laptop is not being used, presumably.
Right, but if you have to optimize for dynamic PM anyway for normal usage, how much would you gain by opportunistic suspend?
As it has been explained before, there's a point of diminishing returns:
http://article.gmane.org/gmane.linux.kernel/995525
http://article.gmane.org/gmane.linux.ports.arm.omap/37982
Now, how much would dynamic PM have progressed by the time we start thinking on opportunistic suspend on laptops (ARM, or fixed PM), 10 seconds idle? 1 minute idle? Would it make sense to rewrite *all* user-space in order to archive that little extra performance, *or* would it make more sense to keep investing on dynamic PM which we have to do anyway?
All this has already been explained.
BTW, the gain is even less if you consider that laptops already automatically go to suspend after a while, so the gains of opportunistic suspend would have to be measured only for a small period of time (like 30 min or so).
Signature · 1 line
Felipe Contreras
Re: Attempted summary of suspend-blockers LKML thread, take three
Felipe,
One thing I'm not clear on --- what's your goal? Is your goal to keep suspend-blockers out of the kernel? Is it to try to convince the android team suspend-blockers are a bad idea and to change Android to not use them? Is it to push some other agenda? Is it to discourage the Android team from trying to waste more time trying to get suspend-blockers (or equivalent functionality) from being added into the kernel?
You seem to be arguing quite passionately, but I'm not sure what you're trying to do.
-- Ted
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasFelipe,
One thing I'm not clear on --- what's your goal? Is your goal to keep suspend-blockers out of the kernel? Is it to try to convince the android team suspend-blockers are a bad idea and to change Android to not use them? Is it to push some other agenda? Is it to discourage the Android team from trying to waste more time trying to get suspend-blockers (or equivalent functionality) from being added into the kernel?
You seem to be arguing quite passionately, but I'm not sure what you're trying to do.
-- Ted
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 1 line · Theodore Tso
One thing I'm not clear on --- what's your goal? Is your goal to keep suspend-blockers out of the kernel? Is it to try to convince the android team suspend-blockers are a bad idea and to change Android to not use them? Is it to push some other agenda? Is it to discourage the Android team from trying to waste more time trying to get suspend-blockers (or equivalent functionality) from being added into the kernel?
My goal is to shine light. I've heard many invalid arguments in favor of suspend blockers, I want to shut them down.
In my mind it's crystal clear that independently of what opportunistic suspend is supposed to be fixing, the fact of the matter is that it's not a silver bullet as it's claimed to be.
So far, nobody has refuted these:
1) opportunistic suspend needs a good behaved user-space to work properly
2) if suspend blockers are enabled in a system, *all* user-space must
implement them to work correctly
3) implementing suspend blockers in user-space is not a straight-forward task
4) there's a point where sleeping (not doing work) has diminished returns
So, as the length of this thread has shown, the benefits of opportunistic suspend are *dubious* at best, and more likely not worth the changes needed in user-space which eventually will get pretty close to what suspend blockers can achieve even in ideal circumstances by just doing dynamic PM.
Signature · 5 lines
Felipe Contreras _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Theodore TsoQuoted 1 line · Theodore Tso
One thing I'm not clear on --- what's your goal? Is your goal to keep suspend-blockers out of the kernel? Is it to try to convince the android team suspend-blockers are a bad idea and to change Android to not use them? Is it to push some other agenda? Is it to discourage the Android team from trying to waste more time trying to get suspend-blockers (or equivalent functionality) from being added into the kernel?
My goal is to shine light. I've heard many invalid arguments in favor of suspend blockers, I want to shut them down.
In my mind it's crystal clear that independently of what opportunistic suspend is supposed to be fixing, the fact of the matter is that it's not a silver bullet as it's claimed to be.
So far, nobody has refuted these:
1) opportunistic suspend needs a good behaved user-space to work properly
2) if suspend blockers are enabled in a system, *all* user-space must
implement them to work correctly
3) implementing suspend blockers in user-space is not a straight-forward task
4) there's a point where sleeping (not doing work) has diminished returns
So, as the length of this thread has shown, the benefits of opportunistic suspend are *dubious* at best, and more likely not worth the changes needed in user-space which eventually will get pretty close to what suspend blockers can achieve even in ideal circumstances by just doing dynamic PM.
Signature · 1 line
Felipe Contreras
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 9 lines · Felipe Contreras
My goal is to shine light. I've heard many invalid arguments in favor of suspend blockers, I want to shut them down.
In my mind it's crystal clear that independently of what opportunistic suspend is supposed to be fixing, the fact of the matter is that it's not a silver bullet as it's claimed to be.
So far, nobody has refuted these:
1) opportunistic suspend needs a good behaved user-space to work properly
That seems entirely reasonable, since opportunistic suspend is essentially a userspace facility. Its in-kernel component is extremely small (and is already in mainline).
Quoted 2 lines
2) if suspend blockers are enabled in a system, *all* user-space must
implement them to work correctly
That isn't clear at all. Certainly they must be implemented correctly in some parts of userspace. But other parts can simply be denied permission to use them.
Quoted 1 line
3) implementing suspend blockers in user-space is not a straight-forward task
Perhaps so. Lots of things in userspace aren't straight-forward -- GUIs, for example. So what? That's not a proof they shouldn't be used.
Quoted 1 line
4) there's a point where sleeping (not doing work) has diminished returns
Agreed. It is platform dependent. The Google people seem to believe strongly they have not yet reached that point on their platforms.
Quoted 5 lines
So, as the length of this thread has shown, the benefits of opportunistic suspend are *dubious* at best, and more likely not worth the changes needed in user-space which eventually will get pretty close to what suspend blockers can achieve even in ideal circumstances by just doing dynamic PM.
You're ignoring the fact that Android has _already_ made the necessary userspace changes. Now you're going to ask them to change back, offering as motivation the loss of a real (albeit "dubious") power-saving advantage? Why should they accept your offer?
Alan Stern
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasQuoted 9 lines · Felipe Contreras
My goal is to shine light. I've heard many invalid arguments in favor of suspend blockers, I want to shut them down.
In my mind it's crystal clear that independently of what opportunistic suspend is supposed to be fixing, the fact of the matter is that it's not a silver bullet as it's claimed to be.
So far, nobody has refuted these:
1) opportunistic suspend needs a good behaved user-space to work properly
That seems entirely reasonable, since opportunistic suspend is essentially a userspace facility. Its in-kernel component is extremely small (and is already in mainline).
Quoted 2 lines
2) if suspend blockers are enabled in a system, *all* user-space must
implement them to work correctly
That isn't clear at all. Certainly they must be implemented correctly in some parts of userspace. But other parts can simply be denied permission to use them.
Quoted 1 line
3) implementing suspend blockers in user-space is not a straight-forward task
Perhaps so. Lots of things in userspace aren't straight-forward -- GUIs, for example. So what? That's not a proof they shouldn't be used.
Quoted 1 line
4) there's a point where sleeping (not doing work) has diminished returns
Agreed. It is platform dependent. The Google people seem to believe strongly they have not yet reached that point on their platforms.
Quoted 5 lines
So, as the length of this thread has shown, the benefits of opportunistic suspend are *dubious* at best, and more likely not worth the changes needed in user-space which eventually will get pretty close to what suspend blockers can achieve even in ideal circumstances by just doing dynamic PM.
You're ignoring the fact that Android has _already_ made the necessary userspace changes. Now you're going to ask them to change back, offering as motivation the loss of a real (albeit "dubious") power-saving advantage? Why should they accept your offer?
Alan Stern
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 10 lines · Alan Stern
Quoted 8 lines · Felipe Contreras
My goal is to shine light. I've heard many invalid arguments in favor of suspend blockers, I want to shut them down.
In my mind it's crystal clear that independently of what opportunistic suspend is supposed to be fixing, the fact of the matter is that it's not a silver bullet as it's claimed to be.
So far, nobody has refuted these:
[...]
Quoted 6 lines
Quoted 2 lines
2) if suspend blockers are enabled in a system, *all* user-space must implement them to work correctly
That isn't clear at all. Certainly they must be implemented correctly in some parts of userspace. But other parts can simply be denied permission to use them.
Yes, but all user-space needs to be considered. There certainly will be cases when people think a certain package doesn't need them, but it turns out they did. Firefox? Nah... oh, wait a second, I want my downloads to finish. Do you think there will be any linux desktop distro willing to attempt that?
Quoted 5 lines
Quoted 1 line
3) implementing suspend blockers in user-space is not a straight-forward task
Perhaps so. Lots of things in userspace aren't straight-forward -- GUIs, for example. So what? That's not a proof they shouldn't be used.
Certainly not, but it means when measuring against plain dynamic PM, opportunistic suspend is less attractive.
Quoted 4 lines
Quoted 1 line
4) there's a point where sleeping (not doing work) has diminished returns
Agreed. It is platform dependent. The Google people seem to believe strongly they have not yet reached that point on their platforms.
Yes, and Nokia/Intel people believe they are close on their platforms.
Surely, at some point Android will reach that point too.
Quoted 10 lines
Quoted 5 lines
So, as the length of this thread has shown, the benefits of opportunistic suspend are *dubious* at best, and more likely not worth the changes needed in user-space which eventually will get pretty close to what suspend blockers can achieve even in ideal circumstances by just doing dynamic PM.
You're ignoring the fact that Android has _already_ made the necessary userspace changes. Now you're going to ask them to change back, offering as motivation the loss of a real (albeit "dubious") power-saving advantage? Why should they accept your offer?
Android people have been selling the idea that suspend blockers are not only for Android, but other platforms can benefit from them too. I am arguing in that context. Hopefully you agree that that claim is dubious at best.
Now, switching to Android... I'm sure if Android guys say their user-space is far from the dynamic PM sweet-spot, then that's the case. Surely, at some point they will reach it, so that they can minimize power usage even when the device is actively used (it has been explained that opportunistic suspend is not activated when screen is on), maybe it will take one year, maybe two. Will they keep opportunistic suspend around for those marginal gains? Maybe.
The question is why are we adding a user-space API that:
1) no user-space beside Android has expresses interest in implementing
2) is dubious whether the benefits are worth the pain for non-Android
user-space
3) will become less and less attractive as dynamic PM gets closer to
the sweet-spot, and then surpass it
4) Android can keep in a separate tree until it's clear in the linux
community that it's useful (if it ever happens)
Signature · 5 lines
Felipe Contreras _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Alan SternQuoted 10 lines · Alan Stern
Quoted 8 lines · Felipe Contreras
My goal is to shine light. I've heard many invalid arguments in favor of suspend blockers, I want to shut them down.
In my mind it's crystal clear that independently of what opportunistic suspend is supposed to be fixing, the fact of the matter is that it's not a silver bullet as it's claimed to be.
So far, nobody has refuted these:
[...]
Quoted 6 lines
Quoted 2 lines
2) if suspend blockers are enabled in a system, *all* user-space must implement them to work correctly
That isn't clear at all. Certainly they must be implemented correctly in some parts of userspace. But other parts can simply be denied permission to use them.
Yes, but all user-space needs to be considered. There certainly will be cases when people think a certain package doesn't need them, but it turns out they did. Firefox? Nah... oh, wait a second, I want my downloads to finish. Do you think there will be any linux desktop distro willing to attempt that?
Quoted 5 lines
Quoted 1 line
3) implementing suspend blockers in user-space is not a straight-forward task
Perhaps so. Lots of things in userspace aren't straight-forward -- GUIs, for example. So what? That's not a proof they shouldn't be used.
Certainly not, but it means when measuring against plain dynamic PM, opportunistic suspend is less attractive.
Quoted 4 lines
Quoted 1 line
4) there's a point where sleeping (not doing work) has diminished returns
Agreed. It is platform dependent. The Google people seem to believe strongly they have not yet reached that point on their platforms.
Yes, and Nokia/Intel people believe they are close on their platforms.
Surely, at some point Android will reach that point too.
Quoted 10 lines
Quoted 5 lines
So, as the length of this thread has shown, the benefits of opportunistic suspend are *dubious* at best, and more likely not worth the changes needed in user-space which eventually will get pretty close to what suspend blockers can achieve even in ideal circumstances by just doing dynamic PM.
You're ignoring the fact that Android has _already_ made the necessary userspace changes. Now you're going to ask them to change back, offering as motivation the loss of a real (albeit "dubious") power-saving advantage? Why should they accept your offer?
Android people have been selling the idea that suspend blockers are not only for Android, but other platforms can benefit from them too. I am arguing in that context. Hopefully you agree that that claim is dubious at best.
Now, switching to Android... I'm sure if Android guys say their user-space is far from the dynamic PM sweet-spot, then that's the case. Surely, at some point they will reach it, so that they can minimize power usage even when the device is actively used (it has been explained that opportunistic suspend is not activated when screen is on), maybe it will take one year, maybe two. Will they keep opportunistic suspend around for those marginal gains? Maybe.
The question is why are we adding a user-space API that:
1) no user-space beside Android has expresses interest in implementing
2) is dubious whether the benefits are worth the pain for non-Android
user-space
3) will become less and less attractive as dynamic PM gets closer to
the sweet-spot, and then surpass it
4) Android can keep in a separate tree until it's clear in the linux
community that it's useful (if it ever happens)
Signature · 1 line
Felipe Contreras
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 9 lines · Felipe Contreras
The question is why are we adding a user-space API that:
1) no user-space beside Android has expresses interest in implementing
2) is dubious whether the benefits are worth the pain for non-Android
user-space
3) will become less and less attractive as dynamic PM gets closer to
the sweet-spot, and then surpass it
4) Android can keep in a separate tree until it's clear in the linux
community that it's useful (if it ever happens)
So, Felipe,
Do you believe you speak for all of LKML?
Are you willing to tell ZDNet and the Slashdot fanboys that it's OK for Suspend blockers to live in a separate tree, and it's not a case of OMG! Google is forking the kernel?
If you could speak out a passionately on those forums as you have here, that would be great.
- Ted
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasQuoted 9 lines · Felipe Contreras
The question is why are we adding a user-space API that:
1) no user-space beside Android has expresses interest in implementing
2) is dubious whether the benefits are worth the pain for non-Android
user-space
3) will become less and less attractive as dynamic PM gets closer to
the sweet-spot, and then surpass it
4) Android can keep in a separate tree until it's clear in the linux
community that it's useful (if it ever happens)
So, Felipe,
Do you believe you speak for all of LKML?
Are you willing to tell ZDNet and the Slashdot fanboys that it's OK for Suspend blockers to live in a separate tree, and it's not a case of OMG! Google is forking the kernel?
If you could speak out a passionately on those forums as you have here, that would be great.
- Ted
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 11 lines · Ted Ts'o
Quoted 9 lines · Felipe Contreras
The question is why are we adding a user-space API that:
1) no user-space beside Android has expresses interest in implementing
2) is dubious whether the benefits are worth the pain for non-Android user-space
3) will become less and less attractive as dynamic PM gets closer to the sweet-spot, and then surpass it
4) Android can keep in a separate tree until it's clear in the linux community that it's useful (if it ever happens)
Quoted 1 line
Do you believe you speak for all of LKML?
No. I'm speaking for myself, and that includes a lot of what people on LKML have already said.
Quoted 3 lines
Are you willing to tell ZDNet and the Slashdot fanboys that it's OK for Suspend blockers to live in a separate tree, and it's not a case of OMG! Google is forking the kernel?
All the Android community had to do is push the drivers *without* suspend blockers, then the Android kernel wouldn't be so different and thus wouldn't be considered a fork. AFAIU the kernel side wakelocks are already in the kernel, so there's no excuse not to merge the drivers.
Then people would stop blaming Google for forking the kernel.
Nobody from the "media" cares about suspend blockers; they are a small patch which cannot be considered a fork, more like a hack, like many other platforms have.
Signature · 5 lines
Felipe Contreras _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Ted Ts'oQuoted 11 lines · Ted Ts'o
Quoted 9 lines · Felipe Contreras
The question is why are we adding a user-space API that:
1) no user-space beside Android has expresses interest in implementing
2) is dubious whether the benefits are worth the pain for non-Android user-space
3) will become less and less attractive as dynamic PM gets closer to the sweet-spot, and then surpass it
4) Android can keep in a separate tree until it's clear in the linux community that it's useful (if it ever happens)
Quoted 1 line
Do you believe you speak for all of LKML?
No. I'm speaking for myself, and that includes a lot of what people on LKML have already said.
Quoted 3 lines
Are you willing to tell ZDNet and the Slashdot fanboys that it's OK for Suspend blockers to live in a separate tree, and it's not a case of OMG! Google is forking the kernel?
All the Android community had to do is push the drivers *without* suspend blockers, then the Android kernel wouldn't be so different and thus wouldn't be considered a fork. AFAIU the kernel side wakelocks are already in the kernel, so there's no excuse not to merge the drivers.
Then people would stop blaming Google for forking the kernel.
Nobody from the "media" cares about suspend blockers; they are a small patch which cannot be considered a fork, more like a hack, like many other platforms have.
Signature · 1 line
Felipe Contreras
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 5 lines · Felipe Contreras
All the Android community had to do is push the drivers *without* suspend blockers, then the Android kernel wouldn't be so different and thus wouldn't be considered a fork. AFAIU the kernel side wakelocks are already in the kernel, so there's no excuse not to merge the drivers.
What's there is not good enough, because it's missing the statistics and reporting so that badly behaved kernel and userspace drivers that take wakelocks can be found.
I have a similar problem with the whole pm_qos subsystem, as I've said earlier. If some badly behaved application claims to want 0us wireless latency, and keeps the radio on all the time, there is no way for me to find out which is the badly behaved application --- even though I'm the owner of the laptop, and at the end of the day *I* should be able to say, no, battery lifetime is more important than what the application might think is its "minimum wireless latency". Not only can I not override the application, I can't even find out
which application is at fault! ***FAIL***
In some ways, this is exactly the same problem as the "which badly Maemo application is causing my causing my N770 to have its battery laptop drop in half?".
- Ted
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasQuoted 5 lines · Felipe Contreras
All the Android community had to do is push the drivers *without* suspend blockers, then the Android kernel wouldn't be so different and thus wouldn't be considered a fork. AFAIU the kernel side wakelocks are already in the kernel, so there's no excuse not to merge the drivers.
What's there is not good enough, because it's missing the statistics and reporting so that badly behaved kernel and userspace drivers that take wakelocks can be found.
I have a similar problem with the whole pm_qos subsystem, as I've said earlier. If some badly behaved application claims to want 0us wireless latency, and keeps the radio on all the time, there is no way for me to find out which is the badly behaved application --- even though I'm the owner of the laptop, and at the end of the day *I* should be able to say, no, battery lifetime is more important than what the application might think is its "minimum wireless latency". Not only can I not override the application, I can't even find out
which application is at fault! ***FAIL***
In some ways, this is exactly the same problem as the "which badly Maemo application is causing my causing my N770 to have its battery laptop drop in half?".
- Ted
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 11 lines · Ted Ts'o
Quoted 5 lines · Felipe Contreras
All the Android community had to do is push the drivers *without* suspend blockers, then the Android kernel wouldn't be so different and thus wouldn't be considered a fork. AFAIU the kernel side wakelocks are already in the kernel, so there's no excuse not to merge the drivers.
What's there is not good enough, because it's missing the statistics and reporting so that badly behaved kernel and userspace drivers that take wakelocks can be found.
You don't need to have all the code merged in, hell, you only needed wakelock stubs.
You should take the point of view of the community as a whole, and forget about Android for a second; the important thing is to bring the code-bases closer, and that means merging the drivers. For that, you don't need anything extra.
Signature · 1 line
Felipe Contreras
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Ted Ts'oQuoted 11 lines · Ted Ts'o
Quoted 5 lines · Felipe Contreras
All the Android community had to do is push the drivers *without* suspend blockers, then the Android kernel wouldn't be so different and thus wouldn't be considered a fork. AFAIU the kernel side wakelocks are already in the kernel, so there's no excuse not to merge the drivers.
What's there is not good enough, because it's missing the statistics and reporting so that badly behaved kernel and userspace drivers that take wakelocks can be found.
You don't need to have all the code merged in, hell, you only needed wakelock stubs.
You should take the point of view of the community as a whole, and forget about Android for a second; the important thing is to bring the code-bases closer, and that means merging the drivers. For that, you don't need anything extra.
Signature · 1 line
Felipe Contreras
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 13 lines · Felipe Contreras
Quoted 11 lines · Ted Ts'o
Quoted 5 lines · Felipe Contreras
All the Android community had to do is push the drivers *without* suspend blockers, then the Android kernel wouldn't be so different and thus wouldn't be considered a fork. AFAIU the kernel side wakelocks are already in the kernel, so there's no excuse not to merge the drivers.
What's there is not good enough, because it's missing the statistics and reporting so that badly behaved kernel and userspace drivers that take wakelocks can be found.
Quoted 7 lines
You don't need to have all the code merged in, hell, you only needed wakelock stubs.
You should take the point of view of the community as a whole, and forget about Android for a second; the important thing is to bring the code-bases closer, and that means merging the drivers. For that, you don't need anything extra.
Stubs would be 100% fine by me. Previous discussion has indicated that they are not acceptable without some firm timeline for removal. I don't think I can commit to a firm removal timeline while we're still making almost no forward progress.
If we don't have to commit to yanking them back out in two releases or whatnot, then awesome, let's drop some stubs in and off we go, worrying about merging drivers that everyone agrees they want.
Question though -- has every feature ever added to the kernel been a feature that there's pre-existing usage of? Seems like a chicken and egg problem. Also, some people seem to think there's value in being able to build kernels "out of the box" that work with the Android userspace -- given that there are a few devices out there that have that userspace on 'em.
Brian
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasQuoted 13 lines · Felipe Contreras
Quoted 11 lines · Ted Ts'o
Quoted 5 lines · Felipe Contreras
All the Android community had to do is push the drivers *without* suspend blockers, then the Android kernel wouldn't be so different and thus wouldn't be considered a fork. AFAIU the kernel side wakelocks are already in the kernel, so there's no excuse not to merge the drivers.
What's there is not good enough, because it's missing the statistics and reporting so that badly behaved kernel and userspace drivers that take wakelocks can be found.
Quoted 7 lines
You don't need to have all the code merged in, hell, you only needed wakelock stubs.
You should take the point of view of the community as a whole, and forget about Android for a second; the important thing is to bring the code-bases closer, and that means merging the drivers. For that, you don't need anything extra.
Stubs would be 100% fine by me. Previous discussion has indicated that they are not acceptable without some firm timeline for removal. I don't think I can commit to a firm removal timeline while we're still making almost no forward progress.
If we don't have to commit to yanking them back out in two releases or whatnot, then awesome, let's drop some stubs in and off we go, worrying about merging drivers that everyone agrees they want.
Question though -- has every feature ever added to the kernel been a feature that there's pre-existing usage of? Seems like a chicken and egg problem. Also, some people seem to think there's value in being able to build kernels "out of the box" that work with the Android userspace -- given that there are a few devices out there that have that userspace on 'em.
Brian
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 6 lines · On Thu, 12 Aug 2010 12:19:34 -0700 Brian Swetland <[email protected]> wrote:
Question though -- has every feature ever added to the kernel been a feature that there's pre-existing usage of? Seems like a chicken and egg problem. Also, some people seem to think there's value in being able to build kernels "out of the box" that work with the Android userspace -- given that there are a few devices out there that have that userspace on 'em.
We generally try to merge new features like this along with code that uses said feature, but there are always exceptions. We've merged code one release or more before the new code gets used for example, which is fine IMO. What we don't want to see is some new drop of code added and abandoned, but you already knew that.
At any rate, if Felipe is the only one arguing against including suspend blockers in the kernel, you're probably in good shape. Based on my (rather cursory I admit) evaluation of this thread, it seems like reasonable people agree that there's a place for a suspend blocker like API in the kernel, and that dynamic power management is also highly desirable. So where's the git pull request already? :)
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Brian SwetlandQuoted 6 lines · On Thu, 12 Aug 2010 12:19:34 -0700 Brian Swetland <[email protected]> wrote:
Question though -- has every feature ever added to the kernel been a feature that there's pre-existing usage of? Seems like a chicken and egg problem. Also, some people seem to think there's value in being able to build kernels "out of the box" that work with the Android userspace -- given that there are a few devices out there that have that userspace on 'em.
We generally try to merge new features like this along with code that uses said feature, but there are always exceptions. We've merged code one release or more before the new code gets used for example, which is fine IMO. What we don't want to see is some new drop of code added and abandoned, but you already knew that.
At any rate, if Felipe is the only one arguing against including suspend blockers in the kernel, you're probably in good shape. Based on my (rather cursory I admit) evaluation of this thread, it seems like reasonable people agree that there's a place for a suspend blocker like API in the kernel, and that dynamic power management is also highly desirable. So where's the git pull request already? :)
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 15 lines · Jesse Barnes
Quoted 6 lines · On Thu, 12 Aug 2010 12:19:34 -0700 Brian Swetland <[email protected]> wrote:
Question though -- has every feature ever added to the kernel been a feature that there's pre-existing usage of? Seems like a chicken and egg problem. Also, some people seem to think there's value in being able to build kernels "out of the box" that work with the Android userspace -- given that there are a few devices out there that have that userspace on 'em.
We generally try to merge new features like this along with code that uses said feature, but there are always exceptions. We've merged code one release or more before the new code gets used for example, which is fine IMO. What we don't want to see is some new drop of code added and abandoned, but you already knew that.
Quoted 6 lines
At any rate, if Felipe is the only one arguing against including suspend blockers in the kernel, you're probably in good shape. Based on my (rather cursory I admit) evaluation of this thread, it seems like reasonable people agree that there's a place for a suspend blocker like API in the kernel, and that dynamic power management is also highly desirable. So where's the git pull request already? :)
In fact my patch going in that direction has been merged already and that code will likely be extended to cover some needs and cases I didn't have in mind when I was preparing it.
However, having discussed the whole issue for many times and reconsidered it thoroughly, I think that it's inappropriate to identify the suspend blockers (or wakelocks) framework with the opportunistic suspend feature as proposed in the original submission of the "suspend blockers" patchset. IMO they really are not the same thing and while the suspend blockers framework is used by Android to implement opportunistic suspend, I don't really believe this is the right approach.
We really need something similar to suspend blockers to avoid races between a suspend process and wakeup events, but it isn't necessary to provide user space with an interface allowing it to use these things directly. Such an interface is only necessary in the specific implementation in which the system is suspended as soon as the number of "active" suspend blockers goes down to zero. Arguably, though, this isn't the only possible way to implement a mechanism allowing the system to be suspended automatically when it appears to be inactive.
Namely, one can use a user space power manager for this purpose and actually the OLPC project has been doing that successfully for some time, which clearly demonstrates that the Android approach to this problem is not the only one possible. Moreover, the kernel's system suspend (or hibernate for that matter) code has not been designed to be started from within the kernel. It's been designed to allow a privileged user space process to request the kernel to put the system into a sleep state at any given time regardless of what the other user space processes are doing. While it can be started from within the kernel, this isn't particularly nice and, in the Android case, starting it from within the kernel requires permission from multiple user space processes (given by not taking suspend blockers these processes are allowed to use).
Since, quite clearly, user space input is necessary to make the decision whether or not to suspend the system, I think it is more appropriate to allow user space to start the entire operation and provide the kernel with a means to abort it in the case of a wakeup event. Then, user space will be able to use arbitrary heuristics in deciding whether or not to suspend the system, possibly taking some kernel's input into account.
I'm not against the very idea of automatic system suspend, which IMO is a legitimate and reasonable thing to do in many usage scenarios, but I don't think that the kernel is the right place to start a suspend process. For this reason I'm not going to take any code trying to start a suspend process from within the kernel, regardless of that code's purpose, unless somebody makes a really convincing case for that to me (basically proving the need for such a solution). That said I'm willing to accept patches adding or improving code that will help us to avoid races between system suspend, initiated by user space, and wakeup events detected by the kernel.
I hope that makes things clear.
Thanks,
Rafael
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Jesse BarnesQuoted 15 lines · Jesse Barnes
Quoted 6 lines · On Thu, 12 Aug 2010 12:19:34 -0700 Brian Swetland <[email protected]> wrote:
Question though -- has every feature ever added to the kernel been a feature that there's pre-existing usage of? Seems like a chicken and egg problem. Also, some people seem to think there's value in being able to build kernels "out of the box" that work with the Android userspace -- given that there are a few devices out there that have that userspace on 'em.
We generally try to merge new features like this along with code that uses said feature, but there are always exceptions. We've merged code one release or more before the new code gets used for example, which is fine IMO. What we don't want to see is some new drop of code added and abandoned, but you already knew that.
Quoted 6 lines
At any rate, if Felipe is the only one arguing against including suspend blockers in the kernel, you're probably in good shape. Based on my (rather cursory I admit) evaluation of this thread, it seems like reasonable people agree that there's a place for a suspend blocker like API in the kernel, and that dynamic power management is also highly desirable. So where's the git pull request already? :)
In fact my patch going in that direction has been merged already and that code will likely be extended to cover some needs and cases I didn't have in mind when I was preparing it.
However, having discussed the whole issue for many times and reconsidered it thoroughly, I think that it's inappropriate to identify the suspend blockers (or wakelocks) framework with the opportunistic suspend feature as proposed in the original submission of the "suspend blockers" patchset. IMO they really are not the same thing and while the suspend blockers framework is used by Android to implement opportunistic suspend, I don't really believe this is the right approach.
We really need something similar to suspend blockers to avoid races between a suspend process and wakeup events, but it isn't necessary to provide user space with an interface allowing it to use these things directly. Such an interface is only necessary in the specific implementation in which the system is suspended as soon as the number of "active" suspend blockers goes down to zero. Arguably, though, this isn't the only possible way to implement a mechanism allowing the system to be suspended automatically when it appears to be inactive.
Namely, one can use a user space power manager for this purpose and actually the OLPC project has been doing that successfully for some time, which clearly demonstrates that the Android approach to this problem is not the only one possible. Moreover, the kernel's system suspend (or hibernate for that matter) code has not been designed to be started from within the kernel. It's been designed to allow a privileged user space process to request the kernel to put the system into a sleep state at any given time regardless of what the other user space processes are doing. While it can be started from within the kernel, this isn't particularly nice and, in the Android case, starting it from within the kernel requires permission from multiple user space processes (given by not taking suspend blockers these processes are allowed to use).
Since, quite clearly, user space input is necessary to make the decision whether or not to suspend the system, I think it is more appropriate to allow user space to start the entire operation and provide the kernel with a means to abort it in the case of a wakeup event. Then, user space will be able to use arbitrary heuristics in deciding whether or not to suspend the system, possibly taking some kernel's input into account.
I'm not against the very idea of automatic system suspend, which IMO is a legitimate and reasonable thing to do in many usage scenarios, but I don't think that the kernel is the right place to start a suspend process. For this reason I'm not going to take any code trying to start a suspend process from within the kernel, regardless of that code's purpose, unless somebody makes a really convincing case for that to me (basically proving the need for such a solution). That said I'm willing to accept patches adding or improving code that will help us to avoid races between system suspend, initiated by user space, and wakeup events detected by the kernel.
I hope that makes things clear.
Thanks,
Rafael
Re: [linux-pm] Attempted summary of suspend-blockers LKML thread, take three
Quoted 44 lines · rafael j. wysocki
Quoted 15 lines · Jesse Barnes
Quoted 6 lines · On Thu, 12 Aug 2010 12:19:34 -0700 Brian Swetland <[email protected]> wrote:
Question though -- has every feature ever added to the kernel been a feature that there's pre-existing usage of? Seems like a chicken and egg problem. Also, some people seem to think there's value in being able to build kernels "out of the box" that work with the Android userspace -- given that there are a few devices out there that have that userspace on 'em.
We generally try to merge new features like this along with code that uses said feature, but there are always exceptions. We've merged code one release or more before the new code gets used for example, which is fine IMO. What we don't want to see is some new drop of code added and abandoned, but you already knew that.
Quoted 6 lines
At any rate, if Felipe is the only one arguing against including suspend blockers in the kernel, you're probably in good shape. Based on my (rather cursory I admit) evaluation of this thread, it seems like reasonable people agree that there's a place for a suspend blocker like API in the kernel, and that dynamic power management is also highly desirable. So where's the git pull request already? :)
In fact my patch going in that direction has been merged already and that code will likely be extended to cover some needs and cases I didn't have in mind when I was preparing it.
However, having discussed the whole issue for many times and reconsidered it thoroughly, I think that it's inappropriate to identify the suspend blockers (or wakelocks) framework with the opportunistic suspend feature as proposed in the original submission of the "suspend blockers" patchset. IMO they really are not the same thing and while the suspend blockers framework is used by Android to implement opportunistic suspend, I don't really believe this is the right approach.
We really need something similar to suspend blockers to avoid races between a suspend process and wakeup events, but it isn't necessary to provide user space with an interface allowing it to use these things directly. Such an interface is only necessary in the specific implementation in which the system is suspended as soon as the number of "active" suspend blockers goes down to zero. Arguably, though, this isn't the only possible way to implement a mechanism allowing the system to be suspended automatically when it appears to be inactive.
Quoted 3 lines
Namely, one can use a user space power manager for this purpose and actually the OLPC project has been doing that successfully for some time, which clearly demonstrates that the Android approach to this problem is not the only one
hey! how did we get dragged into this? :-)
it's true that OLPC has a user-level power management daemon that implements our suspend policy. it uses various metrics and heuristics (i've been told that's latin for "hacks") to decide when the system is "idle enough" to suspend, along with whether to leave our independent display running or not, and whether to leave the wlan active, etc. it does a reasonable job for us for now, but being intimately familiar with the chewing gum and string that hold it together, i don't want anyone to think we've solved a Big Problem.
i do think that there's a place for a flexible user-level policy engine, no matter how the suspend blockers vs. whatever-else issue plays out. i guess i assumed that that was a given -- does android not have such a policy manager? surely there's more to it than just "last one out, turn out the lights"?
(i should also mention that we definitely see the suspend vs. wakeup events race issue, and are looking forward to ways to clean that up.)
paul
Quoted 26 lines
possible. Moreover, the kernel's system suspend (or hibernate for that matter) code has not been designed to be started from within the kernel. It's been designed to allow a privileged user space process to request the kernel to put the system into a sleep state at any given time regardless of what the other user space processes are doing. While it can be started from within the kernel, this isn't particularly nice and, in the Android case, starting it from within the kernel requires permission from multiple user space processes (given by not taking suspend blockers these processes are allowed to use).
Since, quite clearly, user space input is necessary to make the decision whether or not to suspend the system, I think it is more appropriate to allow user space to start the entire operation and provide the kernel with a means to abort it in the case of a wakeup event. Then, user space will be able to use arbitrary heuristics in deciding whether or not to suspend the system, possibly taking some kernel's input into account.
I'm not against the very idea of automatic system suspend, which IMO is a legitimate and reasonable thing to do in many usage scenarios, but I don't think that the kernel is the right place to start a suspend process. For this reason I'm not going to take any code trying to start a suspend process from within the kernel, regardless of that code's purpose, unless somebody makes a really convincing case for that to me (basically proving the need for such a solution). That said I'm willing to accept patches adding or improving code that will help us to avoid races between system suspend, initiated by user space, and wakeup events detected by the kernel.
Quoted 8 lines
I hope that makes things clear.
Thanks,
Rafael
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
=---------------------
paul fox, [email protected]
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Rafael J. WysockiQuoted 27 lines · Rafael J. Wysocki
Quoted 15 lines · Jesse Barnes
Quoted 6 lines · On Thu, 12 Aug 2010 12:19:34 -0700 Brian Swetland <[email protected]> wrote:
Question though -- has every feature ever added to the kernel been a feature that there's pre-existing usage of? Seems like a chicken and egg problem. Also, some people seem to think there's value in being able to build kernels "out of the box" that work with the Android userspace -- given that there are a few devices out there that have that userspace on 'em.
We generally try to merge new features like this along with code that uses said feature, but there are always exceptions. We've merged code one release or more before the new code gets used for example, which is fine IMO. What we don't want to see is some new drop of code added and abandoned, but you already knew that.
Quoted 6 lines
At any rate, if Felipe is the only one arguing against including suspend blockers in the kernel, you're probably in good shape. Based on my (rather cursory I admit) evaluation of this thread, it seems like reasonable people agree that there's a place for a suspend blocker like API in the kernel, and that dynamic power management is also highly desirable. So where's the git pull request already? :)
In fact my patch going in that direction has been merged already and that code will likely be extended to cover some needs and cases I didn't have in mind when I was preparing it.
Quoted 8 lines
However, having discussed the whole issue for many times and reconsidered it thoroughly, I think that it's inappropriate to identify the suspend blockers (or wakelocks) framework with the opportunistic suspend feature as proposed in the original submission of the "suspend blockers" patchset. IMO they really are not the same thing and while the suspend blockers framework is used by Android to implement opportunistic suspend, I don't really believe this is the right approach.
Can you clarify this? Do you not believe using opportunistic suspend is the right approach, or do you not believe linking suspend blockers with opportunistic suspend is the right approach?
Quoted 6 lines
We really need something similar to suspend blockers to avoid races between a suspend process and wakeup events, but it isn't necessary to provide user space with an interface allowing it to use these things directly. Such an interface is only necessary in the specific implementation in which the system is suspended as soon as the number of "active" suspend blockers goes down to zero.
I don't think what you are saying here is correct. When you decide to suspend has no impact on whether a user space interface to block suspend is needed. The last suspend blocker patchset had this interface as a separate patch and the reasons for providing it have not changed with your interface. Android need the user space interface because low level services that handle wakeup events are started before the user space power manager. The other reason to have this interface in the mainline kernel is to provide a safe way to handle wakeup events on linux regardless of which user space power manager is used on the system. For instance some devices have a user space battery monitor, and there would be no need for this code to be android specific if the kernel provided all the functionality it needs.
Quoted 4 lines
Arguably, though, this isn't the only possible way to implement a mechanism allowing the system to be suspended automatically when it appears to be inactive.
Quoted 12 lines
Namely, one can use a user space power manager for this purpose and actually the OLPC project has been doing that successfully for some time, which clearly demonstrates that the Android approach to this problem is not the only one possible. Moreover, the kernel's system suspend (or hibernate for that matter) code has not been designed to be started from within the kernel. It's been designed to allow a privileged user space process to request the kernel to put the system into a sleep state at any given time regardless of what the other user space processes are doing. While it can be started from within the kernel, this isn't particularly nice and, in the Android case, starting it from within the kernel requires permission from multiple user space processes (given by not taking suspend blockers these processes are allowed to use).
Why is starting suspend from within the kernel not nice? Personally I think reentering suspend from within the kernel is nicer than being forced to wake up a user space thread for events that are fully handled within the kernel (for instance the battery monitor on the Nexus One).
Quoted 7 lines
Since, quite clearly, user space input is necessary to make the decision whether or not to suspend the system, I think it is more appropriate to allow user space to start the entire operation and provide the kernel with a means to abort it in the case of a wakeup event. Then, user space will be able to use arbitrary heuristics in deciding whether or not to suspend the system, possibly taking some kernel's input into account.
When we don't need these heuristics, this is just a burden.
Quoted 7 lines
I'm not against the very idea of automatic system suspend, which IMO is a legitimate and reasonable thing to do in many usage scenarios, but I don't think that the kernel is the right place to start a suspend process. For this reason I'm not going to take any code trying to start a suspend process from within the kernel, regardless of that code's purpose, unless somebody makes a really convincing case for that to me (basically proving the need for such a solution).
There is no absolute need to start the suspend process from within the kernel, but it makes the user space code much simpler for what we need.
Quoted 14 lines
That said I'm willing to accept patches adding or improving code that will help us to avoid races between system suspend, initiated by user space, and wakeup events detected by the kernel.
I hope that makes things clear.
Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 1 line
Arve Hjønnevåg
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Rafael J. WysockiQuoted 27 lines · Rafael J. Wysocki
Quoted 15 lines · Jesse Barnes
Quoted 6 lines · On Thu, 12 Aug 2010 12:19:34 -0700 Brian Swetland <[email protected]> wrote:
Question though -- has every feature ever added to the kernel been a feature that there's pre-existing usage of? Seems like a chicken and egg problem. Also, some people seem to think there's value in being able to build kernels "out of the box" that work with the Android userspace -- given that there are a few devices out there that have that userspace on 'em.
We generally try to merge new features like this along with code that uses said feature, but there are always exceptions. We've merged code one release or more before the new code gets used for example, which is fine IMO. What we don't want to see is some new drop of code added and abandoned, but you already knew that.
Quoted 6 lines
At any rate, if Felipe is the only one arguing against including suspend blockers in the kernel, you're probably in good shape. Based on my (rather cursory I admit) evaluation of this thread, it seems like reasonable people agree that there's a place for a suspend blocker like API in the kernel, and that dynamic power management is also highly desirable. So where's the git pull request already? :)
In fact my patch going in that direction has been merged already and that code will likely be extended to cover some needs and cases I didn't have in mind when I was preparing it.
Quoted 8 lines
However, having discussed the whole issue for many times and reconsidered it thoroughly, I think that it's inappropriate to identify the suspend blockers (or wakelocks) framework with the opportunistic suspend feature as proposed in the original submission of the "suspend blockers" patchset. IMO they really are not the same thing and while the suspend blockers framework is used by Android to implement opportunistic suspend, I don't really believe this is the right approach.
Can you clarify this? Do you not believe using opportunistic suspend is the right approach, or do you not believe linking suspend blockers with opportunistic suspend is the right approach?
Quoted 6 lines
We really need something similar to suspend blockers to avoid races between a suspend process and wakeup events, but it isn't necessary to provide user space with an interface allowing it to use these things directly. Such an interface is only necessary in the specific implementation in which the system is suspended as soon as the number of "active" suspend blockers goes down to zero.
I don't think what you are saying here is correct. When you decide to suspend has no impact on whether a user space interface to block suspend is needed. The last suspend blocker patchset had this interface as a separate patch and the reasons for providing it have not changed with your interface. Android need the user space interface because low level services that handle wakeup events are started before the user space power manager. The other reason to have this interface in the mainline kernel is to provide a safe way to handle wakeup events on linux regardless of which user space power manager is used on the system. For instance some devices have a user space battery monitor, and there would be no need for this code to be android specific if the kernel provided all the functionality it needs.
Quoted 4 lines
Arguably, though, this isn't the only possible way to implement a mechanism allowing the system to be suspended automatically when it appears to be inactive.
Quoted 12 lines
Namely, one can use a user space power manager for this purpose and actually the OLPC project has been doing that successfully for some time, which clearly demonstrates that the Android approach to this problem is not the only one possible. Moreover, the kernel's system suspend (or hibernate for that matter) code has not been designed to be started from within the kernel. It's been designed to allow a privileged user space process to request the kernel to put the system into a sleep state at any given time regardless of what the other user space processes are doing. While it can be started from within the kernel, this isn't particularly nice and, in the Android case, starting it from within the kernel requires permission from multiple user space processes (given by not taking suspend blockers these processes are allowed to use).
Why is starting suspend from within the kernel not nice? Personally I think reentering suspend from within the kernel is nicer than being forced to wake up a user space thread for events that are fully handled within the kernel (for instance the battery monitor on the Nexus One).
Quoted 7 lines
Since, quite clearly, user space input is necessary to make the decision whether or not to suspend the system, I think it is more appropriate to allow user space to start the entire operation and provide the kernel with a means to abort it in the case of a wakeup event. Then, user space will be able to use arbitrary heuristics in deciding whether or not to suspend the system, possibly taking some kernel's input into account.
When we don't need these heuristics, this is just a burden.
Quoted 7 lines
I'm not against the very idea of automatic system suspend, which IMO is a legitimate and reasonable thing to do in many usage scenarios, but I don't think that the kernel is the right place to start a suspend process. For this reason I'm not going to take any code trying to start a suspend process from within the kernel, regardless of that code's purpose, unless somebody makes a really convincing case for that to me (basically proving the need for such a solution).
There is no absolute need to start the suspend process from within the kernel, but it makes the user space code much simpler for what we need.
Quoted 14 lines
That said I'm willing to accept patches adding or improving code that will help us to avoid races between system suspend, initiated by user space, and wakeup events detected by the kernel.
I hope that makes things clear.
Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 1 line
Arve Hjønnevåg
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 37 lines · Arve Hjønnevåg
Quoted 27 lines · Rafael J. Wysocki
Quoted 15 lines · Jesse Barnes
Quoted 6 lines · On Thu, 12 Aug 2010 12:19:34 -0700 Brian Swetland <[email protected]> wrote:
Question though -- has every feature ever added to the kernel been a feature that there's pre-existing usage of? Seems like a chicken and egg problem. Also, some people seem to think there's value in being able to build kernels "out of the box" that work with the Android userspace -- given that there are a few devices out there that have that userspace on 'em.
We generally try to merge new features like this along with code that uses said feature, but there are always exceptions. We've merged code one release or more before the new code gets used for example, which is fine IMO. What we don't want to see is some new drop of code added and abandoned, but you already knew that.
Quoted 6 lines
At any rate, if Felipe is the only one arguing against including suspend blockers in the kernel, you're probably in good shape. Based on my (rather cursory I admit) evaluation of this thread, it seems like reasonable people agree that there's a place for a suspend blocker like API in the kernel, and that dynamic power management is also highly desirable. So where's the git pull request already? :)
In fact my patch going in that direction has been merged already and that code will likely be extended to cover some needs and cases I didn't have in mind when I was preparing it.
Quoted 8 lines
However, having discussed the whole issue for many times and reconsidered it thoroughly, I think that it's inappropriate to identify the suspend blockers (or wakelocks) framework with the opportunistic suspend feature as proposed in the original submission of the "suspend blockers" patchset. IMO they really are not the same thing and while the suspend blockers framework is used by Android to implement opportunistic suspend, I don't really believe this is the right approach.
Quoted 3 lines
Can you clarify this? Do you not believe using opportunistic suspend is the right approach, or do you not believe linking suspend blockers with opportunistic suspend is the right approach?
The latter. That should be clear from the remaining part of my message.
Quoted 7 lines
Quoted 6 lines
We really need something similar to suspend blockers to avoid races between a suspend process and wakeup events, but it isn't necessary to provide user space with an interface allowing it to use these things directly. Such an interface is only necessary in the specific implementation in which the system is suspended as soon as the number of "active" suspend blockers goes down to zero.
Quoted 13 lines
I don't think what you are saying here is correct. When you decide to suspend has no impact on whether a user space interface to block suspend is needed. The last suspend blocker patchset had this interface as a separate patch and the reasons for providing it have not changed with your interface. Android need the user space interface because low level services that handle wakeup events are started before the user space power manager. The other reason to have this interface in the mainline kernel is to provide a safe way to handle wakeup events on linux regardless of which user space power manager is used on the system. For instance some devices have a user space battery monitor, and there would be no need for this code to be android specific if the kernel provided all the functionality it needs.
Well, the problem is, with your /dev/suspend_blocker interface, multiple user space processes are supposed to decide whether or not system suspend should be started and in general there don't seem to be any particularly good criteria for choosing these applications, in general. So, application writers may be tempted to use this interface in all programs and then the decision whether or not to allow these programs to affect system power management will be delegated to users. In turn, the users may not be technically qualified to make such a decision.
Also the fact that the same mechanism is used for handling wakeup events detected by the kernel and allowing user space programs to grant permission to suspend the system is somewhat confusing.
Quoted 17 lines
Quoted 4 lines
Arguably, though, this isn't the only possible way to implement a
mechanism allowing the system to be suspended automatically when it appears to be inactive.Quoted 12 lines
Namely, one can use a user space power manager for this purpose and actually the OLPC project has been doing that successfully for some time, which clearly demonstrates that the Android approach to this problem is not the only one possible. Moreover, the kernel's system suspend (or hibernate for that matter) code has not been designed to be started from within the kernel. It's been designed to allow a privileged user space process to request the kernel to put the system into a sleep state at any given time regardless of what the other user space processes are doing. While it can be started from within the kernel, this isn't particularly nice and, in the Android case, starting it from within the kernel requires permission from multiple user space processes (given by not taking suspend blockers these processes are allowed to use).
Quoted 5 lines
Why is starting suspend from within the kernel not nice? Personally I think reentering suspend from within the kernel is nicer than being forced to wake up a user space thread for events that are fully handled within the kernel (for instance the battery monitor on the Nexus One).
For basically the same reason why the kernel generally doesn't use sys_open() for opening files. It is an interface provided for user space.
Quoted 8 lines
Quoted 7 lines
Since, quite clearly, user space input is necessary to make the decision whether or not to suspend the system, I think it is more appropriate to allow user space to start the entire operation and provide the kernel with a means to abort it in the case of a wakeup event. Then, user space will be able to use arbitrary heuristics in deciding whether or not to suspend the system, possibly taking some kernel's input into account.
When we don't need these heuristics, this is just a burden.
The word 'arbitrary' means in particular that you can implement a mechanism equivalent to the /dev/suspend_blocker entirely in user space. Someone else, though, can use a different approach.
By adding the /dev/suspend_blocker interface to the mainline kernel we would mandate that Linux applications use it on all platforms. Consequently, application writers would have the right to expect that all platforms would be using Android-alike opportunistic suspend, which may or may not be the case.
Quoted 11 lines
Quoted 7 lines
I'm not against the very idea of automatic system suspend, which IMO is a legitimate and reasonable thing to do in many usage scenarios, but I don't think that the kernel is the right place to start a suspend process. For this reason I'm not going to take any code trying to start a suspend process from within the kernel, regardless of that code's purpose, unless somebody makes a really convincing case for that to me (basically proving the need for such a solution).
There is no absolute need to start the suspend process from within the kernel, but it makes the user space code much simpler for what we need.
I'm entirely aware of that. Still, I think user space is the right place to initiate system suspend.
Thanks,
Rafael
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Arve HjønnevågQuoted 37 lines · Arve Hjønnevåg
Quoted 27 lines · Rafael J. Wysocki
Quoted 15 lines · Jesse Barnes
Quoted 6 lines · On Thu, 12 Aug 2010 12:19:34 -0700 Brian Swetland <[email protected]> wrote:
Question though -- has every feature ever added to the kernel been a feature that there's pre-existing usage of? Seems like a chicken and egg problem. Also, some people seem to think there's value in being able to build kernels "out of the box" that work with the Android userspace -- given that there are a few devices out there that have that userspace on 'em.
We generally try to merge new features like this along with code that uses said feature, but there are always exceptions. We've merged code one release or more before the new code gets used for example, which is fine IMO. What we don't want to see is some new drop of code added and abandoned, but you already knew that.
Quoted 6 lines
At any rate, if Felipe is the only one arguing against including suspend blockers in the kernel, you're probably in good shape. Based on my (rather cursory I admit) evaluation of this thread, it seems like reasonable people agree that there's a place for a suspend blocker like API in the kernel, and that dynamic power management is also highly desirable. So where's the git pull request already? :)
In fact my patch going in that direction has been merged already and that code will likely be extended to cover some needs and cases I didn't have in mind when I was preparing it.
Quoted 8 lines
However, having discussed the whole issue for many times and reconsidered it thoroughly, I think that it's inappropriate to identify the suspend blockers (or wakelocks) framework with the opportunistic suspend feature as proposed in the original submission of the "suspend blockers" patchset. IMO they really are not the same thing and while the suspend blockers framework is used by Android to implement opportunistic suspend, I don't really believe this is the right approach.
Quoted 3 lines
Can you clarify this? Do you not believe using opportunistic suspend is the right approach, or do you not believe linking suspend blockers with opportunistic suspend is the right approach?
The latter. That should be clear from the remaining part of my message.
Quoted 7 lines
Quoted 6 lines
We really need something similar to suspend blockers to avoid races between a suspend process and wakeup events, but it isn't necessary to provide user space with an interface allowing it to use these things directly. Such an interface is only necessary in the specific implementation in which the system is suspended as soon as the number of "active" suspend blockers goes down to zero.
Quoted 13 lines
I don't think what you are saying here is correct. When you decide to suspend has no impact on whether a user space interface to block suspend is needed. The last suspend blocker patchset had this interface as a separate patch and the reasons for providing it have not changed with your interface. Android need the user space interface because low level services that handle wakeup events are started before the user space power manager. The other reason to have this interface in the mainline kernel is to provide a safe way to handle wakeup events on linux regardless of which user space power manager is used on the system. For instance some devices have a user space battery monitor, and there would be no need for this code to be android specific if the kernel provided all the functionality it needs.
Well, the problem is, with your /dev/suspend_blocker interface, multiple user space processes are supposed to decide whether or not system suspend should be started and in general there don't seem to be any particularly good criteria for choosing these applications, in general. So, application writers may be tempted to use this interface in all programs and then the decision whether or not to allow these programs to affect system power management will be delegated to users. In turn, the users may not be technically qualified to make such a decision.
Also the fact that the same mechanism is used for handling wakeup events detected by the kernel and allowing user space programs to grant permission to suspend the system is somewhat confusing.
Quoted 17 lines
Quoted 4 lines
Arguably, though, this isn't the only possible way to implement a
mechanism allowing the system to be suspended automatically when it appears to be inactive.Quoted 12 lines
Namely, one can use a user space power manager for this purpose and actually the OLPC project has been doing that successfully for some time, which clearly demonstrates that the Android approach to this problem is not the only one possible. Moreover, the kernel's system suspend (or hibernate for that matter) code has not been designed to be started from within the kernel. It's been designed to allow a privileged user space process to request the kernel to put the system into a sleep state at any given time regardless of what the other user space processes are doing. While it can be started from within the kernel, this isn't particularly nice and, in the Android case, starting it from within the kernel requires permission from multiple user space processes (given by not taking suspend blockers these processes are allowed to use).
Quoted 5 lines
Why is starting suspend from within the kernel not nice? Personally I think reentering suspend from within the kernel is nicer than being forced to wake up a user space thread for events that are fully handled within the kernel (for instance the battery monitor on the Nexus One).
For basically the same reason why the kernel generally doesn't use sys_open() for opening files. It is an interface provided for user space.
Quoted 8 lines
Quoted 7 lines
Since, quite clearly, user space input is necessary to make the decision whether or not to suspend the system, I think it is more appropriate to allow user space to start the entire operation and provide the kernel with a means to abort it in the case of a wakeup event. Then, user space will be able to use arbitrary heuristics in deciding whether or not to suspend the system, possibly taking some kernel's input into account.
When we don't need these heuristics, this is just a burden.
The word 'arbitrary' means in particular that you can implement a mechanism equivalent to the /dev/suspend_blocker entirely in user space. Someone else, though, can use a different approach.
By adding the /dev/suspend_blocker interface to the mainline kernel we would mandate that Linux applications use it on all platforms. Consequently, application writers would have the right to expect that all platforms would be using Android-alike opportunistic suspend, which may or may not be the case.
Quoted 11 lines
Quoted 7 lines
I'm not against the very idea of automatic system suspend, which IMO is a legitimate and reasonable thing to do in many usage scenarios, but I don't think that the kernel is the right place to start a suspend process. For this reason I'm not going to take any code trying to start a suspend process from within the kernel, regardless of that code's purpose, unless somebody makes a really convincing case for that to me (basically proving the need for such a solution).
There is no absolute need to start the suspend process from within the kernel, but it makes the user space code much simpler for what we need.
I'm entirely aware of that. Still, I think user space is the right place to initiate system suspend.
Thanks,
Rafael
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 8 lines · On Fri, 13 Aug 2010 17:07:02 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 4 lines
There is no absolute need to start the suspend process from within the kernel, but it makes the user space code much simpler for what we need.
I'm entirely aware of that. Still, I think user space is the right place to initiate system suspend.
For what it's worth - I completely agree.
Clearly there is no a lot of unanimity on this, and so lots of room to experiment with different approaches. It's best if we leave as much as possible of that experimentation in user-space - just have the kernel do what cannot be done elsewhere.
NeilBrown
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Rafael J. WysockiQuoted 8 lines · On Fri, 13 Aug 2010 17:07:02 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 4 lines
There is no absolute need to start the suspend process from within the kernel, but it makes the user space code much simpler for what we need.
I'm entirely aware of that. Still, I think user space is the right place to initiate system suspend.
For what it's worth - I completely agree.
Clearly there is no a lot of unanimity on this, and so lots of room to experiment with different approaches. It's best if we leave as much as possible of that experimentation in user-space - just have the kernel do what cannot be done elsewhere.
NeilBrown
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Arve HjønnevågHi!
Quoted 17 lines
Quoted 4 lines
Arguably, though, this isn't the only possible way to implement a mechanism allowing the system to be suspended automatically when it appears to be inactive.
Quoted 12 lines
Namely, one can use a user space power manager for this purpose and actually the OLPC project has been doing that successfully for some time, which clearly demonstrates that the Android approach to this problem is not the only one possible. Moreover, the kernel's system suspend (or hibernate for that matter) code has not been designed to be started from within the kernel. It's been designed to allow a privileged user space process to request the kernel to put the system into a sleep state at any given time regardless of what the other user space processes are doing. While it can be started from within the kernel, this isn't particularly nice and, in the Android case, starting it from within the kernel requires permission from multiple user space processes (given by not taking suspend blockers these processes are allowed to use).
Quoted 5 lines
Why is starting suspend from within the kernel not nice? Personally I think reentering suspend from within the kernel is nicer than being forced to wake up a user space thread for events that are fully handled within the kernel (for instance the battery monitor on the Nexus One).
For events that are fully handled within the kernel -- like battery monitor on Zaurus/spitz -- doing wakeup all the way to the userspace is not neccessary. But that's implementenation detail with no impact on user/kernel interface, and we are doing that today. (Or were doing that few releases ago; charging is broken on spitz just now).
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Arve HjønnevågHi!
Quoted 17 lines
Quoted 4 lines
Arguably, though, this isn't the only possible way to implement a mechanism allowing the system to be suspended automatically when it appears to be inactive.
Quoted 12 lines
Namely, one can use a user space power manager for this purpose and actually the OLPC project has been doing that successfully for some time, which clearly demonstrates that the Android approach to this problem is not the only one possible. Moreover, the kernel's system suspend (or hibernate for that matter) code has not been designed to be started from within the kernel. It's been designed to allow a privileged user space process to request the kernel to put the system into a sleep state at any given time regardless of what the other user space processes are doing. While it can be started from within the kernel, this isn't particularly nice and, in the Android case, starting it from within the kernel requires permission from multiple user space processes (given by not taking suspend blockers these processes are allowed to use).
Quoted 5 lines
Why is starting suspend from within the kernel not nice? Personally I think reentering suspend from within the kernel is nicer than being forced to wake up a user space thread for events that are fully handled within the kernel (for instance the battery monitor on the Nexus One).
For events that are fully handled within the kernel -- like battery monitor on Zaurus/spitz -- doing wakeup all the way to the userspace is not neccessary. But that's implementenation detail with no impact on user/kernel interface, and we are doing that today. (Or were doing that few releases ago; charging is broken on spitz just now).
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Rafael J. WysockiQuoted 23 lines · On Fri, 13 Aug 2010 05:28:21 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 15 lines · Jesse Barnes
Quoted 6 lines · On Thu, 12 Aug 2010 12:19:34 -0700 Brian Swetland <[email protected]> wrote:
Question though -- has every feature ever added to the kernel been a feature that there's pre-existing usage of? Seems like a chicken and egg problem. Also, some people seem to think there's value in being able to build kernels "out of the box" that work with the Android userspace -- given that there are a few devices out there that have that userspace on 'em.
We generally try to merge new features like this along with code that uses said feature, but there are always exceptions. We've merged code one release or more before the new code gets used for example, which is fine IMO. What we don't want to see is some new drop of code added and abandoned, but you already knew that.
Quoted 6 lines
At any rate, if Felipe is the only one arguing against including suspend blockers in the kernel, you're probably in good shape. Based on my (rather cursory I admit) evaluation of this thread, it seems like reasonable people agree that there's a place for a suspend blocker like API in the kernel, and that dynamic power management is also highly desirable. So where's the git pull request already? :)
Quoted 3 lines
In fact my patch going in that direction has been merged already and that code will likely be extended to cover some needs and cases I didn't have in mind when I was preparing it.
Yeah, I like what you've done with dynamic power management, really good stuff (the approach is very similar to the one I used for vblank interrupt management in the drm layer).
Ted's point about providing the user with a way of knowing which apps are blocking things is a good one though, and doesn't seem too hard to add. It might even be possible to do it largely with scripts wrapping fuser and such.
Quoted 17 lines
However, having discussed the whole issue for many times and reconsidered it thoroughly, I think that it's inappropriate to identify the suspend blockers (or wakelocks) framework with the opportunistic suspend feature as proposed in the original submission of the "suspend blockers" patchset. IMO they really are not the same thing and while the suspend blockers framework is used by Android to implement opportunistic suspend, I don't really believe this is the right approach.
We really need something similar to suspend blockers to avoid races between a suspend process and wakeup events, but it isn't necessary to provide user space with an interface allowing it to use these things directly. Such an interface is only necessary in the specific implementation in which the system is suspended as soon as the number of "active" suspend blockers goes down to zero. Arguably, though, this isn't the only possible way to implement a mechanism allowing the system to be suspended automatically when it appears to be inactive.
Quoted 11 lines
Namely, one can use a user space power manager for this purpose and actually the OLPC project has been doing that successfully for some time, which clearly demonstrates that the Android approach to this problem is not the only one possible. Moreover, the kernel's system suspend (or hibernate for that matter) code has not been designed to be started from within the kernel. It's been designed to allow a privileged user space process to request the kernel to put the system into a sleep state at any given time regardless of what the other user space processes are doing. While it can be started from within the kernel, this isn't particularly nice and, in the Android case, starting it from within the kernel requires permission from multiple user space processes (given by not taking suspend blockers these processes are allowed to use).
Yes, I see your point. But I actually think this is a fairly minor distinction. In one case, a privileged app decides when to suspend the system, in the other case, one or more of several privileged apps decide when a suspend should not be allowed to occur. It's just a matter of where you want to put the code and where you want the complexity. In general, we try to keep such complexity out of the kernel, but not always; there are compelling cases for putting complexity in the kernel to provide uniformity and flexibility (e.g. application state save/restore vs. system-wide checkpoints, the former preserves the "if it can be done outside the kernel, it should be", while the latter provides much greater flexibility and avoids the need to port applications to potentially incompatible or unportable state saves/restore libraries).
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Rafael J. WysockiQuoted 23 lines · On Fri, 13 Aug 2010 05:28:21 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 15 lines · Jesse Barnes
Quoted 6 lines · On Thu, 12 Aug 2010 12:19:34 -0700 Brian Swetland <[email protected]> wrote:
Question though -- has every feature ever added to the kernel been a feature that there's pre-existing usage of? Seems like a chicken and egg problem. Also, some people seem to think there's value in being able to build kernels "out of the box" that work with the Android userspace -- given that there are a few devices out there that have that userspace on 'em.
We generally try to merge new features like this along with code that uses said feature, but there are always exceptions. We've merged code one release or more before the new code gets used for example, which is fine IMO. What we don't want to see is some new drop of code added and abandoned, but you already knew that.
Quoted 6 lines
At any rate, if Felipe is the only one arguing against including suspend blockers in the kernel, you're probably in good shape. Based on my (rather cursory I admit) evaluation of this thread, it seems like reasonable people agree that there's a place for a suspend blocker like API in the kernel, and that dynamic power management is also highly desirable. So where's the git pull request already? :)
Quoted 3 lines
In fact my patch going in that direction has been merged already and that code will likely be extended to cover some needs and cases I didn't have in mind when I was preparing it.
Yeah, I like what you've done with dynamic power management, really good stuff (the approach is very similar to the one I used for vblank interrupt management in the drm layer).
Ted's point about providing the user with a way of knowing which apps are blocking things is a good one though, and doesn't seem too hard to add. It might even be possible to do it largely with scripts wrapping fuser and such.
Quoted 17 lines
However, having discussed the whole issue for many times and reconsidered it thoroughly, I think that it's inappropriate to identify the suspend blockers (or wakelocks) framework with the opportunistic suspend feature as proposed in the original submission of the "suspend blockers" patchset. IMO they really are not the same thing and while the suspend blockers framework is used by Android to implement opportunistic suspend, I don't really believe this is the right approach.
We really need something similar to suspend blockers to avoid races between a suspend process and wakeup events, but it isn't necessary to provide user space with an interface allowing it to use these things directly. Such an interface is only necessary in the specific implementation in which the system is suspended as soon as the number of "active" suspend blockers goes down to zero. Arguably, though, this isn't the only possible way to implement a mechanism allowing the system to be suspended automatically when it appears to be inactive.
Quoted 11 lines
Namely, one can use a user space power manager for this purpose and actually the OLPC project has been doing that successfully for some time, which clearly demonstrates that the Android approach to this problem is not the only one possible. Moreover, the kernel's system suspend (or hibernate for that matter) code has not been designed to be started from within the kernel. It's been designed to allow a privileged user space process to request the kernel to put the system into a sleep state at any given time regardless of what the other user space processes are doing. While it can be started from within the kernel, this isn't particularly nice and, in the Android case, starting it from within the kernel requires permission from multiple user space processes (given by not taking suspend blockers these processes are allowed to use).
Yes, I see your point. But I actually think this is a fairly minor distinction. In one case, a privileged app decides when to suspend the system, in the other case, one or more of several privileged apps decide when a suspend should not be allowed to occur. It's just a matter of where you want to put the code and where you want the complexity. In general, we try to keep such complexity out of the kernel, but not always; there are compelling cases for putting complexity in the kernel to provide uniformity and flexibility (e.g. application state save/restore vs. system-wide checkpoints, the former preserves the "if it can be done outside the kernel, it should be", while the latter provides much greater flexibility and avoids the need to port applications to potentially incompatible or unportable state saves/restore libraries).
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 68 lines · Jesse Barnes
Quoted 23 lines · On Fri, 13 Aug 2010 05:28:21 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 15 lines · Jesse Barnes
Quoted 6 lines · On Thu, 12 Aug 2010 12:19:34 -0700 Brian Swetland <[email protected]> wrote:
Question though -- has every feature ever added to the kernel been a feature that there's pre-existing usage of? Seems like a chicken and egg problem. Also, some people seem to think there's value in being able to build kernels "out of the box" that work with the Android userspace -- given that there are a few devices out there that have that userspace on 'em.
We generally try to merge new features like this along with code that uses said feature, but there are always exceptions. We've merged code one release or more before the new code gets used for example, which is fine IMO. What we don't want to see is some new drop of code added and abandoned, but you already knew that.
Quoted 6 lines
At any rate, if Felipe is the only one arguing against including suspend blockers in the kernel, you're probably in good shape. Based on my (rather cursory I admit) evaluation of this thread, it seems like reasonable people agree that there's a place for a suspend blocker like API in the kernel, and that dynamic power management is also highly desirable. So where's the git pull request already? :)
Quoted 3 lines
In fact my patch going in that direction has been merged already and that code will likely be extended to cover some needs and cases I didn't have in mind when I was preparing it.
Yeah, I like what you've done with dynamic power management, really good stuff (the approach is very similar to the one I used for vblank interrupt management in the drm layer).
Ted's point about providing the user with a way of knowing which apps are blocking things is a good one though, and doesn't seem too hard to add. It might even be possible to do it largely with scripts wrapping fuser and such.
Quoted 17 lines
However, having discussed the whole issue for many times and reconsidered it thoroughly, I think that it's inappropriate to identify the suspend blockers (or wakelocks) framework with the opportunistic suspend feature as proposed in the original submission of the "suspend blockers" patchset. IMO they really are not the same thing and while the suspend blockers framework is used by Android to implement opportunistic suspend, I don't really believe this is the right approach.
We really need something similar to suspend blockers to avoid races between a suspend process and wakeup events, but it isn't necessary to provide user space with an interface allowing it to use these things directly. Such an interface is only necessary in the specific implementation in which the system is suspended as soon as the number of "active" suspend blockers goes down to zero. Arguably, though, this isn't the only possible way to implement a mechanism allowing the system to be suspended automatically when it appears to be inactive.
Quoted 11 lines
Namely, one can use a user space power manager for this purpose and actually the OLPC project has been doing that successfully for some time, which clearly demonstrates that the Android approach to this problem is not the only one possible. Moreover, the kernel's system suspend (or hibernate for that matter) code has not been designed to be started from within the kernel. It's been designed to allow a privileged user space process to request the kernel to put the system into a sleep state at any given time regardless of what the other user space processes are doing. While it can be started from within the kernel, this isn't particularly nice and, in the Android case, starting it from within the kernel requires permission from multiple user space processes (given by not taking suspend blockers these processes are allowed to use).
Quoted 6 lines
Yes, I see your point. But I actually think this is a fairly minor distinction. In one case, a privileged app decides when to suspend the system, in the other case, one or more of several privileged apps decide when a suspend should not be allowed to occur. It's just a matter of where you want to put the code and where you want the complexity.
Well, that used to be my opinion before the whole discussion started, but now I think there's more to it.
First off, we need the "forced" suspend, initiated by writing to /sys/power/state, to work regardless of the "opportunistic" one. Now, the races between wakeup events and suspend process are also a problem for the "forced" suspend mechanism, so the fix should not be specific to "opportunistic" suspend. One could argue that that can be fixed by using wakelocks as proposed by the Android developers, but this is not the case, because there's no way to disinguish wakelocks taken by applications (that we don't want the "forced" suspend to react to) from the wakelocks taken by the kernel (that are strictly related to "real" wakeup events).
Second, system suspend is really an intrusive operation that does violent things to many kernel subsystems (it freezes tasks, it puts the mm subsystem into a degraded mode, it forcibly offlines non-boot CPUs and so on). If that is to be started from the kernel, the kernel thread starting it should really ask all of these subsystems if they are OK with whatever it wants to do and the answer would always be "no" in the majority of cases. The very purpose of that design is to allow a user to suspend the system whenever he wants and not to do that when there's an opportunity to power down things because they appear to be inactive (that may or may not be one of the "whenever the user wants" situations, but really the user should be able to specify the conditions). The powering down of things by the kernel when there's an opportunity should really be done in a more intelligent way (simply becasue the kernel is potentially able to do that more intelligently).
Finally, in the kernel-driven opportunistic suspend scenario (using wakelocks) it is not particularly clear which applications should be given the priviledge to participate in the suspend blocking mechanism. I don't think there are any criteria which can be universally used for selecting these applications and in fact on Android that doesn't work very well either (for example, if you leave Google Maps in the foreground while the screan is off on Nexus One and you happen to move reasonably quickly from one location to another, it will drain the battery for the GPS updates much quickier than you'd expect). For this reason I don't think it is particularly smart to rely on applications when deciding whether or not to start system suspend. Other criteria should also be taken into account in general and I have no idea how to provide the kernel with an interface allowing it to do that. Therefore I don't think the kernel should start system suspend automatically.
Quoted 8 lines
In general, we try to keep such complexity out of the kernel, but not always; there are compelling cases for putting complexity in the kernel to provide uniformity and flexibility (e.g. application state save/restore vs. system-wide checkpoints, the former preserves the "if it can be done outside the kernel, it should be", while the latter provides much greater flexibility and avoids the need to port applications to potentially incompatible or unportable state saves/restore libraries).
I understand that and IMO it should be decided on the case-by-case basis. In this particular case, however, I don't think it's appropriate to use the interface designed with user space in mind for implementing a kernel-based mechanism.
Thanks,
Rafael
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Jesse BarnesQuoted 68 lines · Jesse Barnes
Quoted 23 lines · On Fri, 13 Aug 2010 05:28:21 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 15 lines · Jesse Barnes
Quoted 6 lines · On Thu, 12 Aug 2010 12:19:34 -0700 Brian Swetland <[email protected]> wrote:
Question though -- has every feature ever added to the kernel been a feature that there's pre-existing usage of? Seems like a chicken and egg problem. Also, some people seem to think there's value in being able to build kernels "out of the box" that work with the Android userspace -- given that there are a few devices out there that have that userspace on 'em.
We generally try to merge new features like this along with code that uses said feature, but there are always exceptions. We've merged code one release or more before the new code gets used for example, which is fine IMO. What we don't want to see is some new drop of code added and abandoned, but you already knew that.
Quoted 6 lines
At any rate, if Felipe is the only one arguing against including suspend blockers in the kernel, you're probably in good shape. Based on my (rather cursory I admit) evaluation of this thread, it seems like reasonable people agree that there's a place for a suspend blocker like API in the kernel, and that dynamic power management is also highly desirable. So where's the git pull request already? :)
Quoted 3 lines
In fact my patch going in that direction has been merged already and that code will likely be extended to cover some needs and cases I didn't have in mind when I was preparing it.
Yeah, I like what you've done with dynamic power management, really good stuff (the approach is very similar to the one I used for vblank interrupt management in the drm layer).
Ted's point about providing the user with a way of knowing which apps are blocking things is a good one though, and doesn't seem too hard to add. It might even be possible to do it largely with scripts wrapping fuser and such.
Quoted 17 lines
However, having discussed the whole issue for many times and reconsidered it thoroughly, I think that it's inappropriate to identify the suspend blockers (or wakelocks) framework with the opportunistic suspend feature as proposed in the original submission of the "suspend blockers" patchset. IMO they really are not the same thing and while the suspend blockers framework is used by Android to implement opportunistic suspend, I don't really believe this is the right approach.
We really need something similar to suspend blockers to avoid races between a suspend process and wakeup events, but it isn't necessary to provide user space with an interface allowing it to use these things directly. Such an interface is only necessary in the specific implementation in which the system is suspended as soon as the number of "active" suspend blockers goes down to zero. Arguably, though, this isn't the only possible way to implement a mechanism allowing the system to be suspended automatically when it appears to be inactive.
Quoted 11 lines
Namely, one can use a user space power manager for this purpose and actually the OLPC project has been doing that successfully for some time, which clearly demonstrates that the Android approach to this problem is not the only one possible. Moreover, the kernel's system suspend (or hibernate for that matter) code has not been designed to be started from within the kernel. It's been designed to allow a privileged user space process to request the kernel to put the system into a sleep state at any given time regardless of what the other user space processes are doing. While it can be started from within the kernel, this isn't particularly nice and, in the Android case, starting it from within the kernel requires permission from multiple user space processes (given by not taking suspend blockers these processes are allowed to use).
Quoted 6 lines
Yes, I see your point. But I actually think this is a fairly minor distinction. In one case, a privileged app decides when to suspend the system, in the other case, one or more of several privileged apps decide when a suspend should not be allowed to occur. It's just a matter of where you want to put the code and where you want the complexity.
Well, that used to be my opinion before the whole discussion started, but now I think there's more to it.
First off, we need the "forced" suspend, initiated by writing to /sys/power/state, to work regardless of the "opportunistic" one. Now, the races between wakeup events and suspend process are also a problem for the "forced" suspend mechanism, so the fix should not be specific to "opportunistic" suspend. One could argue that that can be fixed by using wakelocks as proposed by the Android developers, but this is not the case, because there's no way to disinguish wakelocks taken by applications (that we don't want the "forced" suspend to react to) from the wakelocks taken by the kernel (that are strictly related to "real" wakeup events).
Second, system suspend is really an intrusive operation that does violent things to many kernel subsystems (it freezes tasks, it puts the mm subsystem into a degraded mode, it forcibly offlines non-boot CPUs and so on). If that is to be started from the kernel, the kernel thread starting it should really ask all of these subsystems if they are OK with whatever it wants to do and the answer would always be "no" in the majority of cases. The very purpose of that design is to allow a user to suspend the system whenever he wants and not to do that when there's an opportunity to power down things because they appear to be inactive (that may or may not be one of the "whenever the user wants" situations, but really the user should be able to specify the conditions). The powering down of things by the kernel when there's an opportunity should really be done in a more intelligent way (simply becasue the kernel is potentially able to do that more intelligently).
Finally, in the kernel-driven opportunistic suspend scenario (using wakelocks) it is not particularly clear which applications should be given the priviledge to participate in the suspend blocking mechanism. I don't think there are any criteria which can be universally used for selecting these applications and in fact on Android that doesn't work very well either (for example, if you leave Google Maps in the foreground while the screan is off on Nexus One and you happen to move reasonably quickly from one location to another, it will drain the battery for the GPS updates much quickier than you'd expect). For this reason I don't think it is particularly smart to rely on applications when deciding whether or not to start system suspend. Other criteria should also be taken into account in general and I have no idea how to provide the kernel with an interface allowing it to do that. Therefore I don't think the kernel should start system suspend automatically.
Quoted 8 lines
In general, we try to keep such complexity out of the kernel, but not always; there are compelling cases for putting complexity in the kernel to provide uniformity and flexibility (e.g. application state save/restore vs. system-wide checkpoints, the former preserves the "if it can be done outside the kernel, it should be", while the latter provides much greater flexibility and avoids the need to port applications to potentially incompatible or unportable state saves/restore libraries).
I understand that and IMO it should be decided on the case-by-case basis. In this particular case, however, I don't think it's appropriate to use the interface designed with user space in mind for implementing a kernel-based mechanism.
Thanks,
Rafael
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 9 lines · Rafael J. Wysocki
Quoted 8 lines
In general, we try to keep such complexity out of the kernel, but not always; there are compelling cases for putting complexity in the kernel to provide uniformity and flexibility (e.g. application state save/restore vs. system-wide checkpoints, the former preserves the "if it can be done outside the kernel, it should be", while the latter provides much greater flexibility and avoids the need to port applications to potentially incompatible or unportable state saves/restore libraries).
Quoted 4 lines
I understand that and IMO it should be decided on the case-by-case basis. In this particular case, however, I don't think it's appropriate to use the interface designed with user space in mind for implementing a kernel-based mechanism.
Putting the "opportunistic suspend" loop into the kernel doesn't save as much as one might think. The loop itself is quite simple, and the task switch it entails is required in any case (since suspend must be carried out within a process context). Putting it in the kernel would save a few user/kernel context switches, not enough to matter IMO. And it wouldn't offer any greater flexibility -- it might even cut down the flexibility.
Alan Stern
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Rafael J. WysockiQuoted 9 lines · Rafael J. Wysocki
Quoted 8 lines
In general, we try to keep such complexity out of the kernel, but not always; there are compelling cases for putting complexity in the kernel to provide uniformity and flexibility (e.g. application state save/restore vs. system-wide checkpoints, the former preserves the "if it can be done outside the kernel, it should be", while the latter provides much greater flexibility and avoids the need to port applications to potentially incompatible or unportable state saves/restore libraries).
Quoted 4 lines
I understand that and IMO it should be decided on the case-by-case basis. In this particular case, however, I don't think it's appropriate to use the interface designed with user space in mind for implementing a kernel-based mechanism.
Putting the "opportunistic suspend" loop into the kernel doesn't save as much as one might think. The loop itself is quite simple, and the task switch it entails is required in any case (since suspend must be carried out within a process context). Putting it in the kernel would save a few user/kernel context switches, not enough to matter IMO. And it wouldn't offer any greater flexibility -- it might even cut down the flexibility.
Alan Stern
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Jesse BarnesQuoted 9 lines · Jesse Barnes
Quoted 6 lines · On Thu, 12 Aug 2010 12:19:34 -0700 Brian Swetland <[email protected]> wrote:
Question though -- has every feature ever added to the kernel been a feature that there's pre-existing usage of? Seems like a chicken and egg problem. Also, some people seem to think there's value in being able to build kernels "out of the box" that work with the Android userspace -- given that there are a few devices out there that have that userspace on 'em.
Quoted 5 lines
We generally try to merge new features like this along with code that uses said feature, but there are always exceptions. We've merged code one release or more before the new code gets used for example, which is fine IMO. What we don't want to see is some new drop of code added and abandoned, but you already knew that.
If Android guys provided a bare minimal Debian system with suspend blockers that people can take a look at and try, I think that would be a good proof of concept. And a bare minimum to get the patches merged.
Quoted 6 lines
At any rate, if Felipe is the only one arguing against including suspend blockers in the kernel, you're probably in good shape. Based on my (rather cursory I admit) evaluation of this thread, it seems like reasonable people agree that there's a place for a suspend blocker like API in the kernel, and that dynamic power management is also highly desirable. So where's the git pull request already? :)
I certainly have been the more vocal recently, but if that's confusing you, I can shut up and let others do the argumentation. I remember at least Alan Cox, Alan Stern, Thomas Gleixner, Kevin Hilman, Felipe Balbi, Tony Lindgren, and Igor Stopa against them.
Signature · 5 lines
Felipe Contreras _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Jesse BarnesQuoted 9 lines · Jesse Barnes
Quoted 6 lines · On Thu, 12 Aug 2010 12:19:34 -0700 Brian Swetland <[email protected]> wrote:
Question though -- has every feature ever added to the kernel been a feature that there's pre-existing usage of? Seems like a chicken and egg problem. Also, some people seem to think there's value in being able to build kernels "out of the box" that work with the Android userspace -- given that there are a few devices out there that have that userspace on 'em.
Quoted 5 lines
We generally try to merge new features like this along with code that uses said feature, but there are always exceptions. We've merged code one release or more before the new code gets used for example, which is fine IMO. What we don't want to see is some new drop of code added and abandoned, but you already knew that.
If Android guys provided a bare minimal Debian system with suspend blockers that people can take a look at and try, I think that would be a good proof of concept. And a bare minimum to get the patches merged.
Quoted 6 lines
At any rate, if Felipe is the only one arguing against including suspend blockers in the kernel, you're probably in good shape. Based on my (rather cursory I admit) evaluation of this thread, it seems like reasonable people agree that there's a place for a suspend blocker like API in the kernel, and that dynamic power management is also highly desirable. So where's the git pull request already? :)
I certainly have been the more vocal recently, but if that's confusing you, I can shut up and let others do the argumentation. I remember at least Alan Cox, Alan Stern, Thomas Gleixner, Kevin Hilman, Felipe Balbi, Tony Lindgren, and Igor Stopa against them.
Signature · 1 line
Felipe Contreras
Re: Attempted summary of suspend-blockers LKML thread, take three
Hi!
Quoted 13 lines
Quoted 7 lines
Quoted 6 lines
Question though -- has every feature ever added to the kernel been a feature that there's pre-existing usage of? Seems like a chicken and egg problem. Also, some people seem to think there's value in being able to build kernels "out of the box" that work with the Android userspace -- given that there are a few devices out there that have that userspace on 'em.
Quoted 5 lines
We generally try to merge new features like this along with code that uses said feature, but there are always exceptions. We've merged code one release or more before the new code gets used for example, which is fine IMO. What we don't want to see is some new drop of code added and abandoned, but you already knew that.
Quoted 3 lines
If Android guys provided a bare minimal Debian system with suspend blockers that people can take a look at and try, I think that would be a good proof of concept. And a bare minimum to get the patches merged.
Yes, that would certainly help.
I guess this is the major point -- as suspend blockers seem very suitable for android, they don't seem suitable for anyone else...
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Ted Ts'oQuoted 4 lines
I have a similar problem with the whole
pm_qossubsystem, as I've said earlier. If some badly behaved application claims to want 0us wireless latency, and keeps the radio on all the time, there is no way for me to find out which is the badly behaved application --- even
Well firstly you want limits so SELinux says "No" (or rlimit or similar) and secondly you want sysfs views.
This is like file permissions - its not hard
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Ted Ts'oQuoted 13 lines · Ted Ts'o
Quoted 9 lines · Felipe Contreras
The question is why are we adding a user-space API that:
1) no user-space beside Android has expresses interest in implementing
2) is dubious whether the benefits are worth the pain for non-Android
user-space
3) will become less and less attractive as dynamic PM gets closer to
the sweet-spot, and then surpass it
4) Android can keep in a separate tree until it's clear in the linux
community that it's useful (if it ever happens)So, Felipe,
Quoted 8 lines
Do you believe you speak for all of LKML?
Are you willing to tell ZDNet and the Slashdot fanboys that it's OK for Suspend blockers to live in a separate tree, and it's not a case of OMG! Google is forking the kernel?
If you could speak out a passionately on those forums as you have here, that would be great.
Ted, what is going on here? Are you suggesting people disagreeing with Google patches suddenly have to do advocacy for Google?
And yes, for the record Felipe speaks for me pretty well.
Normal path of merging stuff to the kernel is
"Google develops it, then modifies it to address the review comments, then it is merged, then it is deployed".
Unfortunately what Google did here is:
"Google develops it behind the closed door, then deploys it. When asked for changes, Google expects someone else to create system compatible with their existing solution, or else their patches being merged."
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 15 lines · Pavel Machek
Quoted 14 lines · Ted Ts'o
Quoted 9 lines · Felipe Contreras
The question is why are we adding a user-space API that:
1) no user-space beside Android has expresses interest in implementing
2) is dubious whether the benefits are worth the pain for non-Android
user-space
3) will become less and less attractive as dynamic PM gets closer to
the sweet-spot, and then surpass it
4) Android can keep in a separate tree until it's clear in the linux
community that it's useful (if it ever happens)So, Felipe,
Do you believe you speak for all of LKML?
[...]
Quoted 1 line
And yes, for the record Felipe speaks for me pretty well.
Not that I´m as "valuable" as the others quoted above: I have the same impression.
Quoted 11 lines
Normal path of merging stuff to the kernel is
"Google develops it, then modifies it to address the review comments, then it is merged, then it is deployed".
Unfortunately what Google did here is:
"Google develops it behind the closed door, then deploys it. When asked for changes, Google expects someone else to create system compatible with their existing solution, or else their patches being merged."
That basically sums it up as far as I see.
Bernd
Signature · 7 lines
Bernd Petrovitsch Email : [email protected] LUGA : http://www.luga.at _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Pavel MachekQuoted 15 lines · Pavel Machek
Quoted 14 lines · Ted Ts'o
Quoted 9 lines · Felipe Contreras
The question is why are we adding a user-space API that:
1) no user-space beside Android has expresses interest in implementing
2) is dubious whether the benefits are worth the pain for non-Android
user-space
3) will become less and less attractive as dynamic PM gets closer to
the sweet-spot, and then surpass it
4) Android can keep in a separate tree until it's clear in the linux
community that it's useful (if it ever happens)So, Felipe,
Do you believe you speak for all of LKML?
[...]
Quoted 1 line
And yes, for the record Felipe speaks for me pretty well.
Not that I´m as "valuable" as the others quoted above: I have the same impression.
Quoted 11 lines
Normal path of merging stuff to the kernel is
"Google develops it, then modifies it to address the review comments, then it is merged, then it is deployed".
Unfortunately what Google did here is:
"Google develops it behind the closed door, then deploys it. When asked for changes, Google expects someone else to create system compatible with their existing solution, or else their patches being merged."
That basically sums it up as far as I see.
Bernd
Signature · 2 lines
Bernd Petrovitsch Email : [email protected] LUGA : http://www.luga.at
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Pavel MachekQuoted 26 lines · On Sat, 14 Aug 2010 09:50:00 +0200 Pavel Machek <[email protected]> wrote:
Quoted 13 lines · Ted Ts'o
Quoted 9 lines · Felipe Contreras
The question is why are we adding a user-space API that:
1) no user-space beside Android has expresses interest in implementing
2) is dubious whether the benefits are worth the pain for non-Android
user-space
3) will become less and less attractive as dynamic PM gets closer to
the sweet-spot, and then surpass it
4) Android can keep in a separate tree until it's clear in the linux
community that it's useful (if it ever happens)So, Felipe,
Quoted 8 lines
Do you believe you speak for all of LKML?
Are you willing to tell ZDNet and the Slashdot fanboys that it's OK for Suspend blockers to live in a separate tree, and it's not a case of OMG! Google is forking the kernel?
If you could speak out a passionately on those forums as you have here, that would be great.
Ted, what is going on here? Are you suggesting people disagreeing with Google patches suddenly have to do advocacy for Google?
Quoted 6 lines
And yes, for the record Felipe speaks for me pretty well.
Normal path of merging stuff to the kernel is
"Google develops it, then modifies it to address the review comments, then it is merged, then it is deployed".
Pavel, you should know better than this. You've been working on Linux long enough to know that development doesn't happen this way.
It's far more common (and prudent, business-wise) for companies to develop changes against upstream Linux, ship them, and then try to get them or something like them integrated upstream. This often works fine, but big problems arise when either the company in question doesn't bother to ever push upstream (Linux loses out on support for a given feature or hardware) or ships changes that have very little chance of getting upstream (we end up with a fork).
Quoted 6 lines
Unfortunately what Google did here is:
"Google develops it behind the closed door, then deploys it. When asked for changes, Google expects someone else to create system compatible with their existing solution, or else their patches being merged."
Although it would have been nice for Google to work more directly with upstream on their suspend blockers for Android, I don't think they could have made their product development cycle a slave to the politics of upstream development.
Fortunately in this case the problem doesn't seem to be fatal. We've already established that the userland API portion of suspend blockers could be implemented in userspace with a bit more work, given that the kernel problems with suspend/resume and events are addressed. Hopefully Google is already developing a prototype userspace implementation to make sure it's workable; being able to build stock upstream kernels for my Droid and its Android userspace sure would be nice.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Pavel MachekQuoted 26 lines · On Sat, 14 Aug 2010 09:50:00 +0200 Pavel Machek <[email protected]> wrote:
Quoted 13 lines · Ted Ts'o
Quoted 9 lines · Felipe Contreras
The question is why are we adding a user-space API that:
1) no user-space beside Android has expresses interest in implementing
2) is dubious whether the benefits are worth the pain for non-Android
user-space
3) will become less and less attractive as dynamic PM gets closer to
the sweet-spot, and then surpass it
4) Android can keep in a separate tree until it's clear in the linux
community that it's useful (if it ever happens)So, Felipe,
Quoted 8 lines
Do you believe you speak for all of LKML?
Are you willing to tell ZDNet and the Slashdot fanboys that it's OK for Suspend blockers to live in a separate tree, and it's not a case of OMG! Google is forking the kernel?
If you could speak out a passionately on those forums as you have here, that would be great.
Ted, what is going on here? Are you suggesting people disagreeing with Google patches suddenly have to do advocacy for Google?
Quoted 6 lines
And yes, for the record Felipe speaks for me pretty well.
Normal path of merging stuff to the kernel is
"Google develops it, then modifies it to address the review comments, then it is merged, then it is deployed".
Pavel, you should know better than this. You've been working on Linux long enough to know that development doesn't happen this way.
It's far more common (and prudent, business-wise) for companies to develop changes against upstream Linux, ship them, and then try to get them or something like them integrated upstream. This often works fine, but big problems arise when either the company in question doesn't bother to ever push upstream (Linux loses out on support for a given feature or hardware) or ships changes that have very little chance of getting upstream (we end up with a fork).
Quoted 6 lines
Unfortunately what Google did here is:
"Google develops it behind the closed door, then deploys it. When asked for changes, Google expects someone else to create system compatible with their existing solution, or else their patches being merged."
Although it would have been nice for Google to work more directly with upstream on their suspend blockers for Android, I don't think they could have made their product development cycle a slave to the politics of upstream development.
Fortunately in this case the problem doesn't seem to be fatal. We've already established that the userland API portion of suspend blockers could be implemented in userspace with a bit more work, given that the kernel problems with suspend/resume and events are addressed. Hopefully Google is already developing a prototype userspace implementation to make sure it's workable; being able to build stock upstream kernels for my Droid and its Android userspace sure would be nice.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 8 lines · Jesse Barnes
Fortunately in this case the problem doesn't seem to be fatal. We've already established that the userland API portion of suspend blockers could be implemented in userspace with a bit more work, given that the kernel problems with suspend/resume and events are addressed. Hopefully Google is already developing a prototype userspace implementation to make sure it's workable; being able to build stock upstream kernels for my Droid and its Android userspace sure would be nice.
You know, you don't have to wait for the Android engineers to do this work. You (or others who want to be able to use stock upstream kernel with Android devices) could just as easily try to do the "bit more work" yourselves --- that is, do the open souce thing and scratch one's own itch.
After all, Rafael is saying he's refusing to accept patches (or implement) in-kernel oppunsitic suspend for upstream unless it's proven to him that a userspace implementation isn't sufficient. It might be just as fair for the Android userspace upstream to refuse to accept (or engineer) userspace changes unless it is proven that the userspace version of opporunistic suspend is just as good as the in-kernel version which is successfully been deployed in millions and millions of shipping units today...
Speaking personally, it's not clear to me how waking up a userspace suspend daemon and waiting for it to get scheduled will result in better power savings than simply handling it in the kernel, but as soon as someone is willing to do the work, we can find out for sure who is right.
- Ted
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Jesse BarnesQuoted 8 lines · Jesse Barnes
Fortunately in this case the problem doesn't seem to be fatal. We've already established that the userland API portion of suspend blockers could be implemented in userspace with a bit more work, given that the kernel problems with suspend/resume and events are addressed. Hopefully Google is already developing a prototype userspace implementation to make sure it's workable; being able to build stock upstream kernels for my Droid and its Android userspace sure would be nice.
You know, you don't have to wait for the Android engineers to do this work. You (or others who want to be able to use stock upstream kernel with Android devices) could just as easily try to do the "bit more work" yourselves --- that is, do the open souce thing and scratch one's own itch.
After all, Rafael is saying he's refusing to accept patches (or implement) in-kernel oppunsitic suspend for upstream unless it's proven to him that a userspace implementation isn't sufficient. It might be just as fair for the Android userspace upstream to refuse to accept (or engineer) userspace changes unless it is proven that the userspace version of opporunistic suspend is just as good as the in-kernel version which is successfully been deployed in millions and millions of shipping units today...
Speaking personally, it's not clear to me how waking up a userspace suspend daemon and waiting for it to get scheduled will result in better power savings than simply handling it in the kernel, but as soon as someone is willing to do the work, we can find out for sure who is right.
- Ted
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 10 lines · On Mon, 16 Aug 2010 20:20:32 -0400 Ted Ts'o <[email protected]> wrote:
Quoted 8 lines · Jesse Barnes
Fortunately in this case the problem doesn't seem to be fatal. We've already established that the userland API portion of suspend blockers could be implemented in userspace with a bit more work, given that the kernel problems with suspend/resume and events are addressed. Hopefully Google is already developing a prototype userspace implementation to make sure it's workable; being able to build stock upstream kernels for my Droid and its Android userspace sure would be nice.
Quoted 5 lines
You know, you don't have to wait for the Android engineers to do this work. You (or others who want to be able to use stock upstream kernel with Android devices) could just as easily try to do the "bit more work" yourselves --- that is, do the open souce thing and scratch one's own itch.
Sure, I could. And the Google guys could put together a whole Debian distro with suspend blockers sprinkled throughout various apps. But for my part, I can't justify that kind of work at the moment. Of course I'd be happy if someone could and did do the work, it would be a useful exercise and potentially allow Android to work well on stock kernels.
Quoted 9 lines
After all, Rafael is saying he's refusing to accept patches (or implement) in-kernel oppunsitic suspend for upstream unless it's proven to him that a userspace implementation isn't sufficient. It might be just as fair for the Android userspace upstream to refuse to accept (or engineer) userspace changes unless it is proven that the userspace version of opporunistic suspend is just as good as the in-kernel version which is successfully been deployed in millions and millions of shipping units today...
Quoted 5 lines
Speaking personally, it's not clear to me how waking up a userspace suspend daemon and waiting for it to get scheduled will result in better power savings than simply handling it in the kernel, but as soon as someone is willing to do the work, we can find out for sure who is right.
Yeah it would add some overhead, since suspend blocker calls would use IPC to a userspace daemon, which would also be responsible for (periodically?) waking up to see if the system ought to be suspended... I agree coding it up would be a useful exercise.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Ted Ts'oQuoted 10 lines · On Mon, 16 Aug 2010 20:20:32 -0400 Ted Ts'o <[email protected]> wrote:
Quoted 8 lines · Jesse Barnes
Fortunately in this case the problem doesn't seem to be fatal. We've already established that the userland API portion of suspend blockers could be implemented in userspace with a bit more work, given that the kernel problems with suspend/resume and events are addressed. Hopefully Google is already developing a prototype userspace implementation to make sure it's workable; being able to build stock upstream kernels for my Droid and its Android userspace sure would be nice.
Quoted 5 lines
You know, you don't have to wait for the Android engineers to do this work. You (or others who want to be able to use stock upstream kernel with Android devices) could just as easily try to do the "bit more work" yourselves --- that is, do the open souce thing and scratch one's own itch.
Sure, I could. And the Google guys could put together a whole Debian distro with suspend blockers sprinkled throughout various apps. But for my part, I can't justify that kind of work at the moment. Of course I'd be happy if someone could and did do the work, it would be a useful exercise and potentially allow Android to work well on stock kernels.
Quoted 9 lines
After all, Rafael is saying he's refusing to accept patches (or implement) in-kernel oppunsitic suspend for upstream unless it's proven to him that a userspace implementation isn't sufficient. It might be just as fair for the Android userspace upstream to refuse to accept (or engineer) userspace changes unless it is proven that the userspace version of opporunistic suspend is just as good as the in-kernel version which is successfully been deployed in millions and millions of shipping units today...
Quoted 5 lines
Speaking personally, it's not clear to me how waking up a userspace suspend daemon and waiting for it to get scheduled will result in better power savings than simply handling it in the kernel, but as soon as someone is willing to do the work, we can find out for sure who is right.
Yeah it would add some overhead, since suspend blocker calls would use IPC to a userspace daemon, which would also be responsible for (periodically?) waking up to see if the system ought to be suspended... I agree coding it up would be a useful exercise.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Ted Ts'oQuoted 16 lines · On Mon, 16 Aug 2010 20:20:32 -0400 Ted Ts'o <[email protected]> wrote:
Quoted 8 lines · Jesse Barnes
Fortunately in this case the problem doesn't seem to be fatal. We've already established that the userland API portion of suspend blockers could be implemented in userspace with a bit more work, given that the kernel problems with suspend/resume and events are addressed. Hopefully Google is already developing a prototype userspace implementation to make sure it's workable; being able to build stock upstream kernels for my Droid and its Android userspace sure would be nice.
You know, you don't have to wait for the Android engineers to do this work. You (or others who want to be able to use stock upstream kernel with Android devices) could just as easily try to do the "bit more work" yourselves --- that is, do the open souce thing and scratch one's own itch.
Quoted 8 lines
After all, Rafael is saying he's refusing to accept patches (or implement) in-kernel oppunsitic suspend for upstream unless it's proven to him that a userspace implementation isn't sufficient. It might be just as fair for the Android userspace upstream to refuse to accept (or engineer) userspace changes unless it is proven that the userspace version of opporunistic suspend is just as good as the in-kernel version which is successfully been deployed in millions and millions of shipping units today...
Reminds me of the one of the first questions asked in a murder investigation (or so they say on TV)
Cui Bono??
Who benefits? Does Android benefit more by being able to use a standard kernel, or does Linux benefit more by being able to run Android without modification.
Currently it seems that only the lawyers^Wpeople who like arguing on lkml are gaining anything.
Maybe this is the first real fork of Linux - google might be rich enough to persist with it.
Quoted 6 lines
Speaking personally, it's not clear to me how waking up a userspace suspend daemon and waiting for it to get scheduled will result in better power savings than simply handling it in the kernel, but as soon as someone is willing to do the work, we can find out for sure who is right.
I'm surprised at this comment Ted!
Power saving is not the single supreme goal, yet you make it sound like it is.
It should be no surprise to anyone if the most maintainable solution uses a little more power than the most highly optimised solution. I think most of us would still prefer the more maintainable solution. However, if google sees a market opportunity for the minor optimisation of suspend-from-kernel rather than suspend-from-user-space, then it would seem they are welcome to it.
NeilBrown
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Ted Ts'oQuoted 16 lines · On Mon, 16 Aug 2010 20:20:32 -0400 Ted Ts'o <[email protected]> wrote:
Quoted 8 lines · Jesse Barnes
Fortunately in this case the problem doesn't seem to be fatal. We've already established that the userland API portion of suspend blockers could be implemented in userspace with a bit more work, given that the kernel problems with suspend/resume and events are addressed. Hopefully Google is already developing a prototype userspace implementation to make sure it's workable; being able to build stock upstream kernels for my Droid and its Android userspace sure would be nice.
You know, you don't have to wait for the Android engineers to do this work. You (or others who want to be able to use stock upstream kernel with Android devices) could just as easily try to do the "bit more work" yourselves --- that is, do the open souce thing and scratch one's own itch.
Quoted 8 lines
After all, Rafael is saying he's refusing to accept patches (or implement) in-kernel oppunsitic suspend for upstream unless it's proven to him that a userspace implementation isn't sufficient. It might be just as fair for the Android userspace upstream to refuse to accept (or engineer) userspace changes unless it is proven that the userspace version of opporunistic suspend is just as good as the in-kernel version which is successfully been deployed in millions and millions of shipping units today...
Reminds me of the one of the first questions asked in a murder investigation (or so they say on TV)
Cui Bono??
Who benefits? Does Android benefit more by being able to use a standard kernel, or does Linux benefit more by being able to run Android without modification.
Currently it seems that only the lawyers^Wpeople who like arguing on lkml are gaining anything.
Maybe this is the first real fork of Linux - google might be rich enough to persist with it.
Quoted 6 lines
Speaking personally, it's not clear to me how waking up a userspace suspend daemon and waiting for it to get scheduled will result in better power savings than simply handling it in the kernel, but as soon as someone is willing to do the work, we can find out for sure who is right.
I'm surprised at this comment Ted!
Power saving is not the single supreme goal, yet you make it sound like it is.
It should be no surprise to anyone if the most maintainable solution uses a little more power than the most highly optimised solution. I think most of us would still prefer the more maintainable solution. However, if google sees a market opportunity for the minor optimisation of suspend-from-kernel rather than suspend-from-user-space, then it would seem they are welcome to it.
NeilBrown
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 3 lines · Neil Brown
Maybe this is the first real fork of Linux - google might be rich enough to persist with it.
Define "real fork"? Both SuSE and Red Hat have carried patches, in some cases for years, forward porting them to newer kernels. Does that make them forks?
SuSE has made changes to e2fsprogs, and carried those patches for years and years, and even added options to command-line programs which SLES's init scripts are dependent on --- and this was done without even consulting me first. Yet you don't see me calling out SLES for "forking" e2fsprogs and how it "got away" with it.
Can we please cut out this whole forking nonsense? I've been told that it's only something Slashdot kiddies and ZDNet media types looking for advertising impressions. Yet you're a kernel programmer, and one who works for a distribution, and you've made this same claim; you should know better.
Quoted 7 lines
I'm surprised at this comment Ted!
Power saving is not the single supreme goal, yet you make it sound like it is.It should be no surprise to anyone if the most maintainable solution uses a little more power than the most highly optimised solution. I think most of us would still prefer the more maintainable solution.
I think part of the problem here is what's considered "acceptable" to one set of developers may not be considered "acceptable" to another set. As I've said many times before, what makes sense for a cell phone battery and highly power-optimized hardware may not make sense for a devices with 6-cell laptop battery. And I think it's still to be seen whether or not suspend-from-userspace really is as minor as people think it is, and what compromises might have to be made in how app programs are forced to develop their applications, etc.
- Ted
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Neil BrownQuoted 3 lines · Neil Brown
Maybe this is the first real fork of Linux - google might be rich enough to persist with it.
Define "real fork"? Both SuSE and Red Hat have carried patches, in some cases for years, forward porting them to newer kernels. Does that make them forks?
SuSE has made changes to e2fsprogs, and carried those patches for years and years, and even added options to command-line programs which SLES's init scripts are dependent on --- and this was done without even consulting me first. Yet you don't see me calling out SLES for "forking" e2fsprogs and how it "got away" with it.
Can we please cut out this whole forking nonsense? I've been told that it's only something Slashdot kiddies and ZDNet media types looking for advertising impressions. Yet you're a kernel programmer, and one who works for a distribution, and you've made this same claim; you should know better.
Quoted 7 lines
I'm surprised at this comment Ted!
Power saving is not the single supreme goal, yet you make it sound like it is.It should be no surprise to anyone if the most maintainable solution uses a little more power than the most highly optimised solution. I think most of us would still prefer the more maintainable solution.
I think part of the problem here is what's considered "acceptable" to one set of developers may not be considered "acceptable" to another set. As I've said many times before, what makes sense for a cell phone battery and highly power-optimized hardware may not make sense for a devices with 6-cell laptop battery. And I think it's still to be seen whether or not suspend-from-userspace really is as minor as people think it is, and what compromises might have to be made in how app programs are forced to develop their applications, etc.
- Ted
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Neil BrownQuoted 42 lines · Neil Brown
Quoted 16 lines · On Mon, 16 Aug 2010 20:20:32 -0400 Ted Ts'o <[email protected]> wrote:
Quoted 8 lines · Jesse Barnes
Fortunately in this case the problem doesn't seem to be fatal. We've already established that the userland API portion of suspend blockers could be implemented in userspace with a bit more work, given that the kernel problems with suspend/resume and events are addressed. Hopefully Google is already developing a prototype userspace implementation to make sure it's workable; being able to build stock upstream kernels for my Droid and its Android userspace sure would be nice.
You know, you don't have to wait for the Android engineers to do this work. You (or others who want to be able to use stock upstream kernel with Android devices) could just as easily try to do the "bit more work" yourselves --- that is, do the open souce thing and scratch one's own itch.
Quoted 8 lines
After all, Rafael is saying he's refusing to accept patches (or implement) in-kernel oppunsitic suspend for upstream unless it's proven to him that a userspace implementation isn't sufficient. It might be just as fair for the Android userspace upstream to refuse to accept (or engineer) userspace changes unless it is proven that the userspace version of opporunistic suspend is just as good as the in-kernel version which is successfully been deployed in millions and millions of shipping units today...
Reminds me of the one of the first questions asked in a murder investigation (or so they say on TV)
Cui Bono??Who benefits? Does Android benefit more by being able to use a standard kernel, or does Linux benefit more by being able to run Android without modification.
Currently it seems that only the lawyers^Wpeople who like arguing on lkml are gaining anything.
Maybe this is the first real fork of Linux - google might be rich enough to persist with it.
Quoted 8 lines
Quoted 5 lines
Speaking personally, it's not clear to me how waking up a userspace suspend daemon and waiting for it to get scheduled will result in better power savings than simply handling it in the kernel, but as soon as someone is willing to do the work, we can find out for sure who is right.
I'm surprised at this comment Ted!
Power saving is not the single supreme goal, yet you make it sound like it is.
My initial impression was also that power savings was Android's single supreme goal, but a careful reading of this thread and the ones preceding it taught me otherwise. Please see below for my current understanding of what they are trying to accomplish. As always, feedback is welcome!
Thanx, Paul
------------------------------------------------------------------------
Subject: Attempted summary of suspend-blockers LKML thread, epilogue 1
Final report from this particular angel-free zone for the time being...
This is the third^Wfourth and final version of my Android requirements list (last version available at http://lkml.org/lkml/2010/8/6/581).
Again, this email is an attempt to present the Android guys' requirements, based on my interpretation of LKML discussions. Thank you to everyone who took part.
Please note that I am not proposing a solution that meets these requirements, nor am I attempting to judge the various proposed solutions. In fact, I am not trying to judge whether the requirements are optimal, or even whether or not they make sense at all. My only goal at the moment is to improve our collective understanding of what the Android folks' requirements are. That said, I do discuss example mechanisms where needed to clarify the meaning of the requirements. This should not be interpreted as a preference for any given example mechanism.
Thanx, Paul
------------------------------------------------------------------------
CONTENTS
o DEFINITIONS
o CATEGORIES OF APPLICATION BEHAVIOR
o REQUIREMENTS
o NICE-TO-HAVES
o APPARENT NON-REQUIREMENTS
o SUGGESTED USAGE
o POWER-OPTIMIZED APPLICATIONS
o OTHER EXAMPLE APPLICATIONS
o ACKNOWLEDGMENTS
DEFINITIONS
These have been updated based on LKML and linux-pm discussions. The names are probably still sub-optimal, but incremental progress is nevertheless a very good thing.
o "Ill-behaved application" AKA "untrusted application" AKA
"crappy application". The Android guys seem to be thinking in terms of applications that are well-designed and well-implemented in general, but which do not take power consumption or battery life into account. Examples include applications designed for externally powered PCs. Many other people seemed to instead be thinking in terms of an ill-conceived or useless application, perhaps exemplified by "bouncing cows".
This document uses "power-oblivious applications" to mean applications that are well-designed and well-implemented in in general, but which do not take power consumption or battery life into account.
o "PM-driving application" are applications that are permitted
to acquire suspend blockers on Android. Verion 8 of the suspend-blocker patch seems to use group permissions to determine
which processes are classified as power aware. Android uses a
user-level daemon to classify app-store apps as PM-driving or not. More generally, PM-driving applications are those that have permission to exert some control over the system's sleep state.
Note that an application might be power-oblivious on one Android device and PM-driving on another, depending on whether the user allows that application to acquire suspend blockers. The classification might even change over time. For example, a user might give an application PM-driving status initially, but change his or her mind after some experience with that application.
o Oddly enough, "power-optimized applications" were not discussed.
See "POWER-OPTIMIZED APPLICATIONS" below for a brief introduction. The short version is that power-optimized applications are those PM-driving applications that have been aggressively tuned to reduce power consumption.
o Individual devices in an embedded system can enter "device
low-power states" when not in use.
o The system as a whole can enter a "system sleep state" when
the system as a whole is not in use. Suspend blockers are about system sleep states rather than device low-power states.
o There was much discussion of "idle" (AKA "deep idle") and
"suspend" (as in current Linux-kernel suspend operations). The following characteristics distinguish "idle" from "suspend":
1. Idle states are entered by a given CPU only there are no
runnable tasks for that CPU. In contrast, opportunistic suspend can halt the entire system even when there are tasks that are ready, willing, and able to run. (But please note that this might not apply to real-time tasks.)
Freezing of subsets of applications is somewhat related to the idle/suspend discussion, but is covered in a later section of this document.
2. There can be a set of input events that do not bring
the system out of suspend, but which would bring the system out of idle. Exactly which events are in this set depends both on hardware capabilities and on the platform/application policy. For example, on one of the Android-based smartphones, touchscreen input is ignored when the system is suspended, but is handled when idle.
3. The system comes out of idle when a timer expires. In
contrast, timers might or might not bring the system out of suspend, depending on both hardware capabilities and platform/application policy.
4. Suspend generally forces devices to go into their
low-power states immediately. In contrast, idle generally leaves unused devices at full power, relying on timers to shut down these devices. Idle thus often has shorter average wakeup latencies, but on systems where suspend can use deeper sleep states than can idle, idle might have worse energy efficiency.
5. Suspend shuts down timekeeping, but deep idle currently
does not. Timekeeping requires periodic interrupts to correctly compute time. If these interrupts are spaced too far apart (for example, by minutes or hours), timekeeping can become inaccurate. The degree of inaccuracy and the permissible spacing intervals depends on the time-source hardware and the kernel configuration. (It might be possible to reduce the timekeeping system's dependency on periodic interrupts, but this is currently speculation rather than reality.)
6. Suspend usually has longer wakeup latency than does
idle.
CATEGORIES OF APPLICATION BEHAVIOR
There are a number of categories of application behavior with respect to power management and energy efficiency. These can be classified via the following questions: (1) What degree of control is an application permitted over its own behavior? (2) What degree of control is an application permitted over the power state of individual devices within the system? (3) What degree of control is an application permitted over the system sleep state? (4) To what degree has the application been tuned to reduce its power consumption, either in isolation or in conjunction with other applications that might be running concurrently?
These categories are discussed below.
o What degree of control is an application permitted over its
own behavior?
The Linux kernel already has many controls over application behavior:
o the CAP_ capabilities from include/linux/capability.h.
o Processes can be assigned to multiple groups, allowing
them privileged access to portions of the filesystem.
o The chroot() system call limits a process's access to the
specified subtree of the filesystem.
o The ulimit facility can limit CPU consumption, number
of processes, memory, etc. on a per-user basis. The rlimit facility has similar effects on a per-process basis.
o The mlockall() system call provides privileged access
to memory, avoiding page-fault overhead.
But more relevant to this discussion, real-time processes are permitted a much higher degree of control over the timing of their execution than are non-real-time processes. However, suspending the system destroys any pretense of offering real-time guarantees, which might explain much of the annoyance towards suspend blockers from the real-time and scheduler folks. For but one example, Peter Zijlstra suggested that he would merge a patch that acquired a suspend blocker any time that the runqueues were non-empty. My first reaction was amusement at this vintage Peter Zijlstra response, and my second reaction was that it was a futile gesture, as the Android guys would simply back out any such change.
After more thought, however, a variation of Peter's approach might well be the key to resolving this tension between real-time response on the one hand and Android's desire to conserve power at any cost on the other. Given that suspending destroys real-time response, why not acquire a suspend blocker any time there is a user-created real-time task in the system, whether runnable or not? Of course, a simpler approach would be to make Android's OPPORTUNISTIC_SUSPEND depend on !PREEMPT_RT.
o What degree of control is an application permitted over the power
state of individual devices within the system?
Is the application in question permitted to power down the CPU or peripheral devices? As more of the power control is automated based on usage, it is possible that this question will become less relevant. The longer the latency and the greater the energy consumption of a power-up/power-down sequence for a given device, the less suitable that device is for automatic power-up/power-down decisions. Cache SRAMs and main-memory DRAM tend to be less suitable for automation for this reason.
o What degree of control is an application permitted over the
system sleep state?
Is the application permitted to suspend the device? Or in the case of Android, is the application permitted to acquire a suspend blocker, which prevents the device from being suspended?
o To what degree has the application been tuned to reduce its
power consumption, either in isolation or in conjunction with other applications that might be running concurrently?
See the "POWER-OPTIMIZED APPLICATIONS" section below for more detail on the lengths that embedded developers go to in order to conserve power -- or, more accurately, to extend battery life.
REQUIREMENTS
o Reduce the system's power consumption in order to (1) extend
battery life and (2) preserve state until external power can be obtained.
o It is necessary to be able to use power-oblivious applications.
Many of these applications were designed for use in PC platforms where power consumption has historically not been of great concern, due to either (1) the availability of external power or
(2) relatively undemanding laptop battery-lifetime expectations. The system must be capable of running these power-oblivious applications without requiring that these applications be modified, and must be capable of reasonable power efficiency even when power-oblivious applications are in use.
In other words, it must be possible to automate the incorporation of a power-oblivious application into the Android environment, but without significantly degrading battery lifetime.
o If the display is powered off, there is no need to run any
application whose only effect is to update the display.
Although one could simply block such an application when it next tries to access the display, it it is highly desirable that the application also be prevented from consuming power computing something that will not be displayed. Furthermore, whatever mechanism is used must operate on power-oblivious applications that do not use blocking system calls.
There might well be similar requirements for other output-only devices, as noted by Alan Stern.
o In order to avoid overrunning hardware and/or kernel buffers,
and to minimize response latencies, designated input events must be delivered to the corresponding application in a timely fashion. The application might or might not be required to actually process the events in a timely fashion, depending on the specific application.
In particular, if user input that would prevent the system from entering a sleep state is received while the system is transitioning into a sleep state, the system must transition back out of the sleep state so that it can hand the user input off to the corresponding application.
Other input events do not force a wakeup, and such input events -can- be lost due to buffer overflow in hardware or the kernel. The response latency to such input events can of course be unbounded.
o Because Android acquires a suspend blocker as soon as an
input event is noticed and holds it until some application reads that input event, there must be a way to cause the suspend blocker to timeout. If there was no such timeout facility, a power-oblivious application could block suspend by opening an input device and then refusing to ever read from it. (Yes, this can be considered to be a energy-efficiency bug in the power-oblivious application. Please see the statistics requirement below.)
o The API must provide a way for PM-driving applications that
receive events to keep themselves running until they have been able to process those events.
o It must be possible to apply power-oblivious coding techniques
to those code sequences in PM-driving applications where suspend blockers are not held.
o Statistics of the power-control actions taken by PM-driving
applications must be provided. Statistics are aggregated by name,
which is passed by the application in through the suspend-blocker interface. The following specific statistics are collected in the kernel, in roughly decreasing order of importance:
o total_time, which accumulates the total amount of time
that the corresponding suspend blocker has been held.
o active_since, which tracks how long a suspend blocker has
been held since it was last acquired, or (presumably) zero if it is not currently held.
o count, which is the number of times that the suspend
blocker has been acquired. This is useful in combination with total_time, as it allows you to calculate the average hold time for the suspend blocker.
o expire_count, which is the number of times that the
suspend blocker has timed out. This indicates that some application has an input device open, but is not reading from it, which is a bug, as noted earlier.
o max_time, which is the longest hold time for the suspend
blocker. This allows finding cases where suspend blockers are held for too long, but are eventually released. (In contrast, active_since is more useful in the held-forever case.)
o sleep_time, which is the total time that the suspend
blocker was held while the display was powered off. (This might have interesting implications should E-ink displays every become capable of full-motion color video, but it is easy to imagine that the definition of "powered off" would then include only those times during which the display wasn't actively being updated.)
o wake_count, which is the number of times that the
suspend blocker was the first to be acquired in the resume path. This is less than useful on some Android platforms; Arve is dissatisfied with it on Nexus One.
Presumably, the userspace code collects similar statistics on application suspend-blocker activity, but that is out of the scope of this document, which focuses instead on kernel requirements. Given that the overhead of maintaining these statistics is quite low, it seems that it would be worthwhile to have them enabled in production systems, for example, in order to flag power-buggy applications that the user has naively downloaded.
o Some PM-driving applications use power-oblivious infrastructure
code. This means that a PM-driving application must have some way, whether explicit or implicit, to ensure that any power-oblivious infrastructure code is permitted to run when a PM-driving application needs it to run.
o If no PM-driving or power-optimized application are indicating
a need for the system to remain operating, the system is permitted (even encouraged!) to suspend all execution, regardless of the
state of power-oblivious applications. (This requirement did
appear to be somewhat controversial, both in terms of what is meant by "runnable" and in terms of what constitutes "execution".)
In Android, this is implemented by suspending even while PM-driving or power-optimized applications are active, -unless- a suspend blocker is held.
o Transition to system sleep state must be power-efficient.
In particular, methods based on repeated attempts to suspend are considered to be too inefficient to be useful.
o Transition to system sleep state must occur very soon after
all PM-driving and power-optimized applications have indicated that they have no need for the system to remain operating. Quick transition is expecially important in cases where the wakeup was momentary, for example, when processing sporadic network input or processing widely spaced batches of audio output. For an example of the latter, MP3 playback allows 1-4 minute spacing between bursts of CPU activity).
o Individual peripherals and CPUs must still use standard
power-conservation measures, for example, transitioning CPUs into low-power states on idle and powering down peripheral devices and hardware accelerators that have not been recently used.
o The API that controls the system sleep state must be accessible
both from Android's Java replacement, from userland C code, and from kernel C code (both process level and irq code, but not NMI handlers).
o The API that controls the system sleep state must operate
correctly on SMP systems of modest size. (My guess is that "modest" means up to four CPUs, maybe up to eight CPUs.)
o Any QoS-based solution must take display and user-input
state into account. In other words, the QoS must be expressed as a function of the display and the user-input states.
o Transitioning to extremely low-power sleep states requires saving
and restoring DRAM and/or cache SRAM state, which in itself consumes significant energy. The power savings must therefore be balanced against the energy consumed in the state transitions.
o The current Android userspace API must be supported in order
to support existing device software. According to Brian Swetland:
For Java/Dalvik apps, the wakelock API is pertty high level -- it talks to a service via RPC (Binder) that actually interacts with the kernel. Changing the basic kernel<->userspace interface (within reason) is not unthinkable. For example, Arve's suspend_blocker patch provides a device interface rather than the proc interface the older wakelock patches use. We'd have to make some userspace changes to support that but they're pretty low level and minor.
In the current model, only a few processes need to specifically interact with the kernel (the power management service in the system_server, possibly the media_server and the radio interface glue). A model where every process needs to have a bunch of instrumentation is not very desirable from our point of view. We definitely do need reasonable statistics in order to enable debugging and to enable reporting to endusers (through the Battery Usage UI) what's keeping the device awake.
o Any mechanism that freezes some subset of the applications must
ensure that none of the frozen applications hold any user-level resources, such as pthread mutexes. The reason for this is that freezing an application that holds a shared pthread mutex will result in an application-level hang should some unfrozen process attempt to acquire that same pthread mutex. Note that although the current cgroup freezer ensures that frozen applications do not hold any kernel-level mutexes (at least assuming these mutexes are not wrongly held when returning to user-level execution), it currently does nothing to prevent freezing processes holding pthread mutexes. (There are some proposals to address this issue.)
NICE-TO-HAVES
o It would be nice to be able to identify power-oblivious
applications that never were depended on by PM-driving applications. This particular class of power-oblivious applications could be shut down when the screen blanks even if some PM-driving application was preventing the system from powering down.
There are two obstacles to meeting this requirement:
1. There must be a reliable way to identify such
applications. This should be doable, for example, the application might be tagged by its developer.
2. There must be a reliable way to freeze them such
that no frozen application holds a resource that might be contended by a non-frozen application.
Although the cgroup freezer does ensure that frozen tasks hold no kernel-level resources, it currently does nothing to ensure that no user-level resources are held. There are some alternative proposals, which might or might not be more successful:
a. Unfreeze this group periodically to ensure
that any such resource is eventually released, while keeping power consumption down to a dull roar.
b. Perform the freeze at application level, where
it is possible to determine whether an application-level resource is held.
o Any initialization of the API that controls the system power
state should be unconditional, so as to be free from failure. Such unconditional initialization reduces the intrusiveness of the Android patchset.
APPARENT NON-REQUIREMENTS
o Transitioning to system sleep states need not be highly scalable,
as evidenced by the global locks. (If you believe that high scalability will in fact be required, please provide a use case. But please understand that I do know something about scalability trends, but also about uses for transistors beyond more cores.)
That said, it should not be hard to provide a highly scalable implementation of suspend blockers, especially if large systems are allowed to take their time suspending themselves.
o Conserving power in the WiFi and cellular telephony networks.
At the moment, the focus is on increased battery life in the handheld device, perhaps even at the expense of additional power consumed by the externally powered WiFi and cell-telephony equipment.
o Synchronizing wakeups of unrelated applications. This is of
course an important requirement for power savings overall, but seems to be left to other mechanisms (e.g., timer aggregation) by the Android folks. Although one could implement suspend blockers so as to aggregate timers after a sufficiently long suspension, there are problems with this approach:
o There would be a "thundering herd" problem just after
resume completed as almost every timer in the system would expire simultaneously.
o The applications would not necessarily stay aggregated
without some other mechanism helping out.
SUGGESTED USAGE
These are constraints that the developer is expected to abide by, "for best results" and all that.
o When a PM-driving application is preventing the system from
shutting down, and is also waiting on a power-oblivious application, the PM-driving application should set a timeout to handle the possibility that the power-oblivious application might halt or otherwise fail.
POWER-OPTIMIZED APPLICATIONS
A typical power-optimized application manually controls the power state of many separately controlled hardware subsystems to minimize power consumption. Such optimization normally requires an understanding of the hardware and of the full system's workload: strangely enough, concurrently running two separately power-optimized applications often does -not- result in a power-optimized system. Such optimization also requires knowledge of what the application will be doing in the future, so that needed hardware subsystems can be proactively powered up just when the application will need them. This is especially important when powering down cache SRAMS or banks of main memory, because such components take significant time (and consume significant energy) when preparing them to be powered off and when restoring their state after powering them on.
Consider an MP3 player as an example. Such a player will periodically read MP3-encoded data from flash memory, decode it (possibly using hardware acceleration), and place the resulting audio data into main memory. Different systems have different ways of getting the data from main memory to the audio output device, but let's assume that the audio output device consumes data at a predictable rate such that the software can use timers to schedule refilling of the device's output buffer. The timer duration will of course need to allow for the time required to power up the CPU and L2 cache. The timer can be allowed to happen too soon, albeit with a battery-lifetime penalty, but cannot be permitted to happen too late, as this will cause "skips" in the playback.
If MP3 playback is the only application running in the system, things are quite easy. We calculate when the audio output device will empty its buffer, allow a few milliseconds to power up the needed hardware, and set a timer accordingly. Because modern audio output devices have buffers that can handle roughly a second's worth of output, it is well worthwhile to spend the few milliseconds required to flush the cache SRAMS in order to put the system into an extremely low-power sleep state over the several hundred milliseconds of playback.
Now suppose that this device is also recording audio -- perhaps the device is being used to monitor an area for noise pollution, and the user is also using the device to play music via earphones. The audio input process will be the inverse of the audio output process: the microphone data will fill a data buffer, which must be collected into DRAM, then encoded (perhaps again via MP3) and stored into flash. It would be easy to create an optimal application for audio input, but running this optimal audio input program concurrently with the optimal audio playback program would not necessarily result in a power-optimized combination. This lack of optimality is due to the fact that the input and output programs would each burn power separately powering down and up. In contrast, an optimal solution would align the input and output programs' timers so that a single power-down/power-up event would cover both programs' processing. This would trade off optimal processing of each (for example, by draining the input buffer before it was full) in order to attain global optimality (by sharing power-down/power-up overhead).
There are a number of ways to achieve this:
1. Making the kernel group timers that occur at roughly the same
time, as has been discussed on this list many times. This can work in many cases, but can be problematic in the audio example, due to the presence of hard deadlines.
2. Write the programs to be aware of each other, so that each
adjusts its behavior when the other is present. This seems to be current practice in the battery-powered embedded arena, but is quite complex, sensitive to both hardware configuration and software behavior, and requires that all combinations of programs be anticipated by the designer -- which can be a serious disadvantage given today's app stores.
3. Use new features such as range timers, so that each program
can indicate both its preference and the degree of flexibility that it can tolerate. This also works in some cases, but as far as I know, current proposals do not allow the kernel to take power-consumption penalties into account.
4. Provide "heartbeat" services that allow applications to
synchronize with each other. This seems most applicable for applications that run infrequently, such as email-checking and location-service applications.
5. Use of hardware facilities that allow DMA to be scheduled across
time. This would allow the CPU to be turned on only for decode/encode operations. I am under the impression that this sort of time-based DMA hardware does exist in the embedded space and that it is actually used for this purpose.
6. Your favorite solution here.
Whatever solution is chosen, the key point to keep in mind is that running power-optimized applications in combination does -not- result in optimal system behavior.
OTHER EXAMPLE APPLICATIONS
GPS application that silently displays position.
There is no point in this application consuming CPU cycles or in powering up the GPS hardware unless the display is active. Such an application could be handled by the Android suspend-blocker proposal. Of course, such an application could also periodically poll the display, shutting itself down if the display is inactive. In this case, it would also need to have some way to be reactivated when the display comes back on.
GPS application that alerts the user when a given location is reached.
This application should presumably run even when the display is powered down due to input timeout. The question of whether or not it should continue running when the device is powered off is an interesting one that would be likely to spark much spirited discussion. Regardless of the answer to this question, the GPS application would hopefully run very intermittently, adjusting the delay interval based on the device's velocity and distance from the location in question.
I don't know enough about GPS hardware to say under what circumstances the GPS hardware itself should be powered off. However, my experience indicates that it takes significant time for the GPS hardware to get a position fix after being powered on, so presumably this decision would also be based on device velocity and distance from the location in question.
Assuming that the application can run only intermittently, suspend blockers would work reasonably well for this use case. If the application needed to run continuously, battery life would be quite short regardless of the approach used.
MP3 playback.
This requires a PM-driving (and preferably a power-optimized) application. Because the CPU need only run intermittently, suspend blockers can handle this use case. Presumably switching the device off would halt playback.
Bouncing cows.
This can work with a power-oblivious application that is shut down whenever the display is powered off or the device is switched off, similar to the GPS application that silently displays position.
ACKNOWLEDGMENTS
Of course, just because I acknowledge their contributions does not necessarily mean that I think they agree with my assessment of the requirements behind suspend blockers. ;-)
Nevertheless, I am grateful for any and all feedback, whatever the form of that feedback might be. I am new to this area, and have much to learn.
Alan Stern
Anca Emanuel
Arjan van de Ven
Arve Hjønnevåg
Brian Swetland
David Brownell
David Lang
Florian Mickler
James Bottomley
Kevin Granade
Mark Brown
Matt Helsley
Matthew Garrett
Mikael Abrahamsson
Olivier Galibert
Paul Menage
Pavel Machek
Rafael J. Wysocki
Richard Woodruff
Ted Ts'o
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Neil BrownQuoted 42 lines · Neil Brown
Quoted 16 lines · On Mon, 16 Aug 2010 20:20:32 -0400 Ted Ts'o <[email protected]> wrote:
Quoted 8 lines · Jesse Barnes
Fortunately in this case the problem doesn't seem to be fatal. We've already established that the userland API portion of suspend blockers could be implemented in userspace with a bit more work, given that the kernel problems with suspend/resume and events are addressed. Hopefully Google is already developing a prototype userspace implementation to make sure it's workable; being able to build stock upstream kernels for my Droid and its Android userspace sure would be nice.
You know, you don't have to wait for the Android engineers to do this work. You (or others who want to be able to use stock upstream kernel with Android devices) could just as easily try to do the "bit more work" yourselves --- that is, do the open souce thing and scratch one's own itch.
Quoted 8 lines
After all, Rafael is saying he's refusing to accept patches (or implement) in-kernel oppunsitic suspend for upstream unless it's proven to him that a userspace implementation isn't sufficient. It might be just as fair for the Android userspace upstream to refuse to accept (or engineer) userspace changes unless it is proven that the userspace version of opporunistic suspend is just as good as the in-kernel version which is successfully been deployed in millions and millions of shipping units today...
Reminds me of the one of the first questions asked in a murder investigation (or so they say on TV)
Cui Bono??Who benefits? Does Android benefit more by being able to use a standard kernel, or does Linux benefit more by being able to run Android without modification.
Currently it seems that only the lawyers^Wpeople who like arguing on lkml are gaining anything.
Maybe this is the first real fork of Linux - google might be rich enough to persist with it.
Quoted 8 lines
Quoted 5 lines
Speaking personally, it's not clear to me how waking up a userspace suspend daemon and waiting for it to get scheduled will result in better power savings than simply handling it in the kernel, but as soon as someone is willing to do the work, we can find out for sure who is right.
I'm surprised at this comment Ted!
Power saving is not the single supreme goal, yet you make it sound like it is.
My initial impression was also that power savings was Android's single supreme goal, but a careful reading of this thread and the ones preceding it taught me otherwise. Please see below for my current understanding of what they are trying to accomplish. As always, feedback is welcome!
Thanx, Paul
------------------------------------------------------------------------
Subject: Attempted summary of suspend-blockers LKML thread, epilogue 1
Final report from this particular angel-free zone for the time being...
This is the third^Wfourth and final version of my Android requirements list (last version available at http://lkml.org/lkml/2010/8/6/581).
Again, this email is an attempt to present the Android guys' requirements, based on my interpretation of LKML discussions. Thank you to everyone who took part.
Please note that I am not proposing a solution that meets these requirements, nor am I attempting to judge the various proposed solutions. In fact, I am not trying to judge whether the requirements are optimal, or even whether or not they make sense at all. My only goal at the moment is to improve our collective understanding of what the Android folks' requirements are. That said, I do discuss example mechanisms where needed to clarify the meaning of the requirements. This should not be interpreted as a preference for any given example mechanism.
Thanx, Paul
------------------------------------------------------------------------
CONTENTS
o DEFINITIONS
o CATEGORIES OF APPLICATION BEHAVIOR
o REQUIREMENTS
o NICE-TO-HAVES
o APPARENT NON-REQUIREMENTS
o SUGGESTED USAGE
o POWER-OPTIMIZED APPLICATIONS
o OTHER EXAMPLE APPLICATIONS
o ACKNOWLEDGMENTS
DEFINITIONS
These have been updated based on LKML and linux-pm discussions. The names are probably still sub-optimal, but incremental progress is nevertheless a very good thing.
o "Ill-behaved application" AKA "untrusted application" AKA
"crappy application". The Android guys seem to be thinking in terms of applications that are well-designed and well-implemented in general, but which do not take power consumption or battery life into account. Examples include applications designed for externally powered PCs. Many other people seemed to instead be thinking in terms of an ill-conceived or useless application, perhaps exemplified by "bouncing cows".
This document uses "power-oblivious applications" to mean applications that are well-designed and well-implemented in in general, but which do not take power consumption or battery life into account.
o "PM-driving application" are applications that are permitted
to acquire suspend blockers on Android. Verion 8 of the suspend-blocker patch seems to use group permissions to determine
which processes are classified as power aware. Android uses a
user-level daemon to classify app-store apps as PM-driving or not. More generally, PM-driving applications are those that have permission to exert some control over the system's sleep state.
Note that an application might be power-oblivious on one Android device and PM-driving on another, depending on whether the user allows that application to acquire suspend blockers. The classification might even change over time. For example, a user might give an application PM-driving status initially, but change his or her mind after some experience with that application.
o Oddly enough, "power-optimized applications" were not discussed.
See "POWER-OPTIMIZED APPLICATIONS" below for a brief introduction. The short version is that power-optimized applications are those PM-driving applications that have been aggressively tuned to reduce power consumption.
o Individual devices in an embedded system can enter "device
low-power states" when not in use.
o The system as a whole can enter a "system sleep state" when
the system as a whole is not in use. Suspend blockers are about system sleep states rather than device low-power states.
o There was much discussion of "idle" (AKA "deep idle") and
"suspend" (as in current Linux-kernel suspend operations). The following characteristics distinguish "idle" from "suspend":
1. Idle states are entered by a given CPU only there are no
runnable tasks for that CPU. In contrast, opportunistic suspend can halt the entire system even when there are tasks that are ready, willing, and able to run. (But please note that this might not apply to real-time tasks.)
Freezing of subsets of applications is somewhat related to the idle/suspend discussion, but is covered in a later section of this document.
2. There can be a set of input events that do not bring
the system out of suspend, but which would bring the system out of idle. Exactly which events are in this set depends both on hardware capabilities and on the platform/application policy. For example, on one of the Android-based smartphones, touchscreen input is ignored when the system is suspended, but is handled when idle.
3. The system comes out of idle when a timer expires. In
contrast, timers might or might not bring the system out of suspend, depending on both hardware capabilities and platform/application policy.
4. Suspend generally forces devices to go into their
low-power states immediately. In contrast, idle generally leaves unused devices at full power, relying on timers to shut down these devices. Idle thus often has shorter average wakeup latencies, but on systems where suspend can use deeper sleep states than can idle, idle might have worse energy efficiency.
5. Suspend shuts down timekeeping, but deep idle currently
does not. Timekeeping requires periodic interrupts to correctly compute time. If these interrupts are spaced too far apart (for example, by minutes or hours), timekeeping can become inaccurate. The degree of inaccuracy and the permissible spacing intervals depends on the time-source hardware and the kernel configuration. (It might be possible to reduce the timekeeping system's dependency on periodic interrupts, but this is currently speculation rather than reality.)
6. Suspend usually has longer wakeup latency than does
idle.
CATEGORIES OF APPLICATION BEHAVIOR
There are a number of categories of application behavior with respect to power management and energy efficiency. These can be classified via the following questions: (1) What degree of control is an application permitted over its own behavior? (2) What degree of control is an application permitted over the power state of individual devices within the system? (3) What degree of control is an application permitted over the system sleep state? (4) To what degree has the application been tuned to reduce its power consumption, either in isolation or in conjunction with other applications that might be running concurrently?
These categories are discussed below.
o What degree of control is an application permitted over its
own behavior?
The Linux kernel already has many controls over application behavior:
o the CAP_ capabilities from include/linux/capability.h.
o Processes can be assigned to multiple groups, allowing
them privileged access to portions of the filesystem.
o The chroot() system call limits a process's access to the
specified subtree of the filesystem.
o The ulimit facility can limit CPU consumption, number
of processes, memory, etc. on a per-user basis. The rlimit facility has similar effects on a per-process basis.
o The mlockall() system call provides privileged access
to memory, avoiding page-fault overhead.
But more relevant to this discussion, real-time processes are permitted a much higher degree of control over the timing of their execution than are non-real-time processes. However, suspending the system destroys any pretense of offering real-time guarantees, which might explain much of the annoyance towards suspend blockers from the real-time and scheduler folks. For but one example, Peter Zijlstra suggested that he would merge a patch that acquired a suspend blocker any time that the runqueues were non-empty. My first reaction was amusement at this vintage Peter Zijlstra response, and my second reaction was that it was a futile gesture, as the Android guys would simply back out any such change.
After more thought, however, a variation of Peter's approach might well be the key to resolving this tension between real-time response on the one hand and Android's desire to conserve power at any cost on the other. Given that suspending destroys real-time response, why not acquire a suspend blocker any time there is a user-created real-time task in the system, whether runnable or not? Of course, a simpler approach would be to make Android's OPPORTUNISTIC_SUSPEND depend on !PREEMPT_RT.
o What degree of control is an application permitted over the power
state of individual devices within the system?
Is the application in question permitted to power down the CPU or peripheral devices? As more of the power control is automated based on usage, it is possible that this question will become less relevant. The longer the latency and the greater the energy consumption of a power-up/power-down sequence for a given device, the less suitable that device is for automatic power-up/power-down decisions. Cache SRAMs and main-memory DRAM tend to be less suitable for automation for this reason.
o What degree of control is an application permitted over the
system sleep state?
Is the application permitted to suspend the device? Or in the case of Android, is the application permitted to acquire a suspend blocker, which prevents the device from being suspended?
o To what degree has the application been tuned to reduce its
power consumption, either in isolation or in conjunction with other applications that might be running concurrently?
See the "POWER-OPTIMIZED APPLICATIONS" section below for more detail on the lengths that embedded developers go to in order to conserve power -- or, more accurately, to extend battery life.
REQUIREMENTS
o Reduce the system's power consumption in order to (1) extend
battery life and (2) preserve state until external power can be obtained.
o It is necessary to be able to use power-oblivious applications.
Many of these applications were designed for use in PC platforms where power consumption has historically not been of great concern, due to either (1) the availability of external power or
(2) relatively undemanding laptop battery-lifetime expectations. The system must be capable of running these power-oblivious applications without requiring that these applications be modified, and must be capable of reasonable power efficiency even when power-oblivious applications are in use.
In other words, it must be possible to automate the incorporation of a power-oblivious application into the Android environment, but without significantly degrading battery lifetime.
o If the display is powered off, there is no need to run any
application whose only effect is to update the display.
Although one could simply block such an application when it next tries to access the display, it it is highly desirable that the application also be prevented from consuming power computing something that will not be displayed. Furthermore, whatever mechanism is used must operate on power-oblivious applications that do not use blocking system calls.
There might well be similar requirements for other output-only devices, as noted by Alan Stern.
o In order to avoid overrunning hardware and/or kernel buffers,
and to minimize response latencies, designated input events must be delivered to the corresponding application in a timely fashion. The application might or might not be required to actually process the events in a timely fashion, depending on the specific application.
In particular, if user input that would prevent the system from entering a sleep state is received while the system is transitioning into a sleep state, the system must transition back out of the sleep state so that it can hand the user input off to the corresponding application.
Other input events do not force a wakeup, and such input events -can- be lost due to buffer overflow in hardware or the kernel. The response latency to such input events can of course be unbounded.
o Because Android acquires a suspend blocker as soon as an
input event is noticed and holds it until some application reads that input event, there must be a way to cause the suspend blocker to timeout. If there was no such timeout facility, a power-oblivious application could block suspend by opening an input device and then refusing to ever read from it. (Yes, this can be considered to be a energy-efficiency bug in the power-oblivious application. Please see the statistics requirement below.)
o The API must provide a way for PM-driving applications that
receive events to keep themselves running until they have been able to process those events.
o It must be possible to apply power-oblivious coding techniques
to those code sequences in PM-driving applications where suspend blockers are not held.
o Statistics of the power-control actions taken by PM-driving
applications must be provided. Statistics are aggregated by name,
which is passed by the application in through the suspend-blocker interface. The following specific statistics are collected in the kernel, in roughly decreasing order of importance:
o total_time, which accumulates the total amount of time
that the corresponding suspend blocker has been held.
o active_since, which tracks how long a suspend blocker has
been held since it was last acquired, or (presumably) zero if it is not currently held.
o count, which is the number of times that the suspend
blocker has been acquired. This is useful in combination with total_time, as it allows you to calculate the average hold time for the suspend blocker.
o expire_count, which is the number of times that the
suspend blocker has timed out. This indicates that some application has an input device open, but is not reading from it, which is a bug, as noted earlier.
o max_time, which is the longest hold time for the suspend
blocker. This allows finding cases where suspend blockers are held for too long, but are eventually released. (In contrast, active_since is more useful in the held-forever case.)
o sleep_time, which is the total time that the suspend
blocker was held while the display was powered off. (This might have interesting implications should E-ink displays every become capable of full-motion color video, but it is easy to imagine that the definition of "powered off" would then include only those times during which the display wasn't actively being updated.)
o wake_count, which is the number of times that the
suspend blocker was the first to be acquired in the resume path. This is less than useful on some Android platforms; Arve is dissatisfied with it on Nexus One.
Presumably, the userspace code collects similar statistics on application suspend-blocker activity, but that is out of the scope of this document, which focuses instead on kernel requirements. Given that the overhead of maintaining these statistics is quite low, it seems that it would be worthwhile to have them enabled in production systems, for example, in order to flag power-buggy applications that the user has naively downloaded.
o Some PM-driving applications use power-oblivious infrastructure
code. This means that a PM-driving application must have some way, whether explicit or implicit, to ensure that any power-oblivious infrastructure code is permitted to run when a PM-driving application needs it to run.
o If no PM-driving or power-optimized application are indicating
a need for the system to remain operating, the system is permitted (even encouraged!) to suspend all execution, regardless of the
state of power-oblivious applications. (This requirement did
appear to be somewhat controversial, both in terms of what is meant by "runnable" and in terms of what constitutes "execution".)
In Android, this is implemented by suspending even while PM-driving or power-optimized applications are active, -unless- a suspend blocker is held.
o Transition to system sleep state must be power-efficient.
In particular, methods based on repeated attempts to suspend are considered to be too inefficient to be useful.
o Transition to system sleep state must occur very soon after
all PM-driving and power-optimized applications have indicated that they have no need for the system to remain operating. Quick transition is expecially important in cases where the wakeup was momentary, for example, when processing sporadic network input or processing widely spaced batches of audio output. For an example of the latter, MP3 playback allows 1-4 minute spacing between bursts of CPU activity).
o Individual peripherals and CPUs must still use standard
power-conservation measures, for example, transitioning CPUs into low-power states on idle and powering down peripheral devices and hardware accelerators that have not been recently used.
o The API that controls the system sleep state must be accessible
both from Android's Java replacement, from userland C code, and from kernel C code (both process level and irq code, but not NMI handlers).
o The API that controls the system sleep state must operate
correctly on SMP systems of modest size. (My guess is that "modest" means up to four CPUs, maybe up to eight CPUs.)
o Any QoS-based solution must take display and user-input
state into account. In other words, the QoS must be expressed as a function of the display and the user-input states.
o Transitioning to extremely low-power sleep states requires saving
and restoring DRAM and/or cache SRAM state, which in itself consumes significant energy. The power savings must therefore be balanced against the energy consumed in the state transitions.
o The current Android userspace API must be supported in order
to support existing device software. According to Brian Swetland:
For Java/Dalvik apps, the wakelock API is pertty high level -- it talks to a service via RPC (Binder) that actually interacts with the kernel. Changing the basic kernel<->userspace interface (within reason) is not unthinkable. For example, Arve's suspend_blocker patch provides a device interface rather than the proc interface the older wakelock patches use. We'd have to make some userspace changes to support that but they're pretty low level and minor.
In the current model, only a few processes need to specifically interact with the kernel (the power management service in the system_server, possibly the media_server and the radio interface glue). A model where every process needs to have a bunch of instrumentation is not very desirable from our point of view. We definitely do need reasonable statistics in order to enable debugging and to enable reporting to endusers (through the Battery Usage UI) what's keeping the device awake.
o Any mechanism that freezes some subset of the applications must
ensure that none of the frozen applications hold any user-level resources, such as pthread mutexes. The reason for this is that freezing an application that holds a shared pthread mutex will result in an application-level hang should some unfrozen process attempt to acquire that same pthread mutex. Note that although the current cgroup freezer ensures that frozen applications do not hold any kernel-level mutexes (at least assuming these mutexes are not wrongly held when returning to user-level execution), it currently does nothing to prevent freezing processes holding pthread mutexes. (There are some proposals to address this issue.)
NICE-TO-HAVES
o It would be nice to be able to identify power-oblivious
applications that never were depended on by PM-driving applications. This particular class of power-oblivious applications could be shut down when the screen blanks even if some PM-driving application was preventing the system from powering down.
There are two obstacles to meeting this requirement:
1. There must be a reliable way to identify such
applications. This should be doable, for example, the application might be tagged by its developer.
2. There must be a reliable way to freeze them such
that no frozen application holds a resource that might be contended by a non-frozen application.
Although the cgroup freezer does ensure that frozen tasks hold no kernel-level resources, it currently does nothing to ensure that no user-level resources are held. There are some alternative proposals, which might or might not be more successful:
a. Unfreeze this group periodically to ensure
that any such resource is eventually released, while keeping power consumption down to a dull roar.
b. Perform the freeze at application level, where
it is possible to determine whether an application-level resource is held.
o Any initialization of the API that controls the system power
state should be unconditional, so as to be free from failure. Such unconditional initialization reduces the intrusiveness of the Android patchset.
APPARENT NON-REQUIREMENTS
o Transitioning to system sleep states need not be highly scalable,
as evidenced by the global locks. (If you believe that high scalability will in fact be required, please provide a use case. But please understand that I do know something about scalability trends, but also about uses for transistors beyond more cores.)
That said, it should not be hard to provide a highly scalable implementation of suspend blockers, especially if large systems are allowed to take their time suspending themselves.
o Conserving power in the WiFi and cellular telephony networks.
At the moment, the focus is on increased battery life in the handheld device, perhaps even at the expense of additional power consumed by the externally powered WiFi and cell-telephony equipment.
o Synchronizing wakeups of unrelated applications. This is of
course an important requirement for power savings overall, but seems to be left to other mechanisms (e.g., timer aggregation) by the Android folks. Although one could implement suspend blockers so as to aggregate timers after a sufficiently long suspension, there are problems with this approach:
o There would be a "thundering herd" problem just after
resume completed as almost every timer in the system would expire simultaneously.
o The applications would not necessarily stay aggregated
without some other mechanism helping out.
SUGGESTED USAGE
These are constraints that the developer is expected to abide by, "for best results" and all that.
o When a PM-driving application is preventing the system from
shutting down, and is also waiting on a power-oblivious application, the PM-driving application should set a timeout to handle the possibility that the power-oblivious application might halt or otherwise fail.
POWER-OPTIMIZED APPLICATIONS
A typical power-optimized application manually controls the power state of many separately controlled hardware subsystems to minimize power consumption. Such optimization normally requires an understanding of the hardware and of the full system's workload: strangely enough, concurrently running two separately power-optimized applications often does -not- result in a power-optimized system. Such optimization also requires knowledge of what the application will be doing in the future, so that needed hardware subsystems can be proactively powered up just when the application will need them. This is especially important when powering down cache SRAMS or banks of main memory, because such components take significant time (and consume significant energy) when preparing them to be powered off and when restoring their state after powering them on.
Consider an MP3 player as an example. Such a player will periodically read MP3-encoded data from flash memory, decode it (possibly using hardware acceleration), and place the resulting audio data into main memory. Different systems have different ways of getting the data from main memory to the audio output device, but let's assume that the audio output device consumes data at a predictable rate such that the software can use timers to schedule refilling of the device's output buffer. The timer duration will of course need to allow for the time required to power up the CPU and L2 cache. The timer can be allowed to happen too soon, albeit with a battery-lifetime penalty, but cannot be permitted to happen too late, as this will cause "skips" in the playback.
If MP3 playback is the only application running in the system, things are quite easy. We calculate when the audio output device will empty its buffer, allow a few milliseconds to power up the needed hardware, and set a timer accordingly. Because modern audio output devices have buffers that can handle roughly a second's worth of output, it is well worthwhile to spend the few milliseconds required to flush the cache SRAMS in order to put the system into an extremely low-power sleep state over the several hundred milliseconds of playback.
Now suppose that this device is also recording audio -- perhaps the device is being used to monitor an area for noise pollution, and the user is also using the device to play music via earphones. The audio input process will be the inverse of the audio output process: the microphone data will fill a data buffer, which must be collected into DRAM, then encoded (perhaps again via MP3) and stored into flash. It would be easy to create an optimal application for audio input, but running this optimal audio input program concurrently with the optimal audio playback program would not necessarily result in a power-optimized combination. This lack of optimality is due to the fact that the input and output programs would each burn power separately powering down and up. In contrast, an optimal solution would align the input and output programs' timers so that a single power-down/power-up event would cover both programs' processing. This would trade off optimal processing of each (for example, by draining the input buffer before it was full) in order to attain global optimality (by sharing power-down/power-up overhead).
There are a number of ways to achieve this:
1. Making the kernel group timers that occur at roughly the same
time, as has been discussed on this list many times. This can work in many cases, but can be problematic in the audio example, due to the presence of hard deadlines.
2. Write the programs to be aware of each other, so that each
adjusts its behavior when the other is present. This seems to be current practice in the battery-powered embedded arena, but is quite complex, sensitive to both hardware configuration and software behavior, and requires that all combinations of programs be anticipated by the designer -- which can be a serious disadvantage given today's app stores.
3. Use new features such as range timers, so that each program
can indicate both its preference and the degree of flexibility that it can tolerate. This also works in some cases, but as far as I know, current proposals do not allow the kernel to take power-consumption penalties into account.
4. Provide "heartbeat" services that allow applications to
synchronize with each other. This seems most applicable for applications that run infrequently, such as email-checking and location-service applications.
5. Use of hardware facilities that allow DMA to be scheduled across
time. This would allow the CPU to be turned on only for decode/encode operations. I am under the impression that this sort of time-based DMA hardware does exist in the embedded space and that it is actually used for this purpose.
6. Your favorite solution here.
Whatever solution is chosen, the key point to keep in mind is that running power-optimized applications in combination does -not- result in optimal system behavior.
OTHER EXAMPLE APPLICATIONS
GPS application that silently displays position.
There is no point in this application consuming CPU cycles or in powering up the GPS hardware unless the display is active. Such an application could be handled by the Android suspend-blocker proposal. Of course, such an application could also periodically poll the display, shutting itself down if the display is inactive. In this case, it would also need to have some way to be reactivated when the display comes back on.
GPS application that alerts the user when a given location is reached.
This application should presumably run even when the display is powered down due to input timeout. The question of whether or not it should continue running when the device is powered off is an interesting one that would be likely to spark much spirited discussion. Regardless of the answer to this question, the GPS application would hopefully run very intermittently, adjusting the delay interval based on the device's velocity and distance from the location in question.
I don't know enough about GPS hardware to say under what circumstances the GPS hardware itself should be powered off. However, my experience indicates that it takes significant time for the GPS hardware to get a position fix after being powered on, so presumably this decision would also be based on device velocity and distance from the location in question.
Assuming that the application can run only intermittently, suspend blockers would work reasonably well for this use case. If the application needed to run continuously, battery life would be quite short regardless of the approach used.
MP3 playback.
This requires a PM-driving (and preferably a power-optimized) application. Because the CPU need only run intermittently, suspend blockers can handle this use case. Presumably switching the device off would halt playback.
Bouncing cows.
This can work with a power-oblivious application that is shut down whenever the display is powered off or the device is switched off, similar to the GPS application that silently displays position.
ACKNOWLEDGMENTS
Of course, just because I acknowledge their contributions does not necessarily mean that I think they agree with my assessment of the requirements behind suspend blockers. ;-)
Nevertheless, I am grateful for any and all feedback, whatever the form of that feedback might be. I am new to this area, and have much to learn.
Alan Stern
Anca Emanuel
Arjan van de Ven
Arve Hjønnevåg
Brian Swetland
David Brownell
David Lang
Florian Mickler
James Bottomley
Kevin Granade
Mark Brown
Matt Helsley
Matthew Garrett
Mikael Abrahamsson
Olivier Galibert
Paul Menage
Pavel Machek
Rafael J. Wysocki
Richard Woodruff
Ted Ts'o
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Jesse BarnesHi!
Quoted 25 lines
Quoted 25 lines
Quoted 11 lines
Quoted 8 lines
The question is why are we adding a user-space API that:
1) no user-space beside Android has expresses interest in implementing
2) is dubious whether the benefits are worth the pain for non-Android
user-space
3) will become less and less attractive as dynamic PM gets closer to
the sweet-spot, and then surpass it
4) Android can keep in a separate tree until it's clear in the linux
community that it's useful (if it ever happens)So, Felipe,
Quoted 8 lines
Do you believe you speak for all of LKML?
Are you willing to tell ZDNet and the Slashdot fanboys that it's OK for Suspend blockers to live in a separate tree, and it's not a case of OMG! Google is forking the kernel?
If you could speak out a passionately on those forums as you have here, that would be great.
Ted, what is going on here? Are you suggesting people disagreeing with Google patches suddenly have to do advocacy for Google?
And yes, for the record Felipe speaks for me pretty well.
Quoted 7 lines
Quoted 4 lines
Normal path of merging stuff to the kernel is
"Google develops it, then modifies it to address the review comments, then it is merged, then it is deployed".
Pavel, you should know better than this. You've been working on Linux long enough to know that development doesn't happen this way.
Well, I know that world is not always ideal, but it still surprised me how far from "ideal" Google got....
Quoted 4 lines
Although it would have been nice for Google to work more directly with upstream on their suspend blockers for Android, I don't think they could have made their product development cycle a slave to the politics of upstream development.
"Slave of upstream politics" would be going all the way; seeing the patches before there were million devices out there would also help a lot...
Quoted 4 lines
Fortunately in this case the problem doesn't seem to be fatal. We've already established that the userland API portion of suspend blockers could be implemented in userspace with a bit more work, given that the kernel problems with suspend/resume and events are addressed.
You are an optimist. Yes, I also hope it will work out fine, but...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Jesse BarnesHi!
Quoted 25 lines
Quoted 25 lines
Quoted 11 lines
Quoted 8 lines
The question is why are we adding a user-space API that:
1) no user-space beside Android has expresses interest in implementing
2) is dubious whether the benefits are worth the pain for non-Android
user-space
3) will become less and less attractive as dynamic PM gets closer to
the sweet-spot, and then surpass it
4) Android can keep in a separate tree until it's clear in the linux
community that it's useful (if it ever happens)So, Felipe,
Quoted 8 lines
Do you believe you speak for all of LKML?
Are you willing to tell ZDNet and the Slashdot fanboys that it's OK for Suspend blockers to live in a separate tree, and it's not a case of OMG! Google is forking the kernel?
If you could speak out a passionately on those forums as you have here, that would be great.
Ted, what is going on here? Are you suggesting people disagreeing with Google patches suddenly have to do advocacy for Google?
And yes, for the record Felipe speaks for me pretty well.
Quoted 7 lines
Quoted 4 lines
Normal path of merging stuff to the kernel is
"Google develops it, then modifies it to address the review comments, then it is merged, then it is deployed".
Pavel, you should know better than this. You've been working on Linux long enough to know that development doesn't happen this way.
Well, I know that world is not always ideal, but it still surprised me how far from "ideal" Google got....
Quoted 4 lines
Although it would have been nice for Google to work more directly with upstream on their suspend blockers for Android, I don't think they could have made their product development cycle a slave to the politics of upstream development.
"Slave of upstream politics" would be going all the way; seeing the patches before there were million devices out there would also help a lot...
Quoted 4 lines
Fortunately in this case the problem doesn't seem to be fatal. We've already established that the userland API portion of suspend blockers could be implemented in userspace with a bit more work, given that the kernel problems with suspend/resume and events are addressed.
You are an optimist. Yes, I also hope it will work out fine, but...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasQuoted 4 lines · Felipe Contreras
So far, nobody has refuted these:
1) opportunistic suspend needs a good behaved user-space to work properly
2) if suspend blockers are enabled in a system, *all* user-space must
implement them to work correctly
For this note that there's a fairly strong expectation that even in a phone type environment a sane userspace implementation will involve a very large portion of userspace just totally ignoring suspend blockers. This means that while it is true that userspace as a whole must have support for suspend blockers the changes required are substantially less invasive than you appear to expecting.
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasQuoted 4 lines · Felipe Contreras
So far, nobody has refuted these:
1) opportunistic suspend needs a good behaved user-space to work properly
2) if suspend blockers are enabled in a system, *all* user-space must
implement them to work correctly
For this note that there's a fairly strong expectation that even in a phone type environment a sane userspace implementation will involve a very large portion of userspace just totally ignoring suspend blockers. This means that while it is true that userspace as a whole must have support for suspend blockers the changes required are substantially less invasive than you appear to expecting.
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 7 lines · Mark Brown
Quoted 4 lines · Felipe Contreras
So far, nobody has refuted these:
1) opportunistic suspend needs a good behaved user-space to work properly
2) if suspend blockers are enabled in a system, *all* user-space must implement them to work correctly
Quoted 6 lines
For this note that there's a fairly strong expectation that even in a phone type environment a sane userspace implementation will involve a very large portion of userspace just totally ignoring suspend blockers. This means that while it is true that userspace as a whole must have support for suspend blockers the changes required are substantially less invasive than you appear to expecting.
Correct, but still a considerable amount of changes would need to be done, which _nobody_ has expressed any intention to do.
Besides, IMO a good mobile platform would share as much as possible with desktop software. Say, the improvements Nokia has endorsed on the Telepathy IM framework can only help the people already using it on the desktop.
However, personally, if I ever have to do './configure --enable-suspend-blockers', I would think that something that just doesn't belong has creped by to user-space. I don't see why there should something particularly different between mobile phones and laptops, and I think this has been already expressed over, and over.
Signature · 5 lines
Felipe Contreras _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Mark BrownQuoted 7 lines · Mark Brown
Quoted 4 lines · Felipe Contreras
So far, nobody has refuted these:
1) opportunistic suspend needs a good behaved user-space to work properly
2) if suspend blockers are enabled in a system, *all* user-space must implement them to work correctly
Quoted 6 lines
For this note that there's a fairly strong expectation that even in a phone type environment a sane userspace implementation will involve a very large portion of userspace just totally ignoring suspend blockers. This means that while it is true that userspace as a whole must have support for suspend blockers the changes required are substantially less invasive than you appear to expecting.
Correct, but still a considerable amount of changes would need to be done, which _nobody_ has expressed any intention to do.
Besides, IMO a good mobile platform would share as much as possible with desktop software. Say, the improvements Nokia has endorsed on the Telepathy IM framework can only help the people already using it on the desktop.
However, personally, if I ever have to do './configure --enable-suspend-blockers', I would think that something that just doesn't belong has creped by to user-space. I don't see why there should something particularly different between mobile phones and laptops, and I think this has been already expressed over, and over.
Signature · 1 line
Felipe Contreras
Re: Attempted summary of suspend-blockers LKML thread, take three
Quoted 9 lines · Felipe Contreras
Correct, but still a considerable amount of changes would need to be done, which _nobody_ has expressed any intention to do.
Besides, IMO a good mobile platform would share as much as possible with desktop software. Say, the improvements Nokia has endorsed on the Telepathy IM framework can only help the people already using it on the desktop.
Quoted 5 lines
However, personally, if I ever have to do './configure --enable-suspend-blockers', I would think that something that just doesn't belong has creped by to user-space. I don't see why there should something particularly different between mobile phones and laptops, and I think this has been already expressed over, and over.
So, because you feel that phones should be little laptops you oppose providing (optional!) support for environments that take a different view to that?
I'll echo Ted's question -- is this the opinion of the kernel community at large? If so, there's not much point in continuing to have discussions around suspend blockers.
I think that we're still a ways away from a world where we can treat mobile devices the same as laptops and get reasonable user experiences. I think it's unfortunate if the attitude here is "wait and someday it won't matter", especially because I'm skeptical that we're likely to hit that "someday" any time soon.
Brian
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasQuoted 9 lines · Felipe Contreras
Correct, but still a considerable amount of changes would need to be done, which _nobody_ has expressed any intention to do.
Besides, IMO a good mobile platform would share as much as possible with desktop software. Say, the improvements Nokia has endorsed on the Telepathy IM framework can only help the people already using it on the desktop.
Quoted 5 lines
However, personally, if I ever have to do './configure --enable-suspend-blockers', I would think that something that just doesn't belong has creped by to user-space. I don't see why there should something particularly different between mobile phones and laptops, and I think this has been already expressed over, and over.
So, because you feel that phones should be little laptops you oppose providing (optional!) support for environments that take a different view to that?
I'll echo Ted's question -- is this the opinion of the kernel community at large? If so, there's not much point in continuing to have discussions around suspend blockers.
I think that we're still a ways away from a world where we can treat mobile devices the same as laptops and get reasonable user experiences. I think it's unfortunate if the attitude here is "wait and someday it won't matter", especially because I'm skeptical that we're likely to hit that "someday" any time soon.
Brian
Re: Attempted summary of suspend-blockers LKML thread, take three
Hi Brian,
Quoted 17 lines · Brian Swetland
Quoted 9 lines · Felipe Contreras
Correct, but still a considerable amount of changes would need to be done, which _nobody_ has expressed any intention to do.
Besides, IMO a good mobile platform would share as much as possible with desktop software. Say, the improvements Nokia has endorsed on the Telepathy IM framework can only help the people already using it on the desktop.
Quoted 5 lines
However, personally, if I ever have to do './configure --enable-suspend-blockers', I would think that something that just doesn't belong has creped by to user-space. I don't see why there should something particularly different between mobile phones and laptops, and I think this has been already expressed over, and over.
Quoted 3 lines
So, because you feel that phones should be little laptops you oppose providing (optional!) support for environments that take a different view to that?
Look. I'll share with you a little experience.
For years I've been working on a piece of software to access Microsoft's WLM IM service on linux. I have high quality standards for my software, so I optimized algorithms and bandwith, I used valgrind to find memory leaks, OProfile for performance bottlenecks, and so on. All this on a laptop.
When I ported this code to the N900 it just worked, not more-or-less; perfectly. I could stay online the whole day without the battery running out, and I didn't have to make *any* change.
Then at some point people started complaining about battery usage, but lo and behold, on the desktop people started reporting too much bandwith/cpu usage as well. I tried on my laptop, and was able to reproduce, and fix (bug related to daylight savings time).
For years people have been trying to unify certain KDE/GNOME code, and freedesktop.org was born. Now the same technologies are used by Nokia on Maemo, and now MeeGo (DBus, Telepathy, GStreamer, tracker, etc.), so the optimizations done for mobile benefit everyone; desktop power usage also improves.
So, yeah, I think the fact that my laptop and phone share the same software is great, and that improvements in one benefit the other.
Quoted 3 lines
I think that we're still a ways away from a world where we can treat mobile devices the same as laptops and get reasonable user experiences.
Why do you keep ignoring the N900? It has a lot of components that come directly from the linux ecosystem and people are having more than reasonable experiences (some are ecstatic).
Quoted 3 lines
I think it's unfortunate if the attitude here is "wait and someday it won't matter", especially because I'm skeptical that we're likely to hit that "someday" any time soon.
Nobody is waiting for anything. There's hard work all over the place to improve power usage.
If you think suspend blockers are useful for you, great, use them. I just don't see why they should be merged if nobody is going to use them but you. But maybe you are right, and maybe dynamic PM alone never reaches the same levers of performance, then people would ask for it to be merged, and it will. No biggie.
In the meantime, it would be wise to remember that this is not Nokia/Intel vs Google. Nokia has invested a great deal in dynamic PM, and those changes have benefited Android products directly (I even remember somebody from Google directly thanking Nokia for that), and that will continue. So we are on the same team.
And finally, if they don't get merged, I hope you don't see that as a loss. At the very least I think you got a lot of review comments from the most qualified experts in the world _free of charge_, and as a result the code should be more robust.
Cheers.
Signature · 1 line
Felipe Contreras
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Brian SwetlandHi Brian,
Quoted 17 lines · Brian Swetland
Quoted 9 lines · Felipe Contreras
Correct, but still a considerable amount of changes would need to be done, which _nobody_ has expressed any intention to do.
Besides, IMO a good mobile platform would share as much as possible with desktop software. Say, the improvements Nokia has endorsed on the Telepathy IM framework can only help the people already using it on the desktop.
Quoted 5 lines
However, personally, if I ever have to do './configure --enable-suspend-blockers', I would think that something that just doesn't belong has creped by to user-space. I don't see why there should something particularly different between mobile phones and laptops, and I think this has been already expressed over, and over.
Quoted 3 lines
So, because you feel that phones should be little laptops you oppose providing (optional!) support for environments that take a different view to that?
Look. I'll share with you a little experience.
For years I've been working on a piece of software to access Microsoft's WLM IM service on linux. I have high quality standards for my software, so I optimized algorithms and bandwith, I used valgrind to find memory leaks, OProfile for performance bottlenecks, and so on. All this on a laptop.
When I ported this code to the N900 it just worked, not more-or-less; perfectly. I could stay online the whole day without the battery running out, and I didn't have to make *any* change.
Then at some point people started complaining about battery usage, but lo and behold, on the desktop people started reporting too much bandwith/cpu usage as well. I tried on my laptop, and was able to reproduce, and fix (bug related to daylight savings time).
For years people have been trying to unify certain KDE/GNOME code, and freedesktop.org was born. Now the same technologies are used by Nokia on Maemo, and now MeeGo (DBus, Telepathy, GStreamer, tracker, etc.), so the optimizations done for mobile benefit everyone; desktop power usage also improves.
So, yeah, I think the fact that my laptop and phone share the same software is great, and that improvements in one benefit the other.
Quoted 3 lines
I think that we're still a ways away from a world where we can treat mobile devices the same as laptops and get reasonable user experiences.
Why do you keep ignoring the N900? It has a lot of components that come directly from the linux ecosystem and people are having more than reasonable experiences (some are ecstatic).
Quoted 3 lines
I think it's unfortunate if the attitude here is "wait and someday it won't matter", especially because I'm skeptical that we're likely to hit that "someday" any time soon.
Nobody is waiting for anything. There's hard work all over the place to improve power usage.
If you think suspend blockers are useful for you, great, use them. I just don't see why they should be merged if nobody is going to use them but you. But maybe you are right, and maybe dynamic PM alone never reaches the same levers of performance, then people would ask for it to be merged, and it will. No biggie.
In the meantime, it would be wise to remember that this is not Nokia/Intel vs Google. Nokia has invested a great deal in dynamic PM, and those changes have benefited Android products directly (I even remember somebody from Google directly thanking Nokia for that), and that will continue. So we are on the same team.
And finally, if they don't get merged, I hope you don't see that as a loss. At the very least I think you got a lot of review comments from the most qualified experts in the world _free of charge_, and as a result the code should be more robust.
Cheers.
Signature · 1 line
Felipe Contreras
Re: Attempted summary of suspend-blockers LKML thread, take three
Felipe,
Quoted 3 lines
If you think suspend blockers are useful for you, great, use them. I just don't see why they should be merged if nobody is going to use them but you.
Aren't there many drivers in the kernel sources which are only used by very few users? Android is used by million users, albeit on one platform, but I don't see this to be a valid reason to keep this functionality out of the kernel.
Best,
Dominik
Re: [linux-pm] Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasFelipe,
Quoted 3 lines
If you think suspend blockers are useful for you, great, use them. I just don't see why they should be merged if nobody is going to use them but you.
Aren't there many drivers in the kernel sources which are only used by very few users? Android is used by million users, albeit on one platform, but I don't see this to be a valid reason to keep this functionality out of the kernel.
Best,
Dominik
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasQuoted 9 lines · Felipe Contreras
Quoted 1 line · Theodore Tso
One thing I'm not clear on --- what's your goal? Is your goal to keep suspend-blockers out of the kernel? Is it to try to convince the android team suspend-blockers are a bad idea and to change Android to not use them? Is it to push some other agenda? Is it to discourage the Android team from trying to waste more time trying to get suspend-blockers (or equivalent functionality) from being added into the kernel?
My goal is to shine light. I've heard many invalid arguments in favor of suspend blockers, I want to shut them down.
In my mind it's crystal clear that independently of what opportunistic suspend is supposed to be fixing, the fact of the matter is that it's not a silver bullet as it's claimed to be.
The question is not whether suspend blockers are a silver bullet (in my opinion there are no silver bullets), but rather whether or not suspend blockers are useful.
Quoted 2 lines
So far, nobody has refuted these:
1) opportunistic suspend needs a good behaved user-space to work properly
As does dynamic power management.
Quoted 2 lines
2) if suspend blockers are enabled in a system, *all* user-space must
implement them to work correctly
Really? From what I can see, only PM-driving applications need to use suspend blockers.
Quoted 1 line
3) implementing suspend blockers in user-space is not a straight-forward task
Fortunately, experience thus far has shown that only a small fraction of applications need to use suspend blockers. (Or perhaps you are instead saying that the implementation of the suspend-blocker infrastructure itself is not straightforward? It is not clear from your words.)
Quoted 1 line
4) there's a point where sleeping (not doing work) has diminished returns
This one I agree with.
Quoted 5 lines
So, as the length of this thread has shown, the benefits of opportunistic suspend are *dubious* at best, and more likely not worth the changes needed in user-space which eventually will get pretty close to what suspend blockers can achieve even in ideal circumstances by just doing dynamic PM.
The length of this thread (and the ones preceding it) is mostly due to people talking past each other. For example, the Android folks seem to believe that it is important that relatively unskilled people be able to write simple apps, and that the system nevertheless be able to run these apps in a relatively energy efficient manner. Your proposals do not address this issue. This might be because you are not aware of this desire, because you are not aware of the computing history that argues in favor of this requirement, or because you simply don't like this requirement. Whatever the reason, until you face this requirement head on, either addressing it or proving that it need not be addressed, you will continue to be talking past the Android folks.
Thanx, Paul
Re: Attempted summary of suspend-blockers LKML thread, take three
In reply to Felipe ContrerasQuoted 9 lines · Felipe Contreras
Quoted 1 line · Theodore Tso
One thing I'm not clear on --- what's your goal? Is your goal to keep suspend-blockers out of the kernel? Is it to try to convince the android team suspend-blockers are a bad idea and to change Android to not use them? Is it to push some other agenda? Is it to discourage the Android team from trying to waste more time trying to get suspend-blockers (or equivalent functionality) from being added into the kernel?
My goal is to shine light. I've heard many invalid arguments in favor of suspend blockers, I want to shut them down.
In my mind it's crystal clear that independently of what opportunistic suspend is supposed to be fixing, the fact of the matter is that it's not a silver bullet as it's claimed to be.
The question is not whether suspend blockers are a silver bullet (in my opinion there are no silver bullets), but rather whether or not suspend blockers are useful.
Quoted 2 lines
So far, nobody has refuted these:
1) opportunistic suspend needs a good behaved user-space to work properly
As does dynamic power management.
Quoted 2 lines
2) if suspend blockers are enabled in a system, *all* user-space must
implement them to work correctly
Really? From what I can see, only PM-driving applications need to use suspend blockers.
Quoted 1 line
3) implementing suspend blockers in user-space is not a straight-forward task
Fortunately, experience thus far has shown that only a small fraction of applications need to use suspend blockers. (Or perhaps you are instead saying that the implementation of the suspend-blocker infrastructure itself is not straightforward? It is not clear from your words.)
Quoted 1 line
4) there's a point where sleeping (not doing work) has diminished returns
This one I agree with.
Quoted 5 lines
So, as the length of this thread has shown, the benefits of opportunistic suspend are *dubious* at best, and more likely not worth the changes needed in user-space which eventually will get pretty close to what suspend blockers can achieve even in ideal circumstances by just doing dynamic PM.
The length of this thread (and the ones preceding it) is mostly due to people talking past each other. For example, the Android folks seem to believe that it is important that relatively unskilled people be able to write simple apps, and that the system nevertheless be able to run these apps in a relatively energy efficient manner. Your proposals do not address this issue. This might be because you are not aware of this desire, because you are not aware of the computing history that argues in favor of this requirement, or because you simply don't like this requirement. Whatever the reason, until you face this requirement head on, either addressing it or proving that it need not be addressed, you will continue to be talking past the Android folks.
Thanx, Paul