Suspend block api (version 8)
Subsystems (6)
Quoted 16 lines · Matthew Garrett
Quoted 7 lines · Thomas Gleixner
Quoted 5 lines · Matthew Garrett
ACPI provides no guarantees about what level of hardware functionality remains during S3. You don't have any useful ability to determine which events will generate wakeups. And from a purely practical point of view, since the latency is in the range of seconds, you'll never have a low enough wakeup rate to hit it.
Quoted 7 lines
Right, it does not as of today. So we cannot use that on x86 hardware. Fine. That does not prevent us to implement it for architectures which can do it. And if x86 comes to the point where it can handle it as well we're going to use it. Where is the problem ? If x86 cannot guarantee the wakeup sources it's not going to be used for such devices. The kernel just does not provide the service for it, so what ?
Quoted 2 lines
We were talking about PCs. Suspend-as-c-state is already implemented for OMAP.
Ah, now we talk about PCs. And all of a sudden the problem of the unability of determining wakeup sources is not longer relevant ? So how do you guarantee that we don't miss one if we cant figure out which ones are kept alive in S3 ?
Quoted 5 lines
Quoted 3 lines
So the only thing you are imposing to app writers is to use an interface which solves nothing and does not save you any power at all.
It's already been demonstrated that the Android approach saves power.
Demonstrated ? Care to explain me how it makes a difference:
while (1) {
block();
read();
process_event();
unblock(); ---> suspend <--- resume
do_crap(); 1000000 cycles
}
vs.
while (1) {
read(); ---> suspend <--- resume
process_event();
do_crap(); 1000000 cycles
}
You spend the damned 10000000 cycles in any case just at a different point in time. So if you are so convinced and have fully understood all the implications, please enlighten me why do_crap() costs less power with the blockers approach.
An you are also stubbornly refusing to answer my analysis about the effect on apps which do not use the blocker or are not allowed to.
1) The kernel blocker does not guarantee that the lousy app has processed the event. It just guarantees that the lousy app has emptied the input queue. So what's the point of the kernel blocker in that case ?
2) What's the difference on setting that app to QoS(NONE) and let the kernel happily ignore it.
Come up with real explanations and numbers and not just the "it has been demonstrated" chant which is not holding water if you look at the above.
Quoted 8 lines
Quoted 3 lines
Runnable tasks and QoS guarantees are the indicators whether you can go to opportunistic suspend or not. Everything else is just window dressing.
As I keep saying, this is all much less interesting if you don't care about handling suboptimal applications. If you do care about them then the Android approach works. Nobody has demonstrated a scheduler-based one that does.
That does not make the android approach any better. They should have talked to us upfront and not after the fact. Just because they decided to do that in their google basement w/o talking to people who care is not proving that it's a good solution and even less a reason to merge it as is.
The kernel history is full of examples where crappy solutions got rejected and kept out of the kernel for a long time even if there was a need for them in the application field and they got shipped in quantities with out of tree patches (NOHZ, high resolution timers, ...). At some point people stopped arguing for crappy solutions and sat down and got it right. The problem of power management and opportunistic suspend is not different in any way.
Thanks,
tglx
Quoted 8 lines · Thomas Gleixner
Quoted 2 lines · Matthew Garrett
We were talking about PCs. Suspend-as-c-state is already implemented for OMAP.
Ah, now we talk about PCs. And all of a sudden the problem of the unability of determining wakeup sources is not longer relevant ? So how do you guarantee that we don't miss one if we cant figure out which ones are kept alive in S3 ?
A wakeup event is defined as one that wakes the system - if a system can't be woken by a specific event then it's impossible to lose it, since it wasn't a wakeup event to begin with.
Quoted 24 lines
Quoted 5 lines
Quoted 3 lines
So the only thing you are imposing to app writers is to use an interface which solves nothing and does not save you any power at all.
It's already been demonstrated that the Android approach saves power.
Demonstrated ? Care to explain me how it makes a difference:
while (1) {
block();
read();
process_event();unblock(); ---> suspend <--- resume
do_crap(); 1000000 cycles
}vs.
while (1) {
read(); ---> suspend <--- resume
Quoted 8 lines
process_event();
do_crap(); 1000000 cycles
}You spend the damned 10000000 cycles in any case just at a different point in time. So if you are so convinced and have fully understood all the implications, please enlighten me why
do_crap()costs less power with the blockers approach.
Consider the case where the read() is non-blocking.
Quoted 4 lines
1) The kernel blocker does not guarantee that the lousy app has processed the event. It just guarantees that the lousy app has emptied the input queue. So what's the point of the kernel blocker in that case ?
Yes, I think you're right here. You need the userspace component as well for this to work correctly.
Quoted 2 lines
2) What's the difference on setting that app to QoS(NONE) and let the kernel happily ignore it.
What sets that flag, and how does it interact with an application that never makes a blocking system call?
Quoted 3 lines
Come up with real explanations and numbers and not just the "it has been demonstrated" chant which is not holding water if you look at the above.
The numbers were earlier in the thread.
Quoted 7 lines
The kernel history is full of examples where crappy solutions got rejected and kept out of the kernel for a long time even if there was a need for them in the application field and they got shipped in quantities with out of tree patches (NOHZ, high resolution timers, ...). At some point people stopped arguing for crappy solutions and sat down and got it right. The problem of power management and opportunistic suspend is not different in any way.
Yes, and I'd agree with this if anyone seemed to have any idea how to do it right. But despite all the heat and noise in this thread, all we've got is an expression that it should be handled by the scheduler (a viewpoint I agree with) without any explanation of how to switch policies in such a way that applications idle without losing wakeup events.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 5 lines · Matthew Garrett
Quoted 4 lines · Thomas Gleixner
Quoted 2 lines · Matthew Garrett
We were talking about PCs. Suspend-as-c-state is already implemented for OMAP.
Quoted 8 lines
Quoted 4 lines
Ah, now we talk about PCs. And all of a sudden the problem of the unability of determining wakeup sources is not longer relevant ? So how do you guarantee that we don't miss one if we cant figure out which ones are kept alive in S3 ?
A wakeup event is defined as one that wakes the system - if a system can't be woken by a specific event then it's impossible to lose it, since it wasn't a wakeup event to begin with.
So where is the problem ?
Quoted 28 lines
Quoted 28 lines
Quoted 5 lines
Quoted 3 lines
So the only thing you are imposing to app writers is to use an interface which solves nothing and does not save you any power at all.
It's already been demonstrated that the Android approach saves power.
Demonstrated ? Care to explain me how it makes a difference:
while (1) {
block();
read();
process_event();unblock(); ---> suspend <--- resume
do_crap(); 1000000 cycles
}vs.
while (1) {
read(); ---> suspend <--- resume
process_event();
do_crap(); 1000000 cycles
}
Quoted 6 lines
Quoted 4 lines
You spend the damned 10000000 cycles in any case just at a different point in time. So if you are so convinced and have fully understood all the implications, please enlighten me why
do_crap()costs less power with the blockers approach.Consider the case where the
read()is non-blocking.
Which I consider in the same range as the application which does:
while (1);
Quoted 5 lines
Quoted 4 lines
1) The kernel blocker does not guarantee that the lousy app has processed the event. It just guarantees that the lousy app has emptied the input queue. So what's the point of the kernel blocker in that case ?
Quoted 8 lines
Yes, I think you're right here. You need the userspace component as well for this to work correctly.
Quoted 2 lines
2) What's the difference on setting that app to QoS(NONE) and let the kernel happily ignore it.
What sets that flag, and how does it interact with an application that never makes a blocking system call?
QoS(NONE) would be default policy for untrusted apps in the same way as you'd refuse the usage of supsend blockers for untrusted apps.
while (1); is definitely not an application which should be granted trusted rights, right ?
block_suspend(); while(1);
is the same as:
QoS(minimal latency); while(1);
So if you really go to trust an "while (1);" application you better make sure that this app has the appropriate QoS(NONE) or QoS(10s) call in it before letting it lose.
Quoted 5 lines
Quoted 3 lines
Come up with real explanations and numbers and not just the "it has been demonstrated" chant which is not holding water if you look at the above.
The numbers were earlier in the thread.
Numbers, yes. But I really give a sh*t about numbers w/o a detailed explanation of the scenario which created those numbers. And if the numbers boil down to: we handle the untrusted app which does "while (1);" then they are absolutely useless.
Quoted 8 lines
Quoted 7 lines
The kernel history is full of examples where crappy solutions got rejected and kept out of the kernel for a long time even if there was a need for them in the application field and they got shipped in quantities with out of tree patches (NOHZ, high resolution timers, ...). At some point people stopped arguing for crappy solutions and sat down and got it right. The problem of power management and opportunistic suspend is not different in any way.
Quoted 6 lines
Yes, and I'd agree with this if anyone seemed to have any idea how to do it right. But despite all the heat and noise in this thread, all we've got is an expression that it should be handled by the scheduler (a viewpoint I agree with) without any explanation of how to switch policies in such a way that applications idle without losing wakeup events.
Why in the world should they lose wakeup events ? If an app goes idle, it goes idle because it is waiting for an event. There is no other sane reason except for those apps which are untrusted and force idled. And for those you agreed already the suspend blockers don't solve anything as they are either not implemented or the app is not trusted to use them.
So we are back to round one of the whole discussion:
Is it worth to create an utter mess in the kernel just to handle a subset of crappy coded applications ?
And the answer stays the same: No, not at all.
Thanks,
tglx
Quoted 6 lines · Thomas Gleixner
Quoted 3 lines · Matthew Garrett
A wakeup event is defined as one that wakes the system - if a system can't be woken by a specific event then it's impossible to lose it, since it wasn't a wakeup event to begin with.
So where is the problem ?
The problem is that, right now, if a wakeup event is received between the point where userspace decides to start a suspend and userspace actually starts a suspend, that event may not abort the suspend.
Quoted 5 lines
Quoted 1 line
Consider the case where the
read()is non-blocking.Which I consider in the same range as the application which does:
while (1);
Not at all. Depending on what it reads, it may follow some other path where it sleeps. But, as I keep saying, if you don't want to support that kind of code then all of this is massively easier.
Quoted 8 lines
Quoted 2 lines
What sets that flag, and how does it interact with an application that never makes a blocking system call?
QoS(NONE) would be default policy for untrusted apps in the same way as you'd refuse the usage of supsend blockers for untrusted apps.
while (1); is definitely not an application which should be granted trusted rights, right ?
No, but if that while (1) is draw_cows() then the user may want this to run while their session is active and stop running while their session is idle. So you only want it to be QoS(NONE) in the idle session case. How do you change that state?
Quoted 6 lines
Quoted 1 line
The numbers were earlier in the thread.
Numbers, yes. But I really give a sh*t about numbers w/o a detailed explanation of the scenario which created those numbers. And if the numbers boil down to: we handle the untrusted app which does "while (1);" then they are absolutely useless.
The tested case was a stock Android install with opportunistic suspend enabled and one that just used runtime idle. The lowest power state entered was the same on both.
Quoted 14 lines
Quoted 6 lines
Yes, and I'd agree with this if anyone seemed to have any idea how to do it right. But despite all the heat and noise in this thread, all we've got is an expression that it should be handled by the scheduler (a viewpoint I agree with) without any explanation of how to switch policies in such a way that applications idle without losing wakeup events.
Why in the world should they lose wakeup events ? If an app goes idle, it goes idle because it is waiting for an event. There is no other sane reason except for those apps which are untrusted and force idled. And for those you agreed already the suspend blockers don't solve anything as they are either not implemented or the app is not trusted to use them.
Quoted 6 lines
So we are back to round one of the whole discussion:
Is it worth to create an utter mess in the kernel just to handle a subset of crappy coded applications ?
And the answer stays the same: No, not at all.
You need suspend blockers to avoid losing wakeups in the explicit suspend case even if you don't want to implement opportunistic suspend.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 11 lines · Matthew Garrett
Quoted 6 lines · Thomas Gleixner
Quoted 3 lines · Matthew Garrett
A wakeup event is defined as one that wakes the system - if a system can't be woken by a specific event then it's impossible to lose it, since it wasn't a wakeup event to begin with.
So where is the problem ?
The problem is that, right now, if a wakeup event is received between the point where userspace decides to start a suspend and userspace actually starts a suspend, that event may not abort the suspend.
The two of you are talking at cross purposes. Thomas is referring to idle-based suspend and Matthew is talking about forced suspend.
Or at least, that's how it appears to me. No wonder you can't agree on anything.
Alan Stern
Quoted 8 lines · Alan Stern
Quoted 6 lines · Matthew Garrett
Quoted 5 lines · Thomas Gleixner
Quoted 3 lines · Matthew Garrett
A wakeup event is defined as one that wakes the system - if a system can't be woken by a specific event then it's impossible to lose it, since it wasn't a wakeup event to begin with.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
So where is the problem ?
The problem is that, right now, if a wakeup event is received between the point where userspace decides to start a suspend and userspace actually starts a suspend, that event may not abort the suspend.
The two of you are talking at cross purposes. Thomas is referring to idle-based suspend and Matthew is talking about forced suspend.
Yes, and forced suspend to disk is the same as force suspend to disk, which has both nothing to do with sensible resource management.
Thanks,
tglx
Quoted 6 lines · Thomas Gleixner
Quoted 2 lines · Alan Stern
The two of you are talking at cross purposes. Thomas is referring to idle-based suspend and Matthew is talking about forced suspend.
Yes, and forced suspend to disk is the same as force suspend to disk, which has both nothing to do with sensible resource management.
It doesn't matter. Current forced suspend to RAM is racy with respect to wakeup events and should be fixed.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 6 lines · Thomas Gleixner
Quoted 2 lines · Alan Stern
The two of you are talking at cross purposes. Thomas is referring to idle-based suspend and Matthew is talking about forced suspend.
Yes, and forced suspend to disk is the same as force suspend to disk, which has both nothing to do with sensible resource management.
It doesn't matter. Current forced suspend to RAM is racy with respect to wakeup events and should be fixed.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 5 lines · Thomas Gleixner
Quoted 2 lines
The two of you are talking at cross purposes. Thomas is referring to idle-based suspend and Matthew is talking about forced suspend.
Yes, and forced suspend to disk is the same as force suspend to disk, which has both nothing to do with sensible resource management.
If I understand correctly, you are saying that all the untrusted applications should run with QoS(NONE). Then they could do whatever they wanted without causing any interference.
And with idle-based power management (rather than forced suspend), there would be no issue with wakeup events getting unduly delayed.
Unless one of those events was meant for an untrusted application. Is that the source of the difficulty?
Alan Stern
Quoted 12 lines · Alan Stern
Quoted 5 lines · Thomas Gleixner
Quoted 2 lines
The two of you are talking at cross purposes. Thomas is referring to idle-based suspend and Matthew is talking about forced suspend.
Yes, and forced suspend to disk is the same as force suspend to disk, which has both nothing to do with sensible resource management.
If I understand correctly, you are saying that all the untrusted applications should run with QoS(NONE). Then they could do whatever they wanted without causing any interference.
Quoted 5 lines
And with idle-based power management (rather than forced suspend), there would be no issue with wakeup events getting unduly delayed.
Unless one of those events was meant for an untrusted application. Is that the source of the difficulty?
Probably, but that's not solved by suspend blockers either as I explained several times now. Because those untrusted apps either lack blocker calls or are not allowed to use them, so the blocker does not help for those either.
Thanks,
tglx
Quoted 12 lines · Alan Stern
Quoted 5 lines · Thomas Gleixner
Quoted 2 lines
The two of you are talking at cross purposes. Thomas is referring to idle-based suspend and Matthew is talking about forced suspend.
Yes, and forced suspend to disk is the same as force suspend to disk, which has both nothing to do with sensible resource management.
If I understand correctly, you are saying that all the untrusted applications should run with QoS(NONE). Then they could do whatever they wanted without causing any interference.
Quoted 5 lines
And with idle-based power management (rather than forced suspend), there would be no issue with wakeup events getting unduly delayed.
Unless one of those events was meant for an untrusted application. Is that the source of the difficulty?
Probably, but that's not solved by suspend blockers either as I explained several times now. Because those untrusted apps either lack blocker calls or are not allowed to use them, so the blocker does not help for those either.
Thanks,
tglx
Quoted 5 lines · Thomas Gleixner
Quoted 2 lines
The two of you are talking at cross purposes. Thomas is referring to idle-based suspend and Matthew is talking about forced suspend.
Yes, and forced suspend to disk is the same as force suspend to disk, which has both nothing to do with sensible resource management.
If I understand correctly, you are saying that all the untrusted applications should run with QoS(NONE). Then they could do whatever they wanted without causing any interference.
And with idle-based power management (rather than forced suspend), there would be no issue with wakeup events getting unduly delayed.
Unless one of those events was meant for an untrusted application. Is that the source of the difficulty?
Alan Stern
Quoted 8 lines · Alan Stern
Quoted 6 lines · Matthew Garrett
Quoted 5 lines · Thomas Gleixner
Quoted 3 lines · Matthew Garrett
A wakeup event is defined as one that wakes the system - if a system can't be woken by a specific event then it's impossible to lose it, since it wasn't a wakeup event to begin with.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
So where is the problem ?
The problem is that, right now, if a wakeup event is received between the point where userspace decides to start a suspend and userspace actually starts a suspend, that event may not abort the suspend.
The two of you are talking at cross purposes. Thomas is referring to idle-based suspend and Matthew is talking about forced suspend.
Yes, and forced suspend to disk is the same as force suspend to disk, which has both nothing to do with sensible resource management.
Thanks,
tglx
Quoted 11 lines · Matthew Garrett
Quoted 6 lines · Thomas Gleixner
Quoted 3 lines · Matthew Garrett
A wakeup event is defined as one that wakes the system - if a system can't be woken by a specific event then it's impossible to lose it, since it wasn't a wakeup event to begin with.
So where is the problem ?
The problem is that, right now, if a wakeup event is received between the point where userspace decides to start a suspend and userspace actually starts a suspend, that event may not abort the suspend.
The two of you are talking at cross purposes. Thomas is referring to idle-based suspend and Matthew is talking about forced suspend.
Or at least, that's how it appears to me. No wonder you can't agree on anything.
Alan Stern
Quoted 6 lines · Thomas Gleixner
Quoted 3 lines · Matthew Garrett
A wakeup event is defined as one that wakes the system - if a system can't be woken by a specific event then it's impossible to lose it, since it wasn't a wakeup event to begin with.
So where is the problem ?
The problem is that, right now, if a wakeup event is received between the point where userspace decides to start a suspend and userspace actually starts a suspend, that event may not abort the suspend.
Quoted 5 lines
Quoted 1 line
Consider the case where the
read()is non-blocking.Which I consider in the same range as the application which does:
while (1);
Not at all. Depending on what it reads, it may follow some other path where it sleeps. But, as I keep saying, if you don't want to support that kind of code then all of this is massively easier.
Quoted 8 lines
Quoted 2 lines
What sets that flag, and how does it interact with an application that never makes a blocking system call?
QoS(NONE) would be default policy for untrusted apps in the same way as you'd refuse the usage of supsend blockers for untrusted apps.
while (1); is definitely not an application which should be granted trusted rights, right ?
No, but if that while (1) is draw_cows() then the user may want this to run while their session is active and stop running while their session is idle. So you only want it to be QoS(NONE) in the idle session case. How do you change that state?
Quoted 6 lines
Quoted 1 line
The numbers were earlier in the thread.
Numbers, yes. But I really give a sh*t about numbers w/o a detailed explanation of the scenario which created those numbers. And if the numbers boil down to: we handle the untrusted app which does "while (1);" then they are absolutely useless.
The tested case was a stock Android install with opportunistic suspend enabled and one that just used runtime idle. The lowest power state entered was the same on both.
Quoted 14 lines
Quoted 6 lines
Yes, and I'd agree with this if anyone seemed to have any idea how to do it right. But despite all the heat and noise in this thread, all we've got is an expression that it should be handled by the scheduler (a viewpoint I agree with) without any explanation of how to switch policies in such a way that applications idle without losing wakeup events.
Why in the world should they lose wakeup events ? If an app goes idle, it goes idle because it is waiting for an event. There is no other sane reason except for those apps which are untrusted and force idled. And for those you agreed already the suspend blockers don't solve anything as they are either not implemented or the app is not trusted to use them.
Quoted 6 lines
So we are back to round one of the whole discussion:
Is it worth to create an utter mess in the kernel just to handle a subset of crappy coded applications ?
And the answer stays the same: No, not at all.
You need suspend blockers to avoid losing wakeups in the explicit suspend case even if you don't want to implement opportunistic suspend.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 5 lines · Matthew Garrett
Quoted 4 lines · Thomas Gleixner
Quoted 2 lines · Matthew Garrett
We were talking about PCs. Suspend-as-c-state is already implemented for OMAP.
Quoted 8 lines
Quoted 4 lines
Ah, now we talk about PCs. And all of a sudden the problem of the unability of determining wakeup sources is not longer relevant ? So how do you guarantee that we don't miss one if we cant figure out which ones are kept alive in S3 ?
A wakeup event is defined as one that wakes the system - if a system can't be woken by a specific event then it's impossible to lose it, since it wasn't a wakeup event to begin with.
So where is the problem ?
Quoted 28 lines
Quoted 28 lines
Quoted 5 lines
Quoted 3 lines
So the only thing you are imposing to app writers is to use an interface which solves nothing and does not save you any power at all.
It's already been demonstrated that the Android approach saves power.
Demonstrated ? Care to explain me how it makes a difference:
while (1) {
block();
read();
process_event();unblock(); ---> suspend <--- resume
do_crap(); 1000000 cycles
}vs.
while (1) {
read(); ---> suspend <--- resume
process_event();
do_crap(); 1000000 cycles
}
Quoted 6 lines
Quoted 4 lines
You spend the damned 10000000 cycles in any case just at a different point in time. So if you are so convinced and have fully understood all the implications, please enlighten me why
do_crap()costs less power with the blockers approach.Consider the case where the
read()is non-blocking.
Which I consider in the same range as the application which does:
while (1);
Quoted 5 lines
Quoted 4 lines
1) The kernel blocker does not guarantee that the lousy app has processed the event. It just guarantees that the lousy app has emptied the input queue. So what's the point of the kernel blocker in that case ?
Quoted 8 lines
Yes, I think you're right here. You need the userspace component as well for this to work correctly.
Quoted 2 lines
2) What's the difference on setting that app to QoS(NONE) and let the kernel happily ignore it.
What sets that flag, and how does it interact with an application that never makes a blocking system call?
QoS(NONE) would be default policy for untrusted apps in the same way as you'd refuse the usage of supsend blockers for untrusted apps.
while (1); is definitely not an application which should be granted trusted rights, right ?
block_suspend(); while(1);
is the same as:
QoS(minimal latency); while(1);
So if you really go to trust an "while (1);" application you better make sure that this app has the appropriate QoS(NONE) or QoS(10s) call in it before letting it lose.
Quoted 5 lines
Quoted 3 lines
Come up with real explanations and numbers and not just the "it has been demonstrated" chant which is not holding water if you look at the above.
The numbers were earlier in the thread.
Numbers, yes. But I really give a sh*t about numbers w/o a detailed explanation of the scenario which created those numbers. And if the numbers boil down to: we handle the untrusted app which does "while (1);" then they are absolutely useless.
Quoted 8 lines
Quoted 7 lines
The kernel history is full of examples where crappy solutions got rejected and kept out of the kernel for a long time even if there was a need for them in the application field and they got shipped in quantities with out of tree patches (NOHZ, high resolution timers, ...). At some point people stopped arguing for crappy solutions and sat down and got it right. The problem of power management and opportunistic suspend is not different in any way.
Quoted 6 lines
Yes, and I'd agree with this if anyone seemed to have any idea how to do it right. But despite all the heat and noise in this thread, all we've got is an expression that it should be handled by the scheduler (a viewpoint I agree with) without any explanation of how to switch policies in such a way that applications idle without losing wakeup events.
Why in the world should they lose wakeup events ? If an app goes idle, it goes idle because it is waiting for an event. There is no other sane reason except for those apps which are untrusted and force idled. And for those you agreed already the suspend blockers don't solve anything as they are either not implemented or the app is not trusted to use them.
So we are back to round one of the whole discussion:
Is it worth to create an utter mess in the kernel just to handle a subset of crappy coded applications ?
And the answer stays the same: No, not at all.
Thanks,
tglx
Quoted 8 lines · Thomas Gleixner
Quoted 2 lines · Matthew Garrett
We were talking about PCs. Suspend-as-c-state is already implemented for OMAP.
Ah, now we talk about PCs. And all of a sudden the problem of the unability of determining wakeup sources is not longer relevant ? So how do you guarantee that we don't miss one if we cant figure out which ones are kept alive in S3 ?
A wakeup event is defined as one that wakes the system - if a system can't be woken by a specific event then it's impossible to lose it, since it wasn't a wakeup event to begin with.
Quoted 24 lines
Quoted 5 lines
Quoted 3 lines
So the only thing you are imposing to app writers is to use an interface which solves nothing and does not save you any power at all.
It's already been demonstrated that the Android approach saves power.
Demonstrated ? Care to explain me how it makes a difference:
while (1) {
block();
read();
process_event();unblock(); ---> suspend <--- resume
do_crap(); 1000000 cycles
}vs.
while (1) {
read(); ---> suspend <--- resume
Quoted 8 lines
process_event();
do_crap(); 1000000 cycles
}You spend the damned 10000000 cycles in any case just at a different point in time. So if you are so convinced and have fully understood all the implications, please enlighten me why
do_crap()costs less power with the blockers approach.
Consider the case where the read() is non-blocking.
Quoted 4 lines
1) The kernel blocker does not guarantee that the lousy app has processed the event. It just guarantees that the lousy app has emptied the input queue. So what's the point of the kernel blocker in that case ?
Yes, I think you're right here. You need the userspace component as well for this to work correctly.
Quoted 2 lines
2) What's the difference on setting that app to QoS(NONE) and let the kernel happily ignore it.
What sets that flag, and how does it interact with an application that never makes a blocking system call?
Quoted 3 lines
Come up with real explanations and numbers and not just the "it has been demonstrated" chant which is not holding water if you look at the above.
The numbers were earlier in the thread.
Quoted 7 lines
The kernel history is full of examples where crappy solutions got rejected and kept out of the kernel for a long time even if there was a need for them in the application field and they got shipped in quantities with out of tree patches (NOHZ, high resolution timers, ...). At some point people stopped arguing for crappy solutions and sat down and got it right. The problem of power management and opportunistic suspend is not different in any way.
Yes, and I'd agree with this if anyone seemed to have any idea how to do it right. But despite all the heat and noise in this thread, all we've got is an expression that it should be handled by the scheduler (a viewpoint I agree with) without any explanation of how to switch policies in such a way that applications idle without losing wakeup events.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 2 lines
We were talking about PCs. Suspend-as-c-state is already implemented for OMAP.
"You" were talking about PCs. Some of us are interested in the making Linux do the right thing not adding platform specific hacks all over the userspace of all the apps.
Quoted 5 lines
Quoted 3 lines
So the only thing you are imposing to app writers is to use an interface which solves nothing and does not save you any power at all.
It's already been demonstrated that the Android approach saves power.
So do lots of other things
Quoted 6 lines
Quoted 3 lines
Runnable tasks and QoS guarantees are the indicators whether you can go to opportunistic suspend or not. Everything else is just window dressing.
As I keep saying, this is all much less interesting if you don't care about handling suboptimal applications. If you do care about them then
I don't believe the Android one does either. It maybe handles a subset in a specific case.
Quoted 2 lines
the Android approach works. Nobody has demonstrated a scheduler-based one that does.
I would point you at the web, cgi scripts and the huge Linux server farms fielding billions of hits per second on crap cgi scripts.
That doesn't mean the Android one is the right approach. Nobody has explained to me how you don't get synchronization effects in Android or indeed answered several of the questions pointing out holes in the Android model. The fact we are at rev 8 says something too - that the Android 'proof' isn't old or tested either !
Alan
Quoted 15 lines · Matthew Garrett
Quoted 5 lines · Thomas Gleixner
Quoted 3 lines · Matthew Garrett
My question was about explicit suspend states, not implicitly handling an identical state based on scheduler constraints. Suspend-as-a-C-state isn't usable on x86 - you have to explicitly trigger it based on some
Quoted 8 lines
And why not ? Just because suspend is not implemented as an ACPI C-state ?
Nonsense, if we want to push the system into suspend from the idle state we can do that. It's just not implemented and we've never tried to do it as it requires a non trivial amount of work, but I have done it on an ARM two years ago as a prove of concept and it works like a charm.
Quoted 5 lines
ACPI provides no guarantees about what level of hardware functionality remains during S3. You don't have any useful ability to determine which events will generate wakeups. And from a purely practical point of view, since the latency is in the range of seconds, you'll never have a low enough wakeup rate to hit it.
Right, it does not as of today. So we cannot use that on x86 hardware. Fine. That does not prevent us to implement it for architectures which can do it. And if x86 comes to the point where it can handle it as well we're going to use it. Where is the problem ? If x86 cannot guarantee the wakeup sources it's not going to be used for such devices. The kernel just does not provide the service for it, so what ?
Quoted 9 lines
Quoted 8 lines
Quoted 2 lines
policy. And if you want to be able to do that without risking the loss of wakeup events then you need in-kernel suspend blockers.
Crap. Stop beating on those lost wakeup events. If we lose them then the drivers are broken and do not handle the switch over correctly. Or the suspend mechanism is broken as it does not evaluate the system state correctly. Blockers are just papering over that w/o tackling the real problem.
Quoted 3 lines
Ger;kljaserf;kljf;kljer;klj. Suspend blockers are the mechanism for the driver to indicate whether the wakeup event has been handled. That's what they're there for. The in-kernel ones don't paper over anything.
So the driver says: events have been handled. Neat.
Now if that crappy app does not use the user space blockers or is not allowed to use them, then what are you guaranteeing ? All you guarantee is that the application has emptied the input queue. Nothing else. And that's the same as setting the QoS guarantee to NONE.
An application which uses the blocker is just holding off the system from going into deep idle. Nothing which cannot be done today.
So the only thing you are imposing to app writers is to use an interface which solves nothing and does not save you any power at all.
If the application drops the blocker after processing the event and before it goes back to the read event then you just postpone the CPU usage and therefor power consumption to a later point in time instead of going back to the blocking read right away.
Again what is it saving ? NOTHING! And for nothing you want to mess up the kernel big time ?
Runnable tasks and QoS guarantees are the indicators whether you can go to opportunistic suspend or not. Everything else is just window dressing.
Thanks,
tglx
Hi!
(ok, so I'm little late to the party).
Quoted 9 lines
Quoted 5 lines
Nonsense, if we want to push the system into suspend from the idle state we can do that. It's just not implemented and we've never tried to do it as it requires a non trivial amount of work, but I have done it on an ARM two years ago as a prove of concept and it works like a charm.
ACPI provides no guarantees about what level of hardware functionality remains during S3. You don't have any useful ability to determine which events will generate wakeups. And from a purely practical point of view,
We'll need ACPI extensions, then (or very conservative drivers). suspend blockers do *not* help here.
Quoted 2 lines
since the latency is in the range of seconds, you'll never have a low enough wakeup rate to hit it.
I did 'sleepy linux' prototype on PC, and yes I was able to get to 'once in 5 seconds' wakeup rate... good enough...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi!
(ok, so I'm little late to the party).
Quoted 9 lines
Quoted 5 lines
Nonsense, if we want to push the system into suspend from the idle state we can do that. It's just not implemented and we've never tried to do it as it requires a non trivial amount of work, but I have done it on an ARM two years ago as a prove of concept and it works like a charm.
ACPI provides no guarantees about what level of hardware functionality remains during S3. You don't have any useful ability to determine which events will generate wakeups. And from a purely practical point of view,
We'll need ACPI extensions, then (or very conservative drivers). suspend blockers do *not* help here.
Quoted 2 lines
since the latency is in the range of seconds, you'll never have a low enough wakeup rate to hit it.
I did 'sleepy linux' prototype on PC, and yes I was able to get to 'once in 5 seconds' wakeup rate... good enough...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 8 lines · Thomas Gleixner
Quoted 4 lines · Matthew Garrett
You still need the in-kernel suspend blockers if you want to guarantee that you can't lose wakeup events. But yes, if you're not concerned handling badly behaved applications then I believe that you can lose opportunistic suspend and just use the scheduler.
No, we do not. We need correctly implemented drivers and a safe switchover from normal event delivery to wakeup based.
What is a "Correctly implemented driver" in this case? One that receives a wakeup event and then prevents suspend being entered until userspace has acknowledged that event? Because that's what an in-kernel suspend blocker is.
Quoted 4 lines
Quoted 3 lines
My question was about explicit suspend states, not implicitly handling an identical state based on scheduler constraints. Suspend-as-a-C-state isn't usable on x86 - you have to explicitly trigger it based on some
Quoted 8 lines
And why not ? Just because suspend is not implemented as an ACPI C-state ?
Nonsense, if we want to push the system into suspend from the idle state we can do that. It's just not implemented and we've never tried to do it as it requires a non trivial amount of work, but I have done it on an ARM two years ago as a prove of concept and it works like a charm.
ACPI provides no guarantees about what level of hardware functionality remains during S3. You don't have any useful ability to determine which events will generate wakeups. And from a purely practical point of view, since the latency is in the range of seconds, you'll never have a low enough wakeup rate to hit it.
Quoted 8 lines
Quoted 2 lines
policy. And if you want to be able to do that without risking the loss of wakeup events then you need in-kernel suspend blockers.
Crap. Stop beating on those lost wakeup events. If we lose them then the drivers are broken and do not handle the switch over correctly. Or the suspend mechanism is broken as it does not evaluate the system state correctly. Blockers are just papering over that w/o tackling the real problem.
Ger;kljaserf;kljf;kljer;klj. Suspend blockers are the mechanism for the driver to indicate whether the wakeup event has been handled. That's what they're there for. The in-kernel ones don't paper over anything.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 5 lines · Thomas Gleixner
Crap. Stop beating on those lost wakeup events. If we lose them then the drivers are broken and do not handle the switch over correctly. Or the suspend mechanism is broken as it does not evaluate the system state correctly. Blockers are just papering over that w/o tackling the real problem.
That's the point -- suspend does not evaluate the system state correctly because it doesn't have the necessary information. Suspend blockers are a way of providing it that information. They don't paper over the problem; they solve it.
Alan Stern
Quoted 5 lines · Thomas Gleixner
Crap. Stop beating on those lost wakeup events. If we lose them then the drivers are broken and do not handle the switch over correctly. Or the suspend mechanism is broken as it does not evaluate the system state correctly. Blockers are just papering over that w/o tackling the real problem.
That's the point -- suspend does not evaluate the system state correctly because it doesn't have the necessary information. Suspend blockers are a way of providing it that information. They don't paper over the problem; they solve it.
Alan Stern
Quoted 8 lines · Alan Stern
Quoted 5 lines · Thomas Gleixner
Crap. Stop beating on those lost wakeup events. If we lose them then the drivers are broken and do not handle the switch over correctly. Or the suspend mechanism is broken as it does not evaluate the system state correctly. Blockers are just papering over that w/o tackling the real problem.
Quoted 4 lines
That's the point -- suspend does not evaluate the system state correctly because it doesn't have the necessary information. Suspend blockers are a way of providing it that information. They don't paper over the problem; they solve it.
Nonsense. The system state is well defined when a event is pending and we just have to say good bye to the idea that forced suspend is a good solution. It's not as it does not guarantee the event processing in badly written apps and it does move the power consumption to a later point in time for those apps which acquire/drop the blockers.
Thanks,
tglx
Quoted 15 lines · Thomas Gleixner
Quoted 8 lines · Alan Stern
Quoted 5 lines · Thomas Gleixner
Crap. Stop beating on those lost wakeup events. If we lose them then the drivers are broken and do not handle the switch over correctly. Or the suspend mechanism is broken as it does not evaluate the system state correctly. Blockers are just papering over that w/o tackling the real problem.
Quoted 4 lines
That's the point -- suspend does not evaluate the system state correctly because it doesn't have the necessary information. Suspend blockers are a way of providing it that information. They don't paper over the problem; they solve it.
Quoted 5 lines
Nonsense. The system state is well defined when a event is pending and we just have to say good bye to the idea that forced suspend is a good solution. It's not as it does not guarantee the event processing in badly written apps and it does move the power consumption to a later point in time for those apps which acquire/drop the blockers.
Well, now you have stated that Android actually doesn't work. :-)
Rafael
Quoted 15 lines · Thomas Gleixner
Quoted 8 lines · Alan Stern
Quoted 5 lines · Thomas Gleixner
Crap. Stop beating on those lost wakeup events. If we lose them then the drivers are broken and do not handle the switch over correctly. Or the suspend mechanism is broken as it does not evaluate the system state correctly. Blockers are just papering over that w/o tackling the real problem.
Quoted 4 lines
That's the point -- suspend does not evaluate the system state correctly because it doesn't have the necessary information. Suspend blockers are a way of providing it that information. They don't paper over the problem; they solve it.
Quoted 5 lines
Nonsense. The system state is well defined when a event is pending and we just have to say good bye to the idea that forced suspend is a good solution. It's not as it does not guarantee the event processing in badly written apps and it does move the power consumption to a later point in time for those apps which acquire/drop the blockers.
Well, now you have stated that Android actually doesn't work. :-)
Rafael
Quoted 8 lines · Alan Stern
Quoted 5 lines · Thomas Gleixner
Crap. Stop beating on those lost wakeup events. If we lose them then the drivers are broken and do not handle the switch over correctly. Or the suspend mechanism is broken as it does not evaluate the system state correctly. Blockers are just papering over that w/o tackling the real problem.
Quoted 4 lines
That's the point -- suspend does not evaluate the system state correctly because it doesn't have the necessary information. Suspend blockers are a way of providing it that information. They don't paper over the problem; they solve it.
Nonsense. The system state is well defined when a event is pending and we just have to say good bye to the idea that forced suspend is a good solution. It's not as it does not guarantee the event processing in badly written apps and it does move the power consumption to a later point in time for those apps which acquire/drop the blockers.
Thanks,
tglx
Quoted 2 lines
That's the point -- suspend does not evaluate the system state correctly because it doesn't have the necessary information. Suspend
The power management layer knows if the machine is idle, it has insight into when the next wakeups will occur.
Quoted 2 lines
blockers are a way of providing it that information. They don't paper over the problem; they solve it.
I'm still unconvinced (see Thomas examples as a starter) and even if they did, the cure would be far worse than the disease.
The hardware world also shows how you handle suspend/resume event races cleanly and in turn how we can handle right from user to hardware.
If you are dealing with a well behaved UI app then its event loop will just do
if (message == UI_OFF) {
stop_background_stuff();
event_mask &= stuff;
send_reply(NIGHT_NIGHT);
continue;
/* Back to poll() */
}and power management does the rest. If an event wakes up the process before we get to suspend in kernel we will wake it back up. If the event gets in after pm decides to idle via suspend then it'll bounce through the kernel back to a kernel resume, or potentially through a full hardware/software suspend/resume bounce. You have one person who needs to track the sequence - that's however is the guy sending UI_ON/UI_OFF information and making the screen light up.
If you are dealing with a badly behaved app then you can't win because it may not have the magic 'suspend blockers' or will do it wrong. You can constrain it (brute force SIGSTOP after it refuses to UI_OFF for a bit, or via nice or other QoS policy) but you can't assume it'll magically managge itself. It is "badly behaved" so by that very definition you can't assume it has correct magic goo in it. (Side note:
the extra magic goo and complexity of such blockers makes it more likely the app will be buggy and thus 'badly behaved' !)
You can pick up which tasks are stopping the suspend fairly easily at the moment via the ktrace interfaces. Maybe there is a case for making that tidier but powertop and the like already demonstrate you can track this.
A cpu policy can obviously expose offenders itself directly to user space. That (and indeed people not responding to UI_OFF) then lets your phone do
<boop>
X is misbehaving
[Close it] [Allow this time] [Disable]
and also to provide stats for each wakeup a policy manager can spot offenders (even those who are perhaps hard to see because they wake up a little bit every so often but just enough to mess up pm). In the x86 world Arjan found a *lot* of that sort of stuff.
Your policy manager can also act on it. The current policy manager is to fix app bugs and shows people up at conferences. I would imagine a google policy would be to collate misbehaving app reports at google.com and use them both to assist in 'educating' authors and in scoring app store stuff.
As it is <boop> X is misbehaving is a powerful economic lever in a pretty dynamic and functioning software market.
Google seem to be pretty good at statistical data, I can't believe battery advice for apps on the app stores and indeed a 'where did my battery go' pie chart are beyond their wit, or beyond the end user to figure out.
There are a considerable number of people shipping power constrained Linux devices without suddenely desperately needing extra magic potions. Are they really all just that much smarter than Google ?
Alan
Quoted 5 lines · Alan Cox
Quoted 2 lines
That's the point -- suspend does not evaluate the system state correctly because it doesn't have the necessary information. Suspend
The power management layer knows if the machine is idle, it has insight into when the next wakeups will occur.
But not the kind of insight we need. See below.
Quoted 5 lines
Quoted 2 lines
blockers are a way of providing it that information. They don't paper over the problem; they solve it.
I'm still unconvinced (see Thomas examples as a starter) and even if they did, the cure would be far worse than the disease.
Perhaps.
Quoted 14 lines
The hardware world also shows how you handle suspend/resume event races cleanly and in turn how we can handle right from user to hardware.
If you are dealing with a well behaved UI app then its event loop will just do
if (message == UI_OFF) { stop_background_stuff(); event_mask &= stuff; send_reply(NIGHT_NIGHT); continue; /* Back to poll() */ }
Quoted 2 lines
and power management does the rest. If an event wakes up the process before we get to suspend in kernel we will wake it back up.
Okay, and the kernel never suspends. We _are_ talking about a kind of forced suspend, right?
Quoted 3 lines
If the event
gets in after pm decides to idle via suspend then it'll bounce through the kernel back to a kernel resume,
No, it won't. That's the problem suspend blockers were meant to solve. The event winds up sitting in a kernel queue, the PM core doesn't know about it (that's what I meant above -- the PM core doesn't know as much as you seem to think it does), and the suspend takes place regardless.
Quoted 2 lines
or potentially through a full
hardware/software suspend/resume bounce.
It would be okay if that happened. But once the event gets into the kernel and the hardware IRQ source has turned off, there's nothing to cause the resume.
Quoted 6 lines
You have one person who needs to
track the sequence - that's however is the guy sending UI_ON/UI_OFF information and making the screen light up.If you are dealing with a badly behaved app then you can't win because it may not have the magic 'suspend blockers' or will do it wrong.
Agreed. Badly behaved apps must not be allowed to block suspends. As far as I'm concerned, we can ignore them.
Alan Stern
Quoted 5 lines · On Thu, 27 May 2010 17:38:03 -0400 (EDT) Alan Stern…
Quoted 2 lines
and power management does the rest. If an event wakes up the process before we get to suspend in kernel we will wake it back up.
Okay, and the kernel never suspends. We _are_ talking about a kind of forced suspend, right?
No ? We are talking about just letting power management solve the whole problem for us.
Quoted 8 lines
Quoted 3 lines
If the event
gets in after pm decides to idle via suspend then it'll bounce through the kernel back to a kernel resume,No, it won't. That's the problem suspend blockers were meant to solve. The event winds up sitting in a kernel queue, the PM core doesn't know about it (that's what I meant above -- the PM core doesn't know as much as you seem to think it does), and the suspend takes place regardless.
No - because we are not forcing the suspend. The app must go idle. If you force the suspend of running processes then yes the entire thing goes castors up - which is why it's a bad idea to do so.
Quoted 6 lines
Quoted 2 lines
or potentially through a full
hardware/software suspend/resume bounce.It would be okay if that happened. But once the event gets into the kernel and the hardware IRQ source has turned off, there's nothing to cause the resume.
Read the discussion about how the race is avoided at the hardware level. That race is I think not there and furthermore most drivers get it right already.
There are several cases
1. IRQ during app layer (ie policy in user space) asking
applications to go passive
- The event occurs, we undo the app layer policy, easy (or app wakes process and we let it fall through)
2. IRQ after the app layer quiesces its clients
- The task wakes, the app layer won't see it - the app layer allows suspend as an idle mode. Not a problem - the app is running the cpu policy manager will see this and not suspend until the app has been asleep for a bit. The app may well of course tell the UI layer 'hey I want you back on' and it take you back to the full on case.
3. IRQ after kernel suspend begins
- The driver will refuse the suspend, we don't suspend, we unwind the resume so far, the app wakes, we propogate stuff back up to user space whose policy manager unwinds its position
4. IRQ after driver has done its final checks
- Wake up lines are set
- We suspend
- We immediately get resumed
- We follow the full resume path
This is I believe robust (and has been implemented on some non x86 boxes). It depends on not forcing running tasks into suspend. That is the key.
Alan
Quoted 3 lines · Alan Cox
This is I believe robust (and has been implemented on some non x86 boxes). It depends on not forcing running tasks into suspend. That is the key.
We've already established that ACPI systems require us to force running tasks into suspend. How do we avoid the race in that situation?
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 8 lines · On Thu, 27 May 2010 23:09:49 +0100 Matthew Garrett <[email protected]> wrote:
Quoted 3 lines · Alan Cox
This is I believe robust (and has been implemented on some non x86 boxes). It depends on not forcing running tasks into suspend. That is the key.
We've already established that ACPI systems require us to force running tasks into suspend. How do we avoid the race in that situation?
Android phones do not have ACPI. Embedded platforms do not have ACPI. MID x86 devices do not have ACPI.
I would imagine the existing laptops will handle power management limited by the functionality they have available. Just like any other piece of hardware.
Alan
Quoted 9 lines · Alan Cox
Quoted 6 lines · On Thu, 27 May 2010 23:09:49 +0100 Matthew Garrett <[email protected]> wrote:
Quoted 3 lines · Alan Cox
This is I believe robust (and has been implemented on some non x86 boxes). It depends on not forcing running tasks into suspend. That is the key.
Quoted 5 lines
Quoted 2 lines
We've already established that ACPI systems require us to force running tasks into suspend. How do we avoid the race in that situation?
Android phones do not have ACPI. Embedded platforms do not have ACPI. MID x86 devices do not have ACPI.
It doesn't matter. Right now there's a race condition in terms of wakeup events on ACPI systems. What's your proposal for fixing that?
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 10 lines · On Thu, 27 May 2010 23:36:05 +0100 Matthew Garrett <[email protected]> wrote:
Quoted 9 lines · Alan Cox
Quoted 6 lines · On Thu, 27 May 2010 23:09:49 +0100 Matthew Garrett <[email protected]> wrote:
Quoted 3 lines · Alan Cox
This is I believe robust (and has been implemented on some non x86 boxes). It depends on not forcing running tasks into suspend. That is the key.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
We've already established that ACPI systems require us to force running tasks into suspend. How do we avoid the race in that situation?
Android phones do not have ACPI. Embedded platforms do not have ACPI. MID x86 devices do not have ACPI.
It doesn't matter. Right now there's a race condition in terms of wakeup events on ACPI systems. What's your proposal for fixing that?
I see it as a different problem - and one that seems to be minimally pressing to most users jduging by the amount of noise it hasn't caused in the past seven odd years.
This started because the Android people came to a meeting that was put together of various folks to try and sort of the big blockage in getting Android and Linux kernels back towards merging.
I am interested right now in finding a general solution to the Android case and the fact it looks very similar to the VM, hard RT, gamer and other related problems although we seem to have diverged from that logic.
I dont think it particularly useful to go off on a mostly unrelated wild goose chase into ACPI land, especially one based on a premise of changing all the apps when the hardware will end up fixed faster.
Alan
Quoted 8 lines · Alan Cox
This started because the Android people came to a meeting that was put together of various folks to try and sort of the big blockage in getting Android and Linux kernels back towards merging.
I am interested right now in finding a general solution to the Android case and the fact it looks very similar to the VM, hard RT, gamer and other related problems although we seem to have diverged from that logic.
Keep in mind, though, that a solution which is acceptable for Android has to include making sure that crappy applications don't cause the battery to get drained. There seem to be some people who seem adamently against this requirement. From the Android folks' perspective, this is part of what is required to have an open app store, as opposed to one where each application has to be carefully screened and approved ala the Apple iPhone App Store.
Maybe it would be acceptable if there were an easy way THAT A USER AND NOT A DEVELOPER COULD USE ON A SMART PHONE to find the bad application, but realistically, it's much better if the solution can work well even in the face of crappy application. Having interacted with application programmers, I can assure you there are a lot of crappy application programmers out there, and they vastly outnumber us kernel developers. (See as exhibit A all of the application programs who refuse to use fsync, even though it's going to wipe them out on all new modern file systems, including btrfs.)
We need to agree on the requirements up front, because otherwise this is going to be a waste of everyone's time.
And if we can't get agreement on requirements, I'd suggest appealing this whole thing to Linus. Either he'll agree to the requirements and/or the existing implementation, in which case we can move on with our lives, or he'll say no, in which case it will be blately obvious that it was Linux developer community who rejected the Android approach, despite a fairly large amount of effort trying to get something that satisfies *all* of the various LKML developers who have commented on this patch, and we can continue with Android having kernel which is different from mainline --- just as many other embedded companies have patches which are utterly required by their products, but which have been judged Too Ugly To Live In Mainline --- and we can also move on and get on with our lives.
- Ted
P.S. Keep in mind how this looks from an outsider's perspective; an embedded manufacturer spends a fairly large amount of time answering one set of review comments, and a few weeks later, more people pop up, and make a much deeper set of complaints, and request that the current implementation be completely thrown out and that someone new be designed from scratch --- and the new design isn't even going to meet all of the requirements that the embedded manufacturer thought were necessary. Is it any wonder a number of embedded developers have decided it's Just Too Hard to Work With the LKML?
Quoted 8 lines · Alan Cox
This started because the Android people came to a meeting that was put together of various folks to try and sort of the big blockage in getting Android and Linux kernels back towards merging.
I am interested right now in finding a general solution to the Android case and the fact it looks very similar to the VM, hard RT, gamer and other related problems although we seem to have diverged from that logic.
Keep in mind, though, that a solution which is acceptable for Android has to include making sure that crappy applications don't cause the battery to get drained. There seem to be some people who seem adamently against this requirement. From the Android folks' perspective, this is part of what is required to have an open app store, as opposed to one where each application has to be carefully screened and approved ala the Apple iPhone App Store.
Maybe it would be acceptable if there were an easy way THAT A USER AND NOT A DEVELOPER COULD USE ON A SMART PHONE to find the bad application, but realistically, it's much better if the solution can work well even in the face of crappy application. Having interacted with application programmers, I can assure you there are a lot of crappy application programmers out there, and they vastly outnumber us kernel developers. (See as exhibit A all of the application programs who refuse to use fsync, even though it's going to wipe them out on all new modern file systems, including btrfs.)
We need to agree on the requirements up front, because otherwise this is going to be a waste of everyone's time.
And if we can't get agreement on requirements, I'd suggest appealing this whole thing to Linus. Either he'll agree to the requirements and/or the existing implementation, in which case we can move on with our lives, or he'll say no, in which case it will be blately obvious that it was Linux developer community who rejected the Android approach, despite a fairly large amount of effort trying to get something that satisfies *all* of the various LKML developers who have commented on this patch, and we can continue with Android having kernel which is different from mainline --- just as many other embedded companies have patches which are utterly required by their products, but which have been judged Too Ugly To Live In Mainline --- and we can also move on and get on with our lives.
- Ted
P.S. Keep in mind how this looks from an outsider's perspective; an embedded manufacturer spends a fairly large amount of time answering one set of review comments, and a few weeks later, more people pop up, and make a much deeper set of complaints, and request that the current implementation be completely thrown out and that someone new be designed from scratch --- and the new design isn't even going to meet all of the requirements that the embedded manufacturer thought were necessary. Is it any wonder a number of embedded developers have decided it's Just Too Hard to Work With the LKML?
Quoted 4 lines · On Fri, 2010-05-28 at 00:31 -0400, [email protected] wrote:
Keep in mind, though, that a solution which is acceptable for Android has to include making sure that crappy applications don't cause the battery to get drained. There seem to be some people who seem adamently against this requirement.
Again, Alan, Thomas and myself don't argue against that, what we do however argue against is suspend running apps as a form of power management.
If you were to read Alan's latest posts he clearly outlines how you can contain crappy apps.
A combination of weakening QoS guarantees (delaying wakeups etc.) blocking on resources (delay servicing requests) and monitoring resource usage (despite all that its still not idle) and taking affirmative action (shoot it in the head).
If we pose that a well behaved application is one that listens to the environment hints and idles when told to, we can let regular power management kick in and let deep idle states do their thing.
If a bad application ignores those hints and manages to avoid getting blocked on denied resources, we can easily spot it and promote an attitude of violence toward it in the form of SIGXCPU, SIGSTOP, SIGTERM and SIGKILL, possibly coupled with a pop-up dialog -- much like we get today when we try to close a window and the app isn't responding.
If we then also let the environment maintain a shitlist of crappy apps (those it had to take affirmative action against) and maybe set up a service that allows people to share their results, it provides an incentive to the app developers to fix their thing.
How is this not working?
Quoted 10 lines · Peter Zijlstra
Quoted 4 lines · On Fri, 2010-05-28 at 00:31 -0400, [email protected] wrote:
Keep in mind, though, that a solution which is acceptable for Android has to include making sure that crappy applications don't cause the battery to get drained. There seem to be some people who seem adamently against this requirement.
Again, Alan, Thomas and myself don't argue against that, what we do however argue against is suspend running apps as a form of power management.
You seem to argue that android is not allowed to use suspend because the hardware we have shipped on can enter the same power state from idle. From my point of view, since we need to support suspend on some hardware we should be allowed to leverage this solution on the better hardware platforms as well if it improves our battery life.
Quoted 3 lines
If you were to read Alan's latest posts he clearly outlines how you can contain crappy apps.
I have not seen any suggestions for how to deal with all our interprocess dependencies when pausing a subset of processes. Without a solution to that we can only pause a subset of the processes we want to pause.
Quoted 15 lines
A combination of weakening QoS guarantees (delaying wakeups etc.) blocking on resources (delay servicing requests) and monitoring resource usage (despite all that its still not idle) and taking affirmative action (shoot it in the head).
If we pose that a well behaved application is one that listens to the environment hints and idles when told to, we can let regular power management kick in and let deep idle states do their thing.
If a bad application ignores those hints and manages to avoid getting blocked on denied resources, we can easily spot it and promote an attitude of violence toward it in the form of SIGXCPU, SIGSTOP, SIGTERM and SIGKILL, possibly coupled with a pop-up dialog -- much like we get today when we try to close a window and the app isn't responding.
Quoted 7 lines
If we then also let the environment maintain a shitlist of crappy apps (those it had to take affirmative action against) and maybe set up a service that allows people to share their results, it provides an incentive to the app developers to fix their thing.
How is this not working?
These solutions do not allow us to use suspend. They may get us closer to the power consumption we get from suspend on the good hardware or even surpass it, but we still need suspend on some hardware, and we would get event better results by using these solutions in addition to suspend compared to using them instead of suspend.
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 12 lines · Arve Hjønnevåg
Quoted 10 lines · Peter Zijlstra
Quoted 4 lines · On Fri, 2010-05-28 at 00:31 -0400, [email protected] wrote:
Keep in mind, though, that a solution which is acceptable for Android has to include making sure that crappy applications don't cause the battery to get drained. There seem to be some people who seem adamently against this requirement.
Again, Alan, Thomas and myself don't argue against that, what we do however argue against is suspend running apps as a form of power management.
Quoted 5 lines
You seem to argue that android is not allowed to use suspend because the hardware we have shipped on can enter the same power state from idle. From my point of view, since we need to support suspend on some hardware we should be allowed to leverage this solution on the better hardware platforms as well if it improves our battery life.
Correct, I strongly oppose using suspend. Not running runnable tasks is not a sane solution.
If current hardware can't cope, too friggin bad, get better hardware.
But the truth is, all your OMAP phones really can deal with it.
Quoted 4 lines
I have not seen any suggestions for how to deal with all our interprocess dependencies when pausing a subset of processes. Without a solution to that we can only pause a subset of the processes we want to pause.
Do not 'pause' processes and you don't have the problem, make them stop on their own accord or kill them if they dont listen.. who cares about ill-behaved apps anyway?
But really, if you want a more detailed answer, you need to provide more detail on these problems.
If you want to allow an untrusted app to provide a dependency for a trusted app, you've lost and I don't care.
Trusted apps should be well behaved, otherwise there really is no point.
Quoted 5 lines
These solutions do not allow us to use suspend. They may get us closer to the power consumption we get from suspend on the good hardware or even surpass it, but we still need suspend on some hardware, and we would get event better results by using these solutions in addition to suspend compared to using them instead of suspend.
Not using suspend is exactly the point. As Alan has argued, propagating suspend blockers up into all regions of userspace will take much longer than fixing the hardware.
You got to realize this is about Linux as a whole, I really don't care one whit about the specific Android case. We want a solution that is generic enough to solve the power consumption problem and makes sense on future hardware.
The only abstraction that really makes sense in that view is idle states.
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 12 lines · Arve Hjønnevåg
Quoted 10 lines · Peter Zijlstra
Quoted 4 lines · On Fri, 2010-05-28 at 00:31 -0400, [email protected] wrote:
Keep in mind, though, that a solution which is acceptable for Android has to include making sure that crappy applications don't cause the battery to get drained. There seem to be some people who seem adamently against this requirement.
Again, Alan, Thomas and myself don't argue against that, what we do however argue against is suspend running apps as a form of power management.
Quoted 5 lines
You seem to argue that android is not allowed to use suspend because the hardware we have shipped on can enter the same power state from idle. From my point of view, since we need to support suspend on some hardware we should be allowed to leverage this solution on the better hardware platforms as well if it improves our battery life.
Correct, I strongly oppose using suspend. Not running runnable tasks is not a sane solution.
If current hardware can't cope, too friggin bad, get better hardware.
But the truth is, all your OMAP phones really can deal with it.
Quoted 4 lines
I have not seen any suggestions for how to deal with all our interprocess dependencies when pausing a subset of processes. Without a solution to that we can only pause a subset of the processes we want to pause.
Do not 'pause' processes and you don't have the problem, make them stop on their own accord or kill them if they dont listen.. who cares about ill-behaved apps anyway?
But really, if you want a more detailed answer, you need to provide more detail on these problems.
If you want to allow an untrusted app to provide a dependency for a trusted app, you've lost and I don't care.
Trusted apps should be well behaved, otherwise there really is no point.
Quoted 5 lines
These solutions do not allow us to use suspend. They may get us closer to the power consumption we get from suspend on the good hardware or even surpass it, but we still need suspend on some hardware, and we would get event better results by using these solutions in addition to suspend compared to using them instead of suspend.
Not using suspend is exactly the point. As Alan has argued, propagating suspend blockers up into all regions of userspace will take much longer than fixing the hardware.
You got to realize this is about Linux as a whole, I really don't care one whit about the specific Android case. We want a solution that is generic enough to solve the power consumption problem and makes sense on future hardware.
The only abstraction that really makes sense in that view is idle states.
--
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 4 lines · Peter Zijlstra
Correct, I strongly oppose using suspend. Not running runnable tasks is not a sane solution.
If current hardware can't cope, too friggin bad, get better hardware.
Taken out of context, this statement suggests you believe that x86-based laptops should not be allowed to suspend automatically when their lids are closed, and that everybody should replace their x86-based laptops with something better.
Is that really what you mean?
Alan Stern
Quoted 4 lines · Peter Zijlstra
Correct, I strongly oppose using suspend. Not running runnable tasks is not a sane solution.
If current hardware can't cope, too friggin bad, get better hardware.
Taken out of context, this statement suggests you believe that x86-based laptops should not be allowed to suspend automatically when their lids are closed, and that everybody should replace their x86-based laptops with something better.
Is that really what you mean?
Alan Stern
Quoted 13 lines · Peter Zijlstra
Quoted 12 lines · Arve Hjønnevåg
Quoted 10 lines · Peter Zijlstra
Quoted 4 lines · On Fri, 2010-05-28 at 00:31 -0400, [email protected] wrote:
Keep in mind, though, that a solution which is acceptable for Android has to include making sure that crappy applications don't cause the battery to get drained. There seem to be some people who seem adamently against this requirement.
Again, Alan, Thomas and myself don't argue against that, what we do however argue against is suspend running apps as a form of power management.
Quoted 8 lines
Quoted 5 lines
You seem to argue that android is not allowed to use suspend because the hardware we have shipped on can enter the same power state from idle. From my point of view, since we need to support suspend on some hardware we should be allowed to leverage this solution on the better hardware platforms as well if it improves our battery life.
Correct, I strongly oppose using suspend. Not running runnable tasks is not a sane solution.
Look, this is getting into the realms of a pointless semantic quibble. The problem is that untrusted tasks need to be forcibly suspended when they have no legitimate work to do and the user hasn't authorised them to continue even if the scheduler sees them as runnable. Whether that's achieved by suspending the entire system or forcibly idling the tasks (using blocking states or freezers or something) so the scheduler can suspend from idle is something to be discussed, but the net result is that we have to stop a certain set of tasks in such a way that they can still receive certain external events ... semantically, this is equivalent to not running runnable tasks in my book. (Perhaps this whole thing is because the word runnable means different things ... I'm thinking a task that would consume power ... are you thinking in the scheduler R state?)
Realistically, the main thing we need to do is stop timers posted against the task (which is likely polling in a main loop, that being the usual form of easy to write but power crazy app behaviour) from waking the task and bringing the system out of suspend (whether from idle or forced).
Quoted 3 lines
If current hardware can't cope, too friggin bad, get better hardware.
But the truth is, all your OMAP phones really can deal with it.
That's rubbish and you know it. We do software workarounds for hardware problems all the time ... try doing a git grep -i errata in arch x86, or imagine a USB subsystem that only supported sane standards conforming
devices: that would have an almost zero intersect with the current USB device market.
The job of the kernel is to accommodate hardware as best it can ... sometimes it might not be able to, but most of the time it does a pretty good job.
The facts are that C states and S states are different and are entered differently. For some omap hardware, the power consumption in the lowest C state (with all the ancillary power control) is the same as S3, that's fine, suspend from idle works as well as suspend to ram modulo bad apps. For quite a lot of MSM hardware, the lowest C state power consumption is quite a bit above S3. It's not acceptable to tell those people "tough, your battery runs out in 30 minutes because you bought the wrong hardware". We have to figure out how to get to S3 ... whether this is from idle or some other mechanism is again a discussion point, but not doing it is not an option.
Quoted 23 lines
Quoted 4 lines
I have not seen any suggestions for how to deal with all our interprocess dependencies when pausing a subset of processes. Without a solution to that we can only pause a subset of the processes we want to pause.
Do not 'pause' processes and you don't have the problem, make them stop on their own accord or kill them if they dont listen.. who cares about ill-behaved apps anyway?
But really, if you want a more detailed answer, you need to provide more detail on these problems.
If you want to allow an untrusted app to provide a dependency for a trusted app, you've lost and I don't care.
Trusted apps should be well behaved, otherwise there really is no point.
Quoted 5 lines
These solutions do not allow us to use suspend. They may get us closer to the power consumption we get from suspend on the good hardware or even surpass it, but we still need suspend on some hardware, and we would get event better results by using these solutions in addition to suspend compared to using them instead of suspend.
Quoted 3 lines
Not using suspend is exactly the point. As Alan has argued, propagating suspend blockers up into all regions of userspace will take much longer than fixing the hardware.
Strange, that's not what I heard as the possible solution. I thought he was advocating expressing the kernel side of suspend blockers as QoS constraints. Once we have QoS constraints correctly done in the kernel, userspace still has to express its requirements. If the requirements are static, then they can be done from policy files or in some other static way but if they're dynamic, they'll still have to be in the applications ... in about the same places the android wakelocks are.
Quoted 4 lines
You got to realize this is about Linux as a whole, I really don't care one whit about the specific Android case. We want a solution that is generic enough to solve the power consumption problem and makes sense on future hardware.
I don't think anyone disagrees with this. As long as we find a long term solution that satisfies the android case, everyone will be happy.
Quoted 2 lines
The only abstraction that really makes sense in that view is idle states.
James
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 13 lines · Peter Zijlstra
Quoted 12 lines · Arve Hjønnevåg
Quoted 10 lines · Peter Zijlstra
Quoted 4 lines · On Fri, 2010-05-28 at 00:31 -0400, [email protected] wrote:
Keep in mind, though, that a solution which is acceptable for Android has to include making sure that crappy applications don't cause the battery to get drained. There seem to be some people who seem adamently against this requirement.
Again, Alan, Thomas and myself don't argue against that, what we do however argue against is suspend running apps as a form of power management.
Quoted 8 lines
Quoted 5 lines
You seem to argue that android is not allowed to use suspend because the hardware we have shipped on can enter the same power state from idle. From my point of view, since we need to support suspend on some hardware we should be allowed to leverage this solution on the better hardware platforms as well if it improves our battery life.
Correct, I strongly oppose using suspend. Not running runnable tasks is not a sane solution.
Look, this is getting into the realms of a pointless semantic quibble. The problem is that untrusted tasks need to be forcibly suspended when they have no legitimate work to do and the user hasn't authorised them to continue even if the scheduler sees them as runnable. Whether that's achieved by suspending the entire system or forcibly idling the tasks (using blocking states or freezers or something) so the scheduler can suspend from idle is something to be discussed, but the net result is that we have to stop a certain set of tasks in such a way that they can still receive certain external events ... semantically, this is equivalent to not running runnable tasks in my book. (Perhaps this whole thing is because the word runnable means different things ... I'm thinking a task that would consume power ... are you thinking in the scheduler R state?)
Realistically, the main thing we need to do is stop timers posted against the task (which is likely polling in a main loop, that being the usual form of easy to write but power crazy app behaviour) from waking the task and bringing the system out of suspend (whether from idle or forced).
Quoted 3 lines
If current hardware can't cope, too friggin bad, get better hardware.
But the truth is, all your OMAP phones really can deal with it.
That's rubbish and you know it. We do software workarounds for hardware problems all the time ... try doing a git grep -i errata in arch x86, or imagine a USB subsystem that only supported sane standards conforming
devices: that would have an almost zero intersect with the current USB device market.
The job of the kernel is to accommodate hardware as best it can ... sometimes it might not be able to, but most of the time it does a pretty good job.
The facts are that C states and S states are different and are entered differently. For some omap hardware, the power consumption in the lowest C state (with all the ancillary power control) is the same as S3, that's fine, suspend from idle works as well as suspend to ram modulo bad apps. For quite a lot of MSM hardware, the lowest C state power consumption is quite a bit above S3. It's not acceptable to tell those people "tough, your battery runs out in 30 minutes because you bought the wrong hardware". We have to figure out how to get to S3 ... whether this is from idle or some other mechanism is again a discussion point, but not doing it is not an option.
Quoted 23 lines
Quoted 4 lines
I have not seen any suggestions for how to deal with all our interprocess dependencies when pausing a subset of processes. Without a solution to that we can only pause a subset of the processes we want to pause.
Do not 'pause' processes and you don't have the problem, make them stop on their own accord or kill them if they dont listen.. who cares about ill-behaved apps anyway?
But really, if you want a more detailed answer, you need to provide more detail on these problems.
If you want to allow an untrusted app to provide a dependency for a trusted app, you've lost and I don't care.
Trusted apps should be well behaved, otherwise there really is no point.
Quoted 5 lines
These solutions do not allow us to use suspend. They may get us closer to the power consumption we get from suspend on the good hardware or even surpass it, but we still need suspend on some hardware, and we would get event better results by using these solutions in addition to suspend compared to using them instead of suspend.
Quoted 3 lines
Not using suspend is exactly the point. As Alan has argued, propagating suspend blockers up into all regions of userspace will take much longer than fixing the hardware.
Strange, that's not what I heard as the possible solution. I thought he was advocating expressing the kernel side of suspend blockers as QoS constraints. Once we have QoS constraints correctly done in the kernel, userspace still has to express its requirements. If the requirements are static, then they can be done from policy files or in some other static way but if they're dynamic, they'll still have to be in the applications ... in about the same places the android wakelocks are.
Quoted 4 lines
You got to realize this is about Linux as a whole, I really don't care one whit about the specific Android case. We want a solution that is generic enough to solve the power consumption problem and makes sense on future hardware.
I don't think anyone disagrees with this. As long as we find a long term solution that satisfies the android case, everyone will be happy.
Quoted 2 lines
The only abstraction that really makes sense in that view is idle states.
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 10 lines · James Bottomley
Quoted 2 lines
Correct, I strongly oppose using suspend. Not running runnable tasks is not a sane solution.
Look, this is getting into the realms of a pointless semantic quibble. The problem is that untrusted tasks need to be forcibly suspended when they have no legitimate work to do and the user hasn't authorised them to continue even if the scheduler sees them as runnable. Whether that's achieved by suspending the entire system or forcibly idling the tasks (using blocking states or freezers or something) so the scheduler can suspend from idle is something to be discussed,
So what happens if you task is CPU bound and gets suspended and is holding a resource (lock, whatever) that is required by someone else that didn't get suspended?
That's the classic inversion problem, and is caused by not running runnable tasks.
Quoted 4 lines
but the net result is
that we have to stop a certain set of tasks in such a way that they can still receive certain external events ... semantically, this is equivalent to not running runnable tasks in my book.
Why would be care about external events? Clearly these apps are ill behaved, otherwise they would have listened to the environment telling them to idle.
Why would you try to let buggy apps work as intended instead of break them as hard as possible? Such policy promotes crappy code since people get away with it.
Quoted 4 lines
(Perhaps this whole
thing is because the word runnable means different things ... I'm thinking a task that would consume power ... are you thinking in the scheduler R state?)
Clearly I mean TASK_RUNNABLE, if not that the scheduler doesn't care.
Quoted 5 lines
Realistically, the main thing we need to do is stop timers posted against the task (which is likely polling in a main loop, that being the usual form of easy to write but power crazy app behaviour) from waking the task and bringing the system out of suspend (whether from idle or forced).
Sure, that same main loop will probably receive a message along the lines of, 'hey, screen is off, we ought to go sleep'. If after that it doesn't listen, and more serious messages don't get responded to, simply kill the thing.
Again, there is no reason what so ever to tolerate broken apps, it only promotes crappy apps.
Quoted 12 lines · On Sat, 29 May 2010 20:12:14 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 10 lines · James Bottomley
Quoted 2 lines
Correct, I strongly oppose using suspend. Not running runnable tasks is not a sane solution.
Look, this is getting into the realms of a pointless semantic quibble. The problem is that untrusted tasks need to be forcibly suspended when they have no legitimate work to do and the user hasn't authorised them to continue even if the scheduler sees them as runnable. Whether that's achieved by suspending the entire system or forcibly idling the tasks (using blocking states or freezers or something) so the scheduler can suspend from idle is something to be discussed,
Quoted 6 lines
So what happens if you task is CPU bound and gets suspended and is holding a resource (lock, whatever) that is required by someone else that didn't get suspended?
That's the classic inversion problem, and is caused by not running runnable tasks.
The trick with the approach currently discussed (i.e. opportunistic suspend, if you missed it): We suspend the whole machine.
And I really think, this is the only way to do it. It is a big hammer, shure. But if you can pull it of...
Quoted 6 lines
Quoted 5 lines
but the net result is
that we have to stop a certain set of tasks in such a way that they can still receive certain external events ... semantically, this is equivalent to not running runnable tasks in my book.
Quoted 7 lines
Why would be care about external events? Clearly these apps are ill behaved, otherwise they would have listened to the environment telling them to idle.
Why would you try to let buggy apps work as intended instead of break them as hard as possible? Such policy promotes crappy code since people get away with it.
If I have a simple shell script then I don't wanna jump through hoops just to please your fragile kernel.
And before you judge code that does not behave to work with YOUR buggy kernel, i would think twice. This cuts both ways. Just because the problem is too hard for you, this does not excuse forcing crappy kernels on other people.
I think you have a point in that it is _in general_ not easily possible to solve. But for this case this is clearly a simple, to the point and working solution for android based phones.
"Der Wurm muss dem Fisch schmecken, nicht dem Angler."
Quoted 14 lines
Quoted 5 lines
(Perhaps this whole
thing is because the word runnable means different things ... I'm thinking a task that would consume power ... are you thinking in the scheduler R state?)Clearly I mean
TASK_RUNNABLE, if not that the scheduler doesn't care.Quoted 5 lines
Realistically, the main thing we need to do is stop timers posted against the task (which is likely polling in a main loop, that being the usual form of easy to write but power crazy app behaviour) from waking the task and bringing the system out of suspend (whether from idle or forced).
Quoted 4 lines
Sure, that same main loop will probably receive a message along the lines of, 'hey, screen is off, we ought to go sleep'. If after that it doesn't listen, and more serious messages don't get responded to, simply kill the thing.
I think this would be a possibility. And maybe even sane. But I also think this has nothing to do with suspend_blockers. They block suspend. You know?
Quoted 4 lines
Again, there is no reason what so ever to tolerate broken apps, it only promotes crappy apps.
This simple doesn't solve the problem.
Cheers,
Flo
Quoted 9 lines · On Mon, 31 May 2010 22:12:19 +0200 Florian Mickler <[email protected]> wrote:
Quoted 4 lines · On Sat, 29 May 2010 20:12:14 +0200 Peter Zijlstra <[email protected]> wrote:
Why would you try to let buggy apps work as intended instead of break them as hard as possible? Such policy promotes crappy code since people get away with it.
If I have a simple shell script then I don't wanna jump through hoops just to please your fragile kernel.
Also why should that code on one device kill my uptime and on the other machine (my wall-plugged desktop) work just well? That doesn't sound right.
Clearly opportunistic suspend is a workaround for battery-driven devices and no general solution. But it is not specific to android. At least not inherently. It could be useful for any embedded or mobile device where you can clearly distinguish important functions from convenience functions.
I really can't understand the whole _fundamental_ opposition to this design choice.
Cheers,
Flo
Quoted 9 lines · On Mon, 31 May 2010 22:12:19 +0200 Florian Mickler <[email protected]> wrote:
Quoted 4 lines · On Sat, 29 May 2010 20:12:14 +0200 Peter Zijlstra <[email protected]> wrote:
Why would you try to let buggy apps work as intended instead of break them as hard as possible? Such policy promotes crappy code since people get away with it.
If I have a simple shell script then I don't wanna jump through hoops just to please your fragile kernel.
Also why should that code on one device kill my uptime and on the other machine (my wall-plugged desktop) work just well? That doesn't sound right.
Clearly opportunistic suspend is a workaround for battery-driven devices and no general solution. But it is not specific to android. At least not inherently. It could be useful for any embedded or mobile device where you can clearly distinguish important functions from convenience functions.
I really can't understand the whole _fundamental_ opposition to this design choice.
Cheers,
Flo
Quoted 8 lines · Florian Mickler
Quoted 2 lines · On Mon, 31 May 2010 22:12:19 +0200 Florian Mickler <[email protected]> wrote:
If I have a simple shell script then I don't wanna jump through hoops just to please your fragile kernel.
Also why should that code on one device kill my uptime and on the other machine (my wall-plugged desktop) work just well? That doesn't sound right.
Sounds perfectly right to me; one code runs perfectly fine on one machine, and on the other doesn't even compile. Well, sure, it wasn't written with that use-case in mind.
Quoted 5 lines
Clearly opportunistic suspend is a workaround for battery-driven devices and no general solution. But it is not specific to android. At least not inherently. It could be useful for any embedded or mobile device where you can clearly distinguish important functions from convenience functions.
Yes, it could, but why go for the hacky solution when we know how to achieve the ideal one?
Quoted 2 lines
I really can't understand the whole _fundamental_ opposition to this design choice.
Nobody is using it, except Android. Nobody will use it, except Android.
I have seen recent proposals that don't require changing the whole user-space. That might actually be used by other players.
Signature · 1 line
Felipe Contreras
Quoted 20 lines · Felipe Contreras
Quoted 8 lines · Florian Mickler
Quoted 2 lines · On Mon, 31 May 2010 22:12:19 +0200 Florian Mickler <[email protected]> wrote:
If I have a simple shell script then I don't wanna jump through hoops just to please your fragile kernel.
Also why should that code on one device kill my uptime and on the other machine (my wall-plugged desktop) work just well? That doesn't sound right.
Sounds perfectly right to me; one code runs perfectly fine on one machine, and on the other doesn't even compile. Well, sure, it wasn't written with that use-case in mind.
Quoted 5 lines
Clearly opportunistic suspend is a workaround for battery-driven devices and no general solution. But it is not specific to android. At least not inherently. It could be useful for any embedded or mobile device where you can clearly distinguish important functions from convenience functions.
Quoted 7 lines
Yes, it could, but why go for the hacky solution when we know how to achieve the ideal one?
Quoted 2 lines
I really can't understand the whole _fundamental_ opposition to this design choice.
Nobody is using it, except Android. Nobody will use it, except Android.
That's like saying "Android is not a legitimate user of the kernel". Is that you wanted to say?
Quoted 2 lines
I have seen recent proposals that don't require changing the whole user-space. That might actually be used by other players.
Sure, an approach benefitting more platforms than just Android would be better, but saying that the kernel shouldn't address the Android's specific needs as a rule if no one else has those needs too is quite too far reaching to me.
Rafael
Quoted 7 lines · Rafael J. Wysocki
Quoted 3 lines
I have seen recent proposals that don't require changing the whole user-space. That might actually be used by other players.
Sure, an approach benefitting more platforms than just Android would be better, but saying that the kernel shouldn't address the Android's specific needs as a rule if no one else has those needs too is quite too far reaching to me.
Well, if the android people keep rejecting all sensible approaches to power savings except their suspend blocker mess, then I don't see why we should support their ill designed mess.
We should strive to provide an interface that can be used by all interested parties to conserve power; if Android really is the only possible user of the interface then I don't see any reason at all to merge it, they might as well keep it in their private tree.
Quoted 5 lines · Peter Zijlstra
Quoted 4 lines · Rafael J. Wysocki
Quoted 3 lines
I have seen recent proposals that don't require changing the whole user-space. That might actually be used by other players.
Quoted 7 lines
Quoted 3 lines
Sure, an approach benefitting more platforms than just Android would be better, but saying that the kernel shouldn't address the Android's specific needs as a rule if no one else has those needs too is quite too far reaching to me.
Well, if the android people keep rejecting all sensible approaches to power savings except their suspend blocker mess, then I don't see why we should support their ill designed mess.
Well, I certainly would like the Android people to be more appreciative of our ideas if they expect reciprocity.
Quoted 4 lines
We should strive to provide an interface that can be used by all interested parties to conserve power; if Android really is the only possible user of the interface then I don't see any reason at all to merge it, they might as well keep it in their private tree.
There is a number of kernel users that depend on Android user space (phone vendors using Android on their hardware, but providing their own drivers), so I don't think we really can identify Android with Google in that respect.
Rafael
Quoted 5 lines · Rafael J. Wysocki
There is a number of kernel users that depend on Android user space (phone vendors using Android on their hardware, but providing their own drivers), so I don't think we really can identify Android with Google in that respect.
I don't see why we can't merge the platform code and drivers without suspend blockers. Google can patch them back in on their side if they want to.
Quoted 5 lines · Rafael J. Wysocki
There is a number of kernel users that depend on Android user space (phone vendors using Android on their hardware, but providing their own drivers), so I don't think we really can identify Android with Google in that respect.
I don't see why we can't merge the platform code and drivers without suspend blockers. Google can patch them back in on their side if they want to.
Quoted 5 lines · Peter Zijlstra
Quoted 4 lines · Rafael J. Wysocki
Quoted 3 lines
I have seen recent proposals that don't require changing the whole user-space. That might actually be used by other players.
Quoted 7 lines
Quoted 3 lines
Sure, an approach benefitting more platforms than just Android would be better, but saying that the kernel shouldn't address the Android's specific needs as a rule if no one else has those needs too is quite too far reaching to me.
Well, if the android people keep rejecting all sensible approaches to power savings except their suspend blocker mess, then I don't see why we should support their ill designed mess.
Well, I certainly would like the Android people to be more appreciative of our ideas if they expect reciprocity.
Quoted 4 lines
We should strive to provide an interface that can be used by all interested parties to conserve power; if Android really is the only possible user of the interface then I don't see any reason at all to merge it, they might as well keep it in their private tree.
There is a number of kernel users that depend on Android user space (phone vendors using Android on their hardware, but providing their own drivers), so I don't think we really can identify Android with Google in that respect.
Rafael
Quoted 7 lines · Rafael J. Wysocki
Quoted 3 lines
I have seen recent proposals that don't require changing the whole user-space. That might actually be used by other players.
Sure, an approach benefitting more platforms than just Android would be better, but saying that the kernel shouldn't address the Android's specific needs as a rule if no one else has those needs too is quite too far reaching to me.
Well, if the android people keep rejecting all sensible approaches to power savings except their suspend blocker mess, then I don't see why we should support their ill designed mess.
We should strive to provide an interface that can be used by all interested parties to conserve power; if Android really is the only possible user of the interface then I don't see any reason at all to merge it, they might as well keep it in their private tree.
Quoted 24 lines · Rafael J. Wysocki
Quoted 23 lines · Felipe Contreras
Quoted 8 lines · Florian Mickler
Quoted 2 lines · On Mon, 31 May 2010 22:12:19 +0200 Florian Mickler <[email protected]> wrote:
If I have a simple shell script then I don't wanna jump through hoops just to please your fragile kernel.
Also why should that code on one device kill my uptime and on the other machine (my wall-plugged desktop) work just well? That doesn't sound right.
Sounds perfectly right to me; one code runs perfectly fine on one machine, and on the other doesn't even compile. Well, sure, it wasn't written with that use-case in mind.
Quoted 5 lines
Clearly opportunistic suspend is a workaround for battery-driven devices and no general solution. But it is not specific to android. At least not inherently. It could be useful for any embedded or mobile device where you can clearly distinguish important functions from convenience functions.
Yes, it could, but why go for the hacky solution when we know how to achieve the ideal one?
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
I really can't understand the whole _fundamental_ opposition to this design choice.
Nobody is using it, except Android. Nobody will use it, except Android.
That's like saying "Android is not a legitimate user of the kernel". Is that you wanted to say?
Read the context: opportunistic suspend, which is considered a workaround, which requires new user-space API for suspend blockers, might be remotely considered for inclusion *if* it indeed solves a problem for battery-driven devices, which other parties also experience and could benefit from this solution.
The answer: no, it doesn't: only Android user-space will benefit from it.
Quoted 6 lines
Quoted 2 lines
I have seen recent proposals that don't require changing the whole user-space. That might actually be used by other players.
Sure, an approach benefitting more platforms than just Android would be better, but saying that the kernel shouldn't address the Android's specific needs as a rule if no one else has those needs too is quite too far reaching to me.
There are no Android specific needs, why should certain user-space ecosystem need certain API that somehow *nobody* else does? I think in this huge thread it has become obvious that people are reluctant to this idea... whatever problem Android user-space presents (I don't think there's any), it can be solved for "he rest of the world" too, and such generic solution is worth exploring.
Signature · 1 line
Felipe Contreras
Quoted 24 lines · Rafael J. Wysocki
Quoted 23 lines · Felipe Contreras
Quoted 8 lines · Florian Mickler
Quoted 2 lines · On Mon, 31 May 2010 22:12:19 +0200 Florian Mickler <[email protected]> wrote:
If I have a simple shell script then I don't wanna jump through hoops just to please your fragile kernel.
Also why should that code on one device kill my uptime and on the other machine (my wall-plugged desktop) work just well? That doesn't sound right.
Sounds perfectly right to me; one code runs perfectly fine on one machine, and on the other doesn't even compile. Well, sure, it wasn't written with that use-case in mind.
Quoted 5 lines
Clearly opportunistic suspend is a workaround for battery-driven devices and no general solution. But it is not specific to android. At least not inherently. It could be useful for any embedded or mobile device where you can clearly distinguish important functions from convenience functions.
Yes, it could, but why go for the hacky solution when we know how to achieve the ideal one?
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
I really can't understand the whole _fundamental_ opposition to this design choice.
Nobody is using it, except Android. Nobody will use it, except Android.
That's like saying "Android is not a legitimate user of the kernel". Is that you wanted to say?
Read the context: opportunistic suspend, which is considered a workaround, which requires new user-space API for suspend blockers, might be remotely considered for inclusion *if* it indeed solves a problem for battery-driven devices, which other parties also experience and could benefit from this solution.
The answer: no, it doesn't: only Android user-space will benefit from it.
Quoted 6 lines
Quoted 2 lines
I have seen recent proposals that don't require changing the whole user-space. That might actually be used by other players.
Sure, an approach benefitting more platforms than just Android would be better, but saying that the kernel shouldn't address the Android's specific needs as a rule if no one else has those needs too is quite too far reaching to me.
There are no Android specific needs, why should certain user-space ecosystem need certain API that somehow *nobody* else does? I think in this huge thread it has become obvious that people are reluctant to this idea... whatever problem Android user-space presents (I don't think there's any), it can be solved for "he rest of the world" too, and such generic solution is worth exploring.
Signature · 5 lines
Felipe Contreras _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 20 lines · Felipe Contreras
Quoted 8 lines · Florian Mickler
Quoted 2 lines · On Mon, 31 May 2010 22:12:19 +0200 Florian Mickler <[email protected]> wrote:
If I have a simple shell script then I don't wanna jump through hoops just to please your fragile kernel.
Also why should that code on one device kill my uptime and on the other machine (my wall-plugged desktop) work just well? That doesn't sound right.
Sounds perfectly right to me; one code runs perfectly fine on one machine, and on the other doesn't even compile. Well, sure, it wasn't written with that use-case in mind.
Quoted 5 lines
Clearly opportunistic suspend is a workaround for battery-driven devices and no general solution. But it is not specific to android. At least not inherently. It could be useful for any embedded or mobile device where you can clearly distinguish important functions from convenience functions.
Quoted 7 lines
Yes, it could, but why go for the hacky solution when we know how to achieve the ideal one?
Quoted 2 lines
I really can't understand the whole _fundamental_ opposition to this design choice.
Nobody is using it, except Android. Nobody will use it, except Android.
That's like saying "Android is not a legitimate user of the kernel". Is that you wanted to say?
Quoted 2 lines
I have seen recent proposals that don't require changing the whole user-space. That might actually be used by other players.
Sure, an approach benefitting more platforms than just Android would be better, but saying that the kernel shouldn't address the Android's specific needs as a rule if no one else has those needs too is quite too far reaching to me.
Rafael
Quoted 8 lines · Florian Mickler
Quoted 2 lines · On Mon, 31 May 2010 22:12:19 +0200 Florian Mickler <[email protected]> wrote:
If I have a simple shell script then I don't wanna jump through hoops just to please your fragile kernel.
Also why should that code on one device kill my uptime and on the other machine (my wall-plugged desktop) work just well? That doesn't sound right.
Sounds perfectly right to me; one code runs perfectly fine on one machine, and on the other doesn't even compile. Well, sure, it wasn't written with that use-case in mind.
Quoted 5 lines
Clearly opportunistic suspend is a workaround for battery-driven devices and no general solution. But it is not specific to android. At least not inherently. It could be useful for any embedded or mobile device where you can clearly distinguish important functions from convenience functions.
Yes, it could, but why go for the hacky solution when we know how to achieve the ideal one?
Quoted 2 lines
I really can't understand the whole _fundamental_ opposition to this design choice.
Nobody is using it, except Android. Nobody will use it, except Android.
I have seen recent proposals that don't require changing the whole user-space. That might actually be used by other players.
Signature · 1 line
Felipe Contreras
Hi, again!
My two mails were probably a bit pointless and not helping to find a solution.
There are notable and useful approaches mentioned by Peter to the mitigation problem. It's just that it's not the one and only way to think about this.
Just rants,
Flo
Hi, again!
My two mails were probably a bit pointless and not helping to find a solution.
There are notable and useful approaches mentioned by Peter to the mitigation problem. It's just that it's not the one and only way to think about this.
Just rants,
Flo
Quoted 12 lines · On Sat, 29 May 2010 20:12:14 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 10 lines · James Bottomley
Quoted 2 lines
Correct, I strongly oppose using suspend. Not running runnable tasks is not a sane solution.
Look, this is getting into the realms of a pointless semantic quibble. The problem is that untrusted tasks need to be forcibly suspended when they have no legitimate work to do and the user hasn't authorised them to continue even if the scheduler sees them as runnable. Whether that's achieved by suspending the entire system or forcibly idling the tasks (using blocking states or freezers or something) so the scheduler can suspend from idle is something to be discussed,
Quoted 6 lines
So what happens if you task is CPU bound and gets suspended and is holding a resource (lock, whatever) that is required by someone else that didn't get suspended?
That's the classic inversion problem, and is caused by not running runnable tasks.
The trick with the approach currently discussed (i.e. opportunistic suspend, if you missed it): We suspend the whole machine.
And I really think, this is the only way to do it. It is a big hammer, shure. But if you can pull it of...
Quoted 6 lines
Quoted 5 lines
but the net result is
that we have to stop a certain set of tasks in such a way that they can still receive certain external events ... semantically, this is equivalent to not running runnable tasks in my book.
Quoted 7 lines
Why would be care about external events? Clearly these apps are ill behaved, otherwise they would have listened to the environment telling them to idle.
Why would you try to let buggy apps work as intended instead of break them as hard as possible? Such policy promotes crappy code since people get away with it.
If I have a simple shell script then I don't wanna jump through hoops just to please your fragile kernel.
And before you judge code that does not behave to work with YOUR buggy kernel, i would think twice. This cuts both ways. Just because the problem is too hard for you, this does not excuse forcing crappy kernels on other people.
I think you have a point in that it is _in general_ not easily possible to solve. But for this case this is clearly a simple, to the point and working solution for android based phones.
"Der Wurm muss dem Fisch schmecken, nicht dem Angler."
Quoted 14 lines
Quoted 5 lines
(Perhaps this whole
thing is because the word runnable means different things ... I'm thinking a task that would consume power ... are you thinking in the scheduler R state?)Clearly I mean
TASK_RUNNABLE, if not that the scheduler doesn't care.Quoted 5 lines
Realistically, the main thing we need to do is stop timers posted against the task (which is likely polling in a main loop, that being the usual form of easy to write but power crazy app behaviour) from waking the task and bringing the system out of suspend (whether from idle or forced).
Quoted 4 lines
Sure, that same main loop will probably receive a message along the lines of, 'hey, screen is off, we ought to go sleep'. If after that it doesn't listen, and more serious messages don't get responded to, simply kill the thing.
I think this would be a possibility. And maybe even sane. But I also think this has nothing to do with suspend_blockers. They block suspend. You know?
Quoted 4 lines
Again, there is no reason what so ever to tolerate broken apps, it only promotes crappy apps.
This simple doesn't solve the problem.
Cheers,
Flo
Quoted 12 lines · Peter Zijlstra
Quoted 10 lines · James Bottomley
Quoted 2 lines
Correct, I strongly oppose using suspend. Not running runnable tasks is not a sane solution.
Look, this is getting into the realms of a pointless semantic quibble. The problem is that untrusted tasks need to be forcibly suspended when they have no legitimate work to do and the user hasn't authorised them to continue even if the scheduler sees them as runnable. Whether that's achieved by suspending the entire system or forcibly idling the tasks (using blocking states or freezers or something) so the scheduler can suspend from idle is something to be discussed,
Quoted 6 lines
So what happens if you task is CPU bound and gets suspended and is holding a resource (lock, whatever) that is required by someone else that didn't get suspended?
That's the classic inversion problem, and is caused by not running runnable tasks.
OK ... but if the options are running and S3 for the entire platform, then all tasks get suspended and this isn't a problem. This is why the current wakelock implementation on the android platform works flawlessly today.
Inversion only becomes a problem if tasks get individually idled, so you can see that, from the android point of view, we're creating a problem which their implementation doesn't have.
In this view, S3 suspend does look elegant: it solves the inversion problem by suspending everything, it controls rogue applications' power consumption and it gets certain hardware into a lower power state than is possible from suspend from idle.
The inelegance of the S3 suspend solution is the requirement to use these suspend blockers through kernel and user space to get the whole thing up again to respond to an event, which is an inelegance suspend from idle doesn't have.
Quoted 8 lines
Quoted 4 lines
but the net result is
that we have to stop a certain set of tasks in such a way that they can still receive certain external events ... semantically, this is equivalent to not running runnable tasks in my book.Why would be care about external events? Clearly these apps are ill behaved, otherwise they would have listened to the environment telling them to idle.
That's not a correct characterisation. Badly behaved apps from a power point of view can do useful things for the user. The object is to contain the badness while still getting useful stuff done.
Quoted 17 lines
Why would you try to let buggy apps work as intended instead of break them as hard as possible? Such policy promotes crappy code since people get away with it.
Quoted 4 lines
(Perhaps this whole
thing is because the word runnable means different things ... I'm thinking a task that would consume power ... are you thinking in the scheduler R state?)Clearly I mean
TASK_RUNNABLE, if not that the scheduler doesn't care.Quoted 5 lines
Realistically, the main thing we need to do is stop timers posted against the task (which is likely polling in a main loop, that being the usual form of easy to write but power crazy app behaviour) from waking the task and bringing the system out of suspend (whether from idle or forced).
Quoted 7 lines
Sure, that same main loop will probably receive a message along the lines of, 'hey, screen is off, we ought to go sleep'. If after that it doesn't listen, and more serious messages don't get responded to, simply kill the thing.
Again, there is no reason what so ever to tolerate broken apps, it only promotes crappy apps.
Actually, no, if this were a correct view, we wouldn't have the huge x86 hardware work around problem because we'd just be able to tell manufacturers of shoddy or badly standards compliant stuff where to stick it.
The great strength of the x86 commodity platform revolution was the fact that the hardware became cheap, plentiful and outside the ambit of a single walled garden manufacturer. It's great weakness is integration problems and shoddy hardware. We tolerate the weakness because the strength vastly outweighs it: and toleration to us in the kernel means driver work arounds ... it also means that if a device doesn't work with the kernel, we get blamed (rather than the manufacturer).
By the same token, the revolution in smart phones is driven in quite a large part by the provision of third party applications. This commodity app view is almost the direct software analogue of the commodity platform view that has been so successful in hardware; Therefore, fair play seems to demand that we don't draw a hard line for software applications that we wouldn't draw for hardware devices.
James
Quoted 12 lines · Peter Zijlstra
Quoted 10 lines · James Bottomley
Quoted 2 lines
Correct, I strongly oppose using suspend. Not running runnable tasks is not a sane solution.
Look, this is getting into the realms of a pointless semantic quibble. The problem is that untrusted tasks need to be forcibly suspended when they have no legitimate work to do and the user hasn't authorised them to continue even if the scheduler sees them as runnable. Whether that's achieved by suspending the entire system or forcibly idling the tasks (using blocking states or freezers or something) so the scheduler can suspend from idle is something to be discussed,
Quoted 6 lines
So what happens if you task is CPU bound and gets suspended and is holding a resource (lock, whatever) that is required by someone else that didn't get suspended?
That's the classic inversion problem, and is caused by not running runnable tasks.
OK ... but if the options are running and S3 for the entire platform, then all tasks get suspended and this isn't a problem. This is why the current wakelock implementation on the android platform works flawlessly today.
Inversion only becomes a problem if tasks get individually idled, so you can see that, from the android point of view, we're creating a problem which their implementation doesn't have.
In this view, S3 suspend does look elegant: it solves the inversion problem by suspending everything, it controls rogue applications' power consumption and it gets certain hardware into a lower power state than is possible from suspend from idle.
The inelegance of the S3 suspend solution is the requirement to use these suspend blockers through kernel and user space to get the whole thing up again to respond to an event, which is an inelegance suspend from idle doesn't have.
Quoted 8 lines
Quoted 4 lines
but the net result is
that we have to stop a certain set of tasks in such a way that they can still receive certain external events ... semantically, this is equivalent to not running runnable tasks in my book.Why would be care about external events? Clearly these apps are ill behaved, otherwise they would have listened to the environment telling them to idle.
That's not a correct characterisation. Badly behaved apps from a power point of view can do useful things for the user. The object is to contain the badness while still getting useful stuff done.
Quoted 17 lines
Why would you try to let buggy apps work as intended instead of break them as hard as possible? Such policy promotes crappy code since people get away with it.
Quoted 4 lines
(Perhaps this whole
thing is because the word runnable means different things ... I'm thinking a task that would consume power ... are you thinking in the scheduler R state?)Clearly I mean
TASK_RUNNABLE, if not that the scheduler doesn't care.Quoted 5 lines
Realistically, the main thing we need to do is stop timers posted against the task (which is likely polling in a main loop, that being the usual form of easy to write but power crazy app behaviour) from waking the task and bringing the system out of suspend (whether from idle or forced).
Quoted 7 lines
Sure, that same main loop will probably receive a message along the lines of, 'hey, screen is off, we ought to go sleep'. If after that it doesn't listen, and more serious messages don't get responded to, simply kill the thing.
Again, there is no reason what so ever to tolerate broken apps, it only promotes crappy apps.
Actually, no, if this were a correct view, we wouldn't have the huge x86 hardware work around problem because we'd just be able to tell manufacturers of shoddy or badly standards compliant stuff where to stick it.
The great strength of the x86 commodity platform revolution was the fact that the hardware became cheap, plentiful and outside the ambit of a single walled garden manufacturer. It's great weakness is integration problems and shoddy hardware. We tolerate the weakness because the strength vastly outweighs it: and toleration to us in the kernel means driver work arounds ... it also means that if a device doesn't work with the kernel, we get blamed (rather than the manufacturer).
By the same token, the revolution in smart phones is driven in quite a large part by the provision of third party applications. This commodity app view is almost the direct software analogue of the commodity platform view that has been so successful in hardware; Therefore, fair play seems to demand that we don't draw a hard line for software applications that we wouldn't draw for hardware devices.
James
Quoted 12 lines · Peter Zijlstra
Quoted 10 lines · James Bottomley
Quoted 2 lines
Correct, I strongly oppose using suspend. Not running runnable tasks is not a sane solution.
Look, this is getting into the realms of a pointless semantic quibble. The problem is that untrusted tasks need to be forcibly suspended when they have no legitimate work to do and the user hasn't authorised them to continue even if the scheduler sees them as runnable. Whether that's achieved by suspending the entire system or forcibly idling the tasks (using blocking states or freezers or something) so the scheduler can suspend from idle is something to be discussed,
Quoted 6 lines
So what happens if you task is CPU bound and gets suspended and is holding a resource (lock, whatever) that is required by someone else that didn't get suspended?
That's the classic inversion problem, and is caused by not running runnable tasks.
That, among other things, is why suspend uses the freezer which guarantees that nothing like this will happen.
Quoted 5 lines
Quoted 4 lines
but the net result is
that we have to stop a certain set of tasks in such a way that they can still receive certain external events ... semantically, this is equivalent to not running runnable tasks in my book.
Quoted 7 lines
Why would be care about external events? Clearly these apps are ill behaved, otherwise they would have listened to the environment telling them to idle.
Why would you try to let buggy apps work as intended instead of break them as hard as possible? Such policy promotes crappy code since people get away with it.
Yeah, and that's why Windows owns desktop market. ;-)
Quoted 13 lines
Quoted 4 lines
(Perhaps this whole
thing is because the word runnable means different things ... I'm thinking a task that would consume power ... are you thinking in the scheduler R state?)Clearly I mean
TASK_RUNNABLE, if not that the scheduler doesn't care.Quoted 5 lines
Realistically, the main thing we need to do is stop timers posted against the task (which is likely polling in a main loop, that being the usual form of easy to write but power crazy app behaviour) from waking the task and bringing the system out of suspend (whether from idle or forced).
Quoted 7 lines
Sure, that same main loop will probably receive a message along the lines of, 'hey, screen is off, we ought to go sleep'. If after that it doesn't listen, and more serious messages don't get responded to, simply kill the thing.
Again, there is no reason what so ever to tolerate broken apps, it only promotes crappy apps.
Do you realistically think that by hurting the _user_ you will make the _developer_ write better code? No, really.
If the user likes the app very much (or depends on it or whatever makes him use it), he will rather switch the platform to one that allows him to run that app without _visible_ problems than complain to the developer, because _the_ _user_ _doesn't_ _realize_ that the app is broken. From the user's perspective, the platform that has problems with the app is broken, because the app apparently runs without problems on concurrent platforms.
The whole "no reason to tolerate broken apps" midset is simply misguided IMO, because it's based on unrealistic assumptions. That's because in general users only need the platform for running apps they like (or need or whatever). If they can't run apps they like on a given platform, or it is too painful to them to run their apps on it, they will rather switch to another platform than stop using the apps.
Thanks,
Rafael
Quoted 2 lines · Rafael J. Wysocki
Do you realistically think that by hurting the _user_ you will make the _developer_ write better code? No, really.
As an application writer, if my users complain that their battery is being drained (as it happened), they stop using it, and other people see there are problems, so they stop using it, if people get angry about it they will vote it down.
New users will see it has low score; they will not install it. That's a network effect.
Having users is the quintessential reason people write code.
Quoted 6 lines
If the user likes the app very much (or depends on it or whatever makes him use it), he will rather switch the platform to one that allows him to run that app without _visible_ problems than complain to the developer, because _the_ _user_ _doesn't_ _realize_ that the app is broken. From the user's perspective, the platform that has problems with the app is broken, because the app apparently runs without problems on concurrent platforms.
Yeah, right. I don't think anybody has every bought an iPhone because of Tweetie. People care how the applications run on their phones, not how their phone's platform runs their favorite application, in fact, most probably it became their favorite application because it was running great on their phone, and they wouldn't expect it to run on phones with other platforms. Either applications run on S60, iPhone OS, Android, or Maemo, but not in a combination of those. And if their certain app that runs on multiple platforms, and the user actually knows that (probably a geek), then he knows he can't expect it to work exactly the same.
Quoted 6 lines
The whole "no reason to tolerate broken apps" midset is simply misguided IMO, because it's based on unrealistic assumptions. That's because in general users only need the platform for running apps they like (or need or whatever). If they can't run apps they like on a given platform, or it is too painful to them to run their apps on it, they will rather switch to another platform than stop using the apps.
You seriously think people switch high-end phones just to run their favorite apps? It's much cheaper to switch apps, and that's what users do.
Signature · 5 lines
Felipe Contreras _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 2 lines · Rafael J. Wysocki
Do you realistically think that by hurting the _user_ you will make the _developer_ write better code? No, really.
As an application writer, if my users complain that their battery is being drained (as it happened), they stop using it, and other people see there are problems, so they stop using it, if people get angry about it they will vote it down.
New users will see it has low score; they will not install it. That's a network effect.
Having users is the quintessential reason people write code.
Quoted 6 lines
If the user likes the app very much (or depends on it or whatever makes him use it), he will rather switch the platform to one that allows him to run that app without _visible_ problems than complain to the developer, because _the_ _user_ _doesn't_ _realize_ that the app is broken. From the user's perspective, the platform that has problems with the app is broken, because the app apparently runs without problems on concurrent platforms.
Yeah, right. I don't think anybody has every bought an iPhone because of Tweetie. People care how the applications run on their phones, not how their phone's platform runs their favorite application, in fact, most probably it became their favorite application because it was running great on their phone, and they wouldn't expect it to run on phones with other platforms. Either applications run on S60, iPhone OS, Android, or Maemo, but not in a combination of those. And if their certain app that runs on multiple platforms, and the user actually knows that (probably a geek), then he knows he can't expect it to work exactly the same.
Quoted 6 lines
The whole "no reason to tolerate broken apps" midset is simply misguided IMO, because it's based on unrealistic assumptions. That's because in general users only need the platform for running apps they like (or need or whatever). If they can't run apps they like on a given platform, or it is too painful to them to run their apps on it, they will rather switch to another platform than stop using the apps.
You seriously think people switch high-end phones just to run their favorite apps? It's much cheaper to switch apps, and that's what users do.
Signature · 5 lines
Felipe Contreras -- 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 · On Sat, 5 Jun 2010 20:16:33 +0300 Felipe Contreras…
Quoted 2 lines · Rafael J. Wysocki
Do you realistically think that by hurting the _user_ you will make the _developer_ write better code? No, really.
As an application writer, if my users complain that their battery is being drained (as it happened), they stop using it, and other people see there are problems, so they stop using it, if people get angry about it they will vote it down.
Quoted 5 lines
New users will see it has low score; they will not install it. That's a network effect.
Having users is the quintessential reason people write code.
That is nice. But how does it impact the problem that suspend blockers solve? And why do suspend blockers interfere with that?
Cheers,
Flo
Quoted 9 lines · Florian Mickler
Quoted 4 lines · On Sat, 5 Jun 2010 20:16:33 +0300 Felipe Contreras…
New users will see it has low score; they will not install it. That's a network effect.
Having users is the quintessential reason people write code.
That is nice. But how does it impact the problem that suspend blockers solve? And why do suspend blockers interfere with that?
It doesn't, I don't know why people keep bringing this argument, I just though it should not be left open as a valid one.
I should have mentioned that this is indeed irrelevant.
Signature · 1 line
Felipe Contreras
Quoted 9 lines · Florian Mickler
Quoted 4 lines · On Sat, 5 Jun 2010 20:16:33 +0300 Felipe Contreras…
New users will see it has low score; they will not install it. That's a network effect.
Having users is the quintessential reason people write code.
That is nice. But how does it impact the problem that suspend blockers solve? And why do suspend blockers interfere with that?
It doesn't, I don't know why people keep bringing this argument, I just though it should not be left open as a valid one.
I should have mentioned that this is indeed irrelevant.
Signature · 1 line
Felipe Contreras
Quoted 8 lines · On Sat, 5 Jun 2010 22:56:45 +0300 Felipe Contreras…
Quoted 7 lines · Florian Mickler
Quoted 4 lines · On Sat, 5 Jun 2010 20:16:33 +0300 Felipe Contreras…
New users will see it has low score; they will not install it. That's a network effect.
Having users is the quintessential reason people write code.
Quoted 8 lines
Quoted 2 lines
That is nice. But how does it impact the problem that suspend blockers solve? And why do suspend blockers interfere with that?
It doesn't, I don't know why people keep bringing this argument, I just though it should not be left open as a valid one.
I should have mentioned that this is indeed irrelevant.
Uh! I found out how this is relevant to the suspend blockers case. Because not having users means that the bugs don't get fixed. Whereas in the suspend blockers case the users can use the app and get the bugs fixed.
Cheers,
Flo
p.s.: I really wished you would focus more on solving the problem and not on dismissing it.
Quoted 8 lines · On Sat, 5 Jun 2010 22:56:45 +0300 Felipe Contreras…
Quoted 7 lines · Florian Mickler
Quoted 4 lines · On Sat, 5 Jun 2010 20:16:33 +0300 Felipe Contreras…
New users will see it has low score; they will not install it. That's a network effect.
Having users is the quintessential reason people write code.
Quoted 8 lines
Quoted 2 lines
That is nice. But how does it impact the problem that suspend blockers solve? And why do suspend blockers interfere with that?
It doesn't, I don't know why people keep bringing this argument, I just though it should not be left open as a valid one.
I should have mentioned that this is indeed irrelevant.
Uh! I found out how this is relevant to the suspend blockers case. Because not having users means that the bugs don't get fixed. Whereas in the suspend blockers case the users can use the app and get the bugs fixed.
Cheers,
Flo
p.s.: I really wished you would focus more on solving the problem and not on dismissing it.
Quoted 9 lines · On Sat, 5 Jun 2010 20:16:33 +0300 Felipe Contreras…
Quoted 2 lines · Rafael J. Wysocki
Do you realistically think that by hurting the _user_ you will make the _developer_ write better code? No, really.
As an application writer, if my users complain that their battery is being drained (as it happened), they stop using it, and other people see there are problems, so they stop using it, if people get angry about it they will vote it down.
Quoted 5 lines
New users will see it has low score; they will not install it. That's a network effect.
Having users is the quintessential reason people write code.
That is nice. But how does it impact the problem that suspend blockers solve? And why do suspend blockers interfere with that?
Cheers,
Flo
Quoted 12 lines · Peter Zijlstra
Quoted 10 lines · James Bottomley
Quoted 2 lines
Correct, I strongly oppose using suspend. Not running runnable tasks is not a sane solution.
Look, this is getting into the realms of a pointless semantic quibble. The problem is that untrusted tasks need to be forcibly suspended when they have no legitimate work to do and the user hasn't authorised them to continue even if the scheduler sees them as runnable. Whether that's achieved by suspending the entire system or forcibly idling the tasks (using blocking states or freezers or something) so the scheduler can suspend from idle is something to be discussed,
Quoted 6 lines
So what happens if you task is CPU bound and gets suspended and is holding a resource (lock, whatever) that is required by someone else that didn't get suspended?
That's the classic inversion problem, and is caused by not running runnable tasks.
That, among other things, is why suspend uses the freezer which guarantees that nothing like this will happen.
Quoted 5 lines
Quoted 4 lines
but the net result is
that we have to stop a certain set of tasks in such a way that they can still receive certain external events ... semantically, this is equivalent to not running runnable tasks in my book.
Quoted 7 lines
Why would be care about external events? Clearly these apps are ill behaved, otherwise they would have listened to the environment telling them to idle.
Why would you try to let buggy apps work as intended instead of break them as hard as possible? Such policy promotes crappy code since people get away with it.
Yeah, and that's why Windows owns desktop market. ;-)
Quoted 13 lines
Quoted 4 lines
(Perhaps this whole
thing is because the word runnable means different things ... I'm thinking a task that would consume power ... are you thinking in the scheduler R state?)Clearly I mean
TASK_RUNNABLE, if not that the scheduler doesn't care.Quoted 5 lines
Realistically, the main thing we need to do is stop timers posted against the task (which is likely polling in a main loop, that being the usual form of easy to write but power crazy app behaviour) from waking the task and bringing the system out of suspend (whether from idle or forced).
Quoted 7 lines
Sure, that same main loop will probably receive a message along the lines of, 'hey, screen is off, we ought to go sleep'. If after that it doesn't listen, and more serious messages don't get responded to, simply kill the thing.
Again, there is no reason what so ever to tolerate broken apps, it only promotes crappy apps.
Do you realistically think that by hurting the _user_ you will make the _developer_ write better code? No, really.
If the user likes the app very much (or depends on it or whatever makes him use it), he will rather switch the platform to one that allows him to run that app without _visible_ problems than complain to the developer, because _the_ _user_ _doesn't_ _realize_ that the app is broken. From the user's perspective, the platform that has problems with the app is broken, because the app apparently runs without problems on concurrent platforms.
The whole "no reason to tolerate broken apps" midset is simply misguided IMO, because it's based on unrealistic assumptions. That's because in general users only need the platform for running apps they like (or need or whatever). If they can't run apps they like on a given platform, or it is too painful to them to run their apps on it, they will rather switch to another platform than stop using the apps.
Thanks,
Rafael
Quoted 10 lines · James Bottomley
Quoted 2 lines
Correct, I strongly oppose using suspend. Not running runnable tasks is not a sane solution.
Look, this is getting into the realms of a pointless semantic quibble. The problem is that untrusted tasks need to be forcibly suspended when they have no legitimate work to do and the user hasn't authorised them to continue even if the scheduler sees them as runnable. Whether that's achieved by suspending the entire system or forcibly idling the tasks (using blocking states or freezers or something) so the scheduler can suspend from idle is something to be discussed,
So what happens if you task is CPU bound and gets suspended and is holding a resource (lock, whatever) that is required by someone else that didn't get suspended?
That's the classic inversion problem, and is caused by not running runnable tasks.
Quoted 4 lines
but the net result is
that we have to stop a certain set of tasks in such a way that they can still receive certain external events ... semantically, this is equivalent to not running runnable tasks in my book.
Why would be care about external events? Clearly these apps are ill behaved, otherwise they would have listened to the environment telling them to idle.
Why would you try to let buggy apps work as intended instead of break them as hard as possible? Such policy promotes crappy code since people get away with it.
Quoted 4 lines
(Perhaps this whole
thing is because the word runnable means different things ... I'm thinking a task that would consume power ... are you thinking in the scheduler R state?)
Clearly I mean TASK_RUNNABLE, if not that the scheduler doesn't care.
Quoted 5 lines
Realistically, the main thing we need to do is stop timers posted against the task (which is likely polling in a main loop, that being the usual form of easy to write but power crazy app behaviour) from waking the task and bringing the system out of suspend (whether from idle or forced).
Sure, that same main loop will probably receive a message along the lines of, 'hey, screen is off, we ought to go sleep'. If after that it doesn't listen, and more serious messages don't get responded to, simply kill the thing.
Again, there is no reason what so ever to tolerate broken apps, it only promotes crappy apps.
Quoted 10 lines · James Bottomley
Quoted 3 lines
If current hardware can't cope, too friggin bad, get better hardware.
But the truth is, all your OMAP phones really can deal with it.
That's rubbish and you know it. We do software workarounds for hardware problems all the time ... try doing a git grep -i errata in arch x86, or imagine a USB subsystem that only supported sane standards conforming
devices: that would have an almost zero intersect with the current USB device market.
Quoted 3 lines
The job of the kernel is to accommodate hardware as best it can ... sometimes it might not be able to, but most of the time it does a pretty good job.
Sure, and if x86 could wake from S3 on a keypress/mouse movement etc.. you could use S3 as idle state.. not sure people would love the wakeup-latency, but that's a QoS matter.
But if there simply are no suitable wakeup sources from an idle state (S3 really is nothing more than a hardware idle state) then it might not be suitable for transparent idle modes and no amount of software hackery will solve that.
So what I'm saying is, if your hardware can't generate the needed wakeup events, the auto-suspend stuff won't work either. If it can it can be implemented as a regular idle mode.
Quoted 6 lines
The facts are that C states and S states are different and are entered differently. For some omap hardware, the power consumption in the lowest C state (with all the ancillary power control) is the same as S3, that's fine, suspend from idle works as well as suspend to ram modulo bad apps. For quite a lot of MSM hardware, the lowest C state power consumption is quite a bit above S3.
Wth is MSM?
But really, why can't existing hardware get shipped with existing hacks, and for future hardware that does behave we have a proper solution?
Quoted 5 lines · James Bottomley
Quoted 3 lines
Not using suspend is exactly the point. As Alan has argued, propagating suspend blockers up into all regions of userspace will take much longer than fixing the hardware.
Strange, that's not what I heard as the possible solution.
Quoted 10 lines · James Bottomley
Quoted 3 lines
If current hardware can't cope, too friggin bad, get better hardware.
But the truth is, all your OMAP phones really can deal with it.
That's rubbish and you know it. We do software workarounds for hardware problems all the time ... try doing a git grep -i errata in arch x86, or imagine a USB subsystem that only supported sane standards conforming
devices: that would have an almost zero intersect with the current USB device market.
Quoted 3 lines
The job of the kernel is to accommodate hardware as best it can ... sometimes it might not be able to, but most of the time it does a pretty good job.
Sure, and if x86 could wake from S3 on a keypress/mouse movement etc.. you could use S3 as idle state.. not sure people would love the wakeup-latency, but that's a QoS matter.
But if there simply are no suitable wakeup sources from an idle state (S3 really is nothing more than a hardware idle state) then it might not be suitable for transparent idle modes and no amount of software hackery will solve that.
So what I'm saying is, if your hardware can't generate the needed wakeup events, the auto-suspend stuff won't work either. If it can it can be implemented as a regular idle mode.
Quoted 6 lines
The facts are that C states and S states are different and are entered differently. For some omap hardware, the power consumption in the lowest C state (with all the ancillary power control) is the same as S3, that's fine, suspend from idle works as well as suspend to ram modulo bad apps. For quite a lot of MSM hardware, the lowest C state power consumption is quite a bit above S3.
Wth is MSM?
But really, why can't existing hardware get shipped with existing hacks, and for future hardware that does behave we have a proper solution?
Quoted 5 lines · James Bottomley
Quoted 3 lines
Not using suspend is exactly the point. As Alan has argued, propagating suspend blockers up into all regions of userspace will take much longer than fixing the hardware.
Strange, that's not what I heard as the possible solution.
Quoted 6 lines · James Bottomley
The job of the kernel is to accommodate hardware as best it can ... sometimes it might not be able to, but most of the time it does a pretty good job.
The facts are that C states and S states are different and are entered differently.
That's an x86'ism which is going away. And that's really completely irrelevant for the mobile device space. Can we please stop trying to fix todays x86 based laptop problems? They are simply not fixable.
Quoted 9 lines
For some omap hardware, the power consumption in the
lowest C state (with all the ancillary power control) is the same as S3, that's fine, suspend from idle works as well as suspend to ram modulo bad apps. For quite a lot of MSM hardware, the lowest C state power consumption is quite a bit above S3. It's not acceptable to tell those people "tough, your battery runs out in 30 minutes because you bought the wrong hardware". We have to figure out how to get to S3 ... whether this is from idle or some other mechanism is again a discussion point, but not doing it is not an option.
If you'd have read the answers from Alan carefully, then you'd have noticed that even x86 hardware is getting to the point where OMAP is today. i.e. support of transparent suspend from idle. If that wouldn't happen then x86 would be simply unusable for mobile devices. It's that easy. And we really do _NOT_ care about the existing laptop hardware which does not provide that because it's a lost case. Not only due to the missing (or just disabled) wakeup sources, also due to the fact that you cannot do sensible power management by completely disabling clock and/or power of unused devices in the chipset. There is a damn good reason why the mobile space is _NOT_ x86 based at the moment.
Thanks,
tglx
Quoted 11 lines · Thomas Gleixner
Quoted 6 lines · James Bottomley
The job of the kernel is to accommodate hardware as best it can ... sometimes it might not be able to, but most of the time it does a pretty good job.
The facts are that C states and S states are different and are entered differently.
That's an x86'ism which is going away. And that's really completely irrelevant for the mobile device space. Can we please stop trying to fix todays x86 based laptop problems? They are simply not fixable.
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has the same problem may be true, but it's not entirely relevant.
Quoted 10 lines
Quoted 9 lines
For some omap hardware, the power consumption in the
lowest C state (with all the ancillary power control) is the same as S3, that's fine, suspend from idle works as well as suspend to ram modulo bad apps. For quite a lot of MSM hardware, the lowest C state power consumption is quite a bit above S3. It's not acceptable to tell those people "tough, your battery runs out in 30 minutes because you bought the wrong hardware". We have to figure out how to get to S3 ... whether this is from idle or some other mechanism is again a discussion point, but not doing it is not an option.
Quoted 10 lines
If you'd have read the answers from Alan carefully, then you'd have noticed that even x86 hardware is getting to the point where OMAP is today. i.e. support of transparent suspend from idle. If that wouldn't happen then x86 would be simply unusable for mobile devices. It's that easy. And we really do _NOT_ care about the existing laptop hardware which does not provide that because it's a lost case. Not only due to the missing (or just disabled) wakeup sources, also due to the fact that you cannot do sensible power management by completely disabling clock and/or power of unused devices in the chipset. There is a damn good reason why the mobile space is _NOT_ x86 based at the moment.
So not at all interested in x86 at the moment.
For MSM hardware, it looks possible to unify the S and C states by doing suspend to ram from idle but I'm not sure how much work that is.
James
Quoted 3 lines · James Bottomley
For MSM hardware, it looks possible to unify the S and C states by doing suspend to ram from idle but I'm not sure how much work that is.
On ARM, it's not rocket science and we have in tree support for this already (OMAP). I have done the same thing on a Samsung part as a prove of concept two years ago and it's really easy as the hardware is sane. Hint: It's designed for mobile devices :)
Thanks,
tglx
Quoted 3 lines · James Bottomley
For MSM hardware, it looks possible to unify the S and C states by doing suspend to ram from idle but I'm not sure how much work that is.
On ARM, it's not rocket science and we have in tree support for this already (OMAP). I have done the same thing on a Samsung part as a prove of concept two years ago and it's really easy as the hardware is sane. Hint: It's designed for mobile devices :)
Thanks,
tglx
Quoted 10 lines · Thomas Gleixner
Quoted 3 lines · James Bottomley
For MSM hardware, it looks possible to unify the S and C states by doing suspend to ram from idle but I'm not sure how much work that is.
On ARM, it's not rocket science and we have in tree support for this already (OMAP). I have done the same thing on a Samsung part as a prove of concept two years ago and it's really easy as the hardware is sane. Hint: It's designed for mobile devices :)
We already enter the same power state from idle and suspend on msm. In the absence of misbehaving apps, the difference in power consumption is entirely caused by periodic timers in the user-space framework _and_ kernel. It only takes a few timers triggering per second (I think 3 if they do no work) to double the average power consumption on the G1 if the radio is off. We originally added wakelocks because the hardware we had at the time had much lower power consumption in suspend then idle, but we still use suspend because it saves power.
Signature · 1 line
Arve Hjønnevåg
Quoted 12 lines · Arve Hjønnevåg
Quoted 10 lines · Thomas Gleixner
Quoted 3 lines · James Bottomley
For MSM hardware, it looks possible to unify the S and C states by doing suspend to ram from idle but I'm not sure how much work that is.
On ARM, it's not rocket science and we have in tree support for this already (OMAP). I have done the same thing on a Samsung part as a prove of concept two years ago and it's really easy as the hardware is sane. Hint: It's designed for mobile devices :)
Quoted 8 lines
We already enter the same power state from idle and suspend on msm. In the absence of misbehaving apps, the difference in power consumption is entirely caused by periodic timers in the user-space framework _and_ kernel. It only takes a few timers triggering per second (I think 3 if they do no work) to double the average power consumption on the G1 if the radio is off. We originally added wakelocks because the hardware we had at the time had much lower power consumption in suspend then idle, but we still use suspend because it saves power.
So how do you differentiate between timers which _should_ fire and those you do not care about ?
We have mechanisms in place to defer timers so the wakeups are minimized. If that's not enough we need to revisit.
Thanks,
tglx
2010/6/1 Thomas Gleixner <[email protected]>:
Quoted 24 lines · Arve Hjønnevåg
Quoted 13 lines · Thomas Gleixner
Quoted 10 lines · James Bottomley
Quoted 3 lines
For MSM hardware, it looks possible to unify the S and C states by doing suspend to ram from idle but I'm not sure how much work that is.
On ARM, it's not rocket science and we have in tree support for this already (OMAP). I have done the same thing on a Samsung part as a prove of concept two years ago and it's really easy as the hardware is sane. Hint: It's designed for mobile devices :)
Quoted 8 lines
We already enter the same power state from idle and suspend on msm. In the absence of misbehaving apps, the difference in power consumption is entirely caused by periodic timers in the user-space framework _and_ kernel. It only takes a few timers triggering per second (I think 3 if they do no work) to double the average power consumption on the G1 if the radio is off. We originally added wakelocks because the hardware we had at the time had much lower power consumption in suspend then idle, but we still use suspend because it saves power.
Quoted 3 lines
So how do you differentiate between timers which _should_ fire and those you do not care about ?
Only alarms are allowed to fire while suspended.
Quoted 3 lines
We have mechanisms in place to defer timers so the wakeups are minimized. If that's not enough we need to revisit.
Deferring the the timers forever without stopping the clock can cause problems. Our user space code has a lot of timeouts that will trigger an error if an app does not respond in time. Freezing everything and stopping the clock while suspended is a lot simpler than trying to stop individual timers and processes from running.
Signature · 1 line
Arve Hjønnevåg
Quoted 35 lines · Arve Hjønnevåg
2010/6/1 Thomas Gleixner <[email protected]>:
Quoted 24 lines · Arve Hjønnevåg
Quoted 13 lines · Thomas Gleixner
Quoted 10 lines · James Bottomley
Quoted 3 lines
For MSM hardware, it looks possible to unify the S and C states by doing suspend to ram from idle but I'm not sure how much work that is.
On ARM, it's not rocket science and we have in tree support for this already (OMAP). I have done the same thing on a Samsung part as a prove of concept two years ago and it's really easy as the hardware is sane. Hint: It's designed for mobile devices :)
Quoted 8 lines
We already enter the same power state from idle and suspend on msm. In the absence of misbehaving apps, the difference in power consumption is entirely caused by periodic timers in the user-space framework _and_ kernel. It only takes a few timers triggering per second (I think 3 if they do no work) to double the average power consumption on the G1 if the radio is off. We originally added wakelocks because the hardware we had at the time had much lower power consumption in suspend then idle, but we still use suspend because it saves power.
Quoted 3 lines
So how do you differentiate between timers which _should_ fire and those you do not care about ?
Only alarms are allowed to fire while suspended.
Quoted 3 lines
We have mechanisms in place to defer timers so the wakeups are minimized. If that's not enough we need to revisit.
Quoted 5 lines
Deferring the the timers forever without stopping the clock can cause problems. Our user space code has a lot of timeouts that will trigger an error if an app does not respond in time. Freezing everything and stopping the clock while suspended is a lot simpler than trying to stop individual timers and processes from running.
And resume updates timekeeping to account for the slept time. So the only way to get away with that is to sleep under a second or just ignoring the update by avoiding the access to rtc.
So how do you keep timekeeping happy ?
Thanks,
tglx
Quoted 35 lines · Arve Hjønnevåg
2010/6/1 Thomas Gleixner <[email protected]>:
Quoted 24 lines · Arve Hjønnevåg
Quoted 13 lines · Thomas Gleixner
Quoted 10 lines · James Bottomley
Quoted 3 lines
For MSM hardware, it looks possible to unify the S and C states by doing suspend to ram from idle but I'm not sure how much work that is.
On ARM, it's not rocket science and we have in tree support for this already (OMAP). I have done the same thing on a Samsung part as a prove of concept two years ago and it's really easy as the hardware is sane. Hint: It's designed for mobile devices :)
Quoted 8 lines
We already enter the same power state from idle and suspend on msm. In the absence of misbehaving apps, the difference in power consumption is entirely caused by periodic timers in the user-space framework _and_ kernel. It only takes a few timers triggering per second (I think 3 if they do no work) to double the average power consumption on the G1 if the radio is off. We originally added wakelocks because the hardware we had at the time had much lower power consumption in suspend then idle, but we still use suspend because it saves power.
Quoted 3 lines
So how do you differentiate between timers which _should_ fire and those you do not care about ?
Only alarms are allowed to fire while suspended.
Quoted 3 lines
We have mechanisms in place to defer timers so the wakeups are minimized. If that's not enough we need to revisit.
Quoted 5 lines
Deferring the the timers forever without stopping the clock can cause problems. Our user space code has a lot of timeouts that will trigger an error if an app does not respond in time. Freezing everything and stopping the clock while suspended is a lot simpler than trying to stop individual timers and processes from running.
And resume updates timekeeping to account for the slept time. So the only way to get away with that is to sleep under a second or just ignoring the update by avoiding the access to rtc.
So how do you keep timekeeping happy ?
Thanks,
tglx
2010/6/2 Thomas Gleixner <[email protected]>:
Quoted 36 lines · Arve Hjønnevåg
Quoted 35 lines
2010/6/1 Thomas Gleixner <[email protected]>:
Quoted 24 lines · Arve Hjønnevåg
Quoted 13 lines · Thomas Gleixner
Quoted 10 lines · James Bottomley
Quoted 3 lines
For MSM hardware, it looks possible to unify the S and C states by doing suspend to ram from idle but I'm not sure how much work that is.
On ARM, it's not rocket science and we have in tree support for this already (OMAP). I have done the same thing on a Samsung part as a prove of concept two years ago and it's really easy as the hardware is sane. Hint: It's designed for mobile devices :)
Quoted 8 lines
We already enter the same power state from idle and suspend on msm. In the absence of misbehaving apps, the difference in power consumption is entirely caused by periodic timers in the user-space framework _and_ kernel. It only takes a few timers triggering per second (I think 3 if they do no work) to double the average power consumption on the G1 if the radio is off. We originally added wakelocks because the hardware we had at the time had much lower power consumption in suspend then idle, but we still use suspend because it saves power.
Quoted 3 lines
So how do you differentiate between timers which _should_ fire and those you do not care about ?
Only alarms are allowed to fire while suspended.
Quoted 3 lines
We have mechanisms in place to defer timers so the wakeups are minimized. If that's not enough we need to revisit.
Quoted 7 lines
Quoted 5 lines
Deferring the the timers forever without stopping the clock can cause problems. Our user space code has a lot of timeouts that will trigger an error if an app does not respond in time. Freezing everything and stopping the clock while suspended is a lot simpler than trying to stop individual timers and processes from running.
And resume updates timekeeping to account for the slept time. So the
No, for the monotonic clock it does the opposite. The hardware clock is read on resume and the offset is set so the monotonic clock gets the same value as it had when suspend was called.
Quoted 5 lines
only way to get away with that is to sleep under a second or just ignoring the update by avoiding the access to rtc.
So how do you keep timekeeping happy ?
Signature · 1 line
Arve Hjønnevåg
Quoted 8 lines · Arve Hjønnevåg
2010/6/2 Thomas Gleixner <[email protected]>:
Quoted 7 lines · Arve Hjønnevåg
Quoted 5 lines
Deferring the the timers forever without stopping the clock can cause problems. Our user space code has a lot of timeouts that will trigger an error if an app does not respond in time. Freezing everything and stopping the clock while suspended is a lot simpler than trying to stop individual timers and processes from running.
Quoted 5 lines
Quoted 1 line
And resume updates timekeeping to account for the slept time. So the
No, for the monotonic clock it does the opposite. The hardware clock is read on resume and the offset is set so the monotonic clock gets the same value as it had when suspend was called.
Grr, yes. Misread the code. -ENOTENOUGHCOFFEE
Thanks,
tglx
Quoted 8 lines · Arve Hjønnevåg
2010/6/2 Thomas Gleixner <[email protected]>:
Quoted 7 lines · Arve Hjønnevåg
Quoted 5 lines
Deferring the the timers forever without stopping the clock can cause problems. Our user space code has a lot of timeouts that will trigger an error if an app does not respond in time. Freezing everything and stopping the clock while suspended is a lot simpler than trying to stop individual timers and processes from running.
Quoted 5 lines
Quoted 1 line
And resume updates timekeeping to account for the slept time. So the
No, for the monotonic clock it does the opposite. The hardware clock is read on resume and the offset is set so the monotonic clock gets the same value as it had when suspend was called.
Grr, yes. Misread the code. -ENOTENOUGHCOFFEE
Thanks,
tglx
2010/6/2 Thomas Gleixner <[email protected]>:
Quoted 36 lines · Arve Hjønnevåg
Quoted 35 lines
2010/6/1 Thomas Gleixner <[email protected]>:
Quoted 24 lines · Arve Hjønnevåg
Quoted 13 lines · Thomas Gleixner
Quoted 10 lines · James Bottomley
Quoted 3 lines
For MSM hardware, it looks possible to unify the S and C states by doing suspend to ram from idle but I'm not sure how much work that is.
On ARM, it's not rocket science and we have in tree support for this already (OMAP). I have done the same thing on a Samsung part as a prove of concept two years ago and it's really easy as the hardware is sane. Hint: It's designed for mobile devices :)
Quoted 8 lines
We already enter the same power state from idle and suspend on msm. In the absence of misbehaving apps, the difference in power consumption is entirely caused by periodic timers in the user-space framework _and_ kernel. It only takes a few timers triggering per second (I think 3 if they do no work) to double the average power consumption on the G1 if the radio is off. We originally added wakelocks because the hardware we had at the time had much lower power consumption in suspend then idle, but we still use suspend because it saves power.
Quoted 3 lines
So how do you differentiate between timers which _should_ fire and those you do not care about ?
Only alarms are allowed to fire while suspended.
Quoted 3 lines
We have mechanisms in place to defer timers so the wakeups are minimized. If that's not enough we need to revisit.
Quoted 7 lines
Quoted 5 lines
Deferring the the timers forever without stopping the clock can cause problems. Our user space code has a lot of timeouts that will trigger an error if an app does not respond in time. Freezing everything and stopping the clock while suspended is a lot simpler than trying to stop individual timers and processes from running.
And resume updates timekeeping to account for the slept time. So the
No, for the monotonic clock it does the opposite. The hardware clock is read on resume and the offset is set so the monotonic clock gets the same value as it had when suspend was called.
Quoted 5 lines
only way to get away with that is to sleep under a second or just ignoring the update by avoiding the access to rtc.
So how do you keep timekeeping happy ?
Signature · 1 line
Arve Hjønnevåg
2010/6/1 Thomas Gleixner <[email protected]>:
Quoted 24 lines · Arve Hjønnevåg
Quoted 13 lines · Thomas Gleixner
Quoted 10 lines · James Bottomley
Quoted 3 lines
For MSM hardware, it looks possible to unify the S and C states by doing suspend to ram from idle but I'm not sure how much work that is.
On ARM, it's not rocket science and we have in tree support for this already (OMAP). I have done the same thing on a Samsung part as a prove of concept two years ago and it's really easy as the hardware is sane. Hint: It's designed for mobile devices :)
Quoted 8 lines
We already enter the same power state from idle and suspend on msm. In the absence of misbehaving apps, the difference in power consumption is entirely caused by periodic timers in the user-space framework _and_ kernel. It only takes a few timers triggering per second (I think 3 if they do no work) to double the average power consumption on the G1 if the radio is off. We originally added wakelocks because the hardware we had at the time had much lower power consumption in suspend then idle, but we still use suspend because it saves power.
Quoted 3 lines
So how do you differentiate between timers which _should_ fire and those you do not care about ?
Only alarms are allowed to fire while suspended.
Quoted 3 lines
We have mechanisms in place to defer timers so the wakeups are minimized. If that's not enough we need to revisit.
Deferring the the timers forever without stopping the clock can cause problems. Our user space code has a lot of timeouts that will trigger an error if an app does not respond in time. Freezing everything and stopping the clock while suspended is a lot simpler than trying to stop individual timers and processes from running.
Signature · 1 line
Arve Hjønnevåg
Quoted 12 lines · Arve Hjønnevåg
Quoted 10 lines · Thomas Gleixner
Quoted 3 lines · James Bottomley
For MSM hardware, it looks possible to unify the S and C states by doing suspend to ram from idle but I'm not sure how much work that is.
On ARM, it's not rocket science and we have in tree support for this already (OMAP). I have done the same thing on a Samsung part as a prove of concept two years ago and it's really easy as the hardware is sane. Hint: It's designed for mobile devices :)
Quoted 8 lines
We already enter the same power state from idle and suspend on msm. In the absence of misbehaving apps, the difference in power consumption is entirely caused by periodic timers in the user-space framework _and_ kernel. It only takes a few timers triggering per second (I think 3 if they do no work) to double the average power consumption on the G1 if the radio is off. We originally added wakelocks because the hardware we had at the time had much lower power consumption in suspend then idle, but we still use suspend because it saves power.
So how do you differentiate between timers which _should_ fire and those you do not care about ?
We have mechanisms in place to defer timers so the wakeups are minimized. If that's not enough we need to revisit.
Thanks,
tglx
Quoted 10 lines · Thomas Gleixner
Quoted 3 lines · James Bottomley
For MSM hardware, it looks possible to unify the S and C states by doing suspend to ram from idle but I'm not sure how much work that is.
On ARM, it's not rocket science and we have in tree support for this already (OMAP). I have done the same thing on a Samsung part as a prove of concept two years ago and it's really easy as the hardware is sane. Hint: It's designed for mobile devices :)
We already enter the same power state from idle and suspend on msm. In the absence of misbehaving apps, the difference in power consumption is entirely caused by periodic timers in the user-space framework _and_ kernel. It only takes a few timers triggering per second (I think 3 if they do no work) to double the average power consumption on the G1 if the radio is off. We originally added wakelocks because the hardware we had at the time had much lower power consumption in suspend then idle, but we still use suspend because it saves power.
Signature · 1 line
Arve Hjønnevåg
Quoted 9 lines · James Bottomley
Quoted 8 lines · Thomas Gleixner
Quoted 6 lines · James Bottomley
The job of the kernel is to accommodate hardware as best it can ... sometimes it might not be able to, but most of the time it does a pretty good job.
The facts are that C states and S states are different and are entered differently.
Quoted 8 lines
Quoted 3 lines
That's an x86'ism which is going away. And that's really completely irrelevant for the mobile device space. Can we please stop trying to fix todays x86 based laptop problems? They are simply not fixable.
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state.
Those machines can go from idle into S2RAM just fine w/o touching the /sys/power/state S2RAM mechanism.
It's just a deeper "C" state, really.
The confusion is that S3 is considered to be a complete different mechanism - which is true for PC style x86 - but not relevant for hardware which is sane from the PM point of view.
Now some people think, that suspend blockers are a cure for the existing x86/ACPI/BIOS mess, which cannot go to S3 from idle, but that's simply not feasible.
Thanks,
tglx
Quoted 9 lines · James Bottomley
Quoted 8 lines · Thomas Gleixner
Quoted 6 lines · James Bottomley
The job of the kernel is to accommodate hardware as best it can ... sometimes it might not be able to, but most of the time it does a pretty good job.
The facts are that C states and S states are different and are entered differently.
Quoted 8 lines
Quoted 3 lines
That's an x86'ism which is going away. And that's really completely irrelevant for the mobile device space. Can we please stop trying to fix todays x86 based laptop problems? They are simply not fixable.
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state.
Those machines can go from idle into S2RAM just fine w/o touching the /sys/power/state S2RAM mechanism.
It's just a deeper "C" state, really.
The confusion is that S3 is considered to be a complete different mechanism - which is true for PC style x86 - but not relevant for hardware which is sane from the PM point of view.
Now some people think, that suspend blockers are a cure for the existing x86/ACPI/BIOS mess, which cannot go to S3 from idle, but that's simply not feasible.
Thanks,
tglx
Quoted 5 lines · James Bottomley
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has the same problem may be true, but it's not entirely relevant.
As long as you can set a wakeup timer, an S state is just a C state with side effects. The significant one is that entering an S state stops the process scheduler and any in-kernel timers. I don't think Google care at all about whether suspend is entered through an explicit transition or something hooked into cpuidle - the relevant issue is that they want to be able to express a set of constraints that lets them control whether or not the scheduler keeps on scheduling, and which doesn't let them lose wakeup events in the process.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 5 lines · James Bottomley
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has the same problem may be true, but it's not entirely relevant.
As long as you can set a wakeup timer, an S state is just a C state with side effects. The significant one is that entering an S state stops the process scheduler and any in-kernel timers. I don't think Google care at all about whether suspend is entered through an explicit transition or something hooked into cpuidle - the relevant issue is that they want to be able to express a set of constraints that lets them control whether or not the scheduler keeps on scheduling, and which doesn't let them lose wakeup events in the process.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 8 lines · Matthew Garrett
Quoted 5 lines · James Bottomley
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has the same problem may be true, but it's not entirely relevant.
Quoted 8 lines
As long as you can set a wakeup timer, an S state is just a C state with side effects. The significant one is that entering an S state stops the process scheduler and any in-kernel timers. I don't think Google care at all about whether suspend is entered through an explicit transition or something hooked into cpuidle - the relevant issue is that they want to be able to express a set of constraints that lets them control whether or not the scheduler keeps on scheduling, and which doesn't let them lose wakeup events in the process.
Exactly, so my understanding of where we currently are is:
1. pm_qos will be updated to be able to express the android suspend blockers as interactivity constraints (exact name TBD, but probably /dev/cpu_interactivity)
2. pm_qos will be updated to be callable from atomic context
3. pm_qos will be updated to export statistics initially closely matching what suspend blockers provides (simple update of the rw interface?)
After this is done, the current android suspend block patch becomes a re-expression in kernel space in terms of pm_qos, with the current userspace wakelocks being adapted by the android framework into pm_qos requirements expressed to /dev/cpu_interactivity (or whatever name is chosen). Then opportunistic suspend is either a small add-on kernel patch they have in their tree to suspend when the interactivity constraint goes to NONE, or it could be done entirely by a userspace process. Long term this could migrate to the freezer and suspend from idle approach as the various problem timers get fixed.
I think the big unresolved issue is the stats extension. For android, we need just a name written along with the value, so we have something to hang the stats off ... current pm_qos userspace users just write a value, so the name would be optional. From the kernel, we probably just need an additional API that takes a stats name or NULL if none (pm_qos_add_request_named()?). Then reading the stats could be done by implementing a fops read routine on the misc device.
Did I miss anything?
James
Quoted 8 lines · Matthew Garrett
Quoted 5 lines · James Bottomley
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has the same problem may be true, but it's not entirely relevant.
Quoted 8 lines
As long as you can set a wakeup timer, an S state is just a C state with side effects. The significant one is that entering an S state stops the process scheduler and any in-kernel timers. I don't think Google care at all about whether suspend is entered through an explicit transition or something hooked into cpuidle - the relevant issue is that they want to be able to express a set of constraints that lets them control whether or not the scheduler keeps on scheduling, and which doesn't let them lose wakeup events in the process.
Exactly, so my understanding of where we currently are is:
1. pm_qos will be updated to be able to express the android suspend blockers as interactivity constraints (exact name TBD, but probably /dev/cpu_interactivity)
2. pm_qos will be updated to be callable from atomic context
3. pm_qos will be updated to export statistics initially closely matching what suspend blockers provides (simple update of the rw interface?)
After this is done, the current android suspend block patch becomes a re-expression in kernel space in terms of pm_qos, with the current userspace wakelocks being adapted by the android framework into pm_qos requirements expressed to /dev/cpu_interactivity (or whatever name is chosen). Then opportunistic suspend is either a small add-on kernel patch they have in their tree to suspend when the interactivity constraint goes to NONE, or it could be done entirely by a userspace process. Long term this could migrate to the freezer and suspend from idle approach as the various problem timers get fixed.
I think the big unresolved issue is the stats extension. For android, we need just a name written along with the value, so we have something to hang the stats off ... current pm_qos userspace users just write a value, so the name would be optional. From the kernel, we probably just need an additional API that takes a stats name or NULL if none (pm_qos_add_request_named()?). Then reading the stats could be done by implementing a fops read routine on the misc device.
Did I miss anything?
James
Quoted 2 lines · James Bottomley
Quoted 2 lines
As long as you can set a wakeup timer, an S state is just a C state with side effects.
I've seen similar statements on this endless thread before; they're not quite true...
Quoted 3 lines
Quoted 3 lines
The significant one is that entering an
S state stops the process scheduler and
any in-kernel timers.
There's a structural difference too, related to peripheral device activity and power states.
Specifically, peripherals can be active in C states (erforming I/O, maybe with DMA etc) and
will in general not be in lowest power states
(PCI etc). Whereas entry to ACPI S-states involves calling the AML code to put those peripherals into lowest power modes ... ones they can't in general enter at run time. (An additional task of that bytecode is to activate any wakeup logic, which again is not generally functional in except in S-states).
The point being perhaps more that ACPI doesn't map well to the more power-efficient architectures (often built on ARM) ... hardware vendors provide all kinds of PM hooks, and Linux can choose between them so it's more power-miserly than if it tried to emulate an ACPI based platform.
I've seen some Linux systems which put DRAM into self-refresh during certain idle modes, for example, not just during suspend-to-RAM, if it's known that no DMA is active. (Why not save that power if it's safe?) Likewise, disable some oscillators and PLLs if they're not needed (the clock API allows that to be done regardless of "C-states" etc).
The notion of "suspend" gets introduced on such systems primarily to match the ACPI-ish models that exist ... rather than because they necessarily make good matches for the hardware. Which has left a
puzzle: how and why to use such "suspend" models?
Maybe that's underlying some of the pushback for the notion of automagic entry to "suspend" states.
- Dave
Quoted 2 lines · James Bottomley
Quoted 2 lines
As long as you can set a wakeup timer, an S state is just a C state with side effects.
I've seen similar statements on this endless thread before; they're not quite true...
Quoted 3 lines
Quoted 3 lines
The significant one is that entering an
S state stops the process scheduler and
any in-kernel timers.
There's a structural difference too, related to peripheral device activity and power states.
Specifically, peripherals can be active in C states (erforming I/O, maybe with DMA etc) and
will in general not be in lowest power states
(PCI etc). Whereas entry to ACPI S-states involves calling the AML code to put those peripherals into lowest power modes ... ones they can't in general enter at run time. (An additional task of that bytecode is to activate any wakeup logic, which again is not generally functional in except in S-states).
The point being perhaps more that ACPI doesn't map well to the more power-efficient architectures (often built on ARM) ... hardware vendors provide all kinds of PM hooks, and Linux can choose between them so it's more power-miserly than if it tried to emulate an ACPI based platform.
I've seen some Linux systems which put DRAM into self-refresh during certain idle modes, for example, not just during suspend-to-RAM, if it's known that no DMA is active. (Why not save that power if it's safe?) Likewise, disable some oscillators and PLLs if they're not needed (the clock API allows that to be done regardless of "C-states" etc).
The notion of "suspend" gets introduced on such systems primarily to match the ACPI-ish models that exist ... rather than because they necessarily make good matches for the hardware. Which has left a
puzzle: how and why to use such "suspend" models?
Maybe that's underlying some of the pushback for the notion of automagic entry to "suspend" states.
- Dave
Quoted 18 lines · James Bottomley
Quoted 8 lines · Matthew Garrett
Quoted 5 lines · James Bottomley
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has the same problem may be true, but it's not entirely relevant.
Quoted 8 lines
As long as you can set a wakeup timer, an S state is just a C state with side effects. The significant one is that entering an S state stops the process scheduler and any in-kernel timers. I don't think Google care at all about whether suspend is entered through an explicit transition or something hooked into cpuidle - the relevant issue is that they want to be able to express a set of constraints that lets them control whether or not the scheduler keeps on scheduling, and which doesn't let them lose wakeup events in the process.
Quoted 1 line
Exactly, so my understanding of where we currently are is:
Thanks for the recap.
Quoted 3 lines
1.
pm_qoswill be updated to be able to express the android suspend blockers as interactivity constraints (exact name TBD, but probably/dev/cpu_interactivity)
I think that's not been decided yet precisely enough. I saw a few ideas here and there in the thread, but which of them are we going to follow?
Quoted 15 lines
2.
pm_qoswill be updated to be callable from atomic context
3.pm_qoswill be updated to export statistics initially closely matching what suspend blockers provides (simple update of the rw interface?)After this is done, the current android suspend block patch becomes a re-expression in kernel space in terms of
pm_qos, with the current userspace wakelocks being adapted by the android framework intopm_qosrequirements expressed to/dev/cpu_interactivity(or whatever name is chosen). Then opportunistic suspend is either a small add-on kernel patch they have in their tree to suspend when the interactivity constraint goes to NONE, or it could be done entirely by a userspace process. Long term this could migrate to the freezer and suspend from idle approach as the various problem timers get fixed.
Quoted 7 lines
I think the big unresolved issue is the stats extension. For android, we need just a name written along with the value, so we have something to hang the stats off ... current
pm_qosuserspace users just write a value, so the name would be optional. From the kernel, we probably just need an additional API that takes a stats name or NULL if none (pm_qos_add_request_named()?). Then reading the stats could be done by implementing a fops read routine on the misc device.
Is the original idea of having that information in debugfs objectionable?
Rafael
Quoted 21 lines · Rafael J. Wysocki
Quoted 18 lines · James Bottomley
Quoted 8 lines · Matthew Garrett
Quoted 5 lines · James Bottomley
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has the same problem may be true, but it's not entirely relevant.
Quoted 8 lines
As long as you can set a wakeup timer, an S state is just a C state with side effects. The significant one is that entering an S state stops the process scheduler and any in-kernel timers. I don't think Google care at all about whether suspend is entered through an explicit transition or something hooked into cpuidle - the relevant issue is that they want to be able to express a set of constraints that lets them control whether or not the scheduler keeps on scheduling, and which doesn't let them lose wakeup events in the process.
Quoted 1 line
Exactly, so my understanding of where we currently are is:
Quoted 8 lines
Thanks for the recap.
Quoted 3 lines
1.
pm_qoswill be updated to be able to express the android suspend blockers as interactivity constraints (exact name TBD, but probably/dev/cpu_interactivity)I think that's not been decided yet precisely enough. I saw a few ideas here and there in the thread, but which of them are we going to follow?
Well, android only needs two states (block and don't block), so that gets translated as 2 s32 values (say 0 and INT_MAX). I've seen defines like QOS_INTERACTIVE and QOS_NONE (or QOS_DRECKLY or QOS_MANANA) to describe these, but if all we're arguing over is the define name, that's progress.
The other piece they need is the suspend block name, which comes with the stats API, and finally we need to decide what the actual constraint is called (which is how the dev node gets its name) ...
Quoted 23 lines
Quoted 15 lines
2.
pm_qoswill be updated to be callable from atomic context
3.pm_qoswill be updated to export statistics initially closely matching what suspend blockers provides (simple update of the rw interface?)After this is done, the current android suspend block patch becomes a re-expression in kernel space in terms of
pm_qos, with the current userspace wakelocks being adapted by the android framework intopm_qosrequirements expressed to/dev/cpu_interactivity(or whatever name is chosen). Then opportunistic suspend is either a small add-on kernel patch they have in their tree to suspend when the interactivity constraint goes to NONE, or it could be done entirely by a userspace process. Long term this could migrate to the freezer and suspend from idle approach as the various problem timers get fixed.Quoted 7 lines
I think the big unresolved issue is the stats extension. For android, we need just a name written along with the value, so we have something to hang the stats off ... current
pm_qosuserspace users just write a value, so the name would be optional. From the kernel, we probably just need an additional API that takes a stats name or NULL if none (pm_qos_add_request_named()?). Then reading the stats could be done by implementing a fops read routine on the misc device.
Quoted 1 line
Is the original idea of having that information in debugfs objectionable?
Well ... debugfs is usually used to get around the sysfs rules. In this case, pm_qos has a dev interface ... I don't specifically object to using debugfs, but I don't see any reason to forbid it from being a simple dev read interface either.
James
Quoted 21 lines · Rafael J. Wysocki
Quoted 18 lines · James Bottomley
Quoted 8 lines · Matthew Garrett
Quoted 5 lines · James Bottomley
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has the same problem may be true, but it's not entirely relevant.
Quoted 8 lines
As long as you can set a wakeup timer, an S state is just a C state with side effects. The significant one is that entering an S state stops the process scheduler and any in-kernel timers. I don't think Google care at all about whether suspend is entered through an explicit transition or something hooked into cpuidle - the relevant issue is that they want to be able to express a set of constraints that lets them control whether or not the scheduler keeps on scheduling, and which doesn't let them lose wakeup events in the process.
Quoted 1 line
Exactly, so my understanding of where we currently are is:
Quoted 8 lines
Thanks for the recap.
Quoted 3 lines
1.
pm_qoswill be updated to be able to express the android suspend blockers as interactivity constraints (exact name TBD, but probably/dev/cpu_interactivity)I think that's not been decided yet precisely enough. I saw a few ideas here and there in the thread, but which of them are we going to follow?
Well, android only needs two states (block and don't block), so that gets translated as 2 s32 values (say 0 and INT_MAX). I've seen defines like QOS_INTERACTIVE and QOS_NONE (or QOS_DRECKLY or QOS_MANANA) to describe these, but if all we're arguing over is the define name, that's progress.
The other piece they need is the suspend block name, which comes with the stats API, and finally we need to decide what the actual constraint is called (which is how the dev node gets its name) ...
Quoted 23 lines
Quoted 15 lines
2.
pm_qoswill be updated to be callable from atomic context
3.pm_qoswill be updated to export statistics initially closely matching what suspend blockers provides (simple update of the rw interface?)After this is done, the current android suspend block patch becomes a re-expression in kernel space in terms of
pm_qos, with the current userspace wakelocks being adapted by the android framework intopm_qosrequirements expressed to/dev/cpu_interactivity(or whatever name is chosen). Then opportunistic suspend is either a small add-on kernel patch they have in their tree to suspend when the interactivity constraint goes to NONE, or it could be done entirely by a userspace process. Long term this could migrate to the freezer and suspend from idle approach as the various problem timers get fixed.Quoted 7 lines
I think the big unresolved issue is the stats extension. For android, we need just a name written along with the value, so we have something to hang the stats off ... current
pm_qosuserspace users just write a value, so the name would be optional. From the kernel, we probably just need an additional API that takes a stats name or NULL if none (pm_qos_add_request_named()?). Then reading the stats could be done by implementing a fops read routine on the misc device.
Quoted 1 line
Is the original idea of having that information in debugfs objectionable?
Well ... debugfs is usually used to get around the sysfs rules. In this case, pm_qos has a dev interface ... I don't specifically object to using debugfs, but I don't see any reason to forbid it from being a simple dev read interface either.
James
Quoted 28 lines · James Bottomley
Quoted 27 lines · Rafael J. Wysocki
Quoted 18 lines · James Bottomley
Quoted 8 lines · Matthew Garrett
Quoted 5 lines · James Bottomley
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has the same problem may be true, but it's not entirely relevant.
Quoted 8 lines
As long as you can set a wakeup timer, an S state is just a C state with side effects. The significant one is that entering an S state stops the process scheduler and any in-kernel timers. I don't think Google care at all about whether suspend is entered through an explicit transition or something hooked into cpuidle - the relevant issue is that they want to be able to express a set of constraints that lets them control whether or not the scheduler keeps on scheduling, and which doesn't let them lose wakeup events in the process.
Quoted 1 line
Exactly, so my understanding of where we currently are is:
Thanks for the recap.
Quoted 3 lines
1.
pm_qoswill be updated to be able to express the android suspend blockers as interactivity constraints (exact name TBD, but probably/dev/cpu_interactivity)
Quoted 8 lines
Quoted 2 lines
I think that's not been decided yet precisely enough. I saw a few ideas here and there in the thread, but which of them are we going to follow?
Well, android only needs two states (block and don't block), so that gets translated as 2 s32 values (say 0 and
INT_MAX). I've seen defines likeQOS_INTERACTIVEandQOS_NONE(orQOS_DRECKLYorQOS_MANANA) to describe these, but if all we're arguing over is the define name, that's progress.
I think we need separate state constraints for suspend and idle low power modes. On the msm platform only a subset of the interrupts can wake up from the low power mode, so we block the use if the low power mode from idle while other interrupts are enabled. We do not block suspend however if those interrupts are not marked as wakeup interrupts. Most constraints that prevent suspend are not hardware specific and should not prevent entering low power modes from idle. In other words we may need to prevent low power idle modes while allowing suspend, and we may need to prevent suspend while allowing low power idle modes.
It would also be good to not have an implementation that gets slower and slower the more clients you have. With binary constraints this is trivial.
Quoted 9 lines
The other piece they need is the suspend block name, which comes with the stats API, and finally we need to decide what the actual constraint is called (which is how the dev node gets its name) ...
Quoted 4 lines
Quoted 4 lines
2.
pm_qoswill be updated to be callable from atomic context
3.pm_qoswill be updated to export statistics initially closely matching what suspend blockers provides (simple update of the rw interface?)
4. It would be useful to change pm_qos_add_request to not allocate anything so can add constraints from init functions that currently cannot fail.
Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
After this is done, the current android suspend block patch becomes a re-expression in kernel space in terms of
pm_qos, with the current userspace wakelocks being adapted by the android framework intopm_qosrequirements expressed to/dev/cpu_interactivity(or whatever name is chosen). Then opportunistic suspend is either a small add-on kernel patch they have in their tree to suspend when the interactivity constraint goes to NONE, or it could be done entirely by a userspace process. Long term this could migrate to the freezer and suspend from idle approach as the various problem timers get fixed.I think the big unresolved issue is the stats extension. For android, we need just a name written along with the value, so we have something to hang the stats off ... current
pm_qosuserspace users just write a value, so the name would be optional. From the kernel, we probably just need an additional API that takes a stats name or NULL if none (pm_qos_add_request_named()?). Then reading the stats could be done by implementing a fops read routine on the misc device.
Quoted 7 lines
Quoted 1 line
Is the original idea of having that information in debugfs objectionable?
Well ... debugfs is usually used to get around the sysfs rules. In this case,
pm_qoshas a dev interface ... I don't specifically object to using debugfs, but I don't see any reason to forbid it from being a simple dev read interface either.
We don't currently have a dev interface for stats so this is not an immediate requirement. The suspend blocker debugfs interface is just as good as the proc interface we have for wakelocks.
Signature · 1 line
Arve Hjønnevåg
Quoted 28 lines · James Bottomley
Quoted 27 lines · Rafael J. Wysocki
Quoted 18 lines · James Bottomley
Quoted 8 lines · Matthew Garrett
Quoted 5 lines · James Bottomley
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has the same problem may be true, but it's not entirely relevant.
Quoted 8 lines
As long as you can set a wakeup timer, an S state is just a C state with side effects. The significant one is that entering an S state stops the process scheduler and any in-kernel timers. I don't think Google care at all about whether suspend is entered through an explicit transition or something hooked into cpuidle - the relevant issue is that they want to be able to express a set of constraints that lets them control whether or not the scheduler keeps on scheduling, and which doesn't let them lose wakeup events in the process.
Quoted 1 line
Exactly, so my understanding of where we currently are is:
Thanks for the recap.
Quoted 3 lines
1.
pm_qoswill be updated to be able to express the android suspend blockers as interactivity constraints (exact name TBD, but probably/dev/cpu_interactivity)
Quoted 8 lines
Quoted 2 lines
I think that's not been decided yet precisely enough. I saw a few ideas here and there in the thread, but which of them are we going to follow?
Well, android only needs two states (block and don't block), so that gets translated as 2 s32 values (say 0 and
INT_MAX). I've seen defines likeQOS_INTERACTIVEandQOS_NONE(orQOS_DRECKLYorQOS_MANANA) to describe these, but if all we're arguing over is the define name, that's progress.
I think we need separate state constraints for suspend and idle low power modes. On the msm platform only a subset of the interrupts can wake up from the low power mode, so we block the use if the low power mode from idle while other interrupts are enabled. We do not block suspend however if those interrupts are not marked as wakeup interrupts. Most constraints that prevent suspend are not hardware specific and should not prevent entering low power modes from idle. In other words we may need to prevent low power idle modes while allowing suspend, and we may need to prevent suspend while allowing low power idle modes.
It would also be good to not have an implementation that gets slower and slower the more clients you have. With binary constraints this is trivial.
Quoted 9 lines
The other piece they need is the suspend block name, which comes with the stats API, and finally we need to decide what the actual constraint is called (which is how the dev node gets its name) ...
Quoted 4 lines
Quoted 4 lines
2.
pm_qoswill be updated to be callable from atomic context
3.pm_qoswill be updated to export statistics initially closely matching what suspend blockers provides (simple update of the rw interface?)
4. It would be useful to change pm_qos_add_request to not allocate anything so can add constraints from init functions that currently cannot fail.
Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
After this is done, the current android suspend block patch becomes a re-expression in kernel space in terms of
pm_qos, with the current userspace wakelocks being adapted by the android framework intopm_qosrequirements expressed to/dev/cpu_interactivity(or whatever name is chosen). Then opportunistic suspend is either a small add-on kernel patch they have in their tree to suspend when the interactivity constraint goes to NONE, or it could be done entirely by a userspace process. Long term this could migrate to the freezer and suspend from idle approach as the various problem timers get fixed.I think the big unresolved issue is the stats extension. For android, we need just a name written along with the value, so we have something to hang the stats off ... current
pm_qosuserspace users just write a value, so the name would be optional. From the kernel, we probably just need an additional API that takes a stats name or NULL if none (pm_qos_add_request_named()?). Then reading the stats could be done by implementing a fops read routine on the misc device.
Quoted 7 lines
Quoted 1 line
Is the original idea of having that information in debugfs objectionable?
Well ... debugfs is usually used to get around the sysfs rules. In this case,
pm_qoshas a dev interface ... I don't specifically object to using debugfs, but I don't see any reason to forbid it from being a simple dev read interface either.
We don't currently have a dev interface for stats so this is not an immediate requirement. The suspend blocker debugfs interface is just as good as the proc interface we have for wakelocks.
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 71 lines
-----Original Message-----
From: Arve Hjønnevåg [mailto:[email protected]]
Sent: Tuesday, June 01, 2010 6:11 PM
To: James Bottomley
Cc: Rafael J. Wysocki; Matthew Garrett; Thomas Gleixner; Peter Zijlstra; [email protected]; LKML; Florian Mickler; Linux PM; Linux OMAP Mailing List; [email protected]; Alan Cox; Alan Stern; Gross, Mark; Neil Brown
Subject: Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)Quoted 6 lines · James Bottomley
Quoted 5 lines · Rafael J. Wysocki
Quoted 4 lines · James Bottomley
Quoted 3 lines · Matthew Garrett
Quoted 1 line · James Bottomley
You're the one mentioning x86, not me. I already explained that
some
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
MSM hardware (the G1 for example) has lower power consumption in
S3
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
(which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has
the
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
same problem may be true, but it's not entirely relevant.
As long as you can set a wakeup timer, an S state is just a C state
with
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
side effects. The significant one is that entering an S state stops
the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
process scheduler and any in-kernel timers. I don't think Google
care at
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
all about whether suspend is entered through an explicit transition
or
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
something hooked into cpuidle - the relevant issue is that they want
to
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
be able to express a set of constraints that lets them control
whether
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
or not the scheduler keeps on scheduling, and which doesn't let them lose wakeup events in the process.
Exactly, so my understanding of where we currently are is:
Thanks for the recap.
Quoted 1 line
1.
pm_qoswill be updated to be able to express the androidsuspend
Quoted 11 lines
Quoted 5 lines
Quoted 2 lines
blockers as interactivity constraints (exact name TBD, but probably
/dev/cpu_interactivity)I think that's not been decided yet precisely enough. I saw a few ideas here and there in the thread, but which of them are we going to follow?
Well, android only needs two states (block and don't block), so that gets translated as 2 s32 values (say 0 and
INT_MAX). I've seen defines likeQOS_INTERACTIVEandQOS_NONE(orQOS_DRECKLYorQOS_MANANA) to describe these, but if all we're arguing over is the define name, that's progress.I think we need separate state constraints for suspend and idle low power modes. On the msm platform only a subset of the interrupts can wake up from the low power mode, so we block the use if the low power mode from idle while other interrupts are enabled. We do not block suspend however if those interrupts are not marked as wakeup interrupts. Most constraints that prevent suspend are not hardware specific and should not prevent entering low power modes from idle. In other words we may need to prevent low power idle modes while allowing suspend, and we may need to prevent suspend while allowing low power idle modes.
Quoted 3 lines
It would also be good to not have an implementation that gets slower and slower the more clients you have. With binary constraints this is trivial.
[mtg: ] agreed.
Quoted 9 lines
Quoted 9 lines
The other piece they need is the suspend block name, which comes with the stats API, and finally we need to decide what the actual constraint is called (which is how the dev node gets its name) ...
Quoted 3 lines
Quoted 3 lines
2.
pm_qoswill be updated to be callable from atomic context
3.pm_qoswill be updated to export statistics initially closely matching what suspend blockers provides (simple update of the
Quoted 6 lines
rw
Quoted 1 line
Quoted 1 line
Quoted 1 line
interface?)
4. It would be useful to change
pm_qos_add_requestto not allocate anything so can add constraints from init functions that currently cannot fail.
[mtg: ] I'm not sure how to do this but I agree it would be good. I guess we could have a block of pm_qos requests pre-allocated statically and re-use them. In practice there will not be more than a handful of requests ever. Dynamic allocation does seem like a bit of a waste.
Quoted 37 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
After this is done, the current android suspend block patch becomes a re-expression in kernel space in terms of
pm_qos, with the current userspace wakelocks being adapted by the android framework intopm_qosrequirements expressed to/dev/cpu_interactivity(or whatever name is chosen). Then opportunistic suspend is either a small add-on kernel patch they have in their tree to suspend when the interactivity constraint goes to NONE, or it could be done entirely by a userspace process. Long term this could migrate to the freezer and suspend from idle approach as the various problem timers get fixed.Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
I think the big unresolved issue is the stats extension. For android, we need just a name written along with the value, so we have something to hang the stats off ... current
pm_qosuserspace users just write a value, so the name would be optional. From the kernel, we probablyjust
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
need an additional API that takes a stats name or NULL if none (
pm_qos_add_request_named()?). Then reading the stats could be doneby
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
implementing a fops read routine on the misc device.
Is the original idea of having that information in debugfs
objectionable?
Quoted 6 lines
Well ... debugfs is usually used to get around the sysfs rules. In this case,
pm_qoshas a dev interface ... I don't specifically object to using debugfs, but I don't see any reason to forbid it from being a simple dev read interface either.We don't currently have a dev interface for stats so this is not an immediate requirement. The suspend blocker debugfs interface is just as good as the proc interface we have for wakelocks.
--
Arve Hjønnevåg
2010/6/1 Gross, Mark <[email protected]>:
...
Quoted 4 lines
Quoted 3 lines
4. It would be useful to change
pm_qos_add_requestto not allocate anything so can add constraints from init functions that currently cannot fail.[mtg: ] I'm not sure how to do this but I agree it would be good. I guess we could have a block of
pm_qosrequests pre-allocated statically and re-use them. In practice there will not be more than a handful of requests ever. Dynamic allocation does seem like a bit of a waste.
The calling code will have to store a pointer to your structure anyway, you may as well have them provide the whole structure.
Signature · 1 line
Arve Hjønnevåg
Quoted 15 lines
-----Original Message-----
From: Arve Hjønnevåg [mailto:[email protected]]
Sent: Tuesday, June 01, 2010 8:15 PM
To: Gross, Mark
Cc: James Bottomley; Rafael J. Wysocki; Matthew Garrett; Thomas Gleixner; Peter Zijlstra; [email protected]; LKML; Florian Mickler; Linux PM; Linux OMAP Mailing List; [email protected]; Alan Cox; Alan Stern; Neil Brown
Subject: Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)2010/6/1 Gross, Mark <[email protected]>:
...Quoted 3 lines
Quoted 3 lines
4. It would be useful to change
pm_qos_add_requestto not allocate anything so can add constraints from init functions that currently cannot fail.
Quoted 7 lines
Quoted 1 line
[mtg: ] I'm not sure how to do this but I agree it would be good. I
guess we could have a block of
pm_qosrequests pre-allocated statically and re-use them. In practice there will not be more than a handful of requests ever. Dynamic allocation does seem like a bit of a waste.The calling code will have to store a pointer to your structure anyway, you may as well have them provide the whole structure.
[mtg: ] duh! You are right. Make the caller's hold the structure. Its been a long day. That would be easy todo.
--gmross
Quoted 15 lines
-----Original Message-----
From: Arve Hjønnevåg [mailto:[email protected]]
Sent: Tuesday, June 01, 2010 8:15 PM
To: Gross, Mark
Cc: James Bottomley; Rafael J. Wysocki; Matthew Garrett; Thomas Gleixner; Peter Zijlstra; [email protected]; LKML; Florian Mickler; Linux PM; Linux OMAP Mailing List; [email protected]; Alan Cox; Alan Stern; Neil Brown
Subject: Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)2010/6/1 Gross, Mark <[email protected]>:
...Quoted 3 lines
Quoted 3 lines
4. It would be useful to change
pm_qos_add_requestto not allocate anything so can add constraints from init functions that currently cannot fail.
Quoted 7 lines
Quoted 1 line
[mtg: ] I'm not sure how to do this but I agree it would be good. I
guess we could have a block of
pm_qosrequests pre-allocated statically and re-use them. In practice there will not be more than a handful of requests ever. Dynamic allocation does seem like a bit of a waste.The calling code will have to store a pointer to your structure anyway, you may as well have them provide the whole structure.
[mtg: ] duh! You are right. Make the caller's hold the structure. Its been a long day. That would be easy todo.
--gmross
2010/6/1 Gross, Mark <[email protected]>:
...
Quoted 4 lines
Quoted 3 lines
4. It would be useful to change
pm_qos_add_requestto not allocate anything so can add constraints from init functions that currently cannot fail.[mtg: ] I'm not sure how to do this but I agree it would be good. I guess we could have a block of
pm_qosrequests pre-allocated statically and re-use them. In practice there will not be more than a handful of requests ever. Dynamic allocation does seem like a bit of a waste.
The calling code will have to store a pointer to your structure anyway, you may as well have them provide the whole structure.
Signature · 1 line
Arve Hjønnevåg
Quoted 71 lines
-----Original Message-----
From: Arve Hjønnevåg [mailto:[email protected]]
Sent: Tuesday, June 01, 2010 6:11 PM
To: James Bottomley
Cc: Rafael J. Wysocki; Matthew Garrett; Thomas Gleixner; Peter Zijlstra; [email protected]; LKML; Florian Mickler; Linux PM; Linux OMAP Mailing List; [email protected]; Alan Cox; Alan Stern; Gross, Mark; Neil Brown
Subject: Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)Quoted 6 lines · James Bottomley
Quoted 5 lines · Rafael J. Wysocki
Quoted 4 lines · James Bottomley
Quoted 3 lines · Matthew Garrett
Quoted 1 line · James Bottomley
You're the one mentioning x86, not me. I already explained that
some
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
MSM hardware (the G1 for example) has lower power consumption in
S3
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
(which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has
the
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
same problem may be true, but it's not entirely relevant.
As long as you can set a wakeup timer, an S state is just a C state
with
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
side effects. The significant one is that entering an S state stops
the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
process scheduler and any in-kernel timers. I don't think Google
care at
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
all about whether suspend is entered through an explicit transition
or
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
something hooked into cpuidle - the relevant issue is that they want
to
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
be able to express a set of constraints that lets them control
whether
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
or not the scheduler keeps on scheduling, and which doesn't let them lose wakeup events in the process.
Exactly, so my understanding of where we currently are is:
Thanks for the recap.
Quoted 1 line
1.
pm_qoswill be updated to be able to express the androidsuspend
Quoted 11 lines
Quoted 5 lines
Quoted 2 lines
blockers as interactivity constraints (exact name TBD, but probably
/dev/cpu_interactivity)I think that's not been decided yet precisely enough. I saw a few ideas here and there in the thread, but which of them are we going to follow?
Well, android only needs two states (block and don't block), so that gets translated as 2 s32 values (say 0 and
INT_MAX). I've seen defines likeQOS_INTERACTIVEandQOS_NONE(orQOS_DRECKLYorQOS_MANANA) to describe these, but if all we're arguing over is the define name, that's progress.I think we need separate state constraints for suspend and idle low power modes. On the msm platform only a subset of the interrupts can wake up from the low power mode, so we block the use if the low power mode from idle while other interrupts are enabled. We do not block suspend however if those interrupts are not marked as wakeup interrupts. Most constraints that prevent suspend are not hardware specific and should not prevent entering low power modes from idle. In other words we may need to prevent low power idle modes while allowing suspend, and we may need to prevent suspend while allowing low power idle modes.
Quoted 3 lines
It would also be good to not have an implementation that gets slower and slower the more clients you have. With binary constraints this is trivial.
[mtg: ] agreed.
Quoted 9 lines
Quoted 9 lines
The other piece they need is the suspend block name, which comes with the stats API, and finally we need to decide what the actual constraint is called (which is how the dev node gets its name) ...
Quoted 3 lines
Quoted 3 lines
2.
pm_qoswill be updated to be callable from atomic context
3.pm_qoswill be updated to export statistics initially closely matching what suspend blockers provides (simple update of the
Quoted 6 lines
rw
Quoted 1 line
Quoted 1 line
Quoted 1 line
interface?)
4. It would be useful to change
pm_qos_add_requestto not allocate anything so can add constraints from init functions that currently cannot fail.
[mtg: ] I'm not sure how to do this but I agree it would be good. I guess we could have a block of pm_qos requests pre-allocated statically and re-use them. In practice there will not be more than a handful of requests ever. Dynamic allocation does seem like a bit of a waste.
Quoted 37 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
After this is done, the current android suspend block patch becomes a re-expression in kernel space in terms of
pm_qos, with the current userspace wakelocks being adapted by the android framework intopm_qosrequirements expressed to/dev/cpu_interactivity(or whatever name is chosen). Then opportunistic suspend is either a small add-on kernel patch they have in their tree to suspend when the interactivity constraint goes to NONE, or it could be done entirely by a userspace process. Long term this could migrate to the freezer and suspend from idle approach as the various problem timers get fixed.Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
I think the big unresolved issue is the stats extension. For android, we need just a name written along with the value, so we have something to hang the stats off ... current
pm_qosuserspace users just write a value, so the name would be optional. From the kernel, we probablyjust
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
need an additional API that takes a stats name or NULL if none (
pm_qos_add_request_named()?). Then reading the stats could be doneby
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
implementing a fops read routine on the misc device.
Is the original idea of having that information in debugfs
objectionable?
Quoted 6 lines
Well ... debugfs is usually used to get around the sysfs rules. In this case,
pm_qoshas a dev interface ... I don't specifically object to using debugfs, but I don't see any reason to forbid it from being a simple dev read interface either.We don't currently have a dev interface for stats so this is not an immediate requirement. The suspend blocker debugfs interface is just as good as the proc interface we have for wakelocks.
--
Arve Hjønnevåg
Quoted 38 lines · Arve Hjønnevåg
Quoted 28 lines · James Bottomley
Quoted 27 lines · Rafael J. Wysocki
Quoted 18 lines · James Bottomley
Quoted 8 lines · Matthew Garrett
Quoted 5 lines · James Bottomley
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has the same problem may be true, but it's not entirely relevant.
Quoted 8 lines
As long as you can set a wakeup timer, an S state is just a C state with side effects. The significant one is that entering an S state stops the process scheduler and any in-kernel timers. I don't think Google care at all about whether suspend is entered through an explicit transition or something hooked into cpuidle - the relevant issue is that they want to be able to express a set of constraints that lets them control whether or not the scheduler keeps on scheduling, and which doesn't let them lose wakeup events in the process.
Quoted 1 line
Exactly, so my understanding of where we currently are is:
Thanks for the recap.
Quoted 3 lines
1.
pm_qoswill be updated to be able to express the android suspend blockers as interactivity constraints (exact name TBD, but probably/dev/cpu_interactivity)Quoted 8 lines
Quoted 2 lines
I think that's not been decided yet precisely enough. I saw a few ideas here and there in the thread, but which of them are we going to follow?
Well, android only needs two states (block and don't block), so that gets translated as 2 s32 values (say 0 and
INT_MAX). I've seen defines likeQOS_INTERACTIVEandQOS_NONE(orQOS_DRECKLYorQOS_MANANA) to describe these, but if all we're arguing over is the define name, that's progress.
Quoted 10 lines
I think we need separate state constraints for suspend and idle low power modes. On the msm platform only a subset of the interrupts can wake up from the low power mode, so we block the use if the low power mode from idle while other interrupts are enabled. We do not block suspend however if those interrupts are not marked as wakeup interrupts. Most constraints that prevent suspend are not hardware specific and should not prevent entering low power modes from idle. In other words we may need to prevent low power idle modes while allowing suspend, and we may need to prevent suspend while allowing low power idle modes.
Well, as I said, pm_qos is s32 ... it's easy to make the constraint ternary instead of binary.
Quoted 3 lines
It would also be good to not have an implementation that gets slower and slower the more clients you have. With binary constraints this is trivial.
Well, that's an implementation detail ... ordering the list or using a btree would significantly fix that. However, the most number of constraint users I've seen in android is around 60 ... that's not huge from a kernel linear list perspective, so is this really a concern? ... particularly when most uses don't necessarily change the constrain, so a list search isn't done.
Quoted 4 lines
Quoted 4 lines
The other piece they need is the suspend block name, which comes with the stats API, and finally we need to decide what the actual constraint is called (which is how the dev node gets its name) ...
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
2.
pm_qoswill be updated to be callable from atomic context
3.pm_qoswill be updated to export statistics initially closely matching what suspend blockers provides (simple update of the rw interface?)4. It would be useful to change
pm_qos_add_requestto not allocate anything so can add constraints from init functions that currently cannot fail.
Sure .. we do that for the delayed work queues, it's just an API which takes the structure as an argument leaving it the responsibility of the caller to free.
Quoted 26 lines
Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
After this is done, the current android suspend block patch becomes a re-expression in kernel space in terms of
pm_qos, with the current userspace wakelocks being adapted by the android framework intopm_qosrequirements expressed to/dev/cpu_interactivity(or whatever name is chosen). Then opportunistic suspend is either a small add-on kernel patch they have in their tree to suspend when the interactivity constraint goes to NONE, or it could be done entirely by a userspace process. Long term this could migrate to the freezer and suspend from idle approach as the various problem timers get fixed.I think the big unresolved issue is the stats extension. For android, we need just a name written along with the value, so we have something to hang the stats off ... current
pm_qosuserspace users just write a value, so the name would be optional. From the kernel, we probably just need an additional API that takes a stats name or NULL if none (pm_qos_add_request_named()?). Then reading the stats could be done by implementing a fops read routine on the misc device.Quoted 7 lines
Quoted 1 line
Is the original idea of having that information in debugfs objectionable?
Well ... debugfs is usually used to get around the sysfs rules. In this case,
pm_qoshas a dev interface ... I don't specifically object to using debugfs, but I don't see any reason to forbid it from being a simple dev read interface either.
Quoted 3 lines
We don't currently have a dev interface for stats so this is not an immediate requirement. The suspend blocker debugfs interface is just as good as the proc interface we have for wakelocks.
OK, great ... what actually exports the statistics is just an implementation detail.
James
2010/6/1 James Bottomley <[email protected]>:
Quoted 50 lines · Arve Hjønnevåg
Quoted 38 lines · James Bottomley
Quoted 28 lines · Rafael J. Wysocki
Quoted 27 lines · James Bottomley
Quoted 18 lines · Matthew Garrett
Quoted 8 lines · James Bottomley
Quoted 6 lines
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has the same problem may be true, but it's not entirely relevant.
Quoted 8 lines
As long as you can set a wakeup timer, an S state is just a C state with side effects. The significant one is that entering an S state stops the process scheduler and any in-kernel timers. I don't think Google care at all about whether suspend is entered through an explicit transition or something hooked into cpuidle - the relevant issue is that they want to be able to express a set of constraints that lets them control whether or not the scheduler keeps on scheduling, and which doesn't let them lose wakeup events in the process.
Quoted 1 line
Exactly, so my understanding of where we currently are is:
Thanks for the recap.
Quoted 3 lines
1.
pm_qoswill be updated to be able to express the android suspend blockers as interactivity constraints (exact name TBD, but probably/dev/cpu_interactivity)Quoted 8 lines
Quoted 2 lines
I think that's not been decided yet precisely enough. I saw a few ideas here and there in the thread, but which of them are we going to follow?
Well, android only needs two states (block and don't block), so that gets translated as 2 s32 values (say 0 and
INT_MAX). I've seen defines likeQOS_INTERACTIVEandQOS_NONE(orQOS_DRECKLYorQOS_MANANA) to describe these, but if all we're arguing over is the define name, that's progress.Quoted 10 lines
I think we need separate state constraints for suspend and idle low power modes. On the msm platform only a subset of the interrupts can wake up from the low power mode, so we block the use if the low power mode from idle while other interrupts are enabled. We do not block suspend however if those interrupts are not marked as wakeup interrupts. Most constraints that prevent suspend are not hardware specific and should not prevent entering low power modes from idle. In other words we may need to prevent low power idle modes while allowing suspend, and we may need to prevent suspend while allowing low power idle modes.
Quoted 2 lines
Well, as I said,
pm_qosis s32 ... it's easy to make the constraint ternary instead of binary.
No, they have to be two separate constraints, otherwise a constraint to block suspend would override a constraint to block a low power idle mode or the other way around.
Quoted 6 lines
Quoted 4 lines
It would also be good to not have an implementation that gets slower and slower the more clients you have. With binary constraints this is trivial.
Well, that's an implementation detail ... ordering the list or using a
True. I think we also need timeout support in the short term though which is also somewhat simpler to implement in an efficient way for binary constraints.
Quoted 5 lines
btree would significantly fix that. However, the most number of constraint users I've seen in android is around 60 ... that's not huge from a kernel linear list perspective, so is this really a concern? ... particularly when most uses don't necessarily change the constrain, so a list search isn't done.
The search is done every time any of them changes.
Quoted 56 lines
Quoted 5 lines
Quoted 5 lines
The other piece they need is the suspend block name, which comes with the stats API, and finally we need to decide what the actual constraint is called (which is how the dev node gets its name) ...
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
2.
pm_qoswill be updated to be callable from atomic context
3.pm_qoswill be updated to export statistics initially closely matching what suspend blockers provides (simple update of the rw interface?)4. It would be useful to change
pm_qos_add_requestto not allocate anything so can add constraints from init functions that currently cannot fail.Sure .. we do that for the delayed work queues, it's just an API which takes the structure as an argument leaving it the responsibility of the caller to free.
Quoted 26 lines
Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
After this is done, the current android suspend block patch becomes a re-expression in kernel space in terms of
pm_qos, with the current userspace wakelocks being adapted by the android framework intopm_qosrequirements expressed to/dev/cpu_interactivity(or whatever name is chosen). Then opportunistic suspend is either a small add-on kernel patch they have in their tree to suspend when the interactivity constraint goes to NONE, or it could be done entirely by a userspace process. Long term this could migrate to the freezer and suspend from idle approach as the various problem timers get fixed.I think the big unresolved issue is the stats extension. For android, we need just a name written along with the value, so we have something to hang the stats off ... current
pm_qosuserspace users just write a value, so the name would be optional. From the kernel, we probably just need an additional API that takes a stats name or NULL if none (pm_qos_add_request_named()?). Then reading the stats could be done by implementing a fops read routine on the misc device.Quoted 7 lines
Quoted 1 line
Is the original idea of having that information in debugfs objectionable?
Well ... debugfs is usually used to get around the sysfs rules. In this case,
pm_qoshas a dev interface ... I don't specifically object to using debugfs, but I don't see any reason to forbid it from being a simple dev read interface either.Quoted 3 lines
We don't currently have a dev interface for stats so this is not an immediate requirement. The suspend blocker debugfs interface is just as good as the proc interface we have for wakelocks.
OK, great ... what actually exports the statistics is just an implementation detail.
James
Signature · 1 line
Arve Hjønnevåg
Quoted 51 lines · Arve Hjønnevåg
2010/6/1 James Bottomley <[email protected]>:
Quoted 50 lines · Arve Hjønnevåg
Quoted 48 lines · James Bottomley
Quoted 28 lines · Rafael J. Wysocki
Quoted 27 lines · James Bottomley
Quoted 18 lines · Matthew Garrett
Quoted 8 lines · James Bottomley
Quoted 6 lines
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has the same problem may be true, but it's not entirely relevant.
Quoted 8 lines
As long as you can set a wakeup timer, an S state is just a C state with side effects. The significant one is that entering an S state stops the process scheduler and any in-kernel timers. I don't think Google care at all about whether suspend is entered through an explicit transition or something hooked into cpuidle - the relevant issue is that they want to be able to express a set of constraints that lets them control whether or not the scheduler keeps on scheduling, and which doesn't let them lose wakeup events in the process.
Quoted 1 line
Exactly, so my understanding of where we currently are is:
Thanks for the recap.
Quoted 3 lines
1.
pm_qoswill be updated to be able to express the android suspend blockers as interactivity constraints (exact name TBD, but probably/dev/cpu_interactivity)Quoted 8 lines
Quoted 2 lines
I think that's not been decided yet precisely enough. I saw a few ideas here and there in the thread, but which of them are we going to follow?
Well, android only needs two states (block and don't block), so that gets translated as 2 s32 values (say 0 and
INT_MAX). I've seen defines likeQOS_INTERACTIVEandQOS_NONE(orQOS_DRECKLYorQOS_MANANA) to describe these, but if all we're arguing over is the define name, that's progress.I think we need separate state constraints for suspend and idle low power modes. On the msm platform only a subset of the interrupts can wake up from the low power mode, so we block the use if the low power mode from idle while other interrupts are enabled. We do not block suspend however if those interrupts are not marked as wakeup interrupts. Most constraints that prevent suspend are not hardware specific and should not prevent entering low power modes from idle. In other words we may need to prevent low power idle modes while allowing suspend, and we may need to prevent suspend while allowing low power idle modes.
Quoted 6 lines
Quoted 2 lines
Well, as I said,
pm_qosis s32 ... it's easy to make the constraint ternary instead of binary.No, they have to be two separate constraints, otherwise a constraint to block suspend would override a constraint to block a low power idle mode or the other way around.
Depends. If you block the system from going into low power idle, does that mean you still want it to be fully suspended?
If yes, then we do have independent constraints. If not, they have a hierarchy:
* Fully Interactive (no low power idle or suspend)
* Partially Interactive (may go into low power idle but not suspend)
* None (may go into low power idle or suspend)
Which is expressable as a ternary constraint.
James
Quoted 11 lines · On Wed, 02 Jun 2010 10:05:11 -0500 James Bottomley <[email protected]>…
Quoted 3 lines · Arve Hjønnevåg
No, they have to be two separate constraints, otherwise a constraint to block suspend would override a constraint to block a low power idle mode or the other way around.
Depends. If you block the system from going into low power idle, does that mean you still want it to be fully suspended?
If yes, then we do have independent constraints. If not, they have a hierarchy:
Quoted 9 lines
* Fully Interactive (no low power idle or suspend)
* Partially Interactive (may go into low power idle but not suspend)
* None (may go into low power idle or suspend)Which is expressable as a ternary constraint.
James
But unblocking suspend at the moment is independent to getting idle. If you have the requirement to stay in the highest-idle level (i.e. best latency you can get) that does not (currently) mean, that you can not suspend.
To preserve that explicit fall-through while still having working run-time-powermanagement I think the qos-constraints need to be separated.
<disclaimer: just from what I read>
Provided you can reach the same power state from idle, current suspend could probably also be implemented by just the freezing part and a hint to the idle-loop to provide accelerated fall-through to lowest power. </disclaimer>
At that point, you could probably merge the constraints.
But the freezing part is also the hard part, isn't it? (I have no idea. Thomas seems to think about cgroups for that and doing smth about the timers.)
Cheers,
Flo
Quoted 11 lines · On Wed, 02 Jun 2010 10:05:11 -0500 James Bottomley <[email protected]>…
Quoted 3 lines · Arve Hjønnevåg
No, they have to be two separate constraints, otherwise a constraint to block suspend would override a constraint to block a low power idle mode or the other way around.
Depends. If you block the system from going into low power idle, does that mean you still want it to be fully suspended?
If yes, then we do have independent constraints. If not, they have a hierarchy:
Quoted 9 lines
* Fully Interactive (no low power idle or suspend)
* Partially Interactive (may go into low power idle but not suspend)
* None (may go into low power idle or suspend)Which is expressable as a ternary constraint.
James
But unblocking suspend at the moment is independent to getting idle. If you have the requirement to stay in the highest-idle level (i.e. best latency you can get) that does not (currently) mean, that you can not suspend.
To preserve that explicit fall-through while still having working run-time-powermanagement I think the qos-constraints need to be separated.
<disclaimer: just from what I read>
Provided you can reach the same power state from idle, current suspend could probably also be implemented by just the freezing part and a hint to the idle-loop to provide accelerated fall-through to lowest power. </disclaimer>
At that point, you could probably merge the constraints.
But the freezing part is also the hard part, isn't it? (I have no idea. Thomas seems to think about cgroups for that and doing smth about the timers.)
Cheers,
Flo
--
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 21 lines · Florian Mickler
Quoted 18 lines · On Wed, 02 Jun 2010 10:05:11 -0500 James Bottomley <[email protected]>…
Quoted 3 lines · Arve Hjønnevåg
No, they have to be two separate constraints, otherwise a constraint to block suspend would override a constraint to block a low power idle mode or the other way around.
Depends. If you block the system from going into low power idle, does that mean you still want it to be fully suspended?
If yes, then we do have independent constraints. If not, they have a hierarchy:
* Fully Interactive (no low power idle or suspend)
* Partially Interactive (may go into low power idle but not suspend)
* None (may go into low power idle or suspend)Which is expressable as a ternary constraint.
Quoted 7 lines
Quoted 2 lines
James
But unblocking suspend at the moment is independent to getting idle. If you have the requirement to stay in the highest-idle level (i.e. best latency you can get) that does not (currently) mean, that you can not suspend.
I don't understand that as a reason. If we looks at this a qos constraints, you're saying that the system may not drop into certain low power states because it might turn something off that's currently being used by a driver or a process. Suspend is certainly the lowest state of that because it turns everything off, why would it be legal to drop into that?
I also couldn't find this notion of separation of idleness power from suspend blocking in the original suspend block patch set ... if you can either tell me where it is, or give me an example of the separated use cases, I'd understand better.
Quoted 3 lines
To preserve that explicit fall-through while still having working run-time-powermanagement I think the qos-constraints need to be separated.
OK, as above, why? or better yet, just give an example.
Quoted 10 lines
<disclaimer: just from what I read>
Provided you can reach the same power state from idle, current suspend could probably also be implemented by just the freezing part and a hint to the idle-loop to provide accelerated fall-through to lowest power. </disclaimer>At that point, you could probably merge the constraints.
But the freezing part is also the hard part, isn't it? (I have no idea. Thomas seems to think about cgroups for that and doing smth about the timers.)
Um, well, as I said, I think using suspend from idle and freezer is longer term. I think if we express the constraints as qos android can then use them to gate when to enter S3 .. which is functionally equivalent to suspend blockers. And the vanilla kernel can use them to gate power states for the drivers in suspend from idle.
James
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 21 lines · Florian Mickler
Quoted 18 lines · On Wed, 02 Jun 2010 10:05:11 -0500 James Bottomley <[email protected]>…
Quoted 3 lines · Arve Hjønnevåg
No, they have to be two separate constraints, otherwise a constraint to block suspend would override a constraint to block a low power idle mode or the other way around.
Depends. If you block the system from going into low power idle, does that mean you still want it to be fully suspended?
If yes, then we do have independent constraints. If not, they have a hierarchy:
* Fully Interactive (no low power idle or suspend)
* Partially Interactive (may go into low power idle but not suspend)
* None (may go into low power idle or suspend)Which is expressable as a ternary constraint.
Quoted 7 lines
Quoted 2 lines
James
But unblocking suspend at the moment is independent to getting idle. If you have the requirement to stay in the highest-idle level (i.e. best latency you can get) that does not (currently) mean, that you can not suspend.
I don't understand that as a reason. If we looks at this a qos constraints, you're saying that the system may not drop into certain low power states because it might turn something off that's currently being used by a driver or a process. Suspend is certainly the lowest state of that because it turns everything off, why would it be legal to drop into that?
I also couldn't find this notion of separation of idleness power from suspend blocking in the original suspend block patch set ... if you can either tell me where it is, or give me an example of the separated use cases, I'd understand better.
Quoted 3 lines
To preserve that explicit fall-through while still having working run-time-powermanagement I think the qos-constraints need to be separated.
OK, as above, why? or better yet, just give an example.
Quoted 10 lines
<disclaimer: just from what I read>
Provided you can reach the same power state from idle, current suspend could probably also be implemented by just the freezing part and a hint to the idle-loop to provide accelerated fall-through to lowest power. </disclaimer>At that point, you could probably merge the constraints.
But the freezing part is also the hard part, isn't it? (I have no idea. Thomas seems to think about cgroups for that and doing smth about the timers.)
Um, well, as I said, I think using suspend from idle and freezer is longer term. I think if we express the constraints as qos android can then use them to gate when to enter S3 .. which is functionally equivalent to suspend blockers. And the vanilla kernel can use them to gate power states for the drivers in suspend from idle.
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 30 lines · James Bottomley
Quoted 21 lines · Florian Mickler
Quoted 18 lines · On Wed, 02 Jun 2010 10:05:11 -0500 James Bottomley <[email protected]>…
Quoted 3 lines · Arve Hjønnevåg
No, they have to be two separate constraints, otherwise a constraint to block suspend would override a constraint to block a low power idle mode or the other way around.
Depends. If you block the system from going into low power idle, does that mean you still want it to be fully suspended?
If yes, then we do have independent constraints. If not, they have a hierarchy:
* Fully Interactive (no low power idle or suspend)
* Partially Interactive (may go into low power idle but not suspend)
* None (may go into low power idle or suspend)Which is expressable as a ternary constraint.
Quoted 7 lines
Quoted 2 lines
James
But unblocking suspend at the moment is independent to getting idle. If you have the requirement to stay in the highest-idle level (i.e. best latency you can get) that does not (currently) mean, that you can not suspend.
Quoted 6 lines
I don't understand that as a reason. If we looks at this a qos constraints, you're saying that the system may not drop into certain low power states because it might turn something off that's currently being used by a driver or a process. Suspend is certainly the lowest state of that because it turns everything off, why would it be legal to drop into that?
Because the driver gets called on suspend which gives it a change to stop using it.
Quoted 6 lines
I also couldn't find this notion of separation of idleness power from suspend blocking in the original suspend block patch set ... if you can either tell me where it is, or give me an example of the separated use cases, I'd understand better.
The suspend block patchset only deals with suspend, not low power idle modes. The original wakelock patchset had two wakelock types, idle and suspend.
Quoted 6 lines
Quoted 3 lines
To preserve that explicit fall-through while still having working run-time-powermanagement I think the qos-constraints need to be separated.
OK, as above, why? or better yet, just give an example.
The i2c bus on the Nexus One is used by the other core to turn off the power you our core when we enter the lowest power mode. This means that we cannot enter that low power mode while the i2c bus is active, so we block low power idle modes. At some point we also tries to block suspend in this case, but this caused a lot of failed suspend attempts since the frequency scaling code would try to ramp up while freezing processes which in turn aborted the process freezing attempts.
Quoted 21 lines
Quoted 10 lines
<disclaimer: just from what I read>
Provided you can reach the same power state from idle, current suspend could probably also be implemented by just the freezing part and a hint to the idle-loop to provide accelerated fall-through to lowest power. </disclaimer>At that point, you could probably merge the constraints.
But the freezing part is also the hard part, isn't it? (I have no idea. Thomas seems to think about cgroups for that and doing smth about the timers.)
Um, well, as I said, I think using suspend from idle and freezer is longer term. I think if we express the constraints as qos android can then use them to gate when to enter S3 .. which is functionally equivalent to suspend blockers. And the vanilla kernel can use them to gate power states for the drivers in suspend from idle.
James
Signature · 1 line
Arve Hjønnevåg
Quoted 48 lines · Arve Hjønnevåg
Quoted 30 lines · James Bottomley
Quoted 21 lines · Florian Mickler
Quoted 18 lines · On Wed, 02 Jun 2010 10:05:11 -0500 James Bottomley <[email protected]>…
Quoted 3 lines · Arve Hjønnevåg
No, they have to be two separate constraints, otherwise a constraint to block suspend would override a constraint to block a low power idle mode or the other way around.
Depends. If you block the system from going into low power idle, does that mean you still want it to be fully suspended?
If yes, then we do have independent constraints. If not, they have a hierarchy:
* Fully Interactive (no low power idle or suspend)
* Partially Interactive (may go into low power idle but not suspend)
* None (may go into low power idle or suspend)Which is expressable as a ternary constraint.
Quoted 7 lines
Quoted 2 lines
James
But unblocking suspend at the moment is independent to getting idle. If you have the requirement to stay in the highest-idle level (i.e. best latency you can get) that does not (currently) mean, that you can not suspend.
Quoted 6 lines
I don't understand that as a reason. If we looks at this a qos constraints, you're saying that the system may not drop into certain low power states because it might turn something off that's currently being used by a driver or a process. Suspend is certainly the lowest state of that because it turns everything off, why would it be legal to drop into that?
Because the driver gets called on suspend which gives it a change to stop using it.
Quoted 6 lines
I also couldn't find this notion of separation of idleness power from suspend blocking in the original suspend block patch set ... if you can either tell me where it is, or give me an example of the separated use cases, I'd understand better.
Quoted 3 lines
The suspend block patchset only deals with suspend, not low power idle modes. The original wakelock patchset had two wakelock types, idle and suspend.
OK, so that explains why I didn't see it ...
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
To preserve that explicit fall-through while still having working run-time-powermanagement I think the qos-constraints need to be separated.
OK, as above, why? or better yet, just give an example.
Quoted 7 lines
The i2c bus on the Nexus One is used by the other core to turn off the power you our core when we enter the lowest power mode. This means that we cannot enter that low power mode while the i2c bus is active, so we block low power idle modes. At some point we also tries to block suspend in this case, but this caused a lot of failed suspend attempts since the frequency scaling code would try to ramp up while freezing processes which in turn aborted the process freezing attempts.
OK, so this is a device specific power constraint state. I suppose it makes sense to have a bunch of those, because the device isn't necessarily going to know what idle power mode it can't go into, so the cpu govenor should sort it out rather than have the device specify a minimum state.
James
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 48 lines · Arve Hjønnevåg
Quoted 30 lines · James Bottomley
Quoted 21 lines · Florian Mickler
Quoted 18 lines · On Wed, 02 Jun 2010 10:05:11 -0500 James Bottomley <[email protected]>…
Quoted 3 lines · Arve Hjønnevåg
No, they have to be two separate constraints, otherwise a constraint to block suspend would override a constraint to block a low power idle mode or the other way around.
Depends. If you block the system from going into low power idle, does that mean you still want it to be fully suspended?
If yes, then we do have independent constraints. If not, they have a hierarchy:
* Fully Interactive (no low power idle or suspend)
* Partially Interactive (may go into low power idle but not suspend)
* None (may go into low power idle or suspend)Which is expressable as a ternary constraint.
Quoted 7 lines
Quoted 2 lines
James
But unblocking suspend at the moment is independent to getting idle. If you have the requirement to stay in the highest-idle level (i.e. best latency you can get) that does not (currently) mean, that you can not suspend.
Quoted 6 lines
I don't understand that as a reason. If we looks at this a qos constraints, you're saying that the system may not drop into certain low power states because it might turn something off that's currently being used by a driver or a process. Suspend is certainly the lowest state of that because it turns everything off, why would it be legal to drop into that?
Because the driver gets called on suspend which gives it a change to stop using it.
Quoted 6 lines
I also couldn't find this notion of separation of idleness power from suspend blocking in the original suspend block patch set ... if you can either tell me where it is, or give me an example of the separated use cases, I'd understand better.
Quoted 3 lines
The suspend block patchset only deals with suspend, not low power idle modes. The original wakelock patchset had two wakelock types, idle and suspend.
OK, so that explains why I didn't see it ...
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
To preserve that explicit fall-through while still having working run-time-powermanagement I think the qos-constraints need to be separated.
OK, as above, why? or better yet, just give an example.
Quoted 7 lines
The i2c bus on the Nexus One is used by the other core to turn off the power you our core when we enter the lowest power mode. This means that we cannot enter that low power mode while the i2c bus is active, so we block low power idle modes. At some point we also tries to block suspend in this case, but this caused a lot of failed suspend attempts since the frequency scaling code would try to ramp up while freezing processes which in turn aborted the process freezing attempts.
OK, so this is a device specific power constraint state. I suppose it makes sense to have a bunch of those, because the device isn't necessarily going to know what idle power mode it can't go into, so the cpu govenor should sort it out rather than have the device specify a minimum state.
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 30 lines · James Bottomley
Quoted 21 lines · Florian Mickler
Quoted 18 lines · On Wed, 02 Jun 2010 10:05:11 -0500 James Bottomley <[email protected]>…
Quoted 3 lines · Arve Hjønnevåg
No, they have to be two separate constraints, otherwise a constraint to block suspend would override a constraint to block a low power idle mode or the other way around.
Depends. If you block the system from going into low power idle, does that mean you still want it to be fully suspended?
If yes, then we do have independent constraints. If not, they have a hierarchy:
* Fully Interactive (no low power idle or suspend)
* Partially Interactive (may go into low power idle but not suspend)
* None (may go into low power idle or suspend)Which is expressable as a ternary constraint.
Quoted 7 lines
Quoted 2 lines
James
But unblocking suspend at the moment is independent to getting idle. If you have the requirement to stay in the highest-idle level (i.e. best latency you can get) that does not (currently) mean, that you can not suspend.
Quoted 6 lines
I don't understand that as a reason. If we looks at this a qos constraints, you're saying that the system may not drop into certain low power states because it might turn something off that's currently being used by a driver or a process. Suspend is certainly the lowest state of that because it turns everything off, why would it be legal to drop into that?
Because the driver gets called on suspend which gives it a change to stop using it.
Quoted 6 lines
I also couldn't find this notion of separation of idleness power from suspend blocking in the original suspend block patch set ... if you can either tell me where it is, or give me an example of the separated use cases, I'd understand better.
The suspend block patchset only deals with suspend, not low power idle modes. The original wakelock patchset had two wakelock types, idle and suspend.
Quoted 6 lines
Quoted 3 lines
To preserve that explicit fall-through while still having working run-time-powermanagement I think the qos-constraints need to be separated.
OK, as above, why? or better yet, just give an example.
The i2c bus on the Nexus One is used by the other core to turn off the power you our core when we enter the lowest power mode. This means that we cannot enter that low power mode while the i2c bus is active, so we block low power idle modes. At some point we also tries to block suspend in this case, but this caused a lot of failed suspend attempts since the frequency scaling code would try to ramp up while freezing processes which in turn aborted the process freezing attempts.
Quoted 21 lines
Quoted 10 lines
<disclaimer: just from what I read>
Provided you can reach the same power state from idle, current suspend could probably also be implemented by just the freezing part and a hint to the idle-loop to provide accelerated fall-through to lowest power. </disclaimer>At that point, you could probably merge the constraints.
But the freezing part is also the hard part, isn't it? (I have no idea. Thomas seems to think about cgroups for that and doing smth about the timers.)
Um, well, as I said, I think using suspend from idle and freezer is longer term. I think if we express the constraints as qos android can then use them to gate when to enter S3 .. which is functionally equivalent to suspend blockers. And the vanilla kernel can use them to gate power states for the drivers in suspend from idle.
James
Signature · 1 line
Arve Hjønnevåg
Quoted 42 lines · On Wed, 02 Jun 2010 15:41:11 -0500 James Bottomley <[email protected]>…
Quoted 21 lines · Florian Mickler
Quoted 18 lines · On Wed, 02 Jun 2010 10:05:11 -0500 James Bottomley <[email protected]>…
Quoted 3 lines · Arve Hjønnevåg
No, they have to be two separate constraints, otherwise a constraint to block suspend would override a constraint to block a low power idle mode or the other way around.
Depends. If you block the system from going into low power idle, does that mean you still want it to be fully suspended?
If yes, then we do have independent constraints. If not, they have a hierarchy:
* Fully Interactive (no low power idle or suspend)
* Partially Interactive (may go into low power idle but not suspend)
* None (may go into low power idle or suspend)Which is expressable as a ternary constraint.
Quoted 7 lines
Quoted 2 lines
James
But unblocking suspend at the moment is independent to getting idle. If you have the requirement to stay in the highest-idle level (i.e. best latency you can get) that does not (currently) mean, that you can not suspend.
I don't understand that as a reason. If we looks at this a qos constraints, you're saying that the system may not drop into certain low power states because it might turn something off that's currently being used by a driver or a process. Suspend is certainly the lowest state of that because it turns everything off, why would it be legal to drop into that?
I also couldn't find this notion of separation of idleness power from suspend blocking in the original suspend block patch set ... if you can either tell me where it is, or give me an example of the separated use cases, I'd understand better.
Quoted 5 lines
Quoted 3 lines
To preserve that explicit fall-through while still having working run-time-powermanagement I think the qos-constraints need to be separated.
OK, as above, why? or better yet, just give an example.
Hm. Maybe it is me who doesn't understand.
With proposed patchset:
1. As soon as we unblock suspend we go down. (i.e. suspending)
2. While suspend is blocked, the idle-loop does it's things. (i.e. runtime power managment -> can give same power-result as suspend)
possible cases:
1:
- qos-latency-constraints: 1ms, [here: forbids anything other than C1 idle state.]
- suspend is blocked
2: - qos latency-constraints: as in 1
- suspend unblocked
3: - qos latency-constraints: infinity, cpu in lowest power state.
- suspend is blocked
4: - qos latency-constraints: infinity, cpu in lowest power state.
- suspend unblocked
in case 2 and 4 we would suspend, regardeless of the qos-latency.
in case 1 and 3 we would stay awake, regardeless of the qos-latency constraint.
If only one constraint, then case 2 (or 3) wouldn't be possible. But it is possible now.
A possible use case as an example?
(hmm... i'm trying my imagination hard now):
Your sound needs low latency, so that could be a cause for the qos-latency constraint.
And unblocking suspend could nonetheless happen:
For example... you have an firefox open and don't want to prevent suspend for that case when the display is turned off
Cheers,
Flo
Quoted 97 lines
-----Original Message-----
From: Florian Mickler [mailto:[email protected]]
Sent: Wednesday, June 02, 2010 4:06 PM
To: James Bottomley
Cc: Arve Hjønnevåg; Neil Brown; [email protected]; Peter Zijlstra; LKML; Alan Cox; Gross, Mark; Thomas Gleixner; Linux OMAP Mailing List; Linux PM; [email protected]
Subject: Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)Quoted 6 lines · On Wed, 02 Jun 2010 15:41:11 -0500 James Bottomley <[email protected]>…
Quoted 5 lines · Florian Mickler
Quoted 2 lines · On Wed, 02 Jun 2010 10:05:11 -0500 James Bottomley <[email protected]>…
Quoted 1 line · Arve Hjønnevåg
No, they have to be two separate constraints, otherwise a
constraint
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
to block suspend would override a constraint to block a low power
idle
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
mode or the other way around.
Depends. If you block the system from going into low power idle,
does
Quoted 32 lines
Quoted 12 lines
Quoted 12 lines
that mean you still want it to be fully suspended?
If yes, then we do have independent constraints. If not, they have a hierarchy:
* Fully Interactive (no low power idle or suspend)
* Partially Interactive (may go into low power idle but not suspend)
* None (may go into low power idle or suspend)Which is expressable as a ternary constraint.
Quoted 7 lines
Quoted 2 lines
James
But unblocking suspend at the moment is independent to getting idle. If you have the requirement to stay in the highest-idle level (i.e. best latency you can get) that does not (currently) mean, that you can not suspend.
I don't understand that as a reason. If we looks at this a qos constraints, you're saying that the system may not drop into certain low power states because it might turn something off that's currently being used by a driver or a process. Suspend is certainly the lowest state of that because it turns everything off, why would it be legal to drop into that?
I also couldn't find this notion of separation of idleness power from suspend blocking in the original suspend block patch set ... if you can either tell me where it is, or give me an example of the separated use cases, I'd understand better.
Quoted 5 lines
Quoted 3 lines
To preserve that explicit fall-through while still having working run-time-powermanagement I think the qos-constraints need to be separated.
OK, as above, why? or better yet, just give an example.
Hm. Maybe it is me who doesn't understand.
With proposed patchset:
1. As soon as we unblock suspend we go down. (i.e. suspending)
2. While suspend is blocked, the idle-loop does it's things. (i.e. runtime power managment -> can give same power-result as suspend)possible cases:
1:
- qos-latency-constraints: 1ms, [here: forbids anything other than C1 idle state.]
- suspend is blocked2: - qos latency-constraints: as in 1
- suspend unblocked3: - qos latency-constraints: infinity, cpu in lowest power state.
- suspend is blocked4: - qos latency-constraints: infinity, cpu in lowest power state.
- suspend unblockedin case 2 and 4 we would suspend, regardeless of the qos-latency.
in case 1 and 3 we would stay awake, regardeless of the qos-latency constraint.
If only one constraint, then case 2 (or 3) wouldn't be possible. But it is possible now.
Quoted 10 lines
A possible use case as an example?
(hmm... i'm trying my imagination hard now):
Your sound needs low latency, so that could be a cause for the qos-latency constraint.And unblocking suspend could nonetheless happen:
For example... you have an firefox open and don't want to prevent suspend for that case when the display is turned off
[mtg: ] This has been a pain point for the PM_QOS implementation. They change the constrain back and forth at the transaction level of the i2c driver. The pm_qos code really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.
We've had a number of attempts at fixing this, but I think the proper fix is to bolt a "disable C-states > x" interface into cpu_idle that bypases pm_qos altogether. Or, perhaps add a new pm_qos API that does the equivalent operation, overriding whatever constraint is active.
--mgross
Quoted 1 line
[mtg: ] This has been a pain point for the
PM_QOSimplementation. They change the constrain back and forth at the transaction level of the i2c driver. Thepm_qoscode really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.
That should be trivial in the usual case because 99% of the time you can hot path
the QoS entry changing is the latest one
there have been no other changes
If it is valid I can use the cached previous aggregate I cunningly
saved in the top QoS entry when I computed the new one
(ie most of the time from the kernel side you have a QoS stack)
Quoted 1 line
We've had a number of attempts at fixing this, but I think the proper fix is to bolt a "disable C-states > x" interface into
cpu_idlethat bypasespm_qosaltogether. Or, perhaps add a newpm_qosAPI that does the equivalent operation, overriding whatever constraint is active.
We need some of this anyway for deep power saving because there is hardware which can't wake from soem states, which in turn means if that device is active we need to be above the state in question.
Quoted 9 lines · Alan Cox
Quoted 1 line
[mtg: ] This has been a pain point for the
PM_QOSimplementation.They change the constrain back and forth at the transaction level of the i2c driver. The
pm_qoscode really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.That should be trivial in the usual case because 99% of the time you can hot path
Quoted 6 lines
the QoS entry changing is the latest one
there have been no other changes
If it is valid I can use the cached previous aggregate I cunningly
saved in the top QoS entry when I computed the new one(ie most of the time from the kernel side you have a QoS stack)
Why would the kernel change the QoS state of a task? Why not have two interacting QoS variables, one for the task, one for the subsystem in question, and the action depends on their relative value?
Quoted 9 lines
Quoted 1 line
We've had a number of attempts at fixing this, but I think the
proper fix is to bolt a "disable C-states > x" interface into
cpu_idlethat bypasespm_qosaltogether. Or, perhaps add a newpm_qosAPI that does the equivalent operation, overriding whatever constraint is active.We need some of this anyway for deep power saving because there is hardware which can't wake from soem states, which in turn means if that device is active we need to be above the state in question.
Right, and I can imagine that depending on the platform details and not the device details, so we get platform hooks in the drivers, or possible up in the generic stack because I don't think NICs actually know if there are open connections.
Quoted 15 lines · Peter Zijlstra
Quoted 14 lines · Alan Cox
Quoted 1 line
[mtg: ] This has been a pain point for the
PM_QOSimplementation.They change the constrain back and forth at the transaction level of the i2c driver. The
pm_qoscode really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.That should be trivial in the usual case because 99% of the time you can hot path
the QoS entry changing is the latest one
there have been no other changes
If it is valid I can use the cached previous aggregate I cunningly
saved in the top QoS entry when I computed the new one
Quoted 5 lines
Quoted 1 line
(ie most of the time from the kernel side you have a QoS stack)
Why would the kernel change the QoS state of a task? Why not have two interacting QoS variables, one for the task, one for the subsystem in question, and the action depends on their relative value?
Yes, having a QoS parameter per-subsystem (or even per-device) is very important for SoCs that have independently controlled powerdomains. If all devices/subsystems in a particular powerdomain have QoS parameters that permit, the power state of that powerdomain can be lowered independently from system-wide power state and power states of other power domains.
Kevin
Quoted 34 lines
-----Original Message-----
From: Kevin Hilman [mailto:[email protected]]
Sent: Thursday, June 03, 2010 7:43 AM
To: Peter Zijlstra
Cc: Alan Cox; Gross, Mark; Florian Mickler; James Bottomley; Arve Hjønnevåg; Neil Brown; [email protected]; LKML; Thomas Gleixner; Linux OMAP Mailing List; Linux PM; [email protected]
Subject: Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)Quoted 15 lines · Peter Zijlstra
Quoted 14 lines · Alan Cox
Quoted 1 line
[mtg: ] This has been a pain point for the
PM_QOSimplementation.They change the constrain back and forth at the transaction level of the i2c driver. The
pm_qoscode really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.That should be trivial in the usual case because 99% of the time you can hot path
the QoS entry changing is the latest one
there have been no other changes
If it is valid I can use the cached previous aggregate I cunningly
saved in the top QoS entry when I computed the new oneQuoted 5 lines
Quoted 1 line
(ie most of the time from the kernel side you have a QoS stack)
Why would the kernel change the QoS state of a task? Why not have two interacting QoS variables, one for the task, one for the subsystem in question, and the action depends on their relative value?
Quoted 7 lines
Yes, having a QoS parameter per-subsystem (or even per-device) is very important for SoCs that have independently controlled powerdomains. If all devices/subsystems in a particular powerdomain have QoS parameters that permit, the power state of that powerdomain can be lowered independently from system-wide power state and power states of other power domains.
This seems similar to that pm_qos generalization into bus drivers we where waving our hands at during the collab summit in April? We never did get into meaningful detail at that time.
--mgross
Quoted 39 lines · Mark
Quoted 32 lines
-----Original Message-----
From: Kevin Hilman [mailto:[email protected]]
Sent: Thursday, June 03, 2010 7:43 AM
To: Peter Zijlstra
Cc: Alan Cox; Gross, Mark; Florian Mickler; James Bottomley; Arve Hjønnevåg; Neil Brown; [email protected]; LKML; Thomas Gleixner; Linux OMAP Mailing List; Linux PM; [email protected]
Subject: Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)Quoted 15 lines · Peter Zijlstra
Quoted 14 lines · Alan Cox
Quoted 1 line
[mtg: ] This has been a pain point for the
PM_QOSimplementation.They change the constrain back and forth at the transaction level of the i2c driver. The
pm_qoscode really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.That should be trivial in the usual case because 99% of the time you can hot path
the QoS entry changing is the latest one
there have been no other changes
If it is valid I can use the cached previous aggregate I cunningly
saved in the top QoS entry when I computed the new oneQuoted 5 lines
Quoted 1 line
(ie most of the time from the kernel side you have a QoS stack)
Why would the kernel change the QoS state of a task? Why not have two interacting QoS variables, one for the task, one for the subsystem in question, and the action depends on their relative value?
Quoted 7 lines
Yes, having a QoS parameter per-subsystem (or even per-device) is very important for SoCs that have independently controlled powerdomains. If all devices/subsystems in a particular powerdomain have QoS parameters that permit, the power state of that powerdomain can be lowered independently from system-wide power state and power states of other power domains.
Quoted 3 lines
This seems similar to that
pm_qosgeneralization into bus drivers we where waving our hands at during the collab summit in April? We never did get into meaningful detail at that time.
The hand-waving was around how to generalize it into the driver-model, or PM QoS. We're already doing this for OMAP, but in an OMAP-specific way, but it's become clear that this is something useful to generalize.
Kevin
Quoted 39 lines · Mark
Quoted 32 lines
-----Original Message-----
From: Kevin Hilman [mailto:[email protected]]
Sent: Thursday, June 03, 2010 7:43 AM
To: Peter Zijlstra
Cc: Alan Cox; Gross, Mark; Florian Mickler; James Bottomley; Arve Hjønnevåg; Neil Brown; [email protected]; LKML; Thomas Gleixner; Linux OMAP Mailing List; Linux PM; [email protected]
Subject: Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)Quoted 15 lines · Peter Zijlstra
Quoted 14 lines · Alan Cox
Quoted 1 line
[mtg: ] This has been a pain point for the
PM_QOSimplementation.They change the constrain back and forth at the transaction level of the i2c driver. The
pm_qoscode really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.That should be trivial in the usual case because 99% of the time you can hot path
the QoS entry changing is the latest one
there have been no other changes
If it is valid I can use the cached previous aggregate I cunningly
saved in the top QoS entry when I computed the new oneQuoted 5 lines
Quoted 1 line
(ie most of the time from the kernel side you have a QoS stack)
Why would the kernel change the QoS state of a task? Why not have two interacting QoS variables, one for the task, one for the subsystem in question, and the action depends on their relative value?
Quoted 7 lines
Yes, having a QoS parameter per-subsystem (or even per-device) is very important for SoCs that have independently controlled powerdomains. If all devices/subsystems in a particular powerdomain have QoS parameters that permit, the power state of that powerdomain can be lowered independently from system-wide power state and power states of other power domains.
Quoted 3 lines
This seems similar to that
pm_qosgeneralization into bus drivers we where waving our hands at during the collab summit in April? We never did get into meaningful detail at that time.
The hand-waving was around how to generalize it into the driver-model, or PM QoS. We're already doing this for OMAP, but in an OMAP-specific way, but it's become clear that this is something useful to generalize.
Kevin
--
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 41 lines · Kevin Hilman
Quoted 39 lines · Mark
Quoted 39 lines
-----Original Message-----
From: Kevin Hilman [mailto:[email protected]]
Sent: Thursday, June 03, 2010 7:43 AM
To: Peter Zijlstra
Cc: Alan Cox; Gross, Mark; Florian Mickler; James Bottomley; Arve Hjønnevåg; Neil Brown; [email protected]; LKML; Thomas Gleixner; Linux OMAP Mailing List; Linux PM; [email protected]
Subject: Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)Quoted 15 lines · Peter Zijlstra
Quoted 14 lines · Alan Cox
Quoted 1 line
[mtg: ] This has been a pain point for the
PM_QOSimplementation.They change the constrain back and forth at the transaction level of the i2c driver. The
pm_qoscode really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.That should be trivial in the usual case because 99% of the time you can hot path
the QoS entry changing is the latest one
there have been no other changes
If it is valid I can use the cached previous aggregate I cunningly
saved in the top QoS entry when I computed the new oneQuoted 5 lines
Quoted 1 line
(ie most of the time from the kernel side you have a QoS stack)
Why would the kernel change the QoS state of a task? Why not have two interacting QoS variables, one for the task, one for the subsystem in question, and the action depends on their relative value?
Yes, having a QoS parameter per-subsystem (or even per-device) is very important for SoCs that have independently controlled powerdomains. If all devices/subsystems in a particular powerdomain have QoS parameters that permit, the power state of that powerdomain can be lowered independently from system-wide power state and power states of other power domains.
Quoted 8 lines
Quoted 3 lines
This seems similar to that
pm_qosgeneralization into bus drivers we where waving our hands at during the collab summit in April? We never did get into meaningful detail at that time.The hand-waving was around how to generalize it into the driver-model, or PM QoS. We're already doing this for OMAP, but in an OMAP-specific way, but it's become clear that this is something useful to generalize.
Do you have a pointer to the source and description? It might be useful to look at to do a reality check on what we're talking about.
James
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 41 lines · Kevin Hilman
Quoted 39 lines · Mark
Quoted 39 lines
-----Original Message-----
From: Kevin Hilman [mailto:[email protected]]
Sent: Thursday, June 03, 2010 7:43 AM
To: Peter Zijlstra
Cc: Alan Cox; Gross, Mark; Florian Mickler; James Bottomley; Arve Hjønnevåg; Neil Brown; [email protected]; LKML; Thomas Gleixner; Linux OMAP Mailing List; Linux PM; [email protected]
Subject: Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)Quoted 15 lines · Peter Zijlstra
Quoted 14 lines · Alan Cox
Quoted 1 line
[mtg: ] This has been a pain point for the
PM_QOSimplementation.They change the constrain back and forth at the transaction level of the i2c driver. The
pm_qoscode really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.That should be trivial in the usual case because 99% of the time you can hot path
the QoS entry changing is the latest one
there have been no other changes
If it is valid I can use the cached previous aggregate I cunningly
saved in the top QoS entry when I computed the new oneQuoted 5 lines
Quoted 1 line
(ie most of the time from the kernel side you have a QoS stack)
Why would the kernel change the QoS state of a task? Why not have two interacting QoS variables, one for the task, one for the subsystem in question, and the action depends on their relative value?
Yes, having a QoS parameter per-subsystem (or even per-device) is very important for SoCs that have independently controlled powerdomains. If all devices/subsystems in a particular powerdomain have QoS parameters that permit, the power state of that powerdomain can be lowered independently from system-wide power state and power states of other power domains.
Quoted 8 lines
Quoted 3 lines
This seems similar to that
pm_qosgeneralization into bus drivers we where waving our hands at during the collab summit in April? We never did get into meaningful detail at that time.The hand-waving was around how to generalize it into the driver-model, or PM QoS. We're already doing this for OMAP, but in an OMAP-specific way, but it's become clear that this is something useful to generalize.
Do you have a pointer to the source and description? It might be useful to look at to do a reality check on what we're talking about.
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
Hi Kevin, Mark, all,
Yes, from our brief discussions at ELC, and all the ensuing discussions that have happened in the last few weeks, it certainly seems like a good time to think about:
- what is a good model to tie up device idleness, latencies, constraints with cpu idle infrastructure - extensions to PM_QOS, part of what is being discussed, especially Kevin's earlier mail about QOS parameter per subsystem/device that may have independent clock/power domain control.
- what is a good infrastructure to subsequently allow platform-specific low power state - extensions to cpuidle infrastructure to allow platform-wide low power state? Exact conditions for such entry/exit into low power state (latency, wake, etc.) could be platform specific.
Is it a good idea to discuss about a model that could be applicable to other SOCs/platforms as well?
Thanks
Rajeev
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Kevin Hilman
Sent: Thursday, June 03, 2010 10:28 PM
To: Gross, Mark
Cc: Neil Brown; [email protected]; Peter Zijlstra; [email protected]; LKML; Florian Mickler; James Bottomley; Thomas Gleixner; Linux OMAP Mailing List; Linux PM; Alan Cox
Subject: Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)
Quoted 39 lines · Mark
Quoted 32 lines
-----Original Message-----
From: Kevin Hilman [mailto:[email protected]]
Sent: Thursday, June 03, 2010 7:43 AM
To: Peter Zijlstra
Cc: Alan Cox; Gross, Mark; Florian Mickler; James Bottomley; Arve Hjønnevåg; Neil Brown; [email protected]; LKML; Thomas Gleixner; Linux OMAP Mailing List; Linux PM; [email protected]
Subject: Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)Quoted 15 lines · Peter Zijlstra
Quoted 14 lines · Alan Cox
Quoted 1 line
[mtg: ] This has been a pain point for the
PM_QOSimplementation.They change the constrain back and forth at the transaction level of the i2c driver. The
pm_qoscode really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.That should be trivial in the usual case because 99% of the time you can hot path
the QoS entry changing is the latest one
there have been no other changes
If it is valid I can use the cached previous aggregate I cunningly
saved in the top QoS entry when I computed the new oneQuoted 5 lines
Quoted 1 line
(ie most of the time from the kernel side you have a QoS stack)
Why would the kernel change the QoS state of a task? Why not have two interacting QoS variables, one for the task, one for the subsystem in question, and the action depends on their relative value?
Quoted 7 lines
Yes, having a QoS parameter per-subsystem (or even per-device) is very important for SoCs that have independently controlled powerdomains. If all devices/subsystems in a particular powerdomain have QoS parameters that permit, the power state of that powerdomain can be lowered independently from system-wide power state and power states of other power domains.
Quoted 3 lines
This seems similar to that
pm_qosgeneralization into bus drivers we where waving our hands at during the collab summit in April? We never did get into meaningful detail at that time.
The hand-waving was around how to generalize it into the driver-model, or PM QoS. We're already doing this for OMAP, but in an OMAP-specific way, but it's become clear that this is something useful to generalize.
Kevin
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Hi Kevin, Mark, all,
Yes, from our brief discussions at ELC, and all the ensuing discussions that have happened in the last few weeks, it certainly seems like a good time to think about:
- what is a good model to tie up device idleness, latencies, constraints with cpu idle infrastructure - extensions to PM_QOS, part of what is being discussed, especially Kevin's earlier mail about QOS parameter per subsystem/device that may have independent clock/power domain control.
- what is a good infrastructure to subsequently allow platform-specific low power state - extensions to cpuidle infrastructure to allow platform-wide low power state? Exact conditions for such entry/exit into low power state (latency, wake, etc.) could be platform specific.
Is it a good idea to discuss about a model that could be applicable to other SOCs/platforms as well?
Thanks
Rajeev
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Kevin Hilman
Sent: Thursday, June 03, 2010 10:28 PM
To: Gross, Mark
Cc: Neil Brown; [email protected]; Peter Zijlstra; [email protected]; LKML; Florian Mickler; James Bottomley; Thomas Gleixner; Linux OMAP Mailing List; Linux PM; Alan Cox
Subject: Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)
Quoted 39 lines · Mark
Quoted 32 lines
-----Original Message-----
From: Kevin Hilman [mailto:[email protected]]
Sent: Thursday, June 03, 2010 7:43 AM
To: Peter Zijlstra
Cc: Alan Cox; Gross, Mark; Florian Mickler; James Bottomley; Arve Hjønnevåg; Neil Brown; [email protected]; LKML; Thomas Gleixner; Linux OMAP Mailing List; Linux PM; [email protected]
Subject: Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)Quoted 15 lines · Peter Zijlstra
Quoted 14 lines · Alan Cox
Quoted 1 line
[mtg: ] This has been a pain point for the
PM_QOSimplementation.They change the constrain back and forth at the transaction level of the i2c driver. The
pm_qoscode really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.That should be trivial in the usual case because 99% of the time you can hot path
the QoS entry changing is the latest one
there have been no other changes
If it is valid I can use the cached previous aggregate I cunningly
saved in the top QoS entry when I computed the new oneQuoted 5 lines
Quoted 1 line
(ie most of the time from the kernel side you have a QoS stack)
Why would the kernel change the QoS state of a task? Why not have two interacting QoS variables, one for the task, one for the subsystem in question, and the action depends on their relative value?
Quoted 7 lines
Yes, having a QoS parameter per-subsystem (or even per-device) is very important for SoCs that have independently controlled powerdomains. If all devices/subsystems in a particular powerdomain have QoS parameters that permit, the power state of that powerdomain can be lowered independently from system-wide power state and power states of other power domains.
Quoted 3 lines
This seems similar to that
pm_qosgeneralization into bus drivers we where waving our hands at during the collab summit in April? We never did get into meaningful detail at that time.
The hand-waving was around how to generalize it into the driver-model, or PM QoS. We're already doing this for OMAP, but in an OMAP-specific way, but it's become clear that this is something useful to generalize.
Kevin
Quoted 10 lines
Quoted 7 lines
Yes, having a QoS parameter per-subsystem (or even per-device) is very important for SoCs that have independently controlled powerdomains. If all devices/subsystems in a particular powerdomain have QoS parameters that permit, the power state of that powerdomain can be lowered independently from system-wide power state and power states of other power domains.
This seems similar to that
pm_qosgeneralization into bus drivers we where waving our hands at during the collab summit in April? We never did get into meaningful detail at that time.--mgross
I think there is definitely a need for QoS parameters per-device. I've been pondering how to incorporate this concept into runtime_pm. One idea would be to add pm_qos-like callbacks to struct dev_pm_ops, e.g. runtime_pm_qos_add/update/remove_requirement(). Requirements would be passed up the tree to the first parent that cares, usually a bus driver.
Is this similar to what you guys were discussing at the collab summit?
Thanks.
- Bryan
Quoted 7 lines
Quoted 7 lines
Yes, having a QoS parameter per-subsystem (or even per-device) is very important for SoCs that have independently controlled powerdomains. If all devices/subsystems in a particular powerdomain have QoS parameters that permit, the power state of that powerdomain can be lowered independently from system-wide power state and power states of other power domains.
Quoted 5 lines
This seems similar to that
pm_qosgeneralization into bus drivers we where waving our hands at during the collab summit in April? We never did get into meaningful detail at that time.--mgross
I think there is definitely a need for QoS parameters per-device. I've been pondering how to incorporate this concept into runtime_pm. One idea would be to add pm_qos-like callbacks to struct dev_pm_ops, e.g. runtime_pm_qos_add/update/remove_requirement(). Requirements would be passed up the tree to the first parent that cares, usually a bus driver.
Is this similar to what you guys were discussing at the collab summit? Thanks.
- Bryan
Quoted 15 lines · Peter Zijlstra
Quoted 14 lines · Alan Cox
Quoted 1 line
[mtg: ] This has been a pain point for the
PM_QOSimplementation.They change the constrain back and forth at the transaction level of the i2c driver. The
pm_qoscode really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.That should be trivial in the usual case because 99% of the time you can hot path
the QoS entry changing is the latest one
there have been no other changes
If it is valid I can use the cached previous aggregate I cunningly
saved in the top QoS entry when I computed the new one
Quoted 5 lines
Quoted 1 line
(ie most of the time from the kernel side you have a QoS stack)
Why would the kernel change the QoS state of a task? Why not have two interacting QoS variables, one for the task, one for the subsystem in question, and the action depends on their relative value?
Yes, having a QoS parameter per-subsystem (or even per-device) is very important for SoCs that have independently controlled powerdomains. If all devices/subsystems in a particular powerdomain have QoS parameters that permit, the power state of that powerdomain can be lowered independently from system-wide power state and power states of other power domains.
Kevin
Quoted 9 lines · Alan Cox
Quoted 1 line
[mtg: ] This has been a pain point for the
PM_QOSimplementation.They change the constrain back and forth at the transaction level of the i2c driver. The
pm_qoscode really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.That should be trivial in the usual case because 99% of the time you can hot path
Quoted 6 lines
the QoS entry changing is the latest one
there have been no other changes
If it is valid I can use the cached previous aggregate I cunningly
saved in the top QoS entry when I computed the new one(ie most of the time from the kernel side you have a QoS stack)
Why would the kernel change the QoS state of a task? Why not have two interacting QoS variables, one for the task, one for the subsystem in question, and the action depends on their relative value?
Quoted 9 lines
Quoted 1 line
We've had a number of attempts at fixing this, but I think the
proper fix is to bolt a "disable C-states > x" interface into
cpu_idlethat bypasespm_qosaltogether. Or, perhaps add a newpm_qosAPI that does the equivalent operation, overriding whatever constraint is active.We need some of this anyway for deep power saving because there is hardware which can't wake from soem states, which in turn means if that device is active we need to be above the state in question.
Right, and I can imagine that depending on the platform details and not the device details, so we get platform hooks in the drivers, or possible up in the generic stack because I don't think NICs actually know if there are open connections.
Quoted 11 lines · Alan Cox
Quoted 1 line
[mtg: ] This has been a pain point for the
PM_QOSimplementation. They change the constrain back and forth at the transaction level of the i2c driver. Thepm_qoscode really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.That should be trivial in the usual case because 99% of the time you can hot path
the QoS entry changing is the latest one
there have been no other changes
If it is valid I can use the cached previous aggregate I cunningly
saved in the top QoS entry when I computed the new one(ie most of the time from the kernel side you have a QoS stack)
It's not just the list based computation: that's trivial to fix, as you say ... the other problem is the notifier chain, because that's blocking and could be long. Could we invoke the notifier through a workqueue? It doesn't seem to have veto power, so it's pure notification, does it matter if the notice is delayed (as long as it's in order)?
Quoted 5 lines
Quoted 1 line
We've had a number of attempts at fixing this, but I think the proper fix is to bolt a "disable C-states > x" interface into
cpu_idlethat bypasespm_qosaltogether. Or, perhaps add a newpm_qosAPI that does the equivalent operation, overriding whatever constraint is active.We need some of this anyway for deep power saving because there is hardware which can't wake from soem states, which in turn means if that device is active we need to be above the state in question.
James
Quoted 11 lines · On Thu, 03 Jun 2010 08:24:31 -0500 James Bottomley <[email protected]>…
Quoted 10 lines · Alan Cox
Quoted 1 line
[mtg: ] This has been a pain point for the
PM_QOSimplementation. They change the constrain back and forth at the transaction level of the i2c driver. Thepm_qoscode really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.That should be trivial in the usual case because 99% of the time you can hot path
the QoS entry changing is the latest one
there have been no other changes
If it is valid I can use the cached previous aggregate I cunningly
saved in the top QoS entry when I computed the new one
Quoted 7 lines
Quoted 1 line
(ie most of the time from the kernel side you have a QoS stack)
It's not just the list based computation: that's trivial to fix, as you say ... the other problem is the notifier chain, because that's blocking and could be long. Could we invoke the notifier through a workqueue? It doesn't seem to have veto power, so it's pure notification, does it matter if the notice is delayed (as long as it's in order)?
I think schedule_work() (worqueue.h) can take care of that. Thats how the rfkill subsystem does it.
Cheers,
Flo
Quoted 11 lines · On Thu, 03 Jun 2010 08:24:31 -0500 James Bottomley <[email protected]>…
Quoted 10 lines · Alan Cox
Quoted 1 line
[mtg: ] This has been a pain point for the
PM_QOSimplementation. They change the constrain back and forth at the transaction level of the i2c driver. Thepm_qoscode really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.That should be trivial in the usual case because 99% of the time you can hot path
the QoS entry changing is the latest one
there have been no other changes
If it is valid I can use the cached previous aggregate I cunningly
saved in the top QoS entry when I computed the new one
Quoted 7 lines
Quoted 1 line
(ie most of the time from the kernel side you have a QoS stack)
It's not just the list based computation: that's trivial to fix, as you say ... the other problem is the notifier chain, because that's blocking and could be long. Could we invoke the notifier through a workqueue? It doesn't seem to have veto power, so it's pure notification, does it matter if the notice is delayed (as long as it's in order)?
I think schedule_work() (worqueue.h) can take care of that. Thats how the rfkill subsystem does it.
Cheers,
Flo
Quoted 26 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Thursday, June 03, 2010 6:25 AM
To: Alan Cox
Cc: Gross, Mark; Florian Mickler; Arve Hjønnevåg; Neil Brown; [email protected]; Peter Zijlstra; LKML; Thomas Gleixner; Linux OMAP Mailing List; Linux PM; [email protected]
Subject: Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)Quoted 1 line · Alan Cox
Quoted 1 line
[mtg: ] This has been a pain point for the
PM_QOSimplementation. Theychange the constrain back and forth at the transaction level of the i2c driver. The
pm_qoscode really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.Quoted 9 lines
That should be trivial in the usual case because 99% of the time you can hot path
the QoS entry changing is the latest one
there have been no other changes
If it is valid I can use the cached previous aggregate I cunningly
saved in the top QoS entry when I computed the new one
Quoted 7 lines
Quoted 1 line
(ie most of the time from the kernel side you have a QoS stack)
It's not just the list based computation: that's trivial to fix, as you say ... the other problem is the notifier chain, because that's blocking and could be long. Could we invoke the notifier through a workqueue? It doesn't seem to have veto power, so it's pure notification, does it matter if the notice is delayed (as long as it's in order)?
[mtg: ] true. The notifications "could be" done on as a scheduled work item
in most cases. I think there is only one user of the notification so far
any way. Most pm_qos users do a pole of the current value for whatever parameter they are interested in.
--mgross
Quoted 12 lines
Quoted 2 lines
Quoted 2 lines
We've had a number of attempts at fixing this, but I think the proper
fix is to bolt a "disable C-states > x" interface into
cpu_idlethat bypasespm_qosaltogether. Or, perhaps add a newpm_qosAPI that does the equivalent operation, overriding whatever constraint is active.Quoted 4 lines
We need some of this anyway for deep power saving because there is hardware which can't wake from soem states, which in turn means if that device is active we need to be above the state in question.
James
Quoted 26 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Thursday, June 03, 2010 6:25 AM
To: Alan Cox
Cc: Gross, Mark; Florian Mickler; Arve Hjønnevåg; Neil Brown; [email protected]; Peter Zijlstra; LKML; Thomas Gleixner; Linux OMAP Mailing List; Linux PM; [email protected]
Subject: Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)Quoted 1 line · Alan Cox
Quoted 1 line
[mtg: ] This has been a pain point for the
PM_QOSimplementation. Theychange the constrain back and forth at the transaction level of the i2c driver. The
pm_qoscode really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.Quoted 9 lines
That should be trivial in the usual case because 99% of the time you can hot path
the QoS entry changing is the latest one
there have been no other changes
If it is valid I can use the cached previous aggregate I cunningly
saved in the top QoS entry when I computed the new one
Quoted 7 lines
Quoted 1 line
(ie most of the time from the kernel side you have a QoS stack)
It's not just the list based computation: that's trivial to fix, as you say ... the other problem is the notifier chain, because that's blocking and could be long. Could we invoke the notifier through a workqueue? It doesn't seem to have veto power, so it's pure notification, does it matter if the notice is delayed (as long as it's in order)?
[mtg: ] true. The notifications "could be" done on as a scheduled work item
in most cases. I think there is only one user of the notification so far
any way. Most pm_qos users do a pole of the current value for whatever parameter they are interested in.
--mgross
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
We've had a number of attempts at fixing this, but I think the proper
fix is to bolt a "disable C-states > x" interface into
cpu_idlethat bypasespm_qosaltogether. Or, perhaps add a newpm_qosAPI that does the equivalent operation, overriding whatever constraint is active.Quoted 1 line
Quoted 6 lines
Quoted 3 lines
We need some of this anyway for deep power saving because there is hardware which can't wake from soem states, which in turn means if that device is active we need to be above the state in question.
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 11 lines · James Bottomley
Quoted 10 lines · Alan Cox
Quoted 1 line
[mtg: ] This has been a pain point for the
PM_QOSimplementation. They change the constrain back and forth at the transaction level of the i2c driver. Thepm_qoscode really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.That should be trivial in the usual case because 99% of the time you can hot path
the QoS entry changing is the latest one
there have been no other changes
If it is valid I can use the cached previous aggregate I cunningly
saved in the top QoS entry when I computed the new one
Quoted 7 lines
Quoted 1 line
(ie most of the time from the kernel side you have a QoS stack)
It's not just the list based computation: that's trivial to fix, as you say ... the other problem is the notifier chain, because that's blocking and could be long. Could we invoke the notifier through a workqueue? It doesn't seem to have veto power, so it's pure notification, does it matter if the notice is delayed (as long as it's in order)?
It depends on the information type and for a lot of things we might get away without notifiers.
The only real issue is when you need to get other cores out of their deep idle state to make a new constraint work. That's what we do with the DMA latency notifier right now.
Thanks,
tglx
Quoted 11 lines · James Bottomley
Quoted 10 lines · Alan Cox
Quoted 1 line
[mtg: ] This has been a pain point for the
PM_QOSimplementation. They change the constrain back and forth at the transaction level of the i2c driver. Thepm_qoscode really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.That should be trivial in the usual case because 99% of the time you can hot path
the QoS entry changing is the latest one
there have been no other changes
If it is valid I can use the cached previous aggregate I cunningly
saved in the top QoS entry when I computed the new one
Quoted 7 lines
Quoted 1 line
(ie most of the time from the kernel side you have a QoS stack)
It's not just the list based computation: that's trivial to fix, as you say ... the other problem is the notifier chain, because that's blocking and could be long. Could we invoke the notifier through a workqueue? It doesn't seem to have veto power, so it's pure notification, does it matter if the notice is delayed (as long as it's in order)?
It depends on the information type and for a lot of things we might get away without notifiers.
The only real issue is when you need to get other cores out of their deep idle state to make a new constraint work. That's what we do with the DMA latency notifier right now.
Thanks,
tglx
Quoted 21 lines · Thomas Gleixner
Quoted 11 lines · James Bottomley
Quoted 10 lines · Alan Cox
Quoted 1 line
[mtg: ] This has been a pain point for the
PM_QOSimplementation. They change the constrain back and forth at the transaction level of the i2c driver. Thepm_qoscode really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.That should be trivial in the usual case because 99% of the time you can hot path
the QoS entry changing is the latest one
there have been no other changes
If it is valid I can use the cached previous aggregate I cunningly
saved in the top QoS entry when I computed the new oneQuoted 7 lines
Quoted 1 line
(ie most of the time from the kernel side you have a QoS stack)
It's not just the list based computation: that's trivial to fix, as you say ... the other problem is the notifier chain, because that's blocking and could be long. Could we invoke the notifier through a workqueue? It doesn't seem to have veto power, so it's pure notification, does it matter if the notice is delayed (as long as it's in order)?
Quoted 6 lines
It depends on the information type and for a lot of things we might get away without notifiers.
The only real issue is when you need to get other cores out of their deep idle state to make a new constraint work. That's what we do with the DMA latency notifier right now.
But the only DMA latency notifier is cpuidle_latency_notifier. That looks callable from atomic context, so we could have two chains: one atomic and one not.
The only other notifier in use is the ieee80211_max_network_latency, which uses mutexes, so does require user context.
James
Quoted 21 lines · Thomas Gleixner
Quoted 11 lines · James Bottomley
Quoted 10 lines · Alan Cox
Quoted 1 line
[mtg: ] This has been a pain point for the
PM_QOSimplementation. They change the constrain back and forth at the transaction level of the i2c driver. Thepm_qoscode really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.That should be trivial in the usual case because 99% of the time you can hot path
the QoS entry changing is the latest one
there have been no other changes
If it is valid I can use the cached previous aggregate I cunningly
saved in the top QoS entry when I computed the new oneQuoted 7 lines
Quoted 1 line
(ie most of the time from the kernel side you have a QoS stack)
It's not just the list based computation: that's trivial to fix, as you say ... the other problem is the notifier chain, because that's blocking and could be long. Could we invoke the notifier through a workqueue? It doesn't seem to have veto power, so it's pure notification, does it matter if the notice is delayed (as long as it's in order)?
Quoted 6 lines
It depends on the information type and for a lot of things we might get away without notifiers.
The only real issue is when you need to get other cores out of their deep idle state to make a new constraint work. That's what we do with the DMA latency notifier right now.
But the only DMA latency notifier is cpuidle_latency_notifier. That looks callable from atomic context, so we could have two chains: one atomic and one not.
The only other notifier in use is the ieee80211_max_network_latency, which uses mutexes, so does require user context.
James
Quoted 11 lines · Alan Cox
Quoted 1 line
[mtg: ] This has been a pain point for the
PM_QOSimplementation. They change the constrain back and forth at the transaction level of the i2c driver. Thepm_qoscode really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.That should be trivial in the usual case because 99% of the time you can hot path
the QoS entry changing is the latest one
there have been no other changes
If it is valid I can use the cached previous aggregate I cunningly
saved in the top QoS entry when I computed the new one(ie most of the time from the kernel side you have a QoS stack)
It's not just the list based computation: that's trivial to fix, as you say ... the other problem is the notifier chain, because that's blocking and could be long. Could we invoke the notifier through a workqueue? It doesn't seem to have veto power, so it's pure notification, does it matter if the notice is delayed (as long as it's in order)?
Quoted 5 lines
Quoted 1 line
We've had a number of attempts at fixing this, but I think the proper fix is to bolt a "disable C-states > x" interface into
cpu_idlethat bypasespm_qosaltogether. Or, perhaps add a newpm_qosAPI that does the equivalent operation, overriding whatever constraint is active.We need some of this anyway for deep power saving because there is hardware which can't wake from soem states, which in turn means if that device is active we need to be above the state in question.
James
Quoted 1 line
[mtg: ] This has been a pain point for the
PM_QOSimplementation. They change the constrain back and forth at the transaction level of the i2c driver. Thepm_qoscode really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.
That should be trivial in the usual case because 99% of the time you can hot path
the QoS entry changing is the latest one
there have been no other changes
If it is valid I can use the cached previous aggregate I cunningly
saved in the top QoS entry when I computed the new one
(ie most of the time from the kernel side you have a QoS stack)
Quoted 1 line
We've had a number of attempts at fixing this, but I think the proper fix is to bolt a "disable C-states > x" interface into
cpu_idlethat bypasespm_qosaltogether. Or, perhaps add a newpm_qosAPI that does the equivalent operation, overriding whatever constraint is active.
We need some of this anyway for deep power saving because there is hardware which can't wake from soem states, which in turn means if that device is active we need to be above the state in question.
Quoted 97 lines
-----Original Message-----
From: Florian Mickler [mailto:[email protected]]
Sent: Wednesday, June 02, 2010 4:06 PM
To: James Bottomley
Cc: Arve Hjønnevåg; Neil Brown; [email protected]; Peter Zijlstra; LKML; Alan Cox; Gross, Mark; Thomas Gleixner; Linux OMAP Mailing List; Linux PM; [email protected]
Subject: Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)Quoted 6 lines · On Wed, 02 Jun 2010 15:41:11 -0500 James Bottomley <[email protected]>…
Quoted 5 lines · Florian Mickler
Quoted 2 lines · On Wed, 02 Jun 2010 10:05:11 -0500 James Bottomley <[email protected]>…
Quoted 1 line · Arve Hjønnevåg
No, they have to be two separate constraints, otherwise a
constraint
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
to block suspend would override a constraint to block a low power
idle
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
mode or the other way around.
Depends. If you block the system from going into low power idle,
does
Quoted 32 lines
Quoted 12 lines
Quoted 12 lines
that mean you still want it to be fully suspended?
If yes, then we do have independent constraints. If not, they have a hierarchy:
* Fully Interactive (no low power idle or suspend)
* Partially Interactive (may go into low power idle but not suspend)
* None (may go into low power idle or suspend)Which is expressable as a ternary constraint.
Quoted 7 lines
Quoted 2 lines
James
But unblocking suspend at the moment is independent to getting idle. If you have the requirement to stay in the highest-idle level (i.e. best latency you can get) that does not (currently) mean, that you can not suspend.
I don't understand that as a reason. If we looks at this a qos constraints, you're saying that the system may not drop into certain low power states because it might turn something off that's currently being used by a driver or a process. Suspend is certainly the lowest state of that because it turns everything off, why would it be legal to drop into that?
I also couldn't find this notion of separation of idleness power from suspend blocking in the original suspend block patch set ... if you can either tell me where it is, or give me an example of the separated use cases, I'd understand better.
Quoted 5 lines
Quoted 3 lines
To preserve that explicit fall-through while still having working run-time-powermanagement I think the qos-constraints need to be separated.
OK, as above, why? or better yet, just give an example.
Hm. Maybe it is me who doesn't understand.
With proposed patchset:
1. As soon as we unblock suspend we go down. (i.e. suspending)
2. While suspend is blocked, the idle-loop does it's things. (i.e. runtime power managment -> can give same power-result as suspend)possible cases:
1:
- qos-latency-constraints: 1ms, [here: forbids anything other than C1 idle state.]
- suspend is blocked2: - qos latency-constraints: as in 1
- suspend unblocked3: - qos latency-constraints: infinity, cpu in lowest power state.
- suspend is blocked4: - qos latency-constraints: infinity, cpu in lowest power state.
- suspend unblockedin case 2 and 4 we would suspend, regardeless of the qos-latency.
in case 1 and 3 we would stay awake, regardeless of the qos-latency constraint.
If only one constraint, then case 2 (or 3) wouldn't be possible. But it is possible now.
Quoted 10 lines
A possible use case as an example?
(hmm... i'm trying my imagination hard now):
Your sound needs low latency, so that could be a cause for the qos-latency constraint.And unblocking suspend could nonetheless happen:
For example... you have an firefox open and don't want to prevent suspend for that case when the display is turned off
[mtg: ] This has been a pain point for the PM_QOS implementation. They change the constrain back and forth at the transaction level of the i2c driver. The pm_qos code really wasn't made to deal with such hot path use, as each such change triggers a re-computation of what the aggregate qos request is.
We've had a number of attempts at fixing this, but I think the proper fix is to bolt a "disable C-states > x" interface into cpu_idle that bypases pm_qos altogether. Or, perhaps add a new pm_qos API that does the equivalent operation, overriding whatever constraint is active.
--mgross
Quoted 42 lines · On Wed, 02 Jun 2010 15:41:11 -0500 James Bottomley <[email protected]>…
Quoted 21 lines · Florian Mickler
Quoted 18 lines · On Wed, 02 Jun 2010 10:05:11 -0500 James Bottomley <[email protected]>…
Quoted 3 lines · Arve Hjønnevåg
No, they have to be two separate constraints, otherwise a constraint to block suspend would override a constraint to block a low power idle mode or the other way around.
Depends. If you block the system from going into low power idle, does that mean you still want it to be fully suspended?
If yes, then we do have independent constraints. If not, they have a hierarchy:
* Fully Interactive (no low power idle or suspend)
* Partially Interactive (may go into low power idle but not suspend)
* None (may go into low power idle or suspend)Which is expressable as a ternary constraint.
Quoted 7 lines
Quoted 2 lines
James
But unblocking suspend at the moment is independent to getting idle. If you have the requirement to stay in the highest-idle level (i.e. best latency you can get) that does not (currently) mean, that you can not suspend.
I don't understand that as a reason. If we looks at this a qos constraints, you're saying that the system may not drop into certain low power states because it might turn something off that's currently being used by a driver or a process. Suspend is certainly the lowest state of that because it turns everything off, why would it be legal to drop into that?
I also couldn't find this notion of separation of idleness power from suspend blocking in the original suspend block patch set ... if you can either tell me where it is, or give me an example of the separated use cases, I'd understand better.
Quoted 5 lines
Quoted 3 lines
To preserve that explicit fall-through while still having working run-time-powermanagement I think the qos-constraints need to be separated.
OK, as above, why? or better yet, just give an example.
Hm. Maybe it is me who doesn't understand.
With proposed patchset:
1. As soon as we unblock suspend we go down. (i.e. suspending)
2. While suspend is blocked, the idle-loop does it's things. (i.e. runtime power managment -> can give same power-result as suspend)
possible cases:
1:
- qos-latency-constraints: 1ms, [here: forbids anything other than C1 idle state.]
- suspend is blocked
2: - qos latency-constraints: as in 1
- suspend unblocked
3: - qos latency-constraints: infinity, cpu in lowest power state.
- suspend is blocked
4: - qos latency-constraints: infinity, cpu in lowest power state.
- suspend unblocked
in case 2 and 4 we would suspend, regardeless of the qos-latency.
in case 1 and 3 we would stay awake, regardeless of the qos-latency constraint.
If only one constraint, then case 2 (or 3) wouldn't be possible. But it is possible now.
A possible use case as an example?
(hmm... i'm trying my imagination hard now):
Your sound needs low latency, so that could be a cause for the qos-latency constraint.
And unblocking suspend could nonetheless happen:
For example... you have an firefox open and don't want to prevent suspend for that case when the display is turned off
Cheers,
Flo
Quoted 51 lines · Arve Hjønnevåg
2010/6/1 James Bottomley <[email protected]>:
Quoted 50 lines · Arve Hjønnevåg
Quoted 48 lines · James Bottomley
Quoted 28 lines · Rafael J. Wysocki
Quoted 27 lines · James Bottomley
Quoted 18 lines · Matthew Garrett
Quoted 8 lines · James Bottomley
Quoted 6 lines
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has the same problem may be true, but it's not entirely relevant.
Quoted 8 lines
As long as you can set a wakeup timer, an S state is just a C state with side effects. The significant one is that entering an S state stops the process scheduler and any in-kernel timers. I don't think Google care at all about whether suspend is entered through an explicit transition or something hooked into cpuidle - the relevant issue is that they want to be able to express a set of constraints that lets them control whether or not the scheduler keeps on scheduling, and which doesn't let them lose wakeup events in the process.
Quoted 1 line
Exactly, so my understanding of where we currently are is:
Thanks for the recap.
Quoted 3 lines
1.
pm_qoswill be updated to be able to express the android suspend blockers as interactivity constraints (exact name TBD, but probably/dev/cpu_interactivity)Quoted 8 lines
Quoted 2 lines
I think that's not been decided yet precisely enough. I saw a few ideas here and there in the thread, but which of them are we going to follow?
Well, android only needs two states (block and don't block), so that gets translated as 2 s32 values (say 0 and
INT_MAX). I've seen defines likeQOS_INTERACTIVEandQOS_NONE(orQOS_DRECKLYorQOS_MANANA) to describe these, but if all we're arguing over is the define name, that's progress.I think we need separate state constraints for suspend and idle low power modes. On the msm platform only a subset of the interrupts can wake up from the low power mode, so we block the use if the low power mode from idle while other interrupts are enabled. We do not block suspend however if those interrupts are not marked as wakeup interrupts. Most constraints that prevent suspend are not hardware specific and should not prevent entering low power modes from idle. In other words we may need to prevent low power idle modes while allowing suspend, and we may need to prevent suspend while allowing low power idle modes.
Quoted 6 lines
Quoted 2 lines
Well, as I said,
pm_qosis s32 ... it's easy to make the constraint ternary instead of binary.No, they have to be two separate constraints, otherwise a constraint to block suspend would override a constraint to block a low power idle mode or the other way around.
Depends. If you block the system from going into low power idle, does that mean you still want it to be fully suspended?
If yes, then we do have independent constraints. If not, they have a hierarchy:
* Fully Interactive (no low power idle or suspend)
* Partially Interactive (may go into low power idle but not suspend)
* None (may go into low power idle or suspend)
Which is expressable as a ternary constraint.
James
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
2010/6/1 James Bottomley <[email protected]>:
Quoted 50 lines · Arve Hjønnevåg
Quoted 38 lines · James Bottomley
Quoted 28 lines · Rafael J. Wysocki
Quoted 27 lines · James Bottomley
Quoted 18 lines · Matthew Garrett
Quoted 8 lines · James Bottomley
Quoted 6 lines
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has the same problem may be true, but it's not entirely relevant.
Quoted 8 lines
As long as you can set a wakeup timer, an S state is just a C state with side effects. The significant one is that entering an S state stops the process scheduler and any in-kernel timers. I don't think Google care at all about whether suspend is entered through an explicit transition or something hooked into cpuidle - the relevant issue is that they want to be able to express a set of constraints that lets them control whether or not the scheduler keeps on scheduling, and which doesn't let them lose wakeup events in the process.
Quoted 1 line
Exactly, so my understanding of where we currently are is:
Thanks for the recap.
Quoted 3 lines
1.
pm_qoswill be updated to be able to express the android suspend blockers as interactivity constraints (exact name TBD, but probably/dev/cpu_interactivity)Quoted 8 lines
Quoted 2 lines
I think that's not been decided yet precisely enough. I saw a few ideas here and there in the thread, but which of them are we going to follow?
Well, android only needs two states (block and don't block), so that gets translated as 2 s32 values (say 0 and
INT_MAX). I've seen defines likeQOS_INTERACTIVEandQOS_NONE(orQOS_DRECKLYorQOS_MANANA) to describe these, but if all we're arguing over is the define name, that's progress.Quoted 10 lines
I think we need separate state constraints for suspend and idle low power modes. On the msm platform only a subset of the interrupts can wake up from the low power mode, so we block the use if the low power mode from idle while other interrupts are enabled. We do not block suspend however if those interrupts are not marked as wakeup interrupts. Most constraints that prevent suspend are not hardware specific and should not prevent entering low power modes from idle. In other words we may need to prevent low power idle modes while allowing suspend, and we may need to prevent suspend while allowing low power idle modes.
Quoted 2 lines
Well, as I said,
pm_qosis s32 ... it's easy to make the constraint ternary instead of binary.
No, they have to be two separate constraints, otherwise a constraint to block suspend would override a constraint to block a low power idle mode or the other way around.
Quoted 6 lines
Quoted 4 lines
It would also be good to not have an implementation that gets slower and slower the more clients you have. With binary constraints this is trivial.
Well, that's an implementation detail ... ordering the list or using a
True. I think we also need timeout support in the short term though which is also somewhat simpler to implement in an efficient way for binary constraints.
Quoted 5 lines
btree would significantly fix that. However, the most number of constraint users I've seen in android is around 60 ... that's not huge from a kernel linear list perspective, so is this really a concern? ... particularly when most uses don't necessarily change the constrain, so a list search isn't done.
The search is done every time any of them changes.
Quoted 56 lines
Quoted 5 lines
Quoted 5 lines
The other piece they need is the suspend block name, which comes with the stats API, and finally we need to decide what the actual constraint is called (which is how the dev node gets its name) ...
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
2.
pm_qoswill be updated to be callable from atomic context
3.pm_qoswill be updated to export statistics initially closely matching what suspend blockers provides (simple update of the rw interface?)4. It would be useful to change
pm_qos_add_requestto not allocate anything so can add constraints from init functions that currently cannot fail.Sure .. we do that for the delayed work queues, it's just an API which takes the structure as an argument leaving it the responsibility of the caller to free.
Quoted 26 lines
Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
After this is done, the current android suspend block patch becomes a re-expression in kernel space in terms of
pm_qos, with the current userspace wakelocks being adapted by the android framework intopm_qosrequirements expressed to/dev/cpu_interactivity(or whatever name is chosen). Then opportunistic suspend is either a small add-on kernel patch they have in their tree to suspend when the interactivity constraint goes to NONE, or it could be done entirely by a userspace process. Long term this could migrate to the freezer and suspend from idle approach as the various problem timers get fixed.I think the big unresolved issue is the stats extension. For android, we need just a name written along with the value, so we have something to hang the stats off ... current
pm_qosuserspace users just write a value, so the name would be optional. From the kernel, we probably just need an additional API that takes a stats name or NULL if none (pm_qos_add_request_named()?). Then reading the stats could be done by implementing a fops read routine on the misc device.Quoted 7 lines
Quoted 1 line
Is the original idea of having that information in debugfs objectionable?
Well ... debugfs is usually used to get around the sysfs rules. In this case,
pm_qoshas a dev interface ... I don't specifically object to using debugfs, but I don't see any reason to forbid it from being a simple dev read interface either.Quoted 3 lines
We don't currently have a dev interface for stats so this is not an immediate requirement. The suspend blocker debugfs interface is just as good as the proc interface we have for wakelocks.
OK, great ... what actually exports the statistics is just an implementation detail.
James
Signature · 1 line
Arve Hjønnevåg
Quoted 38 lines · Arve Hjønnevåg
Quoted 28 lines · James Bottomley
Quoted 27 lines · Rafael J. Wysocki
Quoted 18 lines · James Bottomley
Quoted 8 lines · Matthew Garrett
Quoted 5 lines · James Bottomley
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has the same problem may be true, but it's not entirely relevant.
Quoted 8 lines
As long as you can set a wakeup timer, an S state is just a C state with side effects. The significant one is that entering an S state stops the process scheduler and any in-kernel timers. I don't think Google care at all about whether suspend is entered through an explicit transition or something hooked into cpuidle - the relevant issue is that they want to be able to express a set of constraints that lets them control whether or not the scheduler keeps on scheduling, and which doesn't let them lose wakeup events in the process.
Quoted 1 line
Exactly, so my understanding of where we currently are is:
Thanks for the recap.
Quoted 3 lines
1.
pm_qoswill be updated to be able to express the android suspend blockers as interactivity constraints (exact name TBD, but probably/dev/cpu_interactivity)Quoted 8 lines
Quoted 2 lines
I think that's not been decided yet precisely enough. I saw a few ideas here and there in the thread, but which of them are we going to follow?
Well, android only needs two states (block and don't block), so that gets translated as 2 s32 values (say 0 and
INT_MAX). I've seen defines likeQOS_INTERACTIVEandQOS_NONE(orQOS_DRECKLYorQOS_MANANA) to describe these, but if all we're arguing over is the define name, that's progress.
Quoted 10 lines
I think we need separate state constraints for suspend and idle low power modes. On the msm platform only a subset of the interrupts can wake up from the low power mode, so we block the use if the low power mode from idle while other interrupts are enabled. We do not block suspend however if those interrupts are not marked as wakeup interrupts. Most constraints that prevent suspend are not hardware specific and should not prevent entering low power modes from idle. In other words we may need to prevent low power idle modes while allowing suspend, and we may need to prevent suspend while allowing low power idle modes.
Well, as I said, pm_qos is s32 ... it's easy to make the constraint ternary instead of binary.
Quoted 3 lines
It would also be good to not have an implementation that gets slower and slower the more clients you have. With binary constraints this is trivial.
Well, that's an implementation detail ... ordering the list or using a btree would significantly fix that. However, the most number of constraint users I've seen in android is around 60 ... that's not huge from a kernel linear list perspective, so is this really a concern? ... particularly when most uses don't necessarily change the constrain, so a list search isn't done.
Quoted 4 lines
Quoted 4 lines
The other piece they need is the suspend block name, which comes with the stats API, and finally we need to decide what the actual constraint is called (which is how the dev node gets its name) ...
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
2.
pm_qoswill be updated to be callable from atomic context
3.pm_qoswill be updated to export statistics initially closely matching what suspend blockers provides (simple update of the rw interface?)4. It would be useful to change
pm_qos_add_requestto not allocate anything so can add constraints from init functions that currently cannot fail.
Sure .. we do that for the delayed work queues, it's just an API which takes the structure as an argument leaving it the responsibility of the caller to free.
Quoted 26 lines
Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
After this is done, the current android suspend block patch becomes a re-expression in kernel space in terms of
pm_qos, with the current userspace wakelocks being adapted by the android framework intopm_qosrequirements expressed to/dev/cpu_interactivity(or whatever name is chosen). Then opportunistic suspend is either a small add-on kernel patch they have in their tree to suspend when the interactivity constraint goes to NONE, or it could be done entirely by a userspace process. Long term this could migrate to the freezer and suspend from idle approach as the various problem timers get fixed.I think the big unresolved issue is the stats extension. For android, we need just a name written along with the value, so we have something to hang the stats off ... current
pm_qosuserspace users just write a value, so the name would be optional. From the kernel, we probably just need an additional API that takes a stats name or NULL if none (pm_qos_add_request_named()?). Then reading the stats could be done by implementing a fops read routine on the misc device.Quoted 7 lines
Quoted 1 line
Is the original idea of having that information in debugfs objectionable?
Well ... debugfs is usually used to get around the sysfs rules. In this case,
pm_qoshas a dev interface ... I don't specifically object to using debugfs, but I don't see any reason to forbid it from being a simple dev read interface either.
Quoted 3 lines
We don't currently have a dev interface for stats so this is not an immediate requirement. The suspend blocker debugfs interface is just as good as the proc interface we have for wakelocks.
OK, great ... what actually exports the statistics is just an implementation detail.
James
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 18 lines · James Bottomley
Quoted 8 lines · Matthew Garrett
Quoted 5 lines · James Bottomley
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has the same problem may be true, but it's not entirely relevant.
Quoted 8 lines
As long as you can set a wakeup timer, an S state is just a C state with side effects. The significant one is that entering an S state stops the process scheduler and any in-kernel timers. I don't think Google care at all about whether suspend is entered through an explicit transition or something hooked into cpuidle - the relevant issue is that they want to be able to express a set of constraints that lets them control whether or not the scheduler keeps on scheduling, and which doesn't let them lose wakeup events in the process.
Quoted 1 line
Exactly, so my understanding of where we currently are is:
Thanks for the recap.
Quoted 3 lines
1.
pm_qoswill be updated to be able to express the android suspend blockers as interactivity constraints (exact name TBD, but probably/dev/cpu_interactivity)
I think that's not been decided yet precisely enough. I saw a few ideas here and there in the thread, but which of them are we going to follow?
Quoted 15 lines
2.
pm_qoswill be updated to be callable from atomic context
3.pm_qoswill be updated to export statistics initially closely matching what suspend blockers provides (simple update of the rw interface?)After this is done, the current android suspend block patch becomes a re-expression in kernel space in terms of
pm_qos, with the current userspace wakelocks being adapted by the android framework intopm_qosrequirements expressed to/dev/cpu_interactivity(or whatever name is chosen). Then opportunistic suspend is either a small add-on kernel patch they have in their tree to suspend when the interactivity constraint goes to NONE, or it could be done entirely by a userspace process. Long term this could migrate to the freezer and suspend from idle approach as the various problem timers get fixed.
Quoted 7 lines
I think the big unresolved issue is the stats extension. For android, we need just a name written along with the value, so we have something to hang the stats off ... current
pm_qosuserspace users just write a value, so the name would be optional. From the kernel, we probably just need an additional API that takes a stats name or NULL if none (pm_qos_add_request_named()?). Then reading the stats could be done by implementing a fops read routine on the misc device.
Is the original idea of having that information in debugfs objectionable?
Rafael
Quoted 28 lines · James Bottomley
Quoted 8 lines · Matthew Garrett
Quoted 5 lines · James Bottomley
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has the same problem may be true, but it's not entirely relevant.
Quoted 8 lines
As long as you can set a wakeup timer, an S state is just a C state with side effects. The significant one is that entering an S state stops the process scheduler and any in-kernel timers. I don't think Google care at all about whether suspend is entered through an explicit transition or something hooked into cpuidle - the relevant issue is that they want to be able to express a set of constraints that lets them control whether or not the scheduler keeps on scheduling, and which doesn't let them lose wakeup events in the process.
Exactly, so my understanding of where we currently are is:
1.
pm_qoswill be updated to be able to express the android suspend blockers as interactivity constraints (exact name TBD, but probably/dev/cpu_interactivity)
2.pm_qoswill be updated to be callable from atomic context
3.pm_qoswill be updated to export statistics initially closely matching what suspend blockers provides (simple update of the rw interface?)
Quoted 9 lines
After this is done, the current android suspend block patch becomes a re-expression in kernel space in terms of
pm_qos, with the current userspace wakelocks being adapted by the android framework intopm_qosrequirements expressed to/dev/cpu_interactivity(or whatever name is chosen). Then opportunistic suspend is either a small add-on kernel patch they have in their tree to suspend when the interactivity constraint goes to NONE, or it could be done entirely by a userspace process. Long term this could migrate to the freezer and suspend from idle approach as the various problem timers get fixed.
This is all nice but, all this does is implement the exact same thing as the wake lock / suspend blocker API as a pm_qos request-class. It leaves the overlapping constraint issue from ISR to user mode in place depending on exactly how the oppertunistic suspend is implemented.
I expect it will be via a notifier on the pm_qos request-class update that would do exactly what the wake lock code does today. just load up an a "suspend_on_non_interactivity" driver that registers for the call back, have it enabled by the user mode PM, and you have the equivelent architecture as what was proposed by the wake lock patches.
it gives the Android guys what they want, without adding a new subsystem, minimizing the changes and makes most of the architecture much more politicaly acceptible.
But doesn't it have the same issues with getting the overlapping constraints right from wake up source to user mode and dealing with the wake up envents in a sane way? Instead of sprinkling suspend-blockers about the kernel we'll sprinkle pm_qos_requests about. I like getting more users of pm_qos, but isn't this the same thing?
Quoted 8 lines
I think the big unresolved issue is the stats extension. For android, we need just a name written along with the value, so we have something to hang the stats off ... current
pm_qosuserspace users just write a value, so the name would be optional. From the kernel, we probably just need an additional API that takes a stats name or NULL if none (pm_qos_add_request_named()?). Then reading the stats could be done by implementing a fops read routine on the misc device.
I don't think the status would be a big deal to add.
However; I am really burned out by this discussion. I am willing to stub this out ASAP if it puts this behind us if the principles in the discussion are in more or less agreement.
--mgross
For the record, I still like my low power event idea, which could coexist with the above.
Quoted 39 lines · mark gross
Quoted 28 lines · James Bottomley
Quoted 8 lines · Matthew Garrett
Quoted 5 lines · James Bottomley
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has the same problem may be true, but it's not entirely relevant.
Quoted 8 lines
As long as you can set a wakeup timer, an S state is just a C state with side effects. The significant one is that entering an S state stops the process scheduler and any in-kernel timers. I don't think Google care at all about whether suspend is entered through an explicit transition or something hooked into cpuidle - the relevant issue is that they want to be able to express a set of constraints that lets them control whether or not the scheduler keeps on scheduling, and which doesn't let them lose wakeup events in the process.
Exactly, so my understanding of where we currently are is:
1.
pm_qoswill be updated to be able to express the android suspend blockers as interactivity constraints (exact name TBD, but probably/dev/cpu_interactivity)
2.pm_qoswill be updated to be callable from atomic context
3.pm_qoswill be updated to export statistics initially closely matching what suspend blockers provides (simple update of the rw interface?)Quoted 9 lines
After this is done, the current android suspend block patch becomes a re-expression in kernel space in terms of
pm_qos, with the current userspace wakelocks being adapted by the android framework intopm_qosrequirements expressed to/dev/cpu_interactivity(or whatever name is chosen). Then opportunistic suspend is either a small add-on kernel patch they have in their tree to suspend when the interactivity constraint goes to NONE, or it could be done entirely by a userspace process. Long term this could migrate to the freezer and suspend from idle approach as the various problem timers get fixed.
Quoted 2 lines
This is all nice but, all this does is implement the exact same thing as the wake lock / suspend blocker API as a
pm_qosrequest-class.
funny that ...
Quoted 3 lines
It
leaves the overlapping constraint issue from ISR to user mode in place depending on exactly how the oppertunistic suspend is implemented.
if the vanilla kernel is simply consuming the pm_qos infrastructure and using suspend from idle, this is irrelevant. As I said, S3 suspend *can* be implemented via a suspend manager process from userspace (the alan stern proposal). However, if I were coding the android kernel, I'd do it as a tiny add on kernel patch. The main goal of making the android kernel close enough to the vanilla kernel for there not to be two separate upstreams for the device driver writers has been achieved regardless of which path is taken.
Quoted 10 lines
I expect it will be via a notifier on the
pm_qosrequest-class update that would do exactly what the wake lock code does today. just load up an a "suspend_on_non_interactivity" driver that registers for the call back, have it enabled by the user mode PM, and you have the equivelent architecture as what was proposed by the wake lock patches.it gives the Android guys what they want, without adding a new subsystem, minimizing the changes and makes most of the architecture much more politicaly acceptible.
Quoted 5 lines
But doesn't it have the same issues with getting the overlapping constraints right from wake up source to user mode and dealing with the wake up envents in a sane way? Instead of sprinkling suspend-blockers about the kernel we'll sprinkle
pm_qos_requestsabout. I like getting more users ofpm_qos, but isn't this the same thing?
Suspend from idle doesn't have the wakeup problem. it only manifests if you want to take the system down via the S states. I think long term, making suspend from idle work for all hardware is the agreed goal, even if android can't implement it today and has to use an S state work around.
Quoted 11 lines
Quoted 7 lines
I think the big unresolved issue is the stats extension. For android, we need just a name written along with the value, so we have something to hang the stats off ... current
pm_qosuserspace users just write a value, so the name would be optional. From the kernel, we probably just need an additional API that takes a stats name or NULL if none (pm_qos_add_request_named()?). Then reading the stats could be done by implementing a fops read routine on the misc device.I don't think the status would be a big deal to add.
Quoted 8 lines
However; I am really burned out by this discussion. I am willing to stub this out ASAP if it puts this behind us if the principles in the discussion are in more or less agreement.
--mgross
For the record, I still like my low power event idea, which could coexist with the above.
The proposal is isomorphic to what I said above ... just s/pm_qos/whatever the lp API is/
James
Quoted 39 lines · mark gross
Quoted 28 lines · James Bottomley
Quoted 8 lines · Matthew Garrett
Quoted 5 lines · James Bottomley
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has the same problem may be true, but it's not entirely relevant.
Quoted 8 lines
As long as you can set a wakeup timer, an S state is just a C state with side effects. The significant one is that entering an S state stops the process scheduler and any in-kernel timers. I don't think Google care at all about whether suspend is entered through an explicit transition or something hooked into cpuidle - the relevant issue is that they want to be able to express a set of constraints that lets them control whether or not the scheduler keeps on scheduling, and which doesn't let them lose wakeup events in the process.
Exactly, so my understanding of where we currently are is:
1.
pm_qoswill be updated to be able to express the android suspend blockers as interactivity constraints (exact name TBD, but probably/dev/cpu_interactivity)
2.pm_qoswill be updated to be callable from atomic context
3.pm_qoswill be updated to export statistics initially closely matching what suspend blockers provides (simple update of the rw interface?)Quoted 9 lines
After this is done, the current android suspend block patch becomes a re-expression in kernel space in terms of
pm_qos, with the current userspace wakelocks being adapted by the android framework intopm_qosrequirements expressed to/dev/cpu_interactivity(or whatever name is chosen). Then opportunistic suspend is either a small add-on kernel patch they have in their tree to suspend when the interactivity constraint goes to NONE, or it could be done entirely by a userspace process. Long term this could migrate to the freezer and suspend from idle approach as the various problem timers get fixed.
Quoted 2 lines
This is all nice but, all this does is implement the exact same thing as the wake lock / suspend blocker API as a
pm_qosrequest-class.
funny that ...
Quoted 3 lines
It
leaves the overlapping constraint issue from ISR to user mode in place depending on exactly how the oppertunistic suspend is implemented.
if the vanilla kernel is simply consuming the pm_qos infrastructure and using suspend from idle, this is irrelevant. As I said, S3 suspend *can* be implemented via a suspend manager process from userspace (the alan stern proposal). However, if I were coding the android kernel, I'd do it as a tiny add on kernel patch. The main goal of making the android kernel close enough to the vanilla kernel for there not to be two separate upstreams for the device driver writers has been achieved regardless of which path is taken.
Quoted 10 lines
I expect it will be via a notifier on the
pm_qosrequest-class update that would do exactly what the wake lock code does today. just load up an a "suspend_on_non_interactivity" driver that registers for the call back, have it enabled by the user mode PM, and you have the equivelent architecture as what was proposed by the wake lock patches.it gives the Android guys what they want, without adding a new subsystem, minimizing the changes and makes most of the architecture much more politicaly acceptible.
Quoted 5 lines
But doesn't it have the same issues with getting the overlapping constraints right from wake up source to user mode and dealing with the wake up envents in a sane way? Instead of sprinkling suspend-blockers about the kernel we'll sprinkle
pm_qos_requestsabout. I like getting more users ofpm_qos, but isn't this the same thing?
Suspend from idle doesn't have the wakeup problem. it only manifests if you want to take the system down via the S states. I think long term, making suspend from idle work for all hardware is the agreed goal, even if android can't implement it today and has to use an S state work around.
Quoted 11 lines
Quoted 7 lines
I think the big unresolved issue is the stats extension. For android, we need just a name written along with the value, so we have something to hang the stats off ... current
pm_qosuserspace users just write a value, so the name would be optional. From the kernel, we probably just need an additional API that takes a stats name or NULL if none (pm_qos_add_request_named()?). Then reading the stats could be done by implementing a fops read routine on the misc device.I don't think the status would be a big deal to add.
Quoted 8 lines
However; I am really burned out by this discussion. I am willing to stub this out ASAP if it puts this behind us if the principles in the discussion are in more or less agreement.
--mgross
For the record, I still like my low power event idea, which could coexist with the above.
The proposal is isomorphic to what I said above ... just s/pm_qos/whatever the lp API is/
James
Quoted 28 lines · James Bottomley
Quoted 8 lines · Matthew Garrett
Quoted 5 lines · James Bottomley
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has the same problem may be true, but it's not entirely relevant.
Quoted 8 lines
As long as you can set a wakeup timer, an S state is just a C state with side effects. The significant one is that entering an S state stops the process scheduler and any in-kernel timers. I don't think Google care at all about whether suspend is entered through an explicit transition or something hooked into cpuidle - the relevant issue is that they want to be able to express a set of constraints that lets them control whether or not the scheduler keeps on scheduling, and which doesn't let them lose wakeup events in the process.
Exactly, so my understanding of where we currently are is:
1.
pm_qoswill be updated to be able to express the android suspend blockers as interactivity constraints (exact name TBD, but probably/dev/cpu_interactivity)
2.pm_qoswill be updated to be callable from atomic context
3.pm_qoswill be updated to export statistics initially closely matching what suspend blockers provides (simple update of the rw interface?)
Quoted 9 lines
After this is done, the current android suspend block patch becomes a re-expression in kernel space in terms of
pm_qos, with the current userspace wakelocks being adapted by the android framework intopm_qosrequirements expressed to/dev/cpu_interactivity(or whatever name is chosen). Then opportunistic suspend is either a small add-on kernel patch they have in their tree to suspend when the interactivity constraint goes to NONE, or it could be done entirely by a userspace process. Long term this could migrate to the freezer and suspend from idle approach as the various problem timers get fixed.
This is all nice but, all this does is implement the exact same thing as the wake lock / suspend blocker API as a pm_qos request-class. It leaves the overlapping constraint issue from ISR to user mode in place depending on exactly how the oppertunistic suspend is implemented.
I expect it will be via a notifier on the pm_qos request-class update that would do exactly what the wake lock code does today. just load up an a "suspend_on_non_interactivity" driver that registers for the call back, have it enabled by the user mode PM, and you have the equivelent architecture as what was proposed by the wake lock patches.
it gives the Android guys what they want, without adding a new subsystem, minimizing the changes and makes most of the architecture much more politicaly acceptible.
But doesn't it have the same issues with getting the overlapping constraints right from wake up source to user mode and dealing with the wake up envents in a sane way? Instead of sprinkling suspend-blockers about the kernel we'll sprinkle pm_qos_requests about. I like getting more users of pm_qos, but isn't this the same thing?
Quoted 8 lines
I think the big unresolved issue is the stats extension. For android, we need just a name written along with the value, so we have something to hang the stats off ... current
pm_qosuserspace users just write a value, so the name would be optional. From the kernel, we probably just need an additional API that takes a stats name or NULL if none (pm_qos_add_request_named()?). Then reading the stats could be done by implementing a fops read routine on the misc device.
I don't think the status would be a big deal to add.
However; I am really burned out by this discussion. I am willing to stub this out ASAP if it puts this behind us if the principles in the discussion are in more or less agreement.
--mgross
For the record, I still like my low power event idea, which could coexist with the above.
Quoted 11 lines · Thomas Gleixner
Quoted 6 lines · James Bottomley
The job of the kernel is to accommodate hardware as best it can ... sometimes it might not be able to, but most of the time it does a pretty good job.
The facts are that C states and S states are different and are entered differently.
That's an x86'ism which is going away. And that's really completely irrelevant for the mobile device space. Can we please stop trying to fix todays x86 based laptop problems? They are simply not fixable.
You're the one mentioning x86, not me. I already explained that some MSM hardware (the G1 for example) has lower power consumption in S3 (which I'm using as an ACPI shorthand for suspend to ram) than any suspend from idle C state. The fact that current x86 hardware has the same problem may be true, but it's not entirely relevant.
Quoted 10 lines
Quoted 9 lines
For some omap hardware, the power consumption in the
lowest C state (with all the ancillary power control) is the same as S3, that's fine, suspend from idle works as well as suspend to ram modulo bad apps. For quite a lot of MSM hardware, the lowest C state power consumption is quite a bit above S3. It's not acceptable to tell those people "tough, your battery runs out in 30 minutes because you bought the wrong hardware". We have to figure out how to get to S3 ... whether this is from idle or some other mechanism is again a discussion point, but not doing it is not an option.
Quoted 10 lines
If you'd have read the answers from Alan carefully, then you'd have noticed that even x86 hardware is getting to the point where OMAP is today. i.e. support of transparent suspend from idle. If that wouldn't happen then x86 would be simply unusable for mobile devices. It's that easy. And we really do _NOT_ care about the existing laptop hardware which does not provide that because it's a lost case. Not only due to the missing (or just disabled) wakeup sources, also due to the fact that you cannot do sensible power management by completely disabling clock and/or power of unused devices in the chipset. There is a damn good reason why the mobile space is _NOT_ x86 based at the moment.
So not at all interested in x86 at the moment.
For MSM hardware, it looks possible to unify the S and C states by doing suspend to ram from idle but I'm not sure how much work that is.
James
Quoted 6 lines · James Bottomley
The job of the kernel is to accommodate hardware as best it can ... sometimes it might not be able to, but most of the time it does a pretty good job.
The facts are that C states and S states are different and are entered differently.
That's an x86'ism which is going away. And that's really completely irrelevant for the mobile device space. Can we please stop trying to fix todays x86 based laptop problems? They are simply not fixable.
Quoted 9 lines
For some omap hardware, the power consumption in the
lowest C state (with all the ancillary power control) is the same as S3, that's fine, suspend from idle works as well as suspend to ram modulo bad apps. For quite a lot of MSM hardware, the lowest C state power consumption is quite a bit above S3. It's not acceptable to tell those people "tough, your battery runs out in 30 minutes because you bought the wrong hardware". We have to figure out how to get to S3 ... whether this is from idle or some other mechanism is again a discussion point, but not doing it is not an option.
If you'd have read the answers from Alan carefully, then you'd have noticed that even x86 hardware is getting to the point where OMAP is today. i.e. support of transparent suspend from idle. If that wouldn't happen then x86 would be simply unusable for mobile devices. It's that easy. And we really do _NOT_ care about the existing laptop hardware which does not provide that because it's a lost case. Not only due to the missing (or just disabled) wakeup sources, also due to the fact that you cannot do sensible power management by completely disabling clock and/or power of unused devices in the chipset. There is a damn good reason why the mobile space is _NOT_ x86 based at the moment.
Thanks,
tglx
Quoted 6 lines · James Bottomley
Quoted 4 lines · Peter Zijlstra
Not using suspend is exactly the point. As Alan has argued, propagating suspend blockers up into all regions of userspace will take much longer than fixing the hardware.
Quoted 7 lines
Strange, that's not what I heard as the possible solution. I thought he was advocating expressing the kernel side of suspend blockers as QoS constraints. Once we have QoS constraints correctly done in the kernel, userspace still has to express its requirements. If the requirements are static, then they can be done from policy files or in some other static way but if they're dynamic, they'll still have to be in the applications ... in about the same places the android wakelocks are.
That's wrong. You only need the explicit dynamic QoS constraints for applications which follow the scheme:
while (1) {
if (event_available())
process_event();
else
do_useless_crap_which_consumes_power();
} which need the following annotation:
while (1) {
block_suspend();
if (event_available()) {
process_event();
unblock_suspend();
} else {
unblock_suspend();
do_useless_crap_which_consumes_power();
}
} Plus the kernel counterpart of drivers which take the suspend blocker in the interrupt handler and release it when the event queue is empty.
So that's done for making polling event handling power "efficient".
Even worse, you need the same "annotation" for non polling mode and it enforces the use of select() because you cannot take a suspend blocker across a blocking read() without adding more invasive interactions to the kernel..
So the "sane" app looks like:
while (1) {
select(); block_suspend(); process_events(); unblock_suspend();
}
I'm really tired of arguing that this promotion of "programming style" is the worst idea ever, so let's look how you can do the same thing QoS based.
s/block_suspend()/qos(INTERACTIVE)/ and
s/unblock_suspend()/qos(NONE)/ and
s/block_magic()/qos_magic()/ in the drivers.
Yes, it's mostly the same, with a subtle difference:
While android can use it in the big hammer approach to disable the existing user initiated suspend via /sys/power/state, the rest of the world can benefit as well in various ways.
- Sane applications which use a blocking event wait can be handled with a static QoS setting simply because a blocking read relies on the QoS state of the underlying I/O system.
- Idle based suspend as the logical consequence of idle states is just a matter of QoS constraint based decisions.
- Untrusted apps can be confined in cgroups. The groups are set to QoS(None) when user land decides that it's time to safe power (e.g. screen lock kicks in)
- QoS states can block applications from I/O when the I/O system is set to a state which is exclusive.
- ...
So that allows to use the same mechanism for more than the android sledge hammer approach and confines the controversial use cases into android specific files without adding a hard to maintain user space interface which would prevent or at least make it hard to do some of the above mentioned things which we want to see implemented.
While I personally disagree with the android approach, I REALLY want to provide them a mechanism to make it work, but not for the price that it actively prevents solutions which are considered to be technically superior by a relevant group of developers/maintainers.
Quoted 7 lines
Quoted 4 lines
You got to realize this is about Linux as a whole, I really don't care one whit about the specific Android case. We want a solution that is generic enough to solve the power consumption problem and makes sense on future hardware.
I don't think anyone disagrees with this. As long as we find a long term solution that satisfies the android case, everyone will be happy.
See above.
Thanks,
tglx
Quoted 85 lines · Thomas Gleixner
Quoted 6 lines · James Bottomley
Quoted 4 lines · Peter Zijlstra
Not using suspend is exactly the point. As Alan has argued, propagating suspend blockers up into all regions of userspace will take much longer than fixing the hardware.
Quoted 7 lines
Strange, that's not what I heard as the possible solution. I thought he was advocating expressing the kernel side of suspend blockers as QoS constraints. Once we have QoS constraints correctly done in the kernel, userspace still has to express its requirements. If the requirements are static, then they can be done from policy files or in some other static way but if they're dynamic, they'll still have to be in the applications ... in about the same places the android wakelocks are.
That's wrong. You only need the explicit dynamic QoS constraints for applications which follow the scheme:
while (1) { if (event_available()) process_event(); else do_useless_crap_which_consumes_power(); }which need the following annotation:
while (1) { block_suspend(); if (event_available()) { process_event(); unblock_suspend(); } else { unblock_suspend(); do_useless_crap_which_consumes_power(); } }Plus the kernel counterpart of drivers which take the suspend blocker in the interrupt handler and release it when the event queue is empty.
So that's done for making polling event handling power "efficient".
Even worse, you need the same "annotation" for non polling mode and it enforces the use of
select()because you cannot take a suspend blocker across a blockingread()without adding more invasive interactions to the kernel..So the "sane" app looks like:
while (1) { select(); block_suspend(); process_events(); unblock_suspend(); }I'm really tired of arguing that this promotion of "programming style" is the worst idea ever, so let's look how you can do the same thing QoS based.
s/block_suspend()/qos(INTERACTIVE)/ and
s/unblock_suspend()/qos(NONE)/ and
s/block_magic()/qos_magic()/ in the drivers.Yes, it's mostly the same, with a subtle difference:
While android can use it in the big hammer approach to disable the existing user initiated suspend via
/sys/power/state, the rest of the world can benefit as well in various ways.- Sane applications which use a blocking event wait can be handled with a static QoS setting simply because a blocking read relies on the QoS state of the underlying I/O system.
- Idle based suspend as the logical consequence of idle states is just a matter of QoS constraint based decisions.
- Untrusted apps can be confined in cgroups. The groups are set to QoS(None) when user land decides that it's time to safe power (e.g. screen lock kicks in)
- QoS states can block applications from I/O when the I/O system is set to a state which is exclusive.
Quoted 7 lines
- ...
So that allows to use the same mechanism for more than the android sledge hammer approach and confines the controversial use cases into android specific files without adding a hard to maintain user space interface which would prevent or at least make it hard to do some of the above mentioned things which we want to see implemented.
I generally agree.
I think the Alan Stern's recent proposal goes along these lines, but it has the advantage of being a bit more specific. ;-)
Thanks,
Rafael
Quoted 11 lines · Rafael J. Wysocki
Quoted 5 lines · Thomas Gleixner
So that allows to use the same mechanism for more than the android sledge hammer approach and confines the controversial use cases into android specific files without adding a hard to maintain user space interface which would prevent or at least make it hard to do some of the above mentioned things which we want to see implemented.
I generally agree.
I think the Alan Stern's recent proposal goes along these lines, but it has the advantage of being a bit more specific. ;-)
Yes, Alan Stern's proposal is going into that direction and I'm not opposed. Just wanted to get the overall picture straight for James :)
Thanks,
tglx
Quoted 85 lines · Thomas Gleixner
Quoted 6 lines · James Bottomley
Quoted 4 lines · Peter Zijlstra
Not using suspend is exactly the point. As Alan has argued, propagating suspend blockers up into all regions of userspace will take much longer than fixing the hardware.
Quoted 7 lines
Strange, that's not what I heard as the possible solution. I thought he was advocating expressing the kernel side of suspend blockers as QoS constraints. Once we have QoS constraints correctly done in the kernel, userspace still has to express its requirements. If the requirements are static, then they can be done from policy files or in some other static way but if they're dynamic, they'll still have to be in the applications ... in about the same places the android wakelocks are.
That's wrong. You only need the explicit dynamic QoS constraints for applications which follow the scheme:
while (1) { if (event_available()) process_event(); else do_useless_crap_which_consumes_power(); }which need the following annotation:
while (1) { block_suspend(); if (event_available()) { process_event(); unblock_suspend(); } else { unblock_suspend(); do_useless_crap_which_consumes_power(); } }Plus the kernel counterpart of drivers which take the suspend blocker in the interrupt handler and release it when the event queue is empty.
So that's done for making polling event handling power "efficient".
Even worse, you need the same "annotation" for non polling mode and it enforces the use of
select()because you cannot take a suspend blocker across a blockingread()without adding more invasive interactions to the kernel..So the "sane" app looks like:
while (1) { select(); block_suspend(); process_events(); unblock_suspend(); }I'm really tired of arguing that this promotion of "programming style" is the worst idea ever, so let's look how you can do the same thing QoS based.
s/block_suspend()/qos(INTERACTIVE)/ and
s/unblock_suspend()/qos(NONE)/ and
s/block_magic()/qos_magic()/ in the drivers.Yes, it's mostly the same, with a subtle difference:
While android can use it in the big hammer approach to disable the existing user initiated suspend via
/sys/power/state, the rest of the world can benefit as well in various ways.- Sane applications which use a blocking event wait can be handled with a static QoS setting simply because a blocking read relies on the QoS state of the underlying I/O system.
- Idle based suspend as the logical consequence of idle states is just a matter of QoS constraint based decisions.
- Untrusted apps can be confined in cgroups. The groups are set to QoS(None) when user land decides that it's time to safe power (e.g. screen lock kicks in)
- QoS states can block applications from I/O when the I/O system is set to a state which is exclusive.
Quoted 7 lines
- ...
So that allows to use the same mechanism for more than the android sledge hammer approach and confines the controversial use cases into android specific files without adding a hard to maintain user space interface which would prevent or at least make it hard to do some of the above mentioned things which we want to see implemented.
I generally agree.
I think the Alan Stern's recent proposal goes along these lines, but it has the advantage of being a bit more specific. ;-)
Thanks,
Rafael
Quoted 57 lines · Thomas Gleixner
Quoted 6 lines · James Bottomley
Quoted 4 lines · Peter Zijlstra
Not using suspend is exactly the point. As Alan has argued, propagating suspend blockers up into all regions of userspace will take much longer than fixing the hardware.
Quoted 7 lines
Strange, that's not what I heard as the possible solution. I thought he was advocating expressing the kernel side of suspend blockers as QoS constraints. Once we have QoS constraints correctly done in the kernel, userspace still has to express its requirements. If the requirements are static, then they can be done from policy files or in some other static way but if they're dynamic, they'll still have to be in the applications ... in about the same places the android wakelocks are.
That's wrong. You only need the explicit dynamic QoS constraints for applications which follow the scheme:
while (1) { if (event_available()) process_event(); else do_useless_crap_which_consumes_power(); }which need the following annotation:
while (1) { block_suspend(); if (event_available()) { process_event(); unblock_suspend(); } else { unblock_suspend(); do_useless_crap_which_consumes_power(); } }Plus the kernel counterpart of drivers which take the suspend blocker in the interrupt handler and release it when the event queue is empty.
So that's done for making polling event handling power "efficient".
Even worse, you need the same "annotation" for non polling mode and it enforces the use of
select()because you cannot take a suspend blocker across a blockingread()without adding more invasive interactions to the kernel..So the "sane" app looks like:
while (1) { select(); block_suspend(); process_events(); unblock_suspend(); }
Quoted 7 lines
I'm really tired of arguing that this promotion of "programming style" is the worst idea ever, so let's look how you can do the same thing QoS based.
s/block_suspend()/qos(INTERACTIVE)/ and
s/unblock_suspend()/qos(NONE)/ and
s/block_magic()/qos_magic()/ in the drivers.
So this is the re-expression in terms of a QoS API that I mentioned ... as I said, I think it's the way forwards. (from the android point of view, it keeps the user space expression in exactly the same place as the original wake locks, or suspend blocks, which is why it looks like a rename to them).
Quoted 13 lines
Yes, it's mostly the same, with a subtle difference:
While android can use it in the big hammer approach to disable the existing user initiated suspend via
/sys/power/state, the rest of the world can benefit as well in various ways.- Sane applications which use a blocking event wait can be handled with a static QoS setting simply because a blocking read relies on the QoS state of the underlying I/O system.
- Idle based suspend as the logical consequence of idle states is just a matter of QoS constraint based decisions.
Quoted 8 lines
- Untrusted apps can be confined in cgroups. The groups are set to QoS(None) when user land decides that it's time to safe power (e.g. screen lock kicks in)
- QoS states can block applications from I/O when the I/O system is set to a state which is exclusive.
- ...
I understand this ... it's effectively the alan stern approach. I've already said that looks like the way forwards.
Quoted 5 lines
So that allows to use the same mechanism for more than the android sledge hammer approach and confines the controversial use cases into android specific files without adding a hard to maintain user space interface which would prevent or at least make it hard to do some of the above mentioned things which we want to see implemented.
Yes, which is why I think something like this can be made to work ... I don't really see that we differ on the broad brush picture. As long as the acceptable implementation accomplishes what everyone wants, I think we're home.
James
Quoted 18 lines
While I personally disagree with the android approach, I REALLY want to provide them a mechanism to make it work, but not for the price that it actively prevents solutions which are considered to be technically superior by a relevant group of developers/maintainers.
Quoted 7 lines
Quoted 4 lines
You got to realize this is about Linux as a whole, I really don't care one whit about the specific Android case. We want a solution that is generic enough to solve the power consumption problem and makes sense on future hardware.
I don't think anyone disagrees with this. As long as we find a long term solution that satisfies the android case, everyone will be happy.
See above.
Thanks,
tglx
Quoted 57 lines · Thomas Gleixner
Quoted 6 lines · James Bottomley
Quoted 4 lines · Peter Zijlstra
Not using suspend is exactly the point. As Alan has argued, propagating suspend blockers up into all regions of userspace will take much longer than fixing the hardware.
Quoted 7 lines
Strange, that's not what I heard as the possible solution. I thought he was advocating expressing the kernel side of suspend blockers as QoS constraints. Once we have QoS constraints correctly done in the kernel, userspace still has to express its requirements. If the requirements are static, then they can be done from policy files or in some other static way but if they're dynamic, they'll still have to be in the applications ... in about the same places the android wakelocks are.
That's wrong. You only need the explicit dynamic QoS constraints for applications which follow the scheme:
while (1) { if (event_available()) process_event(); else do_useless_crap_which_consumes_power(); }which need the following annotation:
while (1) { block_suspend(); if (event_available()) { process_event(); unblock_suspend(); } else { unblock_suspend(); do_useless_crap_which_consumes_power(); } }Plus the kernel counterpart of drivers which take the suspend blocker in the interrupt handler and release it when the event queue is empty.
So that's done for making polling event handling power "efficient".
Even worse, you need the same "annotation" for non polling mode and it enforces the use of
select()because you cannot take a suspend blocker across a blockingread()without adding more invasive interactions to the kernel..So the "sane" app looks like:
while (1) { select(); block_suspend(); process_events(); unblock_suspend(); }
Quoted 7 lines
I'm really tired of arguing that this promotion of "programming style" is the worst idea ever, so let's look how you can do the same thing QoS based.
s/block_suspend()/qos(INTERACTIVE)/ and
s/unblock_suspend()/qos(NONE)/ and
s/block_magic()/qos_magic()/ in the drivers.
So this is the re-expression in terms of a QoS API that I mentioned ... as I said, I think it's the way forwards. (from the android point of view, it keeps the user space expression in exactly the same place as the original wake locks, or suspend blocks, which is why it looks like a rename to them).
Quoted 13 lines
Yes, it's mostly the same, with a subtle difference:
While android can use it in the big hammer approach to disable the existing user initiated suspend via
/sys/power/state, the rest of the world can benefit as well in various ways.- Sane applications which use a blocking event wait can be handled with a static QoS setting simply because a blocking read relies on the QoS state of the underlying I/O system.
- Idle based suspend as the logical consequence of idle states is just a matter of QoS constraint based decisions.
Quoted 8 lines
- Untrusted apps can be confined in cgroups. The groups are set to QoS(None) when user land decides that it's time to safe power (e.g. screen lock kicks in)
- QoS states can block applications from I/O when the I/O system is set to a state which is exclusive.
- ...
I understand this ... it's effectively the alan stern approach. I've already said that looks like the way forwards.
Quoted 5 lines
So that allows to use the same mechanism for more than the android sledge hammer approach and confines the controversial use cases into android specific files without adding a hard to maintain user space interface which would prevent or at least make it hard to do some of the above mentioned things which we want to see implemented.
Yes, which is why I think something like this can be made to work ... I don't really see that we differ on the broad brush picture. As long as the acceptable implementation accomplishes what everyone wants, I think we're home.
James
Quoted 18 lines
While I personally disagree with the android approach, I REALLY want to provide them a mechanism to make it work, but not for the price that it actively prevents solutions which are considered to be technically superior by a relevant group of developers/maintainers.
Quoted 7 lines
Quoted 4 lines
You got to realize this is about Linux as a whole, I really don't care one whit about the specific Android case. We want a solution that is generic enough to solve the power consumption problem and makes sense on future hardware.
I don't think anyone disagrees with this. As long as we find a long term solution that satisfies the android case, everyone will be happy.
See above.
Thanks,
tglx
Quoted 6 lines · James Bottomley
Quoted 4 lines · Peter Zijlstra
Not using suspend is exactly the point. As Alan has argued, propagating suspend blockers up into all regions of userspace will take much longer than fixing the hardware.
Quoted 7 lines
Strange, that's not what I heard as the possible solution. I thought he was advocating expressing the kernel side of suspend blockers as QoS constraints. Once we have QoS constraints correctly done in the kernel, userspace still has to express its requirements. If the requirements are static, then they can be done from policy files or in some other static way but if they're dynamic, they'll still have to be in the applications ... in about the same places the android wakelocks are.
That's wrong. You only need the explicit dynamic QoS constraints for applications which follow the scheme:
while (1) {
if (event_available())
process_event();
else
do_useless_crap_which_consumes_power();
} which need the following annotation:
while (1) {
block_suspend();
if (event_available()) {
process_event();
unblock_suspend();
} else {
unblock_suspend();
do_useless_crap_which_consumes_power();
}
} Plus the kernel counterpart of drivers which take the suspend blocker in the interrupt handler and release it when the event queue is empty.
So that's done for making polling event handling power "efficient".
Even worse, you need the same "annotation" for non polling mode and it enforces the use of select() because you cannot take a suspend blocker across a blocking read() without adding more invasive interactions to the kernel..
So the "sane" app looks like:
while (1) {
select(); block_suspend(); process_events(); unblock_suspend();
}
I'm really tired of arguing that this promotion of "programming style" is the worst idea ever, so let's look how you can do the same thing QoS based.
s/block_suspend()/qos(INTERACTIVE)/ and
s/unblock_suspend()/qos(NONE)/ and
s/block_magic()/qos_magic()/ in the drivers.
Yes, it's mostly the same, with a subtle difference:
While android can use it in the big hammer approach to disable the existing user initiated suspend via /sys/power/state, the rest of the world can benefit as well in various ways.
- Sane applications which use a blocking event wait can be handled with a static QoS setting simply because a blocking read relies on the QoS state of the underlying I/O system.
- Idle based suspend as the logical consequence of idle states is just a matter of QoS constraint based decisions.
- Untrusted apps can be confined in cgroups. The groups are set to QoS(None) when user land decides that it's time to safe power (e.g. screen lock kicks in)
- QoS states can block applications from I/O when the I/O system is set to a state which is exclusive.
- ...
So that allows to use the same mechanism for more than the android sledge hammer approach and confines the controversial use cases into android specific files without adding a hard to maintain user space interface which would prevent or at least make it hard to do some of the above mentioned things which we want to see implemented.
While I personally disagree with the android approach, I REALLY want to provide them a mechanism to make it work, but not for the price that it actively prevents solutions which are considered to be technically superior by a relevant group of developers/maintainers.
Quoted 7 lines
Quoted 4 lines
You got to realize this is about Linux as a whole, I really don't care one whit about the specific Android case. We want a solution that is generic enough to solve the power consumption problem and makes sense on future hardware.
I don't think anyone disagrees with this. As long as we find a long term solution that satisfies the android case, everyone will be happy.
See above.
Thanks,
tglx
Quoted 10 lines · Peter Zijlstra
Quoted 4 lines · On Fri, 2010-05-28 at 00:31 -0400, [email protected] wrote:
Keep in mind, though, that a solution which is acceptable for Android has to include making sure that crappy applications don't cause the battery to get drained. There seem to be some people who seem adamently against this requirement.
Again, Alan, Thomas and myself don't argue against that, what we do however argue against is suspend running apps as a form of power management.
You seem to argue that android is not allowed to use suspend because the hardware we have shipped on can enter the same power state from idle. From my point of view, since we need to support suspend on some hardware we should be allowed to leverage this solution on the better hardware platforms as well if it improves our battery life.
Quoted 3 lines
If you were to read Alan's latest posts he clearly outlines how you can contain crappy apps.
I have not seen any suggestions for how to deal with all our interprocess dependencies when pausing a subset of processes. Without a solution to that we can only pause a subset of the processes we want to pause.
Quoted 15 lines
A combination of weakening QoS guarantees (delaying wakeups etc.) blocking on resources (delay servicing requests) and monitoring resource usage (despite all that its still not idle) and taking affirmative action (shoot it in the head).
If we pose that a well behaved application is one that listens to the environment hints and idles when told to, we can let regular power management kick in and let deep idle states do their thing.
If a bad application ignores those hints and manages to avoid getting blocked on denied resources, we can easily spot it and promote an attitude of violence toward it in the form of SIGXCPU, SIGSTOP, SIGTERM and SIGKILL, possibly coupled with a pop-up dialog -- much like we get today when we try to close a window and the app isn't responding.
Quoted 7 lines
If we then also let the environment maintain a shitlist of crappy apps (those it had to take affirmative action against) and maybe set up a service that allows people to share their results, it provides an incentive to the app developers to fix their thing.
How is this not working?
These solutions do not allow us to use suspend. They may get us closer to the power consumption we get from suspend on the good hardware or even surpass it, but we still need suspend on some hardware, and we would get event better results by using these solutions in addition to suspend compared to using them instead of suspend.
Signature · 1 line
Arve Hjønnevåg
Quoted 4 lines · On Fri, 2010-05-28 at 00:31 -0400, [email protected] wrote:
Keep in mind, though, that a solution which is acceptable for Android has to include making sure that crappy applications don't cause the battery to get drained. There seem to be some people who seem adamently against this requirement.
Again, Alan, Thomas and myself don't argue against that, what we do however argue against is suspend running apps as a form of power management.
If you were to read Alan's latest posts he clearly outlines how you can contain crappy apps.
A combination of weakening QoS guarantees (delaying wakeups etc.) blocking on resources (delay servicing requests) and monitoring resource usage (despite all that its still not idle) and taking affirmative action (shoot it in the head).
If we pose that a well behaved application is one that listens to the environment hints and idles when told to, we can let regular power management kick in and let deep idle states do their thing.
If a bad application ignores those hints and manages to avoid getting blocked on denied resources, we can easily spot it and promote an attitude of violence toward it in the form of SIGXCPU, SIGSTOP, SIGTERM and SIGKILL, possibly coupled with a pop-up dialog -- much like we get today when we try to close a window and the app isn't responding.
If we then also let the environment maintain a shitlist of crappy apps (those it had to take affirmative action against) and maybe set up a service that allows people to share their results, it provides an incentive to the app developers to fix their thing.
How is this not working?
Quoted 2 lines
Keep in mind, though, that a solution which is acceptable for Android has to include making sure that crappy applications don't cause the
Ted if you are speaking for Android do you think you should post from a google address or with a google .sig ?
Quoted 5 lines
battery to get drained. There seem to be some people who seem adamently against this requirement. From the Android folks' perspective, this is part of what is required to have an open app store, as opposed to one where each application has to be carefully screened and approved ala the Apple iPhone App Store.
The other vendors appear to be managing nicely without magic blockers. I conjecture therefore there are other solutions.
Quoted 2 lines
We need to agree on the requirements up front, because otherwise this is going to be a waste of everyone's time.
This is why I am trying to understand the problem properly.
Quoted 3 lines
And if we can't get agreement on requirements, I'd suggest appealing this whole thing to Linus. Either he'll agree to the requirements and/or the existing implementation, in which case we can move on with
The existing implementation has been comprehensively rejected by half the x86 maintainers and scheduler people to start with. That's a fairly big 'No'.
Quoted 4 lines
our lives, or he'll say no, in which case it will be blately obvious that it was Linux developer community who rejected the Android approach, despite a fairly large amount of effort trying to get something that satisfies *all* of the various LKML developers who have
Ted save the politicing and blame mongering for management meetings please.
If we don't have a solution it means that between us we couldn't find a viable solution. Maybe there isn't one, maybe we missed it. It's as much 'google rejects kernel approach' as 'kernel rejects google approach' and more importantly its actually 'we (cumulative) were not smart enough between us to figure it out'
Quoted 9 lines
P.S. Keep in mind how this looks from an outsider's perspective; an embedded manufacturer spends a fairly large amount of time answering one set of review comments, and a few weeks later, more people pop up, and make a much deeper set of complaints, and request that the current implementation be completely thrown out and that someone new be designed from scratch --- and the new design isn't even going to meet all of the requirements that the embedded manufacturer thought were necessary. Is it any wonder a number of embedded developers have decided it's Just Too Hard to Work With the LKML?
In some cases it is easier to do stuff yourself than work with others. One of the conditions of working in a public space is that you do so without harming others. This is why in much of the western world you can drive a car around your own land without a licence but must have one to drive on a public road. This is why a restuarant must meet different food standards to a home kitchen. This is why the kernel standards are higher than what you go off and do in private.
Android is a very unique and extremely narrow environment. If it really is special enough to need its own kernel fork it isn't the first case for that and it's not a problem. The GPL is quite happy to encourage this. Time will then answer the questions because in 3 years time either every non Google phone will be kicking butt without suspend blockers, or every phone vendor using Linux with a traditional user space will be demanding them.
Alan
Quoted 2 lines · Alan Cox
The other vendors appear to be managing nicely without magic blockers. I conjecture therefore there are other solutions.
Actually, no. A badly behaved application will kill the N900's battery life. Nobody else has "managed nicely" - they've just made life harder for application developers and users, which may have something to do with the relative levels of market adoption of Maemo and Android. I'm not aware of any form of resource management framework in MeeGo either, so as far as I know it'll have exactly the same problem.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 10 lines · ext Matthew Garrett
Quoted 3 lines · Alan Cox
The other vendors appear to be managing nicely without magic blockers. I conjecture therefore there are other solutions.
Actually, no. A badly behaved application will kill the N900's battery life. Nobody else has "managed nicely" - they've just made life harder for application developers and users, which may have something to do with the relative levels of market adoption of Maemo and Android. I'm not aware of any form of resource management framework in MeeGo either, so as far as I know it'll have exactly the same problem.
It's true that a braindead app can kill the battery.
However we provide a version of powertop that is tailored to the N900, there is a nokia energy profiler meant to give graphical representation of the battery current, there is htop available and you can even get the processor activity visualized on the leftmost and rightmost keyboard backlight LEDS, when in RD mode and with screen blanked.
I would advice you to not start debating on company strategies, this is not the right place.
Otherwise I'll have to ask what's the expected threshold of devices sold with broken sw design to get automatic admission into the mainline kernel source tree.
But this is not the direction we want to take.
Notice also that we _do_ have a store and official repository where apps are monitored for sanity, also with feedback from users and their help to promote new apps to trusted state.
Former Maemo 6, now MeeGo do introduce resource management from security POV, but that will also have the side effect of discriminating between signers.
igor
Quoted 14 lines · Igor Stoppa
Quoted 10 lines · ext Matthew Garrett
Quoted 2 lines · Alan Cox
The other vendors appear to be managing nicely without magic blockers. I conjecture therefore there are other solutions.
Actually, no. A badly behaved application will kill the N900's battery life. Nobody else has "managed nicely" - they've just made life harder for application developers and users, which may have something to do with the relative levels of market adoption of Maemo and Android. I'm not aware of any form of resource management framework in MeeGo either, so as far as I know it'll have exactly the same problem.
It's true that a braindead app can kill the battery.
Quoted 8 lines
However we provide a version of powertop that is tailored to the N900, there is a nokia energy profiler meant to give graphical representation of the battery current, there is htop available and you can even get the processor activity visualized on the leftmost and rightmost keyboard backlight LEDS, when in RD mode and with screen blanked.
I would advice you to not start debating on company strategies, this is not the right place.
At a certain point, if one side of the argument is using "N900 / OMAP3 works just fine as is" (which has certainly been the case stated by a number of folks throughout these discussions), I think it's a little unrealistic to express shock that somebody argues the opposing point.
I've personally avoided commenting on specific power management issues or properties of competitive platforms because it can easily be viewed as rather rude or unprofessional. (though in theory we all could benefit from any improvements to the kernel regarding power management, no?).
I am quite willing to state that on both MSM and OMAP based Android platforms, we've found that the suspend blocker model allows us to obtain a lower average power draw than if we don't use it -- Mike Chan provided some numbers earlier in another thread in the trivial device idle case, the win is of course much larger in the case of several poorly behaved apps being active.
I do think that everyone involved agrees that it is beneficial to educate users and developers in hopes that users will understand that some apps are non-optimal and developers will be encouraged to write better apps.
I think we also all agree that striving to obtain the lowest power state at all times through cpu frequency scaling, runtime pm, drivers that aggressively clock/power down when idle, etc is a worthy goal. Some have argued that suspend blockers may deter further development in these areas, but I think this is unlikely -- power usage while the device is active and the user is interacting with it is just as critical as when it's not being used interactively. We (Android) certainly pursue aggressive low power optimization in both states.
There appears to be some disagreement in terms of what one should do in the face of poorly behaved applications. The Android approach has been to both gather as much data as possible for education of user and developer and to mitigate the impact of poorly written apps on endusers, goals which are aided by the suspend blocker model.
A reality of a mass market device with a completely open and unrestricted application development and distribution ecosystem is that there will be plenty of non-optimal apps available to users (Sturgeon's Law applies everywhere, after all). Worse yet, many of these non-optimal apps may be beloved by users for various reasons. I think there's value in trying to do the best you can power-wise even in the face of such horrible foes as the dreaded Bouncing Cows App that Matthew is fond of citing as an example.
Brian
Quoted 5 lines · ext Brian Swetland
At a certain point, if one side of the argument is using "N900 / OMAP3 works just fine as is" (which has certainly been the case stated by a number of folks throughout these discussions), I think it's a little unrealistic to express shock that somebody argues the opposing point.
The problem lies in the definition of the goal and means to achieve it. We do rely on repositories to discriminate on the quality of applications. As I stated some are accessible and run by our community.
So, in this scenario, it works well enough.
Quoted 6 lines
I've personally avoided commenting on specific power management issues or properties of competitive platforms because it can easily be viewed as rather rude or unprofessional. (though in theory we all could benefit from any improvements to the kernel regarding power management, no?).
What I consider plain wrong i to claim that since there are this many units out, some code should be merged. A company needs to cut corners sometimes when making a product but this should not affect upstream code.
Quoted 7 lines
I am quite willing to state that on both MSM and OMAP based Android platforms, we've found that the suspend blocker model allows us to obtain a lower average power draw than if we don't use it -- Mike Chan provided some numbers earlier in another thread in the trivial device idle case, the win is of course much larger in the case of several poorly behaved apps being active.
That's very good. But if it is done in a conceptually flawed way, some better solution should be considered for upstream merge.
[snip]
Quoted 8 lines
A reality of a mass market device with a completely open and unrestricted application development and distribution ecosystem is that there will be plenty of non-optimal apps available to users (Sturgeon's Law applies everywhere, after all). Worse yet, many of these non-optimal apps may be beloved by users for various reasons. I think there's value in trying to do the best you can power-wise even in the face of such horrible foes as the dreaded Bouncing Cows App that Matthew is fond of citing as an example.
Sure.
I simply disagree on the methods proposed (suspend_blockers) and some of the rationale used for promoting them (volume of otherwise unsupported units).
igor
Quoted 3 lines · Igor Stoppa
What I consider plain wrong i to claim that since there are this many units out, some code should be merged.
I've never suggested that we should get a get-out-of-code-review-free card or be automatically merged based on shipping volume.
Hell, I never thought we should even bother trying to merge wakelocks upstream, because I assumed that they'd be hated for not being the linux way (tm). Greg KH and others have spent a bunch of time shouting at me (or Google) that we should be doing this, and here we are giving it a go. At this point we've spent more engineering time on revising this one patchset (10 revisions to address various rounds of feedback) and discussion of it than we have on rebasing our working kernel trees to roughly every other linux release from 2.6.16 to 2.6.32 (which became much easier after switching to git).
Quoted 2 lines
A company needs to cut corners sometimes when making a product but this should not affect upstream code.
I will disagree that wakelocks are "cutting corners" (we certainly have some corner cutting code in our trees, because yeah, ship is compromise, but I don't believe wakelocks are an example). They're a real solution for real problems faced on real devices. Obviously not a solution that everyone here likes, and maybe they'll never end up in mainline as a result, but so far I haven't seen a counter proposed solution that seems to solve the same problem, avoid races, and be simpler/cleaner (at least to my eyes).
Quoted 9 lines
Quoted 6 lines
I am quite willing to state that on both MSM and OMAP based Android platforms, we've found that the suspend blocker model allows us to obtain a lower average power draw than if we don't use it -- Mike Chan provided some numbers earlier in another thread in the trivial device idle case, the win is of course much larger in the case of several poorly behaved apps being active.
That's very good. But if it is done in a conceptually flawed way, some better solution should be considered for upstream merge.
How is it flawed? Serious question.
Brian
Quoted 2 lines · ext Brian Swetland
How is it flawed? Serious question.
I would avoid repeating all the good arguments given so far, but to make it short:
* I believe runtime PM is a much better starting point (at least for the type of HW targeted at mobile devices) because it mimics an always-on system toward userspace, which requires less disruption in the way apps are designed
* QoS is closer to the apps pov: fps if it is a media player or a game, transfer speed if it is a file manager, bandwidth if it is a network app, etc The app is required to express its opinion by using a format that it understands better and is less system dependent. Actually the kernel should only be concerned with 2 parameters at most for any given operation: latency and bandwidth/throughput
* Some form of resource management is needed as trust mechanism to discriminate "trusted" vs untrusted apps that can give reliable info (but in your case you should give trust to whom prevents the suspend)
* Most of this could be done in userspace with the kernel merely providing the means to enforce the decisions taken by the userspace manager.
* The kernel wouldn't even have to try to outsmart the "evil application writer"
igor
Quoted 10 lines · Igor Stoppa
Quoted 1 line · ext Brian Swetland
How is it flawed? Serious question.
I would avoid repeating all the good arguments given so far, but to make it short:
* I believe runtime PM is a much better starting point (at least for the type of HW targeted at mobile devices) because it mimics an always-on system toward userspace, which requires less disruption in the way apps are designed
I agree.
If I understand correctly, if we have a perfect user-space that only does work when strictly needed and trying to do it in bursts, then we would be reaching the lowest power state, and there would be no need for suspend. The problem is that Android's user-space is pretty far from that, so they said "let's segregate user-space and go to lower power mode anyway".
If that's true, then this problem can be fixed in user-space, and in fact, it already is on N900. Good behaving applications are asynchronous, use g_timeout_add_seconds() to align bursts of work at the same second intervals, and don't do polls directly, but use GLib's mainloop. Same as in GNOME desktop. It seems there are other methods to align multiple processes for longer periods of time, but that code is closed and I can't find much information.
Quoted 7 lines
* QoS is closer to the apps pov: fps if it is a media player or a game, transfer speed if it is a file manager, bandwidth if it is a network app, etc
The app is required to express its opinion by using a format that it understands better and is less system dependent.
Actually the kernel should only be concerned with 2 parameters at most for any given operation: latency and bandwidth/throughput
I think this information can be obtained dynamically while the application is running, and perhaps the limits can be stored. It would be pretty difficult for the applications to give this kind of information because there are so many variables.
For example, an media player can tell you: this clip has 24 fps, but if the user is moving the time slider, the fps would increase and drop very rapidly, and how much depends at least on the container format and type of seek.
A game or a telephony app could tell you "I need real-time priority" but so much as giving the details of latency and bandwidth? I find that very unlikely.
Cheers.
Signature · 1 line
Felipe Contreras
Quoted 12 lines · On Sat, 29 May 2010 02:42:35 +0300 Felipe Contreras…
Quoted 10 lines · Igor Stoppa
Quoted 1 line · ext Brian Swetland
How is it flawed? Serious question.
I would avoid repeating all the good arguments given so far, but to make it short:
* I believe runtime PM is a much better starting point (at least for the type of HW targeted at mobile devices) because it mimics an always-on system toward userspace, which requires less disruption in the way apps are designed
Quoted 8 lines
I agree.
If I understand correctly, if we have a perfect user-space that only does work when strictly needed and trying to do it in bursts, then we would be reaching the lowest power state, and there would be no need for suspend. The problem is that Android's user-space is pretty far from that, so they said "let's segregate user-space and go to lower power mode anyway".
This has already been mentioned (who knew?): Android doesn't want to depend on userspace for this.
Cheers,
Flo
Quoted 24 lines · On Sat, 29 May 2010 10:28:19 +0200 Florian Mickler <[email protected]> wrote:
Quoted 12 lines · On Sat, 29 May 2010 02:42:35 +0300 Felipe Contreras…
Quoted 10 lines · Igor Stoppa
Quoted 1 line · ext Brian Swetland
How is it flawed? Serious question.
I would avoid repeating all the good arguments given so far, but to make it short:
* I believe runtime PM is a much better starting point (at least for the type of HW targeted at mobile devices) because it mimics an always-on system toward userspace, which requires less disruption in the way apps are designed
Quoted 8 lines
I agree.
If I understand correctly, if we have a perfect user-space that only does work when strictly needed and trying to do it in bursts, then we would be reaching the lowest power state, and there would be no need for suspend. The problem is that Android's user-space is pretty far from that, so they said "let's segregate user-space and go to lower power mode anyway".
Quoted 2 lines
This has already been mentioned (who knew?): Android doesn't want to depend on userspace for this.
there is an implicit "all of userspace" in there, btw..
Quoted 3 lines
Cheers,
Flo
Quoted 24 lines · On Sat, 29 May 2010 10:28:19 +0200 Florian Mickler <[email protected]> wrote:
Quoted 12 lines · On Sat, 29 May 2010 02:42:35 +0300 Felipe Contreras…
Quoted 10 lines · Igor Stoppa
Quoted 1 line · ext Brian Swetland
How is it flawed? Serious question.
I would avoid repeating all the good arguments given so far, but to make it short:
* I believe runtime PM is a much better starting point (at least for the type of HW targeted at mobile devices) because it mimics an always-on system toward userspace, which requires less disruption in the way apps are designed
Quoted 8 lines
I agree.
If I understand correctly, if we have a perfect user-space that only does work when strictly needed and trying to do it in bursts, then we would be reaching the lowest power state, and there would be no need for suspend. The problem is that Android's user-space is pretty far from that, so they said "let's segregate user-space and go to lower power mode anyway".
Quoted 2 lines
This has already been mentioned (who knew?): Android doesn't want to depend on userspace for this.
there is an implicit "all of userspace" in there, btw..
Quoted 3 lines
Cheers,
Flo
--
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 12 lines · On Sat, 29 May 2010 02:42:35 +0300 Felipe Contreras…
Quoted 10 lines · Igor Stoppa
Quoted 1 line · ext Brian Swetland
How is it flawed? Serious question.
I would avoid repeating all the good arguments given so far, but to make it short:
* I believe runtime PM is a much better starting point (at least for the type of HW targeted at mobile devices) because it mimics an always-on system toward userspace, which requires less disruption in the way apps are designed
Quoted 8 lines
I agree.
If I understand correctly, if we have a perfect user-space that only does work when strictly needed and trying to do it in bursts, then we would be reaching the lowest power state, and there would be no need for suspend. The problem is that Android's user-space is pretty far from that, so they said "let's segregate user-space and go to lower power mode anyway".
This has already been mentioned (who knew?): Android doesn't want to depend on userspace for this.
Cheers,
Flo
Quoted 2 lines · ext Felipe Contreras
I think this information can be obtained dynamically while the application is running,
yes, that was the idea
Quoted 9 lines
and perhaps the limits can be stored. It would
be pretty difficult for the applications to give this kind of information because there are so many variables.For example, an media player can tell you: this clip has 24 fps, but if the user is moving the time slider, the fps would increase and drop very rapidly, and how much depends at least on the container format and type of seek.
I doubt that belongs to typical QoS. Maybe the target could be to be able to decode a sequence of i-frames?
Quoted 4 lines
A game or a telephony app could tell you "I need real-time priority" but so much as giving the details of latency and bandwidth? I find that very unlikely.
from my gaming days the games were still evaluated in fps ... maybe i made the wrong assumption?
A telephony app should still be able to tell if it's dropping audio frames.
In all cases there should be some device independent limit - like: what is the sort of degradation that is considered acceptable by the typical user?
Tuning might be offered, but at least this should set some sane set of defaults.
igor
Quoted 11 lines · Igor Stoppa
Quoted 2 lines · ext Felipe Contreras
I think this information can be obtained dynamically while the application is running,
yes, that was the idea
Quoted 4 lines
and perhaps the limits can be stored. It would
be pretty difficult for the applications to give this kind of information because there are so many variables.
Quoted 8 lines
Quoted 5 lines
For example, an media player can tell you: this clip has 24 fps, but if the user is moving the time slider, the fps would increase and drop very rapidly, and how much depends at least on the container format and type of seek.
I doubt that belongs to typical QoS. Maybe the target could be to be able to decode a sequence of i-frames?
I'm not sure what you mean. I-frames comes usually one per second, so if you only decode I-frames, your experience would be really bad. Moreover, you don't know beforehand when an I-frame is coming, only when it's there, and some clips can have only one I-frame at the beginning.
Quoted 7 lines
Quoted 4 lines
A game or a telephony app could tell you "I need real-time priority" but so much as giving the details of latency and bandwidth? I find that very unlikely.
from my gaming days the games were still evaluated in fps ... maybe i made the wrong assumption?
Yes, the more fps, the better, but you calculate that by counting the amount of frames rendered over a period of time; you know the fps *after* the fact.
Quoted 1 line
A telephony app should still be able to tell if it's dropping audio frames.
Yes, which could be unrelated to PM, like bad network conditions, but yeah, it should also be able to tell if the problem is with the application itself (audio decoder too slow).
Quoted 2 lines
In all cases there should be some device independent limit - like: what is the sort of degradation that is considered acceptable by the typical user?
It is easy to tell after the PM actions have been made, as in "wait! I'm not able to perform gimme more power!". But I don't see how that could be done _before_ the PM actions are done.
From all the QoS proposals I have seen here, and considering that some people said that suspend blockers could be a specific case of QOS, I don't think people have been considering QoS as something to state _after_.
Quoted 2 lines
Tuning might be offered, but at least this should set some sane set of defaults.
Huh? Defaults in what units, based on what, and when and how to update?
Cheers.
Signature · 1 line
Felipe Contreras
Quoted 11 lines · Igor Stoppa
Quoted 2 lines · ext Felipe Contreras
I think this information can be obtained dynamically while the application is running,
yes, that was the idea
Quoted 4 lines
and perhaps the limits can be stored. It would
be pretty difficult for the applications to give this kind of information because there are so many variables.
Quoted 8 lines
Quoted 5 lines
For example, an media player can tell you: this clip has 24 fps, but if the user is moving the time slider, the fps would increase and drop very rapidly, and how much depends at least on the container format and type of seek.
I doubt that belongs to typical QoS. Maybe the target could be to be able to decode a sequence of i-frames?
I'm not sure what you mean. I-frames comes usually one per second, so if you only decode I-frames, your experience would be really bad. Moreover, you don't know beforehand when an I-frame is coming, only when it's there, and some clips can have only one I-frame at the beginning.
Quoted 7 lines
Quoted 4 lines
A game or a telephony app could tell you "I need real-time priority" but so much as giving the details of latency and bandwidth? I find that very unlikely.
from my gaming days the games were still evaluated in fps ... maybe i made the wrong assumption?
Yes, the more fps, the better, but you calculate that by counting the amount of frames rendered over a period of time; you know the fps *after* the fact.
Quoted 1 line
A telephony app should still be able to tell if it's dropping audio frames.
Yes, which could be unrelated to PM, like bad network conditions, but yeah, it should also be able to tell if the problem is with the application itself (audio decoder too slow).
Quoted 2 lines
In all cases there should be some device independent limit - like: what is the sort of degradation that is considered acceptable by the typical user?
It is easy to tell after the PM actions have been made, as in "wait! I'm not able to perform gimme more power!". But I don't see how that could be done _before_ the PM actions are done.
From all the QoS proposals I have seen here, and considering that some people said that suspend blockers could be a specific case of QOS, I don't think people have been considering QoS as something to state _after_.
Quoted 2 lines
Tuning might be offered, but at least this should set some sane set of defaults.
Huh? Defaults in what units, based on what, and when and how to update?
Cheers.
Signature · 5 lines
Felipe Contreras _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 2 lines · ext Felipe Contreras
I think this information can be obtained dynamically while the application is running,
yes, that was the idea
Quoted 9 lines
and perhaps the limits can be stored. It would
be pretty difficult for the applications to give this kind of information because there are so many variables.For example, an media player can tell you: this clip has 24 fps, but if the user is moving the time slider, the fps would increase and drop very rapidly, and how much depends at least on the container format and type of seek.
I doubt that belongs to typical QoS. Maybe the target could be to be able to decode a sequence of i-frames?
Quoted 4 lines
A game or a telephony app could tell you "I need real-time priority" but so much as giving the details of latency and bandwidth? I find that very unlikely.
from my gaming days the games were still evaluated in fps ... maybe i made the wrong assumption?
A telephony app should still be able to tell if it's dropping audio frames.
In all cases there should be some device independent limit - like: what is the sort of degradation that is considered acceptable by the typical user?
Tuning might be offered, but at least this should set some sane set of defaults.
igor
Quoted 10 lines · Igor Stoppa
Quoted 1 line · ext Brian Swetland
How is it flawed? Serious question.
I would avoid repeating all the good arguments given so far, but to make it short:
* I believe runtime PM is a much better starting point (at least for the type of HW targeted at mobile devices) because it mimics an always-on system toward userspace, which requires less disruption in the way apps are designed
I agree.
If I understand correctly, if we have a perfect user-space that only does work when strictly needed and trying to do it in bursts, then we would be reaching the lowest power state, and there would be no need for suspend. The problem is that Android's user-space is pretty far from that, so they said "let's segregate user-space and go to lower power mode anyway".
If that's true, then this problem can be fixed in user-space, and in fact, it already is on N900. Good behaving applications are asynchronous, use g_timeout_add_seconds() to align bursts of work at the same second intervals, and don't do polls directly, but use GLib's mainloop. Same as in GNOME desktop. It seems there are other methods to align multiple processes for longer periods of time, but that code is closed and I can't find much information.
Quoted 7 lines
* QoS is closer to the apps pov: fps if it is a media player or a game, transfer speed if it is a file manager, bandwidth if it is a network app, etc
The app is required to express its opinion by using a format that it understands better and is less system dependent.
Actually the kernel should only be concerned with 2 parameters at most for any given operation: latency and bandwidth/throughput
I think this information can be obtained dynamically while the application is running, and perhaps the limits can be stored. It would be pretty difficult for the applications to give this kind of information because there are so many variables.
For example, an media player can tell you: this clip has 24 fps, but if the user is moving the time slider, the fps would increase and drop very rapidly, and how much depends at least on the container format and type of seek.
A game or a telephony app could tell you "I need real-time priority" but so much as giving the details of latency and bandwidth? I find that very unlikely.
Cheers.
Signature · 5 lines
Felipe Contreras _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 2 lines · ext Brian Swetland
How is it flawed? Serious question.
I would avoid repeating all the good arguments given so far, but to make it short:
* I believe runtime PM is a much better starting point (at least for the type of HW targeted at mobile devices) because it mimics an always-on system toward userspace, which requires less disruption in the way apps are designed
* QoS is closer to the apps pov: fps if it is a media player or a game, transfer speed if it is a file manager, bandwidth if it is a network app, etc
The app is required to express its opinion by using a format that it understands better and is less system dependent.
Actually the kernel should only be concerned with 2 parameters at most for any given operation: latency and bandwidth/throughput
* Some form of resource management is needed as trust mechanism to discriminate "trusted" vs untrusted apps that can give reliable info (but in your case you should give trust to whom prevents the suspend)
* Most of this could be done in userspace with the kernel merely providing the means to enforce the decisions taken by the userspace manager.
* The kernel wouldn't even have to try to outsmart the "evil application writer"
igor
Quoted 4 lines
Quoted 2 lines
That's very good. But if it is done in a conceptually flawed way, some better solution should be considered for upstream merge.
How is it flawed? Serious question.
- It means changing drivers and quite a few apps
- It doesn't solve the problem of rogue apps if they end up owning locks
- It puts the deep knowledge of the platform in the applications
- It gives the apps control of the action taken not policy indication
- It doesn't resolve the problem of synchronization of take/releases stopping any suspend
- The kernel parts are not generically useful, merely effective for solving a specific problem right now - even things like VM migration to/from phones seems to break it
- It inverts the whole logic the kernel is following and trend it is following that suspend is simply a very deep idle (with implementations merged)
If it was a localised turd I wouldn't worry. There are plenty df deep unmentionables hidden away enirely in platform specific code that deal with everything from stoned hardware engineers to crazed software stack implementations.
Here is a question back the other way perhaps
- If the existing kerne was almostl entirely read only, or you had to pay a large fee per line of code changed outside your own driver how would you implement the wakelock/suspend blocker API ?
Because if you take the path that 'we want wakelockers' that is essentially the question you have to answer. How do you merge it so that nobody outside of your driver and maybe a spot of arch code knows about it. You are permitted a couple of sneaky substitions of core function bits in headers.
Right now bits are going to leak out over the kernel which is the cause of friction. At the point it's invisible to everyone else they cease to be stakeholders so you don't have keep them happy. You've only got a couple in your patches but its painfully obvious from Matthew and your comments you'll end up needing a ton more and these will get everywhere as Android grows hardware platforms and CPU support as phones become more featureful and PC like. The moment a phone grows a USB base station with hub for example the entire USB stack becomes burdened with them. Matthew has already indicated networking needs them. Good luck with Dave Miller on that.
I'm asking questions to look for generalised approaches, or even better doing it without new kernel stuff in the first place, but it's not the only way.
Alan
Quoted 4 lines
Quoted 2 lines
That's very good. But if it is done in a conceptually flawed way, some better solution should be considered for upstream merge.
How is it flawed? Serious question.
- It means changing drivers and quite a few apps
- It doesn't solve the problem of rogue apps if they end up owning locks
- It puts the deep knowledge of the platform in the applications
- It gives the apps control of the action taken not policy indication
- It doesn't resolve the problem of synchronization of take/releases stopping any suspend
- The kernel parts are not generically useful, merely effective for solving a specific problem right now - even things like VM migration to/from phones seems to break it
- It inverts the whole logic the kernel is following and trend it is following that suspend is simply a very deep idle (with implementations merged)
If it was a localised turd I wouldn't worry. There are plenty df deep unmentionables hidden away enirely in platform specific code that deal with everything from stoned hardware engineers to crazed software stack implementations.
Here is a question back the other way perhaps
- If the existing kerne was almostl entirely read only, or you had to pay a large fee per line of code changed outside your own driver how would you implement the wakelock/suspend blocker API ?
Because if you take the path that 'we want wakelockers' that is essentially the question you have to answer. How do you merge it so that nobody outside of your driver and maybe a spot of arch code knows about it. You are permitted a couple of sneaky substitions of core function bits in headers.
Right now bits are going to leak out over the kernel which is the cause of friction. At the point it's invisible to everyone else they cease to be stakeholders so you don't have keep them happy. You've only got a couple in your patches but its painfully obvious from Matthew and your comments you'll end up needing a ton more and these will get everywhere as Android grows hardware platforms and CPU support as phones become more featureful and PC like. The moment a phone grows a USB base station with hub for example the entire USB stack becomes burdened with them. Matthew has already indicated networking needs them. Good luck with Dave Miller on that.
I'm asking questions to look for generalised approaches, or even better doing it without new kernel stuff in the first place, but it's not the only way.
Alan
Quoted 3 lines · Igor Stoppa
What I consider plain wrong i to claim that since there are this many units out, some code should be merged.
I've never suggested that we should get a get-out-of-code-review-free card or be automatically merged based on shipping volume.
Hell, I never thought we should even bother trying to merge wakelocks upstream, because I assumed that they'd be hated for not being the linux way (tm). Greg KH and others have spent a bunch of time shouting at me (or Google) that we should be doing this, and here we are giving it a go. At this point we've spent more engineering time on revising this one patchset (10 revisions to address various rounds of feedback) and discussion of it than we have on rebasing our working kernel trees to roughly every other linux release from 2.6.16 to 2.6.32 (which became much easier after switching to git).
Quoted 2 lines
A company needs to cut corners sometimes when making a product but this should not affect upstream code.
I will disagree that wakelocks are "cutting corners" (we certainly have some corner cutting code in our trees, because yeah, ship is compromise, but I don't believe wakelocks are an example). They're a real solution for real problems faced on real devices. Obviously not a solution that everyone here likes, and maybe they'll never end up in mainline as a result, but so far I haven't seen a counter proposed solution that seems to solve the same problem, avoid races, and be simpler/cleaner (at least to my eyes).
Quoted 9 lines
Quoted 6 lines
I am quite willing to state that on both MSM and OMAP based Android platforms, we've found that the suspend blocker model allows us to obtain a lower average power draw than if we don't use it -- Mike Chan provided some numbers earlier in another thread in the trivial device idle case, the win is of course much larger in the case of several poorly behaved apps being active.
That's very good. But if it is done in a conceptually flawed way, some better solution should be considered for upstream merge.
How is it flawed? Serious question.
Brian
Quoted 5 lines · Igor Stoppa
What I consider plain wrong i to claim that since there are this many units out, some code should be merged.
A company needs to cut corners sometimes when making a product but this should not affect upstream code.
Linus will disagree with you there. Linus *has* merged code on the basis that it is shipping in distributions, regardless of the fact that some developers objected to it. Sometimes "perfect" should not be the enemy of "good enough" shipping code.
For example, I used to point out that we shipped PCMCIA code in mainline that had a 10% chance of crashing the system if you ejected the card. NetBSD was proud to say that their code was so iron-clad and well designed that it always did the right thing, even if you ejected while it was busily passing network traffic. Unfortunately, NetBSD had working PCMCIA support 3 years later than Linux. So it used to be that we were the technical pragmatists (and Linus fortunately, still very much is the pragmatists, while others were the hard-line perfectionists. It seems to me we've started getting some of the NetBSD attitude infecting LKML, and IMHO, that's unfortunate.
We've rewritten our networking stack, 3 or 4 times, depending on how you count. And sometimes shipping in products counts for a lot. It doesn't count for everything, and it isn't a get-out-of-jail card, for sure. But if it's a hard problem, and we have something that's good enough, maybe the right call is to merge it now, and we'll rework things to make something better and more general later. Ultimately that's a call only Linus can make.
If everyone agrees we're making progress, and we can let this 100+ mail thread keep going. But if anyone feels that we are spinning endlessly without making forward progress (which is after all the same criteria the OOM killer uses, no? :-), people should remember that sometimes Linus *has* ended arguments that have gone on too long by making a "merge or kill" decision.
- Ted
Quoted 5 lines · ext [email protected] wrote:
Linus will disagree with you there. Linus *has* merged code on the basis that it is shipping in distributions, regardless of the fact that some developers objected to it. Sometimes "perfect" should not be the enemy of "good enough" shipping code.
"good enough" is very subjective, in this case
Quoted 2 lines
If everyone agrees we're making progress, and we can let this 100+ mail thread keep going.
I have seen very good proposals for saner solutions.
Is that progress?
igor
Quoted 5 lines · ext [email protected] wrote:
Linus will disagree with you there. Linus *has* merged code on the basis that it is shipping in distributions, regardless of the fact that some developers objected to it. Sometimes "perfect" should not be the enemy of "good enough" shipping code.
"good enough" is very subjective, in this case
Quoted 2 lines
If everyone agrees we're making progress, and we can let this 100+ mail thread keep going.
I have seen very good proposals for saner solutions.
Is that progress?
igor
Quoted 3 lines · Igor Stoppa
I have seen very good proposals for saner solutions.
Is that progress?
The proposals so far involve either redefining the problem space or being inherently racey. It may be that we can redefine the problem space in such a way that everyone's happy, but it's not possible to do so by fiat.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 10 lines · Matthew Garrett
Quoted 3 lines · Igor Stoppa
I have seen very good proposals for saner solutions.
Is that progress?
The proposals so far involve either redefining the problem space or being inherently racey. It may be that we can redefine the problem space in such a way that everyone's happy, but it's not possible to do so by fiat.
I think the suggestion that has the closet fit with what we're trying to accomplish is Ingo's (or perhaps Ingo's explanation of Alan's):
http://lkml.org/lkml/2010/5/28/106 where it's implemented as a constraint of some sort.
Arve points out that qos constraint objects could work (but not if specifically tied to apps): http://lkml.org/lkml/2010/5/28/120 though he suggests that "latency" constraints don't represent this as well as "state" constraints.
Though if you look at it that way, then suspend_blockers become qos constraint objects, but their implementation and usage remain pretty much the same as we have now, which does not address Alan's concern regarding code turning up in drivers, etc. I'm not sure how you can solve this problem (avoiding races around entering/exiting the suspend or suspend-like state) without having a means for drivers to prevent entry to that state.
I need to think more about the cgroups approach, but I'm pretty sure it still suffers from wakeup race situations, and due to the complexity of userspace (at least ours), I suspect it would risk livelock/deadlock/priority-inversion style issues due to interaction between different processes in different groups.
Brian
Quoted 5 lines · Brian Swetland
I need to think more about the cgroups approach, but I'm pretty sure it still suffers from wakeup race situations, and due to the complexity of userspace (at least ours), I suspect it would risk livelock/deadlock/priority-inversion style issues due to interaction between different processes in different groups.
I think the cgroups approach works if you assume that applications that consume wakeup events can be trusted to otherwise be good citizens. Everything that has no direct interest in wakeup events (except the generic Android userspace) can be frozen, and you can use the scheduler to make everything else Just Work. That's a rather big if, but you've got a better idea of the state of the Android app base than I do.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 5 lines · Brian Swetland
I need to think more about the cgroups approach, but I'm pretty sure it still suffers from wakeup race situations, and due to the complexity of userspace (at least ours), I suspect it would risk livelock/deadlock/priority-inversion style issues due to interaction between different processes in different groups.
I think the cgroups approach works if you assume that applications that consume wakeup events can be trusted to otherwise be good citizens. Everything that has no direct interest in wakeup events (except the generic Android userspace) can be frozen, and you can use the scheduler to make everything else Just Work. That's a rather big if, but you've got a better idea of the state of the Android app base than I do.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 4 lines
I think the suggestion that has the closet fit with what we're trying to accomplish is Ingo's (or perhaps Ingo's explanation of Alan's):
http://lkml.org/lkml/2010/5/28/106 where it's implemented as a constraint of some sort.
I think we ended up in the same place on our own.
Quoted 4 lines
Arve points out that qos constraint objects could work (but not if specifically tied to apps): http://lkml.org/lkml/2010/5/28/120 though he suggests that "latency" constraints don't represent this as well as "state" constraints.
With latency you have an "I don't give damn" latency in your model which we could describe as infinite or "manyana" perhaps.
Quoted 7 lines
Though if you look at it that way, then
suspend_blockersbecome qos constraint objects, but their implementation and usage remain pretty much the same as we have now, which does not address Alan's concern regarding code turning up in drivers, etc. I'm not sure how you can solve this problem (avoiding races around entering/exiting the suspend or suspend-like state) without having a means for drivers to prevent entry to that state.
I am much much less concerned about general expressions of constraint appearing in drivers. One of my early mails gave a list of other people/projects/problems that need them - from hard real time, to high speed serial on low end embedded to virtualisation.
They fix a general problem in terms of a driver specific item. We end up making changes around the tree but we make everyone happy not just Android. Also we are isolating policy properly. The apps and drivers say "I have these needs", the power manager figures out how to meet them.
Where it gets ugly is if you start trying to have drivers giving an app a guarantee which the app then magically has to know to dispose of.
If you are prepared to exclude untrusted apps from perfectly reliable event reporting (ie from finger to application action) that doesn't seem to be a neccessity anyway.
Quoted 2 lines
livelock/deadlock/priority-inversion style issues due to interaction between different processes in different groups.
Priority inversion with the cgroup case is like synchronization effects with the suspend blockers - its a real ugly problem and one that is known to be hard to fix if you let it happen so I agree there.
Quoted 7 lines · Alan Cox
Quoted 4 lines
Arve points out that qos constraint objects could work (but not if specifically tied to apps): http://lkml.org/lkml/2010/5/28/120 though he suggests that "latency" constraints don't represent this as well as "state" constraints.
With latency you have an "I don't give damn" latency in your model which we could describe as infinite or "manyana" perhaps.
I think Arve's concern was the representation of the "I care, but only a little" or "just low enough to ensure threads must run" level which is what suspend blockers would map to (low enough to ensure we shouldn't halt the world but not necessarily implying a hard latency constraint beyond that).
Quoted 13 lines
Quoted 7 lines
Though if you look at it that way, then
suspend_blockersbecome qos constraint objects, but their implementation and usage remain pretty much the same as we have now, which does not address Alan's concern regarding code turning up in drivers, etc. I'm not sure how you can solve this problem (avoiding races around entering/exiting the suspend or suspend-like state) without having a means for drivers to prevent entry to that state.I am much much less concerned about general expressions of constraint appearing in drivers. One of my early mails gave a list of other people/projects/problems that need them - from hard real time, to high speed serial on low end embedded to virtualisation.
Quoted 4 lines
They fix a general problem in terms of a driver specific item. We end up making changes around the tree but we make everyone happy not just Android. Also we are isolating policy properly. The apps and drivers say "I have these needs", the power manager figures out how to meet them.
That makes sense -- and as I've mentioned elsewhere, we're really not super picky about naming -- if it turns out that wakelocks/suspendblockers were shorthand for "request a qos constraint that ensures that threads are running", we'll be able to get things done just as well as we do now.
Quoted 2 lines
Where it gets ugly is if you start trying to have drivers giving an app a guarantee which the app then magically has to know to dispose of.
Yeah -- which is something we've avoided in the existing model with overlapping wakelocks during handoff between domains.
- input service is select()ing on input devices
- when select() returns it grabs a wakelock, reads events, passes them on, releases the wakelock
- the event subsystem can then safely drop its "should be running threads" constraint as soon as the last event is read because it has no queues for userspace to drain, but the overlapping wakelock prevents the system from immediately snapping back to sleep
Quoted 3 lines
If you are prepared to exclude untrusted apps from perfectly reliable event reporting (ie from finger to application action) that doesn't seem to be a neccessity anyway.
Currently in the Android userpace only trusted (system) apps can directly obtain wakelocks -- arbitrary apps obtain them via rpc to a trusted system service (which ensures the app has been granted permission to do this and tracks usage for accountability to user/developer).
Brian
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 7 lines · Alan Cox
Quoted 4 lines
Arve points out that qos constraint objects could work (but not if specifically tied to apps): http://lkml.org/lkml/2010/5/28/120 though he suggests that "latency" constraints don't represent this as well as "state" constraints.
With latency you have an "I don't give damn" latency in your model which we could describe as infinite or "manyana" perhaps.
I think Arve's concern was the representation of the "I care, but only a little" or "just low enough to ensure threads must run" level which is what suspend blockers would map to (low enough to ensure we shouldn't halt the world but not necessarily implying a hard latency constraint beyond that).
Quoted 13 lines
Quoted 7 lines
Though if you look at it that way, then
suspend_blockersbecome qos constraint objects, but their implementation and usage remain pretty much the same as we have now, which does not address Alan's concern regarding code turning up in drivers, etc. I'm not sure how you can solve this problem (avoiding races around entering/exiting the suspend or suspend-like state) without having a means for drivers to prevent entry to that state.I am much much less concerned about general expressions of constraint appearing in drivers. One of my early mails gave a list of other people/projects/problems that need them - from hard real time, to high speed serial on low end embedded to virtualisation.
Quoted 4 lines
They fix a general problem in terms of a driver specific item. We end up making changes around the tree but we make everyone happy not just Android. Also we are isolating policy properly. The apps and drivers say "I have these needs", the power manager figures out how to meet them.
That makes sense -- and as I've mentioned elsewhere, we're really not super picky about naming -- if it turns out that wakelocks/suspendblockers were shorthand for "request a qos constraint that ensures that threads are running", we'll be able to get things done just as well as we do now.
Quoted 2 lines
Where it gets ugly is if you start trying to have drivers giving an app a guarantee which the app then magically has to know to dispose of.
Yeah -- which is something we've avoided in the existing model with overlapping wakelocks during handoff between domains.
- input service is select()ing on input devices
- when select() returns it grabs a wakelock, reads events, passes them on, releases the wakelock
- the event subsystem can then safely drop its "should be running threads" constraint as soon as the last event is read because it has no queues for userspace to drain, but the overlapping wakelock prevents the system from immediately snapping back to sleep
Quoted 3 lines
If you are prepared to exclude untrusted apps from perfectly reliable event reporting (ie from finger to application action) that doesn't seem to be a neccessity anyway.
Currently in the Android userpace only trusted (system) apps can directly obtain wakelocks -- arbitrary apps obtain them via rpc to a trusted system service (which ensures the app has been granted permission to do this and tracks usage for accountability to user/developer).
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 5 lines
I think Arve's concern was the representation of the "I care, but only a little" or "just low enough to ensure threads must run" level which is what suspend blockers would map to (low enough to ensure we shouldn't halt the world but not necessarily implying a hard latency constraint beyond that).
That's why I suggested "manyana" (can't get accents for mañana in a define) or perhaps "dreckly"[1]. They are both words that mean "at some point" but in a very very vague and 'relax it'll happen eventually' sense.
More importantly it's policy. It's a please meet this constraint guide to the PM layer - not a you must do as say even if its stupid.
Quoted 10 lines
Quoted 4 lines
They fix a general problem in terms of a driver specific item. We end up making changes around the tree but we make everyone happy not just Android. Also we are isolating policy properly. The apps and drivers say "I have these needs", the power manager figures out how to meet them.
That makes sense -- and as I've mentioned elsewhere, we're really not super picky about naming -- if it turns out that wakelocks/suspendblockers were shorthand for "request a qos constraint that ensures that threads are running", we'll be able to get things done just as well as we do now.
Cool. I think they are or at least they are close enough that nobody will notice the join ;)
Quoted 5 lines
Quoted 2 lines
Where it gets ugly is if you start trying to have drivers giving an app a guarantee which the app then magically has to know to dispose of.
Yeah -- which is something we've avoided in the existing model with overlapping wakelocks during handoff between domains.
I'm not sure avoided is the right description - its there in all its identical ugliness in wakelock magic
If you treat QoS guarantees as a wakelock for your purposes (which is just fine, drivers and apps give you policy, you use it how you like) then you could write the paragraph below substituting the word 'guarantee' for 'wakelock' So in that sense the mess is the same because in both cases you are trying to suspend active tasks rather than asking the task to behave and then taking remedial action with offenders.
Quoted 7 lines
- input service is select()ing on input devices
- whenselect()returns it grabs a wakelock, reads events, passes them on, releases the wakelock
- the event subsystem can then safely drop its "should be running threads" constraint as soon as the last event is read because it has no queues for userspace to drain, but the overlapping wakelock prevents the system from immediately snapping back to sleep
The conventional PC model is 'we don't go back into sleep proper fast enough for that race to occur'. It's hard to see how you change it. An app->device "thank you for that event, I enjoyed it very much and have finished with it" message moves the underlying event management and QoS knowledge into he driver proper but doesn't really change the interface.
Quoted 9 lines
Quoted 3 lines
If you are prepared to exclude untrusted apps from perfectly reliable event reporting (ie from finger to application action) that doesn't seem to be a neccessity anyway.
Currently in the Android userpace only trusted (system) apps can directly obtain wakelocks -- arbitrary apps obtain them via rpc to a trusted system service (which ensures the app has been granted permission to do this and tracks usage for accountability to user/developer).
Clearly that would continue to work out.
Alan
[1] Dreckly being used in Cornwall, as one friend put it 'Like manãna but without that dreadful sense of urgency'
--
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 · Alan Cox
Quoted 5 lines
I think Arve's concern was the representation of the "I care, but only a little" or "just low enough to ensure threads must run" level which is what suspend blockers would map to (low enough to ensure we shouldn't halt the world but not necessarily implying a hard latency constraint beyond that).
That's why I suggested "manyana" (can't get accents for mañana in a define) or perhaps "dreckly"[1]. They are both words that mean "at some point" but in a very very vague and 'relax it'll happen eventually' sense.
A USA-style equivalent phrase might be "Real Soon Now". Except that it conveys a strong implication that the event will never happen...
Quoted 8 lines
Quoted 5 lines
That makes sense -- and as I've mentioned elsewhere, we're really not super picky about naming -- if it turns out that wakelocks/suspendblockers were shorthand for "request a qos constraint that ensures that threads are running", we'll be able to get things done just as well as we do now.
Cool. I think they are or at least they are close enough that nobody will notice the join ;)
Why are suspend blockers needed if you're going to put all untrusted apps in a cgroup and freeze/stop them? Or is that not what you're planning to do?
ALan Stern
Quoted 9 lines · Alan Cox
Quoted 5 lines
I think Arve's concern was the representation of the "I care, but only a little" or "just low enough to ensure threads must run" level which is what suspend blockers would map to (low enough to ensure we shouldn't halt the world but not necessarily implying a hard latency constraint beyond that).
That's why I suggested "manyana" (can't get accents for mañana in a define) or perhaps "dreckly"[1]. They are both words that mean "at some point" but in a very very vague and 'relax it'll happen eventually' sense.
A USA-style equivalent phrase might be "Real Soon Now". Except that it conveys a strong implication that the event will never happen...
Quoted 8 lines
Quoted 5 lines
That makes sense -- and as I've mentioned elsewhere, we're really not super picky about naming -- if it turns out that wakelocks/suspendblockers were shorthand for "request a qos constraint that ensures that threads are running", we'll be able to get things done just as well as we do now.
Cool. I think they are or at least they are close enough that nobody will notice the join ;)
Why are suspend blockers needed if you're going to put all untrusted apps in a cgroup and freeze/stop them? Or is that not what you're planning to do?
ALan Stern
--
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 6 lines · Alan Cox
Quoted 5 lines
I think Arve's concern was the representation of the "I care, but only a little" or "just low enough to ensure threads must run" level which is what suspend blockers would map to (low enough to ensure we shouldn't halt the world but not necessarily implying a hard latency constraint beyond that).
Quoted 6 lines
That's why I suggested "manyana" (can't get accents for mañana in a define) or perhaps "dreckly"[1]. They are both words that mean "at some point" but in a very very vague and 'relax it'll happen eventually' sense.
More importantly it's policy. It's a please meet this constraint guide to the PM layer - not a you must do as say even if its stupid.
Huh?
Quoted 39 lines
Quoted 11 lines
Quoted 5 lines
They fix a general problem in terms of a driver specific item. We end up making changes around the tree but we make everyone happy not just Android. Also we are isolating policy properly. The apps and drivers say "I have these needs", the power manager figures out how to meet them.
That makes sense -- and as I've mentioned elsewhere, we're really not super picky about naming -- if it turns out that wakelocks/suspendblockers were shorthand for "request a qos constraint that ensures that threads are running", we'll be able to get things done just as well as we do now.
Cool. I think they are or at least they are close enough that nobody will notice the join ;)
Quoted 5 lines
Quoted 2 lines
Where it gets ugly is if you start trying to have drivers giving an app a guarantee which the app then magically has to know to dispose of.
Yeah -- which is something we've avoided in the existing model with overlapping wakelocks during handoff between domains.
I'm not sure avoided is the right description - its there in all its identical ugliness in wakelock magic
If you treat QoS guarantees as a wakelock for your purposes (which is just fine, drivers and apps give you policy, you use it how you like) then you could write the paragraph below substituting the word 'guarantee' for 'wakelock' So in that sense the mess is the same because in both cases you are trying to suspend active tasks rather than asking the task to behave and then taking remedial action with offenders.
Quoted 7 lines
- input service is select()ing on input devices
- whenselect()returns it grabs a wakelock, reads events, passes them on, releases the wakelock
- the event subsystem can then safely drop its "should be running threads" constraint as soon as the last event is read because it has no queues for userspace to drain, but the overlapping wakelock prevents the system from immediately snapping back to sleep
Quoted 2 lines
The conventional PC model is 'we don't go back into sleep proper fast enough for that race to occur'.
This is the same as saying these two threads don't run often enough to need a mutex around their critical section. Just because you have not been bitten by the race yet, does not mean it does not exist.
Quoted 1 line
It's hard to see how you change it. An
If each layer prevents suspend while it knows there are pending events you don't have a race. Suspend blockers lets you do this.
Quoted 4 lines
app->device"thank you for that event, I enjoyed it very much and have finished with it" message moves the underlying event management and QoS knowledge into he driver proper but doesn't really change the interface.
Yes you can do this, and it it how the android alarm driver works, but we found the select()/poll(), block suspend, read event, process event then unblock suspend sequence cleaner (especially for interfaces that can return more than one event at a time). Kernel suspend blocker lets you implement the alarm driver model, adding user-space suspend blockers lets you implement the second.
Quoted 22 lines
Quoted 9 lines
Quoted 3 lines
If you are prepared to exclude untrusted apps from perfectly reliable event reporting (ie from finger to application action) that doesn't seem to be a neccessity anyway.
Currently in the Android userpace only trusted (system) apps can directly obtain wakelocks -- arbitrary apps obtain them via rpc to a trusted system service (which ensures the app has been granted permission to do this and tracks usage for accountability to user/developer).
Clearly that would continue to work out.
Alan
[1] Dreckly being used in Cornwall, as one friend put it 'Like manãna but without that dreadful sense of urgency'--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 1 line
Arve Hjønnevåg
Quoted 6 lines · Alan Cox
Quoted 5 lines
I think Arve's concern was the representation of the "I care, but only a little" or "just low enough to ensure threads must run" level which is what suspend blockers would map to (low enough to ensure we shouldn't halt the world but not necessarily implying a hard latency constraint beyond that).
Quoted 6 lines
That's why I suggested "manyana" (can't get accents for mañana in a define) or perhaps "dreckly"[1]. They are both words that mean "at some point" but in a very very vague and 'relax it'll happen eventually' sense.
More importantly it's policy. It's a please meet this constraint guide to the PM layer - not a you must do as say even if its stupid.
Huh?
Quoted 39 lines
Quoted 11 lines
Quoted 5 lines
They fix a general problem in terms of a driver specific item. We end up making changes around the tree but we make everyone happy not just Android. Also we are isolating policy properly. The apps and drivers say "I have these needs", the power manager figures out how to meet them.
That makes sense -- and as I've mentioned elsewhere, we're really not super picky about naming -- if it turns out that wakelocks/suspendblockers were shorthand for "request a qos constraint that ensures that threads are running", we'll be able to get things done just as well as we do now.
Cool. I think they are or at least they are close enough that nobody will notice the join ;)
Quoted 5 lines
Quoted 2 lines
Where it gets ugly is if you start trying to have drivers giving an app a guarantee which the app then magically has to know to dispose of.
Yeah -- which is something we've avoided in the existing model with overlapping wakelocks during handoff between domains.
I'm not sure avoided is the right description - its there in all its identical ugliness in wakelock magic
If you treat QoS guarantees as a wakelock for your purposes (which is just fine, drivers and apps give you policy, you use it how you like) then you could write the paragraph below substituting the word 'guarantee' for 'wakelock' So in that sense the mess is the same because in both cases you are trying to suspend active tasks rather than asking the task to behave and then taking remedial action with offenders.
Quoted 7 lines
- input service is select()ing on input devices
- whenselect()returns it grabs a wakelock, reads events, passes them on, releases the wakelock
- the event subsystem can then safely drop its "should be running threads" constraint as soon as the last event is read because it has no queues for userspace to drain, but the overlapping wakelock prevents the system from immediately snapping back to sleep
Quoted 2 lines
The conventional PC model is 'we don't go back into sleep proper fast enough for that race to occur'.
This is the same as saying these two threads don't run often enough to need a mutex around their critical section. Just because you have not been bitten by the race yet, does not mean it does not exist.
Quoted 1 line
It's hard to see how you change it. An
If each layer prevents suspend while it knows there are pending events you don't have a race. Suspend blockers lets you do this.
Quoted 4 lines
app->device"thank you for that event, I enjoyed it very much and have finished with it" message moves the underlying event management and QoS knowledge into he driver proper but doesn't really change the interface.
Yes you can do this, and it it how the android alarm driver works, but we found the select()/poll(), block suspend, read event, process event then unblock suspend sequence cleaner (especially for interfaces that can return more than one event at a time). Kernel suspend blocker lets you implement the alarm driver model, adding user-space suspend blockers lets you implement the second.
Quoted 22 lines
Quoted 9 lines
Quoted 3 lines
If you are prepared to exclude untrusted apps from perfectly reliable event reporting (ie from finger to application action) that doesn't seem to be a neccessity anyway.
Currently in the Android userpace only trusted (system) apps can directly obtain wakelocks -- arbitrary apps obtain them via rpc to a trusted system service (which ensures the app has been granted permission to do this and tracks usage for accountability to user/developer).
Clearly that would continue to work out.
Alan
[1] Dreckly being used in Cornwall, as one friend put it 'Like manãna but without that dreadful sense of urgency'--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 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 5 lines
I think Arve's concern was the representation of the "I care, but only a little" or "just low enough to ensure threads must run" level which is what suspend blockers would map to (low enough to ensure we shouldn't halt the world but not necessarily implying a hard latency constraint beyond that).
That's why I suggested "manyana" (can't get accents for mañana in a define) or perhaps "dreckly"[1]. They are both words that mean "at some point" but in a very very vague and 'relax it'll happen eventually' sense.
More importantly it's policy. It's a please meet this constraint guide to the PM layer - not a you must do as say even if its stupid.
Quoted 10 lines
Quoted 4 lines
They fix a general problem in terms of a driver specific item. We end up making changes around the tree but we make everyone happy not just Android. Also we are isolating policy properly. The apps and drivers say "I have these needs", the power manager figures out how to meet them.
That makes sense -- and as I've mentioned elsewhere, we're really not super picky about naming -- if it turns out that wakelocks/suspendblockers were shorthand for "request a qos constraint that ensures that threads are running", we'll be able to get things done just as well as we do now.
Cool. I think they are or at least they are close enough that nobody will notice the join ;)
Quoted 5 lines
Quoted 2 lines
Where it gets ugly is if you start trying to have drivers giving an app a guarantee which the app then magically has to know to dispose of.
Yeah -- which is something we've avoided in the existing model with overlapping wakelocks during handoff between domains.
I'm not sure avoided is the right description - its there in all its identical ugliness in wakelock magic
If you treat QoS guarantees as a wakelock for your purposes (which is just fine, drivers and apps give you policy, you use it how you like) then you could write the paragraph below substituting the word 'guarantee' for 'wakelock' So in that sense the mess is the same because in both cases you are trying to suspend active tasks rather than asking the task to behave and then taking remedial action with offenders.
Quoted 7 lines
- input service is select()ing on input devices
- whenselect()returns it grabs a wakelock, reads events, passes them on, releases the wakelock
- the event subsystem can then safely drop its "should be running threads" constraint as soon as the last event is read because it has no queues for userspace to drain, but the overlapping wakelock prevents the system from immediately snapping back to sleep
The conventional PC model is 'we don't go back into sleep proper fast enough for that race to occur'. It's hard to see how you change it. An app->device "thank you for that event, I enjoyed it very much and have finished with it" message moves the underlying event management and QoS knowledge into he driver proper but doesn't really change the interface.
Quoted 9 lines
Quoted 3 lines
If you are prepared to exclude untrusted apps from perfectly reliable event reporting (ie from finger to application action) that doesn't seem to be a neccessity anyway.
Currently in the Android userpace only trusted (system) apps can directly obtain wakelocks -- arbitrary apps obtain them via rpc to a trusted system service (which ensures the app has been granted permission to do this and tracks usage for accountability to user/developer).
Clearly that would continue to work out.
Alan
[1] Dreckly being used in Cornwall, as one friend put it 'Like manãna but without that dreadful sense of urgency'
Quoted 6 lines · Brian Swetland
Quoted 4 lines · Alan Cox
They fix a general problem in terms of a driver specific item. We end up making changes around the tree but we make everyone happy not just Android. Also we are isolating policy properly. The apps and drivers say "I have these needs", the power manager figures out how to meet them.
Quoted 7 lines
That makes sense -- and as I've mentioned elsewhere, we're really not super picky about naming -- if it turns out that wakelocks/suspendblockers were shorthand for "request a qos constraint that ensures that threads are running", we'll be able to get things done just as well as we do now.
From my reading of this thread, there's a lot of overlap between
suspendblockers and constraints. Many use cases are served equally well with one or the other, except for one: a case where an event that should ultimately wake the system triggers a code execution path (or data flow path) that wanders through a user-space full of complex interacting processes where the kernel (and maybe even the processes) can't see it.
Suspend-blockers in user-space handle this by making such code/data paths visible to the kernel. An all-kernel constraint-based approach has no way to see the user-space paths, so the system will end up trying to sleep when it should be waking up.
Wait, what? Surely all the user-space code handling such events is running under a PM-QoS constraint that says "don't sleep if this process is runnable," so the system won't go to sleep. Presumably all other processes which don't handle wakeup events will be running under a PM-QoS constraint that says "do sleep even if this process is runnable."
That's true, except for one common case: a process is drawing things on the display on behalf of other processes, and that drawing process can't have the "don't sleep" constraint because if it did the system would seem to be continuously busy and never go to sleep. Any process that is handling a critical event but also needs to talk to the display process will end up being not-runnable, and the system may go to sleep before the display process wakes up. So we need another PM-QoS constraint that says "don't sleep even if this process isn't runnable, because some *other* runnable process might do something that makes our critical process runnable again." The critical event handling app would switch to this PM-QoS constraint until it had received an ack from whatever it talked to in user-space, then switch back to the "don't sleep if this process is runnable" state until a new event comes in.
So, three constraint policies should do it (*):
1. Do sleep even if this process is runnable,
2. Don't sleep if this process is runnable, and
3. Don't sleep even if this process isn't runnable, as long as at least one other runnable process exists somewhere on the system.
"Runnable" would include tasks that are literally runnable as well as tasks that aren't runnable but are presumed to be imminently runnable (e.g. blocked on timers that are going to expire before the wakeup latency).
"Sleep" means going into any state where the scheduler doesn't run any tasks. That covers most CPU idle modes, deep power saving states, ACPI suspend, or whatever.
(*) or you could define a "please stop wasting CPU" message in user-space, and send that message to anything in user-space which has a PM-QoS constraint better than "none" whenever something in user-space thinks the user has gone away. Then the display process can have constraint #2, and we don't need #3.
Quoted 3 lines · Zygo Blaxell
From my reading of this thread, there's a lot of overlap between suspendblockers and constraints. Many use cases are served equally well with one or the other,
If using suspend-blockers,
Please explain to me how:
- I will avoid the cpu going into some idle state for which the wakeup latency is larger than my RT app fancies?
- to avoid some tasks from being serviced by the filesystems whilst others are? (ionice on steroids).
- does my sporadic task (with strict bandwidth budget) not suffer bandwidth inversion?
suspend blockers do a bit of each of that, but none of it in a usable fashion.
Quoted 3 lines · Zygo Blaxell
From my reading of this thread, there's a lot of overlap between suspendblockers and constraints. Many use cases are served equally well with one or the other,
If using suspend-blockers,
Please explain to me how:
- I will avoid the cpu going into some idle state for which the wakeup latency is larger than my RT app fancies?
- to avoid some tasks from being serviced by the filesystems whilst others are? (ionice on steroids).
- does my sporadic task (with strict bandwidth budget) not suffer bandwidth inversion?
suspend blockers do a bit of each of that, but none of it in a usable fashion.
Quoted 4 lines · Peter Zijlstra
Quoted 3 lines · Zygo Blaxell
From my reading of this thread, there's a lot of overlap between suspendblockers and constraints. Many use cases are served equally well with one or the other,
Oops, I apparently meant "many use cases *of suspendblockers* are served equally well with one or the other."
Quoted 4 lines
If using suspend-blockers,
Please explain to me how:
- I will avoid the cpu going into some idle state for which the wakeup latency is larger than my RT app fancies?
...though I'd think you could do that by holding a suspendblocker, thus preventing the CPU from going into any idle state at all.
There's four likely outcomes, corresponding to inclusion or non-inclusion of suspend blockers and PM constraints in the kernel. Both could coexist in the same kernel, since a suspend blocker can be trivially expressed as "an extreme PM constraint with other non-constraint-related semantics."
It's the "other non-constraint-related semantics" that seem to be the contentious issue. What can a suspend blocker do that a PM resource constraint cannot do? If that set contains at least one useful use case, then we need either suspend blockers, or some other thing that provides for the use case.
Lots of people want PM constraints, and I haven't seen anyone suggest there should *not* be PM constraints in the kernel some day. I've seen a few "working and useful PM constraints aren't going to happen any time soon" statements, and several "there's lots of stuff you still can't do with PM constraints or suspend blockers" statements, but those aren't arguments *against* PM constraints or *for* suspend blockers.
Quoted 4 lines · Peter Zijlstra
Quoted 3 lines · Zygo Blaxell
From my reading of this thread, there's a lot of overlap between suspendblockers and constraints. Many use cases are served equally well with one or the other,
Oops, I apparently meant "many use cases *of suspendblockers* are served equally well with one or the other."
Quoted 4 lines
If using suspend-blockers,
Please explain to me how:
- I will avoid the cpu going into some idle state for which the wakeup latency is larger than my RT app fancies?
...though I'd think you could do that by holding a suspendblocker, thus preventing the CPU from going into any idle state at all.
There's four likely outcomes, corresponding to inclusion or non-inclusion of suspend blockers and PM constraints in the kernel. Both could coexist in the same kernel, since a suspend blocker can be trivially expressed as "an extreme PM constraint with other non-constraint-related semantics."
It's the "other non-constraint-related semantics" that seem to be the contentious issue. What can a suspend blocker do that a PM resource constraint cannot do? If that set contains at least one useful use case, then we need either suspend blockers, or some other thing that provides for the use case.
Lots of people want PM constraints, and I haven't seen anyone suggest there should *not* be PM constraints in the kernel some day. I've seen a few "working and useful PM constraints aren't going to happen any time soon" statements, and several "there's lots of stuff you still can't do with PM constraints or suspend blockers" statements, but those aren't arguments *against* PM constraints or *for* suspend blockers.
Quoted 6 lines · Brian Swetland
Quoted 4 lines · Alan Cox
They fix a general problem in terms of a driver specific item. We end up making changes around the tree but we make everyone happy not just Android. Also we are isolating policy properly. The apps and drivers say "I have these needs", the power manager figures out how to meet them.
Quoted 7 lines
That makes sense -- and as I've mentioned elsewhere, we're really not super picky about naming -- if it turns out that wakelocks/suspendblockers were shorthand for "request a qos constraint that ensures that threads are running", we'll be able to get things done just as well as we do now.
From my reading of this thread, there's a lot of overlap between
suspendblockers and constraints. Many use cases are served equally well with one or the other, except for one: a case where an event that should ultimately wake the system triggers a code execution path (or data flow path) that wanders through a user-space full of complex interacting processes where the kernel (and maybe even the processes) can't see it.
Suspend-blockers in user-space handle this by making such code/data paths visible to the kernel. An all-kernel constraint-based approach has no way to see the user-space paths, so the system will end up trying to sleep when it should be waking up.
Wait, what? Surely all the user-space code handling such events is running under a PM-QoS constraint that says "don't sleep if this process is runnable," so the system won't go to sleep. Presumably all other processes which don't handle wakeup events will be running under a PM-QoS constraint that says "do sleep even if this process is runnable."
That's true, except for one common case: a process is drawing things on the display on behalf of other processes, and that drawing process can't have the "don't sleep" constraint because if it did the system would seem to be continuously busy and never go to sleep. Any process that is handling a critical event but also needs to talk to the display process will end up being not-runnable, and the system may go to sleep before the display process wakes up. So we need another PM-QoS constraint that says "don't sleep even if this process isn't runnable, because some *other* runnable process might do something that makes our critical process runnable again." The critical event handling app would switch to this PM-QoS constraint until it had received an ack from whatever it talked to in user-space, then switch back to the "don't sleep if this process is runnable" state until a new event comes in.
So, three constraint policies should do it (*):
1. Do sleep even if this process is runnable,
2. Don't sleep if this process is runnable, and
3. Don't sleep even if this process isn't runnable, as long as at least one other runnable process exists somewhere on the system.
"Runnable" would include tasks that are literally runnable as well as tasks that aren't runnable but are presumed to be imminently runnable (e.g. blocked on timers that are going to expire before the wakeup latency).
"Sleep" means going into any state where the scheduler doesn't run any tasks. That covers most CPU idle modes, deep power saving states, ACPI suspend, or whatever.
(*) or you could define a "please stop wasting CPU" message in user-space, and send that message to anything in user-space which has a PM-QoS constraint better than "none" whenever something in user-space thinks the user has gone away. Then the display process can have constraint #2, and we don't need #3.
Quoted 4 lines
I think the suggestion that has the closet fit with what we're trying to accomplish is Ingo's (or perhaps Ingo's explanation of Alan's):
http://lkml.org/lkml/2010/5/28/106 where it's implemented as a constraint of some sort.
I think we ended up in the same place on our own.
Quoted 4 lines
Arve points out that qos constraint objects could work (but not if specifically tied to apps): http://lkml.org/lkml/2010/5/28/120 though he suggests that "latency" constraints don't represent this as well as "state" constraints.
With latency you have an "I don't give damn" latency in your model which we could describe as infinite or "manyana" perhaps.
Quoted 7 lines
Though if you look at it that way, then
suspend_blockersbecome qos constraint objects, but their implementation and usage remain pretty much the same as we have now, which does not address Alan's concern regarding code turning up in drivers, etc. I'm not sure how you can solve this problem (avoiding races around entering/exiting the suspend or suspend-like state) without having a means for drivers to prevent entry to that state.
I am much much less concerned about general expressions of constraint appearing in drivers. One of my early mails gave a list of other people/projects/problems that need them - from hard real time, to high speed serial on low end embedded to virtualisation.
They fix a general problem in terms of a driver specific item. We end up making changes around the tree but we make everyone happy not just Android. Also we are isolating policy properly. The apps and drivers say "I have these needs", the power manager figures out how to meet them.
Where it gets ugly is if you start trying to have drivers giving an app a guarantee which the app then magically has to know to dispose of.
If you are prepared to exclude untrusted apps from perfectly reliable event reporting (ie from finger to application action) that doesn't seem to be a neccessity anyway.
Quoted 2 lines
livelock/deadlock/priority-inversion style issues due to interaction between different processes in different groups.
Priority inversion with the cgroup case is like synchronization effects with the suspend blockers - its a real ugly problem and one that is known to be hard to fix if you let it happen so I agree there.
Quoted 10 lines · Matthew Garrett
Quoted 3 lines · Igor Stoppa
I have seen very good proposals for saner solutions.
Is that progress?
The proposals so far involve either redefining the problem space or being inherently racey. It may be that we can redefine the problem space in such a way that everyone's happy, but it's not possible to do so by fiat.
I think the suggestion that has the closet fit with what we're trying to accomplish is Ingo's (or perhaps Ingo's explanation of Alan's):
http://lkml.org/lkml/2010/5/28/106 where it's implemented as a constraint of some sort.
Arve points out that qos constraint objects could work (but not if specifically tied to apps): http://lkml.org/lkml/2010/5/28/120 though he suggests that "latency" constraints don't represent this as well as "state" constraints.
Though if you look at it that way, then suspend_blockers become qos constraint objects, but their implementation and usage remain pretty much the same as we have now, which does not address Alan's concern regarding code turning up in drivers, etc. I'm not sure how you can solve this problem (avoiding races around entering/exiting the suspend or suspend-like state) without having a means for drivers to prevent entry to that state.
I need to think more about the cgroups approach, but I'm pretty sure it still suffers from wakeup race situations, and due to the complexity of userspace (at least ours), I suspect it would risk livelock/deadlock/priority-inversion style issues due to interaction between different processes in different groups.
Brian