suspend blockers & Android integration
Quoted 3 lines · * [email protected] <[email protected]> wrote:
[...] Not only has the source code been made available, but hundreds of engineering hours have been made trying to accomodate the demands of LKML --- and LKML has said no to suspend blockers/wakelocks.
I dont think you are being fair here, at all.
Firstly, the suspend-blockers feature is not being rejected (fixing and extending suspend is a worthwile goal), it's just that various different schemes have been proposed by the people who'll eventually have to maintain that code down the line.
Those reasons seem justified and they are based in praxis that have solved similar problems to what Android tries to solve.
Sadly the response from the Android team has been 100% uncompromising: either suspend blockers or nothing.
The thing is, if the insertion of 'hundreds of man hours' into discussing a feature was technical grounds for upstream inclusion then we'd today have a Linux kernel with:
- STREAMS
- a kABI
- modularized ipv4
- perfmon
- two dozen CPU schedulers
- zero-copy stupidly pushed to all the file APIs
... and IMO we'd be off much worse technically.
Lets realize it, Linux is an engineering effort that has literally cost about ten thousand man years. That's about a _85 million_ man hours. It takes effort to keep that kind of work valuable!
Also, why did the Android team start its contributions with such a difficult and controversial kernel feature?
There is absolutely _zero_ technical reason why the Android team should present this as as an all-or-nothing effort. Why not merge hw drivers first (with suspend blockers commented or stubbed out), to reduce the fork distance?
Really, i myself have controversial kernel features pending all the time. They dont go upstream for a few kernel releases - over a year sometimes - and sometimes they never go upstream.
But the fact that some feature of mine is pending doesnt give me the right to go away sulking, it doesnt mean i will block the whole flow of patches in retaliation (as you seem to suggest Google will now have the right to do) - i simply try to work it out.
Lets be reasonable and work it all out, ok?
Thanks,
Ingo
Quoted 3 lines · Ingo Molnar
Sadly the response from the Android team has been 100% uncompromising: either suspend blockers or nothing.
Well, we're willing to accept something that gives us the same functionality (thus rewriting the api several times to meet various objections, current discussions around constraint-based-implementations / pm-qos, etc). We believe we're solving a real problem here and have not seen a counter-proposal that accomplishes the same.
Suggestions such as "just yell at developers for writing bad apps" or "it's the user's fault if they install a lousy app" or "make your app marketplace more restrictive" are not helpful. The technical discussions around alternatives are more so (though I do feel like we're going in circles in places), which again is why we're still here talking about this (that and Arve is about a billion times more patient and persistent than I am).
We're not interested in massively rearchitecting our userspace to accomplish this (and the "rewrite your userspace!" proposals I've seen have had race conditions and/or significant more complexity than the wakelock model).
...
Quoted 2 lines
Also, why did the Android team start its contributions with such a difficult and controversial kernel feature?
We started here because it's possibly the only api level change we have -- almost everything else is driver or subarch type work or controversial but entirely self-contained (like the binder, which I would be shocked to see ever hit mainline). Assertions have been made that because the "android kernel" (not a term I like -- linux is linux, we have some assorted patches on top) has this feature it represents a difficulty for silicon vendors trying to support both Android projects and OEMs and mainline:
See: http://www.kroah.com/log/linux/android-kernel-problems.html and various other rants about the evil terrible android forks, etc.
So, we figure, let's sort out the hard problem first and then move on with our lives.
Quoted 3 lines
There is absolutely _zero_ technical reason why the Android team should present this as as an all-or-nothing effort. Why not merge hw drivers first (with suspend blockers commented or stubbed out), to reduce the fork distance?
If that's the case then there is no problem and people could stop yelling at us and just submit their drivers. Awesome.
I can't speak for all the nameless silicon vendors Greg represents, that we apparently are preventing from doing this (how? I don't know!), etc, but for my team maintaining multiple versions of drivers is a headache, we'd rather square away the wakelock debate first and figure something out there, as it just seems like a more logical approach. Maybe we're crazy.
Quoted 8 lines
Really, i myself have controversial kernel features pending all the time. They dont go upstream for a few kernel releases - over a year sometimes - and sometimes they never go upstream.
But the fact that some feature of mine is pending doesnt give me the right to go away sulking, it doesnt mean i will block the whole flow of patches in retaliation (as you seem to suggest Google will now have the right to do) - i simply try to work it out.
We're not blocking anything. Hell, if people want drivers we wrote upstream and we're not fast enough for 'em, we publish everything via android.git.kernel.org, pretty aggressively rebase to follow latest mainline, and release everything under GPLv2, ready-to-go. We have to ship though, and as long as the version we maintain has the features we need to ship and the mainline version doesn't, we're going to ship based on our version, but this really shouldn't be surprising to anyone.
Quoted 1 line
Lets be reasonable and work it all out, ok?
We're trying.
I do feel like we're suffering from lack of a clear "how do we move forward" path, and in particular from an environment where every time we do a bunch of work to address one set of concerns and entirely new set of people pop up with different concerns (sometimes contradicting the last round of changes we were asked to make, etc, etc).
Brian
Quoted 3 lines · Ingo Molnar
Sadly the response from the Android team has been 100% uncompromising: either suspend blockers or nothing.
Well, we're willing to accept something that gives us the same functionality (thus rewriting the api several times to meet various objections, current discussions around constraint-based-implementations / pm-qos, etc). We believe we're solving a real problem here and have not seen a counter-proposal that accomplishes the same.
Suggestions such as "just yell at developers for writing bad apps" or "it's the user's fault if they install a lousy app" or "make your app marketplace more restrictive" are not helpful. The technical discussions around alternatives are more so (though I do feel like we're going in circles in places), which again is why we're still here talking about this (that and Arve is about a billion times more patient and persistent than I am).
We're not interested in massively rearchitecting our userspace to accomplish this (and the "rewrite your userspace!" proposals I've seen have had race conditions and/or significant more complexity than the wakelock model).
...
Quoted 2 lines
Also, why did the Android team start its contributions with such a difficult and controversial kernel feature?
We started here because it's possibly the only api level change we have -- almost everything else is driver or subarch type work or controversial but entirely self-contained (like the binder, which I would be shocked to see ever hit mainline). Assertions have been made that because the "android kernel" (not a term I like -- linux is linux, we have some assorted patches on top) has this feature it represents a difficulty for silicon vendors trying to support both Android projects and OEMs and mainline:
See: http://www.kroah.com/log/linux/android-kernel-problems.html and various other rants about the evil terrible android forks, etc.
So, we figure, let's sort out the hard problem first and then move on with our lives.
Quoted 3 lines
There is absolutely _zero_ technical reason why the Android team should present this as as an all-or-nothing effort. Why not merge hw drivers first (with suspend blockers commented or stubbed out), to reduce the fork distance?
If that's the case then there is no problem and people could stop yelling at us and just submit their drivers. Awesome.
I can't speak for all the nameless silicon vendors Greg represents, that we apparently are preventing from doing this (how? I don't know!), etc, but for my team maintaining multiple versions of drivers is a headache, we'd rather square away the wakelock debate first and figure something out there, as it just seems like a more logical approach. Maybe we're crazy.
Quoted 8 lines
Really, i myself have controversial kernel features pending all the time. They dont go upstream for a few kernel releases - over a year sometimes - and sometimes they never go upstream.
But the fact that some feature of mine is pending doesnt give me the right to go away sulking, it doesnt mean i will block the whole flow of patches in retaliation (as you seem to suggest Google will now have the right to do) - i simply try to work it out.
We're not blocking anything. Hell, if people want drivers we wrote upstream and we're not fast enough for 'em, we publish everything via android.git.kernel.org, pretty aggressively rebase to follow latest mainline, and release everything under GPLv2, ready-to-go. We have to ship though, and as long as the version we maintain has the features we need to ship and the mainline version doesn't, we're going to ship based on our version, but this really shouldn't be surprising to anyone.
Quoted 1 line
Lets be reasonable and work it all out, ok?
We're trying.
I do feel like we're suffering from lack of a clear "how do we move forward" path, and in particular from an environment where every time we do a bunch of work to address one set of concerns and entirely new set of people pop up with different concerns (sometimes contradicting the last round of changes we were asked to make, etc, etc).
Brian
Quoted 12 lines · Brian Swetland
Quoted 3 lines · Ingo Molnar
Sadly the response from the Android team has been 100% uncompromising: either suspend blockers or nothing.
Well, we're willing to accept something that gives us the same functionality (thus rewriting the api several times to meet various objections, current discussions around constraint-based-implementations / pm-qos, etc). We believe we're solving a real problem here and have not seen a counter-proposal that accomplishes the same.
Quoted 3 lines
Suggestions such as "just yell at developers for writing bad apps" or "it's the user's fault if they install a lousy app" or "make your app marketplace more restrictive" are not helpful. [...]
Agreed.
Quoted 2 lines
[...] The technical discussions around alternatives are more so (though I do feel like we're going in circles in places), [...]
Yep.
Quoted 6 lines
[...] which again is why we're still here talking about this (that and Arve is about a billion times more patient and persistent than I am).
We're not interested in massively rearchitecting our userspace to accomplish this (and the "rewrite your userspace!" proposals I've seen have had race conditions and/or significant more complexity than the wakelock model).
Having a somewhat different ABI for achieving things you'll probably have prepare for. I doubt it would result in any large-scale, massive rewrites.
Quoted 9 lines
...
Quoted 2 lines
Also, why did the Android team start its contributions with such a difficult and controversial kernel feature?
We started here because it's possibly the only api level change we have -- almost everything else is driver or subarch type work or controversial but entirely self-contained (like the binder, which I would be shocked to see ever hit mainline). [...]
So why arent those bits mainline? It's a 1000 times easier to get drivers and small improvements and non-ABI changes upstream.
After basically two years of growing your fork (and some attempts to get your drivers into drivers/staging/ - from where they have meanwhile dropped out again) you re-started with the worst possible thing to merge: a big and difficult kernel feature affecting many subsystems. Why?
This is one of the fundamental problems here. People simply dont know you, because you have not worked with us much - and hence they dont trust you positively out of box - they are neutral at best.
And believe me, it's hard enough to get difficult features upstream if people _do_ know you and when they positively _do_ trust you ... Arent you talking to Andrew Morton about how to do these things properly? This is kernel contribution 101 really.
Quoted 2 lines
[...] Assertions have been made that because the "android kernel" (not a term I like -- linux is linux, we have some assorted patches on top) [...]
I've been tracking android-common and android-msm for a while and i have to say that it shows a very lackluster attitude towards upstream:
- The latest branches i can see are v2.6.32 based today. We are in the v2.6.35 stabilization cycle and are developing v2.6.36. I.e. your upstream base is about a year too old.
- The last commit is a couple of weeks old AFAICS.
- The diffstat of android-common/android-2.6.32 is:
890 files changed, 39962 insertions(+), 6286 deletions(-)
Those assorted patches have spread over nearly a thousand files. FYI, by the looks of it you are facing an exponentially worsening maintenance overhead curve here.
Is there perhaps some other tree i should be following? I'm looking at:
[remote "android-msm"]
url = git://android.git.kernel.org/kernel/msm.git
fetch = +refs/heads/*:refs/remotes/android-msm/*
[remote "android-common"]
url = git://android.git.kernel.org/kernel/common.git
fetch = +refs/heads/*:refs/remotes/android-common/*
Btw., the commits i've glanced at looked mostly clean and well structured, so i see no fundamental reason why this couldn't be done better.
Quoted 5 lines
See: http://www.kroah.com/log/linux/android-kernel-problems.html and various other rants about the evil terrible android forks, etc.
So, we figure, let's sort out the hard problem first and then move on with our lives.
Well, my suggestion would be to first build up a path towards upstream, build up trust, reduce your very high cross section to mainline - and do the most difficult bits last.
Especially 'move on with our lives' suggests that you just want to get rid of this ABI divergence and continue-as-usual with the pattern of non-cooperation, hm?
Quoted 5 lines
Quoted 4 lines
There is absolutely _zero_ technical reason why the Android team should present this as as an all-or-nothing effort. Why not merge hw drivers first (with suspend blockers commented or stubbed out), to reduce the fork distance?
Quoted 8 lines
If that's the case then there is no problem and people could stop yelling at us and just submit their drivers. Awesome.
I can't speak for all the nameless silicon vendors Greg represents, that we apparently are preventing from doing this (how? I don't know!), etc, but for my team maintaining multiple versions of drivers is a headache, we'd rather square away the wakelock debate first and figure something out there, as it just seems like a more logical approach. Maybe we're crazy.
It's not crazy, it's just IMHO inefficient and very difficult to do it like that. And you arent the first one to try it like that (people _always_ gravitate towards coming with their most difficult patches first - because they are very often the most useful patches) - it's a non-trivial learning curve IMHO.
Ingo
Quoted 7 lines · Ingo Molnar
Quoted 5 lines · Brian Swetland
We started here because it's possibly the only api level change we have -- almost everything else is driver or subarch type work or controversial but entirely self-contained (like the binder, which I would be shocked to see ever hit mainline). [...]
Quoted 7 lines
So why arent those bits mainline? It's a 1000 times easier to get drivers and small improvements and non-ABI changes upstream.
After basically two years of growing your fork (and some attempts to get your drivers into
drivers/staging/- from where they have meanwhile dropped out again) you re-started with the worst possible thing to merge: a big and difficult kernel feature affecting many subsystems. Why?
Because a large number of our drivers depend on it.
Quoted 12 lines
This is one of the fundamental problems here. People simply dont know you, because you have not worked with us much - and hence they dont trust you positively out of box - they are neutral at best.
And believe me, it's hard enough to get difficult features upstream if people _do_ know you and when they positively _do_ trust you ... Arent you talking to Andrew Morton about how to do these things properly? This is kernel contribution 101 really.
Quoted 2 lines
[...] Assertions have been made that because the "android kernel" (not a term I like -- linux is linux, we have some assorted patches on top) [...]
Quoted 6 lines
I've been tracking android-common and android-msm for a while and i have to say that it shows a very lackluster attitude towards upstream:
- The latest branches i can see are v2.6.32 based today. We are in the v2.6.35 stabilization cycle and are developing v2.6.36. I.e. your upstream base is about a year too old.
We have some branch naming confusion and work going on in experimental, but our active work right now is against 2.6.34 and 2.6.35-rc. The tegra2 work has been very aggressively following mainline (rebasing against 2.6.34rc as they were getting underway), and we've been sending those patches out for review, in hopes of getting that tree off on a better foot.
Quoted 20 lines
- The last commit is a couple of weeks old AFAICS.
- The diffstat of android-common/android-2.6.32 is:
890 files changed, 39962 insertions(+), 6286 deletions(-)Those assorted patches have spread over nearly a thousand files. FYI, by the looks of it you are facing an exponentially worsening maintenance overhead curve here.
Is there perhaps some other tree i should be following? I'm looking at:
[remote "android-msm"]
url =git://android.git.kernel.org/kernel/msm.git
fetch = +refs/heads/*:refs/remotes/android-msm/* [remote "android-common"]
url =git://android.git.kernel.org/kernel/common.git
fetch = +refs/heads/*:refs/remotes/android-common/*
Quoted 2 lines
Btw., the commits i've glanced at looked mostly clean and well structured, so i see no fundamental reason why this couldn't be done better.
I think the fundamental issue we keep bumping into is the turnaround time on patch review / inclusion (again we're trying to get things going much earlier on tegra2 to hopefully have less pain there). We aim for kernel style compliance (though we're not perfect and we make our share of mistakes), but previously when I tried sending mach-msm stuff out, it seemed infeasible to send 30-60+ patches, so we'd start with 5-10, feedback would trickle in over the course of a week, I'd respin, etc. After a couple weeks some stuff would get picked up toward a merge window but the rest would have to wait. And then we hit crunch to ship, etc, and get behind.
Totally our fault that we're not just constantly pushing patches (and we're trying to get a fulltime engineer or two just to work on upstream related stuff), but we rapidly hit the point where what we're sending up is a drop in the bucket compared to the work we're doing and things keep diverging, etc.
I'm told this happens to everyone, is common, etc. We're (seriously) a small team, trying to ship multiple products a year and keep our head above water here, and unfortunately that means we keep tabling these projects until we can find some cycles to give it another go and the delta grows.
Quoted 6 lines
Quoted 2 lines
So, we figure, let's sort out the hard problem first and then move on with our lives.
Well, my suggestion would be to first build up a path towards upstream, build up trust, reduce your very high cross section to mainline - and do the most difficult bits last.
Having to maintain two versions of about half our driver code because we depend on an ABI not in mainline is a significant factor for us -- it's difficult to have what's going upstream lag behind our active work (basically we have to maintain two different trees -- one for mainline one for ship) already, but having these codelines also be different makes it worse for us.
Quoted 3 lines
Especially 'move on with our lives' suggests that you just want to get rid of this ABI divergence and continue-as-usual with the pattern of non-cooperation, hm?
I'd like to make some forward progress either to get something wakelock-ish in and shift to whatever that api is, or to get a clear "no not going to happen" and deal with the fallout there.
...
Sadly, for mach-msm, we're now further out due to maintainership shifts (Daniel stepped up to do msm stuff, is pushing up some hybrid of our work and Qualcomm's work that doesn't seem to really fit with either, and I have no idea how to sanely get our stuff to sit on top of that). I'd love to find some time to sit down, clean up the whole msm tree for 8x50/7x30 which is (largely) pretty clean, and is extremely stable and shippable, and try to get it into a patch series and headed upstream, but we're now colliding with the upstream mach-msm which has gone off in a different direction, etc.
Anyway, we continue to try to figure out how to make stuff work better (again, trying some different approaches with tegra2), but so far the process of getting code upstream has been extremely time intensive and rather frustrating and it remains unclear who can sign off on what and how many hoops different people will keep asking us to jump through.
Brian
Quoted 11 lines · Brian Swetland
Quoted 10 lines · Ingo Molnar
Quoted 5 lines · Brian Swetland
We started here because it's possibly the only api level change we have -- almost everything else is driver or subarch type work or controversial but entirely self-contained (like the binder, which I would be shocked to see ever hit mainline). [...]
So why arent those bits mainline? It's a 1000 times easier to get drivers and small improvements and non-ABI changes upstream.
Quoted 6 lines
Quoted 4 lines
After basically two years of growing your fork (and some attempts to get your drivers into
drivers/staging/- from where they have meanwhile dropped out again) you re-started with the worst possible thing to merge:
a big and difficult kernel feature affecting many subsystems. Why?Because a large number of our drivers depend on it.
So why not put in some stub or so? Auto-suspend/suspend-blockers is a feature, and drivers ought to be able to work without a feature as well. Keep the suspend-blocker changes in the android tree initially, and get the main body of changes out first, and establish a flow of timely changes. That reduces your maintenance burden and increases trust for future changes - a win-win situation.
In any case, this is not to suggest that the suspend-blocker bits are 'impossible' to merge. I just say that if you start with your most difficult feature you should not be surprised to be on the receiving end of a 1000+ mails flamewar on lkml ;-)
Quoted 10 lines
Quoted 6 lines
I've been tracking android-common and android-msm for a while and i have to say that it shows a very lackluster attitude towards upstream:
??- The latest branches i can see are v2.6.32 based today. We are in the ?? v2.6.35 stabilization cycle and are developing v2.6.36. I.e. your upstream ?? base is about a year too old.
We have some branch naming confusion and work going on in experimental, but our active work right now is against 2.6.34 and 2.6.35-rc. [...]
That's nice!
Quoted 4 lines
[...] The tegra2 work has been very aggressively following mainline (rebasing against 2.6.34rc as they were getting underway), and we've been sending those patches out for review, in hopes of getting that tree off on a better foot.
Ah, googling for 'tegra2' gave me the magic URI:
git remote add android-tegra2 git://android.git.kernel.org/kernel/tegra.git
I generally roam various trees for scheduler patches when i can, seeing what problems people are facing and trying to prevent more painful forks from developing. You have these changes there currently:
d82647e: sched: make task dump print all 15 chars of proc comm 5e3e0f1: sched: Enable might_sleep before initializing drivers.
Please submit 5e3e0f1. We can probably do that one even simpler, by turning __might_sleep_init_called into the only flag that __might_sleep() checks - i.e. not checking system_state at all.
Also, please submit d82647e, it makes sense too.
Thanks,
Ingo
Quoted 11 lines · Brian Swetland
Quoted 10 lines · Ingo Molnar
Quoted 5 lines · Brian Swetland
We started here because it's possibly the only api level change we have -- almost everything else is driver or subarch type work or controversial but entirely self-contained (like the binder, which I would be shocked to see ever hit mainline). [...]
So why arent those bits mainline? It's a 1000 times easier to get drivers and small improvements and non-ABI changes upstream.
Quoted 6 lines
Quoted 4 lines
After basically two years of growing your fork (and some attempts to get your drivers into
drivers/staging/- from where they have meanwhile dropped out again) you re-started with the worst possible thing to merge:
a big and difficult kernel feature affecting many subsystems. Why?Because a large number of our drivers depend on it.
So why not put in some stub or so? Auto-suspend/suspend-blockers is a feature, and drivers ought to be able to work without a feature as well. Keep the suspend-blocker changes in the android tree initially, and get the main body of changes out first, and establish a flow of timely changes. That reduces your maintenance burden and increases trust for future changes - a win-win situation.
In any case, this is not to suggest that the suspend-blocker bits are 'impossible' to merge. I just say that if you start with your most difficult feature you should not be surprised to be on the receiving end of a 1000+ mails flamewar on lkml ;-)
Quoted 10 lines
Quoted 6 lines
I've been tracking android-common and android-msm for a while and i have to say that it shows a very lackluster attitude towards upstream:
??- The latest branches i can see are v2.6.32 based today. We are in the ?? v2.6.35 stabilization cycle and are developing v2.6.36. I.e. your upstream ?? base is about a year too old.
We have some branch naming confusion and work going on in experimental, but our active work right now is against 2.6.34 and 2.6.35-rc. [...]
That's nice!
Quoted 4 lines
[...] The tegra2 work has been very aggressively following mainline (rebasing against 2.6.34rc as they were getting underway), and we've been sending those patches out for review, in hopes of getting that tree off on a better foot.
Ah, googling for 'tegra2' gave me the magic URI:
git remote add android-tegra2 git://android.git.kernel.org/kernel/tegra.git
I generally roam various trees for scheduler patches when i can, seeing what problems people are facing and trying to prevent more painful forks from developing. You have these changes there currently:
d82647e: sched: make task dump print all 15 chars of proc comm 5e3e0f1: sched: Enable might_sleep before initializing drivers.
Please submit 5e3e0f1. We can probably do that one even simpler, by turning __might_sleep_init_called into the only flag that __might_sleep() checks - i.e. not checking system_state at all.
Also, please submit d82647e, it makes sense too.
Thanks,
Ingo
Quoted 4 lines · Ingo Molnar
In any case, this is not to suggest that the suspend-blocker bits are 'impossible' to merge. I just say that if you start with your most difficult feature you should not be surprised to be on the receiving end of a 1000+ mails flamewar on lkml ;-)
Indeed. This 'all or nothing' approach hasn't worked well in the past and I highly doubt it will work now. It's much easier to work with people when you have a track record of getting things merged and actually maintaining the code.
Pekka
Quoted 4 lines · Ingo Molnar
In any case, this is not to suggest that the suspend-blocker bits are 'impossible' to merge. I just say that if you start with your most difficult feature you should not be surprised to be on the receiving end of a 1000+ mails flamewar on lkml ;-)
Indeed. This 'all or nothing' approach hasn't worked well in the past and I highly doubt it will work now. It's much easier to work with people when you have a track record of getting things merged and actually maintaining the code.
Pekka
Quoted 6 lines · Ingo Molnar
Quoted 5 lines · Brian Swetland
Quoted 4 lines
After basically two years of growing your fork (and some attempts to get your drivers into
drivers/staging/- from where they have meanwhile dropped out again) you re-started with the worst possible thing to merge:
a big and difficult kernel feature affecting many subsystems. Why?
Quoted 8 lines
Quoted 1 line
Because a large number of our drivers depend on it.
So why not put in some stub or so? Auto-suspend/suspend-blockers is a feature, and drivers ought to be able to work without a feature as well. Keep the suspend-blocker changes in the android tree initially, and get the main body of changes out first, and establish a flow of timely changes. That reduces your maintenance burden and increases trust for future changes - a win-win situation.
The impression I got from previous discussions was that upstream did not want things that were built conditionally around APIs that did not exist in mainline nor stub implementations for things that were not agreed upon.
We could easily either #if defined(CONFIG_SUSPEND_BLOCKERS) or submit a suspend_blockers.h that just makes everything a no-op, if that's an acceptable transition vehicle. I didn't think either were an option open to us.
Quoted 4 lines
In any case, this is not to suggest that the suspend-blocker bits are 'impossible' to merge. I just say that if you start with your most difficult feature you should not be surprised to be on the receiving end of a 1000+ mails flamewar on lkml ;-)
Yeah, I do understand that we're not making it easy for ourselves here. I think we hit the point where Rafael and Matthew signed off on things and thought "aha, linux-pm maintainers are happy, now we're getting somewhere" only to realize the light at the end of the tunnel was a bit further out than we anticipated ^^
Brian
Quoted 6 lines · Ingo Molnar
Quoted 5 lines · Brian Swetland
Quoted 4 lines
After basically two years of growing your fork (and some attempts to get your drivers into
drivers/staging/- from where they have meanwhile dropped out again) you re-started with the worst possible thing to merge:
a big and difficult kernel feature affecting many subsystems. Why?
Quoted 8 lines
Quoted 1 line
Because a large number of our drivers depend on it.
So why not put in some stub or so? Auto-suspend/suspend-blockers is a feature, and drivers ought to be able to work without a feature as well. Keep the suspend-blocker changes in the android tree initially, and get the main body of changes out first, and establish a flow of timely changes. That reduces your maintenance burden and increases trust for future changes - a win-win situation.
The impression I got from previous discussions was that upstream did not want things that were built conditionally around APIs that did not exist in mainline nor stub implementations for things that were not agreed upon.
We could easily either #if defined(CONFIG_SUSPEND_BLOCKERS) or submit a suspend_blockers.h that just makes everything a no-op, if that's an acceptable transition vehicle. I didn't think either were an option open to us.
Quoted 4 lines
In any case, this is not to suggest that the suspend-blocker bits are 'impossible' to merge. I just say that if you start with your most difficult feature you should not be surprised to be on the receiving end of a 1000+ mails flamewar on lkml ;-)
Yeah, I do understand that we're not making it easy for ourselves here. I think we hit the point where Rafael and Matthew signed off on things and thought "aha, linux-pm maintainers are happy, now we're getting somewhere" only to realize the light at the end of the tunnel was a bit further out than we anticipated ^^
Brian
Quoted 16 lines · Brian Swetland
Quoted 6 lines · Ingo Molnar
Quoted 5 lines · Brian Swetland
Quoted 4 lines
After basically two years of growing your fork (and some attempts to get your drivers into
drivers/staging/- from where they have meanwhile dropped out again) you re-started with the worst possible thing to merge:
a big and difficult kernel feature affecting many subsystems. Why?Quoted 8 lines
Quoted 1 line
Because a large number of our drivers depend on it.
So why not put in some stub or so? Auto-suspend/suspend-blockers is a feature, and drivers ought to be able to work without a feature as well. Keep the suspend-blocker changes in the android tree initially, and get the main body of changes out first, and establish a flow of timely changes. That reduces your maintenance burden and increases trust for future changes - a win-win situation.
Quoted 3 lines
The impression I got from previous discussions was that upstream did not want things that were built conditionally around APIs that did not exist in mainline nor stub implementations for things that were not agreed upon.
Well, if it's some ugly #ifdef solution i could imagine light objections on pure aesthetic micro-grounds.
Quoted 4 lines
We could easily either #if
defined(CONFIG_SUSPEND_BLOCKERS)or submit asuspend_blockers.hthat just makes everything a no-op, if that's an acceptable transition vehicle. I didn't think either were an option open to us.
You can certainly put in a suspend_blockers.h thing into some Android directory, and populate it with empty wrappers - as long as you only use it within Android drivers and not core kernel code or other subsystems you dont maintain.
It's being done all the time and helpful cleanup patches eliminating the stubs are frowned upon (unless the subs are there like for years with no progress and no maintenance in sight).
Putting empty stubs into include/linux/ would be pushing things i think.
In fact sometimes architectures even jump the gun with major kernel features:
we had a dynticks implementation in ARM for years, we had RTLinux stubs in x86 code for quite some time, and we still have perfmon in IA64 - despite the core kernel having gone for a different design.
It's certainly not ideal, but it's certainly a solution that is used every now and then. The less difference there is between trees the easier it becomes to merge - for both sides, both technically and socially.
Quoted 10 lines
Quoted 4 lines
In any case, this is not to suggest that the suspend-blocker bits are 'impossible' to merge. I just say that if you start with your most difficult feature you should not be surprised to be on the receiving end of a 1000+ mails flamewar on lkml ;-)
Yeah, I do understand that we're not making it easy for ourselves here. I think we hit the point where Rafael and Matthew signed off on things and thought "aha, linux-pm maintainers are happy, now we're getting somewhere" only to realize the light at the end of the tunnel was a bit further out than we anticipated ^^
That's a well-known problem on lkml: the light at the end of the tunnel was the other train ;-)
Anyway, i'm not pessimistic at all: _some_ sort of scheme appears to be crystalising out today. Everyone seems to agree now that the main usecases are indeed useful and need handling one way or another - the rest is really just technological discussions how to achieve the mostly-agreed-upon end goal.
The worst situation are features where one side says 'we dont need this kind of functionality at all' - IMO auto/opportunistic-suspend isnt in that situation, fortunately.
Thanks,
Ingo
Quoted 12 lines · Ingo Molnar
You can certainly put in a
suspend_blockers.hthing into some Android directory, and populate it with empty wrappers - as long as you only use it within Android drivers and not core kernel code or other subsystems you dont maintain.It's being done all the time and helpful cleanup patches eliminating the stubs are frowned upon (unless the subs are there like for years with no progress and no maintenance in sight).
Putting empty stubs into
include/linux/would be pushing things i think.
Quoted 8 lines
In fact sometimes architectures even jump the gun with major kernel features:
we had a dynticks implementation in ARM for years, we had RTLinux stubs in x86 code for quite some time, and we still have perfmon in IA64 - despite the core kernel having gone for a different design.It's certainly not ideal, but it's certainly a solution that is used every now and then. The less difference there is between trees the easier it becomes to merge - for both sides, both technically and socially.
Totally -- our goal would be that as drivers find their way from our tree to mainline we'd keep them 1:1 between the trees. If we can it a local suspend_blocker.h somewhere while the long term solution gets hashed out that'd remove the biggest painpoint on a driver level. I'm not quite sure where the best place to drop such a thing would be -- we'd likely be including it from mach-msm, mach-tegra2, and drivers for both those architectures in the normal driver places for the tree. I guess we could just drop it in arch/arm/mach-{msm,tegra2}/include/mach/ and both the subarch code and subarch-specific-drivers we've been writing could pick it up via #include <mach/suspend_blockers.h>
Quoted 9 lines
Quoted 5 lines
Yeah, I do understand that we're not making it easy for ourselves here. I think we hit the point where Rafael and Matthew signed off on things and thought "aha, linux-pm maintainers are happy, now we're getting somewhere" only to realize the light at the end of the tunnel was a bit further out than we anticipated ^^
That's a well-known problem on lkml: the light at the end of the tunnel was the other train ;-)
Quoted 8 lines
Anyway, i'm not pessimistic at all: _some_ sort of scheme appears to be crystalising out today. Everyone seems to agree now that the main usecases are indeed useful and need handling one way or another - the rest is really just technological discussions how to achieve the mostly-agreed-upon end goal.
The worst situation are features where one side says 'we dont need this kind of functionality at all' - IMO auto/opportunistic-suspend isnt in that situation, fortunately.
It is encouraging that there's at least some general consensus that the feature is useful, and as Arve and I have both mentioned, we're really not religious about names, etc, provided we can solve the problem we're trying to solve, so if it ends up being qos constraints or something else entirely but still gets us where we're trying to go, it's good news.
I think one point of contention remaining may be "just blocking suspend" vs "halting specific untrusted processes". The latter is difficult for us to work with because of the overall complexity of (our) userspace environment. A big hammer where we stop it all and suspend ends up being less deadlock/inversion-prone. Of course if the general solution ends up being able to do either, then perhaps everyone's happy.
Brian
Quoted 12 lines · Ingo Molnar
You can certainly put in a
suspend_blockers.hthing into some Android directory, and populate it with empty wrappers - as long as you only use it within Android drivers and not core kernel code or other subsystems you dont maintain.It's being done all the time and helpful cleanup patches eliminating the stubs are frowned upon (unless the subs are there like for years with no progress and no maintenance in sight).
Putting empty stubs into
include/linux/would be pushing things i think.
Quoted 8 lines
In fact sometimes architectures even jump the gun with major kernel features:
we had a dynticks implementation in ARM for years, we had RTLinux stubs in x86 code for quite some time, and we still have perfmon in IA64 - despite the core kernel having gone for a different design.It's certainly not ideal, but it's certainly a solution that is used every now and then. The less difference there is between trees the easier it becomes to merge - for both sides, both technically and socially.
Totally -- our goal would be that as drivers find their way from our tree to mainline we'd keep them 1:1 between the trees. If we can it a local suspend_blocker.h somewhere while the long term solution gets hashed out that'd remove the biggest painpoint on a driver level. I'm not quite sure where the best place to drop such a thing would be -- we'd likely be including it from mach-msm, mach-tegra2, and drivers for both those architectures in the normal driver places for the tree. I guess we could just drop it in arch/arm/mach-{msm,tegra2}/include/mach/ and both the subarch code and subarch-specific-drivers we've been writing could pick it up via #include <mach/suspend_blockers.h>
Quoted 9 lines
Quoted 5 lines
Yeah, I do understand that we're not making it easy for ourselves here. I think we hit the point where Rafael and Matthew signed off on things and thought "aha, linux-pm maintainers are happy, now we're getting somewhere" only to realize the light at the end of the tunnel was a bit further out than we anticipated ^^
That's a well-known problem on lkml: the light at the end of the tunnel was the other train ;-)
Quoted 8 lines
Anyway, i'm not pessimistic at all: _some_ sort of scheme appears to be crystalising out today. Everyone seems to agree now that the main usecases are indeed useful and need handling one way or another - the rest is really just technological discussions how to achieve the mostly-agreed-upon end goal.
The worst situation are features where one side says 'we dont need this kind of functionality at all' - IMO auto/opportunistic-suspend isnt in that situation, fortunately.
It is encouraging that there's at least some general consensus that the feature is useful, and as Arve and I have both mentioned, we're really not religious about names, etc, provided we can solve the problem we're trying to solve, so if it ends up being qos constraints or something else entirely but still gets us where we're trying to go, it's good news.
I think one point of contention remaining may be "just blocking suspend" vs "halting specific untrusted processes". The latter is difficult for us to work with because of the overall complexity of (our) userspace environment. A big hammer where we stop it all and suspend ends up being less deadlock/inversion-prone. Of course if the general solution ends up being able to do either, then perhaps everyone's happy.
Brian
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 3 lines · Ingo Molnar
Quoted 2 lines · Brian Swetland
Quoted 1 line · Ingo Molnar
* Brian Swetland <[email protected]> wrote:
[...]
Quoted 11 lines
Quoted 10 lines
Quoted 4 lines
In any case, this is not to suggest that the suspend-blocker bits are 'impossible' to merge. I just say that if you start with your most difficult feature you should not be surprised to be on the receiving end of a 1000+ mails flamewar on lkml ;-)
Yeah, I do understand that we're not making it easy for ourselves here. I think we hit the point where Rafael and Matthew signed off on things and thought "aha, linux-pm maintainers are happy, now we're getting somewhere" only to realize the light at the end of the tunnel was a bit further out than we anticipated ^^
Quoted 7 lines
That's a well-known problem on lkml: the light at the end of the tunnel was the other train ;-)
Anyway, i'm not pessimistic at all: _some_ sort of scheme appears to be crystalising out today. Everyone seems to agree now that the main usecases are indeed useful and need handling one way or another - the rest is really just technological discussions how to achieve the mostly-agreed-upon end goal.
It's still not clear to me whether everyone's revolving around to using the current suspend block API because it's orthogonal to all other mechanisms and is therefore separate from the kernel (and can be compiled out if you don't want it). Or whether re-expressing what the android drivers want (minimum idle states and suspend block) in pm_qos terms which others can use is the way to go. I think the latter, but I'd like to know what other people think (because I'm not wedded to this preference).
Quoted 3 lines
The worst situation are features where one side says 'we dont need this kind of functionality at all' - IMO auto/opportunistic-suspend isnt in that situation, fortunately.
Great ... because deprecating the problem has been one of the persistent memes by some people on this huge thread.
James
Quoted 6 lines · On Fri, 04 Jun 2010 09:24:06 -0500 James Bottomley <[email protected]>…
Quoted 4 lines · Ingo Molnar
Anyway, i'm not pessimistic at all: _some_ sort of scheme appears to be crystalising out today. Everyone seems to agree now that the main usecases are indeed useful and need handling one way or another - the rest is really just technological discussions how to achieve the mostly-agreed-upon end goal.
Quoted 8 lines
It's still not clear to me whether everyone's revolving around to using the current suspend block API because it's orthogonal to all other mechanisms and is therefore separate from the kernel (and can be compiled out if you don't want it). Or whether re-expressing what the android drivers want (minimum idle states and suspend block) in
pm_qosterms which others can use is the way to go. I think the latter, but I'd like to know what other people think (because I'm not wedded to this preference).
I'd like to know that also.
I have a patch to add pm_qos_add_request_nonblock function, so it is possible to register an pm_qos constraint by passing preallocated memory to it.
Notifying should be possible to do from atomic contexts via async_schedule()?
The scalability issues of pm_qos can be adressed by using plists for all pm_qos_class'es. Or by having the different pm_qos_class'es provide their own implementations for the update and get operations.
Cheers,
Flo
Quoted 3 lines
James
Quoted 6 lines · On Fri, 04 Jun 2010 09:24:06 -0500 James Bottomley <[email protected]>…
Quoted 4 lines · Ingo Molnar
Anyway, i'm not pessimistic at all: _some_ sort of scheme appears to be crystalising out today. Everyone seems to agree now that the main usecases are indeed useful and need handling one way or another - the rest is really just technological discussions how to achieve the mostly-agreed-upon end goal.
Quoted 8 lines
It's still not clear to me whether everyone's revolving around to using the current suspend block API because it's orthogonal to all other mechanisms and is therefore separate from the kernel (and can be compiled out if you don't want it). Or whether re-expressing what the android drivers want (minimum idle states and suspend block) in
pm_qosterms which others can use is the way to go. I think the latter, but I'd like to know what other people think (because I'm not wedded to this preference).
I'd like to know that also.
I have a patch to add pm_qos_add_request_nonblock function, so it is possible to register an pm_qos constraint by passing preallocated memory to it.
Notifying should be possible to do from atomic contexts via async_schedule()?
The scalability issues of pm_qos can be adressed by using plists for all pm_qos_class'es. Or by having the different pm_qos_class'es provide their own implementations for the update and get operations.
Cheers,
Flo
Quoted 3 lines
James
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 3 lines · Ingo Molnar
Quoted 2 lines · Brian Swetland
Quoted 1 line · Ingo Molnar
* Brian Swetland <[email protected]> wrote:
[...]
Quoted 11 lines
Quoted 10 lines
Quoted 4 lines
In any case, this is not to suggest that the suspend-blocker bits are 'impossible' to merge. I just say that if you start with your most difficult feature you should not be surprised to be on the receiving end of a 1000+ mails flamewar on lkml ;-)
Yeah, I do understand that we're not making it easy for ourselves here. I think we hit the point where Rafael and Matthew signed off on things and thought "aha, linux-pm maintainers are happy, now we're getting somewhere" only to realize the light at the end of the tunnel was a bit further out than we anticipated ^^
Quoted 7 lines
That's a well-known problem on lkml: the light at the end of the tunnel was the other train ;-)
Anyway, i'm not pessimistic at all: _some_ sort of scheme appears to be crystalising out today. Everyone seems to agree now that the main usecases are indeed useful and need handling one way or another - the rest is really just technological discussions how to achieve the mostly-agreed-upon end goal.
It's still not clear to me whether everyone's revolving around to using the current suspend block API because it's orthogonal to all other mechanisms and is therefore separate from the kernel (and can be compiled out if you don't want it). Or whether re-expressing what the android drivers want (minimum idle states and suspend block) in pm_qos terms which others can use is the way to go. I think the latter, but I'd like to know what other people think (because I'm not wedded to this preference).
Quoted 3 lines
The worst situation are features where one side says 'we dont need this kind of functionality at all' - IMO auto/opportunistic-suspend isnt in that situation, fortunately.
Great ... because deprecating the problem has been one of the persistent memes by some people on this huge thread.
James
Quoted 16 lines · Brian Swetland
Quoted 6 lines · Ingo Molnar
Quoted 5 lines · Brian Swetland
Quoted 4 lines
After basically two years of growing your fork (and some attempts to get your drivers into
drivers/staging/- from where they have meanwhile dropped out again) you re-started with the worst possible thing to merge:
a big and difficult kernel feature affecting many subsystems. Why?Quoted 8 lines
Quoted 1 line
Because a large number of our drivers depend on it.
So why not put in some stub or so? Auto-suspend/suspend-blockers is a feature, and drivers ought to be able to work without a feature as well. Keep the suspend-blocker changes in the android tree initially, and get the main body of changes out first, and establish a flow of timely changes. That reduces your maintenance burden and increases trust for future changes - a win-win situation.
Quoted 3 lines
The impression I got from previous discussions was that upstream did not want things that were built conditionally around APIs that did not exist in mainline nor stub implementations for things that were not agreed upon.
Well, if it's some ugly #ifdef solution i could imagine light objections on pure aesthetic micro-grounds.
Quoted 4 lines
We could easily either #if
defined(CONFIG_SUSPEND_BLOCKERS)or submit asuspend_blockers.hthat just makes everything a no-op, if that's an acceptable transition vehicle. I didn't think either were an option open to us.
You can certainly put in a suspend_blockers.h thing into some Android directory, and populate it with empty wrappers - as long as you only use it within Android drivers and not core kernel code or other subsystems you dont maintain.
It's being done all the time and helpful cleanup patches eliminating the stubs are frowned upon (unless the subs are there like for years with no progress and no maintenance in sight).
Putting empty stubs into include/linux/ would be pushing things i think.
In fact sometimes architectures even jump the gun with major kernel features:
we had a dynticks implementation in ARM for years, we had RTLinux stubs in x86 code for quite some time, and we still have perfmon in IA64 - despite the core kernel having gone for a different design.
It's certainly not ideal, but it's certainly a solution that is used every now and then. The less difference there is between trees the easier it becomes to merge - for both sides, both technically and socially.
Quoted 10 lines
Quoted 4 lines
In any case, this is not to suggest that the suspend-blocker bits are 'impossible' to merge. I just say that if you start with your most difficult feature you should not be surprised to be on the receiving end of a 1000+ mails flamewar on lkml ;-)
Yeah, I do understand that we're not making it easy for ourselves here. I think we hit the point where Rafael and Matthew signed off on things and thought "aha, linux-pm maintainers are happy, now we're getting somewhere" only to realize the light at the end of the tunnel was a bit further out than we anticipated ^^
That's a well-known problem on lkml: the light at the end of the tunnel was the other train ;-)
Anyway, i'm not pessimistic at all: _some_ sort of scheme appears to be crystalising out today. Everyone seems to agree now that the main usecases are indeed useful and need handling one way or another - the rest is really just technological discussions how to achieve the mostly-agreed-upon end goal.
The worst situation are features where one side says 'we dont need this kind of functionality at all' - IMO auto/opportunistic-suspend isnt in that situation, fortunately.
Thanks,
Ingo
Quoted 5 lines · Brian Swetland
Yeah, I do understand that we're not making it easy for ourselves here. I think we hit the point where Rafael and Matthew signed off on things and thought "aha, linux-pm maintainers are happy, now we're getting somewhere" only to realize the light at the end of the tunnel was a bit further out than we anticipated ^^
What you missed is that the linux-pm maintainers have relativly little weight in getting things into the kernel. They are gatekeeper, so until they approve it there is basically no chance of getting in, but even changes that they develop and push frequently have a uphill battle to get into the kernel, especially if they would end up touching all drivers. There have been several proposals by the pm team that have been shot down much more completely than wavelocks.
David Lang
Hi!
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
We started here because it's possibly the only api level change we have -- almost everything else is driver or subarch type work or controversial but entirely self-contained (like the binder, which I would be shocked to see ever hit mainline). [...]
So why arent those bits mainline? It's a 1000 times easier to get drivers and small improvements and non-ABI changes upstream.
Quoted 6 lines
Quoted 4 lines
After basically two years of growing your fork (and some attempts to get your drivers into
drivers/staging/- from where they have meanwhile dropped out again) you re-started with the worst possible thing to merge: a big and difficult kernel feature affecting many subsystems. Why?Because a large number of our drivers depend on it.
The dependencies are trivial. Last time I checked, you had about 150KLoC drivers, with about 100 lines depending on wakelock support -- I know, I cleaned it up from staging.
The changes required for merging 150KLoC will be definitely much bigger than 100 lines...
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
This is a bit off the topic of Android flamage, but I thought it would be worth highlighting an example where the current frameworks may still have a deficiency... one that likewise relates to needing to block entry ot a system suspend state, but in this case user-space isn't very involved (just drivers coping with hardware).
The example I wanted to re-post (I've done so in the past) is one where drivers ouldn't really do the right thing, since driver.suspend() wasn't quite powerful enough as a programming interface.
The example works with USB on many ARM SoCs, and similar non-USB examples aren't rare.
- Want to enter a system suspend state, with some USB wakeup sources. USB peripheral waken up by the host, or vice versa.
NOTE ASSUMPTION: there are multiple suspend states supported by the hardware, significantly different in hardware configuration Linux should be able to use more than one such state... (if only because their power savings differ.) This
can mean driver-specific knowledge about those various states.
- The wakeup requires a particular clock to be active, so the USB controller can detect that the
wakeup should trigger, then issue the right signals
triggering the non-USB parts of the system.
Problem: how does the device driver suspend()
method block entry to a suspend state when it can't ensure that clock is going to be active. Magic return code?
There are other issues here too. (Is the target system suspend state one of the ones which doesn't
allow that clock to be active? SoC-specific calls might suffice for this issue.
A number of years ago, this problem was insoluble with the then-current Linux PM and clock frameworks. I've been away from this issue for quite a while now, but don't recall seeing its sub-problems get solved ... If they're now solved, I'll be glad. (I know Kevin's recent OMAP stuff addresses similar issues, but It's OMAP-specific...)
After all these thousands and thousands of emails... I'm not sure how much forward motion has happened.
Do we at least have a clean way that a driver can
reject a system suspend? I've lost track of many
issues, but maybe this could be phrased as a QOS
constraint: the current config of driver X needs
clock Y active to enter the target system suspend
state, driver's suspend() method reports as much. Then the entry to that system state gets blocked if the clock isn't enabled.
(That QOS constraint should be removed when that driver no longer needs to issue wakeups; that's not quite the same as "removed by driver.resume().
This is a bit off the topic of Android flamage, but I thought it would be worth highlighting an example where the current frameworks may still have a deficiency... one that likewise relates to needing to block entry ot a system suspend state, but in this case user-space isn't very involved (just drivers coping with hardware).
The example I wanted to re-post (I've done so in the past) is one where drivers ouldn't really do the right thing, since driver.suspend() wasn't quite powerful enough as a programming interface.
The example works with USB on many ARM SoCs, and similar non-USB examples aren't rare.
- Want to enter a system suspend state, with some USB wakeup sources. USB peripheral waken up by the host, or vice versa.
NOTE ASSUMPTION: there are multiple suspend states supported by the hardware, significantly different in hardware configuration Linux should be able to use more than one such state... (if only because their power savings differ.) This
can mean driver-specific knowledge about those various states.
- The wakeup requires a particular clock to be active, so the USB controller can detect that the
wakeup should trigger, then issue the right signals
triggering the non-USB parts of the system.
Problem: how does the device driver suspend()
method block entry to a suspend state when it can't ensure that clock is going to be active. Magic return code?
There are other issues here too. (Is the target system suspend state one of the ones which doesn't
allow that clock to be active? SoC-specific calls might suffice for this issue.
A number of years ago, this problem was insoluble with the then-current Linux PM and clock frameworks. I've been away from this issue for quite a while now, but don't recall seeing its sub-problems get solved ... If they're now solved, I'll be glad. (I know Kevin's recent OMAP stuff addresses similar issues, but It's OMAP-specific...)
After all these thousands and thousands of emails... I'm not sure how much forward motion has happened.
Do we at least have a clean way that a driver can
reject a system suspend? I've lost track of many
issues, but maybe this could be phrased as a QOS
constraint: the current config of driver X needs
clock Y active to enter the target system suspend
state, driver's suspend() method reports as much. Then the entry to that system state gets blocked if the clock isn't enabled.
(That QOS constraint should be removed when that driver no longer needs to issue wakeups; that's not quite the same as "removed by driver.resume().
Quoted 8 lines · David Brownell
Do we at least have a clean way that a driver can
reject a system suspend? I've lost track of many
issues, but maybe this could be phrased as a QOS
constraint: the current config of driver X needs
clock Y active to enter the target system suspend
state, driver'ssuspend()method reports as much. Then the entry to that system state gets blocked
if the clock isn't enabled.
So in QoS modifications to android patches, the answer is "yes" ... except that the current android patch set didn't actually have this type of wakelock in it.
Android wants an idleness suspend block (or pm qos constraint) that a driver can set to prevent the system idleness power govenor from dropping into a power state too low for the driver, so in USB terms this would prevent the states that shut down the clock. For android, it prevented shutdown of an internal i2c bus.
The one thing that does look difficult is that these power constraints are device (and sometimes SoC) specific. Expressing them in a generic way for the cpu govenors to make sense of might be hard.
Quoted 3 lines
(That QOS constraint should be removed when that driver no longer needs to issue wakeups; that's not quite the same as "removed by
driver.resume().
The USB one needs user input, doesn't it, since user hot plug might (or might not) be one of the wakeup sources.
James
Quoted 20 lines · James Bottomley
Quoted 8 lines · David Brownell
Do we at least have a clean way that a driver can
reject a system suspend? I've lost track of many
issues, but maybe this could be phrased as a QOS
constraint: the current config of driver X needs
clock Y active to enter the target system suspend
state, driver'ssuspend()method reports as much. Then the entry to that system state gets blocked
if the clock isn't enabled.So in QoS modifications to android patches, the answer is "yes" ... except that the current android patch set didn't actually have this type of wakelock in it.
Android wants an idleness suspend block (or pm qos constraint) that a driver can set to prevent the system idleness power govenor from dropping into a power state too low for the driver, so in USB terms this would prevent the states that shut down the clock. For android, it prevented shutdown of an internal i2c bus.
Quoted 3 lines
The one thing that does look difficult is that these power constraints are device (and sometimes SoC) specific. Expressing them in a generic way for the cpu govenors to make sense of might be hard.
Doesn't the clock framework already handle this sort of thing?
Alan Stern
Quoted 20 lines · James Bottomley
Quoted 8 lines · David Brownell
Do we at least have a clean way that a driver can
reject a system suspend? I've lost track of many
issues, but maybe this could be phrased as a QOS
constraint: the current config of driver X needs
clock Y active to enter the target system suspend
state, driver'ssuspend()method reports as much. Then the entry to that system state gets blocked
if the clock isn't enabled.So in QoS modifications to android patches, the answer is "yes" ... except that the current android patch set didn't actually have this type of wakelock in it.
Android wants an idleness suspend block (or pm qos constraint) that a driver can set to prevent the system idleness power govenor from dropping into a power state too low for the driver, so in USB terms this would prevent the states that shut down the clock. For android, it prevented shutdown of an internal i2c bus.
Quoted 3 lines
The one thing that does look difficult is that these power constraints are device (and sometimes SoC) specific. Expressing them in a generic way for the cpu govenors to make sense of might be hard.
Doesn't the clock framework already handle this sort of thing?
Alan Stern
Quoted 7 lines · Alan Stern
Quoted 3 lines · James Bottomley
The one thing that does look difficult is that these power constraints are device (and sometimes SoC) specific. Expressing them in a generic way for the cpu govenors to make sense of might be hard.
Doesn't the clock framework already handle this sort of thing?
The clock framework is implemented independantly for each CPU.
Quoted 7 lines · Alan Stern
Quoted 3 lines · James Bottomley
The one thing that does look difficult is that these power constraints are device (and sometimes SoC) specific. Expressing them in a generic way for the cpu govenors to make sense of might be hard.
Doesn't the clock framework already handle this sort of thing?
The clock framework is implemented independantly for each CPU.
Quoted 22 lines · Alan Stern
Quoted 20 lines · James Bottomley
Quoted 8 lines · David Brownell
Do we at least have a clean way that a driver can
reject a system suspend? I've lost track of many
issues, but maybe this could be phrased as a QOS
constraint: the current config of driver X needs
clock Y active to enter the target system suspend
state, driver'ssuspend()method reports as much. Then the entry to that system state gets blocked
if the clock isn't enabled.So in QoS modifications to android patches, the answer is "yes" ... except that the current android patch set didn't actually have this type of wakelock in it.
Android wants an idleness suspend block (or pm qos constraint) that a driver can set to prevent the system idleness power govenor from dropping into a power state too low for the driver, so in USB terms this would prevent the states that shut down the clock. For android, it prevented shutdown of an internal i2c bus.
Quoted 5 lines
Quoted 3 lines
The one thing that does look difficult is that these power constraints are device (and sometimes SoC) specific. Expressing them in a generic way for the cpu govenors to make sense of might be hard.
Doesn't the clock framework already handle this sort of thing?
Well, there are two elements to "this sort of thing":
1. Allow a driver to request that a given clock not be turned off.
2. Make the cpuidle governors aware of a pending "don't turn off X clock source" so they can keep the system in a state where the clock doesn't get powered down.
As far as I can tell from the code, neither currently exists at the moment.
James
Quoted 22 lines · Alan Stern
Quoted 20 lines · James Bottomley
Quoted 8 lines · David Brownell
Do we at least have a clean way that a driver can
reject a system suspend? I've lost track of many
issues, but maybe this could be phrased as a QOS
constraint: the current config of driver X needs
clock Y active to enter the target system suspend
state, driver'ssuspend()method reports as much. Then the entry to that system state gets blocked
if the clock isn't enabled.So in QoS modifications to android patches, the answer is "yes" ... except that the current android patch set didn't actually have this type of wakelock in it.
Android wants an idleness suspend block (or pm qos constraint) that a driver can set to prevent the system idleness power govenor from dropping into a power state too low for the driver, so in USB terms this would prevent the states that shut down the clock. For android, it prevented shutdown of an internal i2c bus.
Quoted 5 lines
Quoted 3 lines
The one thing that does look difficult is that these power constraints are device (and sometimes SoC) specific. Expressing them in a generic way for the cpu govenors to make sense of might be hard.
Doesn't the clock framework already handle this sort of thing?
Well, there are two elements to "this sort of thing":
1. Allow a driver to request that a given clock not be turned off.
2. Make the cpuidle governors aware of a pending "don't turn off X clock source" so they can keep the system in a state where the clock doesn't get powered down.
As far as I can tell from the code, neither currently exists at the moment.
James
Quoted 10 lines · Mark Brown
Quoted 7 lines · Alan Stern
Quoted 3 lines · James Bottomley
The one thing that does look difficult is that these power constraints are device (and sometimes SoC) specific. Expressing them in a generic way for the cpu govenors to make sense of might be hard.
Doesn't the clock framework already handle this sort of thing?
The clock framework is implemented independantly for each CPU.
That's not an impediment, since drivers' requirements regarding which clocks remain running in which power states are necessarily platform-dependent also.
Quoted 9 lines · James Bottomley
Well, there are two elements to "this sort of thing":
1. Allow a driver to request that a given clock not be turned off.
2. Make the cpuidle governors aware of a pending "don't turn off X clock source" so they can keep the system in a state where the clock doesn't get powered down.As far as I can tell from the code, neither currently exists at the moment.
Well then, can (or should) the clock framework interact with the pm-qos subsystem so that drivers don't have to worry about it?
Alan Stern
Quoted 27 lines · Alan Stern
Quoted 10 lines · Mark Brown
Quoted 7 lines · Alan Stern
Quoted 3 lines · James Bottomley
The one thing that does look difficult is that these power constraints are device (and sometimes SoC) specific. Expressing them in a generic way for the cpu govenors to make sense of might be hard.
Doesn't the clock framework already handle this sort of thing?
The clock framework is implemented independantly for each CPU.
That's not an impediment, since drivers' requirements regarding which clocks remain running in which power states are necessarily platform-dependent also.
Quoted 7 lines · James Bottomley
Well, there are two elements to "this sort of thing":
1. Allow a driver to request that a given clock not be turned off.
2. Make the cpuidle governors aware of a pending "don't turn off X clock source" so they can keep the system in a state where the clock doesn't get powered down.
Quoted 5 lines
Quoted 2 lines
As far as I can tell from the code, neither currently exists at the moment.
Well then, can (or should) the clock framework interact with the pm-qos subsystem so that drivers don't have to worry about it?
So the implementation of this seems to be a bit complex: We could have clockevents_register() do a per clock pm_qos variable but then the cpuidle governors need to know which to listen for so they don't transition to a state too low for them to be active if pm_qos says keep them running. Even if that gets sorted out, how would USB know which platform specific clock source is driving the wakeup events on its bus?
How complex can SoC clocksources be? If it's just a simple binary do/don't potentially stop all clocks, I think it's easy. If SoC's have a hierarchical shutdown sequence, and they really need this to save power, then expressing that generically becomes rather problematic.
James
Quoted 27 lines · Alan Stern
Quoted 10 lines · Mark Brown
Quoted 7 lines · Alan Stern
Quoted 3 lines · James Bottomley
The one thing that does look difficult is that these power constraints are device (and sometimes SoC) specific. Expressing them in a generic way for the cpu govenors to make sense of might be hard.
Doesn't the clock framework already handle this sort of thing?
The clock framework is implemented independantly for each CPU.
That's not an impediment, since drivers' requirements regarding which clocks remain running in which power states are necessarily platform-dependent also.
Quoted 7 lines · James Bottomley
Well, there are two elements to "this sort of thing":
1. Allow a driver to request that a given clock not be turned off.
2. Make the cpuidle governors aware of a pending "don't turn off X clock source" so they can keep the system in a state where the clock doesn't get powered down.
Quoted 5 lines
Quoted 2 lines
As far as I can tell from the code, neither currently exists at the moment.
Well then, can (or should) the clock framework interact with the pm-qos subsystem so that drivers don't have to worry about it?
So the implementation of this seems to be a bit complex: We could have clockevents_register() do a per clock pm_qos variable but then the cpuidle governors need to know which to listen for so they don't transition to a state too low for them to be active if pm_qos says keep them running. Even if that gets sorted out, how would USB know which platform specific clock source is driving the wakeup events on its bus?
How complex can SoC clocksources be? If it's just a simple binary do/don't potentially stop all clocks, I think it's easy. If SoC's have a hierarchical shutdown sequence, and they really need this to save power, then expressing that generically becomes rather problematic.
James
Quoted 7 lines · Alan Stern
Quoted 1 line · Mark Brown
The clock framework is implemented independantly for each CPU.
That's not an impediment, since drivers' requirements regarding which clocks remain running in which power states are necessarily platform-dependent also.
It does mean that you can't make any general statements about what the clock framework does and doesn't do which is what the person I was replying to (the quoting you did as you cut'n'pasted replies to multiple messages seems more than a little confused, sorry) seemed to want.
Quoted 7 lines · Alan Stern
Quoted 1 line · Mark Brown
The clock framework is implemented independantly for each CPU.
That's not an impediment, since drivers' requirements regarding which clocks remain running in which power states are necessarily platform-dependent also.
It does mean that you can't make any general statements about what the clock framework does and doesn't do which is what the person I was replying to (the quoting you did as you cut'n'pasted replies to multiple messages seems more than a little confused, sorry) seemed to want.
Quoted 10 lines · Mark Brown
Quoted 7 lines · Alan Stern
Quoted 3 lines · James Bottomley
The one thing that does look difficult is that these power constraints are device (and sometimes SoC) specific. Expressing them in a generic way for the cpu govenors to make sense of might be hard.
Doesn't the clock framework already handle this sort of thing?
The clock framework is implemented independantly for each CPU.
That's not an impediment, since drivers' requirements regarding which clocks remain running in which power states are necessarily platform-dependent also.
Quoted 9 lines · James Bottomley
Well, there are two elements to "this sort of thing":
1. Allow a driver to request that a given clock not be turned off.
2. Make the cpuidle governors aware of a pending "don't turn off X clock source" so they can keep the system in a state where the clock doesn't get powered down.As far as I can tell from the code, neither currently exists at the moment.
Well then, can (or should) the clock framework interact with the pm-qos subsystem so that drivers don't have to worry about it?
Alan Stern
Quoted 9 lines · James Bottomley
Quoted 2 lines
Do we at least have a clean way that a driver can reject a system suspend? I've lost track of
many
Quoted 2 lines
issues, but maybe this could be phrased as a QOS constraint: the current config of driver X
needs
Quoted 1 line
clock Y active to enter the target system
suspend
Quoted 1 line
state, driver's
suspend()method reports as
Quoted 8 lines
much. Then the entry to
Quoted 2 lines
that system state gets blocked
if the clock isn't enabled.So in QoS modifications to android patches, the answer is "yes" ... except that the current android patch set didn't actually have this type
of wakelock in it.
Except, we're not talking "wakelock" ... :)
So ... no, these cases still have no solution. (I think that's at least five years now.)
Quoted 3 lines
The one thing that does look difficult is that these power constraints
are device (and sometimes SoC) specific.
Exactly why they make good examples for turning up framework limitations... like having overlooked constraints coming from various SoC peripherals.
Quoted 2 lines
Expressing them in a generic way
for the cpu govenors to make sense of might be hard.
Requiring "CPU governors" to be involved in such stuff feels a bit off-course to me. At least, if the involvement is very deep. The constraints are from the integrated peripherals, not (usually) from the CPU
There are plent of places to hang SoC or device specific data, once there's awareness that without such data, (which PCs hide behind ACPI bytecode) the PM framework is missing out on support for some desirable low power modes.
Quoted 6 lines
Quoted 4 lines
(That QOS constraint should be removed when that driver no longer needs to issue wakeups; that's not quite the same as "removed by
driver.resume().The USB one needs user input, doesn't it,
I don't quite see that. The drivers get called in enough places, and they'll know if the system is going to be in a suspend state where they need to be partially
aactive (with various QOS constraints, or they can't work.
Quoted 2 lines
since user hotplug might (or
might not) be one of the wakeup sources.
If it wakes via hotplug, then the driver must already Do The Right Thing; what input would be needed (Beyond changing the cable config)?
Quoted 5 lines
James
--
Quoted 9 lines · James Bottomley
Quoted 2 lines
Do we at least have a clean way that a driver can reject a system suspend? I've lost track of
many
Quoted 2 lines
issues, but maybe this could be phrased as a QOS constraint: the current config of driver X
needs
Quoted 1 line
clock Y active to enter the target system
suspend
Quoted 1 line
state, driver's
suspend()method reports as
Quoted 8 lines
much. Then the entry to
Quoted 2 lines
that system state gets blocked
if the clock isn't enabled.So in QoS modifications to android patches, the answer is "yes" ... except that the current android patch set didn't actually have this type
of wakelock in it.
Except, we're not talking "wakelock" ... :)
So ... no, these cases still have no solution. (I think that's at least five years now.)
Quoted 3 lines
The one thing that does look difficult is that these power constraints
are device (and sometimes SoC) specific.
Exactly why they make good examples for turning up framework limitations... like having overlooked constraints coming from various SoC peripherals.
Quoted 2 lines
Expressing them in a generic way
for the cpu govenors to make sense of might be hard.
Requiring "CPU governors" to be involved in such stuff feels a bit off-course to me. At least, if the involvement is very deep. The constraints are from the integrated peripherals, not (usually) from the CPU
There are plent of places to hang SoC or device specific data, once there's awareness that without such data, (which PCs hide behind ACPI bytecode) the PM framework is missing out on support for some desirable low power modes.
Quoted 6 lines
Quoted 4 lines
(That QOS constraint should be removed when that driver no longer needs to issue wakeups; that's not quite the same as "removed by
driver.resume().The USB one needs user input, doesn't it,
I don't quite see that. The drivers get called in enough places, and they'll know if the system is going to be in a suspend state where they need to be partially
aactive (with various QOS constraints, or they can't work.
Quoted 2 lines
since user hotplug might (or
might not) be one of the wakeup sources.
If it wakes via hotplug, then the driver must already Do The Right Thing; what input would be needed (Beyond changing the cable config)?
Quoted 5 lines
James
--
Quoted 8 lines · David Brownell
Do we at least have a clean way that a driver can
reject a system suspend? I've lost track of many
issues, but maybe this could be phrased as a QOS
constraint: the current config of driver X needs
clock Y active to enter the target system suspend
state, driver'ssuspend()method reports as much. Then the entry to that system state gets blocked
if the clock isn't enabled.
So in QoS modifications to android patches, the answer is "yes" ... except that the current android patch set didn't actually have this type of wakelock in it.
Android wants an idleness suspend block (or pm qos constraint) that a driver can set to prevent the system idleness power govenor from dropping into a power state too low for the driver, so in USB terms this would prevent the states that shut down the clock. For android, it prevented shutdown of an internal i2c bus.
The one thing that does look difficult is that these power constraints are device (and sometimes SoC) specific. Expressing them in a generic way for the cpu govenors to make sense of might be hard.
Quoted 3 lines
(That QOS constraint should be removed when that driver no longer needs to issue wakeups; that's not quite the same as "removed by
driver.resume().
The USB one needs user input, doesn't it, since user hot plug might (or might not) be one of the wakeup sources.
James
Quoted 29 lines · David Brownell
This is a bit off the topic of Android flamage, but I thought it would be worth highlighting an example where the current frameworks may still have a deficiency... one that likewise relates to needing to block entry ot a system suspend state, but in this case user-space isn't very involved (just drivers coping with hardware).
The example I wanted to re-post (I've done so in the past) is one where drivers ouldn't really do the right thing, since
driver.suspend()wasn't quite powerful enough as a programming interface.The example works with USB on many ARM SoCs, and similar non-USB examples aren't rare.
- Want to enter a system suspend state, with some USB wakeup sources. USB peripheral waken up by the host, or vice versa.
NOTE ASSUMPTION: there are multiple suspend states supported by the hardware, significantly different in hardware configuration Linux should be able to use more than one such state... (if only because their power savings differ.) This
can mean driver-specific knowledge about those various states.
Quoted 8 lines
- The wakeup requires a particular clock to be active, so the USB controller can detect that the
wakeup should trigger, then issue the right signals
triggering the non-USB parts of the system.Problem: how does the device driver
suspend()
method block entry to a suspend state when it can't ensure that clock is going to be active. Magic return code?
At the moment, drivers aren't told what suspend state the system is going into. They know the difference between suspend and hibernate, but the PM core doesn't tell drivers whether it's going into standby vs. suspend. (Strictly speaking, those terms apply mostly to ACPI systems and not so much elsewhere. What I'm talking about is the /sys/power/state interface, where the user can write either "standby" or "mem". Drivers aren't told which was written.)
Quoted 4 lines
There are other issues here too. (Is the target system suspend state one of the ones which doesn't
allow that clock to be active? SoC-specific calls might suffice for this issue.
I imagine platforms have to answer all such questions when they decide exactly how they will implement "standby" and "mem".
Quoted 10 lines
A number of years ago, this problem was insoluble with the then-current Linux PM and clock frameworks. I've been away from this issue for quite a while now, but don't recall seeing its sub-problems get solved ... If they're now solved, I'll be glad. (I know Kevin's recent OMAP stuff addresses similar issues, but It's OMAP-specific...)
After all these thousands and thousands of emails... I'm not sure how much forward motion has happened.
I'm not aware of any progress.
Alan Stern
Quoted 29 lines · David Brownell
This is a bit off the topic of Android flamage, but I thought it would be worth highlighting an example where the current frameworks may still have a deficiency... one that likewise relates to needing to block entry ot a system suspend state, but in this case user-space isn't very involved (just drivers coping with hardware).
The example I wanted to re-post (I've done so in the past) is one where drivers ouldn't really do the right thing, since
driver.suspend()wasn't quite powerful enough as a programming interface.The example works with USB on many ARM SoCs, and similar non-USB examples aren't rare.
- Want to enter a system suspend state, with some USB wakeup sources. USB peripheral waken up by the host, or vice versa.
NOTE ASSUMPTION: there are multiple suspend states supported by the hardware, significantly different in hardware configuration Linux should be able to use more than one such state... (if only because their power savings differ.) This
can mean driver-specific knowledge about those various states.
Quoted 8 lines
- The wakeup requires a particular clock to be active, so the USB controller can detect that the
wakeup should trigger, then issue the right signals
triggering the non-USB parts of the system.Problem: how does the device driver
suspend()
method block entry to a suspend state when it can't ensure that clock is going to be active. Magic return code?
At the moment, drivers aren't told what suspend state the system is going into. They know the difference between suspend and hibernate, but the PM core doesn't tell drivers whether it's going into standby vs. suspend. (Strictly speaking, those terms apply mostly to ACPI systems and not so much elsewhere. What I'm talking about is the /sys/power/state interface, where the user can write either "standby" or "mem". Drivers aren't told which was written.)
Quoted 4 lines
There are other issues here too. (Is the target system suspend state one of the ones which doesn't
allow that clock to be active? SoC-specific calls might suffice for this issue.
I imagine platforms have to answer all such questions when they decide exactly how they will implement "standby" and "mem".
Quoted 10 lines
A number of years ago, this problem was insoluble with the then-current Linux PM and clock frameworks. I've been away from this issue for quite a while now, but don't recall seeing its sub-problems get solved ... If they're now solved, I'll be glad. (I know Kevin's recent OMAP stuff addresses similar issues, but It's OMAP-specific...)
After all these thousands and thousands of emails... I'm not sure how much forward motion has happened.
I'm not aware of any progress.
Alan Stern
Hi!
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
We started here because it's possibly the only api level change we have -- almost everything else is driver or subarch type work or controversial but entirely self-contained (like the binder, which I would be shocked to see ever hit mainline). [...]
So why arent those bits mainline? It's a 1000 times easier to get drivers and small improvements and non-ABI changes upstream.
Quoted 6 lines
Quoted 4 lines
After basically two years of growing your fork (and some attempts to get your drivers into
drivers/staging/- from where they have meanwhile dropped out again) you re-started with the worst possible thing to merge: a big and difficult kernel feature affecting many subsystems. Why?Because a large number of our drivers depend on it.
The dependencies are trivial. Last time I checked, you had about 150KLoC drivers, with about 100 lines depending on wakelock support -- I know, I cleaned it up from staging.
The changes required for merging 150KLoC will be definitely much bigger than 100 lines...
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 7 lines · Ingo Molnar
Quoted 5 lines · Brian Swetland
We started here because it's possibly the only api level change we have -- almost everything else is driver or subarch type work or controversial but entirely self-contained (like the binder, which I would be shocked to see ever hit mainline). [...]
Quoted 7 lines
So why arent those bits mainline? It's a 1000 times easier to get drivers and small improvements and non-ABI changes upstream.
After basically two years of growing your fork (and some attempts to get your drivers into
drivers/staging/- from where they have meanwhile dropped out again) you re-started with the worst possible thing to merge: a big and difficult kernel feature affecting many subsystems. Why?
Because a large number of our drivers depend on it.
Quoted 12 lines
This is one of the fundamental problems here. People simply dont know you, because you have not worked with us much - and hence they dont trust you positively out of box - they are neutral at best.
And believe me, it's hard enough to get difficult features upstream if people _do_ know you and when they positively _do_ trust you ... Arent you talking to Andrew Morton about how to do these things properly? This is kernel contribution 101 really.
Quoted 2 lines
[...] Assertions have been made that because the "android kernel" (not a term I like -- linux is linux, we have some assorted patches on top) [...]
Quoted 6 lines
I've been tracking android-common and android-msm for a while and i have to say that it shows a very lackluster attitude towards upstream:
- The latest branches i can see are v2.6.32 based today. We are in the v2.6.35 stabilization cycle and are developing v2.6.36. I.e. your upstream base is about a year too old.
We have some branch naming confusion and work going on in experimental, but our active work right now is against 2.6.34 and 2.6.35-rc. The tegra2 work has been very aggressively following mainline (rebasing against 2.6.34rc as they were getting underway), and we've been sending those patches out for review, in hopes of getting that tree off on a better foot.
Quoted 20 lines
- The last commit is a couple of weeks old AFAICS.
- The diffstat of android-common/android-2.6.32 is:
890 files changed, 39962 insertions(+), 6286 deletions(-)Those assorted patches have spread over nearly a thousand files. FYI, by the looks of it you are facing an exponentially worsening maintenance overhead curve here.
Is there perhaps some other tree i should be following? I'm looking at:
[remote "android-msm"]
url =git://android.git.kernel.org/kernel/msm.git
fetch = +refs/heads/*:refs/remotes/android-msm/* [remote "android-common"]
url =git://android.git.kernel.org/kernel/common.git
fetch = +refs/heads/*:refs/remotes/android-common/*
Quoted 2 lines
Btw., the commits i've glanced at looked mostly clean and well structured, so i see no fundamental reason why this couldn't be done better.
I think the fundamental issue we keep bumping into is the turnaround time on patch review / inclusion (again we're trying to get things going much earlier on tegra2 to hopefully have less pain there). We aim for kernel style compliance (though we're not perfect and we make our share of mistakes), but previously when I tried sending mach-msm stuff out, it seemed infeasible to send 30-60+ patches, so we'd start with 5-10, feedback would trickle in over the course of a week, I'd respin, etc. After a couple weeks some stuff would get picked up toward a merge window but the rest would have to wait. And then we hit crunch to ship, etc, and get behind.
Totally our fault that we're not just constantly pushing patches (and we're trying to get a fulltime engineer or two just to work on upstream related stuff), but we rapidly hit the point where what we're sending up is a drop in the bucket compared to the work we're doing and things keep diverging, etc.
I'm told this happens to everyone, is common, etc. We're (seriously) a small team, trying to ship multiple products a year and keep our head above water here, and unfortunately that means we keep tabling these projects until we can find some cycles to give it another go and the delta grows.
Quoted 6 lines
Quoted 2 lines
So, we figure, let's sort out the hard problem first and then move on with our lives.
Well, my suggestion would be to first build up a path towards upstream, build up trust, reduce your very high cross section to mainline - and do the most difficult bits last.
Having to maintain two versions of about half our driver code because we depend on an ABI not in mainline is a significant factor for us -- it's difficult to have what's going upstream lag behind our active work (basically we have to maintain two different trees -- one for mainline one for ship) already, but having these codelines also be different makes it worse for us.
Quoted 3 lines
Especially 'move on with our lives' suggests that you just want to get rid of this ABI divergence and continue-as-usual with the pattern of non-cooperation, hm?
I'd like to make some forward progress either to get something wakelock-ish in and shift to whatever that api is, or to get a clear "no not going to happen" and deal with the fallout there.
...
Sadly, for mach-msm, we're now further out due to maintainership shifts (Daniel stepped up to do msm stuff, is pushing up some hybrid of our work and Qualcomm's work that doesn't seem to really fit with either, and I have no idea how to sanely get our stuff to sit on top of that). I'd love to find some time to sit down, clean up the whole msm tree for 8x50/7x30 which is (largely) pretty clean, and is extremely stable and shippable, and try to get it into a patch series and headed upstream, but we're now colliding with the upstream mach-msm which has gone off in a different direction, etc.
Anyway, we continue to try to figure out how to make stuff work better (again, trying some different approaches with tegra2), but so far the process of getting code upstream has been extremely time intensive and rather frustrating and it remains unclear who can sign off on what and how many hoops different people will keep asking us to jump through.
Brian
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 12 lines · Brian Swetland
Quoted 3 lines · Ingo Molnar
Sadly the response from the Android team has been 100% uncompromising: either suspend blockers or nothing.
Well, we're willing to accept something that gives us the same functionality (thus rewriting the api several times to meet various objections, current discussions around constraint-based-implementations / pm-qos, etc). We believe we're solving a real problem here and have not seen a counter-proposal that accomplishes the same.
Quoted 3 lines
Suggestions such as "just yell at developers for writing bad apps" or "it's the user's fault if they install a lousy app" or "make your app marketplace more restrictive" are not helpful. [...]
Agreed.
Quoted 2 lines
[...] The technical discussions around alternatives are more so (though I do feel like we're going in circles in places), [...]
Yep.
Quoted 6 lines
[...] which again is why we're still here talking about this (that and Arve is about a billion times more patient and persistent than I am).
We're not interested in massively rearchitecting our userspace to accomplish this (and the "rewrite your userspace!" proposals I've seen have had race conditions and/or significant more complexity than the wakelock model).
Having a somewhat different ABI for achieving things you'll probably have prepare for. I doubt it would result in any large-scale, massive rewrites.
Quoted 9 lines
...
Quoted 2 lines
Also, why did the Android team start its contributions with such a difficult and controversial kernel feature?
We started here because it's possibly the only api level change we have -- almost everything else is driver or subarch type work or controversial but entirely self-contained (like the binder, which I would be shocked to see ever hit mainline). [...]
So why arent those bits mainline? It's a 1000 times easier to get drivers and small improvements and non-ABI changes upstream.
After basically two years of growing your fork (and some attempts to get your drivers into drivers/staging/ - from where they have meanwhile dropped out again) you re-started with the worst possible thing to merge: a big and difficult kernel feature affecting many subsystems. Why?
This is one of the fundamental problems here. People simply dont know you, because you have not worked with us much - and hence they dont trust you positively out of box - they are neutral at best.
And believe me, it's hard enough to get difficult features upstream if people _do_ know you and when they positively _do_ trust you ... Arent you talking to Andrew Morton about how to do these things properly? This is kernel contribution 101 really.
Quoted 2 lines
[...] Assertions have been made that because the "android kernel" (not a term I like -- linux is linux, we have some assorted patches on top) [...]
I've been tracking android-common and android-msm for a while and i have to say that it shows a very lackluster attitude towards upstream:
- The latest branches i can see are v2.6.32 based today. We are in the v2.6.35 stabilization cycle and are developing v2.6.36. I.e. your upstream base is about a year too old.
- The last commit is a couple of weeks old AFAICS.
- The diffstat of android-common/android-2.6.32 is:
890 files changed, 39962 insertions(+), 6286 deletions(-)
Those assorted patches have spread over nearly a thousand files. FYI, by the looks of it you are facing an exponentially worsening maintenance overhead curve here.
Is there perhaps some other tree i should be following? I'm looking at:
[remote "android-msm"]
url = git://android.git.kernel.org/kernel/msm.git
fetch = +refs/heads/*:refs/remotes/android-msm/*
[remote "android-common"]
url = git://android.git.kernel.org/kernel/common.git
fetch = +refs/heads/*:refs/remotes/android-common/*
Btw., the commits i've glanced at looked mostly clean and well structured, so i see no fundamental reason why this couldn't be done better.
Quoted 5 lines
See: http://www.kroah.com/log/linux/android-kernel-problems.html and various other rants about the evil terrible android forks, etc.
So, we figure, let's sort out the hard problem first and then move on with our lives.
Well, my suggestion would be to first build up a path towards upstream, build up trust, reduce your very high cross section to mainline - and do the most difficult bits last.
Especially 'move on with our lives' suggests that you just want to get rid of this ABI divergence and continue-as-usual with the pattern of non-cooperation, hm?
Quoted 5 lines
Quoted 4 lines
There is absolutely _zero_ technical reason why the Android team should present this as as an all-or-nothing effort. Why not merge hw drivers first (with suspend blockers commented or stubbed out), to reduce the fork distance?
Quoted 8 lines
If that's the case then there is no problem and people could stop yelling at us and just submit their drivers. Awesome.
I can't speak for all the nameless silicon vendors Greg represents, that we apparently are preventing from doing this (how? I don't know!), etc, but for my team maintaining multiple versions of drivers is a headache, we'd rather square away the wakelock debate first and figure something out there, as it just seems like a more logical approach. Maybe we're crazy.
It's not crazy, it's just IMHO inefficient and very difficult to do it like that. And you arent the first one to try it like that (people _always_ gravitate towards coming with their most difficult patches first - because they are very often the most useful patches) - it's a non-trivial learning curve IMHO.
Ingo
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 6 lines · Ingo Molnar
Quoted 3 lines · * [email protected] <[email protected]> wrote:
[...] Not only has the source code been made available, but hundreds of engineering hours have been made trying to accomodate the demands of LKML --- and LKML has said no to suspend blockers/wakelocks.
Quoted 6 lines
I dont think you are being fair here, at all.
Firstly, the suspend-blockers feature is not being rejected (fixing and extending suspend is a worthwile goal), it's just that various different schemes have been proposed by the people who'll eventually have to maintain that code down the line.
Btw., i'd like to summarize the scheduler based suspend scheme proposed by Thomas Gleixner, Peter Zijlstra and myself. I found no good summary of it in the big thread, and there are also new elements of the proposal:
- Create a 'deep idle' mode that suspends. This, if all constraints are met, is triggered by the scheduler automatically: just like the other idle modes are triggered currently. This approach fixes the wakeup races because an incoming wakeup event will set need_resched() and abort the suspend.
( This mode can even use the existing suspend code to bring stuff down,
therefore it also solves the pending timer problem and works even on PC style x86. )
- Introduce a 'minimum wakeup latency' task attribute (task->latency), settable via a scheduler syscall. This is an ABI that influences the kernel how idle the system can go. (i.e. the equivalent of suspend blockers, just not binary and not system-wide.)
- Solve crappy app confinement via the scheduler:
A first proposal was to use the existing cgroup mechanism, but we found a different and probably more elegant solution:
We can slightly extend the scheduler and introduce another per task 'minimum latency other tasks are allowed to run' scheduling attribute (task->exclude_latency) - set via a scheduler syscall as well. (only settable by privileged tasks - such as the screensaver.)
This allows a task to 'exclude' other tasks that dont have low-latency requirements. Crappy apps would have a large latency value, so they'd be idled out when a privileged task sets the exclusion level low enough.
In the case of Android, this would for example be used by the screensaver to introduce different levels of runnability/idling.
[ Note that this scheme would also be useful in a completely different
scenario, for real-time tasks as well: it would allow extreme-RT tasks to quiescence all lower prio tasks in a controlled manner. (even if the RT task is sleeping) ]
- Controlled auto-suspend: drivers (such as input) could on wakeup automatically set the 'minimum wakeup latency' value of wakee tasks to a lower value. This automatically prevents another auto-suspend in the near
future: up to the point the wakee task increases its latency (via the scheduler syscall) again and allows suspend again.
This means there will be no surprise suspends for a task that may take a bit longer than usual to finish its work. [ Detail: this would only be done for tasks that have a non-default (non-infinity) task->latency value - to prevent the input driver from lowering latency values (and preventing future suspends) just because some unaware apps are running and using input drivers. ]
All in one, this scheme allows everything without exception that suspend-blockers allows and supports all the important usecases:
- allows agressive auto-idling
- has no wakeup races
- allows crappy-app confinement and other finegrained suspend control
- it should be pretty easy to adopt by Android as well, as it goes along similar principles of kernel automatisms combined with user-space controlled task and system attributes.
It's straightforward to adapt and it is also more generic, more clean and more flexible than suspend-blockers.
Please mention any remaining technical issues that may still be are unaddressed.
Thanks,
Ingo
Quoted 4 lines · Ingo Molnar
This allows a task to 'exclude' other tasks that dont have low-latency requirements. Crappy apps would have a large latency value, so they'd be idled out when a privileged task sets the exclusion level low enough.
Quite frankly, this sounds fundamentally broken.
Think deadlock. The high-latency task got a lock, and now you're excluding it because it scheduled away.
So from my perspective, putting that kind of logic deep in the system sounds like the _last_ thing we want to do.
I think it's much saner to have a very targeted suspend blocker that only blocks the opportunistic suspends and has _zero_ interaction with the rest of the system (certainly none at all with core code like the scheduler).
And if somebody then suspends the traditional way (by an actual suspend event, not that opportunistic thing), then the suspend blocker does nothing at all - because it simply doesn't even _exist_ at that level. It's only about the opportunistic suspends.
(I'd further suggest that disk wait and running in kernel mode disable any opportunistic suspend anyway - but that's not about suspend blockers as much as it is about just the opportunistic suspend itself).
Linus
Quoted 10 lines · Linus Torvalds
Quoted 4 lines · Ingo Molnar
This allows a task to 'exclude' other tasks that dont have low-latency requirements. Crappy apps would have a large latency value, so they'd be idled out when a privileged task sets the exclusion level low enough.
Quite frankly, this sounds fundamentally broken.
Think deadlock. The high-latency task got a lock, and now you're excluding it because it scheduled away.
Mail was a bit too long already so i trimmed it at the wrong place :-/
What you say is absolutely true, hence this would be driven via sched_tick() + TIF notifiers - i.e. only ever treat user-mode tasks as 'idle-able'. This can be done with no overhead to the regular fastpaths.
The TIF notifier would be the one scheduling to idle - and would thus do it only to user-mode tasks.
Thanks,
Ingo
Quoted 7 lines · Ingo Molnar
What you say is absolutely true, hence this would be driven via
sched_tick()+ TIF notifiers - i.e. only ever treat user-mode tasks as 'idle-able'. This can be done with no overhead to the regular fastpaths.The TIF notifier would be the one scheduling to idle - and would thus do it only to user-mode tasks.
The thing is, unless there is some _really_ deep other reason to do something like this, I still think it's total overdesign to push any knowledge/choices like this into the scheduler. I'd rather keep things way more independent, less tied to each other and to deep kernel subsystems.
IOW, my personal opinion is that somethng like a suspend (blocker or not) decision simply shouldn't be important enough to be tied into the scheduler. Especially not if it could just be its own layer.
That said, as far as I know, the Android people have mostly been looking at the suspend angle from a single-core standpoint. And I'm not at all convinced that they should hijack the existing "/sys/power/state" thing which is what I think they do now.
And those two things go together. The /sys/power/state thing is a global suspend - which I don't think is appropriate for a opportunistic thing in the first place, especially for multi-core.
A well-designed opportunistic suspend should be a two-phase thing: an opportunistc CPU hotunplug (shutting down cores one by one as the system is idle), and not a "global" event in the first place. And only when you've reached single-core state should you then say "do I suspend the system too".
So I've tried to look a bit at the patches, and my admittedly rough comments so far is
- I really do prefer the "off to the side" approach that the current google opportunistic suspend patches have. As mentioned, I don't think this should be deep in the scheduler. Not at all.
- I do think there are possibly races and CPU idle issues there, but I think they are mainly for the multi-core thing. And I think that's a totally separate issue. Or it _should_ be.
- once you're single-core (whether because you never had more cores to begin with, or because the "opportunistic CPU offlining" has taken down the other cores), I think the suspend-blocker is fine as a concept, and certainly shouldn't need any deep scheduler hooks.
so I'd like to see the opportunistc suspend thing think about CPU offlining, and I'd like to see it disconnect from the existing /sys/power/state. And I'd really not like to involved deep internal kernel hooks into it.
But I'll also admit that maybe I'm not seeing some problems. I've frankly tried to avoid the whole discussion until Andrew pulled me in yesterday.
Linus
Quoted 3 lines · Linus Torvalds
so I'd like to see the opportunistc suspend thing think about CPU offlining
Side note: one reason for me being somewhat interested in the CPU offlining is that I think the Android kind of opportunistic suspend is _not_ likely something I'd like to see on a desktop. But an the "opportunistic CPU offliner"? That might _well_ be useful even outside of any other suspend activity.
If the system is idle (or almost idle) for long times, I would heartily recommend actively shutting down unused cores. Some CPU's are hopefully smart enough to not even need that kind of software management, but I suspect even the really smart ones might be able to take advantage of the kernel saying: "I'm shutting you down, you don't have to worry about latency AT ALL, because I'm keeping another CPU active to do any real work".
I'd also be interested to see if it could even improve single-thread performance if we end up doing the whole SMP->UP "lock" prefix rewriting when the system is idle enough that we'd be better off running just a single core. I dunno - just throwing that out there.
Anyway, the only reason I think this is related is literally because I think that if we know there is only a single CPU active, I think the actual "real" opportunistic suspend is easier. Suddenly you don't have to worry about what happens on other run-queues etc, and whether another CPU is just about to create a suspend block etc.
So I think they tie together, although it's mostly tangential. And as mentioned, I think a opportunistic CPU suspend part is more relevant outside of Android, and thus perhaps more widely interesting.
Linus
Quoted 8 lines · On Thu, 3 Jun 2010 19:26:50 -0700 (PDT) Linus Torvalds…
If the system is idle (or almost idle) for long times, I would heartily recommend actively shutting down unused cores. Some CPU's are hopefully smart enough to not even need that kind of software management, but I suspect even the really smart ones might be able to take advantage of the kernel saying: "I'm shutting you down, you don't have to worry about latency AT ALL, because I'm keeping another CPU active to do any real work".
sadly the reality is that "offline" is actually the same as "deepest C state". At best.
As far as I can see, this is at least true for all Intel and AMD cpus.
And because there's then no power saving (but a performance cost), it's actually a negative for battery life/total energy.
(lots of experiments inside Intel seem to confirm that, it's not just theory)
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 3 lines · Arjan van de Ven
And because there's then no power saving (but a performance cost), it's actually a negative for battery life/total energy.
Including the UP optimizations we do (ie lock prefix removal)? It's possible that I'm just biased by benchmarks, and it's true that Intel has been getting lots better, but the locking costs are very noticeable performance-wise on some benchmarks.
And several CPU's have been held back from going into deepest sleep states by stupid firmware and/or platform bugs.
But hey, if it's not going to help, and people have tried it, I guess I'll have to believe it.
Linus
Quoted 6 lines · Linus Torvalds
Quoted 3 lines · Arjan van de Ven
And because there's then no power saving (but a performance cost), it's actually a negative for battery life/total energy.
Including the UP optimizations we do (ie lock prefix removal)? It's
Those only help the kernel and most workloads do not do enough kernel execution for it to really matter, but spend most of their time in user space.
Even if as kernel programmers we often have a different view, in most cases most cycles are in user space :)
-Andi
Signature · 1 line
[email protected] -- Speaking for myself only.
Quoted 6 lines · Linus Torvalds
Quoted 3 lines · Arjan van de Ven
And because there's then no power saving (but a performance cost), it's actually a negative for battery life/total energy.
Including the UP optimizations we do (ie lock prefix removal)? It's
Those only help the kernel and most workloads do not do enough kernel execution for it to really matter, but spend most of their time in user space.
Even if as kernel programmers we often have a different view, in most cases most cycles are in user space :)
-Andi
Signature · 1 line
[email protected] -- Speaking for myself only.
Quoted 14 lines · Arjan van de Ven
Quoted 7 lines · On Thu, 3 Jun 2010 19:26:50 -0700 (PDT) Linus Torvalds…
If the system is idle (or almost idle) for long times, I would heartily recommend actively shutting down unused cores. Some CPU's are hopefully smart enough to not even need that kind of software management, but I suspect even the really smart ones might be able to take advantage of the kernel saying: "I'm shutting you down, you don't have to worry about latency AT ALL, because I'm keeping another CPU active to do any real work".
sadly the reality is that "offline" is actually the same as "deepest C state". At best.
Quoted 7 lines
As far as I can see, this is at least true for all Intel and AMD cpus.
And because there's then no power saving (but a performance cost), it's actually a negative for battery life/total energy.
(lots of experiments inside Intel seem to confirm that, it's not just theory)
Well, the scheme would only be useful if it's _NOT_ just a deep C4 state, but something that prevents tasks from being woken to that CPU for a good period of time. Hot-unplugging that CPU achieves that (the runqueues are pulled), so i think in Linus's idea makes sense in principle.
[ Or have you done deep-idle experiments to that effect as well? ]
I suspect it all depends on the cost: and our current hot-unplug and hot-replug code is all but cheap ...
Ingo
Quoted 14 lines · Arjan van de Ven
Quoted 7 lines · On Thu, 3 Jun 2010 19:26:50 -0700 (PDT) Linus Torvalds…
If the system is idle (or almost idle) for long times, I would heartily recommend actively shutting down unused cores. Some CPU's are hopefully smart enough to not even need that kind of software management, but I suspect even the really smart ones might be able to take advantage of the kernel saying: "I'm shutting you down, you don't have to worry about latency AT ALL, because I'm keeping another CPU active to do any real work".
sadly the reality is that "offline" is actually the same as "deepest C state". At best.
Quoted 7 lines
As far as I can see, this is at least true for all Intel and AMD cpus.
And because there's then no power saving (but a performance cost), it's actually a negative for battery life/total energy.
(lots of experiments inside Intel seem to confirm that, it's not just theory)
Well, the scheme would only be useful if it's _NOT_ just a deep C4 state, but something that prevents tasks from being woken to that CPU for a good period of time. Hot-unplugging that CPU achieves that (the runqueues are pulled), so i think in Linus's idea makes sense in principle.
[ Or have you done deep-idle experiments to that effect as well? ]
I suspect it all depends on the cost: and our current hot-unplug and hot-replug code is all but cheap ...
Ingo
Quoted 12 lines · Arjan van de Ven
Quoted 8 lines · On Thu, 3 Jun 2010 19:26:50 -0700 (PDT) Linus Torvalds…
If the system is idle (or almost idle) for long times, I would heartily recommend actively shutting down unused cores. Some CPU's are hopefully smart enough to not even need that kind of software management, but I suspect even the really smart ones might be able to take advantage of the kernel saying: "I'm shutting you down, you don't have to worry about latency AT ALL, because I'm keeping another CPU active to do any real work".
Quoted 7 lines
sadly the reality is that "offline" is actually the same as "deepest C state". At best.
As far as I can see, this is at least true for all Intel and AMD cpus.
And because there's then no power saving (but a performance cost), it's actually a negative for battery life/total energy.
I believe that this assumes you are in the 'race to idle' situation where when you finish your work you can shutdown. If the work is ongoing you may never shutdown.
Also, what about the new CPUs where you can ramp up the clockspeed on some cores if you hsut down other cores? that couls also benifit individual threads.
David Lang
Quoted 8 lines · On Thu, 3 Jun 2010 19:26:50 -0700 (PDT) Linus Torvalds…
If the system is idle (or almost idle) for long times, I would heartily recommend actively shutting down unused cores. Some CPU's are hopefully smart enough to not even need that kind of software management, but I suspect even the really smart ones might be able to take advantage of the kernel saying: "I'm shutting you down, you don't have to worry about latency AT ALL, because I'm keeping another CPU active to do any real work".
sadly the reality is that "offline" is actually the same as "deepest C state". At best.
As far as I can see, this is at least true for all Intel and AMD cpus.
And because there's then no power saving (but a performance cost), it's actually a negative for battery life/total energy.
(lots of experiments inside Intel seem to confirm that, it's not just theory)
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 10 lines · Linus Torvalds
Quoted 3 lines · Linus Torvalds
so I'd like to see the opportunistc suspend thing think about CPU offlining
Side note: one reason for me being somewhat interested in the CPU offlining is that I think the Android kind of opportunistic suspend is _not_ likely something I'd like to see on a desktop. But an the "opportunistic CPU offliner"? That might _well_ be useful even outside of any other suspend activity.
When the OLPC was first released there was talk that the hardware was well designed for sleeping (including the ability for the display to keep going even if the system itself shut down), with the idealistic talk of the system possibly sleeping between keystrokes.
things didn't end up working (a couple pieces of hardware ended up not playing well with others), but the concept is still something that could end up impacting users outside of the mobile phone market, even if not on your traditional desktop.
David Lang
Quoted 10 lines · Linus Torvalds
Quoted 3 lines · Linus Torvalds
so I'd like to see the opportunistc suspend thing think about CPU offlining
Side note: one reason for me being somewhat interested in the CPU offlining is that I think the Android kind of opportunistic suspend is _not_ likely something I'd like to see on a desktop. But an the "opportunistic CPU offliner"? That might _well_ be useful even outside of any other suspend activity.
When the OLPC was first released there was talk that the hardware was well designed for sleeping (including the ability for the display to keep going even if the system itself shut down), with the idealistic talk of the system possibly sleeping between keystrokes.
things didn't end up working (a couple pieces of hardware ended up not playing well with others), but the concept is still something that could end up impacting users outside of the mobile phone market, even if not on your traditional desktop.
David Lang
Quoted 16 lines · Linus Torvalds
Quoted 7 lines · Ingo Molnar
What you say is absolutely true, hence this would be driven via
sched_tick()+ TIF notifiers - i.e. only ever treat user-mode tasks as 'idle-able'. This can be done with no overhead to the regular fastpaths.The TIF notifier would be the one scheduling to idle - and would thus do it only to user-mode tasks.
The thing is, unless there is some _really_ deep other reason to do something like this, I still think it's total overdesign to push any knowledge/choices like this into the scheduler. I'd rather keep things way more independent, less tied to each other and to deep kernel subsystems.
Quoted 9 lines
IOW, my personal opinion is that somethng like a suspend (blocker or not) decision simply shouldn't be important enough to be tied into the scheduler. Especially not if it could just be its own layer.
That said, as far as I know, the Android people have mostly been looking at the suspend angle from a single-core standpoint. And I'm not at all convinced that they should hijack the existing "
/sys/power/state" thing which is what I think they do now.
While it is true that we have not used this code on a multi core system yet, I'm not sure why multiple cores codes would affect it. We annotate that works needs to be done before it is safe to suspend, but we don't care which core does the work (or if multiple cores do pieces of it).
Quoted 10 lines
And those two things go together. The
/sys/power/statething is a global suspend - which I don't think is appropriate for a opportunistic thing in the first place, especially for multi-core.A well-designed opportunistic suspend should be a two-phase thing: an opportunistc CPU hotunplug (shutting down cores one by one as the system is idle), and not a "global" event in the first place. And only when you've reached single-core state should you then say "do I suspend the system too".
This seems to fit better into the cpuidle and/or frequency scaling framework.
Quoted 11 lines
So I've tried to look a bit at the patches, and my admittedly rough comments so far is
- I really do prefer the "off to the side" approach that the current google opportunistic suspend patches have. As mentioned, I don't think this should be deep in the scheduler. Not at all.
- I do think there are possibly races and CPU idle issues there, but I think they are mainly for the multi-core thing. And I think that's a totally separate issue. Or it _should_ be.
I'm not aware of any races with multi-core systems unless there are existing problems in suspend. We check if any suspend blockers are active after disable_nonboot_cpus() has returned.
Quoted 7 lines
- once you're single-core (whether because you never had more cores to begin with, or because the "opportunistic CPU offlining" has taken down the other cores), I think the suspend-blocker is fine as a concept, and certainly shouldn't need any deep scheduler hooks.
so I'd like to see the opportunistc suspend thing think about CPU offlining,
I see this as a separate problem. We ignore a single busy CPU for opportunistic suspend, so why should the number of online CPUs matter?
Quoted 2 lines
and I'd like to see it disconnect from the existing
/sys/power/state.
The entry point is not important to us. The current interface is what Rafael wanted instead of the /sys/power/request-state interface which is what we changed it to last year.
Quoted 8 lines
And I'd really not like to involved deep internal kernel hooks into it.
But I'll also admit that maybe I'm not seeing some problems. I've frankly tried to avoid the whole discussion until Andrew pulled me in yesterday.
Linus
Signature · 1 line
Arve Hjønnevåg
Quoted 16 lines · Linus Torvalds
Quoted 7 lines · Ingo Molnar
What you say is absolutely true, hence this would be driven via
sched_tick()+ TIF notifiers - i.e. only ever treat user-mode tasks as 'idle-able'. This can be done with no overhead to the regular fastpaths.The TIF notifier would be the one scheduling to idle - and would thus do it only to user-mode tasks.
The thing is, unless there is some _really_ deep other reason to do something like this, I still think it's total overdesign to push any knowledge/choices like this into the scheduler. I'd rather keep things way more independent, less tied to each other and to deep kernel subsystems.
Quoted 9 lines
IOW, my personal opinion is that somethng like a suspend (blocker or not) decision simply shouldn't be important enough to be tied into the scheduler. Especially not if it could just be its own layer.
That said, as far as I know, the Android people have mostly been looking at the suspend angle from a single-core standpoint. And I'm not at all convinced that they should hijack the existing "
/sys/power/state" thing which is what I think they do now.
While it is true that we have not used this code on a multi core system yet, I'm not sure why multiple cores codes would affect it. We annotate that works needs to be done before it is safe to suspend, but we don't care which core does the work (or if multiple cores do pieces of it).
Quoted 10 lines
And those two things go together. The
/sys/power/statething is a global suspend - which I don't think is appropriate for a opportunistic thing in the first place, especially for multi-core.A well-designed opportunistic suspend should be a two-phase thing: an opportunistc CPU hotunplug (shutting down cores one by one as the system is idle), and not a "global" event in the first place. And only when you've reached single-core state should you then say "do I suspend the system too".
This seems to fit better into the cpuidle and/or frequency scaling framework.
Quoted 11 lines
So I've tried to look a bit at the patches, and my admittedly rough comments so far is
- I really do prefer the "off to the side" approach that the current google opportunistic suspend patches have. As mentioned, I don't think this should be deep in the scheduler. Not at all.
- I do think there are possibly races and CPU idle issues there, but I think they are mainly for the multi-core thing. And I think that's a totally separate issue. Or it _should_ be.
I'm not aware of any races with multi-core systems unless there are existing problems in suspend. We check if any suspend blockers are active after disable_nonboot_cpus() has returned.
Quoted 7 lines
- once you're single-core (whether because you never had more cores to begin with, or because the "opportunistic CPU offlining" has taken down the other cores), I think the suspend-blocker is fine as a concept, and certainly shouldn't need any deep scheduler hooks.
so I'd like to see the opportunistc suspend thing think about CPU offlining,
I see this as a separate problem. We ignore a single busy CPU for opportunistic suspend, so why should the number of online CPUs matter?
Quoted 2 lines
and I'd like to see it disconnect from the existing
/sys/power/state.
The entry point is not important to us. The current interface is what Rafael wanted instead of the /sys/power/request-state interface which is what we changed it to last year.
Quoted 8 lines
And I'd really not like to involved deep internal kernel hooks into it.
But I'll also admit that maybe I'm not seeing some problems. I've frankly tried to avoid the whole discussion until Andrew pulled me in yesterday.
Linus
Signature · 1 line
Arve Hjønnevåg
Quoted 10 lines · Linus Torvalds
[...]
And those two things go together. The
/sys/power/statething is a global suspend - which I don't think is appropriate for a opportunistic thing in the first place, especially for multi-core.A well-designed opportunistic suspend should be a two-phase thing: an opportunistc CPU hotunplug (shutting down cores one by one as the system is idle), and not a "global" event in the first place. And only when you've reached single-core state should you then say "do I suspend the system too".
Shutting a core down would be a natural idle level, and when the last one goes idle we can do the suspend. (it happens as part of suspend anyway)
So on systems that dont want to auto-suspend this would indeed behave like you
suggest: the final core left would run as UP in essence.
Ingo
Quoted 10 lines · Linus Torvalds
[...]
And those two things go together. The
/sys/power/statething is a global suspend - which I don't think is appropriate for a opportunistic thing in the first place, especially for multi-core.A well-designed opportunistic suspend should be a two-phase thing: an opportunistc CPU hotunplug (shutting down cores one by one as the system is idle), and not a "global" event in the first place. And only when you've reached single-core state should you then say "do I suspend the system too".
Shutting a core down would be a natural idle level, and when the last one goes idle we can do the suspend. (it happens as part of suspend anyway)
So on systems that dont want to auto-suspend this would indeed behave like you
suggest: the final core left would run as UP in essence.
Ingo
Quoted 6 lines · Linus Torvalds
Quoted 4 lines · Ingo Molnar
What you say is absolutely true, hence this would be driven via
sched_tick()+ TIF notifiers - i.e. only ever treat user-mode tasks as 'idle-able'. This can be done with no overhead to the regular fastpaths.
Quoted 7 lines
Quoted 2 lines
The TIF notifier would be the one scheduling to idle - and would thus do it only to user-mode tasks.
The thing is, unless there is some _really_ deep other reason to do something like this, I still think it's total overdesign to push any knowledge/choices like this into the scheduler. I'd rather keep things way more independent, less tied to each other and to deep kernel subsystems.
Well, the deep reason as i see it is simply the observation that what the Android auto-suspend code implements via the suspend-blocker patches is an idle driver and user-space scheduler in disguise. (if you count that as a deep enough reason)
I dont mind hacks if they are local and if i dont have to maintain them, but the objection from other folks was that suspend blockers are not that local and not that maintainable. And if (and that's a big if) we have a global effect anyway, then we might as well consider implementing it cleanly:
- A global /sys flag is fundamentally racy and only allows a single user-space actor. Not a problem on mobile phones but sure violates taste buds.
Proper per task latency attributes are not racy - we always know the maximum/minimum values, without user-space interfering with each other.
- When done correctly we might win a couple of new features as well around the fringes:
- Useful for power savings on mobile: crappy apps can be idled on an intermediate level, even before the system goes totally idle. There's no equivalent suspend-blockers feature.
- Useful for real-time tasks that want to idle lower prio tasks when some really important thing is running - even if the real-time task might sleep. This is superior to the 'hog the CPU' kind of hacks that have been used for this purpose before.
- The hacks needed to express a race-free suspend/wakeup cycle are unnatural and stem from the model being a user-space driven idle manager instead of a proper part of task sleep/wakeup.
- None of this code seems to impact any scheduler hotpath (most of it is just a special form of idle driver) - it's all on deeper levels of idle and, at most, in off-line return-to-userspace codepaths. So there's no strong performance reason _against_ some level of integration. There is indeed the coupling effect as you mention, which weighs against.
- i also think Andoid's auto-suspend is a strategic feature to Linux: i think auto/opportunistic suspend will matter more and more, and my guess is that ten years most of our daily systems will be doing auto-suspend and will have proper wakeups from suspend implemented in hardware. Not just phones and gadgets but also portable tablets, book readers, TVs - and i wouldnt mind a non-portable, table sized tablet either ;-)
At which point i'd hate to have some hack of a solution ingrained and ABI-ized with little chance to move user-space to sanity.
But yes, i definitely agree with you that it all comes down to 'do we care':
- If we care we should integrate it intelligently where it belongs
conceptually: the idle drivers and the scheduler.
- If we dont care then we should isolate the hacks as much as possible - and then the current suspend blocker patch-set is definitely a good basis to start. (with perhaps the /sys hackery cleaned up a bit, as you suggested)
I dont favor either of the solutions too deeply - so i personally have not NAK-ed suspend blockers - i just saw a half a dozen semi-NAKs flying from other folks, so tried to help come up with a palatable design.
_If_ most of x86 hardware was able to suspend race-free i think deeper integration would be a slam-dunk - as we could make it work almost everywhere. Sadly only a tiny subset of x86 qualifies, so the argument isnt obvious. Maybe we should pick a variant of suspend blockers and re-examine things in a few years? It being an ABI makes it difficult tho.
What i would personally find unacceptable is to have _neither_ solutions - and the discussion was heading towards that stage really, with both sides digging the trenches of non-cooperation. IMHO we just cannot afford to let this drop on the floor as the feature is immensely useful to Android and thus to Linux at large.
Anyway, i'm glad that it's up to you ;-)
Ingo
Quoted 9 lines · On Thu, 3 Jun 2010 19:16:55 -0700 (PDT) Linus Torvalds…
The thing is, unless there is some _really_ deep other reason to do something like this, I still think it's total overdesign to push any knowledge/choices like this into the scheduler. I'd rather keep things way more independent, less tied to each other and to deep kernel subsystems.
IOW, my personal opinion is that somethng like a suspend (blocker or not) decision simply shouldn't be important enough to be tied into the scheduler. Especially not if it could just be its own layer.
Quoted 9 lines
That said, as far as I know, the Android people have mostly been looking at the suspend angle from a single-core standpoint. And I'm not at all convinced that they should hijack the existing "
/sys/power/state" thing which is what I think they do now.And those two things go together. The
/sys/power/statething is a global suspend - which I don't think is appropriate for a opportunistic thing in the first place, especially for multi-core.
This sounds right.
If there is soo much need for a better solution, it will emerge. With merged suspend blockers or not.
Just my 2 cents.
Quoted 1 line
Linus
Cheers,
Flo
Quoted 9 lines · On Thu, 3 Jun 2010 19:16:55 -0700 (PDT) Linus Torvalds…
The thing is, unless there is some _really_ deep other reason to do something like this, I still think it's total overdesign to push any knowledge/choices like this into the scheduler. I'd rather keep things way more independent, less tied to each other and to deep kernel subsystems.
IOW, my personal opinion is that somethng like a suspend (blocker or not) decision simply shouldn't be important enough to be tied into the scheduler. Especially not if it could just be its own layer.
Quoted 9 lines
That said, as far as I know, the Android people have mostly been looking at the suspend angle from a single-core standpoint. And I'm not at all convinced that they should hijack the existing "
/sys/power/state" thing which is what I think they do now.And those two things go together. The
/sys/power/statething is a global suspend - which I don't think is appropriate for a opportunistic thing in the first place, especially for multi-core.
This sounds right.
If there is soo much need for a better solution, it will emerge. With merged suspend blockers or not.
Just my 2 cents.
Quoted 1 line
Linus
Cheers,
Flo
Quoted 10 lines · Linus Torvalds
Quoted 4 lines · Ingo Molnar
This allows a task to 'exclude' other tasks that dont have low-latency requirements. Crappy apps would have a large latency value, so they'd be idled out when a privileged task sets the exclusion level low enough.
Quite frankly, this sounds fundamentally broken.
Think deadlock. The high-latency task got a lock, and now you're excluding it because it scheduled away.
Mail was a bit too long already so i trimmed it at the wrong place :-/
What you say is absolutely true, hence this would be driven via sched_tick() + TIF notifiers - i.e. only ever treat user-mode tasks as 'idle-able'. This can be done with no overhead to the regular fastpaths.
The TIF notifier would be the one scheduling to idle - and would thus do it only to user-mode tasks.
Thanks,
Ingo
Quoted 4 lines · Ingo Molnar
This allows a task to 'exclude' other tasks that dont have low-latency requirements. Crappy apps would have a large latency value, so they'd be idled out when a privileged task sets the exclusion level low enough.
Quite frankly, this sounds fundamentally broken.
Think deadlock. The high-latency task got a lock, and now you're excluding it because it scheduled away.
So from my perspective, putting that kind of logic deep in the system sounds like the _last_ thing we want to do.
I think it's much saner to have a very targeted suspend blocker that only blocks the opportunistic suspends and has _zero_ interaction with the rest of the system (certainly none at all with core code like the scheduler).
And if somebody then suspends the traditional way (by an actual suspend event, not that opportunistic thing), then the suspend blocker does nothing at all - because it simply doesn't even _exist_ at that level. It's only about the opportunistic suspends.
(I'd further suggest that disk wait and running in kernel mode disable any opportunistic suspend anyway - but that's not about suspend blockers as much as it is about just the opportunistic suspend itself).
Linus
Quoted 9 lines · Ingo Molnar
- Create a 'deep idle' mode that suspends. This, if all constraints are met, is triggered by the scheduler automatically: just like the other idle modes are triggered currently. This approach fixes the wakeup races because an incoming wakeup event will set
need_resched()and abort the suspend.( This mode can even use the existing suspend code to bring stuff down,
therefore it also solves the pending timer problem and works even on PC style x86. )
Note that this does not necessarily have to be implemented as 'execute suspend from the idle task' code: scheduling from the idle task, while can certainly be made to work, is a somewhat recursive concept that we might want to avoid for robustness reasons.
Instead, the 'deepest idle' (suspend) method could consist of a wakeup of a kernel thread (or of any of the existing kernel threads such as the migration thread) - which kernel thread then does a race-free suspend: it offlines all but one CPU [on platforms that need that] and then initiates the suspend - but aborts the attempt if there's any sign of wakeup activity.
Thanks,
Ingo
Quoted 10 lines · Ingo Molnar
Note that this does not necessarily have to be implemented as 'execute suspend from the idle task' code: scheduling from the idle task, while can certainly be made to work, is a somewhat recursive concept that we might want to avoid for robustness reasons.
Instead, the 'deepest idle' (suspend) method could consist of a wakeup of a kernel thread (or of any of the existing kernel threads such as the migration thread) - which kernel thread then does a race-free suspend: it offlines all but one CPU [on platforms that need that] and then initiates the suspend - but aborts the attempt if there's any sign of wakeup activity.
Out of morbid curiosity... A typical sign of wakeup activity is a thread becoming runnable because of expiration of a kernel timer or an I/O completion interrupt. How would the "race-free suspend" thread detect this sort of thing? Indeed, isn't the inability to detect these part of what makes the existing suspend implementation (the freezer in particular) not race-free?
Alan Stern
Quoted 10 lines · Ingo Molnar
Note that this does not necessarily have to be implemented as 'execute suspend from the idle task' code: scheduling from the idle task, while can certainly be made to work, is a somewhat recursive concept that we might want to avoid for robustness reasons.
Instead, the 'deepest idle' (suspend) method could consist of a wakeup of a kernel thread (or of any of the existing kernel threads such as the migration thread) - which kernel thread then does a race-free suspend: it offlines all but one CPU [on platforms that need that] and then initiates the suspend - but aborts the attempt if there's any sign of wakeup activity.
Out of morbid curiosity... A typical sign of wakeup activity is a thread becoming runnable because of expiration of a kernel timer or an I/O completion interrupt. How would the "race-free suspend" thread detect this sort of thing? Indeed, isn't the inability to detect these part of what makes the existing suspend implementation (the freezer in particular) not race-free?
Alan Stern
Quoted 9 lines · Ingo Molnar
- Create a 'deep idle' mode that suspends. This, if all constraints are met, is triggered by the scheduler automatically: just like the other idle modes are triggered currently. This approach fixes the wakeup races because an incoming wakeup event will set
need_resched()and abort the suspend.( This mode can even use the existing suspend code to bring stuff down,
therefore it also solves the pending timer problem and works even on PC style x86. )
Note that this does not necessarily have to be implemented as 'execute suspend from the idle task' code: scheduling from the idle task, while can certainly be made to work, is a somewhat recursive concept that we might want to avoid for robustness reasons.
Instead, the 'deepest idle' (suspend) method could consist of a wakeup of a kernel thread (or of any of the existing kernel threads such as the migration thread) - which kernel thread then does a race-free suspend: it offlines all but one CPU [on platforms that need that] and then initiates the suspend - but aborts the attempt if there's any sign of wakeup activity.
Thanks,
Ingo
Quoted 3 lines · On Fri, 4 Jun 2010 01:23:02 +0200 Ingo Molnar <[email protected]> wrote:
Btw., i'd like to summarize the scheduler based suspend scheme proposed by Thomas Gleixner, Peter Zijlstra and myself. I found no good summary of it in the big thread, and there are also new elements of the proposal:
Hi
I would like to summarise the alternate proposal that I an others have suggested in a variety of different forms.
It starts from the premise that
1/ Android developers actually like the "big hammer" aspect of suspend.
Initiating suspend powers down some devices, puts others in low power states, freezes all processes and generally puts the device to sleep with a well defined and easily controlled (at the whole-of-system level) set of events that will wake from suspend. This is a big part of the Android approach to power-saving and I'm guessing they are not keen to depart from it.
2/ The main problem with using suspend as-is is that it is racy.
The purpose of suspend is to put the device to sleep until a wake-event occurs. When that wake-event occurs at much the same time that suspend is requested races can occur. We want a wake-event to not only wake the device, to be keep the device awake while the wake-event is being handled, and to cancel any suspend that was initiated before the wake event completed.
We need to understand "wake event" in an holistic sense. If a key press is expected to brighten the screen and make a glyph appear, and if that key press is considered to be a wake-event, then the glyph appearing must also be a part of the wake event. For such a holistic wake-event to fully block/cancel a suspend there much be some mechanism for hand-over of wake-events from kernel-space to user-space.
Given those premises, google's suspend-blocker approach was to allow a kernel thread to initiate suspend whenever nothing was stopping it, and to allow both drivers and user processes to block that suspend while handling a wake event (or anything else that needed to keep the device awake). In this case the hand-over is fairly straight forward as the kernel thread as full knowledge and can easily wait for all sorts of things.
The alternate proposal is simply to have user-space initiate a suspend (as is already possible), user-space processes can then trivially block that suspend through any of a number of IPC approaches, and kernel space drivers can block/abort suspend by explicitly requesting a block.
The variety of alternate proposals comes from a variety of ways to modify the semantics of "ask for a suspend" in such a way that userspace can discover when there are kernel-space blocks, and can wait for them to be released without spinning.
A sample modification (which I think is different to all the ones mentioned so far, and hopefully pulls out the best of them all) is to allow userspace to write e.g. "mem_safe" rather than "mem" to /sys/power/state. The 'safe' implies it is safe from races.
When this is written, the process sleeps in an interruptible state until all in-kernel suspend blocks have been dropped. If any such suspend blocks were found, or if a signal is received, the request aborts. Only if there were no suspend blocks and no pending signals does the suspend progress.
wake-events in the kernel then need to be tracked all the way to user-space, and the in-kernel lock is only dropped when the event is consumed by user-space. User-space must take some sort of lock to ensure no new suspend is requested before consuming any wake-events from the kernel.
I believe this is very close to what android has today, only with a much smaller change to the user-space interface, which I believe to be the thing that has been found most objectionable.
I does still require a degree of event-tracking within the kernel which might still be objectionable - I'm not so sure about different people's positions on that.
Thanks,
NeilBrown
Quoted 3 lines · On Fri, 4 Jun 2010 01:23:02 +0200 Ingo Molnar <[email protected]> wrote:
Btw., i'd like to summarize the scheduler based suspend scheme proposed by Thomas Gleixner, Peter Zijlstra and myself. I found no good summary of it in the big thread, and there are also new elements of the proposal:
Hi
I would like to summarise the alternate proposal that I an others have suggested in a variety of different forms.
It starts from the premise that
1/ Android developers actually like the "big hammer" aspect of suspend.
Initiating suspend powers down some devices, puts others in low power states, freezes all processes and generally puts the device to sleep with a well defined and easily controlled (at the whole-of-system level) set of events that will wake from suspend. This is a big part of the Android approach to power-saving and I'm guessing they are not keen to depart from it.
2/ The main problem with using suspend as-is is that it is racy.
The purpose of suspend is to put the device to sleep until a wake-event occurs. When that wake-event occurs at much the same time that suspend is requested races can occur. We want a wake-event to not only wake the device, to be keep the device awake while the wake-event is being handled, and to cancel any suspend that was initiated before the wake event completed.
We need to understand "wake event" in an holistic sense. If a key press is expected to brighten the screen and make a glyph appear, and if that key press is considered to be a wake-event, then the glyph appearing must also be a part of the wake event. For such a holistic wake-event to fully block/cancel a suspend there much be some mechanism for hand-over of wake-events from kernel-space to user-space.
Given those premises, google's suspend-blocker approach was to allow a kernel thread to initiate suspend whenever nothing was stopping it, and to allow both drivers and user processes to block that suspend while handling a wake event (or anything else that needed to keep the device awake). In this case the hand-over is fairly straight forward as the kernel thread as full knowledge and can easily wait for all sorts of things.
The alternate proposal is simply to have user-space initiate a suspend (as is already possible), user-space processes can then trivially block that suspend through any of a number of IPC approaches, and kernel space drivers can block/abort suspend by explicitly requesting a block.
The variety of alternate proposals comes from a variety of ways to modify the semantics of "ask for a suspend" in such a way that userspace can discover when there are kernel-space blocks, and can wait for them to be released without spinning.
A sample modification (which I think is different to all the ones mentioned so far, and hopefully pulls out the best of them all) is to allow userspace to write e.g. "mem_safe" rather than "mem" to /sys/power/state. The 'safe' implies it is safe from races.
When this is written, the process sleeps in an interruptible state until all in-kernel suspend blocks have been dropped. If any such suspend blocks were found, or if a signal is received, the request aborts. Only if there were no suspend blocks and no pending signals does the suspend progress.
wake-events in the kernel then need to be tracked all the way to user-space, and the in-kernel lock is only dropped when the event is consumed by user-space. User-space must take some sort of lock to ensure no new suspend is requested before consuming any wake-events from the kernel.
I believe this is very close to what android has today, only with a much smaller change to the user-space interface, which I believe to be the thing that has been found most objectionable.
I does still require a degree of event-tracking within the kernel which might still be objectionable - I'm not so sure about different people's positions on that.
Thanks,
NeilBrown
On Thu, Jun 3, 2010 at 4:23 PM, Ingo Molnar <[email protected]> wrote:
...
Quoted 6 lines
- Controlled auto-suspend: drivers (such as input) could on wakeup automatically set the 'minimum wakeup latency' value of wakee tasks to a lower value. This automatically prevents another auto-suspend in the near
future: up to the point the wakee task increases its latency (via the scheduler syscall) again and allows suspend again.
How do you clear the latency value in a safe way? If another wakeup event happens right after your wakee task is done processing the last event and decides to increase its latency, auto suspend will be allowed even though you have an unprocessed wakeup event. Also how do you know which task will read the event if it is not already waiting for it?
Quoted 6 lines
This means there will be no surprise suspends for a task that may take a bit longer than usual to finish its work. [ Detail: this would only be done for tasks that have a non-default (non-infinity)
task->latencyvalue - to prevent the input driver from lowering latency values (and preventing future suspends) just because some unaware apps are running and using input drivers. ]
Don't you need two inifinity values for this?
Signature · 5 lines
Arve Hjønnevåg -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Arve Hj?nnev?g
On Thu, Jun 3, 2010 at 4:23 PM, Ingo Molnar <[email protected]> wrote:
...Quoted 6 lines
?- Controlled auto-suspend: drivers (such as input) could on wakeup ? automatically set the 'minimum wakeup latency' value of wakee tasks to a ? lower value. This automatically prevents another auto-suspend in the near ? future: up to the point the wakee task increases its latency (via the ? scheduler syscall) again and allows suspend again.
Quoted 5 lines
How do you clear the latency value in a safe way? If another wakeup event happens right after your wakee task is done processing the last event and decides to increase its latency, auto suspend will be allowed even though you have an unprocessed wakeup event. Also how do you know which task will read the event if it is not already waiting for it?
The easiest solution would be to not do any of that initially. (If it's ever a concern we could subtract/add without destroying the nesting property)
Why do you need to track input wakeups? It's rather fragile and rather unnecessary - the idle drivers know it very well how to not go into the deepest idle mode already today. We wont hit C8 on laptops when you are using the desktop.
Quoted 8 lines
Quoted 6 lines
? This means there will be no surprise suspends for a task that may take a ? bit longer than usual to finish its work. [ Detail: this would only be done ? for tasks that have a non-default (non-infinity)
task->latencyvalue - to ? prevent the input driver from lowering latency values (and preventing ? future suspends) just because some unaware apps are running and using input ? drivers. ]Don't you need two inifinity values for this?
Yes - any value above the max idle latency in the system will do.
Thanks,
Ingo
Quoted 18 lines · Ingo Molnar
Quoted 9 lines · Arve Hj?nnev?g
On Thu, Jun 3, 2010 at 4:23 PM, Ingo Molnar <[email protected]> wrote:
...Quoted 6 lines
?- Controlled auto-suspend: drivers (such as input) could on wakeup ? automatically set the 'minimum wakeup latency' value of wakee tasks to a ? lower value. This automatically prevents another auto-suspend in the near ? future: up to the point the wakee task increases its latency (via the ? scheduler syscall) again and allows suspend again.
Quoted 5 lines
How do you clear the latency value in a safe way? If another wakeup event happens right after your wakee task is done processing the last event and decides to increase its latency, auto suspend will be allowed even though you have an unprocessed wakeup event. Also how do you know which task will read the event if it is not already waiting for it?
Quoted 4 lines
The easiest solution would be to not do any of that initially. (If it's ever a concern we could subtract/add without destroying the nesting property)
Why do you need to track input wakeups? It's rather fragile and rather
Because we have keys that should always turn the screen on, but the problem is not specific to input events. If we enabled a wakeup event it usually means we need this event to always work, not just when the system is fully awake or fully suspended.
Quoted 4 lines
unnecessary - the idle drivers know it very well how to not go into the deepest idle mode already today. We wont hit C8 on laptops when you are using the desktop.
The whole point allow the use of suspend.
Quoted 15 lines
Quoted 8 lines
Quoted 6 lines
? This means there will be no surprise suspends for a task that may take a ? bit longer than usual to finish its work. [ Detail: this would only be done ? for tasks that have a non-default (non-infinity)
task->latencyvalue - to ? prevent the input driver from lowering latency values (and preventing ? future suspends) just because some unaware apps are running and using input ? drivers. ]Don't you need two inifinity values for this?
Yes - any value above the max idle latency in the system will do.
Thanks,
Ingo
Signature · 1 line
Arve Hjønnevåg
Quoted 9 lines · Arve Hj?nnev?g
Quoted 4 lines
[...]
Why do you need to track input wakeups? It's rather fragile and rather unnecessary [...]
Because we have keys that should always turn the screen on, but the problem is not specific to input events. If we enabled a wakeup event it usually means we need this event to always work, not just when the system is fully awake or fully suspended.
Hm, i cannot follow that generic claim. Could you please point out the problem to me via a specific example? Which task does what, what undesirable thing happens where, etc.
Thanks,
Ingo
Quoted 8 lines · Ingo Molnar
Quoted 5 lines · Arve Hj?nnev?g
Quoted 4 lines
[...]
Why do you need to track input wakeups? It's rather fragile and rather unnecessary [...]
Quoted 9 lines
Quoted 4 lines
Because we have keys that should always turn the screen on, but the problem is not specific to input events. If we enabled a wakeup event it usually means we need this event to always work, not just when the system is fully awake or fully suspended.
Hm, i cannot follow that generic claim. Could you please point out the problem to me via a specific example? Which task does what, what undesirable thing happens where, etc.
We have many wakeup events, and some of them are invisible to the user. For instance on the Nexus One wake up every 10 minutes monitor the battery health. If the user presses a key right after this work has finished and we did not block suspend until userspace could process this key event, we risk suspending before we could turn the screen on, which to the user looks like the key did not work. Another example, the user pressed the power key which turns the screen off and allows suspend. We initiate suspend and a phone call comes in. If we don't block suspend until we processed the incoming phone call notification, the phone may never ring (some devices will send a new message every few seconds for this, so on those devices it would just delay the ringing).
Signature · 1 line
Arve Hjønnevåg
Quoted 28 lines · Arve Hjønnevåg
Quoted 8 lines · Ingo Molnar
Quoted 5 lines · Arve Hj?nnev?g
Quoted 4 lines
[...]
Why do you need to track input wakeups? It's rather fragile and rather unnecessary [...]
Quoted 9 lines
Quoted 4 lines
Because we have keys that should always turn the screen on, but the problem is not specific to input events. If we enabled a wakeup event it usually means we need this event to always work, not just when the system is fully awake or fully suspended.
Hm, i cannot follow that generic claim. Could you please point out the problem to me via a specific example? Which task does what, what undesirable thing happens where, etc.
We have many wakeup events, and some of them are invisible to the user. For instance on the Nexus One wake up every 10 minutes monitor the battery health.
If the user presses a key right after this work
has finished and we did not block suspend until userspace could process this key event, we risk suspending before we could turn the screen on, which to the user looks like the key did not work.
Quoted 7 lines
Another
example, the user pressed the power key which turns the screen off and allows suspend. We initiate suspend and a phone call comes in. If we don't block suspend until we processed the incoming phone call notification, the phone may never ring (some devices will send a new message every few seconds for this, so on those devices it would just delay the ringing).
Right, so in the proposed scheme all these tasks would be executed by trusted processes, and trusted processes will never get frozen and so will never be delayed in processing these events.
Only untrusted code will be frozen. And trusted processes are reliable for thawing the untrusted processes and delivering events to it.
Trusted processes are assumed to be sane and idle when there is nothing for them to do, allowing the machine to go into deep idle states.
2010/6/4 Peter Zijlstra <[email protected]>:
Quoted 37 lines · Arve Hjønnevåg
Quoted 28 lines · Ingo Molnar
Quoted 8 lines · Arve Hj?nnev?g
Quoted 6 lines
Quoted 5 lines
[...]
Why do you need to track input wakeups? It's rather fragile and rather unnecessary [...]
Quoted 9 lines
Quoted 4 lines
Because we have keys that should always turn the screen on, but the problem is not specific to input events. If we enabled a wakeup event it usually means we need this event to always work, not just when the system is fully awake or fully suspended.
Hm, i cannot follow that generic claim. Could you please point out the problem to me via a specific example? Which task does what, what undesirable thing happens where, etc.
We have many wakeup events, and some of them are invisible to the user. For instance on the Nexus One wake up every 10 minutes monitor the battery health.
If the user presses a key right after this work
has finished and we did not block suspend until userspace could process this key event, we risk suspending before we could turn the screen on, which to the user looks like the key did not work.Quoted 7 lines
Another
example, the user pressed the power key which turns the screen off and allows suspend. We initiate suspend and a phone call comes in. If we don't block suspend until we processed the incoming phone call notification, the phone may never ring (some devices will send a new message every few seconds for this, so on those devices it would just delay the ringing).
Quoted 4 lines
Right, so in the proposed scheme all these tasks would be executed by trusted processes, and trusted processes will never get frozen and so will never be delayed in processing these events.
There are many proposes schemes. I assume you mean freezing only untrusted processes and nothing else.
Quoted 3 lines
Only untrusted code will be frozen. And trusted processes are reliable for thawing the untrusted processes and delivering events to it.
I have two problems with this. I don't want to funnel all events trough trusted processes, and I also want to freeze trusted processes.
Quoted 3 lines
Trusted processes are assumed to be sane and idle when there is nothing for them to do, allowing the machine to go into deep idle states.
Neither the kernel nor our trusted user-space code currently meets this criteria.
Signature · 1 line
Arve Hjønnevåg
Quoted 6 lines · Arve Hjønnevåg
Quoted 3 lines
Trusted processes are assumed to be sane and idle when there is nothing for them to do, allowing the machine to go into deep idle states.
Neither the kernel nor our trusted user-space code currently meets this criteria.
Then both need fixing. Really, that's the only sane approach.
Quoted 10 lines · On Sat, 05 Jun 2010 11:54:13 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 7 lines · Arve Hjønnevåg
Quoted 4 lines
Trusted processes are assumed to be sane and idle when there is nothing for them to do, allowing the machine to go into deep idle states.
Neither the kernel nor our trusted user-space code currently meets this criteria.
Then both need fixing. Really, that's the only sane approach.
fwiw... in MeeGo we're seeing quite good idle times (> 1 seconds) without really bad hacks.
the kernel has a set of infrastructure already to help here (range timers, with which you can wakeup-limit untrusted userspace crap), timer slack for legacy background timers, etc etc.
getting to 10 seconds is not in the range of impossibilities to be honest... and that's even without doing things like putting untrusted junk (read: Appstore apps) into a cgroup and do wakeup limiting and cpu time limiting on a cgroup level....
Signature · 7 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Arjan van de Ven
Quoted 6 lines · On Sat, 05 Jun 2010 11:54:13 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 5 lines · Arve Hjønnevåg
Quoted 4 lines
Trusted processes are assumed to be sane and idle when there is nothing for them to do, allowing the machine to go into deep idle states.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Neither the kernel nor our trusted user-space code currently meets this criteria.
Then both need fixing. Really, that's the only sane approach.
fwiw... in MeeGo we're seeing quite good idle times (> 1 seconds) without really bad hacks.
We clearly have different standards for what we consider good. We measure time suspended in minutes or hours, not seconds, and waking up every second or two causes a noticeable decrease in battery life on the hardware we have today.
Quoted 3 lines
the kernel has a set of infrastructure already to help here (range timers, with which you can wakeup-limit untrusted userspace crap), timer slack for legacy background timers, etc etc.
Range timers allows the kernel to align different timers so they don't each bring the cpu out of idle individually. They do not eliminate timers or make individual timers fire less often. For example if you have 10 timers that fire every second on an idle system, without range timers you will most likely have to bring the cpu out of idle 10 times a second, but with range timers you have a chance of waking up only once a second (I say a chance here, since if they are identical they will just chase each other and never catch up).
Quoted 3 lines
getting to 10 seconds is not in the range of impossibilities to be honest... and that's even without doing things like putting untrusted
That is still far short of what we get with suspend (in terms of time).
Quoted 9 lines
junk (read: Appstore apps) into a cgroup and do wakeup limiting and cpu time limiting on a cgroup level....
--
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Signature · 1 line
Arve Hjønnevåg
Quoted 16 lines · On Sat, 5 Jun 2010 14:26:14 -0700 Arve Hjønnevåg <[email protected]> wrote:
Quoted 14 lines · Arjan van de Ven
Quoted 10 lines · On Sat, 05 Jun 2010 11:54:13 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 7 lines · Arve Hjønnevåg
Quoted 4 lines
Trusted processes are assumed to be sane and idle when there is nothing for them to do, allowing the machine to go into deep idle states.
Neither the kernel nor our trusted user-space code currently meets this criteria.
Then both need fixing. Really, that's the only sane approach.
Quoted 8 lines
Quoted 3 lines
fwiw... in MeeGo we're seeing quite good idle times (> 1 seconds) without really bad hacks.
We clearly have different standards for what we consider good. We measure time suspended in minutes or hours, not seconds, and waking up every second or two causes a noticeable decrease in battery life on the hardware we have today.
I guess I'm spoiled working with (unreleased) hardware that knows how to power gate ;-)
Quoted 8 lines
Quoted 4 lines
the kernel has a set of infrastructure already to help here (range timers, with which you can wakeup-limit untrusted userspace crap), timer slack for legacy background timers, etc etc.
Range timers allows the kernel to align different timers so they don't each bring the cpu out of idle individually. They do not eliminate timers or make individual timers fire less often.
you're incorrect.
With range timers you can control the rate at which timers fire just fine.
For example if the Adobe Flash player puts a timer every 10 milliseconds (yes it does that), and you give it a 3.99 seconds range, it will fire its timers every 4 seconds.... unless other activity happens independently, at which point it'll align with that instead.
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 8 lines · Arjan van de Ven
Quoted 5 lines
We clearly have different standards for what we consider good. We measure time suspended in minutes or hours, not seconds, and waking up every second or two causes a noticeable decrease in battery life on the hardware we have today.
I guess I'm spoiled working with (unreleased) hardware that knows how to power gate ;-)
I'm continually surprised by answers like this. We run on hardware that power gates very aggressively and draws in the neighborhood of 1-2mA at the battery when in the lowest state (3-5mA while the radio is connected to the network and paging). Waking up out of that lowest state and executing code every few seconds or (worse) several times a second) will raise your average power consumption. Being able to stay parked at the very bottom for minutes or hours at a time when nothing "interesting" is happening is very useful and can have a significant impact on overall battery life.
Brian
Quoted 10 lines · On Sat, 5 Jun 2010 15:26:36 -0700 Brian Swetland <[email protected]> wrote:
I'm continually surprised by answers like this. We run on hardware that power gates very aggressively and draws in the neighborhood of 1-2mA at the battery when in the lowest state (3-5mA while the radio is connected to the network and paging). Waking up out of that lowest state and executing code every few seconds or (worse) several times a second) will raise your average power consumption. Being able to stay parked at the very bottom for minutes or hours at a time when nothing "interesting" is happening is very useful and can have a significant impact on overall battery life.
It's relatively simple math.
If you wake up for a burst of work, you burn power at the higher level P1 (versus the lower power level P2), for, lets say an average time T, with a relatively small T (few milliseconds at most).
If you wake up X times per second (with X being a fractional number, so can be smaller than 1) the extra power consumption factor is
X * T * P1
-------------------------------
X * T * P1 + (1.0 - X * T) * P2
if you draw a graph of this, for real values of P and T, there's a real point where you hit diminishing returns.
if say T is 5 milliseconds (that's a high amount), and X is 1 wakeup/second, then there's already a 200:1 ratio in time an power.
If X goes to once every 10 seconds (not unreasonable, especially since any real device will pull email and stuff in the backgroudn), you have 2000:1 time and power ratios...
Unless your "on" power is insane high (and hopefully it's not, since you're not turning on the whole device obviously, you do selective power and clock gating)... that "divide by 200 or 2000" makes the whole problem go away.. in the "seconds" range for really low power devices. Not in "hours" range.
On laptops (which have much more poor powermanagement) this point is around 40 milliseconds or so.. but on phone silicon that I've seen, both Intel and others, this is in the 1 to 5 seconds range.
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 37 lines · Arjan van de Ven
Quoted 10 lines · On Sat, 5 Jun 2010 15:26:36 -0700 Brian Swetland <[email protected]> wrote:
I'm continually surprised by answers like this. We run on hardware that power gates very aggressively and draws in the neighborhood of 1-2mA at the battery when in the lowest state (3-5mA while the radio is connected to the network and paging). Waking up out of that lowest state and executing code every few seconds or (worse) several times a second) will raise your average power consumption. Being able to stay parked at the very bottom for minutes or hours at a time when nothing "interesting" is happening is very useful and can have a significant impact on overall battery life.
It's relatively simple math.
If you wake up for a burst of work, you burn power at the higher level P1 (versus the lower power level P2), for, lets say an average time T, with a relatively small T (few milliseconds at most).
If you wake up X times per second (with X being a fractional number, so can be smaller than 1) the extra power consumption factor is
X * T * P1-------------------------------
X * T * P1 + (1.0 - X * T) * P2if you draw a graph of this, for real values of P and T, there's a real point where you hit diminishing returns.
if say T is 5 milliseconds (that's a high amount), and X is 1 wakeup/second, then there's already a 200:1 ratio in time an power.
If X goes to once every 10 seconds (not unreasonable, especially since any real device will pull email and stuff in the backgroudn), you have 2000:1 time and power ratios...
Quoted 5 lines
Unless your "on" power is insane high (and hopefully it's not, since you're not turning on the whole device obviously, you do selective power and clock gating)... that "divide by 200 or 2000" makes the whole problem go away.. in the "seconds" range for really low power devices. Not in "hours" range.
That's the whole problem. Suspend blockers are a binary all on/off approach so you waste power just to get the thing back to "suspend". They unleash the world and some more just to put it back into oblivion with brute force.
Thanks,
tglx
Quoted 37 lines · Arjan van de Ven
Quoted 10 lines · On Sat, 5 Jun 2010 15:26:36 -0700 Brian Swetland <[email protected]> wrote:
I'm continually surprised by answers like this. We run on hardware that power gates very aggressively and draws in the neighborhood of 1-2mA at the battery when in the lowest state (3-5mA while the radio is connected to the network and paging). Waking up out of that lowest state and executing code every few seconds or (worse) several times a second) will raise your average power consumption. Being able to stay parked at the very bottom for minutes or hours at a time when nothing "interesting" is happening is very useful and can have a significant impact on overall battery life.
It's relatively simple math.
If you wake up for a burst of work, you burn power at the higher level P1 (versus the lower power level P2), for, lets say an average time T, with a relatively small T (few milliseconds at most).
If you wake up X times per second (with X being a fractional number, so can be smaller than 1) the extra power consumption factor is
X * T * P1-------------------------------
X * T * P1 + (1.0 - X * T) * P2if you draw a graph of this, for real values of P and T, there's a real point where you hit diminishing returns.
if say T is 5 milliseconds (that's a high amount), and X is 1 wakeup/second, then there's already a 200:1 ratio in time an power.
If X goes to once every 10 seconds (not unreasonable, especially since any real device will pull email and stuff in the backgroudn), you have 2000:1 time and power ratios...
Quoted 5 lines
Unless your "on" power is insane high (and hopefully it's not, since you're not turning on the whole device obviously, you do selective power and clock gating)... that "divide by 200 or 2000" makes the whole problem go away.. in the "seconds" range for really low power devices. Not in "hours" range.
That's the whole problem. Suspend blockers are a binary all on/off approach so you waste power just to get the thing back to "suspend". They unleash the world and some more just to put it back into oblivion with brute force.
Thanks,
tglx
Quoted 27 lines · Arjan van de Ven
Quoted 10 lines · On Sat, 5 Jun 2010 15:26:36 -0700 Brian Swetland <[email protected]> wrote:
I'm continually surprised by answers like this. We run on hardware that power gates very aggressively and draws in the neighborhood of 1-2mA at the battery when in the lowest state (3-5mA while the radio is connected to the network and paging). Waking up out of that lowest state and executing code every few seconds or (worse) several times a second) will raise your average power consumption. Being able to stay parked at the very bottom for minutes or hours at a time when nothing "interesting" is happening is very useful and can have a significant impact on overall battery life.
It's relatively simple math.
If you wake up for a burst of work, you burn power at the higher level P1 (versus the lower power level P2), for, lets say an average time T, with a relatively small T (few milliseconds at most).
If you wake up X times per second (with X being a fractional number, so can be smaller than 1) the extra power consumption factor is
X * T * P1
-------------------------------
X * T * P1 + (1.0 - X * T) * P2
Quoted 6 lines
if you draw a graph of this, for real values of P and T, there's a real point where you hit diminishing returns.
if say T is 5 milliseconds (that's a high amount), and X is 1 wakeup/second, then there's already a 200:1 ratio in time an power.
It is a 200:1 ratio in time not in power.
Quoted 5 lines
If X goes to once every 10 seconds (not unreasonable, especially since any real device will pull email and stuff in the backgroudn), you have 2000:1 time and power ratios...
Unless your "on" power is insane high (and hopefully it's not, since
The absolute "on" power is not relevant to the ratio, the difference between on and off power is. This can easily be 100:1.
Quoted 5 lines
you're not turning on the whole device obviously, you do selective power and clock gating)... that "divide by 200 or 2000" makes the whole problem go away.. in the "seconds" range for really low power devices. Not in "hours" range.
If you improve the low power state, compared to the "on" state wakeup gets worse, not better, but yes the phone hardware we have now does not need to stay idle for hours to get good battery life, the msm hardware at least needs to stay idle for more than a few seconds.
Quoted 14 lines
On laptops (which have much more poor powermanagement) this point is around 40 milliseconds or so.. but on phone silicon that I've seen, both Intel and others, this is in the 1 to 5 seconds range.
--
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Signature · 1 line
Arve Hjønnevåg
Quoted 27 lines · Arjan van de Ven
Quoted 10 lines · On Sat, 5 Jun 2010 15:26:36 -0700 Brian Swetland <[email protected]> wrote:
I'm continually surprised by answers like this. We run on hardware that power gates very aggressively and draws in the neighborhood of 1-2mA at the battery when in the lowest state (3-5mA while the radio is connected to the network and paging). Waking up out of that lowest state and executing code every few seconds or (worse) several times a second) will raise your average power consumption. Being able to stay parked at the very bottom for minutes or hours at a time when nothing "interesting" is happening is very useful and can have a significant impact on overall battery life.
It's relatively simple math.
If you wake up for a burst of work, you burn power at the higher level P1 (versus the lower power level P2), for, lets say an average time T, with a relatively small T (few milliseconds at most).
If you wake up X times per second (with X being a fractional number, so can be smaller than 1) the extra power consumption factor is
X * T * P1
-------------------------------
X * T * P1 + (1.0 - X * T) * P2
Quoted 6 lines
if you draw a graph of this, for real values of P and T, there's a real point where you hit diminishing returns.
if say T is 5 milliseconds (that's a high amount), and X is 1 wakeup/second, then there's already a 200:1 ratio in time an power.
It is a 200:1 ratio in time not in power.
Quoted 5 lines
If X goes to once every 10 seconds (not unreasonable, especially since any real device will pull email and stuff in the backgroudn), you have 2000:1 time and power ratios...
Unless your "on" power is insane high (and hopefully it's not, since
The absolute "on" power is not relevant to the ratio, the difference between on and off power is. This can easily be 100:1.
Quoted 5 lines
you're not turning on the whole device obviously, you do selective power and clock gating)... that "divide by 200 or 2000" makes the whole problem go away.. in the "seconds" range for really low power devices. Not in "hours" range.
If you improve the low power state, compared to the "on" state wakeup gets worse, not better, but yes the phone hardware we have now does not need to stay idle for hours to get good battery life, the msm hardware at least needs to stay idle for more than a few seconds.
Quoted 14 lines
On laptops (which have much more poor powermanagement) this point is around 40 milliseconds or so.. but on phone silicon that I've seen, both Intel and others, this is in the 1 to 5 seconds range.
--
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Signature · 1 line
Arve Hjønnevåg
Quoted 10 lines · On Sat, 5 Jun 2010 15:26:36 -0700 Brian Swetland <[email protected]> wrote:
I'm continually surprised by answers like this. We run on hardware that power gates very aggressively and draws in the neighborhood of 1-2mA at the battery when in the lowest state (3-5mA while the radio is connected to the network and paging). Waking up out of that lowest state and executing code every few seconds or (worse) several times a second) will raise your average power consumption. Being able to stay parked at the very bottom for minutes or hours at a time when nothing "interesting" is happening is very useful and can have a significant impact on overall battery life.
It's relatively simple math.
If you wake up for a burst of work, you burn power at the higher level P1 (versus the lower power level P2), for, lets say an average time T, with a relatively small T (few milliseconds at most).
If you wake up X times per second (with X being a fractional number, so can be smaller than 1) the extra power consumption factor is
X * T * P1
-------------------------------
X * T * P1 + (1.0 - X * T) * P2
if you draw a graph of this, for real values of P and T, there's a real point where you hit diminishing returns.
if say T is 5 milliseconds (that's a high amount), and X is 1 wakeup/second, then there's already a 200:1 ratio in time an power.
If X goes to once every 10 seconds (not unreasonable, especially since any real device will pull email and stuff in the backgroudn), you have 2000:1 time and power ratios...
Unless your "on" power is insane high (and hopefully it's not, since you're not turning on the whole device obviously, you do selective power and clock gating)... that "divide by 200 or 2000" makes the whole problem go away.. in the "seconds" range for really low power devices. Not in "hours" range.
On laptops (which have much more poor powermanagement) this point is around 40 milliseconds or so.. but on phone silicon that I've seen, both Intel and others, this is in the 1 to 5 seconds range.
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 10 lines · Brian Swetland
Quoted 8 lines · Arjan van de Ven
Quoted 5 lines
We clearly have different standards for what we consider good. We measure time suspended in minutes or hours, not seconds, and waking up every second or two causes a noticeable decrease in battery life on the hardware we have today.
I guess I'm spoiled working with (unreleased) hardware that knows how to power gate ;-)
Quoted 9 lines
I'm continually surprised by answers like this. We run on hardware that power gates very aggressively and draws in the neighborhood of 1-2mA at the battery when in the lowest state (3-5mA while the radio is connected to the network and paging). Waking up out of that lowest state and executing code every few seconds or (worse) several times a second) will raise your average power consumption. Being able to stay parked at the very bottom for minutes or hours at a time when nothing "interesting" is happening is very useful and can have a significant impact on overall battery life.
Yes, and if you look at the approach I proposed in this very thread
(http://lkml.org/lkml/2010/6/4/368), it goes exactly in this direction.
And I think it is superior to the opportunistic suspend framework you have right now, because, for example, it doesn't require you to carry out full system resume and full system suspend every once a while to check battery status.
And guess what, suspending and resuming the whole system actually uses energy.
Rafael
Quoted 10 lines · Brian Swetland
Quoted 8 lines · Arjan van de Ven
Quoted 5 lines
We clearly have different standards for what we consider good. We measure time suspended in minutes or hours, not seconds, and waking up every second or two causes a noticeable decrease in battery life on the hardware we have today.
I guess I'm spoiled working with (unreleased) hardware that knows how to power gate ;-)
Quoted 9 lines
I'm continually surprised by answers like this. We run on hardware that power gates very aggressively and draws in the neighborhood of 1-2mA at the battery when in the lowest state (3-5mA while the radio is connected to the network and paging). Waking up out of that lowest state and executing code every few seconds or (worse) several times a second) will raise your average power consumption. Being able to stay parked at the very bottom for minutes or hours at a time when nothing "interesting" is happening is very useful and can have a significant impact on overall battery life.
Yes, and if you look at the approach I proposed in this very thread
(http://lkml.org/lkml/2010/6/4/368), it goes exactly in this direction.
And I think it is superior to the opportunistic suspend framework you have right now, because, for example, it doesn't require you to carry out full system resume and full system suspend every once a while to check battery status.
And guess what, suspending and resuming the whole system actually uses energy.
Rafael
Quoted 8 lines · Arjan van de Ven
Quoted 5 lines
We clearly have different standards for what we consider good. We measure time suspended in minutes or hours, not seconds, and waking up every second or two causes a noticeable decrease in battery life on the hardware we have today.
I guess I'm spoiled working with (unreleased) hardware that knows how to power gate ;-)
I'm continually surprised by answers like this. We run on hardware that power gates very aggressively and draws in the neighborhood of 1-2mA at the battery when in the lowest state (3-5mA while the radio is connected to the network and paging). Waking up out of that lowest state and executing code every few seconds or (worse) several times a second) will raise your average power consumption. Being able to stay parked at the very bottom for minutes or hours at a time when nothing "interesting" is happening is very useful and can have a significant impact on overall battery life.
Brian
2010/6/5 Arjan van de Ven <[email protected]>:
Quoted 41 lines
Quoted 16 lines · On Sat, 5 Jun 2010 14:26:14 -0700 Arve Hjønnevåg <[email protected]> wrote:
Quoted 14 lines · Arjan van de Ven
Quoted 10 lines · On Sat, 05 Jun 2010 11:54:13 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 7 lines · Arve Hjønnevåg
Quoted 4 lines
Trusted processes are assumed to be sane and idle when there is nothing for them to do, allowing the machine to go into deep idle states.
Neither the kernel nor our trusted user-space code currently meets this criteria.
Then both need fixing. Really, that's the only sane approach.
Quoted 8 lines
Quoted 3 lines
fwiw... in MeeGo we're seeing quite good idle times (> 1 seconds) without really bad hacks.
We clearly have different standards for what we consider good. We measure time suspended in minutes or hours, not seconds, and waking up every second or two causes a noticeable decrease in battery life on the hardware we have today.
I guess I'm spoiled working with (unreleased) hardware that knows how to power gate ;-)
Quoted 8 lines
Quoted 4 lines
the kernel has a set of infrastructure already to help here (range timers, with which you can wakeup-limit untrusted userspace crap), timer slack for legacy background timers, etc etc.
Range timers allows the kernel to align different timers so they don't each bring the cpu out of idle individually. They do not eliminate timers or make individual timers fire less often.
Quoted 9 lines
you're incorrect.
With range timers you can control the rate at which timers fire just fine.For example if the Adobe Flash player puts a timer every 10 milliseconds (yes it does that), and you give it a 3.99 seconds range, it will fire its timers every 4 seconds.... unless other activity happens independently, at which point it'll align with that instead.
If you do that what you are delivering is nowhere close to what the app asked for. You don't need range timers for this, you could just as well add 4 seconds to all normal timers.
Signature · 1 line
Arve Hjønnevåg
Quoted 10 lines · On Sat, 5 Jun 2010 15:39:44 -0700 Arve Hjønnevåg <[email protected]> wrote:
Quoted 7 lines
For example if the Adobe Flash player puts a timer every 10 milliseconds (yes it does that), and you give it a 3.99 seconds range, it will fire its timers every 4 seconds.... unless other activity happens independently, at which point it'll align with that instead.
If you do that what you are delivering is nowhere close to what the app asked for.
yeah it feels a little bit suspended
Quoted 2 lines
You don't need range timers for this, you could just as well add 4 seconds to all normal timers.
.. with the difference that with range timers, you naturally align with other activity, so if there's system level activity, the AVERAGE service the app gets is better by a LOT than just adding 4 seconds always.
but you knew that.... just doesn't help your case.
Signature · 7 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
2010/6/5 Arjan van de Ven <[email protected]>:
Quoted 16 lines
Quoted 10 lines · On Sat, 5 Jun 2010 15:39:44 -0700 Arve Hjønnevåg <[email protected]> wrote:
Quoted 7 lines
For example if the Adobe Flash player puts a timer every 10 milliseconds (yes it does that), and you give it a 3.99 seconds range, it will fire its timers every 4 seconds.... unless other activity happens independently, at which point it'll align with that instead.
If you do that what you are delivering is nowhere close to what the app asked for.
yeah it feels a little bit suspended
Quoted 8 lines
Quoted 2 lines
You don't need range timers for this, you could just as well add 4 seconds to all normal timers.
.. with the difference that with range timers, you naturally align with other activity, so if there's system level activity, the AVERAGE service the app gets is better by a LOT than just adding 4 seconds always.
but you knew that.... just doesn't help your case.
So you are saying it is safe to use range timers to radically change the requested timer interval because it does not actually get to the value that you changed it so. But you are also saying that this will allow the system to stay idle for that long. Something does not add up.
Signature · 1 line
Arve Hjønnevåg
2010/6/5 Arjan van de Ven <[email protected]>:
Quoted 16 lines
Quoted 10 lines · On Sat, 5 Jun 2010 15:39:44 -0700 Arve Hjønnevåg <[email protected]> wrote:
Quoted 7 lines
For example if the Adobe Flash player puts a timer every 10 milliseconds (yes it does that), and you give it a 3.99 seconds range, it will fire its timers every 4 seconds.... unless other activity happens independently, at which point it'll align with that instead.
If you do that what you are delivering is nowhere close to what the app asked for.
yeah it feels a little bit suspended
Quoted 8 lines
Quoted 2 lines
You don't need range timers for this, you could just as well add 4 seconds to all normal timers.
.. with the difference that with range timers, you naturally align with other activity, so if there's system level activity, the AVERAGE service the app gets is better by a LOT than just adding 4 seconds always.
but you knew that.... just doesn't help your case.
So you are saying it is safe to use range timers to radically change the requested timer interval because it does not actually get to the value that you changed it so. But you are also saying that this will allow the system to stay idle for that long. Something does not add up.
Signature · 1 line
Arve Hjønnevåg
Quoted 10 lines · On Sat, 5 Jun 2010 15:39:44 -0700 Arve Hjønnevåg <[email protected]> wrote:
Quoted 7 lines
For example if the Adobe Flash player puts a timer every 10 milliseconds (yes it does that), and you give it a 3.99 seconds range, it will fire its timers every 4 seconds.... unless other activity happens independently, at which point it'll align with that instead.
If you do that what you are delivering is nowhere close to what the app asked for.
yeah it feels a little bit suspended
Quoted 2 lines
You don't need range timers for this, you could just as well add 4 seconds to all normal timers.
.. with the difference that with range timers, you naturally align with other activity, so if there's system level activity, the AVERAGE service the app gets is better by a LOT than just adding 4 seconds always.
but you knew that.... just doesn't help your case.
Signature · 7 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
2010/6/6 Arjan van de Ven <[email protected]>:
Quoted 6 lines
Quoted 4 lines · On Sat, 5 Jun 2010 14:26:14 -0700 Arve Hjønnevåg <[email protected]> wrote:
Quoted 3 lines
the kernel has a set of infrastructure already to help here (range timers, with which you can wakeup-limit untrusted userspace crap), timer slack for legacy background timers, etc etc.
Quoted 7 lines
Quoted 3 lines
Range timers allows the kernel to align different timers so they don't each bring the cpu out of idle individually. They do not eliminate timers or make individual timers fire less often.
you're incorrect.
With range timers you can control the rate at which timers fire just fine.
I was wondering... Currently GLib user-space aligns itself to fire burst of work at second boundaries without the need for IPC. But if you want to align beyond one second you need multi-process alignment. Say, one application says: wake me up between 30s and 1m. And the other one says: wake me up between 10m and 20m. They could very well align at some point if there was a central process keeping track of all the timers.
Does the kernel provide something to solve that problem already?
Signature · 1 line
Felipe Contreras
Quoted 23 lines · Felipe Contreras
2010/6/6 Arjan van de Ven <[email protected]>:
Quoted 6 lines
Quoted 4 lines · On Sat, 5 Jun 2010 14:26:14 -0700 Arve Hj?nnev?g <[email protected]> wrote:
Quoted 3 lines
the kernel has a set of infrastructure already to help here (range timers, with which you can wakeup-limit untrusted userspace crap), timer slack for legacy background timers, etc etc.
Quoted 7 lines
Quoted 3 lines
Range timers allows the kernel to align different timers so they don't each bring the cpu out of idle individually. They do not eliminate timers or make individual timers fire less often.
you're incorrect.
With range timers you can control the rate at which timers fire just fine.I was wondering... Currently GLib user-space aligns itself to fire burst of work at second boundaries without the need for IPC. But if you want to align beyond one second you need multi-process alignment. Say, one application says: wake me up between 30s and 1m. And the other one says: wake me up between 10m and 20m. They could very well align at some point if there was a central process keeping track of all the timers.
Quoted 1 line
Does the kernel provide something to solve that problem already?
yes,the kernel will let you say 'wake me in 10m, with a possible delay of up to 10 min' and get woken up between 10 and 20 min
this is what was mentioned earlier in the thread where you could take an app that tries to do something every .1 second and set the kernel to allow the tick to be delayed for up to 3.9 seconds, resulting in a wakeup every 4 seconds if the system is idle. This has the additional advantage that if the system is not idle and other things are causing ticks to take place anyway, this app would get more ticks up to the 10/second it's asking for)
David Lang
2010/6/6 Arjan van de Ven <[email protected]>:
Quoted 6 lines
Quoted 4 lines · On Sat, 5 Jun 2010 14:26:14 -0700 Arve Hjønnevåg <[email protected]> wrote:
Quoted 3 lines
the kernel has a set of infrastructure already to help here (range timers, with which you can wakeup-limit untrusted userspace crap), timer slack for legacy background timers, etc etc.
Quoted 7 lines
Quoted 3 lines
Range timers allows the kernel to align different timers so they don't each bring the cpu out of idle individually. They do not eliminate timers or make individual timers fire less often.
you're incorrect.
With range timers you can control the rate at which timers fire just fine.
I was wondering... Currently GLib user-space aligns itself to fire burst of work at second boundaries without the need for IPC. But if you want to align beyond one second you need multi-process alignment. Say, one application says: wake me up between 30s and 1m. And the other one says: wake me up between 10m and 20m. They could very well align at some point if there was a central process keeping track of all the timers.
Does the kernel provide something to solve that problem already?
Signature · 5 lines
Felipe Contreras _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 16 lines · On Sat, 5 Jun 2010 14:26:14 -0700 Arve Hjønnevåg <[email protected]> wrote:
Quoted 14 lines · Arjan van de Ven
Quoted 10 lines · On Sat, 05 Jun 2010 11:54:13 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 7 lines · Arve Hjønnevåg
Quoted 4 lines
Trusted processes are assumed to be sane and idle when there is nothing for them to do, allowing the machine to go into deep idle states.
Neither the kernel nor our trusted user-space code currently meets this criteria.
Then both need fixing. Really, that's the only sane approach.
Quoted 8 lines
Quoted 3 lines
fwiw... in MeeGo we're seeing quite good idle times (> 1 seconds) without really bad hacks.
We clearly have different standards for what we consider good. We measure time suspended in minutes or hours, not seconds, and waking up every second or two causes a noticeable decrease in battery life on the hardware we have today.
I guess I'm spoiled working with (unreleased) hardware that knows how to power gate ;-)
Quoted 8 lines
Quoted 4 lines
the kernel has a set of infrastructure already to help here (range timers, with which you can wakeup-limit untrusted userspace crap), timer slack for legacy background timers, etc etc.
Range timers allows the kernel to align different timers so they don't each bring the cpu out of idle individually. They do not eliminate timers or make individual timers fire less often.
you're incorrect.
With range timers you can control the rate at which timers fire just fine.
For example if the Adobe Flash player puts a timer every 10 milliseconds (yes it does that), and you give it a 3.99 seconds range, it will fire its timers every 4 seconds.... unless other activity happens independently, at which point it'll align with that instead.
Signature · 7 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
2010/6/5 Arve Hjønnevåg <[email protected]>:
Quoted 15 lines · Arjan van de Ven
Quoted 14 lines
Quoted 10 lines · On Sat, 05 Jun 2010 11:54:13 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 7 lines · Arve Hjønnevåg
Quoted 4 lines
Trusted processes are assumed to be sane and idle when there is nothing for them to do, allowing the machine to go into deep idle states.
Neither the kernel nor our trusted user-space code currently meets this criteria.
Then both need fixing. Really, that's the only sane approach.
Quoted 8 lines
Quoted 3 lines
fwiw... in MeeGo we're seeing quite good idle times (> 1 seconds) without really bad hacks.
We clearly have different standards for what we consider good. We measure time suspended in minutes or hours, not seconds, and waking up every second or two causes a noticeable decrease in battery life on the hardware we have today.
Are you stating that the existing Android implementation enters the suspended state for hours for any of the existing designs?
~Vitaly
Quoted 9 lines · Vitaly Wool
2010/6/5 Arve Hjønnevåg <[email protected]>:
Quoted 5 lines
We clearly have different standards for what we consider good. We measure time suspended in minutes or hours, not seconds, and waking up every second or two causes a noticeable decrease in battery life on the hardware we have today.
Are you stating that the existing Android implementation enters the suspended state for hours for any of the existing designs?
It varies depending on device and usage. The battery monitoring on NexusOne happens every ten minutes, so that's the longest you'll see a N1 suspended for. On a G1 or Dream/myTouch you can see 20-30 minutes between wakeups (depending on network issues and background data sync traffic), and if you have background data sync off those devices can sit in suspend for days at a time (unless you receive a phone call or something). In "airplane mode", with no local alarms, a device can easily sit in the lowest power state for a month or so, until the battery finally runs out.
Brian
Quoted 11 lines · Brian Swetland
Quoted 9 lines · Vitaly Wool
2010/6/5 Arve Hjønnevåg <[email protected]>:
Quoted 5 lines
We clearly have different standards for what we consider good. We measure time suspended in minutes or hours, not seconds, and waking up every second or two causes a noticeable decrease in battery life on the hardware we have today.
Are you stating that the existing Android implementation enters the suspended state for hours for any of the existing designs?
Quoted 9 lines
It varies depending on device and usage. The battery monitoring on NexusOne happens every ten minutes, so that's the longest you'll see a N1 suspended for. On a G1 or Dream/myTouch you can see 20-30 minutes between wakeups (depending on network issues and background data sync traffic), and if you have background data sync off those devices can sit in suspend for days at a time (unless you receive a phone call or something). In "airplane mode", with no local alarms, a device can easily sit in the lowest power state for a month or so, until the battery finally runs out.
That only concerns the case when you have just turned on the phone and left it laying around.
You have to admit that it's not the common case for a smartphone. The common case is that you've played with it for a bit, turning on things like BT/WIFI, running some apps and so on. And doing so you'll end up having wake locks taken from everywhere, so I can hardly see a second of suspend for Nexus.
E. g. when the wireless is connected to an AP, it takes a wake lock which is released on 15 minutes touchscreen inactivity timeout, as far as I can tell. So:
* the system will never hit suspend during this period;
* if the download was ongoing and had not been completed during this period, it will be terminated.
So the bottom line is: the approach is very inflexible. Of course it can give you the best power savings if you turn the Airplane mode on as soon as you switched on the phone, but this is not what a typical user would do.
~Vitaly
Quoted 11 lines · Vitaly Wool
Quoted 10 lines
It varies depending on device and usage. The battery monitoring on NexusOne happens every ten minutes, so that's the longest you'll see a N1 suspended for. On a G1 or Dream/myTouch you can see 20-30 minutes between wakeups (depending on network issues and background data sync traffic), and if you have background data sync off those devices can sit in suspend for days at a time (unless you receive a phone call or something). In "airplane mode", with no local alarms, a device can easily sit in the lowest power state for a month or so, until the battery finally runs out.
Quoted 7 lines
That only concerns the case when you have just turned on the phone and left it laying around.
You have to admit that it's not the common case for a smartphone. The common case is that you've played with it for a bit, turning on things like BT/WIFI, running some apps and so on. And doing so you'll end up having wake locks taken from everywhere, so I can hardly see a second of suspend for Nexus.
The common case for a phone is to be sitting around. Even for heavy smartphone users, unless they power on, use the device screen-on for 4 hours solid or whatnot and drain the battery straight away, the device is going to spend a significant portion of its operating time in screen-off standby modes (conserving power for when you take a call, browse the web, etc).
For typical users on typical android devices, this means the device stays suspended for 5-10 minutes at a time, coming up for air when a network packet (mail sync, im, etc) or alarm (battery monitor) wakes the device briefly. Obviously with the right combination of bad apps you will see a device suspending more rarely.
Quoted 7 lines
E. g. when the wireless is connected to an AP, it takes a wake lock which is released on 15 minutes touchscreen inactivity timeout, as far as I can tell. So:
* the system will never hit suspend during this period;
* if the download was ongoing and had not been completed during this period, it will be terminated.
I'm pretty sure the wifi subsystem does not actually take a wakelock while its connected -- it does have an alarm to spin down wifi after 15 minutes (by default, and user disableable) largely due to power inefficiencies in the wifi solution in some early devices. There's some room for improvement here, obviously. With a decent wifi chipset and implementation, depending on local wifi traffic patterns, you can see power usage competitive to cellular.
Quoted 4 lines
So the bottom line is: the approach is very inflexible. Of course it can give you the best power savings if you turn the Airplane mode on as soon as you switched on the phone, but this is not what a typical user would do.
The savings in airplane mode (apart from preventing data connections, which saves power by preventing data-hungry background apps from doing much) is the difference between standby with radio (3-5mA) and without (1-2mA). I'm not suggesting that airplane mode is a typical case, just using it as in illustration of the more extreme standby case.
Users do like that to work too -- I recall Arve leaving a device in his filing cabinet with the radio off while he was out of the country for three weeks once, and him discovering it was still running with something like 25% battery remaining when he returned.
In any case, I'm saying that suspending for minutes at a time (typical, 10s of minutes or more in some cases, hours in others), does happen and it does represent an improvement over suspending or otherwise entering your lowest power state for seconds at a time.
Brian
Quoted 5 lines · Brian Swetland
The savings in airplane mode (apart from preventing data connections, which saves power by preventing data-hungry background apps from doing much) is the difference between standby with radio (3-5mA) and without (1-2mA). I'm not suggesting that airplane mode is a typical case, just using it as in illustration of the more extreme standby case.
for the sake of discussion, let's say that standby is 5ma and full operation is 500ma and a minimal wakeup is 0.1 sec. these are probably fairly pessimistic numbers.
waking up every second would be awake 10% of the time, so in an hour you would use .9*5mA + .1*500mA = 4.5mA +45mA = 49.5mAH
waking up every 10 seconds would be awake 1% of the time, so in an hour you would use .99*5mA + 0.01*500mA = 4.95mA + 5mA = 9.95mAH
waking up every 100 seconds would be awake 0.1% of the time, so in an hour you would use .999*5mA + 0.001*500mA =4.995mA + 0.5mA = 5.495mAH
waking up every 1000 seconds would be awake 0.01% of the time so in an hour you would use .9999*5mA + 0.0001*500mA = 4.9995mA + 0.05mAH = 5.0495mAH
now if you have a 1000mAH battery (small, but reasonable for a smartphone) your standby life would be
.1 second wakeup (on continuously) = 2 hours
1 second wakup = 20 hours
10 second wakeup = 100 hours
100 second wakeup = 182 hours
1000 second wakeup = 198 hours
if you could shrink the time awake to 0.01 second per wakeup you would shift this all up a category (and avoiding the need to wake everything up to service a timer would help do this)
this effort very definantly has diminishing returns as you go to larger sleep periods as the constant standby power draw becomes more and more dominating. someone mentioned that they were getting the sleep time of normal systems up past the 1 second mark with the 10 second mark looking very attainable. that is where you get the most benifit for whatever changes are needed. getting up to a 2 min sleep time really gives you about all the benifit that you can get, going from there to 15 min makes very little difference.
don't let chasing the best possible sleep time prevent you from considering options that would be good enough in time, but would drastically reduce the maintinance effort (as things could be upstreamed more easily), and would be usable on far more systems.
David Lang
Quoted 5 lines · Brian Swetland
The savings in airplane mode (apart from preventing data connections, which saves power by preventing data-hungry background apps from doing much) is the difference between standby with radio (3-5mA) and without (1-2mA). I'm not suggesting that airplane mode is a typical case, just using it as in illustration of the more extreme standby case.
for the sake of discussion, let's say that standby is 5ma and full operation is 500ma and a minimal wakeup is 0.1 sec. these are probably fairly pessimistic numbers.
waking up every second would be awake 10% of the time, so in an hour you would use .9*5mA + .1*500mA = 4.5mA +45mA = 49.5mAH
waking up every 10 seconds would be awake 1% of the time, so in an hour you would use .99*5mA + 0.01*500mA = 4.95mA + 5mA = 9.95mAH
waking up every 100 seconds would be awake 0.1% of the time, so in an hour you would use .999*5mA + 0.001*500mA =4.995mA + 0.5mA = 5.495mAH
waking up every 1000 seconds would be awake 0.01% of the time so in an hour you would use .9999*5mA + 0.0001*500mA = 4.9995mA + 0.05mAH = 5.0495mAH
now if you have a 1000mAH battery (small, but reasonable for a smartphone) your standby life would be
.1 second wakeup (on continuously) = 2 hours
1 second wakup = 20 hours
10 second wakeup = 100 hours
100 second wakeup = 182 hours
1000 second wakeup = 198 hours
if you could shrink the time awake to 0.01 second per wakeup you would shift this all up a category (and avoiding the need to wake everything up to service a timer would help do this)
this effort very definantly has diminishing returns as you go to larger sleep periods as the constant standby power draw becomes more and more dominating. someone mentioned that they were getting the sleep time of normal systems up past the 1 second mark with the 10 second mark looking very attainable. that is where you get the most benifit for whatever changes are needed. getting up to a 2 min sleep time really gives you about all the benifit that you can get, going from there to 15 min makes very little difference.
don't let chasing the best possible sleep time prevent you from considering options that would be good enough in time, but would drastically reduce the maintinance effort (as things could be upstreamed more easily), and would be usable on far more systems.
David Lang
2010/6/6 <[email protected]>:
Quoted 14 lines · Brian Swetland
if you could shrink the time awake to 0.01 second per wakeup you would shift this all up a category (and avoiding the need to wake everything up to service a timer would help do this)
this effort very definantly has diminishing returns as you go to larger sleep periods as the constant standby power draw becomes more and more dominating. someone mentioned that they were getting the sleep time of normal systems up past the 1 second mark with the 10 second mark looking very attainable. that is where you get the most benifit for whatever changes are needed. getting up to a 2 min sleep time really gives you about all the benifit that you can get, going from there to 15 min makes very little difference.
Quoted 4 lines
don't let chasing the best possible sleep time prevent you from considering options that would be good enough in time, but would drastically reduce the maintinance effort (as things could be upstreamed more easily), and would be usable on far more systems.
Not to mention the fact that there's nothing fundamental that prevents dynamic PM to reach > 15 min idle. It's a matter of time before we find the tools needed. The amount of work that suspend blockers would require to implement properly in user-space other than Android just doesn't match the power savings.
Signature · 1 line
Felipe Contreras
2010/6/6 <[email protected]>:
Quoted 14 lines · Brian Swetland
if you could shrink the time awake to 0.01 second per wakeup you would shift this all up a category (and avoiding the need to wake everything up to service a timer would help do this)
this effort very definantly has diminishing returns as you go to larger sleep periods as the constant standby power draw becomes more and more dominating. someone mentioned that they were getting the sleep time of normal systems up past the 1 second mark with the 10 second mark looking very attainable. that is where you get the most benifit for whatever changes are needed. getting up to a 2 min sleep time really gives you about all the benifit that you can get, going from there to 15 min makes very little difference.
Quoted 4 lines
don't let chasing the best possible sleep time prevent you from considering options that would be good enough in time, but would drastically reduce the maintinance effort (as things could be upstreamed more easily), and would be usable on far more systems.
Not to mention the fact that there's nothing fundamental that prevents dynamic PM to reach > 15 min idle. It's a matter of time before we find the tools needed. The amount of work that suspend blockers would require to implement properly in user-space other than Android just doesn't match the power savings.
Signature · 1 line
Felipe Contreras
Quoted 7 lines · Brian Swetland
The common case for a phone is to be sitting around. Even for heavy smartphone users, unless they power on, use the device screen-on for 4 hours solid or whatnot and drain the battery straight away, the device is going to spend a significant portion of its operating time in screen-off standby modes (conserving power for when you take a call, browse the web, etc).
Sure, but my point was, some non-trivial (still kind of natural for a smartphone) activities with the device will prevent it from suspending for quite some time. Even worse, the suspend wakelock will keep the whole kernel active, as opposed to powering off unused devices separately as it's done in runtime PM. Yep, I know about the "early suspend" type of thing; yet it's excess, not mainlined and lacks granularity.
Quoted 5 lines
For typical users on typical android devices, this means the device stays suspended for 5-10 minutes at a time, coming up for air when a network packet (mail sync, im, etc) or alarm (battery monitor) wakes the device briefly. Obviously with the right combination of bad apps you will see a device suspending more rarely.
Wasn't that you who stated that you so successfully tolerate bad apps with opportunistic suspend that anything of the kind should not really be the case? :)
Quoted 4 lines
Quoted 4 lines
E. g. when the wireless is connected to an AP, it takes a wake lock which is released on 15 minutes touchscreen inactivity timeout, as far as I can tell. So:
Quoted 8 lines
Quoted 3 lines
* the system will never hit suspend during this period;
* if the download was ongoing and had not been completed during this period, it will be terminated.I'm pretty sure the wifi subsystem does not actually take a wakelock while its connected -- it does have an alarm to spin down wifi after 15 minutes (by default, and user disableable) largely due to power inefficiencies in the wifi solution in some early devices.
Oh? How does it make sure it's not powered off while scanning for APs, for instance?
Quoted 4 lines
Users do like that to work too -- I recall Arve leaving a device in his filing cabinet with the radio off while he was out of the country for three weeks once, and him discovering it was still running with something like 25% battery remaining when he returned.
So what you're actually up to is that a user should restart the phone and turn the radio off if he wants to find it running when he's back from a long business trip or something. Nice...
Quoted 4 lines
In any case, I'm saying that suspending for minutes at a time (typical, 10s of minutes or more in some cases, hours in others), does happen and it does represent an improvement over suspending or otherwise entering your lowest power state for seconds at a time.
That's for sure, if _all_ the other parameters *are* *equal*. This is obviously not the case.
~Vitaly
Quoted 7 lines · Brian Swetland
The common case for a phone is to be sitting around. Even for heavy smartphone users, unless they power on, use the device screen-on for 4 hours solid or whatnot and drain the battery straight away, the device is going to spend a significant portion of its operating time in screen-off standby modes (conserving power for when you take a call, browse the web, etc).
Sure, but my point was, some non-trivial (still kind of natural for a smartphone) activities with the device will prevent it from suspending for quite some time. Even worse, the suspend wakelock will keep the whole kernel active, as opposed to powering off unused devices separately as it's done in runtime PM. Yep, I know about the "early suspend" type of thing; yet it's excess, not mainlined and lacks granularity.
Quoted 5 lines
For typical users on typical android devices, this means the device stays suspended for 5-10 minutes at a time, coming up for air when a network packet (mail sync, im, etc) or alarm (battery monitor) wakes the device briefly. Obviously with the right combination of bad apps you will see a device suspending more rarely.
Wasn't that you who stated that you so successfully tolerate bad apps with opportunistic suspend that anything of the kind should not really be the case? :)
Quoted 4 lines
Quoted 4 lines
E. g. when the wireless is connected to an AP, it takes a wake lock which is released on 15 minutes touchscreen inactivity timeout, as far as I can tell. So:
Quoted 8 lines
Quoted 3 lines
* the system will never hit suspend during this period;
* if the download was ongoing and had not been completed during this period, it will be terminated.I'm pretty sure the wifi subsystem does not actually take a wakelock while its connected -- it does have an alarm to spin down wifi after 15 minutes (by default, and user disableable) largely due to power inefficiencies in the wifi solution in some early devices.
Oh? How does it make sure it's not powered off while scanning for APs, for instance?
Quoted 4 lines
Users do like that to work too -- I recall Arve leaving a device in his filing cabinet with the radio off while he was out of the country for three weeks once, and him discovering it was still running with something like 25% battery remaining when he returned.
So what you're actually up to is that a user should restart the phone and turn the radio off if he wants to find it running when he's back from a long business trip or something. Nice...
Quoted 4 lines
In any case, I'm saying that suspending for minutes at a time (typical, 10s of minutes or more in some cases, hours in others), does happen and it does represent an improvement over suspending or otherwise entering your lowest power state for seconds at a time.
That's for sure, if _all_ the other parameters *are* *equal*. This is obviously not the case.
~Vitaly
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 8 lines · Vitaly Wool
Quoted 4 lines · Brian Swetland
In any case, I'm saying that suspending for minutes at a time (typical, 10s of minutes or more in some cases, hours in others), does happen and it does represent an improvement over suspending or otherwise entering your lowest power state for seconds at a time.
That's for sure, if _all_ the other parameters *are* *equal*. This is obviously not the case.
and while it will represent an improvement, is the cost worth the relativly minor benifit that going from 10s of seconds of sleep to 10s of minuites of sleep give you?
a system that wakes up every 10 seconds, but only wakes the portion of the system needed for the wakeup can easily outlast one that wakes up far less frequently, but when it's awake is fully awake.
as an example (taken from this thread).
system A needs to wake up to get a battery reading, store it and go back to sleep, It does so every 10 seconds. But when it does so it only runs the one process and then goes back to sleep.
system B has the same need, but wakes up every 10 minutes. but when it does so it fully wakes up and this allows the mail app to power up the radio, connect to the Internet and start checking for new mail before oppurtunistic sleep shuts things down (causing the mail check to fail)
System A will last considerably longer on a battery than System B.
David Lang
2010/6/6 <[email protected]>:
Quoted 6 lines
as an example (taken from this thread).
system A needs to wake up to get a battery reading, store it and go back to sleep, It does so every 10 seconds. But when it does so it only runs the one process and then goes back to sleep.
Quoted 6 lines
system B has the same need, but wakes up every 10 minutes. but when it does so it fully wakes up and this allows the mail app to power up the radio, connect to the Internet and start checking for new mail before oppurtunistic sleep shuts things down (causing the mail check to fail)
System A will last considerably longer on a battery than System B.
Exactly, thanks for pointing out the specific example :)
~Vitaly
Quoted 13 lines · On Sun, 6 Jun 2010 12:19:08 +0200 Vitaly Wool <[email protected]> wrote:
2010/6/6 <[email protected]>:
Quoted 11 lines
as an example (taken from this thread).
system A needs to wake up to get a battery reading, store it and go back to sleep, It does so every 10 seconds. But when it does so it only runs the one process and then goes back to sleep.
system B has the same need, but wakes up every 10 minutes. but when it does so it fully wakes up and this allows the mail app to power up the radio, connect to the Internet and start checking for new mail before oppurtunistic sleep shuts things down (causing the mail check to fail)
Quoted 5 lines
Quoted 1 line
System A will last considerably longer on a battery than System B.
Exactly, thanks for pointing out the specific example :)
~Vitaly
This does not affect suspend_blockers nor does suspend_blockers interfere with that.
Suspend_blockers allow the system to suspend ("mem">/sys/power/state suspend), when the userspace decides that the device is not in use.
So implementing suspend_blockers support does not impact any optimizations done to either system A nor system B.
Cheers,
Flo
2010/6/6 Florian Mickler <[email protected]>:
Quoted 2 lines
Suspend_blockersallow the system to suspend ("mem">/sys/power/state suspend), when the userspace decides that the device is not in use.
Sorry. What? Blockers allow the system to suspend?
Quoted 2 lines
So implementing
suspend_blockerssupport does not impact any optimizations done to either system A nor system B.
Suspend blockers by themselves are of no use. Completely. So any talks on suspend blockers separated from the sleep policy are completely pointless.
The suspend blockers are of use when the userspace tries to blindly freeze the tasks to enter the suspend state. This way of hammering the system down obviously impacts everything.
~Vitaly
Quoted 22 lines · Florian Mickler
Quoted 13 lines · On Sun, 6 Jun 2010 12:19:08 +0200 Vitaly Wool <[email protected]> wrote:
2010/6/6 <[email protected]>:
Quoted 11 lines
as an example (taken from this thread).
system A needs to wake up to get a battery reading, store it and go back to sleep, It does so every 10 seconds. But when it does so it only runs the one process and then goes back to sleep.
system B has the same need, but wakes up every 10 minutes. but when it does so it fully wakes up and this allows the mail app to power up the radio, connect to the Internet and start checking for new mail before oppurtunistic sleep shuts things down (causing the mail check to fail)
Quoted 5 lines
Quoted 1 line
System A will last considerably longer on a battery than System B.
Exactly, thanks for pointing out the specific example :)
~Vitaly
Quoted 8 lines
This does not affect
suspend_blockersnor doessuspend_blockersinterfere with that.
Suspend_blockersallow the system to suspend ("mem">/sys/power/state suspend), when the userspace decides that the device is not in use.So implementing
suspend_blockerssupport does not impact any optimizations done to either system A nor system B.
Actually, it does.
system A is what's being proposed by kernel developers, where the untrusted stuff is in a different cgroup and what puts the system to sleep is 'normal' power management. It doesn't sleep as long, but when it wakes up the untrusted stuff is still frozen, so it doesn't stay awake long, or do very much.
System B is suspend blockers where you are either awake or asleep, and when you wake up you wake up fully, but oppertunistic sleep can interrupt untrusted processes at any time. The system sleeps longer (as fewer things can wake it), but when it wakes up it's fully awake.
David Lang
Quoted 41 lines · On Sun, 6 Jun 2010 04:14:09 -0700 (PDT) [email protected] wrote:
Quoted 22 lines · Florian Mickler
Quoted 13 lines · On Sun, 6 Jun 2010 12:19:08 +0200 Vitaly Wool <[email protected]> wrote:
2010/6/6 <[email protected]>:
Quoted 11 lines
as an example (taken from this thread).
system A needs to wake up to get a battery reading, store it and go back to sleep, It does so every 10 seconds. But when it does so it only runs the one process and then goes back to sleep.
system B has the same need, but wakes up every 10 minutes. but when it does so it fully wakes up and this allows the mail app to power up the radio, connect to the Internet and start checking for new mail before oppurtunistic sleep shuts things down (causing the mail check to fail)
Quoted 5 lines
Quoted 1 line
System A will last considerably longer on a battery than System B.
Exactly, thanks for pointing out the specific example :)
~Vitaly
Quoted 8 lines
This does not affect
suspend_blockersnor doessuspend_blockersinterfere with that.
Suspend_blockersallow the system to suspend ("mem">/sys/power/state suspend), when the userspace decides that the device is not in use.So implementing
suspend_blockerssupport does not impact any optimizations done to either system A nor system B.Actually, it does.
system A is what's being proposed by kernel developers, where the untrusted stuff is in a different cgroup and what puts the system to sleep is 'normal' power management. It doesn't sleep as long, but when it wakes up the untrusted stuff is still frozen, so it doesn't stay awake long, or do very much.
Quoted 6 lines
System B is suspend blockers where you are either awake or asleep, and when you wake up you wake up fully, but oppertunistic sleep can interrupt untrusted processes at any time. The system sleeps longer (as fewer things can wake it), but when it wakes up it's fully awake.
David Lang
You say, that coming back from suspend takes the system to full power (and everything runs) before it begins the descend into runtime-low-power?
But are you referring to the fact that coming back
from suspend starts in the zero-idle-state (i.e. "consumes extra power") or that all processes run when it is not suspended?
Because the latter would of course (theretically) profit from the framework-controlled-cgroup-freeze/thaw (with and without opportunistic suspend) while the former should be a problem that both opportunistic suspend as well as suspend-from-idle have. Or not?
So, here is the question I'm asking myself: If System A were to be complemented by suspend_blockers, wouldn't it still be better?
With System A you could try to do a really sophisticated power-management scheme and so on... but as soon as you allow 3rd-Party Apps, how do you manage their cross-dependencies? I.e. you can not automatically detect when App1 needs App2 to function.
You need to allow all 3rd-Party apps to run as a group.
So you can perhaps partition your software stack into "untrusted applications" and different groups of software with audited dependencies.
If one group interacts with another group (as will be the case at least with the "untrusted applications" group) you have to have them both running at the same time.
This really gets pretty complex. Do you really think something like this is better than a simple suspend? (I.e. suspend blockers or having just one group)
Suppose you implement suspend blockers with a cgroup freeze... how do you implement the freeze/thaw control?
Cheers,
Flo
p.s.: do you see an possibility for any kind of "priority inheritance" in the cgroup scheme? I don't.
Quoted 49 lines · Florian Mickler
Quoted 46 lines · On Sun, 6 Jun 2010 04:14:09 -0700 (PDT) [email protected] wrote:
Quoted 22 lines · Florian Mickler
Quoted 13 lines · On Sun, 6 Jun 2010 12:19:08 +0200 Vitaly Wool <[email protected]> wrote:
2010/6/6 <[email protected]>:
Quoted 11 lines
as an example (taken from this thread).
system A needs to wake up to get a battery reading, store it and go back to sleep, It does so every 10 seconds. But when it does so it only runs the one process and then goes back to sleep.
system B has the same need, but wakes up every 10 minutes. but when it does so it fully wakes up and this allows the mail app to power up the radio, connect to the Internet and start checking for new mail before oppurtunistic sleep shuts things down (causing the mail check to fail)
Quoted 5 lines
Quoted 1 line
System A will last considerably longer on a battery than System B.
Exactly, thanks for pointing out the specific example :)
~Vitaly
Quoted 8 lines
This does not affect
suspend_blockersnor doessuspend_blockersinterfere with that.
Suspend_blockersallow the system to suspend ("mem">/sys/power/state suspend), when the userspace decides that the device is not in use.So implementing
suspend_blockerssupport does not impact any optimizations done to either system A nor system B.Actually, it does.
system A is what's being proposed by kernel developers, where the untrusted stuff is in a different cgroup and what puts the system to sleep is 'normal' power management. It doesn't sleep as long, but when it wakes up the untrusted stuff is still frozen, so it doesn't stay awake long, or do very much.
System B is suspend blockers where you are either awake or asleep, and when you wake up you wake up fully, but oppertunistic sleep can interrupt untrusted processes at any time. The system sleeps longer (as fewer things can wake it), but when it wakes up it's fully awake.
Quoted 8 lines
Quoted 1 line
David Lang
You say, that coming back from suspend takes the system to full power (and everything runs) before it begins the descend into runtime-low-power?
But are you referring to the fact that coming back
from suspend starts in the zero-idle-state (i.e. "consumes extra power") or that all processes run when it is not suspended?
I am referring to the fact that with suspend blockers and opertunistic suspend all processes start running when it's not suspended (because they were all running when it was suspended)
If instead the system only wakes up the trusted processes to handle whatever woke the system up and is then idle again, it spends less power and time while awake.
Quoted 7 lines
Because the latter would of course (theretically) profit from the framework-controlled-cgroup-freeze/thaw (with and without opportunistic suspend) while the former should be a problem that both opportunistic suspend as well as suspend-from-idle have. Or not?
So, here is the question I'm asking myself: If System A were to be complemented by
suspend_blockers, wouldn't it still be better?
not neccessarily.
having suspend blockers inside the kernel adds significant complexity, it's worth it only if the complexity buys you enough. In this case the question is if the suspend blockers would extend the sleep time enough more to matter. As per my other e-mail, this is an area with rapidly diminishing returns as the sleep times get longer.
Quoted 10 lines
With System A you could try to do a really sophisticated power-management scheme and so on... but as soon as you allow 3rd-Party Apps, how do you manage their cross-dependencies? I.e. you can not automatically detect when App1 needs App2 to function.
You need to allow all 3rd-Party apps to run as a group.So you can perhaps partition your software stack into "untrusted applications" and different groups of software with audited dependencies.
Quoted 7 lines
If one group interacts with another group (as will be the case at least with the "untrusted applications" group) you have to have them both running at the same time.
This really gets pretty complex. Do you really think something like this is better than a simple suspend? (I.e. suspend blockers or having just one group)
even if all you do is have two groups (trusted and untrusted), all you need to do is to watch for the interaction between these two. Put the third-party apps in the untrusted group.
depending on what security you have available, you may be able to define more, smaller groups after using the security to make sure that there is no overlap between them
Quoted 2 lines
Suppose you implement suspend blockers with a cgroup freeze... how do you implement the freeze/thaw control?
I thought the answer had been provided, one of the trusted apps implements the freeze/thaw, and everything happens in userspace.
Quoted 5 lines
Cheers,
Flop.s.: do you see an possibility for any kind of "priority inheritance" in the cgroup scheme? I don't.
is there a need for it?
David Lang
Quoted 49 lines · Florian Mickler
Quoted 46 lines · On Sun, 6 Jun 2010 04:14:09 -0700 (PDT) [email protected] wrote:
Quoted 22 lines · Florian Mickler
Quoted 13 lines · On Sun, 6 Jun 2010 12:19:08 +0200 Vitaly Wool <[email protected]> wrote:
2010/6/6 <[email protected]>:
Quoted 11 lines
as an example (taken from this thread).
system A needs to wake up to get a battery reading, store it and go back to sleep, It does so every 10 seconds. But when it does so it only runs the one process and then goes back to sleep.
system B has the same need, but wakes up every 10 minutes. but when it does so it fully wakes up and this allows the mail app to power up the radio, connect to the Internet and start checking for new mail before oppurtunistic sleep shuts things down (causing the mail check to fail)
Quoted 5 lines
Quoted 1 line
System A will last considerably longer on a battery than System B.
Exactly, thanks for pointing out the specific example :)
~Vitaly
Quoted 8 lines
This does not affect
suspend_blockersnor doessuspend_blockersinterfere with that.
Suspend_blockersallow the system to suspend ("mem">/sys/power/state suspend), when the userspace decides that the device is not in use.So implementing
suspend_blockerssupport does not impact any optimizations done to either system A nor system B.Actually, it does.
system A is what's being proposed by kernel developers, where the untrusted stuff is in a different cgroup and what puts the system to sleep is 'normal' power management. It doesn't sleep as long, but when it wakes up the untrusted stuff is still frozen, so it doesn't stay awake long, or do very much.
System B is suspend blockers where you are either awake or asleep, and when you wake up you wake up fully, but oppertunistic sleep can interrupt untrusted processes at any time. The system sleeps longer (as fewer things can wake it), but when it wakes up it's fully awake.
Quoted 8 lines
Quoted 1 line
David Lang
You say, that coming back from suspend takes the system to full power (and everything runs) before it begins the descend into runtime-low-power?
But are you referring to the fact that coming back
from suspend starts in the zero-idle-state (i.e. "consumes extra power") or that all processes run when it is not suspended?
I am referring to the fact that with suspend blockers and opertunistic suspend all processes start running when it's not suspended (because they were all running when it was suspended)
If instead the system only wakes up the trusted processes to handle whatever woke the system up and is then idle again, it spends less power and time while awake.
Quoted 7 lines
Because the latter would of course (theretically) profit from the framework-controlled-cgroup-freeze/thaw (with and without opportunistic suspend) while the former should be a problem that both opportunistic suspend as well as suspend-from-idle have. Or not?
So, here is the question I'm asking myself: If System A were to be complemented by
suspend_blockers, wouldn't it still be better?
not neccessarily.
having suspend blockers inside the kernel adds significant complexity, it's worth it only if the complexity buys you enough. In this case the question is if the suspend blockers would extend the sleep time enough more to matter. As per my other e-mail, this is an area with rapidly diminishing returns as the sleep times get longer.
Quoted 10 lines
With System A you could try to do a really sophisticated power-management scheme and so on... but as soon as you allow 3rd-Party Apps, how do you manage their cross-dependencies? I.e. you can not automatically detect when App1 needs App2 to function.
You need to allow all 3rd-Party apps to run as a group.So you can perhaps partition your software stack into "untrusted applications" and different groups of software with audited dependencies.
Quoted 7 lines
If one group interacts with another group (as will be the case at least with the "untrusted applications" group) you have to have them both running at the same time.
This really gets pretty complex. Do you really think something like this is better than a simple suspend? (I.e. suspend blockers or having just one group)
even if all you do is have two groups (trusted and untrusted), all you need to do is to watch for the interaction between these two. Put the third-party apps in the untrusted group.
depending on what security you have available, you may be able to define more, smaller groups after using the security to make sure that there is no overlap between them
Quoted 2 lines
Suppose you implement suspend blockers with a cgroup freeze... how do you implement the freeze/thaw control?
I thought the answer had been provided, one of the trusted apps implements the freeze/thaw, and everything happens in userspace.
Quoted 5 lines
Cheers,
Flop.s.: do you see an possibility for any kind of "priority inheritance" in the cgroup scheme? I don't.
is there a need for it?
David Lang
Quoted 6 lines · On Tue, 8 Jun 2010, [email protected] wrote:
having suspend blockers inside the kernel adds significant complexity, it's worth it only if the complexity buys you enough. In this case the question is if the suspend blockers would extend the sleep time enough more to matter. As per my other e-mail, this is an area with rapidly diminishing returns as the sleep times get longer.
Well, the counter-argument that nobody seems to have brought up is that suspend blockers exist, are real code, and end up being shipped in a lot of machines.
That's a _big_ argument in favour of them. Certainly much bigger than arguing against them based on some complexity-arguments for an alternative that hasn't seen any testing at all.
IOW, I would seriously hope that this discussion was more about real code that _exists_ and does what people need. It seems to have degenerated into something else.
Because in the end, "code talks, bullshit walks". People can complain and suggest alternatives all they want, but you can't just argue. At some point you need to show the code that actually solves the problem.
Linus
Quoted 16 lines · Linus Torvalds
Quoted 6 lines · On Tue, 8 Jun 2010, [email protected] wrote:
having suspend blockers inside the kernel adds significant complexity, it's worth it only if the complexity buys you enough. In this case the question is if the suspend blockers would extend the sleep time enough more to matter. As per my other e-mail, this is an area with rapidly diminishing returns as the sleep times get longer.
Well, the counter-argument that nobody seems to have brought up is that suspend blockers exist, are real code, and end up being shipped in a lot of machines.
That's a _big_ argument in favour of them. Certainly much bigger than arguing against them based on some complexity-arguments for an alternative that hasn't seen any testing at all.
Quoted 7 lines
IOW, I would seriously hope that this discussion was more about real code that _exists_ and does what people need. It seems to have degenerated into something else.
Because in the end, "code talks, bullshit walks". People can complain and suggest alternatives all they want, but you can't just argue. At some point you need to show the code that actually solves the problem.
That's assuming there is an actual problem, which according to all the embedded people except android, there is not.
And if there is indeed such a problem (probably not big), it might be solved properly by the time suspend blockers are merged, or few releases after.
Whatever the solution (or workaround) is, it would be nice if it could be used by more than just android people, and it would also be nice to do it without introducing user-space API that *nobody* likes and might be quickly deprecated.
Signature · 1 line
Felipe Contreras
Quoted 22 lines · Felipe Contreras
Quoted 20 lines · Linus Torvalds
Quoted 6 lines · On Tue, 8 Jun 2010, [email protected] wrote:
having suspend blockers inside the kernel adds significant complexity, it's worth it only if the complexity buys you enough. In this case the question is if the suspend blockers would extend the sleep time enough more to matter. As per my other e-mail, this is an area with rapidly diminishing returns as the sleep times get longer.
Well, the counter-argument that nobody seems to have brought up is that suspend blockers exist, are real code, and end up being shipped in a lot of machines.
That's a _big_ argument in favour of them. Certainly much bigger than arguing against them based on some complexity-arguments for an alternative that hasn't seen any testing at all.
IOW, I would seriously hope that this discussion was more about real code that _exists_ and does what people need. It seems to have degenerated into something else.
Quoted 6 lines
Quoted 3 lines
Because in the end, "code talks, bullshit walks". People can complain and suggest alternatives all they want, but you can't just argue. At some point you need to show the code that actually solves the problem.
That's assuming there is an actual problem, which according to all the embedded people except android, there is not.
Yes, there is, but they've decided to ignore it.
Quoted 3 lines
And if there is indeed such a problem (probably not big), it might be solved properly by the time suspend blockers are merged, or few releases after.
Not quite. Have you followed all of the discussion, actually?
Quoted 4 lines
Whatever the solution (or workaround) is, it would be nice if it could be used by more than just android people, and it would also be nice to do it without introducing user-space API that *nobody* likes and might be quickly deprecated.
I agree with Linus and I don't have that much of a problem with the API that people seem to have. In fact the much-hated user space API is just a char device driver with 3 ioctls (that can be extended in future if need be) and the kernel API is acceptable to me. Yes, there is some overlap between it and PM QoS, but IMhO that overlap may be reduced over time (eg. by using PM QoS requirements to implement suspend blockers).
To me, the question boils down to whether or not we're able to persuade the Android people to use any other approach (eg. by demonstrating that something else is actually better), because even if we invent a brilliant new approach, but Android ends up using its old one anyway, the net result will be as though we haven't done anything useful.
Rafael
Quoted 43 lines · On Wed, 9 Jun 2010 11:40:27 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 22 lines · Felipe Contreras
Quoted 20 lines · Linus Torvalds
Quoted 6 lines · On Tue, 8 Jun 2010, [email protected] wrote:
having suspend blockers inside the kernel adds significant complexity, it's worth it only if the complexity buys you enough. In this case the question is if the suspend blockers would extend the sleep time enough more to matter. As per my other e-mail, this is an area with rapidly diminishing returns as the sleep times get longer.
Well, the counter-argument that nobody seems to have brought up is that suspend blockers exist, are real code, and end up being shipped in a lot of machines.
That's a _big_ argument in favour of them. Certainly much bigger than arguing against them based on some complexity-arguments for an alternative that hasn't seen any testing at all.
IOW, I would seriously hope that this discussion was more about real code that _exists_ and does what people need. It seems to have degenerated into something else.
Quoted 6 lines
Quoted 3 lines
Because in the end, "code talks, bullshit walks". People can complain and suggest alternatives all they want, but you can't just argue. At some point you need to show the code that actually solves the problem.
That's assuming there is an actual problem, which according to all the embedded people except android, there is not.
Yes, there is, but they've decided to ignore it.
Quoted 3 lines
And if there is indeed such a problem (probably not big), it might be solved properly by the time suspend blockers are merged, or few releases after.
Not quite. Have you followed all of the discussion, actually?
Quoted 4 lines
Whatever the solution (or workaround) is, it would be nice if it could be used by more than just android people, and it would also be nice to do it without introducing user-space API that *nobody* likes and might be quickly deprecated.
Quoted 4 lines
I agree with Linus and I don't have that much of a problem with the API that people seem to have. In fact the much-hated user space API is just a char device driver with 3 ioctls (that can be extended in future if need be) and the kernel API is acceptable to me.
I think there is a little bit more to it than that. It seems there is a new ioctl for input/event devices to say "Any events queued here should be treated as wake-up events". There may be similar additions to other devices, but I know of no details.
I wonder if we can get a complete statement of changes to the user-space API...
Quoted 9 lines
Yes, there is some overlap between it
and PM QoS, but IMhO that overlap may be reduced over time (eg. by using PM QoS requirements to implement suspend blockers).To me, the question boils down to whether or not we're able to persuade the Android people to use any other approach (eg. by demonstrating that something else is actually better), because even if we invent a brilliant new approach, but Android ends up using its old one anyway, the net result will be as though we haven't done anything useful.
Yes. There is no point unless we can meet somewhere in the middle. I think that would have to include a full suspend that freezes all processes. Solutions which reject that - while quite clever - would require too much change to Android user-space to be acceptable.
NeilBrown
Quoted 2 lines
Rafael
Quoted 43 lines · On Wed, 9 Jun 2010 11:40:27 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 22 lines · Felipe Contreras
Quoted 20 lines · Linus Torvalds
Quoted 6 lines · On Tue, 8 Jun 2010, [email protected] wrote:
having suspend blockers inside the kernel adds significant complexity, it's worth it only if the complexity buys you enough. In this case the question is if the suspend blockers would extend the sleep time enough more to matter. As per my other e-mail, this is an area with rapidly diminishing returns as the sleep times get longer.
Well, the counter-argument that nobody seems to have brought up is that suspend blockers exist, are real code, and end up being shipped in a lot of machines.
That's a _big_ argument in favour of them. Certainly much bigger than arguing against them based on some complexity-arguments for an alternative that hasn't seen any testing at all.
IOW, I would seriously hope that this discussion was more about real code that _exists_ and does what people need. It seems to have degenerated into something else.
Quoted 6 lines
Quoted 3 lines
Because in the end, "code talks, bullshit walks". People can complain and suggest alternatives all they want, but you can't just argue. At some point you need to show the code that actually solves the problem.
That's assuming there is an actual problem, which according to all the embedded people except android, there is not.
Yes, there is, but they've decided to ignore it.
Quoted 3 lines
And if there is indeed such a problem (probably not big), it might be solved properly by the time suspend blockers are merged, or few releases after.
Not quite. Have you followed all of the discussion, actually?
Quoted 4 lines
Whatever the solution (or workaround) is, it would be nice if it could be used by more than just android people, and it would also be nice to do it without introducing user-space API that *nobody* likes and might be quickly deprecated.
Quoted 4 lines
I agree with Linus and I don't have that much of a problem with the API that people seem to have. In fact the much-hated user space API is just a char device driver with 3 ioctls (that can be extended in future if need be) and the kernel API is acceptable to me.
I think there is a little bit more to it than that. It seems there is a new ioctl for input/event devices to say "Any events queued here should be treated as wake-up events". There may be similar additions to other devices, but I know of no details.
I wonder if we can get a complete statement of changes to the user-space API...
Quoted 9 lines
Yes, there is some overlap between it
and PM QoS, but IMhO that overlap may be reduced over time (eg. by using PM QoS requirements to implement suspend blockers).To me, the question boils down to whether or not we're able to persuade the Android people to use any other approach (eg. by demonstrating that something else is actually better), because even if we invent a brilliant new approach, but Android ends up using its old one anyway, the net result will be as though we haven't done anything useful.
Yes. There is no point unless we can meet somewhere in the middle. I think that would have to include a full suspend that freezes all processes. Solutions which reject that - while quite clever - would require too much change to Android user-space to be acceptable.
NeilBrown
Quoted 2 lines
Rafael
Quoted 51 lines · Neil Brown
Quoted 43 lines · On Wed, 9 Jun 2010 11:40:27 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 22 lines · Felipe Contreras
Quoted 20 lines · Linus Torvalds
Quoted 6 lines · On Tue, 8 Jun 2010, [email protected] wrote:
having suspend blockers inside the kernel adds significant complexity, it's worth it only if the complexity buys you enough. In this case the question is if the suspend blockers would extend the sleep time enough more to matter. As per my other e-mail, this is an area with rapidly diminishing returns as the sleep times get longer.
Well, the counter-argument that nobody seems to have brought up is that suspend blockers exist, are real code, and end up being shipped in a lot of machines.
That's a _big_ argument in favour of them. Certainly much bigger than arguing against them based on some complexity-arguments for an alternative that hasn't seen any testing at all.
IOW, I would seriously hope that this discussion was more about real code that _exists_ and does what people need. It seems to have degenerated into something else.
Quoted 6 lines
Quoted 3 lines
Because in the end, "code talks, bullshit walks". People can complain and suggest alternatives all they want, but you can't just argue. At some point you need to show the code that actually solves the problem.
That's assuming there is an actual problem, which according to all the embedded people except android, there is not.
Yes, there is, but they've decided to ignore it.
Quoted 3 lines
And if there is indeed such a problem (probably not big), it might be solved properly by the time suspend blockers are merged, or few releases after.
Not quite. Have you followed all of the discussion, actually?
Quoted 4 lines
Whatever the solution (or workaround) is, it would be nice if it could be used by more than just android people, and it would also be nice to do it without introducing user-space API that *nobody* likes and might be quickly deprecated.
Quoted 4 lines
I agree with Linus and I don't have that much of a problem with the API that people seem to have. In fact the much-hated user space API is just a char device driver with 3 ioctls (that can be extended in future if need be) and the kernel API is acceptable to me.
Quoted 4 lines
I think there is a little bit more to it than that. It seems there is a new ioctl for input/event devices to say "Any events queued here should be treated as wake-up events". There may be similar additions to other devices, but I know of no details.
That's not in the patchset as in my pull request.
It is used on Android, though, and it would have been submitted separately, had the first patchset been merged.
Quoted 13 lines
I wonder if we can get a complete statement of changes to the user-space API...
Quoted 9 lines
Yes, there is some overlap between it
and PM QoS, but IMhO that overlap may be reduced over time (eg. by using PM QoS requirements to implement suspend blockers).To me, the question boils down to whether or not we're able to persuade the Android people to use any other approach (eg. by demonstrating that something else is actually better), because even if we invent a brilliant new approach, but Android ends up using its old one anyway, the net result will be as though we haven't done anything useful.
Quoted 4 lines
Yes. There is no point unless we can meet somewhere in the middle. I think that would have to include a full suspend that freezes all processes. Solutions which reject that - while quite clever - would require too much change to Android user-space to be acceptable.
Moreover, having thought a bit more about the "power manager in user space" concept I'm not sure if it really is that better than the original wakelocks idea. Namely, it only repaces a kernel-based mechanism with a user space task doing basically the same thing, but the communication between that task and the other cooperating user space tasks is arguably more complicated (it also uses the kernel resources, although indirectly).
So, for a phone-like system, where you'd generally want to simplify user space, having a "power manager" in the kernel seems to make sense to me.
Rafael
Quoted 51 lines · Neil Brown
Quoted 43 lines · On Wed, 9 Jun 2010 11:40:27 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 22 lines · Felipe Contreras
Quoted 20 lines · Linus Torvalds
Quoted 6 lines · On Tue, 8 Jun 2010, [email protected] wrote:
having suspend blockers inside the kernel adds significant complexity, it's worth it only if the complexity buys you enough. In this case the question is if the suspend blockers would extend the sleep time enough more to matter. As per my other e-mail, this is an area with rapidly diminishing returns as the sleep times get longer.
Well, the counter-argument that nobody seems to have brought up is that suspend blockers exist, are real code, and end up being shipped in a lot of machines.
That's a _big_ argument in favour of them. Certainly much bigger than arguing against them based on some complexity-arguments for an alternative that hasn't seen any testing at all.
IOW, I would seriously hope that this discussion was more about real code that _exists_ and does what people need. It seems to have degenerated into something else.
Quoted 6 lines
Quoted 3 lines
Because in the end, "code talks, bullshit walks". People can complain and suggest alternatives all they want, but you can't just argue. At some point you need to show the code that actually solves the problem.
That's assuming there is an actual problem, which according to all the embedded people except android, there is not.
Yes, there is, but they've decided to ignore it.
Quoted 3 lines
And if there is indeed such a problem (probably not big), it might be solved properly by the time suspend blockers are merged, or few releases after.
Not quite. Have you followed all of the discussion, actually?
Quoted 4 lines
Whatever the solution (or workaround) is, it would be nice if it could be used by more than just android people, and it would also be nice to do it without introducing user-space API that *nobody* likes and might be quickly deprecated.
Quoted 4 lines
I agree with Linus and I don't have that much of a problem with the API that people seem to have. In fact the much-hated user space API is just a char device driver with 3 ioctls (that can be extended in future if need be) and the kernel API is acceptable to me.
Quoted 4 lines
I think there is a little bit more to it than that. It seems there is a new ioctl for input/event devices to say "Any events queued here should be treated as wake-up events". There may be similar additions to other devices, but I know of no details.
That's not in the patchset as in my pull request.
It is used on Android, though, and it would have been submitted separately, had the first patchset been merged.
Quoted 13 lines
I wonder if we can get a complete statement of changes to the user-space API...
Quoted 9 lines
Yes, there is some overlap between it
and PM QoS, but IMhO that overlap may be reduced over time (eg. by using PM QoS requirements to implement suspend blockers).To me, the question boils down to whether or not we're able to persuade the Android people to use any other approach (eg. by demonstrating that something else is actually better), because even if we invent a brilliant new approach, but Android ends up using its old one anyway, the net result will be as though we haven't done anything useful.
Quoted 4 lines
Yes. There is no point unless we can meet somewhere in the middle. I think that would have to include a full suspend that freezes all processes. Solutions which reject that - while quite clever - would require too much change to Android user-space to be acceptable.
Moreover, having thought a bit more about the "power manager in user space" concept I'm not sure if it really is that better than the original wakelocks idea. Namely, it only repaces a kernel-based mechanism with a user space task doing basically the same thing, but the communication between that task and the other cooperating user space tasks is arguably more complicated (it also uses the kernel resources, although indirectly).
So, for a phone-like system, where you'd generally want to simplify user space, having a "power manager" in the kernel seems to make sense to me.
Rafael
Quoted 57 lines · On Thu, 10 Jun 2010 10:59:43 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 51 lines · Neil Brown
Quoted 43 lines · On Wed, 9 Jun 2010 11:40:27 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 22 lines · Felipe Contreras
Quoted 20 lines · Linus Torvalds
Quoted 6 lines · On Tue, 8 Jun 2010, [email protected] wrote:
having suspend blockers inside the kernel adds significant complexity, it's worth it only if the complexity buys you enough. In this case the question is if the suspend blockers would extend the sleep time enough more to matter. As per my other e-mail, this is an area with rapidly diminishing returns as the sleep times get longer.
Well, the counter-argument that nobody seems to have brought up is that suspend blockers exist, are real code, and end up being shipped in a lot of machines.
That's a _big_ argument in favour of them. Certainly much bigger than arguing against them based on some complexity-arguments for an alternative that hasn't seen any testing at all.
IOW, I would seriously hope that this discussion was more about real code that _exists_ and does what people need. It seems to have degenerated into something else.
Quoted 6 lines
Quoted 3 lines
Because in the end, "code talks, bullshit walks". People can complain and suggest alternatives all they want, but you can't just argue. At some point you need to show the code that actually solves the problem.
That's assuming there is an actual problem, which according to all the embedded people except android, there is not.
Yes, there is, but they've decided to ignore it.
Quoted 3 lines
And if there is indeed such a problem (probably not big), it might be solved properly by the time suspend blockers are merged, or few releases after.
Not quite. Have you followed all of the discussion, actually?
Quoted 4 lines
Whatever the solution (or workaround) is, it would be nice if it could be used by more than just android people, and it would also be nice to do it without introducing user-space API that *nobody* likes and might be quickly deprecated.
Quoted 4 lines
I agree with Linus and I don't have that much of a problem with the API that people seem to have. In fact the much-hated user space API is just a char device driver with 3 ioctls (that can be extended in future if need be) and the kernel API is acceptable to me.
Quoted 4 lines
I think there is a little bit more to it than that. It seems there is a new ioctl for input/event devices to say "Any events queued here should be treated as wake-up events". There may be similar additions to other devices, but I know of no details.
Quoted 4 lines
That's not in the patchset as in my pull request.
It is used on Android, though, and it would have been submitted separately, had the first patchset been merged.
Very true. But as the one cannot be used without the other, they really need to be considered as a package.
Quoted 26 lines
Quoted 14 lines
I wonder if we can get a complete statement of changes to the user-space API...
Quoted 9 lines
Yes, there is some overlap between it
and PM QoS, but IMhO that overlap may be reduced over time (eg. by using PM QoS requirements to implement suspend blockers).To me, the question boils down to whether or not we're able to persuade the Android people to use any other approach (eg. by demonstrating that something else is actually better), because even if we invent a brilliant new approach, but Android ends up using its old one anyway, the net result will be as though we haven't done anything useful.
Quoted 4 lines
Yes. There is no point unless we can meet somewhere in the middle. I think that would have to include a full suspend that freezes all processes. Solutions which reject that - while quite clever - would require too much change to Android user-space to be acceptable.
Moreover, having thought a bit more about the "power manager in user space" concept I'm not sure if it really is that better than the original wakelocks idea. Namely, it only repaces a kernel-based mechanism with a user space task doing basically the same thing, but the communication between that task and the other cooperating user space tasks is arguably more complicated (it also uses the kernel resources, although indirectly).
Quoted 3 lines
So, for a phone-like system, where you'd generally want to simplify user space, having a "power manager" in the kernel seems to make sense to me.
Following that logic would we end up putting everything in the kernel?
To my mind the advantage of having something in user-space is flexibility - you can refine the interfaces and behaviours without bothering the kernel. The reasons for putting things in the kernel are:
- tight integration with VM or processes (the two main abstractions that the kernel has to manage)
- privileged access to devices
- arbitration between processes with different privilege levels
Need-for-speed, on the other hand, is not necessarily a justification for going in the kernel - experience shows that we can make user-space interactions quite fast enough.
The "power manager" itself is quite trivial. It just needs something like:
while true
wait for all wake-locks to be dropped
activate suspend
and for 'activate suspend' to be interruptible by something taking out a wake-lock.
To my mind, the most interesting part of this is interruptibility. There is essentially only one way to do that in Unix/Linux: signals.
So it makes sense to have a task - with a pid - performing this loop so that it can be sent a signal.
And we already have mechanisms for sending signals on all sorts of different events, both kernel events (fcntl(F_OWNER)), file events (FNOTIFY), and normal process operations (kill).
If you are going to have a process (which I think you should) it makes sense for it to spend some time in user-space to use ipc-of-your-choice to communicate with other processes, and spend some time in kernel-space to be able to wait for in-kernel locks to be dropped, and to use signals to get out of kernel-space, and system calls to get into kernel space.
Yes, the proposed user-space interface for suspend blocks may not be all that horrible. But the fact is that you can get all the required functionality by just using currently existing interfaces. Against that background, adding anything new should be avoided.
NeilBrown
Quoted 57 lines · On Thu, 10 Jun 2010 10:59:43 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 51 lines · Neil Brown
Quoted 43 lines · On Wed, 9 Jun 2010 11:40:27 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 22 lines · Felipe Contreras
Quoted 20 lines · Linus Torvalds
Quoted 6 lines · On Tue, 8 Jun 2010, [email protected] wrote:
having suspend blockers inside the kernel adds significant complexity, it's worth it only if the complexity buys you enough. In this case the question is if the suspend blockers would extend the sleep time enough more to matter. As per my other e-mail, this is an area with rapidly diminishing returns as the sleep times get longer.
Well, the counter-argument that nobody seems to have brought up is that suspend blockers exist, are real code, and end up being shipped in a lot of machines.
That's a _big_ argument in favour of them. Certainly much bigger than arguing against them based on some complexity-arguments for an alternative that hasn't seen any testing at all.
IOW, I would seriously hope that this discussion was more about real code that _exists_ and does what people need. It seems to have degenerated into something else.
Quoted 6 lines
Quoted 3 lines
Because in the end, "code talks, bullshit walks". People can complain and suggest alternatives all they want, but you can't just argue. At some point you need to show the code that actually solves the problem.
That's assuming there is an actual problem, which according to all the embedded people except android, there is not.
Yes, there is, but they've decided to ignore it.
Quoted 3 lines
And if there is indeed such a problem (probably not big), it might be solved properly by the time suspend blockers are merged, or few releases after.
Not quite. Have you followed all of the discussion, actually?
Quoted 4 lines
Whatever the solution (or workaround) is, it would be nice if it could be used by more than just android people, and it would also be nice to do it without introducing user-space API that *nobody* likes and might be quickly deprecated.
Quoted 4 lines
I agree with Linus and I don't have that much of a problem with the API that people seem to have. In fact the much-hated user space API is just a char device driver with 3 ioctls (that can be extended in future if need be) and the kernel API is acceptable to me.
Quoted 4 lines
I think there is a little bit more to it than that. It seems there is a new ioctl for input/event devices to say "Any events queued here should be treated as wake-up events". There may be similar additions to other devices, but I know of no details.
Quoted 4 lines
That's not in the patchset as in my pull request.
It is used on Android, though, and it would have been submitted separately, had the first patchset been merged.
Very true. But as the one cannot be used without the other, they really need to be considered as a package.
Quoted 26 lines
Quoted 14 lines
I wonder if we can get a complete statement of changes to the user-space API...
Quoted 9 lines
Yes, there is some overlap between it
and PM QoS, but IMhO that overlap may be reduced over time (eg. by using PM QoS requirements to implement suspend blockers).To me, the question boils down to whether or not we're able to persuade the Android people to use any other approach (eg. by demonstrating that something else is actually better), because even if we invent a brilliant new approach, but Android ends up using its old one anyway, the net result will be as though we haven't done anything useful.
Quoted 4 lines
Yes. There is no point unless we can meet somewhere in the middle. I think that would have to include a full suspend that freezes all processes. Solutions which reject that - while quite clever - would require too much change to Android user-space to be acceptable.
Moreover, having thought a bit more about the "power manager in user space" concept I'm not sure if it really is that better than the original wakelocks idea. Namely, it only repaces a kernel-based mechanism with a user space task doing basically the same thing, but the communication between that task and the other cooperating user space tasks is arguably more complicated (it also uses the kernel resources, although indirectly).
Quoted 3 lines
So, for a phone-like system, where you'd generally want to simplify user space, having a "power manager" in the kernel seems to make sense to me.
Following that logic would we end up putting everything in the kernel?
To my mind the advantage of having something in user-space is flexibility - you can refine the interfaces and behaviours without bothering the kernel. The reasons for putting things in the kernel are:
- tight integration with VM or processes (the two main abstractions that the kernel has to manage)
- privileged access to devices
- arbitration between processes with different privilege levels
Need-for-speed, on the other hand, is not necessarily a justification for going in the kernel - experience shows that we can make user-space interactions quite fast enough.
The "power manager" itself is quite trivial. It just needs something like:
while true
wait for all wake-locks to be dropped
activate suspend
and for 'activate suspend' to be interruptible by something taking out a wake-lock.
To my mind, the most interesting part of this is interruptibility. There is essentially only one way to do that in Unix/Linux: signals.
So it makes sense to have a task - with a pid - performing this loop so that it can be sent a signal.
And we already have mechanisms for sending signals on all sorts of different events, both kernel events (fcntl(F_OWNER)), file events (FNOTIFY), and normal process operations (kill).
If you are going to have a process (which I think you should) it makes sense for it to spend some time in user-space to use ipc-of-your-choice to communicate with other processes, and spend some time in kernel-space to be able to wait for in-kernel locks to be dropped, and to use signals to get out of kernel-space, and system calls to get into kernel space.
Yes, the proposed user-space interface for suspend blocks may not be all that horrible. But the fact is that you can get all the required functionality by just using currently existing interfaces. Against that background, adding anything new should be avoided.
NeilBrown
Quoted 60 lines · Neil Brown
Quoted 57 lines · On Thu, 10 Jun 2010 10:59:43 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 55 lines · Neil Brown
Quoted 43 lines · On Wed, 9 Jun 2010 11:40:27 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 22 lines · Felipe Contreras
Quoted 20 lines · Linus Torvalds
Quoted 6 lines · On Tue, 8 Jun 2010, [email protected] wrote:
having suspend blockers inside the kernel adds significant complexity, it's worth it only if the complexity buys you enough. In this case the question is if the suspend blockers would extend the sleep time enough more to matter. As per my other e-mail, this is an area with rapidly diminishing returns as the sleep times get longer.
Well, the counter-argument that nobody seems to have brought up is that suspend blockers exist, are real code, and end up being shipped in a lot of machines.
That's a _big_ argument in favour of them. Certainly much bigger than arguing against them based on some complexity-arguments for an alternative that hasn't seen any testing at all.
IOW, I would seriously hope that this discussion was more about real code that _exists_ and does what people need. It seems to have degenerated into something else.
Quoted 6 lines
Quoted 3 lines
Because in the end, "code talks, bullshit walks". People can complain and suggest alternatives all they want, but you can't just argue. At some point you need to show the code that actually solves the problem.
That's assuming there is an actual problem, which according to all the embedded people except android, there is not.
Yes, there is, but they've decided to ignore it.
Quoted 3 lines
And if there is indeed such a problem (probably not big), it might be solved properly by the time suspend blockers are merged, or few releases after.
Not quite. Have you followed all of the discussion, actually?
Quoted 4 lines
Whatever the solution (or workaround) is, it would be nice if it could be used by more than just android people, and it would also be nice to do it without introducing user-space API that *nobody* likes and might be quickly deprecated.
Quoted 4 lines
I agree with Linus and I don't have that much of a problem with the API that people seem to have. In fact the much-hated user space API is just a char device driver with 3 ioctls (that can be extended in future if need be) and the kernel API is acceptable to me.
I think there is a little bit more to it than that. It seems there is a new ioctl for input/event devices to say "Any events queued here should be treated as wake-up events". There may be similar additions to other devices, but I know of no details.
Quoted 7 lines
Quoted 4 lines
That's not in the patchset as in my pull request.
It is used on Android, though, and it would have been submitted separately, had the first patchset been merged.
Very true. But as the one cannot be used without the other, they really need to be considered as a package.
You can use suspend blockers as in the pull request without the input patch in principle.
Quoted 26 lines
Quoted 26 lines
Quoted 14 lines
I wonder if we can get a complete statement of changes to the user-space API...
Quoted 9 lines
Yes, there is some overlap between it
and PM QoS, but IMhO that overlap may be reduced over time (eg. by using PM QoS requirements to implement suspend blockers).To me, the question boils down to whether or not we're able to persuade the Android people to use any other approach (eg. by demonstrating that something else is actually better), because even if we invent a brilliant new approach, but Android ends up using its old one anyway, the net result will be as though we haven't done anything useful.
Quoted 4 lines
Yes. There is no point unless we can meet somewhere in the middle. I think that would have to include a full suspend that freezes all processes. Solutions which reject that - while quite clever - would require too much change to Android user-space to be acceptable.
Moreover, having thought a bit more about the "power manager in user space" concept I'm not sure if it really is that better than the original wakelocks idea. Namely, it only repaces a kernel-based mechanism with a user space task doing basically the same thing, but the communication between that task and the other cooperating user space tasks is arguably more complicated (it also uses the kernel resources, although indirectly).
Quoted 5 lines
Quoted 3 lines
So, for a phone-like system, where you'd generally want to simplify user space, having a "power manager" in the kernel seems to make sense to me.
Following that logic would we end up putting everything in the kernel?
No, I don't think so.
Quoted 7 lines
To my mind the advantage of having something in user-space is flexibility - you can refine the interfaces and behaviours without bothering the kernel. The reasons for putting things in the kernel are:
- tight integration with VM or processes (the two main abstractions that the kernel has to manage)
- privileged access to devices
- arbitration between processes with different privilege levels
I'd add inter-process communication to this list as well.
Quoted 3 lines
Need-for-speed, on the other hand, is not necessarily a justification for going in the kernel - experience shows that we can make user-space interactions quite fast enough.
Still, if a kernel-based approach ends up being simpler than a user-space-only alternative, I tend to prefer the former. And please remember that in this particular case all user-space-only alternatives in fact _have_ _to_ use facilities provided by the kernel anyway, although they can use the existing ones.
Quoted 6 lines
The "power manager" itself is quite trivial. It just needs something like:
while true
wait for all wake-locks to be dropped
activate suspend
and for 'activate suspend' to be interruptible by something taking out a wake-lock.
Where the last thing is kind of complicated.
Quoted 2 lines
To my mind, the most interesting part of this is interruptibility. There is essentially only one way to do that in Unix/Linux: signals.
Well, I don't follow. :-)
Quoted 7 lines
So it makes sense to have a task - with a pid - performing this loop so that it can be sent a signal.
And we already have mechanisms for sending signals on all sorts of different events, both kernel events (fcntl(F_OWNER)), file events (FNOTIFY), and normal process operations (kill).If you are going to have a process (which I think you should)
There's no such process in the original patchset and it seemed to get away with that.
Quoted 9 lines
it makes sense for it to spend some time in user-space to use ipc-of-your-choice to communicate with other processes, and spend some time in kernel-space to be able to wait for in-kernel locks to be dropped, and to use signals to get out of kernel-space, and system calls to get into kernel space.
Yes, the proposed user-space interface for suspend blocks may not be all that horrible. But the fact is that you can get all the required functionality by just using currently existing interfaces. Against that background, adding anything new should be avoided.
Again, if things can be simplified overall by adding something new to the kernel, I don't see a problem with that in principle. Especially if that new stuff doesn't really interfere with anything already existing.
There also is the "real code" argument you seem to totally neglect. Whatever you suggest, you should actually implement it and show that it works and that it really is better than the proposed approach. Till then, it's just pure speculation.
So there's real code that I don't really have a problem with and I haven't seen any alternative implemented and working yet.
Rafael
Quoted 60 lines · Neil Brown
Quoted 57 lines · On Thu, 10 Jun 2010 10:59:43 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 55 lines · Neil Brown
Quoted 43 lines · On Wed, 9 Jun 2010 11:40:27 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 22 lines · Felipe Contreras
Quoted 20 lines · Linus Torvalds
Quoted 6 lines · On Tue, 8 Jun 2010, [email protected] wrote:
having suspend blockers inside the kernel adds significant complexity, it's worth it only if the complexity buys you enough. In this case the question is if the suspend blockers would extend the sleep time enough more to matter. As per my other e-mail, this is an area with rapidly diminishing returns as the sleep times get longer.
Well, the counter-argument that nobody seems to have brought up is that suspend blockers exist, are real code, and end up being shipped in a lot of machines.
That's a _big_ argument in favour of them. Certainly much bigger than arguing against them based on some complexity-arguments for an alternative that hasn't seen any testing at all.
IOW, I would seriously hope that this discussion was more about real code that _exists_ and does what people need. It seems to have degenerated into something else.
Quoted 6 lines
Quoted 3 lines
Because in the end, "code talks, bullshit walks". People can complain and suggest alternatives all they want, but you can't just argue. At some point you need to show the code that actually solves the problem.
That's assuming there is an actual problem, which according to all the embedded people except android, there is not.
Yes, there is, but they've decided to ignore it.
Quoted 3 lines
And if there is indeed such a problem (probably not big), it might be solved properly by the time suspend blockers are merged, or few releases after.
Not quite. Have you followed all of the discussion, actually?
Quoted 4 lines
Whatever the solution (or workaround) is, it would be nice if it could be used by more than just android people, and it would also be nice to do it without introducing user-space API that *nobody* likes and might be quickly deprecated.
Quoted 4 lines
I agree with Linus and I don't have that much of a problem with the API that people seem to have. In fact the much-hated user space API is just a char device driver with 3 ioctls (that can be extended in future if need be) and the kernel API is acceptable to me.
I think there is a little bit more to it than that. It seems there is a new ioctl for input/event devices to say "Any events queued here should be treated as wake-up events". There may be similar additions to other devices, but I know of no details.
Quoted 7 lines
Quoted 4 lines
That's not in the patchset as in my pull request.
It is used on Android, though, and it would have been submitted separately, had the first patchset been merged.
Very true. But as the one cannot be used without the other, they really need to be considered as a package.
You can use suspend blockers as in the pull request without the input patch in principle.
Quoted 26 lines
Quoted 26 lines
Quoted 14 lines
I wonder if we can get a complete statement of changes to the user-space API...
Quoted 9 lines
Yes, there is some overlap between it
and PM QoS, but IMhO that overlap may be reduced over time (eg. by using PM QoS requirements to implement suspend blockers).To me, the question boils down to whether or not we're able to persuade the Android people to use any other approach (eg. by demonstrating that something else is actually better), because even if we invent a brilliant new approach, but Android ends up using its old one anyway, the net result will be as though we haven't done anything useful.
Quoted 4 lines
Yes. There is no point unless we can meet somewhere in the middle. I think that would have to include a full suspend that freezes all processes. Solutions which reject that - while quite clever - would require too much change to Android user-space to be acceptable.
Moreover, having thought a bit more about the "power manager in user space" concept I'm not sure if it really is that better than the original wakelocks idea. Namely, it only repaces a kernel-based mechanism with a user space task doing basically the same thing, but the communication between that task and the other cooperating user space tasks is arguably more complicated (it also uses the kernel resources, although indirectly).
Quoted 5 lines
Quoted 3 lines
So, for a phone-like system, where you'd generally want to simplify user space, having a "power manager" in the kernel seems to make sense to me.
Following that logic would we end up putting everything in the kernel?
No, I don't think so.
Quoted 7 lines
To my mind the advantage of having something in user-space is flexibility - you can refine the interfaces and behaviours without bothering the kernel. The reasons for putting things in the kernel are:
- tight integration with VM or processes (the two main abstractions that the kernel has to manage)
- privileged access to devices
- arbitration between processes with different privilege levels
I'd add inter-process communication to this list as well.
Quoted 3 lines
Need-for-speed, on the other hand, is not necessarily a justification for going in the kernel - experience shows that we can make user-space interactions quite fast enough.
Still, if a kernel-based approach ends up being simpler than a user-space-only alternative, I tend to prefer the former. And please remember that in this particular case all user-space-only alternatives in fact _have_ _to_ use facilities provided by the kernel anyway, although they can use the existing ones.
Quoted 6 lines
The "power manager" itself is quite trivial. It just needs something like:
while true
wait for all wake-locks to be dropped
activate suspend
and for 'activate suspend' to be interruptible by something taking out a wake-lock.
Where the last thing is kind of complicated.
Quoted 2 lines
To my mind, the most interesting part of this is interruptibility. There is essentially only one way to do that in Unix/Linux: signals.
Well, I don't follow. :-)
Quoted 7 lines
So it makes sense to have a task - with a pid - performing this loop so that it can be sent a signal.
And we already have mechanisms for sending signals on all sorts of different events, both kernel events (fcntl(F_OWNER)), file events (FNOTIFY), and normal process operations (kill).If you are going to have a process (which I think you should)
There's no such process in the original patchset and it seemed to get away with that.
Quoted 9 lines
it makes sense for it to spend some time in user-space to use ipc-of-your-choice to communicate with other processes, and spend some time in kernel-space to be able to wait for in-kernel locks to be dropped, and to use signals to get out of kernel-space, and system calls to get into kernel space.
Yes, the proposed user-space interface for suspend blocks may not be all that horrible. But the fact is that you can get all the required functionality by just using currently existing interfaces. Against that background, adding anything new should be avoided.
Again, if things can be simplified overall by adding something new to the kernel, I don't see a problem with that in principle. Especially if that new stuff doesn't really interfere with anything already existing.
There also is the "real code" argument you seem to totally neglect. Whatever you suggest, you should actually implement it and show that it works and that it really is better than the proposed approach. Till then, it's just pure speculation.
So there's real code that I don't really have a problem with and I haven't seen any alternative implemented and working yet.
Rafael
Quoted 2 lines · Rafael J. Wysocki
So, for a phone-like system, where you'd generally want to simplify user space, having a "power manager" in the kernel seems to make sense to me.
I'm not clear where this requirement to simplify user space specifically for phones comes from - phones do have pretty substantial software stacks that aren't that far away to PCs.
Quoted 7 lines · Mark Brown
Quoted 2 lines · Rafael J. Wysocki
So, for a phone-like system, where you'd generally want to simplify user space, having a "power manager" in the kernel seems to make sense to me.
I'm not clear where this requirement to simplify user space specifically for phones comes from
This isn't a requirement, but something that IMO is reasonable.
Quoted 2 lines
- phones do have pretty substantial software stacks that aren't that far away to PCs.
That doesn't seem to be relevant here.
Rafael
Quoted 9 lines · Rafael J. Wysocki
Quoted 7 lines · Mark Brown
Quoted 2 lines · Rafael J. Wysocki
So, for a phone-like system, where you'd generally want to simplify user space, having a "power manager" in the kernel seems to make sense to me.
I'm not clear where this requirement to simplify user space specifically for phones comes from
Quoted 6 lines
This isn't a requirement, but something that IMO is reasonable.
Quoted 2 lines
- phones do have pretty substantial software stacks that aren't that far away to PCs.
That doesn't seem to be relevant here.
Sure, that's my point - you seem to be suggesting that phones have a different requirement here.
Quoted 9 lines · Rafael J. Wysocki
Quoted 7 lines · Mark Brown
Quoted 2 lines · Rafael J. Wysocki
So, for a phone-like system, where you'd generally want to simplify user space, having a "power manager" in the kernel seems to make sense to me.
I'm not clear where this requirement to simplify user space specifically for phones comes from
Quoted 6 lines
This isn't a requirement, but something that IMO is reasonable.
Quoted 2 lines
- phones do have pretty substantial software stacks that aren't that far away to PCs.
That doesn't seem to be relevant here.
Sure, that's my point - you seem to be suggesting that phones have a different requirement here.
Quoted 7 lines · Mark Brown
Quoted 2 lines · Rafael J. Wysocki
So, for a phone-like system, where you'd generally want to simplify user space, having a "power manager" in the kernel seems to make sense to me.
I'm not clear where this requirement to simplify user space specifically for phones comes from
This isn't a requirement, but something that IMO is reasonable.
Quoted 2 lines
- phones do have pretty substantial software stacks that aren't that far away to PCs.
That doesn't seem to be relevant here.
Rafael
Quoted 2 lines · Rafael J. Wysocki
So, for a phone-like system, where you'd generally want to simplify user space, having a "power manager" in the kernel seems to make sense to me.
I'm not clear where this requirement to simplify user space specifically for phones comes from - phones do have pretty substantial software stacks that aren't that far away to PCs.
Quoted 6 lines · Rafael J. Wysocki
Moreover, having thought a bit more about the "power manager in user space" concept I'm not sure if it really is that better than the original wakelocks idea. Namely, it only repaces a kernel-based mechanism with a user space task doing basically the same thing, but the communication between that task and the other cooperating user space tasks is arguably more complicated (it also uses the kernel resources, although indirectly).
That is all true. The "power manager in userspace" was meant to prove a point: that this _could_ be done without invasive changes to the kernel. It wasn't necessarily meant to be a _better_ solution.
Quoted 2 lines
So, for a phone-like system, where you'd generally want to simplify user space, having a "power manager" in the kernel seems to make sense to me.
This is a judgment call. Obviously different people have different opinions.
Alan Stern
Quoted 6 lines · Rafael J. Wysocki
Moreover, having thought a bit more about the "power manager in user space" concept I'm not sure if it really is that better than the original wakelocks idea. Namely, it only repaces a kernel-based mechanism with a user space task doing basically the same thing, but the communication between that task and the other cooperating user space tasks is arguably more complicated (it also uses the kernel resources, although indirectly).
That is all true. The "power manager in userspace" was meant to prove a point: that this _could_ be done without invasive changes to the kernel. It wasn't necessarily meant to be a _better_ solution.
Quoted 2 lines
So, for a phone-like system, where you'd generally want to simplify user space, having a "power manager" in the kernel seems to make sense to me.
This is a judgment call. Obviously different people have different opinions.
Alan Stern
Quoted 13 lines · Alan Stern
Quoted 6 lines · Rafael J. Wysocki
Moreover, having thought a bit more about the "power manager in user space" concept I'm not sure if it really is that better than the original wakelocks idea. Namely, it only repaces a kernel-based mechanism with a user space task doing basically the same thing, but the communication between that task and the other cooperating user space tasks is arguably more complicated (it also uses the kernel resources, although indirectly).
That is all true. The "power manager in userspace" was meant to prove a point: that this _could_ be done without invasive changes to the kernel. It wasn't necessarily meant to be a _better_ solution.
Quoted 5 lines
Quoted 2 lines
So, for a phone-like system, where you'd generally want to simplify user space, having a "power manager" in the kernel seems to make sense to me.
This is a judgment call. Obviously different people have different opinions.
Agreed.
Rafael
Quoted 13 lines · Alan Stern
Quoted 6 lines · Rafael J. Wysocki
Moreover, having thought a bit more about the "power manager in user space" concept I'm not sure if it really is that better than the original wakelocks idea. Namely, it only repaces a kernel-based mechanism with a user space task doing basically the same thing, but the communication between that task and the other cooperating user space tasks is arguably more complicated (it also uses the kernel resources, although indirectly).
That is all true. The "power manager in userspace" was meant to prove a point: that this _could_ be done without invasive changes to the kernel. It wasn't necessarily meant to be a _better_ solution.
Quoted 5 lines
Quoted 2 lines
So, for a phone-like system, where you'd generally want to simplify user space, having a "power manager" in the kernel seems to make sense to me.
This is a judgment call. Obviously different people have different opinions.
Agreed.
Rafael
Quoted 22 lines · Felipe Contreras
Quoted 20 lines · Linus Torvalds
Quoted 6 lines · On Tue, 8 Jun 2010, [email protected] wrote:
having suspend blockers inside the kernel adds significant complexity, it's worth it only if the complexity buys you enough. In this case the question is if the suspend blockers would extend the sleep time enough more to matter. As per my other e-mail, this is an area with rapidly diminishing returns as the sleep times get longer.
Well, the counter-argument that nobody seems to have brought up is that suspend blockers exist, are real code, and end up being shipped in a lot of machines.
That's a _big_ argument in favour of them. Certainly much bigger than arguing against them based on some complexity-arguments for an alternative that hasn't seen any testing at all.
IOW, I would seriously hope that this discussion was more about real code that _exists_ and does what people need. It seems to have degenerated into something else.
Quoted 6 lines
Quoted 3 lines
Because in the end, "code talks, bullshit walks". People can complain and suggest alternatives all they want, but you can't just argue. At some point you need to show the code that actually solves the problem.
That's assuming there is an actual problem, which according to all the embedded people except android, there is not.
Yes, there is, but they've decided to ignore it.
Quoted 3 lines
And if there is indeed such a problem (probably not big), it might be solved properly by the time suspend blockers are merged, or few releases after.
Not quite. Have you followed all of the discussion, actually?
Quoted 4 lines
Whatever the solution (or workaround) is, it would be nice if it could be used by more than just android people, and it would also be nice to do it without introducing user-space API that *nobody* likes and might be quickly deprecated.
I agree with Linus and I don't have that much of a problem with the API that people seem to have. In fact the much-hated user space API is just a char device driver with 3 ioctls (that can be extended in future if need be) and the kernel API is acceptable to me. Yes, there is some overlap between it and PM QoS, but IMhO that overlap may be reduced over time (eg. by using PM QoS requirements to implement suspend blockers).
To me, the question boils down to whether or not we're able to persuade the Android people to use any other approach (eg. by demonstrating that something else is actually better), because even if we invent a brilliant new approach, but Android ends up using its old one anyway, the net result will be as though we haven't done anything useful.
Rafael
Quoted 16 lines · Linus Torvalds
Quoted 6 lines · On Tue, 8 Jun 2010, [email protected] wrote:
having suspend blockers inside the kernel adds significant complexity, it's worth it only if the complexity buys you enough. In this case the question is if the suspend blockers would extend the sleep time enough more to matter. As per my other e-mail, this is an area with rapidly diminishing returns as the sleep times get longer.
Well, the counter-argument that nobody seems to have brought up is that suspend blockers exist, are real code, and end up being shipped in a lot of machines.
That's a _big_ argument in favour of them. Certainly much bigger than arguing against them based on some complexity-arguments for an alternative that hasn't seen any testing at all.
Quoted 7 lines
IOW, I would seriously hope that this discussion was more about real code that _exists_ and does what people need. It seems to have degenerated into something else.
Because in the end, "code talks, bullshit walks". People can complain and suggest alternatives all they want, but you can't just argue. At some point you need to show the code that actually solves the problem.
That's assuming there is an actual problem, which according to all the embedded people except android, there is not.
And if there is indeed such a problem (probably not big), it might be solved properly by the time suspend blockers are merged, or few releases after.
Whatever the solution (or workaround) is, it would be nice if it could be used by more than just android people, and it would also be nice to do it without introducing user-space API that *nobody* likes and might be quickly deprecated.
Signature · 1 line
Felipe Contreras
Quoted 41 lines · On Sun, 6 Jun 2010 04:14:09 -0700 (PDT) [email protected] wrote:
Quoted 22 lines · Florian Mickler
Quoted 13 lines · On Sun, 6 Jun 2010 12:19:08 +0200 Vitaly Wool <[email protected]> wrote:
2010/6/6 <[email protected]>:
Quoted 11 lines
as an example (taken from this thread).
system A needs to wake up to get a battery reading, store it and go back to sleep, It does so every 10 seconds. But when it does so it only runs the one process and then goes back to sleep.
system B has the same need, but wakes up every 10 minutes. but when it does so it fully wakes up and this allows the mail app to power up the radio, connect to the Internet and start checking for new mail before oppurtunistic sleep shuts things down (causing the mail check to fail)
Quoted 5 lines
Quoted 1 line
System A will last considerably longer on a battery than System B.
Exactly, thanks for pointing out the specific example :)
~Vitaly
Quoted 8 lines
This does not affect
suspend_blockersnor doessuspend_blockersinterfere with that.
Suspend_blockersallow the system to suspend ("mem">/sys/power/state suspend), when the userspace decides that the device is not in use.So implementing
suspend_blockerssupport does not impact any optimizations done to either system A nor system B.Actually, it does.
system A is what's being proposed by kernel developers, where the untrusted stuff is in a different cgroup and what puts the system to sleep is 'normal' power management. It doesn't sleep as long, but when it wakes up the untrusted stuff is still frozen, so it doesn't stay awake long, or do very much.
Quoted 6 lines
System B is suspend blockers where you are either awake or asleep, and when you wake up you wake up fully, but oppertunistic sleep can interrupt untrusted processes at any time. The system sleeps longer (as fewer things can wake it), but when it wakes up it's fully awake.
David Lang
You say, that coming back from suspend takes the system to full power (and everything runs) before it begins the descend into runtime-low-power?
But are you referring to the fact that coming back
from suspend starts in the zero-idle-state (i.e. "consumes extra power") or that all processes run when it is not suspended?
Because the latter would of course (theretically) profit from the framework-controlled-cgroup-freeze/thaw (with and without opportunistic suspend) while the former should be a problem that both opportunistic suspend as well as suspend-from-idle have. Or not?
So, here is the question I'm asking myself: If System A were to be complemented by suspend_blockers, wouldn't it still be better?
With System A you could try to do a really sophisticated power-management scheme and so on... but as soon as you allow 3rd-Party Apps, how do you manage their cross-dependencies? I.e. you can not automatically detect when App1 needs App2 to function.
You need to allow all 3rd-Party apps to run as a group.
So you can perhaps partition your software stack into "untrusted applications" and different groups of software with audited dependencies.
If one group interacts with another group (as will be the case at least with the "untrusted applications" group) you have to have them both running at the same time.
This really gets pretty complex. Do you really think something like this is better than a simple suspend? (I.e. suspend blockers or having just one group)
Suppose you implement suspend blockers with a cgroup freeze... how do you implement the freeze/thaw control?
Cheers,
Flo
p.s.: do you see an possibility for any kind of "priority inheritance" in the cgroup scheme? I don't.
Quoted 22 lines · Florian Mickler
Quoted 13 lines · On Sun, 6 Jun 2010 12:19:08 +0200 Vitaly Wool <[email protected]> wrote:
2010/6/6 <[email protected]>:
Quoted 11 lines
as an example (taken from this thread).
system A needs to wake up to get a battery reading, store it and go back to sleep, It does so every 10 seconds. But when it does so it only runs the one process and then goes back to sleep.
system B has the same need, but wakes up every 10 minutes. but when it does so it fully wakes up and this allows the mail app to power up the radio, connect to the Internet and start checking for new mail before oppurtunistic sleep shuts things down (causing the mail check to fail)
Quoted 5 lines
Quoted 1 line
System A will last considerably longer on a battery than System B.
Exactly, thanks for pointing out the specific example :)
~Vitaly
Quoted 8 lines
This does not affect
suspend_blockersnor doessuspend_blockersinterfere with that.
Suspend_blockersallow the system to suspend ("mem">/sys/power/state suspend), when the userspace decides that the device is not in use.So implementing
suspend_blockerssupport does not impact any optimizations done to either system A nor system B.
Actually, it does.
system A is what's being proposed by kernel developers, where the untrusted stuff is in a different cgroup and what puts the system to sleep is 'normal' power management. It doesn't sleep as long, but when it wakes up the untrusted stuff is still frozen, so it doesn't stay awake long, or do very much.
System B is suspend blockers where you are either awake or asleep, and when you wake up you wake up fully, but oppertunistic sleep can interrupt untrusted processes at any time. The system sleeps longer (as fewer things can wake it), but when it wakes up it's fully awake.
David Lang
Quoted 13 lines · On Sun, 6 Jun 2010 12:19:08 +0200 Vitaly Wool <[email protected]> wrote:
2010/6/6 <[email protected]>:
Quoted 11 lines
as an example (taken from this thread).
system A needs to wake up to get a battery reading, store it and go back to sleep, It does so every 10 seconds. But when it does so it only runs the one process and then goes back to sleep.
system B has the same need, but wakes up every 10 minutes. but when it does so it fully wakes up and this allows the mail app to power up the radio, connect to the Internet and start checking for new mail before oppurtunistic sleep shuts things down (causing the mail check to fail)
Quoted 5 lines
Quoted 1 line
System A will last considerably longer on a battery than System B.
Exactly, thanks for pointing out the specific example :)
~Vitaly
This does not affect suspend_blockers nor does suspend_blockers interfere with that.
Suspend_blockers allow the system to suspend ("mem">/sys/power/state suspend), when the userspace decides that the device is not in use.
So implementing suspend_blockers support does not impact any optimizations done to either system A nor system B.
Cheers,
Flo
2010/6/6 <[email protected]>:
Quoted 6 lines
as an example (taken from this thread).
system A needs to wake up to get a battery reading, store it and go back to sleep, It does so every 10 seconds. But when it does so it only runs the one process and then goes back to sleep.
Quoted 6 lines
system B has the same need, but wakes up every 10 minutes. but when it does so it fully wakes up and this allows the mail app to power up the radio, connect to the Internet and start checking for new mail before oppurtunistic sleep shuts things down (causing the mail check to fail)
System A will last considerably longer on a battery than System B.
Exactly, thanks for pointing out the specific example :)
~Vitaly
Quoted 3 lines · On Sun, 6 Jun 2010 12:00:47 +0200 Vitaly Wool <[email protected]> wrote:
Even worse, the suspend wakelock will keep the
whole kernel active, as opposed to powering off unused devices separately as it's done in runtime PM.
That is not true. While the kernel is not suspended it does runtime pm.
Quoted 8 lines
Quoted 4 lines
Users do like that to work too -- I recall Arve leaving a device in his filing cabinet with the radio off while he was out of the country for three weeks once, and him discovering it was still running with something like 25% battery remaining when he returned.
So what you're actually up to is that a user should restart the phone and turn the radio off if he wants to find it running when he's back from a long business trip or something. Nice...
?
Cheers,
Flo
Quoted 3 lines · On Sun, 6 Jun 2010 12:00:47 +0200 Vitaly Wool <[email protected]> wrote:
Even worse, the suspend wakelock will keep the
whole kernel active, as opposed to powering off unused devices separately as it's done in runtime PM.
That is not true. While the kernel is not suspended it does runtime pm.
Quoted 8 lines
Quoted 4 lines
Users do like that to work too -- I recall Arve leaving a device in his filing cabinet with the radio off while he was out of the country for three weeks once, and him discovering it was still running with something like 25% battery remaining when he returned.
So what you're actually up to is that a user should restart the phone and turn the radio off if he wants to find it running when he's back from a long business trip or something. Nice...
?
Cheers,
Flo
Quoted 9 lines · On Sun, 6 Jun 2010 12:46:01 +0200 Florian Mickler <[email protected]> wrote:
Quoted 3 lines · On Sun, 6 Jun 2010 12:00:47 +0200 Vitaly Wool <[email protected]> wrote:
Even worse, the suspend wakelock will keep the
whole kernel active, as opposed to powering off unused devices separately as it's done in runtime PM.That is not true. While the kernel is not suspended it does runtime pm.
On several of our platforms runtime PM already includes suspend so a suspend wakelock does interfere with existing power managemet at that level (not to mention the maintenance mess it causes).
This is one of the reasons you want QoS information, it provides parameters by which the power management code can make a decision. Suspend blocksers simply don't have sufficient variety to manage the direction of power policy.
If Android chooses to abuse the QoS information for crude suspend blocking then that is fine, it doesn't interfere with doing the job 'properly' on other systems or its use for realtime work on other boxes.
Alan
Quoted 8 lines · Alan Cox
Quoted 2 lines · On Sun, 6 Jun 2010 12:46:01 +0200 Florian Mickler <[email protected]> wrote:
That is not true. While the kernel is not suspended it does runtime pm.
On several of our platforms runtime PM already includes suspend so a suspend wakelock does interfere with existing power managemet at that level (not to mention the maintenance mess it causes).
No, it doesn't. Android on omap will enter the mpu/core off state from the idle loop even if a suspend block is held.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 8 lines · Alan Cox
Quoted 2 lines · On Sun, 6 Jun 2010 12:46:01 +0200 Florian Mickler <[email protected]> wrote:
That is not true. While the kernel is not suspended it does runtime pm.
On several of our platforms runtime PM already includes suspend so a suspend wakelock does interfere with existing power managemet at that level (not to mention the maintenance mess it causes).
No, it doesn't. Android on omap will enter the mpu/core off state from the idle loop even if a suspend block is held.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 17 lines · Alan Cox
Quoted 9 lines · On Sun, 6 Jun 2010 12:46:01 +0200 Florian Mickler <[email protected]> wrote:
Quoted 3 lines · On Sun, 6 Jun 2010 12:00:47 +0200 Vitaly Wool <[email protected]> wrote:
Even worse, the suspend wakelock will keep the
whole kernel active, as opposed to powering off unused devices separately as it's done in runtime PM.That is not true. While the kernel is not suspended it does runtime pm.
On several of our platforms runtime PM already includes suspend so a suspend wakelock does interfere with existing power managemet at that level (not to mention the maintenance mess it causes).
Quoted 8 lines
This is one of the reasons you want QoS information, it provides parameters by which the power management code can make a decision. Suspend blocksers simply don't have sufficient variety to manage the direction of power policy.
If Android chooses to abuse the QoS information for crude suspend blocking then that is fine, it doesn't interfere with doing the job 'properly' on other systems or its use for realtime work on other boxes.
Right ... and I think we can make use of this as an incremental way forwards. This QoS re-expression needs doing for the suspend from idle
+ cgroup approach, and it can be made to work with the current suspend blockers patch.
I've already posted most of the necessary improvements to pm_qos, all of which end up looking like the right thing to do independent of android. There's really only one remaining thing, and that's adding statistics.
Once stats are added, I think I can transform the 8 android patches into a set of 7 pm_qos transformations and one patch that adds the opportunistic suspend infrastructure. The 7 pm_qos patches should be reasonably uncontroversial, but what they would allow us to do is to unblock about 75% of the driver divergences from Qualcomm and others. The 1 opportunistic suspend one will be confined to one or two files, so is easy to maintain ... we can then argue over who should maintain it in the interim, us or Google.
Quoted 1 line
From this basis, we can then proceed to look at implementing the cgroups
+ suspend from idle approach, and we can do this regardless of whether the opportunistic suspend patch is applied or not.
There are three reasons why the whole debate is going in circles
1. Lots of people are taking a holistic approach (i.e. must solve everything) ... this means that previously unarticulated issues keep cropping up that are unrelated to the current patch set ... but which set off another cascade of emails.
2. There currently is no cgroups + suspend from idle approach implemented anywhere. That means we have to argue theoreticals rather than actuals (theoreticals are easy to shoot down with other theoretical arguments ... leading to another email cascade). If we implemented the thing, these arguments would compare one factual basis to another.
3. We've lost sight of one of the original goals, which was to bring the android tree close enough to the kernel so that the android downstream driver and board producers don't have to choose between the android kernel and vanilla kernel.
I think the proposal above gets us to within 75% of the way to 3, moves us towards a factual basis for 2 and eliminates some of the grounds for argument of 1 ... now can we please get on with it?
James
Quoted 5 lines · James Bottomley
3. We've lost sight of one of the original goals, which was to bring the android tree close enough to the kernel so that the android downstream driver and board producers don't have to choose between the android kernel and vanilla kernel.
There are two ways to do that w/o creating a dependcy on anything.
1) merge the drivers w/o the suspend_blockers. It's not rocket science to have a patch which brings them back for android.
2) merge the drivers with empty stub implementations for annotation. android just has to patch in the real one.
While I'd prefer #1, I' not in the way of #2.
Both ways can get the drivers into the kernel and it could/should have been done right from the beginning, but now we face a situation where drivers are held hostage.
Then we can sit down more relaxed and fix the stuff in a way which makes both sides happy. If we manage to replace them, we can deprecate the stub implementation and remove it after a grace period. If we rename them it's not an issue either. We can rename them right away to a qos interface, but that does not really make a difference.
What we really want to avoid is implementing an user space contract in a frenzy which binds us forever.
It's not the suspend_blockers which are the causing the nightmare, it's solely the drivers itself especially when there are different implementations in both trees. And frankly, the drivers in android are not in a shape which makes them flood in within 2 weeks. That's serious work to get them brushed up and polished. So that gives us quite a period of time to solve the suspend problem.
Thanks,
tglx
Quoted 5 lines · James Bottomley
3. We've lost sight of one of the original goals, which was to bring the android tree close enough to the kernel so that the android downstream driver and board producers don't have to choose between the android kernel and vanilla kernel.
There are two ways to do that w/o creating a dependcy on anything.
1) merge the drivers w/o the suspend_blockers. It's not rocket science to have a patch which brings them back for android.
2) merge the drivers with empty stub implementations for annotation. android just has to patch in the real one.
While I'd prefer #1, I' not in the way of #2.
Both ways can get the drivers into the kernel and it could/should have been done right from the beginning, but now we face a situation where drivers are held hostage.
Then we can sit down more relaxed and fix the stuff in a way which makes both sides happy. If we manage to replace them, we can deprecate the stub implementation and remove it after a grace period. If we rename them it's not an issue either. We can rename them right away to a qos interface, but that does not really make a difference.
What we really want to avoid is implementing an user space contract in a frenzy which binds us forever.
It's not the suspend_blockers which are the causing the nightmare, it's solely the drivers itself especially when there are different implementations in both trees. And frankly, the drivers in android are not in a shape which makes them flood in within 2 weeks. That's serious work to get them brushed up and polished. So that gives us quite a period of time to solve the suspend problem.
Thanks,
tglx
Quoted 11 lines · Thomas Gleixner
Quoted 5 lines · James Bottomley
3. We've lost sight of one of the original goals, which was to bring the android tree close enough to the kernel so that the android downstream driver and board producers don't have to choose between the android kernel and vanilla kernel.
There are two ways to do that w/o creating a dependcy on anything.
1) merge the drivers w/o the
suspend_blockers. It's not rocket science to have a patch which brings them back for android.
Well, we sort of tried this when Greg pulled some of them into the staging tree. The problem is that without the annotations, the drivers are still different, and patches won't apply, so, unsurprisingly, they didn't get improved or even maintained.
Quoted 2 lines
2) merge the drivers with empty stub implementations for annotation. android just has to patch in the real one.
That's also possible. This time, we would have a cosmetically closer tree ... however, what's in the kernel wouldn't be compilable for android ... which is where all the downstream wants to test, so they'd still be building for the android tree ... we just might have an easier time of it picking up their fixes.
Quoted 1 line
While I'd prefer #1, I' not in the way of #2.
I think 1 is unviable ... I'm not opposed to 2 but I'd like to try to get the kernel really closer to android before we go for the cosmetic only option.
Quoted 4 lines
Both ways can get the drivers into the kernel and it could/should have been done right from the beginning, but now we face a situation where drivers are held hostage.
Quoted 8 lines
Then we can sit down more relaxed and fix the stuff in a way which makes both sides happy. If we manage to replace them, we can deprecate the stub implementation and remove it after a grace period. If we rename them it's not an issue either. We can rename them right away to a qos interface, but that does not really make a difference.
What we really want to avoid is implementing an user space contract in a frenzy which binds us forever.
Well, that's why the QoS proposal ... it already has a userspace API ... we'd just be extending it for statistics, which looks like a wothwhile goal independent of android anyway.
Quoted 6 lines
It's not the
suspend_blockerswhich are the causing the nightmare, it's solely the drivers itself especially when there are different implementations in both trees. And frankly, the drivers in android are not in a shape which makes them flood in within 2 weeks. That's serious work to get them brushed up and polished. So that gives us quite a period of time to solve the suspend problem.
Right, so the sooner we make it easier for the drivers to use the kernel as their main repository, the better.
James
James,
Quoted 18 lines · James Bottomley
Quoted 11 lines · Thomas Gleixner
Quoted 5 lines · James Bottomley
3. We've lost sight of one of the original goals, which was to bring the android tree close enough to the kernel so that the android downstream driver and board producers don't have to choose between the android kernel and vanilla kernel.
There are two ways to do that w/o creating a dependcy on anything.
1) merge the drivers w/o the
suspend_blockers. It's not rocket science to have a patch which brings them back for android.Well, we sort of tried this when Greg pulled some of them into the staging tree. The problem is that without the annotations, the drivers are still different, and patches won't apply, so, unsurprisingly, they didn't get improved or even maintained.
Quoted 8 lines
Quoted 2 lines
2) merge the drivers with empty stub implementations for annotation. android just has to patch in the real one.
That's also possible. This time, we would have a cosmetically closer tree ... however, what's in the kernel wouldn't be compilable for android ... which is where all the downstream wants to test, so they'd still be building for the android tree ... we just might have an easier time of it picking up their fixes.
The downstream users will be bound to the android tree anyway until the full set of drivers for a given platform is completely merged. So optimistically that would be 2.6.36, which gives us a couple of months to sort out the whole thing.
Once a driver is merged mainline and the android tree switched over to use the mainline version, fixes can be sent both ways and that's not a real problem.
Quoted 16 lines
Quoted 1 line
While I'd prefer #1, I' not in the way of #2.
I think 1 is unviable ... I'm not opposed to 2 but I'd like to try to get the kernel really closer to android before we go for the cosmetic only option.
Quoted 10 lines
Both ways can get the drivers into the kernel and it could/should have been done right from the beginning, but now we face a situation where drivers are held hostage.
Then we can sit down more relaxed and fix the stuff in a way which makes both sides happy. If we manage to replace them, we can deprecate the stub implementation and remove it after a grace period. If we rename them it's not an issue either. We can rename them right away to a qos interface, but that does not really make a difference.
Quoted 6 lines
Quoted 2 lines
What we really want to avoid is implementing an user space contract in a frenzy which binds us forever.
Well, that's why the QoS proposal ... it already has a userspace API ... we'd just be extending it for statistics, which looks like a wothwhile goal independent of android anyway.
Right, but there is no dependency for the driver merge on that.
Quoted 9 lines
Quoted 6 lines
It's not the
suspend_blockerswhich are the causing the nightmare, it's solely the drivers itself especially when there are different implementations in both trees. And frankly, the drivers in android are not in a shape which makes them flood in within 2 weeks. That's serious work to get them brushed up and polished. So that gives us quite a period of time to solve the suspend problem.Right, so the sooner we make it easier for the drivers to use the kernel as their main repository, the better.
Yep, the fastest way is to provide two stub inlines in pm.h and let the driver flood come in.
I think all of us involved in that can do with a break, where we sit back, calm down and rethink w/o time pressure.
Thanks,
tglx
Quoted 6 lines · Thomas Gleixner
Quoted 3 lines
Right, so the sooner we make it easier for the drivers to use the kernel as their main repository, the better.
Yep, the fastest way is to provide two stub inlines in
pm.hand let the driver flood come in.
As mentioned previously, we didn't know this was an option (stubs without an implementation behind them). If it is, and thus we can simplify the driver merging process short-term while sorting out a long-term implementation or replacement for suspend blockers, then I think we're making real progress.
There is no reason that drivers that support suspend blockers cannot (or should not) support regular suspend/resume or runtime suspend/resume, so that shouldn't be a worry. The various operating modes complement, not compete with each other (we want the lowest possible power consumption in all states, be that fully active, fully suspended, or anything in between -- I think everyone involved agrees with this).
Quoted 2 lines
I think all of us involved in that can do with a break, where we sit back, calm down and rethink w/o time pressure.
Total agreement.
Brian
Quoted 6 lines · Thomas Gleixner
Quoted 3 lines
Right, so the sooner we make it easier for the drivers to use the kernel as their main repository, the better.
Yep, the fastest way is to provide two stub inlines in
pm.hand let the driver flood come in.
As mentioned previously, we didn't know this was an option (stubs without an implementation behind them). If it is, and thus we can simplify the driver merging process short-term while sorting out a long-term implementation or replacement for suspend blockers, then I think we're making real progress.
There is no reason that drivers that support suspend blockers cannot (or should not) support regular suspend/resume or runtime suspend/resume, so that shouldn't be a worry. The various operating modes complement, not compete with each other (we want the lowest possible power consumption in all states, be that fully active, fully suspended, or anything in between -- I think everyone involved agrees with this).
Quoted 2 lines
I think all of us involved in that can do with a break, where we sit back, calm down and rethink w/o time pressure.
Total agreement.
Brian
Quoted 10 lines · Brian Swetland
Quoted 6 lines · Thomas Gleixner
Quoted 3 lines
Right, so the sooner we make it easier for the drivers to use the kernel as their main repository, the better.
Yep, the fastest way is to provide two stub inlines in
pm.hand let the driver flood come in.As mentioned previously, we didn't know this was an option (stubs without an implementation behind them). If it is, and thus we can
That's what Greg did when he pulled stuff into staging, but there is no reason not to do it outside of staging as well. We can simply put the stub functions into Documentation/feature-removal.txt to ensure that we don't forget about them :)
Quoted 3 lines
simplify the driver merging process short-term while sorting out a long-term implementation or replacement for suspend blockers, then I think we're making real progress.
Yes, that way we do not lose the annotations. Replacing them, ripping them out or whatever we agree on, is a nobrainer.
But it gets the drivers into the tree, so they are usable outside of android as well and the delta between android and mainline shrinks significantly.
Thanks,
tglx
James,
Quoted 18 lines · James Bottomley
Quoted 11 lines · Thomas Gleixner
Quoted 5 lines · James Bottomley
3. We've lost sight of one of the original goals, which was to bring the android tree close enough to the kernel so that the android downstream driver and board producers don't have to choose between the android kernel and vanilla kernel.
There are two ways to do that w/o creating a dependcy on anything.
1) merge the drivers w/o the
suspend_blockers. It's not rocket science to have a patch which brings them back for android.Well, we sort of tried this when Greg pulled some of them into the staging tree. The problem is that without the annotations, the drivers are still different, and patches won't apply, so, unsurprisingly, they didn't get improved or even maintained.
Quoted 8 lines
Quoted 2 lines
2) merge the drivers with empty stub implementations for annotation. android just has to patch in the real one.
That's also possible. This time, we would have a cosmetically closer tree ... however, what's in the kernel wouldn't be compilable for android ... which is where all the downstream wants to test, so they'd still be building for the android tree ... we just might have an easier time of it picking up their fixes.
The downstream users will be bound to the android tree anyway until the full set of drivers for a given platform is completely merged. So optimistically that would be 2.6.36, which gives us a couple of months to sort out the whole thing.
Once a driver is merged mainline and the android tree switched over to use the mainline version, fixes can be sent both ways and that's not a real problem.
Quoted 16 lines
Quoted 1 line
While I'd prefer #1, I' not in the way of #2.
I think 1 is unviable ... I'm not opposed to 2 but I'd like to try to get the kernel really closer to android before we go for the cosmetic only option.
Quoted 10 lines
Both ways can get the drivers into the kernel and it could/should have been done right from the beginning, but now we face a situation where drivers are held hostage.
Then we can sit down more relaxed and fix the stuff in a way which makes both sides happy. If we manage to replace them, we can deprecate the stub implementation and remove it after a grace period. If we rename them it's not an issue either. We can rename them right away to a qos interface, but that does not really make a difference.
Quoted 6 lines
Quoted 2 lines
What we really want to avoid is implementing an user space contract in a frenzy which binds us forever.
Well, that's why the QoS proposal ... it already has a userspace API ... we'd just be extending it for statistics, which looks like a wothwhile goal independent of android anyway.
Right, but there is no dependency for the driver merge on that.
Quoted 9 lines
Quoted 6 lines
It's not the
suspend_blockerswhich are the causing the nightmare, it's solely the drivers itself especially when there are different implementations in both trees. And frankly, the drivers in android are not in a shape which makes them flood in within 2 weeks. That's serious work to get them brushed up and polished. So that gives us quite a period of time to solve the suspend problem.Right, so the sooner we make it easier for the drivers to use the kernel as their main repository, the better.
Yep, the fastest way is to provide two stub inlines in pm.h and let the driver flood come in.
I think all of us involved in that can do with a break, where we sit back, calm down and rethink w/o time pressure.
Thanks,
tglx
Quoted 4 lines · James Bottomley
Well, we sort of tried this when Greg pulled some of them into the staging tree. The problem is that without the annotations, the drivers are still different, and patches won't apply, so, unsurprisingly, they didn't get improved or even maintained.
Err, the biggest pile in staging was meta drivers like the binder or some oom killer magic which are flat out braindead and wrong and have no chance going into mainline anyway. That's something different from real hardware drivers, although a few of those made it into staging as well if I remember correctly.
Quoted 11 lines · Christoph Hellwig
Quoted 4 lines · James Bottomley
Well, we sort of tried this when Greg pulled some of them into the staging tree. The problem is that without the annotations, the drivers are still different, and patches won't apply, so, unsurprisingly, they didn't get improved or even maintained.
Err, the biggest pile in staging was meta drivers like the binder or some oom killer magic which are flat out braindead and wrong and have no chance going into mainline anyway. That's something different from real hardware drivers, although a few of those made it into staging as well if I remember correctly.
I was shocked when Greg pulled the binder driver and some of the other "generic" android drivers into staging, because it was always my assumption that nobody upstream would want them. We did get some bugfixes for the binder driver (thanks!) but the general reaction was pretty much the same as yours here. I then was relatively unsurprised when it was dropped (we find it useful, upstream finds it useless, not much else to say).
The various SoC peripheral drivers are, I suspect, much less contentious (modulo suspend blocker usage and any necessary kernel style cleanup).
Brian
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 11 lines · Brian Swetland
I was shocked when Greg pulled the binder driver and some of the other "generic" android drivers into staging, because it was always my assumption that nobody upstream would want them. We did get some bugfixes for the binder driver (thanks!) but the general reaction was pretty much the same as yours here. I then was relatively unsurprised when it was dropped (we find it useful, upstream finds it useless, not much else to say).
The various SoC peripheral drivers are, I suspect, much less contentious (modulo suspend blocker usage and any necessary kernel style cleanup).
Yes. That's what makes me wonder about some parts of the discussion here. Getting the drivers for one or more of the android plattforms in is not a problem. I'd say it could have easily been done with the manweeks spent arguing in this and related threads.
The much bigger issues is to get android userspace running on a more or less vanilla kernel, that is withoutthe binder, without the rather interesting group ID based security hack^H^H^H^Hmodel, without the suspend blocker userspace API and so on, and so on.
So for people who really care about running a mainline kernel on their android device doing that part first on a generic ARM board in qemu
might be much better first step work. On the other hand I've heard
that various hardware vendors or parties closed to them are rather annoyed by their drivers beeing stuck in the android tree - but that can be easily solved by getting removing the suspend blockers (at least temporarily), cleaning up a few bits here and there and getting them in.
It's not rocket science to get support for ARM SOC number 1654 into the mainline kernel.
Quoted 10 lines · Christoph Hellwig
Yes. That's what makes me wonder about some parts of the discussion here. Getting the drivers for one or more of the android plattforms in is not a problem. I'd say it could have easily been done with the manweeks spent arguing in this and related threads.
The much bigger issues is to get android userspace running on a more or less vanilla kernel, that is withoutthe binder, without the rather interesting group ID based security hack^H^H^H^Hmodel, without the suspend blocker userspace API and so on, and so on.
Somebody will have to broker a deal with the frameworks/apps folks to get rid of the binder. They like it a lot. Of course if somebody built a drop-in replacement for the userspace side that didn't require a kernel driver, had the same performance characteristics, solved the same problems, etc, they could probably make an argument for it (or just provide it as a drop-in replacement for people who want a more "pure" linux underneath Android, even if we didn't pick it up).
The group ID stuff works incredibly well for gating device access -- we ensure that devices that need access from various processes end up with perms like 0660 root audio (say for a raw audio interface), and then we assure that processes which have the "may use audio hardware" permission are executed with audio as an additional group. We ended up using the same model to control socket, raw socket, and bt socket access because at the time we could not find a reasonable way to grant or exclude such permissions on a process by process basis. Maintaining about 20-30 lines of diffs to make that work was not a bad tradeoff (and we don't expect those patches to go upstream). If there's a way to accomplish this without patching the kernel, we're all ears.
While we do maintain some assorted patches to core code (like the permissions thing), we strongly prefer to keep our work localized to drivers (generic to android or specific to hardware), and try to migrate to common kernel features when possible, submit patches (like work Mike Chan is doing around cpufreq and power measurement), etc. Patches to core code cause more headaches when we rebase up to new kernel versions, after all.
Quoted 9 lines
So for people who really care about running a mainline kernel on their android device doing that part first on a generic ARM board in qemu might be much better first step work.
On the other hand I've heard
that various hardware vendors or parties closed to them are rather annoyed by their drivers beeing stuck in the android tree - but that can be easily solved by getting removing the suspend blockers (at least temporarily), cleaning up a few bits here and there and getting them in.
This continues to baffle me. If we (Google) are such a headache, why not just route around us. The drivers we've written are GPLv2, the source is out there for anyone who wants it, etc. The drivers other people have written we have no control over at all. From my point of view it'd be an annoyance if somebody took the code we wrote, modified it heavily, and pushed it upstream, but fundamentally I can't stop that from happening other than by pushing it upstream myself, first.
Blaming me because you want me to send your drivers upstream and I'm not doing it or not doing it fast enough or not doing it the way you like does not seem very productive. I'm not a gatekeeper for patch submission to the mainline kernel.
Brian
Brian,
Quoted 33 lines · Brian Swetland
Quoted 10 lines · Christoph Hellwig
Yes. That's what makes me wonder about some parts of the discussion here. Getting the drivers for one or more of the android plattforms in is not a problem. I'd say it could have easily been done with the manweeks spent arguing in this and related threads.
The much bigger issues is to get android userspace running on a more or less vanilla kernel, that is withoutthe binder, without the rather interesting group ID based security hack^H^H^H^Hmodel, without the suspend blocker userspace API and so on, and so on.
Somebody will have to broker a deal with the frameworks/apps folks to get rid of the binder. They like it a lot. Of course if somebody built a drop-in replacement for the userspace side that didn't require a kernel driver, had the same performance characteristics, solved the same problems, etc, they could probably make an argument for it (or just provide it as a drop-in replacement for people who want a more "pure" linux underneath Android, even if we didn't pick it up).
The group ID stuff works incredibly well for gating device access -- we ensure that devices that need access from various processes end up with perms like 0660 root audio (say for a raw audio interface), and then we assure that processes which have the "may use audio hardware" permission are executed with audio as an additional group. We ended up using the same model to control socket, raw socket, and bt socket access because at the time we could not find a reasonable way to grant or exclude such permissions on a process by process basis. Maintaining about 20-30 lines of diffs to make that work was not a bad tradeoff (and we don't expect those patches to go upstream). If there's a way to accomplish this without patching the kernel, we're all ears.
Quoted 7 lines
While we do maintain some assorted patches to core code (like the permissions thing), we strongly prefer to keep our work localized to drivers (generic to android or specific to hardware), and try to migrate to common kernel features when possible, submit patches (like work Mike Chan is doing around cpufreq and power measurement), etc. Patches to core code cause more headaches when we rebase up to new kernel versions, after all.
thanks for the honest answer and thanks to Christoph for the reminder!
That takes a lot of the bullshit arguments about downstream users being hurt out of the discussion. The above problems are way more complex to resolve than the suspend blocker details.
That's another prove why we can let the drivers flow in (in the worst case w/o the suspend blocker stubs) and have no pressure to resolve the suspend blocker problem yesterday.
That said, after thinking more about it, I'm advocating the stubs solution with a clear removal / decision date constraint (e.g. 2.6.37), as it forces all involved parties to stay tuned and not to forget about it. I'm curious about the outcome :)
Thanks,
tglx
Brian,
Quoted 33 lines · Brian Swetland
Quoted 10 lines · Christoph Hellwig
Yes. That's what makes me wonder about some parts of the discussion here. Getting the drivers for one or more of the android plattforms in is not a problem. I'd say it could have easily been done with the manweeks spent arguing in this and related threads.
The much bigger issues is to get android userspace running on a more or less vanilla kernel, that is withoutthe binder, without the rather interesting group ID based security hack^H^H^H^Hmodel, without the suspend blocker userspace API and so on, and so on.
Somebody will have to broker a deal with the frameworks/apps folks to get rid of the binder. They like it a lot. Of course if somebody built a drop-in replacement for the userspace side that didn't require a kernel driver, had the same performance characteristics, solved the same problems, etc, they could probably make an argument for it (or just provide it as a drop-in replacement for people who want a more "pure" linux underneath Android, even if we didn't pick it up).
The group ID stuff works incredibly well for gating device access -- we ensure that devices that need access from various processes end up with perms like 0660 root audio (say for a raw audio interface), and then we assure that processes which have the "may use audio hardware" permission are executed with audio as an additional group. We ended up using the same model to control socket, raw socket, and bt socket access because at the time we could not find a reasonable way to grant or exclude such permissions on a process by process basis. Maintaining about 20-30 lines of diffs to make that work was not a bad tradeoff (and we don't expect those patches to go upstream). If there's a way to accomplish this without patching the kernel, we're all ears.
Quoted 7 lines
While we do maintain some assorted patches to core code (like the permissions thing), we strongly prefer to keep our work localized to drivers (generic to android or specific to hardware), and try to migrate to common kernel features when possible, submit patches (like work Mike Chan is doing around cpufreq and power measurement), etc. Patches to core code cause more headaches when we rebase up to new kernel versions, after all.
thanks for the honest answer and thanks to Christoph for the reminder!
That takes a lot of the bullshit arguments about downstream users being hurt out of the discussion. The above problems are way more complex to resolve than the suspend blocker details.
That's another prove why we can let the drivers flow in (in the worst case w/o the suspend blocker stubs) and have no pressure to resolve the suspend blocker problem yesterday.
That said, after thinking more about it, I'm advocating the stubs solution with a clear removal / decision date constraint (e.g. 2.6.37), as it forces all involved parties to stay tuned and not to forget about it. I'm curious about the outcome :)
Thanks,
tglx
Quoted 4 lines · Thomas Gleixner
That takes a lot of the bullshit arguments about downstream users being hurt out of the discussion. The above problems are way more complex to resolve than the suspend blocker details.
Quoted 8 lines
That's another prove why we can let the drivers flow in (in the worst case w/o the suspend blocker stubs) and have no pressure to resolve the suspend blocker problem yesterday.
That said, after thinking more about it, I'm advocating the stubs solution with a clear removal / decision date constraint (e.g. 2.6.37), as it forces all involved parties to stay tuned and not to forget about it. I'm curious about the outcome :)
As long as we have that clear removal schedule I'm fine with in-kernel suspend blocker stubs.
Quoted 4 lines · Thomas Gleixner
That takes a lot of the bullshit arguments about downstream users being hurt out of the discussion. The above problems are way more complex to resolve than the suspend blocker details.
Quoted 8 lines
That's another prove why we can let the drivers flow in (in the worst case w/o the suspend blocker stubs) and have no pressure to resolve the suspend blocker problem yesterday.
That said, after thinking more about it, I'm advocating the stubs solution with a clear removal / decision date constraint (e.g. 2.6.37), as it forces all involved parties to stay tuned and not to forget about it. I'm curious about the outcome :)
As long as we have that clear removal schedule I'm fine with in-kernel suspend blocker stubs.
Quoted 7 lines · Brian Swetland
Somebody will have to broker a deal with the frameworks/apps folks to get rid of the binder. They like it a lot. Of course if somebody built a drop-in replacement for the userspace side that didn't require a kernel driver, had the same performance characteristics, solved the same problems, etc, they could probably make an argument for it (or just provide it as a drop-in replacement for people who want a more "pure" linux underneath Android, even if we didn't pick it up).
This wasn't really directed at you, but rather about people talking about running a mainline kernel on Android in this thread. As I said this is a lot more work then sorting out the drivers - with or without suspend blockers.
Quoted 4 lines
The group ID stuff works incredibly well for gating device access -- we ensure that devices that need access from various processes end up with perms like 0660 root audio (say for a raw audio interface), and then we assure that processes which have the "may use audio hardware"
Quoted 8 lines
permission are executed with audio as an additional group. We ended up using the same model to control socket, raw socket, and bt socket access because at the time we could not find a reasonable way to grant or exclude such permissions on a process by process basis. Maintaining about 20-30 lines of diffs to make that work was not a bad tradeoff (and we don't expect those patches to go upstream). If there's a way to accomplish this without patching the kernel, we're all ears.
I'd have to take a look again on how this is implemented in details. If it's just overriding the capabilities it's really hard to do in the current model as the capabilities aren't fine grained enough currently, even with the existing per-file and per-process capabilities. If it's mostly overriding regular unix file permissions it's easily doable with ACLs, or in fact just with group ownership at the filesystem level, without kernel hacks.
Quoted 14 lines · Christoph Hellwig
Quoted 4 lines · Brian Swetland
The group ID stuff works incredibly well for gating device access -- we ensure that devices that need access from various processes end up with perms like 0660 root audio (say for a raw audio interface), and then we assure that processes which have the "may use audio hardware"
Quoted 8 lines
permission are executed with audio as an additional group. We ended up using the same model to control socket, raw socket, and bt socket access because at the time we could not find a reasonable way to grant or exclude such permissions on a process by process basis. Maintaining about 20-30 lines of diffs to make that work was not a bad tradeoff (and we don't expect those patches to go upstream). If there's a way to accomplish this without patching the kernel, we're all ears.
Quoted 7 lines
I'd have to take a look again on how this is implemented in details. If it's just overriding the capabilities it's really hard to do in the current model as the capabilities aren't fine grained enough currently, even with the existing per-file and per-process capabilities. If it's mostly overriding regular unix file permissions it's easily doable with ACLs, or in fact just with group ownership at the filesystem level, without kernel hacks.
For device nodes, we just use group ownership and it works fine with no kernel modifications. For the "can create socket", "can create bt socket", and "can create raw socket" permissions we ended up throwing together a patch tying those operations to being in the appropriate group. Obviously a hack, but it was the most straightforward solution we could find at the time.
Brian
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 14 lines · Christoph Hellwig
Quoted 4 lines · Brian Swetland
The group ID stuff works incredibly well for gating device access -- we ensure that devices that need access from various processes end up with perms like 0660 root audio (say for a raw audio interface), and then we assure that processes which have the "may use audio hardware"
Quoted 8 lines
permission are executed with audio as an additional group. We ended up using the same model to control socket, raw socket, and bt socket access because at the time we could not find a reasonable way to grant or exclude such permissions on a process by process basis. Maintaining about 20-30 lines of diffs to make that work was not a bad tradeoff (and we don't expect those patches to go upstream). If there's a way to accomplish this without patching the kernel, we're all ears.
Quoted 7 lines
I'd have to take a look again on how this is implemented in details. If it's just overriding the capabilities it's really hard to do in the current model as the capabilities aren't fine grained enough currently, even with the existing per-file and per-process capabilities. If it's mostly overriding regular unix file permissions it's easily doable with ACLs, or in fact just with group ownership at the filesystem level, without kernel hacks.
For device nodes, we just use group ownership and it works fine with no kernel modifications. For the "can create socket", "can create bt socket", and "can create raw socket" permissions we ended up throwing together a patch tying those operations to being in the appropriate group. Obviously a hack, but it was the most straightforward solution we could find at the time.
Brian
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 7 lines · Brian Swetland
Somebody will have to broker a deal with the frameworks/apps folks to get rid of the binder. They like it a lot. Of course if somebody built a drop-in replacement for the userspace side that didn't require a kernel driver, had the same performance characteristics, solved the same problems, etc, they could probably make an argument for it (or just provide it as a drop-in replacement for people who want a more "pure" linux underneath Android, even if we didn't pick it up).
This wasn't really directed at you, but rather about people talking about running a mainline kernel on Android in this thread. As I said this is a lot more work then sorting out the drivers - with or without suspend blockers.
Quoted 4 lines
The group ID stuff works incredibly well for gating device access -- we ensure that devices that need access from various processes end up with perms like 0660 root audio (say for a raw audio interface), and then we assure that processes which have the "may use audio hardware"
Quoted 8 lines
permission are executed with audio as an additional group. We ended up using the same model to control socket, raw socket, and bt socket access because at the time we could not find a reasonable way to grant or exclude such permissions on a process by process basis. Maintaining about 20-30 lines of diffs to make that work was not a bad tradeoff (and we don't expect those patches to go upstream). If there's a way to accomplish this without patching the kernel, we're all ears.
I'd have to take a look again on how this is implemented in details. If it's just overriding the capabilities it's really hard to do in the current model as the capabilities aren't fine grained enough currently, even with the existing per-file and per-process capabilities. If it's mostly overriding regular unix file permissions it's easily doable with ACLs, or in fact just with group ownership at the filesystem level, without kernel hacks.
Quoted 7 lines · Brian Swetland
Somebody will have to broker a deal with the frameworks/apps folks to get rid of the binder. They like it a lot. Of course if somebody built a drop-in replacement for the userspace side that didn't require a kernel driver, had the same performance characteristics, solved the same problems, etc, they could probably make an argument for it (or just provide it as a drop-in replacement for people who want a more "pure" linux underneath Android, even if we didn't pick it up).
So what's up with this Binder stuff, from what I can see its just yet-another-CORBA. Why does it need a kernel part at all, can't you simply run with a user-space ORB instead?
I really don't get why people keep re-inventing CORBA, there's some really nice (free) ORBs out there, like:
Quoted 7 lines · Brian Swetland
Somebody will have to broker a deal with the frameworks/apps folks to get rid of the binder. They like it a lot. Of course if somebody built a drop-in replacement for the userspace side that didn't require a kernel driver, had the same performance characteristics, solved the same problems, etc, they could probably make an argument for it (or just provide it as a drop-in replacement for people who want a more "pure" linux underneath Android, even if we didn't pick it up).
So what's up with this Binder stuff, from what I can see its just yet-another-CORBA. Why does it need a kernel part at all, can't you simply run with a user-space ORB instead?
I really don't get why people keep re-inventing CORBA, there's some really nice (free) ORBs out there, like:
Quoted 7 lines · Peter Zijlstra
So what's up with this Binder stuff, from what I can see its just
yet-another-CORBA. Why does it need a kernel part at all, can't you
simply run with a user-space ORB instead?I really don't get why people keep re-inventing CORBA,
That made me laugh. Do you realize that one of the earliest objections to CORBA was "why do people keep re-inventing RPC" ... :)
(Simple answer: the existing stuff didn't solve enough of the right problems ... and it was easier (in a political sense) to come up with something new than to try fixing DCE or ONC (or whatever). Similar answers may still apply ... last I looked at CORBA, it didn't standardize desktop integration (or cell-phone equivalents), and the pure user-space versions suffered slowdowns when looking up object bindings.
Quoted 1 line
there's some really nice (free) ORBs out there,
Quoted 7 lines · Peter Zijlstra
So what's up with this Binder stuff, from what I can see its just
yet-another-CORBA. Why does it need a kernel part at all, can't you
simply run with a user-space ORB instead?I really don't get why people keep re-inventing CORBA,
That made me laugh. Do you realize that one of the earliest objections to CORBA was "why do people keep re-inventing RPC" ... :)
(Simple answer: the existing stuff didn't solve enough of the right problems ... and it was easier (in a political sense) to come up with something new than to try fixing DCE or ONC (or whatever). Similar answers may still apply ... last I looked at CORBA, it didn't standardize desktop integration (or cell-phone equivalents), and the pure user-space versions suffered slowdowns when looking up object bindings.
Quoted 1 line
there's some really nice (free) ORBs out there,
2010/6/7 Peter Zijlstra <[email protected]>:
Quoted 9 lines · Brian Swetland
Quoted 7 lines
Somebody will have to broker a deal with the frameworks/apps folks to get rid of the binder. They like it a lot. Of course if somebody built a drop-in replacement for the userspace side that didn't require a kernel driver, had the same performance characteristics, solved the same problems, etc, they could probably make an argument for it (or just provide it as a drop-in replacement for people who want a more "pure" linux underneath Android, even if we didn't pick it up).
Quoted 8 lines
So what's up with this Binder stuff, from what I can see its just yet-another-CORBA. Why does it need a kernel part at all, can't you simply run with a user-space ORB instead?
I really don't get why people keep re-inventing CORBA, there's some really nice (free) ORBs out there, like:
There was a mailthread on LKML a while back where binder was discussed, where Dianne Hackborn explained in detail how Android uses binder. At the time it was contrasted with D-Bus (the IPC mechanism that has largely replaced DCOP (KDE) and Bonobo (GNOME), the latter was actually CORBA-based).
I don't think there was any conclusion, but it was pretty clear that binder is an Android key asset, actually the key component that the Android people have brought with them from BeOS to Palmsource to Android to Google, and they really really like to use that thing.
It's built into the entire Android userspace for all IPC, except the stuff that's handled by D-Bus instead (yes they have
both for some cases).
What sets binder aside from the others is that it's kernel-based; things like low-latency and large buffer-passing have been mentioned as key features of the kernel driver.
Solving binder one way is to just include it and say it's needed to run Android, the other is to define the technical issue at hand, which is: "can the kernel support high-speed, low-latency, partly marshalled, large-buffer IPC?"
D-Bus (on a local machine, mind you, it can use TCP also) will use a simple unix domain socket by:
socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0)
as can be seen here:
http://cgit.freedesktop.org/dbus/dbus/tree/dbus/dbus-sysdeps-unix.c
ACE/TAO as referenced seems to use only TCP sockets actually:
https://svn.dre.vanderbilt.edu/viewvc/Middleware/trunk/ACE/ace/Sock_Connect.cpp?view=co
Perhaps it simply uses 127.0.0.1 for local IPC. (The source is voluminous and hard for me to navigate, perhaps someone familiar with it can add something here.)
Then either D-Bus or TAO builds a complete marshalling stack on top of these sockets, it's all fully abstract, fully userspace. Several processes and dbus daemons push/pull bytes into these sockets. I think DCOP and Bonobo basically do the same thing, by
the way.
Binder on the other hand is a large kernel module:
http://android.git.kernel.org/?p=kernel/experimental.git;a=blob;f=drivers/staging/android/binder.c;h=e13b4c4834076eb64680457049832af0b92d88b9;hb=android-2.6.34-test2
It will do some serious reference counting, handshaking back-and-forth and so on. Basically a lot of the stuff that other IPC mechanisms also does, but in kernelspace. (OK I'm oversimplifying, binder is far more lightweight for one.)
The bigger question behind it all is this:
Does the kernel provide the proper support for local IPC transport, or is there more it could do in terms of interface, latency, throughput?
A domain socket bitsink should be enough for everybody?
So I would really like to know from the Android people why the binder is in the kernel, after all. Could it *theoretically* be in userspace, on top of some unix domain sockets, running as a real-time scheduled daemon or whatever, still yielding the same performance? Or is there some discovered limitation with current interfaces, that everybody ought to know? Especially authors of D-Bus and TAO etc would be very interested in this I believe.
It's not like I don't understand that it would be hard to move this thing to userspace, it's more that I'd like to know how you think it would be impacted by that.
Yours,
Linus Walleij
Quoted 9 lines · Linus Walleij
So I would really like to know from the Android people why the binder is in the kernel, after all. Could it *theoretically* be in userspace, on top of some unix domain sockets, running as a real-time scheduled daemon or whatever, still yielding the same performance? Or is there some discovered limitation with current interfaces, that everybody ought to know? Especially authors of D-Bus and TAO etc would be very interested in this I believe.
Quoted 3 lines
It's not like I don't understand that it would be hard to move this thing to userspace, it's more that I'd like to know how you think it would be impacted by that.
Fundamentally, yes, you should be able to replicate the functionality in userspace. We considered this during 1.0 development, but it ended up being a lot of risk (at the point when it was discussed) compared to using the existing driver that we had. You almost certainly would need a central daemon to do some state and permission management as well as track some of the refcounting, you could use EPIPE on local sockets to detect remote process termination. You could even just use local sockets for high level control and use shared memory for actual message transport to avoid copy-in-copy-out overhead (another binder driver feature).
That said, the userspace environment was built up around the binder, relies on it heavily for all ipc (except for dbus which we use for bluez because it just hasn't been worth the headache to maintain alternate ipc patches for bluez), and is performance sensitive (it's possible that you could achieve similar performance with a suitably clever userspace implementation making use of shared memory, of course), and the frameworks/apps folks are happy with it as is (so talking them into replacing it may be a nontrivial exercise).
I wouldn't mind not having to maintain the kernel driver (well, not having Arve have to maintain the kernel driver...) but building a pure-userspace replacement would be a pretty huge undertaking, especially given all the other work we have just with general kernel development, bringup, etc.
Since all binder comms in userspace bottlenecks through two small libraries (one C++, one lighter weight C), in theory you could build a drop-in replacement and then prove it out, verify correctness and performance, and make the argument for replacing the existing implementation.
Debugging binder implementation issues under a full system using many binder services and patterns like "client A calls service B which returns and object in service C", is a bit of a nightmare. I try to stay far away from it, myself.
Brian
Quoted 9 lines · Linus Walleij
So I would really like to know from the Android people why the binder is in the kernel, after all. Could it *theoretically* be in userspace, on top of some unix domain sockets, running as a real-time scheduled daemon or whatever, still yielding the same performance? Or is there some discovered limitation with current interfaces, that everybody ought to know? Especially authors of D-Bus and TAO etc would be very interested in this I believe.
Quoted 3 lines
It's not like I don't understand that it would be hard to move this thing to userspace, it's more that I'd like to know how you think it would be impacted by that.
Fundamentally, yes, you should be able to replicate the functionality in userspace. We considered this during 1.0 development, but it ended up being a lot of risk (at the point when it was discussed) compared to using the existing driver that we had. You almost certainly would need a central daemon to do some state and permission management as well as track some of the refcounting, you could use EPIPE on local sockets to detect remote process termination. You could even just use local sockets for high level control and use shared memory for actual message transport to avoid copy-in-copy-out overhead (another binder driver feature).
That said, the userspace environment was built up around the binder, relies on it heavily for all ipc (except for dbus which we use for bluez because it just hasn't been worth the headache to maintain alternate ipc patches for bluez), and is performance sensitive (it's possible that you could achieve similar performance with a suitably clever userspace implementation making use of shared memory, of course), and the frameworks/apps folks are happy with it as is (so talking them into replacing it may be a nontrivial exercise).
I wouldn't mind not having to maintain the kernel driver (well, not having Arve have to maintain the kernel driver...) but building a pure-userspace replacement would be a pretty huge undertaking, especially given all the other work we have just with general kernel development, bringup, etc.
Since all binder comms in userspace bottlenecks through two small libraries (one C++, one lighter weight C), in theory you could build a drop-in replacement and then prove it out, verify correctness and performance, and make the argument for replacing the existing implementation.
Debugging binder implementation issues under a full system using many binder services and patterns like "client A calls service B which returns and object in service C", is a bit of a nightmare. I try to stay far away from it, myself.
Brian
Quoted 6 lines · Linus Walleij
So I would really like to know from the Android people why the binder is in the kernel, after all. Could it *theoretically* be in userspace, on top of some unix domain sockets, running as a real-time scheduled daemon or whatever, still yielding the same performance? Or is there some discovered limitation with current interfaces, that everybody ought to know?
Not an Android person, but...
How expensive is a userspace->kernel transition on Android-class hardware? There's certainly something to be said for short-circuiting the path source_process -> kernel -> broker_process -> kernel -> dest_process down to the shorter source->kernel->dest
Quoted 8 lines · Brian Swetland
Quoted 5 lines · Christoph Hellwig
On the other hand I've heard
that various hardware vendors or parties closed to them are rather annoyed by their drivers beeing stuck in the android tree - but that can be easily solved by getting removing the suspend blockers (at least temporarily), cleaning up a few bits here and there and getting them in.
Quoted 7 lines
This continues to baffle me. If we (Google) are such a headache, why not just route around us. The drivers we've written are GPLv2, the source is out there for anyone who wants it, etc. The drivers other people have written we have no control over at all. From my point of view it'd be an annoyance if somebody took the code we wrote, modified it heavily, and pushed it upstream, but fundamentally I can't stop that from happening other than by pushing it upstream myself, first.
AFAICT this is purely down to the fact that the vendors producing Android devices are using the kernel which is shipped with whatever release they are using so people doing drivers end up getting locked in to an older kernel with old APIs (independant of Android specifics) and don't have the resource to redo things for upstream. Suspend blockers are one more API update in there, but general kernel development creates far more.
I was looking at this just today and one thing that it occurs to me might help is if when you guys rebase your work against upstream you were to tag the results - at the minute the only "release" Android kernels are those included in full stack releases so providing more hints that other kernel versions could be substituted in may help.
Quoted 8 lines · Brian Swetland
Quoted 5 lines · Christoph Hellwig
On the other hand I've heard
that various hardware vendors or parties closed to them are rather annoyed by their drivers beeing stuck in the android tree - but that can be easily solved by getting removing the suspend blockers (at least temporarily), cleaning up a few bits here and there and getting them in.
Quoted 7 lines
This continues to baffle me. If we (Google) are such a headache, why not just route around us. The drivers we've written are GPLv2, the source is out there for anyone who wants it, etc. The drivers other people have written we have no control over at all. From my point of view it'd be an annoyance if somebody took the code we wrote, modified it heavily, and pushed it upstream, but fundamentally I can't stop that from happening other than by pushing it upstream myself, first.
AFAICT this is purely down to the fact that the vendors producing Android devices are using the kernel which is shipped with whatever release they are using so people doing drivers end up getting locked in to an older kernel with old APIs (independant of Android specifics) and don't have the resource to redo things for upstream. Suspend blockers are one more API update in there, but general kernel development creates far more.
I was looking at this just today and one thing that it occurs to me might help is if when you guys rebase your work against upstream you were to tag the results - at the minute the only "release" Android kernels are those included in full stack releases so providing more hints that other kernel versions could be substituted in may help.
HTC Dream drivers was Re: [linux-pm] suspend blockers & Android integration
In reply to Brian SwetlandHi!
Quoted 4 lines
Quoted 3 lines
So for people who really care about running a mainline kernel on their android device doing that part first on a generic ARM board in qemu might be much better first step work.
Quoted 8 lines
Quoted 5 lines
On the other hand I've heard
that various hardware vendors or parties closed to them are rather annoyed by their drivers beeing stuck in the android tree - but that can be easily solved by getting removing the suspend blockers (at least temporarily), cleaning up a few bits here and there and getting them in.This continues to baffle me. If we (Google) are such a headache, why not just route around us. The drivers we've written are GPLv2, the
Well, we did route around you, and that's why the HTC Dream drivers are in
staging.
Unfortunately...
Quoted 5 lines
source is out there for anyone who wants it, etc. The drivers other people have written we have no control over at all. From my point of view it'd be an annoyance if somebody took the code we wrote, modified it heavily, and pushed it upstream, but fundamentally I can't stop that from happening other than by pushing it upstream myself, first.
...you were calling bloody murder when we tried to name them right way -- thats board_dream, not board_trout -- and AFAIK you still did not switch to actually using those drivers so that diffs would grow smaller...
And no, it is not 'just arm architecture #1536'; due to strange baseband/cpu split in msm drivers end up quite big&complex...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
HTC Dream drivers was Re: suspend blockers & Android integration
In reply to Brian SwetlandHi!
Quoted 4 lines
Quoted 3 lines
So for people who really care about running a mainline kernel on their android device doing that part first on a generic ARM board in qemu might be much better first step work.
Quoted 8 lines
Quoted 5 lines
On the other hand I've heard
that various hardware vendors or parties closed to them are rather annoyed by their drivers beeing stuck in the android tree - but that can be easily solved by getting removing the suspend blockers (at least temporarily), cleaning up a few bits here and there and getting them in.This continues to baffle me. If we (Google) are such a headache, why not just route around us. The drivers we've written are GPLv2, the
Well, we did route around you, and that's why the HTC Dream drivers are in
staging.
Unfortunately...
Quoted 5 lines
source is out there for anyone who wants it, etc. The drivers other people have written we have no control over at all. From my point of view it'd be an annoyance if somebody took the code we wrote, modified it heavily, and pushed it upstream, but fundamentally I can't stop that from happening other than by pushing it upstream myself, first.
...you were calling bloody murder when we tried to name them right way -- thats board_dream, not board_trout -- and AFAIK you still did not switch to actually using those drivers so that diffs would grow smaller...
And no, it is not 'just arm architecture #1536'; due to strange baseband/cpu split in msm drivers end up quite big&complex...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 10 lines · Christoph Hellwig
Yes. That's what makes me wonder about some parts of the discussion here. Getting the drivers for one or more of the android plattforms in is not a problem. I'd say it could have easily been done with the manweeks spent arguing in this and related threads.
The much bigger issues is to get android userspace running on a more or less vanilla kernel, that is withoutthe binder, without the rather interesting group ID based security hack^H^H^H^Hmodel, without the suspend blocker userspace API and so on, and so on.
Somebody will have to broker a deal with the frameworks/apps folks to get rid of the binder. They like it a lot. Of course if somebody built a drop-in replacement for the userspace side that didn't require a kernel driver, had the same performance characteristics, solved the same problems, etc, they could probably make an argument for it (or just provide it as a drop-in replacement for people who want a more "pure" linux underneath Android, even if we didn't pick it up).
The group ID stuff works incredibly well for gating device access -- we ensure that devices that need access from various processes end up with perms like 0660 root audio (say for a raw audio interface), and then we assure that processes which have the "may use audio hardware" permission are executed with audio as an additional group. We ended up using the same model to control socket, raw socket, and bt socket access because at the time we could not find a reasonable way to grant or exclude such permissions on a process by process basis. Maintaining about 20-30 lines of diffs to make that work was not a bad tradeoff (and we don't expect those patches to go upstream). If there's a way to accomplish this without patching the kernel, we're all ears.
While we do maintain some assorted patches to core code (like the permissions thing), we strongly prefer to keep our work localized to drivers (generic to android or specific to hardware), and try to migrate to common kernel features when possible, submit patches (like work Mike Chan is doing around cpufreq and power measurement), etc. Patches to core code cause more headaches when we rebase up to new kernel versions, after all.
Quoted 9 lines
So for people who really care about running a mainline kernel on their android device doing that part first on a generic ARM board in qemu might be much better first step work.
On the other hand I've heard
that various hardware vendors or parties closed to them are rather annoyed by their drivers beeing stuck in the android tree - but that can be easily solved by getting removing the suspend blockers (at least temporarily), cleaning up a few bits here and there and getting them in.
This continues to baffle me. If we (Google) are such a headache, why not just route around us. The drivers we've written are GPLv2, the source is out there for anyone who wants it, etc. The drivers other people have written we have no control over at all. From my point of view it'd be an annoyance if somebody took the code we wrote, modified it heavily, and pushed it upstream, but fundamentally I can't stop that from happening other than by pushing it upstream myself, first.
Blaming me because you want me to send your drivers upstream and I'm not doing it or not doing it fast enough or not doing it the way you like does not seem very productive. I'm not a gatekeeper for patch submission to the mainline kernel.
Brian
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 11 lines · Brian Swetland
I was shocked when Greg pulled the binder driver and some of the other "generic" android drivers into staging, because it was always my assumption that nobody upstream would want them. We did get some bugfixes for the binder driver (thanks!) but the general reaction was pretty much the same as yours here. I then was relatively unsurprised when it was dropped (we find it useful, upstream finds it useless, not much else to say).
The various SoC peripheral drivers are, I suspect, much less contentious (modulo suspend blocker usage and any necessary kernel style cleanup).
Yes. That's what makes me wonder about some parts of the discussion here. Getting the drivers for one or more of the android plattforms in is not a problem. I'd say it could have easily been done with the manweeks spent arguing in this and related threads.
The much bigger issues is to get android userspace running on a more or less vanilla kernel, that is withoutthe binder, without the rather interesting group ID based security hack^H^H^H^Hmodel, without the suspend blocker userspace API and so on, and so on.
So for people who really care about running a mainline kernel on their android device doing that part first on a generic ARM board in qemu
might be much better first step work. On the other hand I've heard
that various hardware vendors or parties closed to them are rather annoyed by their drivers beeing stuck in the android tree - but that can be easily solved by getting removing the suspend blockers (at least temporarily), cleaning up a few bits here and there and getting them in.
It's not rocket science to get support for ARM SOC number 1654 into the mainline kernel.
Quoted 4 lines · James Bottomley
Well, we sort of tried this when Greg pulled some of them into the staging tree. The problem is that without the annotations, the drivers are still different, and patches won't apply, so, unsurprisingly, they didn't get improved or even maintained.
Err, the biggest pile in staging was meta drivers like the binder or some oom killer magic which are flat out braindead and wrong and have no chance going into mainline anyway. That's something different from real hardware drivers, although a few of those made it into staging as well if I remember correctly.
Quoted 11 lines · Thomas Gleixner
Quoted 5 lines · James Bottomley
3. We've lost sight of one of the original goals, which was to bring the android tree close enough to the kernel so that the android downstream driver and board producers don't have to choose between the android kernel and vanilla kernel.
There are two ways to do that w/o creating a dependcy on anything.
1) merge the drivers w/o the
suspend_blockers. It's not rocket science to have a patch which brings them back for android.
Well, we sort of tried this when Greg pulled some of them into the staging tree. The problem is that without the annotations, the drivers are still different, and patches won't apply, so, unsurprisingly, they didn't get improved or even maintained.
Quoted 2 lines
2) merge the drivers with empty stub implementations for annotation. android just has to patch in the real one.
That's also possible. This time, we would have a cosmetically closer tree ... however, what's in the kernel wouldn't be compilable for android ... which is where all the downstream wants to test, so they'd still be building for the android tree ... we just might have an easier time of it picking up their fixes.
Quoted 1 line
While I'd prefer #1, I' not in the way of #2.
I think 1 is unviable ... I'm not opposed to 2 but I'd like to try to get the kernel really closer to android before we go for the cosmetic only option.
Quoted 4 lines
Both ways can get the drivers into the kernel and it could/should have been done right from the beginning, but now we face a situation where drivers are held hostage.
Quoted 8 lines
Then we can sit down more relaxed and fix the stuff in a way which makes both sides happy. If we manage to replace them, we can deprecate the stub implementation and remove it after a grace period. If we rename them it's not an issue either. We can rename them right away to a qos interface, but that does not really make a difference.
What we really want to avoid is implementing an user space contract in a frenzy which binds us forever.
Well, that's why the QoS proposal ... it already has a userspace API ... we'd just be extending it for statistics, which looks like a wothwhile goal independent of android anyway.
Quoted 6 lines
It's not the
suspend_blockerswhich are the causing the nightmare, it's solely the drivers itself especially when there are different implementations in both trees. And frankly, the drivers in android are not in a shape which makes them flood in within 2 weeks. That's serious work to get them brushed up and polished. So that gives us quite a period of time to solve the suspend problem.
Right, so the sooner we make it easier for the drivers to use the kernel as their main repository, the better.
James
Quoted 9 lines · On Sun, 6 Jun 2010 12:46:01 +0200 Florian Mickler <[email protected]> wrote:
Quoted 3 lines · On Sun, 6 Jun 2010 12:00:47 +0200 Vitaly Wool <[email protected]> wrote:
Even worse, the suspend wakelock will keep the
whole kernel active, as opposed to powering off unused devices separately as it's done in runtime PM.That is not true. While the kernel is not suspended it does runtime pm.
On several of our platforms runtime PM already includes suspend so a suspend wakelock does interfere with existing power managemet at that level (not to mention the maintenance mess it causes).
This is one of the reasons you want QoS information, it provides parameters by which the power management code can make a decision. Suspend blocksers simply don't have sufficient variety to manage the direction of power policy.
If Android chooses to abuse the QoS information for crude suspend blocking then that is fine, it doesn't interfere with doing the job 'properly' on other systems or its use for realtime work on other boxes.
Alan
Quoted 7 lines · Vitaly Wool
Sure, but my point was, some non-trivial (still kind of natural for a smartphone) activities with the device will prevent it from suspending for quite some time. Even worse, the suspend wakelock will keep the whole kernel active, as opposed to powering off unused devices separately as it's done in runtime PM. Yep, I know about the "early suspend" type of thing; yet it's excess, not mainlined and lacks granularity.
Holding a suspend blocker is entirely orthogonal to runtime pm. The "whole kernel" will not be "active" - it can continue to hit the same low power state in the idle loop, and any runtime pm implementation in the drivers will continue to be active.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 7 lines · Vitaly Wool
Sure, but my point was, some non-trivial (still kind of natural for a smartphone) activities with the device will prevent it from suspending for quite some time. Even worse, the suspend wakelock will keep the whole kernel active, as opposed to powering off unused devices separately as it's done in runtime PM. Yep, I know about the "early suspend" type of thing; yet it's excess, not mainlined and lacks granularity.
Holding a suspend blocker is entirely orthogonal to runtime pm. The "whole kernel" will not be "active" - it can continue to hit the same low power state in the idle loop, and any runtime pm implementation in the drivers will continue to be active.
Signature · 1 line
Matthew Garrett | [email protected]
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 10 lines · Vitaly Wool
Quoted 8 lines
Sure, but my point was, some non-trivial (still kind of natural for a smartphone) activities with the device will prevent it from suspending for quite some time. Even worse, the suspend wakelock will keep the whole kernel active, as opposed to powering off unused devices separately as it's done in runtime PM. Yep, I know about the "early suspend" type of thing; yet it's excess, not mainlined and lacks granularity.
Quoted 4 lines
Holding a suspend blocker is entirely orthogonal to runtime pm. The "whole kernel" will not be "active" - it can continue to hit the same low power state in the idle loop, and any runtime pm implementation in the drivers will continue to be active.
Yeah, that might also be the case, But then again, what's the use of suspend blockers in this situation?
~Vitaly
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 10 lines · Vitaly Wool
Quoted 8 lines
Sure, but my point was, some non-trivial (still kind of natural for a smartphone) activities with the device will prevent it from suspending for quite some time. Even worse, the suspend wakelock will keep the whole kernel active, as opposed to powering off unused devices separately as it's done in runtime PM. Yep, I know about the "early suspend" type of thing; yet it's excess, not mainlined and lacks granularity.
Quoted 4 lines
Holding a suspend blocker is entirely orthogonal to runtime pm. The "whole kernel" will not be "active" - it can continue to hit the same low power state in the idle loop, and any runtime pm implementation in the drivers will continue to be active.
Yeah, that might also be the case, But then again, what's the use of suspend blockers in this situation?
~Vitaly
Quoted 8 lines · Vitaly Wool
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 4 lines
Holding a suspend blocker is entirely orthogonal to runtime pm. The "whole kernel" will not be "active" - it can continue to hit the same low power state in the idle loop, and any runtime pm implementation in the drivers will continue to be active.
Yeah, that might also be the case, But then again, what's the use of suspend blockers in this situation?
The difference between idle-based suspend and opportunistic suspend is that the former will continue to wake up for timers and will never be entered if something is using CPU, whereas the latter will be entered whenever no suspend blocks are held. The problem with opportunistic suspend is that you might make the decision to suspend simultaneusly with a wakeup event being received. Suspend blocks facilitate synchronisation between the kernel and userspace to ensure that all such events have been consumed and handld appropriately.
Signature · 1 line
Matthew Garrett | [email protected]
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 10 lines · Vitaly Wool
Quoted 8 lines
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 4 lines
Holding a suspend blocker is entirely orthogonal to runtime pm. The "whole kernel" will not be "active" - it can continue to hit the same low power state in the idle loop, and any runtime pm implementation in the drivers will continue to be active.
Yeah, that might also be the case, But then again, what's the use of suspend blockers in this situation?
Quoted 8 lines
The difference between idle-based suspend and opportunistic suspend is that the former will continue to wake up for timers and will never be entered if something is using CPU, whereas the latter will be entered whenever no suspend blocks are held. The problem with opportunistic suspend is that you might make the decision to suspend simultaneusly with a wakeup event being received. Suspend blocks facilitate synchronisation between the kernel and userspace to ensure that all such events have been consumed and handld appropriately.
Right, and then you start taking suspend blockers in kernel here and there which eventually interferes with runtime PM.
So I don't buy the "orthogonality" point. Generally speaking, it's not true.
~Vitaly
Quoted 10 lines · Vitaly Wool
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 8 lines
The difference between idle-based suspend and opportunistic suspend is that the former will continue to wake up for timers and will never be entered if something is using CPU, whereas the latter will be entered whenever no suspend blocks are held. The problem with opportunistic suspend is that you might make the decision to suspend simultaneusly with a wakeup event being received. Suspend blocks facilitate synchronisation between the kernel and userspace to ensure that all such events have been consumed and handld appropriately.
Quoted 2 lines
Right, and then you start taking suspend blockers in kernel here and there which eventually interferes with runtime PM.
Suspend blocks prevent system suspend, not any per-device suspend.
Signature · 1 line
Matthew Garrett | [email protected]
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 1 line
Suspend blocks prevent system suspend, not any per-device suspend.
Can you suspend a device which is holding a wake lock?
~Vitaly
Quoted 5 lines · Vitaly Wool
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 1 line
Suspend blocks prevent system suspend, not any per-device suspend.
Can you suspend a device which is holding a wake lock?
Yes. Suspend blocks are orthogonal to runtime PM.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 5 lines · Vitaly Wool
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 1 line
Suspend blocks prevent system suspend, not any per-device suspend.
Can you suspend a device which is holding a wake lock?
Yes. Suspend blocks are orthogonal to runtime PM.
Signature · 1 line
Matthew Garrett | [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 4 lines · Vitaly Wool
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 3 lines · Vitaly Wool
Quoted 2 lines
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Suspend blocks prevent system suspend, not any per-device suspend.
Can you suspend a device which is holding a wake lock?
Yes. Suspend blocks are orthogonal to runtime PM.
That's nice, but that means that it can hold the wake lock indefinitely. Brilliant design, I'd say.
Putting a device in a low power state doesn't mean you can't run code in the driver. If a device generates an event and that event gets handled by the driver, the driver can take a suspend block and then release it when userspace reads the event. It's perfectly valid for the device to go into a low power state in the meantime. When I say that these things are orthogonal, I really do mean it.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 8 lines · Matthew Garrett
Quoted 5 lines · Vitaly Wool
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 1 line
Suspend blocks prevent system suspend, not any per-device suspend.
Can you suspend a device which is holding a wake lock?
Yes. Suspend blocks are orthogonal to runtime PM.
Yes, they are.
The idea that they would somehow interfere with runtime PM has always been pure nonsense. They wouldn't and there's no way in which they could.
Whether or not they are really necessary to address the Android requirements is a different question, though, and I don't really think so right now. At least not in the form submitted by Arve.
Also, there's some overlap between suspend blockers and the PM QoS framework, so it seems to be a good idea to extend PM QoS (which already is in the kernel) to express some requirements that suspend blockers are supposed to express.
Rafael
Quoted 8 lines · Matthew Garrett
Quoted 5 lines · Vitaly Wool
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 1 line
Suspend blocks prevent system suspend, not any per-device suspend.
Can you suspend a device which is holding a wake lock?
Yes. Suspend blocks are orthogonal to runtime PM.
Yes, they are.
The idea that they would somehow interfere with runtime PM has always been pure nonsense. They wouldn't and there's no way in which they could.
Whether or not they are really necessary to address the Android requirements is a different question, though, and I don't really think so right now. At least not in the form submitted by Arve.
Also, there's some overlap between suspend blockers and the PM QoS framework, so it seems to be a good idea to extend PM QoS (which already is in the kernel) to express some requirements that suspend blockers are supposed to express.
Rafael
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 8 lines · Vitaly Wool
Quoted 5 lines
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 1 line
Suspend blocks prevent system suspend, not any per-device suspend.
Can you suspend a device which is holding a wake lock?
Yes. Suspend blocks are orthogonal to runtime PM.
In that sense yes, but as it has been stated before; if Android user-space concentrates on getting suspend blockers right, then the timers in user-space will not be aligned correctly, and runtime PM wouldn't work that great. Moreover, opportunistic suspend takes the device out of idle. So, as runtime PM gets better, there's a point where opportunistic suspend makes the situation worst.
So they are _mostly_ orthogonal, but not completely, at least for the analysis of suspend blockers' usefulness.
Signature · 1 line
Felipe Contreras
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 8 lines · Vitaly Wool
Quoted 5 lines
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 1 line
Suspend blocks prevent system suspend, not any per-device suspend.
Can you suspend a device which is holding a wake lock?
Yes. Suspend blocks are orthogonal to runtime PM.
In that sense yes, but as it has been stated before; if Android user-space concentrates on getting suspend blockers right, then the timers in user-space will not be aligned correctly, and runtime PM wouldn't work that great. Moreover, opportunistic suspend takes the device out of idle. So, as runtime PM gets better, there's a point where opportunistic suspend makes the situation worst.
So they are _mostly_ orthogonal, but not completely, at least for the analysis of suspend blockers' usefulness.
Signature · 1 line
Felipe Contreras
Quoted 7 lines · On Sun, 6 Jun 2010 19:21:49 +0200 Vitaly Wool <[email protected]> wrote:
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 1 line
Suspend blocks prevent system suspend, not any per-device suspend.
Can you suspend a device which is holding a wake lock?
~Vitaly
If you look at the suspend blocker patchset, you'll see that the only patches adding calls to "suspend_is_blocked()" are
PM: Opportunistic suspend support
and
PM: Abort task freezing if there is an active suspend blocker .
Both are in generic suspend code and don't affect runtime pm.
Cheers,
Flo
Quoted 7 lines · On Sun, 6 Jun 2010 19:21:49 +0200 Vitaly Wool <[email protected]> wrote:
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 1 line
Suspend blocks prevent system suspend, not any per-device suspend.
Can you suspend a device which is holding a wake lock?
~Vitaly
If you look at the suspend blocker patchset, you'll see that the only patches adding calls to "suspend_is_blocked()" are
PM: Opportunistic suspend support
and
PM: Abort task freezing if there is an active suspend blocker .
Both are in generic suspend code and don't affect runtime pm.
Cheers,
Flo
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 1 line
Suspend blocks prevent system suspend, not any per-device suspend.
Can you suspend a device which is holding a wake lock?
~Vitaly
Quoted 10 lines · Vitaly Wool
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 8 lines
The difference between idle-based suspend and opportunistic suspend is that the former will continue to wake up for timers and will never be entered if something is using CPU, whereas the latter will be entered whenever no suspend blocks are held. The problem with opportunistic suspend is that you might make the decision to suspend simultaneusly with a wakeup event being received. Suspend blocks facilitate synchronisation between the kernel and userspace to ensure that all such events have been consumed and handld appropriately.
Quoted 2 lines
Right, and then you start taking suspend blockers in kernel here and there which eventually interferes with runtime PM.
Suspend blocks prevent system suspend, not any per-device suspend.
Signature · 1 line
Matthew Garrett | [email protected]
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 10 lines · Vitaly Wool
Quoted 8 lines
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 4 lines
Holding a suspend blocker is entirely orthogonal to runtime pm. The "whole kernel" will not be "active" - it can continue to hit the same low power state in the idle loop, and any runtime pm implementation in the drivers will continue to be active.
Yeah, that might also be the case, But then again, what's the use of suspend blockers in this situation?
Quoted 8 lines
The difference between idle-based suspend and opportunistic suspend is that the former will continue to wake up for timers and will never be entered if something is using CPU, whereas the latter will be entered whenever no suspend blocks are held. The problem with opportunistic suspend is that you might make the decision to suspend simultaneusly with a wakeup event being received. Suspend blocks facilitate synchronisation between the kernel and userspace to ensure that all such events have been consumed and handld appropriately.
Right, and then you start taking suspend blockers in kernel here and there which eventually interferes with runtime PM.
So I don't buy the "orthogonality" point. Generally speaking, it's not true.
~Vitaly
Quoted 8 lines · Matthew Garrett
The difference between idle-based suspend and opportunistic suspend is that the former will continue to wake up for timers and will never be entered if something is using CPU, whereas the latter will be entered whenever no suspend blocks are held. The problem with opportunistic suspend is that you might make the decision to suspend simultaneusly with a wakeup event being received. Suspend blocks facilitate synchronisation between the kernel and userspace to ensure that all such events have been consumed and handld appropriately.
Remember that suspend takes place in several phases, the first of which is to freeze tasks. The phases can be controlled individually by the process carrying out a suspend, and there's nothing to prevent you from stopping after the freezer phase. Devices won't get powered down, but Android uses aggressive runtime power management for its devices anyway.
If you do this then the synchronization can be carried out entirely from userspace, with no need for kernel modifications such as suspend blockers. And since Android can reach essentially the same low-power state from idle as from suspend, it appears that they really don't need any kernel changes at all.
Alan Stern
Re: [linux-pm] suspend blockers & Android integrationy
Alan,
Quoted 18 lines · Alan Stern
Quoted 8 lines · Matthew Garrett
The difference between idle-based suspend and opportunistic suspend is that the former will continue to wake up for timers and will never be entered if something is using CPU, whereas the latter will be entered whenever no suspend blocks are held. The problem with opportunistic suspend is that you might make the decision to suspend simultaneusly with a wakeup event being received. Suspend blocks facilitate synchronisation between the kernel and userspace to ensure that all such events have been consumed and handld appropriately.
Remember that suspend takes place in several phases, the first of which is to freeze tasks. The phases can be controlled individually by the process carrying out a suspend, and there's nothing to prevent you from stopping after the freezer phase. Devices won't get powered down, but Android uses aggressive runtime power management for its devices anyway.
Quoted 5 lines
If you do this then the synchronization can be carried out entirely from userspace, with no need for kernel modifications such as suspend blockers. And since Android can reach essentially the same low-power state from idle as from suspend, it appears that they really don't need any kernel changes at all.
Well there are some things to solve:
1) the confinement of untrusted apps
2) the confinement of trusted apps firing periodic timers.
Aside of that they need to shut off undesired interrupt sources, but that's not a real problem to solve and probably possible today already.
#1 can be solved elegantly by cgroups. We know how to freeze the
cgroup timers when the need arises, but that's not a real problem as all periodic timers are firing only once when the target app does not handle them.
Though the cgroup based approach of freezing timers might be interesting for containers c/r as well and it might be necessary to emulate the suspend semantics of freezing CLOCK_MONOTONIC, but that's simple to do and basically no overhead.
#2 is a tad harder, as it requires to fix the trusted apps not to fire
timers when there is nothing to do.
Though you can solve it with cgroups as well. The unfreeze problem for real wakeups can be solved as mhelsley pointed out somewhere else in this thread.
But that depends on user space changes ....
Though as we learned today that suspend blockers are the least of the problems which android is facing vs. mainline and we have a plan to get the drivers in we can relax a bit and think more about it.
I'm not saying that we should ignore the shortcomings of todays code, but in the face of hardware which perfectly goes into the same power state from idle as it does from suspend we can IMNSHO safely ignore the x86/ACPI/BIOS crap and the user space wreckage (see above) and just focus on a sane design based on current/future hardware.
That's nothing new, we do not go and make NOHZ/HIGHRES work on crappy hardware either, even if there have been patches around to do so. We do not make broken TSCs work, even if there are brute force ways to do so. ....
It's more sane to say "Sorry, it does not work on your system" than trying to make it work under all circumstances for a questionable benefit and paying the price for it in terms of maintainability and/or complexity.
Thanks,
tglx
Re: suspend blockers & Android integrationy
Quoted 1 line · Thomas Gleixner
Alan,
Thomas:
Quoted 15 lines · Alan Stern
Quoted 8 lines
Remember that suspend takes place in several phases, the first of which is to freeze tasks. The phases can be controlled individually by the process carrying out a suspend, and there's nothing to prevent you from stopping after the freezer phase. Devices won't get powered down, but Android uses aggressive runtime power management for its devices anyway.
Quoted 5 lines
If you do this then the synchronization can be carried out entirely from userspace, with no need for kernel modifications such as suspend blockers. And since Android can reach essentially the same low-power state from idle as from suspend, it appears that they really don't need any kernel changes at all.
Quoted 5 lines
Well there are some things to solve:
1) the confinement of untrusted apps
2) the confinement of trusted apps firing periodic timers.
No, these things don't need to be solved.
The difference between our approaches is that you're trying to find a solution that can be used more generally, not just on Android, whereas I'm simply trying to find a way to help Arve and Brian accomplish what they want as easily as possible.
(Even though some kernel developers may consider their design to be ill-conceived. So long as the objectionable features are confined to userspace nobody will mind. And if a few small kernel patches are needed, they will most likely be accepted if they aren't intrusive.)
This means sticking to the "big-gun" approach of system-wide suspend or its equivalent, because Android's userspace is so unstructured and has so many widespread (perhaps even conflicting!) requirements. And of course the necessary changes to userspace should be minimal.
Thus, in my proposed scheme there is no need to confine untrusted apps, just as there was no need to do so when using wakelocks in their original form. Likewise, there is no need to worry about trusted apps firing periodic timers: Once processes are frozen, user timers really don't matter much.
Quoted 3 lines
Aside of that they need to shut off undesired interrupt sources, but that's not a real problem to solve and probably possible today already.
Yes. They may also need to shut off undesired kernel timers. This should be doable as well, and it would benefit all platforms.
Quoted 4 lines
#1 can be solved elegantly by cgroups. We know how to freeze the
cgroup timers when the need arises, but that's not a real problem as all periodic timers are firing only once when the target app does not handle them.
That's why I said they don't matter much.
Quoted 4 lines
Though the cgroup based approach of freezing timers might be interesting for containers c/r as well and it might be necessary to emulate the suspend semantics of freezing
CLOCK_MONOTONIC, but that's simple to do and basically no overhead.
Cgroups are not needed. The power-manager process can simply freeze all tasks other than itself.
Quoted 2 lines
#2 is a tad harder, as it requires to fix the trusted apps not to fire
timers when there is nothing to do.
No; all you have to do is handle the trusted apps as though they were untrusted -- just as in the original wakelock approach.
Quoted 5 lines
Though you can solve it with cgroups as well. The unfreeze problem for real wakeups can be solved as mhelsley pointed out somewhere else in this thread.
But that depends on user space changes ....
If you handle all the apps uniformly, very few userspace changes are needed.
Quoted 3 lines
Though as we learned today that suspend blockers are the least of the problems which android is facing vs. mainline and we have a plan to get the drivers in we can relax a bit and think more about it.
The only reason for inventing suspend blockers in the first place was to make system suspend reliable in the face of races with wakeup sources. If system suspend doesn't run to completion, but stops after freezing all tasks other than the power manager, then these races can be handled entirely within userspace. Hence there is no need to have suspend blockers at all.
Assuming Arve doesn't find any fatal flaws in this approach, the issue will become moot. We can relax and _avoid_ thinking about it! :-)
Quoted 5 lines
I'm not saying that we should ignore the shortcomings of todays code, but in the face of hardware which perfectly goes into the same power state from idle as it does from suspend we can IMNSHO safely ignore the x86/ACPI/BIOS crap and the user space wreckage (see above) and just focus on a sane design based on current/future hardware.
You're preaching to the choir. If the Google people want to use suspend blockers on ACPI-based systems ... well, we can resume the arguments then. They won't be nearly as pressing.
Quoted 9 lines
That's nothing new, we do not go and make NOHZ/HIGHRES work on crappy hardware either, even if there have been patches around to do so. We do not make broken TSCs work, even if there are brute force ways to do so. ....
It's more sane to say "Sorry, it does not work on your system" than trying to make it work under all circumstances for a questionable benefit and paying the price for it in terms of maintainability and/or complexity.
Agreed.
Alan Stern
Re: [linux-pm] suspend blockers & Android integrationy
In reply to Thomas GleixnerQuoted 1 line · Thomas Gleixner
Alan,
Thomas:
Quoted 15 lines · Alan Stern
Quoted 8 lines
Remember that suspend takes place in several phases, the first of which is to freeze tasks. The phases can be controlled individually by the process carrying out a suspend, and there's nothing to prevent you from stopping after the freezer phase. Devices won't get powered down, but Android uses aggressive runtime power management for its devices anyway.
Quoted 5 lines
If you do this then the synchronization can be carried out entirely from userspace, with no need for kernel modifications such as suspend blockers. And since Android can reach essentially the same low-power state from idle as from suspend, it appears that they really don't need any kernel changes at all.
Quoted 5 lines
Well there are some things to solve:
1) the confinement of untrusted apps
2) the confinement of trusted apps firing periodic timers.
No, these things don't need to be solved.
The difference between our approaches is that you're trying to find a solution that can be used more generally, not just on Android, whereas I'm simply trying to find a way to help Arve and Brian accomplish what they want as easily as possible.
(Even though some kernel developers may consider their design to be ill-conceived. So long as the objectionable features are confined to userspace nobody will mind. And if a few small kernel patches are needed, they will most likely be accepted if they aren't intrusive.)
This means sticking to the "big-gun" approach of system-wide suspend or its equivalent, because Android's userspace is so unstructured and has so many widespread (perhaps even conflicting!) requirements. And of course the necessary changes to userspace should be minimal.
Thus, in my proposed scheme there is no need to confine untrusted apps, just as there was no need to do so when using wakelocks in their original form. Likewise, there is no need to worry about trusted apps firing periodic timers: Once processes are frozen, user timers really don't matter much.
Quoted 3 lines
Aside of that they need to shut off undesired interrupt sources, but that's not a real problem to solve and probably possible today already.
Yes. They may also need to shut off undesired kernel timers. This should be doable as well, and it would benefit all platforms.
Quoted 4 lines
#1 can be solved elegantly by cgroups. We know how to freeze the
cgroup timers when the need arises, but that's not a real problem as all periodic timers are firing only once when the target app does not handle them.
That's why I said they don't matter much.
Quoted 4 lines
Though the cgroup based approach of freezing timers might be interesting for containers c/r as well and it might be necessary to emulate the suspend semantics of freezing
CLOCK_MONOTONIC, but that's simple to do and basically no overhead.
Cgroups are not needed. The power-manager process can simply freeze all tasks other than itself.
Quoted 2 lines
#2 is a tad harder, as it requires to fix the trusted apps not to fire
timers when there is nothing to do.
No; all you have to do is handle the trusted apps as though they were untrusted -- just as in the original wakelock approach.
Quoted 5 lines
Though you can solve it with cgroups as well. The unfreeze problem for real wakeups can be solved as mhelsley pointed out somewhere else in this thread.
But that depends on user space changes ....
If you handle all the apps uniformly, very few userspace changes are needed.
Quoted 3 lines
Though as we learned today that suspend blockers are the least of the problems which android is facing vs. mainline and we have a plan to get the drivers in we can relax a bit and think more about it.
The only reason for inventing suspend blockers in the first place was to make system suspend reliable in the face of races with wakeup sources. If system suspend doesn't run to completion, but stops after freezing all tasks other than the power manager, then these races can be handled entirely within userspace. Hence there is no need to have suspend blockers at all.
Assuming Arve doesn't find any fatal flaws in this approach, the issue will become moot. We can relax and _avoid_ thinking about it! :-)
Quoted 5 lines
I'm not saying that we should ignore the shortcomings of todays code, but in the face of hardware which perfectly goes into the same power state from idle as it does from suspend we can IMNSHO safely ignore the x86/ACPI/BIOS crap and the user space wreckage (see above) and just focus on a sane design based on current/future hardware.
You're preaching to the choir. If the Google people want to use suspend blockers on ACPI-based systems ... well, we can resume the arguments then. They won't be nearly as pressing.
Quoted 9 lines
That's nothing new, we do not go and make NOHZ/HIGHRES work on crappy hardware either, even if there have been patches around to do so. We do not make broken TSCs work, even if there are brute force ways to do so. ....
It's more sane to say "Sorry, it does not work on your system" than trying to make it work under all circumstances for a questionable benefit and paying the price for it in terms of maintainability and/or complexity.
Agreed.
Alan Stern
Re: suspend blockers & Android integrationy
Alan,
Quoted 7 lines · Alan Stern
Quoted 2 lines · Thomas Gleixner
#2 is a tad harder, as it requires to fix the trusted apps not to fire
timers when there is nothing to do.No; all you have to do is handle the trusted apps as though they were untrusted -- just as in the original wakelock approach.
Quoted 8 lines
Quoted 5 lines
Though you can solve it with cgroups as well. The unfreeze problem for real wakeups can be solved as mhelsley pointed out somewhere else in this thread.
But that depends on user space changes ....
If you handle all the apps uniformly, very few userspace changes are needed.
Oh, I see. I misunderstood you. -ENOTENOUGHSLEEP
Thanks,
Thomas
Re: [linux-pm] suspend blockers & Android integrationy
In reply to Alan SternAlan,
Quoted 7 lines · Alan Stern
Quoted 2 lines · Thomas Gleixner
#2 is a tad harder, as it requires to fix the trusted apps not to fire
timers when there is nothing to do.No; all you have to do is handle the trusted apps as though they were untrusted -- just as in the original wakelock approach.
Quoted 8 lines
Quoted 5 lines
Though you can solve it with cgroups as well. The unfreeze problem for real wakeups can be solved as mhelsley pointed out somewhere else in this thread.
But that depends on user space changes ....
If you handle all the apps uniformly, very few userspace changes are needed.
Oh, I see. I misunderstood you. -ENOTENOUGHSLEEP
Thanks,
Thomas
Re: suspend blockers & Android integrationy
In reply to Alan SternAlan,
Quoted 18 lines · Alan Stern
Quoted 8 lines · Matthew Garrett
The difference between idle-based suspend and opportunistic suspend is that the former will continue to wake up for timers and will never be entered if something is using CPU, whereas the latter will be entered whenever no suspend blocks are held. The problem with opportunistic suspend is that you might make the decision to suspend simultaneusly with a wakeup event being received. Suspend blocks facilitate synchronisation between the kernel and userspace to ensure that all such events have been consumed and handld appropriately.
Remember that suspend takes place in several phases, the first of which is to freeze tasks. The phases can be controlled individually by the process carrying out a suspend, and there's nothing to prevent you from stopping after the freezer phase. Devices won't get powered down, but Android uses aggressive runtime power management for its devices anyway.
Quoted 5 lines
If you do this then the synchronization can be carried out entirely from userspace, with no need for kernel modifications such as suspend blockers. And since Android can reach essentially the same low-power state from idle as from suspend, it appears that they really don't need any kernel changes at all.
Well there are some things to solve:
1) the confinement of untrusted apps
2) the confinement of trusted apps firing periodic timers.
Aside of that they need to shut off undesired interrupt sources, but that's not a real problem to solve and probably possible today already.
#1 can be solved elegantly by cgroups. We know how to freeze the
cgroup timers when the need arises, but that's not a real problem as all periodic timers are firing only once when the target app does not handle them.
Though the cgroup based approach of freezing timers might be interesting for containers c/r as well and it might be necessary to emulate the suspend semantics of freezing CLOCK_MONOTONIC, but that's simple to do and basically no overhead.
#2 is a tad harder, as it requires to fix the trusted apps not to fire
timers when there is nothing to do.
Though you can solve it with cgroups as well. The unfreeze problem for real wakeups can be solved as mhelsley pointed out somewhere else in this thread.
But that depends on user space changes ....
Though as we learned today that suspend blockers are the least of the problems which android is facing vs. mainline and we have a plan to get the drivers in we can relax a bit and think more about it.
I'm not saying that we should ignore the shortcomings of todays code, but in the face of hardware which perfectly goes into the same power state from idle as it does from suspend we can IMNSHO safely ignore the x86/ACPI/BIOS crap and the user space wreckage (see above) and just focus on a sane design based on current/future hardware.
That's nothing new, we do not go and make NOHZ/HIGHRES work on crappy hardware either, even if there have been patches around to do so. We do not make broken TSCs work, even if there are brute force ways to do so. ....
It's more sane to say "Sorry, it does not work on your system" than trying to make it work under all circumstances for a questionable benefit and paying the price for it in terms of maintainability and/or complexity.
Thanks,
tglx
Quoted 3 lines · On Sun, 6 Jun 2010 20:01:56 -0400 (EDT) Alan Stern <[email protected]>…
And since Android can reach essentially the same low-power state from idle as from suspend, it appears that they really don't need any kernel changes at all.
Well, perhaps a hint to the scheduler to fall through as fast as possible into deepest idle?
Quoted 3 lines
Alan Stern
Cheers,
Flo
Quoted 3 lines · On Sun, 6 Jun 2010 20:01:56 -0400 (EDT) Alan Stern <[email protected]>…
And since Android can reach essentially the same low-power state from idle as from suspend, it appears that they really don't need any kernel changes at all.
Well, perhaps a hint to the scheduler to fall through as fast as possible into deepest idle?
Quoted 3 lines
Alan Stern
Cheers,
Flo
Quoted 18 lines · Alan Stern
Quoted 8 lines · Matthew Garrett
The difference between idle-based suspend and opportunistic suspend is that the former will continue to wake up for timers and will never be entered if something is using CPU, whereas the latter will be entered whenever no suspend blocks are held. The problem with opportunistic suspend is that you might make the decision to suspend simultaneusly with a wakeup event being received. Suspend blocks facilitate synchronisation between the kernel and userspace to ensure that all such events have been consumed and handld appropriately.
Remember that suspend takes place in several phases, the first of which is to freeze tasks. The phases can be controlled individually by the process carrying out a suspend, and there's nothing to prevent you from stopping after the freezer phase. Devices won't get powered down, but Android uses aggressive runtime power management for its devices anyway.
Quoted 6 lines
If you do this then the synchronization can be carried out entirely from userspace, with no need for kernel modifications such as suspend blockers. And since Android can reach essentially the same low-power state from idle as from suspend, it appears that they really don't need any kernel changes at all.
I don't think this is true. If you stop after the freezer phase you still need all the suspend blockers that are held until user-space consumes an event, otherwise it never gets consumed since user-space is frozen.
Signature · 1 line
Arve Hjønnevåg
Quoted 18 lines · Alan Stern
Quoted 8 lines · Matthew Garrett
The difference between idle-based suspend and opportunistic suspend is that the former will continue to wake up for timers and will never be entered if something is using CPU, whereas the latter will be entered whenever no suspend blocks are held. The problem with opportunistic suspend is that you might make the decision to suspend simultaneusly with a wakeup event being received. Suspend blocks facilitate synchronisation between the kernel and userspace to ensure that all such events have been consumed and handld appropriately.
Remember that suspend takes place in several phases, the first of which is to freeze tasks. The phases can be controlled individually by the process carrying out a suspend, and there's nothing to prevent you from stopping after the freezer phase. Devices won't get powered down, but Android uses aggressive runtime power management for its devices anyway.
Quoted 6 lines
If you do this then the synchronization can be carried out entirely from userspace, with no need for kernel modifications such as suspend blockers. And since Android can reach essentially the same low-power state from idle as from suspend, it appears that they really don't need any kernel changes at all.
I don't think this is true. If you stop after the freezer phase you still need all the suspend blockers that are held until user-space consumes an event, otherwise it never gets consumed since user-space is frozen.
Signature · 5 lines
Arve Hjønnevåg -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 14 lines · Arve Hjønnevåg
Quoted 7 lines
Remember that suspend takes place in several phases, the first of which is to freeze tasks. The phases can be controlled individually by the process carrying out a suspend, and there's nothing to prevent you from stopping after the freezer phase. Devices won't get powered down, but Android uses aggressive runtime power management for its devices anyway.
Quoted 6 lines
If you do this then the synchronization can be carried out entirely from userspace, with no need for kernel modifications such as suspend blockers. And since Android can reach essentially the same low-power state from idle as from suspend, it appears that they really don't need any kernel changes at all.
Quoted 4 lines
I don't think this is true. If you stop after the freezer phase you still need all the suspend blockers that are held until user-space consumes an event, otherwise it never gets consumed since user-space is frozen.
No. You don't need to hold any suspend blockers; you merely need to unfreeze userspace. Once it is unfrozen, it will eventually consume the wakeup event.
What you _do_ need to do is to prevent userspace from getting frozen again too soon. That's the purpose of the list of "active" wakeup sources. So long as the power manager believes a source is still active, it won't freeze anything.
Alan Stern
Quoted 14 lines · Arve Hjønnevåg
Quoted 7 lines
Remember that suspend takes place in several phases, the first of which is to freeze tasks. The phases can be controlled individually by the process carrying out a suspend, and there's nothing to prevent you from stopping after the freezer phase. Devices won't get powered down, but Android uses aggressive runtime power management for its devices anyway.
Quoted 6 lines
If you do this then the synchronization can be carried out entirely from userspace, with no need for kernel modifications such as suspend blockers. And since Android can reach essentially the same low-power state from idle as from suspend, it appears that they really don't need any kernel changes at all.
Quoted 4 lines
I don't think this is true. If you stop after the freezer phase you still need all the suspend blockers that are held until user-space consumes an event, otherwise it never gets consumed since user-space is frozen.
No. You don't need to hold any suspend blockers; you merely need to unfreeze userspace. Once it is unfrozen, it will eventually consume the wakeup event.
What you _do_ need to do is to prevent userspace from getting frozen again too soon. That's the purpose of the list of "active" wakeup sources. So long as the power manager believes a source is still active, it won't freeze anything.
Alan Stern
Quoted 8 lines · Matthew Garrett
The difference between idle-based suspend and opportunistic suspend is that the former will continue to wake up for timers and will never be entered if something is using CPU, whereas the latter will be entered whenever no suspend blocks are held. The problem with opportunistic suspend is that you might make the decision to suspend simultaneusly with a wakeup event being received. Suspend blocks facilitate synchronisation between the kernel and userspace to ensure that all such events have been consumed and handld appropriately.
Remember that suspend takes place in several phases, the first of which is to freeze tasks. The phases can be controlled individually by the process carrying out a suspend, and there's nothing to prevent you from stopping after the freezer phase. Devices won't get powered down, but Android uses aggressive runtime power management for its devices anyway.
If you do this then the synchronization can be carried out entirely from userspace, with no need for kernel modifications such as suspend blockers. And since Android can reach essentially the same low-power state from idle as from suspend, it appears that they really don't need any kernel changes at all.
Alan Stern
Quoted 8 lines · Vitaly Wool
2010/6/6 Matthew Garrett <[email protected]>:
Quoted 4 lines
Holding a suspend blocker is entirely orthogonal to runtime pm. The "whole kernel" will not be "active" - it can continue to hit the same low power state in the idle loop, and any runtime pm implementation in the drivers will continue to be active.
Yeah, that might also be the case, But then again, what's the use of suspend blockers in this situation?
The difference between idle-based suspend and opportunistic suspend is that the former will continue to wake up for timers and will never be entered if something is using CPU, whereas the latter will be entered whenever no suspend blocks are held. The problem with opportunistic suspend is that you might make the decision to suspend simultaneusly with a wakeup event being received. Suspend blocks facilitate synchronisation between the kernel and userspace to ensure that all such events have been consumed and handld appropriately.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 11 lines · Vitaly Wool
Quoted 10 lines
It varies depending on device and usage. The battery monitoring on NexusOne happens every ten minutes, so that's the longest you'll see a N1 suspended for. On a G1 or Dream/myTouch you can see 20-30 minutes between wakeups (depending on network issues and background data sync traffic), and if you have background data sync off those devices can sit in suspend for days at a time (unless you receive a phone call or something). In "airplane mode", with no local alarms, a device can easily sit in the lowest power state for a month or so, until the battery finally runs out.
Quoted 7 lines
That only concerns the case when you have just turned on the phone and left it laying around.
You have to admit that it's not the common case for a smartphone. The common case is that you've played with it for a bit, turning on things like BT/WIFI, running some apps and so on. And doing so you'll end up having wake locks taken from everywhere, so I can hardly see a second of suspend for Nexus.
The common case for a phone is to be sitting around. Even for heavy smartphone users, unless they power on, use the device screen-on for 4 hours solid or whatnot and drain the battery straight away, the device is going to spend a significant portion of its operating time in screen-off standby modes (conserving power for when you take a call, browse the web, etc).
For typical users on typical android devices, this means the device stays suspended for 5-10 minutes at a time, coming up for air when a network packet (mail sync, im, etc) or alarm (battery monitor) wakes the device briefly. Obviously with the right combination of bad apps you will see a device suspending more rarely.
Quoted 7 lines
E. g. when the wireless is connected to an AP, it takes a wake lock which is released on 15 minutes touchscreen inactivity timeout, as far as I can tell. So:
* the system will never hit suspend during this period;
* if the download was ongoing and had not been completed during this period, it will be terminated.
I'm pretty sure the wifi subsystem does not actually take a wakelock while its connected -- it does have an alarm to spin down wifi after 15 minutes (by default, and user disableable) largely due to power inefficiencies in the wifi solution in some early devices. There's some room for improvement here, obviously. With a decent wifi chipset and implementation, depending on local wifi traffic patterns, you can see power usage competitive to cellular.
Quoted 4 lines
So the bottom line is: the approach is very inflexible. Of course it can give you the best power savings if you turn the Airplane mode on as soon as you switched on the phone, but this is not what a typical user would do.
The savings in airplane mode (apart from preventing data connections, which saves power by preventing data-hungry background apps from doing much) is the difference between standby with radio (3-5mA) and without (1-2mA). I'm not suggesting that airplane mode is a typical case, just using it as in illustration of the more extreme standby case.
Users do like that to work too -- I recall Arve leaving a device in his filing cabinet with the radio off while he was out of the country for three weeks once, and him discovering it was still running with something like 25% battery remaining when he returned.
In any case, I'm saying that suspending for minutes at a time (typical, 10s of minutes or more in some cases, hours in others), does happen and it does represent an improvement over suspending or otherwise entering your lowest power state for seconds at a time.
Brian
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 11 lines · Brian Swetland
Quoted 9 lines · Vitaly Wool
2010/6/5 Arve Hjønnevåg <[email protected]>:
Quoted 5 lines
We clearly have different standards for what we consider good. We measure time suspended in minutes or hours, not seconds, and waking up every second or two causes a noticeable decrease in battery life on the hardware we have today.
Are you stating that the existing Android implementation enters the suspended state for hours for any of the existing designs?
Quoted 9 lines
It varies depending on device and usage. The battery monitoring on NexusOne happens every ten minutes, so that's the longest you'll see a N1 suspended for. On a G1 or Dream/myTouch you can see 20-30 minutes between wakeups (depending on network issues and background data sync traffic), and if you have background data sync off those devices can sit in suspend for days at a time (unless you receive a phone call or something). In "airplane mode", with no local alarms, a device can easily sit in the lowest power state for a month or so, until the battery finally runs out.
That only concerns the case when you have just turned on the phone and left it laying around.
You have to admit that it's not the common case for a smartphone. The common case is that you've played with it for a bit, turning on things like BT/WIFI, running some apps and so on. And doing so you'll end up having wake locks taken from everywhere, so I can hardly see a second of suspend for Nexus.
E. g. when the wireless is connected to an AP, it takes a wake lock which is released on 15 minutes touchscreen inactivity timeout, as far as I can tell. So:
* the system will never hit suspend during this period;
* if the download was ongoing and had not been completed during this period, it will be terminated.
So the bottom line is: the approach is very inflexible. Of course it can give you the best power savings if you turn the Airplane mode on as soon as you switched on the phone, but this is not what a typical user would do.
~Vitaly
Quoted 9 lines · Vitaly Wool
2010/6/5 Arve Hjønnevåg <[email protected]>:
Quoted 5 lines
We clearly have different standards for what we consider good. We measure time suspended in minutes or hours, not seconds, and waking up every second or two causes a noticeable decrease in battery life on the hardware we have today.
Are you stating that the existing Android implementation enters the suspended state for hours for any of the existing designs?
It varies depending on device and usage. The battery monitoring on NexusOne happens every ten minutes, so that's the longest you'll see a N1 suspended for. On a G1 or Dream/myTouch you can see 20-30 minutes between wakeups (depending on network issues and background data sync traffic), and if you have background data sync off those devices can sit in suspend for days at a time (unless you receive a phone call or something). In "airplane mode", with no local alarms, a device can easily sit in the lowest power state for a month or so, until the battery finally runs out.
Brian
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
2010/6/5 Arve Hjønnevåg <[email protected]>:
Quoted 15 lines · Arjan van de Ven
Quoted 14 lines
Quoted 10 lines · On Sat, 05 Jun 2010 11:54:13 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 7 lines · Arve Hjønnevåg
Quoted 4 lines
Trusted processes are assumed to be sane and idle when there is nothing for them to do, allowing the machine to go into deep idle states.
Neither the kernel nor our trusted user-space code currently meets this criteria.
Then both need fixing. Really, that's the only sane approach.
Quoted 8 lines
Quoted 3 lines
fwiw... in MeeGo we're seeing quite good idle times (> 1 seconds) without really bad hacks.
We clearly have different standards for what we consider good. We measure time suspended in minutes or hours, not seconds, and waking up every second or two causes a noticeable decrease in battery life on the hardware we have today.
Are you stating that the existing Android implementation enters the suspended state for hours for any of the existing designs?
~Vitaly
Quoted 9 lines · Arjan van de Ven
Quoted 6 lines · On Sat, 05 Jun 2010 11:54:13 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 5 lines · Arve Hjønnevåg
Quoted 4 lines
Trusted processes are assumed to be sane and idle when there is nothing for them to do, allowing the machine to go into deep idle states.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Neither the kernel nor our trusted user-space code currently meets this criteria.
Then both need fixing. Really, that's the only sane approach.
fwiw... in MeeGo we're seeing quite good idle times (> 1 seconds) without really bad hacks.
We clearly have different standards for what we consider good. We measure time suspended in minutes or hours, not seconds, and waking up every second or two causes a noticeable decrease in battery life on the hardware we have today.
Quoted 3 lines
the kernel has a set of infrastructure already to help here (range timers, with which you can wakeup-limit untrusted userspace crap), timer slack for legacy background timers, etc etc.
Range timers allows the kernel to align different timers so they don't each bring the cpu out of idle individually. They do not eliminate timers or make individual timers fire less often. For example if you have 10 timers that fire every second on an idle system, without range timers you will most likely have to bring the cpu out of idle 10 times a second, but with range timers you have a chance of waking up only once a second (I say a chance here, since if they are identical they will just chase each other and never catch up).
Quoted 3 lines
getting to 10 seconds is not in the range of impossibilities to be honest... and that's even without doing things like putting untrusted
That is still far short of what we get with suspend (in terms of time).
Quoted 9 lines
junk (read: Appstore apps) into a cgroup and do wakeup limiting and cpu time limiting on a cgroup level....
--
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Signature · 1 line
Arve Hjønnevåg
Quoted 10 lines · On Sat, 05 Jun 2010 11:54:13 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 7 lines · Arve Hjønnevåg
Quoted 4 lines
Trusted processes are assumed to be sane and idle when there is nothing for them to do, allowing the machine to go into deep idle states.
Neither the kernel nor our trusted user-space code currently meets this criteria.
Then both need fixing. Really, that's the only sane approach.
fwiw... in MeeGo we're seeing quite good idle times (> 1 seconds) without really bad hacks.
the kernel has a set of infrastructure already to help here (range timers, with which you can wakeup-limit untrusted userspace crap), timer slack for legacy background timers, etc etc.
getting to 10 seconds is not in the range of impossibilities to be honest... and that's even without doing things like putting untrusted junk (read: Appstore apps) into a cgroup and do wakeup limiting and cpu time limiting on a cgroup level....
Signature · 7 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 6 lines · Arve Hjønnevåg
Quoted 3 lines
Trusted processes are assumed to be sane and idle when there is nothing for them to do, allowing the machine to go into deep idle states.
Neither the kernel nor our trusted user-space code currently meets this criteria.
Then both need fixing. Really, that's the only sane approach.
_______________________________________________
linux-pm mailing list [email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
2010/6/4 Peter Zijlstra <[email protected]>:
Quoted 37 lines · Arve Hjønnevåg
Quoted 28 lines · Ingo Molnar
Quoted 8 lines · Arve Hj?nnev?g
Quoted 6 lines
Quoted 5 lines
[...]
Why do you need to track input wakeups? It's rather fragile and rather unnecessary [...]
Quoted 9 lines
Quoted 4 lines
Because we have keys that should always turn the screen on, but the problem is not specific to input events. If we enabled a wakeup event it usually means we need this event to always work, not just when the system is fully awake or fully suspended.
Hm, i cannot follow that generic claim. Could you please point out the problem to me via a specific example? Which task does what, what undesirable thing happens where, etc.
We have many wakeup events, and some of them are invisible to the user. For instance on the Nexus One wake up every 10 minutes monitor the battery health.
If the user presses a key right after this work
has finished and we did not block suspend until userspace could process this key event, we risk suspending before we could turn the screen on, which to the user looks like the key did not work.Quoted 7 lines
Another
example, the user pressed the power key which turns the screen off and allows suspend. We initiate suspend and a phone call comes in. If we don't block suspend until we processed the incoming phone call notification, the phone may never ring (some devices will send a new message every few seconds for this, so on those devices it would just delay the ringing).
Quoted 4 lines
Right, so in the proposed scheme all these tasks would be executed by trusted processes, and trusted processes will never get frozen and so will never be delayed in processing these events.
There are many proposes schemes. I assume you mean freezing only untrusted processes and nothing else.
Quoted 3 lines
Only untrusted code will be frozen. And trusted processes are reliable for thawing the untrusted processes and delivering events to it.
I have two problems with this. I don't want to funnel all events trough trusted processes, and I also want to freeze trusted processes.
Quoted 3 lines
Trusted processes are assumed to be sane and idle when there is nothing for them to do, allowing the machine to go into deep idle states.
Neither the kernel nor our trusted user-space code currently meets this criteria.
Signature · 1 line
Arve Hjønnevåg
Quoted 28 lines · Arve Hjønnevåg
Quoted 8 lines · Ingo Molnar
Quoted 5 lines · Arve Hj?nnev?g
Quoted 4 lines
[...]
Why do you need to track input wakeups? It's rather fragile and rather unnecessary [...]
Quoted 9 lines
Quoted 4 lines
Because we have keys that should always turn the screen on, but the problem is not specific to input events. If we enabled a wakeup event it usually means we need this event to always work, not just when the system is fully awake or fully suspended.
Hm, i cannot follow that generic claim. Could you please point out the problem to me via a specific example? Which task does what, what undesirable thing happens where, etc.
We have many wakeup events, and some of them are invisible to the user. For instance on the Nexus One wake up every 10 minutes monitor the battery health.
If the user presses a key right after this work
has finished and we did not block suspend until userspace could process this key event, we risk suspending before we could turn the screen on, which to the user looks like the key did not work.
Quoted 7 lines
Another
example, the user pressed the power key which turns the screen off and allows suspend. We initiate suspend and a phone call comes in. If we don't block suspend until we processed the incoming phone call notification, the phone may never ring (some devices will send a new message every few seconds for this, so on those devices it would just delay the ringing).
Right, so in the proposed scheme all these tasks would be executed by trusted processes, and trusted processes will never get frozen and so will never be delayed in processing these events.
Only untrusted code will be frozen. And trusted processes are reliable for thawing the untrusted processes and delivering events to it.
Trusted processes are assumed to be sane and idle when there is nothing for them to do, allowing the machine to go into deep idle states.
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 8 lines · Ingo Molnar
Quoted 5 lines · Arve Hj?nnev?g
Quoted 4 lines
[...]
Why do you need to track input wakeups? It's rather fragile and rather unnecessary [...]
Quoted 9 lines
Quoted 4 lines
Because we have keys that should always turn the screen on, but the problem is not specific to input events. If we enabled a wakeup event it usually means we need this event to always work, not just when the system is fully awake or fully suspended.
Hm, i cannot follow that generic claim. Could you please point out the problem to me via a specific example? Which task does what, what undesirable thing happens where, etc.
We have many wakeup events, and some of them are invisible to the user. For instance on the Nexus One wake up every 10 minutes monitor the battery health. If the user presses a key right after this work has finished and we did not block suspend until userspace could process this key event, we risk suspending before we could turn the screen on, which to the user looks like the key did not work. Another example, the user pressed the power key which turns the screen off and allows suspend. We initiate suspend and a phone call comes in. If we don't block suspend until we processed the incoming phone call notification, the phone may never ring (some devices will send a new message every few seconds for this, so on those devices it would just delay the ringing).
Signature · 1 line
Arve Hjønnevåg
Quoted 9 lines · Arve Hj?nnev?g
Quoted 4 lines
[...]
Why do you need to track input wakeups? It's rather fragile and rather unnecessary [...]
Because we have keys that should always turn the screen on, but the problem is not specific to input events. If we enabled a wakeup event it usually means we need this event to always work, not just when the system is fully awake or fully suspended.
Hm, i cannot follow that generic claim. Could you please point out the problem to me via a specific example? Which task does what, what undesirable thing happens where, etc.
Thanks,
Ingo
Quoted 18 lines · Ingo Molnar
Quoted 9 lines · Arve Hj?nnev?g
On Thu, Jun 3, 2010 at 4:23 PM, Ingo Molnar <[email protected]> wrote:
...Quoted 6 lines
?- Controlled auto-suspend: drivers (such as input) could on wakeup ? automatically set the 'minimum wakeup latency' value of wakee tasks to a ? lower value. This automatically prevents another auto-suspend in the near ? future: up to the point the wakee task increases its latency (via the ? scheduler syscall) again and allows suspend again.
Quoted 5 lines
How do you clear the latency value in a safe way? If another wakeup event happens right after your wakee task is done processing the last event and decides to increase its latency, auto suspend will be allowed even though you have an unprocessed wakeup event. Also how do you know which task will read the event if it is not already waiting for it?
Quoted 4 lines
The easiest solution would be to not do any of that initially. (If it's ever a concern we could subtract/add without destroying the nesting property)
Why do you need to track input wakeups? It's rather fragile and rather
Because we have keys that should always turn the screen on, but the problem is not specific to input events. If we enabled a wakeup event it usually means we need this event to always work, not just when the system is fully awake or fully suspended.
Quoted 4 lines
unnecessary - the idle drivers know it very well how to not go into the deepest idle mode already today. We wont hit C8 on laptops when you are using the desktop.
The whole point allow the use of suspend.
Quoted 15 lines
Quoted 8 lines
Quoted 6 lines
? This means there will be no surprise suspends for a task that may take a ? bit longer than usual to finish its work. [ Detail: this would only be done ? for tasks that have a non-default (non-infinity)
task->latencyvalue - to ? prevent the input driver from lowering latency values (and preventing ? future suspends) just because some unaware apps are running and using input ? drivers. ]Don't you need two inifinity values for this?
Yes - any value above the max idle latency in the system will do.
Thanks,
Ingo
Signature · 1 line
Arve Hjønnevåg
Quoted 9 lines · Arve Hj?nnev?g
On Thu, Jun 3, 2010 at 4:23 PM, Ingo Molnar <[email protected]> wrote:
...Quoted 6 lines
?- Controlled auto-suspend: drivers (such as input) could on wakeup ? automatically set the 'minimum wakeup latency' value of wakee tasks to a ? lower value. This automatically prevents another auto-suspend in the near ? future: up to the point the wakee task increases its latency (via the ? scheduler syscall) again and allows suspend again.
Quoted 5 lines
How do you clear the latency value in a safe way? If another wakeup event happens right after your wakee task is done processing the last event and decides to increase its latency, auto suspend will be allowed even though you have an unprocessed wakeup event. Also how do you know which task will read the event if it is not already waiting for it?
The easiest solution would be to not do any of that initially. (If it's ever a concern we could subtract/add without destroying the nesting property)
Why do you need to track input wakeups? It's rather fragile and rather unnecessary - the idle drivers know it very well how to not go into the deepest idle mode already today. We wont hit C8 on laptops when you are using the desktop.
Quoted 8 lines
Quoted 6 lines
? This means there will be no surprise suspends for a task that may take a ? bit longer than usual to finish its work. [ Detail: this would only be done ? for tasks that have a non-default (non-infinity)
task->latencyvalue - to ? prevent the input driver from lowering latency values (and preventing ? future suspends) just because some unaware apps are running and using input ? drivers. ]Don't you need two inifinity values for this?
Yes - any value above the max idle latency in the system will do.
Thanks,
Ingo
On Thu, Jun 3, 2010 at 4:23 PM, Ingo Molnar <[email protected]> wrote:
...
Quoted 6 lines
- Controlled auto-suspend: drivers (such as input) could on wakeup automatically set the 'minimum wakeup latency' value of wakee tasks to a lower value. This automatically prevents another auto-suspend in the near
future: up to the point the wakee task increases its latency (via the scheduler syscall) again and allows suspend again.
How do you clear the latency value in a safe way? If another wakeup event happens right after your wakee task is done processing the last event and decides to increase its latency, auto suspend will be allowed even though you have an unprocessed wakeup event. Also how do you know which task will read the event if it is not already waiting for it?
Quoted 6 lines
This means there will be no surprise suspends for a task that may take a bit longer than usual to finish its work. [ Detail: this would only be done for tasks that have a non-default (non-infinity)
task->latencyvalue - to prevent the input driver from lowering latency values (and preventing future suspends) just because some unaware apps are running and using input drivers. ]
Don't you need two inifinity values for this?
Signature · 1 line
Arve Hjønnevåg
Quoted 3 lines · Ingo Molnar
Btw., i'd like to summarize the scheduler based suspend scheme proposed by Thomas Gleixner, Peter Zijlstra and myself. I found no good summary of it in the big thread, and there are also new elements of the proposal:
Just to clarify, my proposition doesn't go much further than treating 'suspend' as a genuine idle state (on suitable hardware, which x86 isn't).
Quoted 6 lines
- Create a 'deep idle' mode that suspends. This, if all constraints are met, is triggered by the scheduler automatically: just like the other idle modes are triggered currently. This approach fixes the wakeup races because an incoming wakeup event will set
need_resched()and abort the suspend.
Right, so 'suspend' as idle seems (at least on UP/arm) a very sensible idea. On SMP current suspend hot-unplugs all but the boot cpu, I'm not sure we need to do that, since if the system is genuinely idle, what races are there?
And if its not idle...
Quoted 3 lines
( This mode can even use the existing suspend code to bring stuff down,
therefore it also solves the pending timer problem and works even on PC style x86. )
You cannot solve the pending timer issue from idle, unless you allow idle to stop clock_monotonic, which would change idle semantics, and that is not something I can say is a good idea.
You want all idle states to have the same semantics, otherwise things just get way too confusing.
Quoted 3 lines
- Solve crappy app confinement via the scheduler:
A first proposal was to use the existing cgroup mechanism,
I still believe containment is a cgroup problem. The freeze/snapshot/resume container folks seem to face many of the same problems. Including the pending timer one I suspect. Lets solve it there.
Quoted 5 lines
- Controlled auto-suspend: drivers (such as input) could on wakeup automatically set the 'minimum wakeup latency' value of wakee tasks to a lower value. This automatically prevents another auto-suspend in the near
future: up to the point the wakee task increases its latency (via the scheduler syscall) again and allows suspend again.
I think treating wakeups special like that is a mistake. I also think the kernel should never adjust a task's QoS attributes, the user set them in the expectation of them being respected.
I'm not really sure about the interaction between wakeups and untrusted apps. It seems to me that an untrusted app needs a trusted intermediate anyway, that intermediate can be responsible for freezing/unfreezing of the untrusted app.
So either the app asks for suspend blockers through the intermediate, or it's cgroup is managed by the intermediate -- should work out to the same end result, right?
Quoted 3 lines · Ingo Molnar
Btw., i'd like to summarize the scheduler based suspend scheme proposed by Thomas Gleixner, Peter Zijlstra and myself. I found no good summary of it in the big thread, and there are also new elements of the proposal:
Just to clarify, my proposition doesn't go much further than treating 'suspend' as a genuine idle state (on suitable hardware, which x86 isn't).
Quoted 6 lines
- Create a 'deep idle' mode that suspends. This, if all constraints are met, is triggered by the scheduler automatically: just like the other idle modes are triggered currently. This approach fixes the wakeup races because an incoming wakeup event will set
need_resched()and abort the suspend.
Right, so 'suspend' as idle seems (at least on UP/arm) a very sensible idea. On SMP current suspend hot-unplugs all but the boot cpu, I'm not sure we need to do that, since if the system is genuinely idle, what races are there?
And if its not idle...
Quoted 3 lines
( This mode can even use the existing suspend code to bring stuff down,
therefore it also solves the pending timer problem and works even on PC style x86. )
You cannot solve the pending timer issue from idle, unless you allow idle to stop clock_monotonic, which would change idle semantics, and that is not something I can say is a good idea.
You want all idle states to have the same semantics, otherwise things just get way too confusing.
Quoted 3 lines
- Solve crappy app confinement via the scheduler:
A first proposal was to use the existing cgroup mechanism,
I still believe containment is a cgroup problem. The freeze/snapshot/resume container folks seem to face many of the same problems. Including the pending timer one I suspect. Lets solve it there.
Quoted 5 lines
- Controlled auto-suspend: drivers (such as input) could on wakeup automatically set the 'minimum wakeup latency' value of wakee tasks to a lower value. This automatically prevents another auto-suspend in the near
future: up to the point the wakee task increases its latency (via the scheduler syscall) again and allows suspend again.
I think treating wakeups special like that is a mistake. I also think the kernel should never adjust a task's QoS attributes, the user set them in the expectation of them being respected.
I'm not really sure about the interaction between wakeups and untrusted apps. It seems to me that an untrusted app needs a trusted intermediate anyway, that intermediate can be responsible for freezing/unfreezing of the untrusted app.
So either the app asks for suspend blockers through the intermediate, or it's cgroup is managed by the intermediate -- should work out to the same end result, right?
Quoted 3 lines · Peter Zijlstra
I still believe containment is a cgroup problem. The freeze/snapshot/resume container folks seem to face many of the same problems. Including the pending timer one I suspect. Lets solve it there.
While talking to Thomas about this, we'd probably need a CLOCK_MONOTONIC namespace to pull this off, so that resumed apps don't see the jump in absolute time.
This would also help with locating the relevant timers, since they'd be on the related timer base.
The only 'interesting' issue I can see here is that if you create 1000 CLOCK_MONOTONIC namepaces, we'd need to have a tree of trees in order to efficiently find the leftmost timer.
Quoted 3 lines · Peter Zijlstra
I still believe containment is a cgroup problem. The freeze/snapshot/resume container folks seem to face many of the same problems. Including the pending timer one I suspect. Lets solve it there.
While talking to Thomas about this, we'd probably need a CLOCK_MONOTONIC namespace to pull this off, so that resumed apps don't see the jump in absolute time.
This would also help with locating the relevant timers, since they'd be on the related timer base.
The only 'interesting' issue I can see here is that if you create 1000 CLOCK_MONOTONIC namepaces, we'd need to have a tree of trees in order to efficiently find the leftmost timer.
Quoted 11 lines · Peter Zijlstra
Quoted 3 lines · Peter Zijlstra
I still believe containment is a cgroup problem. The freeze/snapshot/resume container folks seem to face many of the same problems. Including the pending timer one I suspect. Lets solve it there.
While talking to Thomas about this, we'd probably need a
CLOCK_MONOTONICnamespace to pull this off, so that resumed apps don't see the jump in absolute time.This would also help with locating the relevant timers, since they'd be on the related timer base.
Ok - this looks workable, and looks technically isolated that can be pursued as a separate module of this whole topic.
Quoted 3 lines
The only 'interesting' issue I can see here is that if you create 1000
CLOCK_MONOTONICnamepaces, we'd need to have a tree of trees in order to efficiently find the leftmost timer.
Realistically Android userspace would create just a single such namespace for all the untrusted/unknown/uncontrolled apps, right?
Ingo
Quoted 11 lines · Peter Zijlstra
Quoted 3 lines · Peter Zijlstra
I still believe containment is a cgroup problem. The freeze/snapshot/resume container folks seem to face many of the same problems. Including the pending timer one I suspect. Lets solve it there.
While talking to Thomas about this, we'd probably need a
CLOCK_MONOTONICnamespace to pull this off, so that resumed apps don't see the jump in absolute time.This would also help with locating the relevant timers, since they'd be on the related timer base.
Ok - this looks workable, and looks technically isolated that can be pursued as a separate module of this whole topic.
Quoted 3 lines
The only 'interesting' issue I can see here is that if you create 1000
CLOCK_MONOTONICnamepaces, we'd need to have a tree of trees in order to efficiently find the leftmost timer.
Realistically Android userspace would create just a single such namespace for all the untrusted/unknown/uncontrolled apps, right?
Ingo
Quoted 6 lines · Ingo Molnar
Quoted 3 lines
The only 'interesting' issue I can see here is that if you create 1000
CLOCK_MONOTONICnamepaces, we'd need to have a tree of trees in order to efficiently find the leftmost timer.Realistically Android userspace would create just a single such namespace for all the untrusted/unknown/uncontrolled apps, right?
Possibly, yeah.
But it might not stop someone else from create an insane amount of them. So we do need to deal with that, and a linear loop over all timer bases, which then will be a user controlled quantity, just doesn't sound right :-)
Quoted 10 lines · Peter Zijlstra
Quoted 6 lines · Ingo Molnar
Quoted 3 lines
The only 'interesting' issue I can see here is that if you create 1000
CLOCK_MONOTONICnamepaces, we'd need to have a tree of trees in order to efficiently find the leftmost timer.Realistically Android userspace would create just a single such namespace for all the untrusted/unknown/uncontrolled apps, right?
Possibly, yeah.
Definitely, at least initially. If we had the ability to do more fine grained control, we might be tempted to experiment with it, but to start with we'd feel safer using the big hammer as we are today.
Brian
Quoted 10 lines · Peter Zijlstra
Quoted 6 lines · Ingo Molnar
Quoted 3 lines
The only 'interesting' issue I can see here is that if you create 1000
CLOCK_MONOTONICnamepaces, we'd need to have a tree of trees in order to efficiently find the leftmost timer.Realistically Android userspace would create just a single such namespace for all the untrusted/unknown/uncontrolled apps, right?
Possibly, yeah.
Definitely, at least initially. If we had the ability to do more fine grained control, we might be tempted to experiment with it, but to start with we'd feel safer using the big hammer as we are today.
Brian
Quoted 6 lines · Ingo Molnar
Quoted 3 lines
The only 'interesting' issue I can see here is that if you create 1000
CLOCK_MONOTONICnamepaces, we'd need to have a tree of trees in order to efficiently find the leftmost timer.Realistically Android userspace would create just a single such namespace for all the untrusted/unknown/uncontrolled apps, right?
Possibly, yeah.
But it might not stop someone else from create an insane amount of them. So we do need to deal with that, and a linear loop over all timer bases, which then will be a user controlled quantity, just doesn't sound right :-)