Suspend block api (version 8)
Subsystems (6)
PM_QOS re-design for hot path use of limited dynamic range requests was- Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)
In reply to James BottomleyQuoted 87 lines · James Bottomley
Quoted 64 lines · Arve Hjønnevåg
Quoted 63 lines · Rafael J. Wysocki
Quoted 61 lines · James Bottomley
Quoted 44 lines · Arve Hjønnevåg
Quoted 27 lines · mark gross
Quoted 26 lines · Brian Swetland
Quoted 24 lines · mark gross
Quoted 5 lines · Arve Hjønnevåg
The list is not short. You have all the inactive and active constraints on the same list. If you change it to a two level list though, the list of unique values (which is the list you have to walk) may be short enough for a tree to be overkill.
what have you seen in practice from the wake-lock stats?
I'm having a hard time seeing where you could get more than just a handfull. However; one could go to a dual list (like the scheduler) and move inactive nodes from an active to inactive list, or we could simply remove them from the list uppon inactivity. which would would well after I change the api to have the client allocate the memory for the nodes... BUT, if your moving things in and out of a list a lot, I'm not sure the break even point where changing the structure helps.
We'll need to try it.
I think we will almost never see more than 10 list elements.
--mgross
Quoted 9 lines
Quoted 2 lines
I see about 80 (based on the batteryinfo dump) on my Nexus One (QSD8250, Android Froyo):
shucks.
well I think for a
pm_qosclass that has boolean dynamic range we can get away with not walking the list on every request update. we can use a counter, and the list will be for mostly for stats.Did you give any thought to my suggestion to only use one entry per unique value on the first level list and then use secondary lists of identical values. That way if you only have two constraints values the list you have to walk when updating a request will never have more than two entries regardless of how many total request you have.
Quoted 12 lines
A request update then becomes something like this:
if on primary list {
unlink from primary list
if secondary list is not empty
get next secondary entry and add in same spot on primary list
}
unlink from secondary list
find new spot on primary list
if already there
add to secondary list
else
add to primary listThis is just reinventing hash bucketed lists. To get the benefits, all we do is implement an N state constraint as backed by an N bucketed hash list, which the kernel already has all the internal mechanics for.
Quoted 5 lines
Quoted 2 lines
Agreed.
No, a hash is used for quick lookup of a specific value, not to find an extreme value.
If you only have N possible values an N bucket hash list is rather efficient (provided N is small). But I would agree that knowing what N is represents an API change, and since plists can do this without changing the API, they're better.
Quoted 2 lines
It is however extremely similar to plists. The only
difference is that plists link all the secondary lists together.Right, so they would solve the *current* problem exactly.
Quoted 5 lines
If we
want to have constraints that autoexpire, then keeping the secondary lists separate allows the same optimization as I did for wakelock/suspend_blocker timeouts where no timer is active if an (equal or stricter) non-expiring constraint is active.
Quoted 9 lines
But this is a future discussion and not part of the patch. The way open source works is that we sort out the best implementation for the current conditions. If the implementation has to change because of future stuff, then we change it when the future stuff comes along. Changing implementations is easy (they don't have any externally visible impact). Changing the in-kernel API is slightly harder, but easily doable. It's only changing the user visible ABI that we worry about and try not to do.
True.
The following is what I think I'll work on this weekend. (hopefully have some sort of patch that at least compiles...)
Changes to pm_qos to enable "wakelock" or "suspend blocker" support:
Requirements:
1) atomic context support.
2) make updating request fast enough for hot path users.
3) Add a request class for "interactive_suspend", this particular request has a dynamic range of 1 (its 0 or 1). If zero then ok to auto suspend, if 1 then only user driven suspend. Whenever the aggregate request changes value the registered notifiers are called.
Implementation:
* change api to have caller allocated the qos request structures. (solve the kalloc issue)
* add plist use for constraint classes with hash-able dynamic ranges
* consider auto hashing / plist-ing everything. (most users of pm_qos don't do any fancy stuff and tend to request the only 2 different values, ever) but for now only request with dynamic range of 0,1 will get the fancy lists.
I think the rest are implementation details.
--mgross
Re: PM_QOS re-design for hot path use of limited dynamic range requests was- Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)
Quoted 115 lines · mark gross
Quoted 87 lines · James Bottomley
Quoted 64 lines · Arve Hjønnevåg
Quoted 63 lines · Rafael J. Wysocki
Quoted 61 lines · James Bottomley
Quoted 44 lines · Arve Hjønnevåg
Quoted 27 lines · mark gross
Quoted 26 lines · Brian Swetland
Quoted 24 lines · mark gross
Quoted 5 lines · Arve Hjønnevåg
The list is not short. You have all the inactive and active constraints on the same list. If you change it to a two level list though, the list of unique values (which is the list you have to walk) may be short enough for a tree to be overkill.
what have you seen in practice from the wake-lock stats?
I'm having a hard time seeing where you could get more than just a handfull. However; one could go to a dual list (like the scheduler) and move inactive nodes from an active to inactive list, or we could simply remove them from the list uppon inactivity. which would would well after I change the api to have the client allocate the memory for the nodes... BUT, if your moving things in and out of a list a lot, I'm not sure the break even point where changing the structure helps.
We'll need to try it.
I think we will almost never see more than 10 list elements.
--mgross
Quoted 9 lines
Quoted 2 lines
I see about 80 (based on the batteryinfo dump) on my Nexus One (QSD8250, Android Froyo):
shucks.
well I think for a
pm_qosclass that has boolean dynamic range we can get away with not walking the list on every request update. we can use a counter, and the list will be for mostly for stats.Did you give any thought to my suggestion to only use one entry per unique value on the first level list and then use secondary lists of identical values. That way if you only have two constraints values the list you have to walk when updating a request will never have more than two entries regardless of how many total request you have.
Quoted 12 lines
A request update then becomes something like this:
if on primary list {
unlink from primary list
if secondary list is not empty
get next secondary entry and add in same spot on primary list
}
unlink from secondary list
find new spot on primary list
if already there
add to secondary list
else
add to primary listThis is just reinventing hash bucketed lists. To get the benefits, all we do is implement an N state constraint as backed by an N bucketed hash list, which the kernel already has all the internal mechanics for.
Quoted 5 lines
Quoted 2 lines
Agreed.
No, a hash is used for quick lookup of a specific value, not to find an extreme value.
If you only have N possible values an N bucket hash list is rather efficient (provided N is small). But I would agree that knowing what N is represents an API change, and since plists can do this without changing the API, they're better.
Quoted 2 lines
It is however extremely similar to plists. The only
difference is that plists link all the secondary lists together.Right, so they would solve the *current* problem exactly.
Quoted 5 lines
If we
want to have constraints that autoexpire, then keeping the secondary lists separate allows the same optimization as I did for wakelock/suspend_blocker timeouts where no timer is active if an (equal or stricter) non-expiring constraint is active.Quoted 9 lines
But this is a future discussion and not part of the patch. The way open source works is that we sort out the best implementation for the current conditions. If the implementation has to change because of future stuff, then we change it when the future stuff comes along. Changing implementations is easy (they don't have any externally visible impact). Changing the in-kernel API is slightly harder, but easily doable. It's only changing the user visible ABI that we worry about and try not to do.
True.
The following is what I think I'll work on this weekend. (hopefully have some sort of patch that at least compiles...)
Changes to
pm_qosto enable "wakelock" or "suspend blocker" support:Requirements:
1) atomic context support.
2) make updating request fast enough for hot path users.
3) Add a request class for "interactive_suspend", this particular request has a dynamic range of 1 (its 0 or 1). If zero then ok to auto suspend, if 1 then only user driven suspend. Whenever the aggregate request changes value the registered notifiers are called.
Quoted 4 lines
Implementation:
* change api to have caller allocated the qos request structures. (solve the kalloc issue)
* add plist use for constraint classes with hash-able dynamic ranges
Please have a look at the patch James posted earlier today on linux-pm, you were CCed.
Rafael
Re: PM_QOS re-design for hot path use of limited dynamic range requests was- Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)
Quoted 116 lines · Rafael J. Wysocki
Quoted 115 lines · mark gross
Quoted 87 lines · James Bottomley
Quoted 64 lines · Arve Hjønnevåg
Quoted 63 lines · Rafael J. Wysocki
Quoted 61 lines · James Bottomley
Quoted 44 lines · Arve Hjønnevåg
Quoted 27 lines · mark gross
Quoted 26 lines · Brian Swetland
Quoted 24 lines · mark gross
Quoted 5 lines · Arve Hjønnevåg
The list is not short. You have all the inactive and active constraints on the same list. If you change it to a two level list though, the list of unique values (which is the list you have to walk) may be short enough for a tree to be overkill.
what have you seen in practice from the wake-lock stats?
I'm having a hard time seeing where you could get more than just a handfull. However; one could go to a dual list (like the scheduler) and move inactive nodes from an active to inactive list, or we could simply remove them from the list uppon inactivity. which would would well after I change the api to have the client allocate the memory for the nodes... BUT, if your moving things in and out of a list a lot, I'm not sure the break even point where changing the structure helps.
We'll need to try it.
I think we will almost never see more than 10 list elements.
--mgross
Quoted 9 lines
Quoted 2 lines
I see about 80 (based on the batteryinfo dump) on my Nexus One (QSD8250, Android Froyo):
shucks.
well I think for a
pm_qosclass that has boolean dynamic range we can get away with not walking the list on every request update. we can use a counter, and the list will be for mostly for stats.Did you give any thought to my suggestion to only use one entry per unique value on the first level list and then use secondary lists of identical values. That way if you only have two constraints values the list you have to walk when updating a request will never have more than two entries regardless of how many total request you have.
Quoted 12 lines
A request update then becomes something like this:
if on primary list {
unlink from primary list
if secondary list is not empty
get next secondary entry and add in same spot on primary list
}
unlink from secondary list
find new spot on primary list
if already there
add to secondary list
else
add to primary listThis is just reinventing hash bucketed lists. To get the benefits, all we do is implement an N state constraint as backed by an N bucketed hash list, which the kernel already has all the internal mechanics for.
Quoted 5 lines
Quoted 2 lines
Agreed.
No, a hash is used for quick lookup of a specific value, not to find an extreme value.
If you only have N possible values an N bucket hash list is rather efficient (provided N is small). But I would agree that knowing what N is represents an API change, and since plists can do this without changing the API, they're better.
Quoted 2 lines
It is however extremely similar to plists. The only
difference is that plists link all the secondary lists together.Right, so they would solve the *current* problem exactly.
Quoted 5 lines
If we
want to have constraints that autoexpire, then keeping the secondary lists separate allows the same optimization as I did for wakelock/suspend_blocker timeouts where no timer is active if an (equal or stricter) non-expiring constraint is active.Quoted 9 lines
But this is a future discussion and not part of the patch. The way open source works is that we sort out the best implementation for the current conditions. If the implementation has to change because of future stuff, then we change it when the future stuff comes along. Changing implementations is easy (they don't have any externally visible impact). Changing the in-kernel API is slightly harder, but easily doable. It's only changing the user visible ABI that we worry about and try not to do.
True.
The following is what I think I'll work on this weekend. (hopefully have some sort of patch that at least compiles...)
Changes to
pm_qosto enable "wakelock" or "suspend blocker" support:Requirements:
1) atomic context support.
2) make updating request fast enough for hot path users.
3) Add a request class for "interactive_suspend", this particular request has a dynamic range of 1 (its 0 or 1). If zero then ok to auto suspend, if 1 then only user driven suspend. Whenever the aggregate request changes value the registered notifiers are called.
Quoted 8 lines
Quoted 4 lines
Implementation:
* change api to have caller allocated the qos request structures. (solve the kalloc issue)
* add plist use for constraint classes with hash-able dynamic rangesPlease have a look at the patch James posted earlier today on linux-pm, you were CCed.
I like James' post. I'm sorry I missed it before I sent this note, but I'm really glad he's posted it. Now I can do some testing.
--mgross
Re: PM_QOS re-design for hot path use of limited dynamic range requests was- Re: [PATCH 0/8] Suspend block api (version 8)
In reply to Rafael J. WysockiQuoted 116 lines · Rafael J. Wysocki
Quoted 115 lines · mark gross
Quoted 87 lines · James Bottomley
Quoted 64 lines · Arve Hjønnevåg
Quoted 63 lines · Rafael J. Wysocki
Quoted 61 lines · James Bottomley
Quoted 44 lines · Arve Hjønnevåg
Quoted 27 lines · mark gross
Quoted 26 lines · Brian Swetland
Quoted 24 lines · mark gross
Quoted 5 lines · Arve Hjønnevåg
The list is not short. You have all the inactive and active constraints on the same list. If you change it to a two level list though, the list of unique values (which is the list you have to walk) may be short enough for a tree to be overkill.
what have you seen in practice from the wake-lock stats?
I'm having a hard time seeing where you could get more than just a handfull. However; one could go to a dual list (like the scheduler) and move inactive nodes from an active to inactive list, or we could simply remove them from the list uppon inactivity. which would would well after I change the api to have the client allocate the memory for the nodes... BUT, if your moving things in and out of a list a lot, I'm not sure the break even point where changing the structure helps.
We'll need to try it.
I think we will almost never see more than 10 list elements.
--mgross
Quoted 9 lines
Quoted 2 lines
I see about 80 (based on the batteryinfo dump) on my Nexus One (QSD8250, Android Froyo):
shucks.
well I think for a
pm_qosclass that has boolean dynamic range we can get away with not walking the list on every request update. we can use a counter, and the list will be for mostly for stats.Did you give any thought to my suggestion to only use one entry per unique value on the first level list and then use secondary lists of identical values. That way if you only have two constraints values the list you have to walk when updating a request will never have more than two entries regardless of how many total request you have.
Quoted 12 lines
A request update then becomes something like this:
if on primary list {
unlink from primary list
if secondary list is not empty
get next secondary entry and add in same spot on primary list
}
unlink from secondary list
find new spot on primary list
if already there
add to secondary list
else
add to primary listThis is just reinventing hash bucketed lists. To get the benefits, all we do is implement an N state constraint as backed by an N bucketed hash list, which the kernel already has all the internal mechanics for.
Quoted 5 lines
Quoted 2 lines
Agreed.
No, a hash is used for quick lookup of a specific value, not to find an extreme value.
If you only have N possible values an N bucket hash list is rather efficient (provided N is small). But I would agree that knowing what N is represents an API change, and since plists can do this without changing the API, they're better.
Quoted 2 lines
It is however extremely similar to plists. The only
difference is that plists link all the secondary lists together.Right, so they would solve the *current* problem exactly.
Quoted 5 lines
If we
want to have constraints that autoexpire, then keeping the secondary lists separate allows the same optimization as I did for wakelock/suspend_blocker timeouts where no timer is active if an (equal or stricter) non-expiring constraint is active.Quoted 9 lines
But this is a future discussion and not part of the patch. The way open source works is that we sort out the best implementation for the current conditions. If the implementation has to change because of future stuff, then we change it when the future stuff comes along. Changing implementations is easy (they don't have any externally visible impact). Changing the in-kernel API is slightly harder, but easily doable. It's only changing the user visible ABI that we worry about and try not to do.
True.
The following is what I think I'll work on this weekend. (hopefully have some sort of patch that at least compiles...)
Changes to
pm_qosto enable "wakelock" or "suspend blocker" support:Requirements:
1) atomic context support.
2) make updating request fast enough for hot path users.
3) Add a request class for "interactive_suspend", this particular request has a dynamic range of 1 (its 0 or 1). If zero then ok to auto suspend, if 1 then only user driven suspend. Whenever the aggregate request changes value the registered notifiers are called.
Quoted 8 lines
Quoted 4 lines
Implementation:
* change api to have caller allocated the qos request structures. (solve the kalloc issue)
* add plist use for constraint classes with hash-able dynamic rangesPlease have a look at the patch James posted earlier today on linux-pm, you were CCed.
I like James' post. I'm sorry I missed it before I sent this note, but I'm really glad he's posted it. Now I can do some testing.
--mgross
Re: PM_QOS re-design for hot path use of limited dynamic range requests was- Re: [PATCH 0/8] Suspend block api (version 8)
In reply to mark grossQuoted 115 lines · mark gross
Quoted 87 lines · James Bottomley
Quoted 64 lines · Arve Hjønnevåg
Quoted 63 lines · Rafael J. Wysocki
Quoted 61 lines · James Bottomley
Quoted 44 lines · Arve Hjønnevåg
Quoted 27 lines · mark gross
Quoted 26 lines · Brian Swetland
Quoted 24 lines · mark gross
Quoted 5 lines · Arve Hjønnevåg
The list is not short. You have all the inactive and active constraints on the same list. If you change it to a two level list though, the list of unique values (which is the list you have to walk) may be short enough for a tree to be overkill.
what have you seen in practice from the wake-lock stats?
I'm having a hard time seeing where you could get more than just a handfull. However; one could go to a dual list (like the scheduler) and move inactive nodes from an active to inactive list, or we could simply remove them from the list uppon inactivity. which would would well after I change the api to have the client allocate the memory for the nodes... BUT, if your moving things in and out of a list a lot, I'm not sure the break even point where changing the structure helps.
We'll need to try it.
I think we will almost never see more than 10 list elements.
--mgross
Quoted 9 lines
Quoted 2 lines
I see about 80 (based on the batteryinfo dump) on my Nexus One (QSD8250, Android Froyo):
shucks.
well I think for a
pm_qosclass that has boolean dynamic range we can get away with not walking the list on every request update. we can use a counter, and the list will be for mostly for stats.Did you give any thought to my suggestion to only use one entry per unique value on the first level list and then use secondary lists of identical values. That way if you only have two constraints values the list you have to walk when updating a request will never have more than two entries regardless of how many total request you have.
Quoted 12 lines
A request update then becomes something like this:
if on primary list {
unlink from primary list
if secondary list is not empty
get next secondary entry and add in same spot on primary list
}
unlink from secondary list
find new spot on primary list
if already there
add to secondary list
else
add to primary listThis is just reinventing hash bucketed lists. To get the benefits, all we do is implement an N state constraint as backed by an N bucketed hash list, which the kernel already has all the internal mechanics for.
Quoted 5 lines
Quoted 2 lines
Agreed.
No, a hash is used for quick lookup of a specific value, not to find an extreme value.
If you only have N possible values an N bucket hash list is rather efficient (provided N is small). But I would agree that knowing what N is represents an API change, and since plists can do this without changing the API, they're better.
Quoted 2 lines
It is however extremely similar to plists. The only
difference is that plists link all the secondary lists together.Right, so they would solve the *current* problem exactly.
Quoted 5 lines
If we
want to have constraints that autoexpire, then keeping the secondary lists separate allows the same optimization as I did for wakelock/suspend_blocker timeouts where no timer is active if an (equal or stricter) non-expiring constraint is active.Quoted 9 lines
But this is a future discussion and not part of the patch. The way open source works is that we sort out the best implementation for the current conditions. If the implementation has to change because of future stuff, then we change it when the future stuff comes along. Changing implementations is easy (they don't have any externally visible impact). Changing the in-kernel API is slightly harder, but easily doable. It's only changing the user visible ABI that we worry about and try not to do.
True.
The following is what I think I'll work on this weekend. (hopefully have some sort of patch that at least compiles...)
Changes to
pm_qosto enable "wakelock" or "suspend blocker" support:Requirements:
1) atomic context support.
2) make updating request fast enough for hot path users.
3) Add a request class for "interactive_suspend", this particular request has a dynamic range of 1 (its 0 or 1). If zero then ok to auto suspend, if 1 then only user driven suspend. Whenever the aggregate request changes value the registered notifiers are called.
Quoted 4 lines
Implementation:
* change api to have caller allocated the qos request structures. (solve the kalloc issue)
* add plist use for constraint classes with hash-able dynamic ranges
Please have a look at the patch James posted earlier today on linux-pm, you were CCed.
Rafael
PM_QOS re-design for hot path use of limited dynamic range requests was- Re: [PATCH 0/8] Suspend block api (version 8)
In reply to James BottomleyQuoted 87 lines · James Bottomley
Quoted 64 lines · Arve Hjønnevåg
Quoted 63 lines · Rafael J. Wysocki
Quoted 61 lines · James Bottomley
Quoted 44 lines · Arve Hjønnevåg
Quoted 27 lines · mark gross
Quoted 26 lines · Brian Swetland
Quoted 24 lines · mark gross
Quoted 5 lines · Arve Hjønnevåg
The list is not short. You have all the inactive and active constraints on the same list. If you change it to a two level list though, the list of unique values (which is the list you have to walk) may be short enough for a tree to be overkill.
what have you seen in practice from the wake-lock stats?
I'm having a hard time seeing where you could get more than just a handfull. However; one could go to a dual list (like the scheduler) and move inactive nodes from an active to inactive list, or we could simply remove them from the list uppon inactivity. which would would well after I change the api to have the client allocate the memory for the nodes... BUT, if your moving things in and out of a list a lot, I'm not sure the break even point where changing the structure helps.
We'll need to try it.
I think we will almost never see more than 10 list elements.
--mgross
Quoted 9 lines
Quoted 2 lines
I see about 80 (based on the batteryinfo dump) on my Nexus One (QSD8250, Android Froyo):
shucks.
well I think for a
pm_qosclass that has boolean dynamic range we can get away with not walking the list on every request update. we can use a counter, and the list will be for mostly for stats.Did you give any thought to my suggestion to only use one entry per unique value on the first level list and then use secondary lists of identical values. That way if you only have two constraints values the list you have to walk when updating a request will never have more than two entries regardless of how many total request you have.
Quoted 12 lines
A request update then becomes something like this:
if on primary list {
unlink from primary list
if secondary list is not empty
get next secondary entry and add in same spot on primary list
}
unlink from secondary list
find new spot on primary list
if already there
add to secondary list
else
add to primary listThis is just reinventing hash bucketed lists. To get the benefits, all we do is implement an N state constraint as backed by an N bucketed hash list, which the kernel already has all the internal mechanics for.
Quoted 5 lines
Quoted 2 lines
Agreed.
No, a hash is used for quick lookup of a specific value, not to find an extreme value.
If you only have N possible values an N bucket hash list is rather efficient (provided N is small). But I would agree that knowing what N is represents an API change, and since plists can do this without changing the API, they're better.
Quoted 2 lines
It is however extremely similar to plists. The only
difference is that plists link all the secondary lists together.Right, so they would solve the *current* problem exactly.
Quoted 5 lines
If we
want to have constraints that autoexpire, then keeping the secondary lists separate allows the same optimization as I did for wakelock/suspend_blocker timeouts where no timer is active if an (equal or stricter) non-expiring constraint is active.
Quoted 9 lines
But this is a future discussion and not part of the patch. The way open source works is that we sort out the best implementation for the current conditions. If the implementation has to change because of future stuff, then we change it when the future stuff comes along. Changing implementations is easy (they don't have any externally visible impact). Changing the in-kernel API is slightly harder, but easily doable. It's only changing the user visible ABI that we worry about and try not to do.
True.
The following is what I think I'll work on this weekend. (hopefully have some sort of patch that at least compiles...)
Changes to pm_qos to enable "wakelock" or "suspend blocker" support:
Requirements:
1) atomic context support.
2) make updating request fast enough for hot path users.
3) Add a request class for "interactive_suspend", this particular request has a dynamic range of 1 (its 0 or 1). If zero then ok to auto suspend, if 1 then only user driven suspend. Whenever the aggregate request changes value the registered notifiers are called.
Implementation:
* change api to have caller allocated the qos request structures. (solve the kalloc issue)
* add plist use for constraint classes with hash-able dynamic ranges
* consider auto hashing / plist-ing everything. (most users of pm_qos don't do any fancy stuff and tend to request the only 2 different values, ever) but for now only request with dynamic range of 0,1 will get the fancy lists.
I think the rest are implementation details.
--mgross
Quoted 58 lines · James Bottomley
Quoted 44 lines · Arve Hjønnevåg
Quoted 27 lines · mark gross
Quoted 26 lines · Brian Swetland
Quoted 24 lines · mark gross
Quoted 5 lines · Arve Hjønnevåg
The list is not short. You have all the inactive and active constraints on the same list. If you change it to a two level list though, the list of unique values (which is the list you have to walk) may be short enough for a tree to be overkill.
what have you seen in practice from the wake-lock stats?
I'm having a hard time seeing where you could get more than just a handfull. However; one could go to a dual list (like the scheduler) and move inactive nodes from an active to inactive list, or we could simply remove them from the list uppon inactivity. which would would well after I change the api to have the client allocate the memory for the nodes... BUT, if your moving things in and out of a list a lot, I'm not sure the break even point where changing the structure helps.
We'll need to try it.
I think we will almost never see more than 10 list elements.
--mgross
Quoted 9 lines
Quoted 2 lines
I see about 80 (based on the batteryinfo dump) on my Nexus One (QSD8250, Android Froyo):
shucks.
well I think for a
pm_qosclass that has boolean dynamic range we can get away with not walking the list on every request update. we can use a counter, and the list will be for mostly for stats.Did you give any thought to my suggestion to only use one entry per unique value on the first level list and then use secondary lists of identical values. That way if you only have two constraints values the list you have to walk when updating a request will never have more than two entries regardless of how many total request you have.
Quoted 12 lines
A request update then becomes something like this:
if on primary list {
unlink from primary list
if secondary list is not empty
get next secondary entry and add in same spot on primary list
}
unlink from secondary list
find new spot on primary list
if already there
add to secondary list
else
add to primary list
Quoted 3 lines
This is just reinventing hash bucketed lists. To get the benefits, all we do is implement an N state constraint as backed by an N bucketed hash list, which the kernel already has all the internal mechanics for.
Agreed.
Rafael
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 20 lines · Brian Swetland
Quoted 19 lines · mark gross
Quoted 5 lines · Arve Hjønnevåg
The list is not short. You have all the inactive and active constraints on the same list. If you change it to a two level list though, the list of unique values (which is the list you have to walk) may be short enough for a tree to be overkill.
what have you seen in practice from the wake-lock stats?
I'm having a hard time seeing where you could get more than just a handfull. However; one could go to a dual list (like the scheduler) and move inactive nodes from an active to inactive list, or we could simply remove them from the list uppon inactivity. which would would well after I change the api to have the client allocate the memory for the nodes... BUT, if your moving things in and out of a list a lot, I'm not sure the break even point where changing the structure helps.
We'll need to try it.
Quoted 8 lines
Quoted 5 lines
I think we will almost never see more than 10 list elements.
--mgross
I see about 80 (based on the batteryinfo dump) on my Nexus One (QSD8250, Android Froyo):
shucks.
well I think for a pm_qos class that has boolean dynamic range we can get away with not walking the list on every request update. we can use a counter, and the list will be for mostly for stats.
Quoted 75 lines
Kernel Wake lock "event5-86": (nothing executed)
Kernel Wake lock "PowerManagerService": 4m 27s 994ms (453 times) realtime Kernel Wake lock "event4-92": 72ms (10 times) realtime
Kernel Wake lock "AudioHardwareQSDIn": (nothing executed) Kernel Wake lock "event4-87": (nothing executed)
Kernel Wake lock "event5-82": (nothing executed)
Kernel Wake lock "event2-87": (nothing executed)
Kernel Wake lock "alarm_rtc": 21s 882ms (186 times) realtime Kernel Wake lock "vdec_suspend": (nothing executed)
Kernel Wake lock "event6-87": (nothing executed)
Kernel Wake lock "event0-91": (nothing executed)
Kernel Wake lock "SMD_DS": 30s 938ms (53 times) realtime Kernel Wake lock "event6-91": (nothing executed)
Kernel Wake lock "KeyEvents": 398ms (3226 times) realtime Kernel Wake lock "qmi1": (nothing executed)
Kernel Wake lock "mmc_delayed_work": (nothing executed)
Kernel Wake lock "event3-82": (nothing executed)
Kernel Wake lock "event3-92": 58ms (6 times) realtime
Kernel Wake lock "SMD_RPCCALL": 295ms (1756 times) realtime Kernel Wake lock "SMD_DATA6": (nothing executed)
Kernel Wake lock "audio_pcm_idle": 3s 99ms (1 times) realtime Kernel Wake lock "serial-debug": (nothing executed)
Kernel Wake lock "event6-82": (nothing executed)
Kernel Wake lock "event3-86": (nothing executed)
Kernel Wake lock "event2-82": (nothing executed)
Kernel Wake lock "i2c": (nothing executed)
Kernel Wake lock "event2-86": (nothing executed)
Kernel Wake lock "event5-87": (nothing executed)
Kernel Wake lock "event4-86": (nothing executed)
Kernel Wake lock "event5-92": 4ms (21 times) realtime
Kernel Wake lock "rpc_server": (nothing executed)
Kernel Wake lock "power-supply": 527ms (8 times) realtime Kernel Wake lock "radio-interface": 10s 11ms (10 times) realtime Kernel Wake lock "event6-86": (nothing executed)
Kernel Wake lock "deleted_wake_locks": 203ms (214 times) realtime Kernel Wake lock "qmi0": (nothing executed)
Kernel Wake lock "event2-91": (nothing executed)
Kernel Wake lock "event4-82": (nothing executed)
Kernel Wake lock "event7-82": (nothing executed)
Kernel Wake lock "dock": 27ms (1 times) realtime
Kernel Wake lock "SMD_DATA5": 1m 45s 121ms (158 times) realtime Kernel Wake lock "event1-92": (nothing executed)
Kernel Wake lock "gpio_kp": (nothing executed)
Kernel Wake lock "event3-87": (nothing executed)
Kernel Wake lock "event7-92": (nothing executed)
Kernel Wake lock "msm_serial_hs_dma": (nothing executed) Kernel Wake lock "event5-91": (nothing executed)
Kernel Wake lock "vbus_present": 517ms (1 times) realtime Kernel Wake lock "alarm": 3s 229ms (249 times) realtime Kernel Wake lock "event1-82": (nothing executed)
Kernel Wake lock "venc_suspend": (nothing executed)
Kernel Wake lock "event1-86": (nothing executed)
Kernel Wake lock "AudioHardwareQSDOut": 3s 98ms (1 times) realtime Kernel Wake lock "event0-87": (nothing executed)
Kernel Wake lock "event2-92": 169ms (687 times) realtime Kernel Wake lock "ds2784-battery": 12s 846ms (158 times) realtime Kernel Wake lock "ApmCommandThread": 564ms (2 times) realtime Kernel Wake lock "msmfb_idle_lock": 1s 495ms (715 times) realtime Kernel Wake lock "headset": (nothing executed)
Kernel Wake lock "kgsl": 26s 473ms (123 times) realtime Kernel Wake lock "venc_idle": (nothing executed)
Kernel Wake lock "event1-91": (nothing executed)
Kernel Wake lock "s5k3e2fx": (nothing executed)
Kernel Wake lock "usb_mass_storage": (nothing executed)
Kernel Wake lock "unknown_wakeups": (nothing executed)
Kernel Wake lock "vdec_idle": (nothing executed)
Kernel Wake lock "audio_pcm_suspend": 3s 99ms (1 times) realtime Kernel Wake lock "microp_i2c_present": (nothing executed) Kernel Wake lock "event4-91": (nothing executed)
Kernel Wake lock "event6-92": 182ms (86 times) realtime Kernel Wake lock "event0-82": (nothing executed)
Kernel Wake lock "event0-92": 8ms (37 times) realtime
Kernel Wake lock "rpc_read": 112ms (1540 times) realtime Kernel Wake lock "event0-86": (nothing executed)
Kernel Wake lock "msm_serial_hs_rx": (nothing executed)
Quoted 8 lines
Kernel Wake lock "qmi2": (nothing executed) Kernel Wake lock "event1-87": (nothing executed) Kernel Wake lock "
msm_camera": (nothing executed) Kernel Wake lock "rpc-interface": 2ms (1 times) realtime Kernel Wake lock "main": 1m 38s 314ms (5 times) realtime Kernel Wake lock "gpio_input": (nothing executed) Kernel Wake lock "event3-91": (nothing executed) Kernel Wake lock "SMD_DATA7": (nothing executed)
How much of this is portable to your next phone? I bet it was a big effort to get these right too. FWIW I don't think most of these will map into the moorestown port of android I'm working on.
This is why I really think a low power event framework would be cleaner but, lets make everyone happy and expand pm_qos into a wake lock re-implementation first.
--mgross
Quoted 2 lines · mark gross
However; one could go to a dual list (like the scheduler) and move inactive nodes from an active to inactive list,
/me suggests you take a new look at the scheduler, those lists disappeared more than 10 releases ago. We use RB-trees these days.
Quoted 2 lines · mark gross
However; one could go to a dual list (like the scheduler) and move inactive nodes from an active to inactive list,
/me suggests you take a new look at the scheduler, those lists disappeared more than 10 releases ago. We use RB-trees these days.
Quoted 6 lines · Peter Zijlstra
Quoted 2 lines · mark gross
However; one could go to a dual list (like the scheduler) and move inactive nodes from an active to inactive list,
/me suggests you take a new look at the scheduler, those lists disappeared more than 10 releases ago. We use RB-trees these days.
your dating me ;)
I haven't taken a hard look at the scheduler for a while.
/me hides.
--mgross
Quoted 6 lines · Peter Zijlstra
Quoted 2 lines · mark gross
However; one could go to a dual list (like the scheduler) and move inactive nodes from an active to inactive list,
/me suggests you take a new look at the scheduler, those lists disappeared more than 10 releases ago. We use RB-trees these days.
your dating me ;)
I haven't taken a hard look at the scheduler for a while.
/me hides.
--mgross
Quoted 35 lines · Arve Hjønnevåg
2010/6/2 mark gross <[email protected]>:
Quoted 27 lines · Arve Hjønnevåg
Quoted 19 lines · mark gross
Quoted 1 line · Florian Mickler
...
Quoted 6 lines
Quoted 6 lines
kernel/pm_qos_params.c +6
-0+static void update_target_val (int pm_qos_class,s32 val) +{ + s32 extreme_value; + s32 new_value; + extreme_value = atomic_read(&pm_qos_array[pm_qos_class]->target_value); + new_value = pm_qos_array[pm_qos_class]->comparitor(val,extreme_value);Quoted 9 lines
kernel/pm_qos_params.c static s32 min_compare(s32 v1, s32 v2) · line 148
Quoted 4 lines
+ if (
extreme_value!=new_value)
+atomic_set(&pm_qos_array[pm_qos_class]->target_value,new_value);kernel/pm_qos_params.c +2
-0+} +Only works 1/2 the time, but I like the idea!
It fails to get the righ answer when constraints are reduced. But, this idea is a good improvement i'll roll into the nextpm_qosupdate!Quoted 6 lines
I think it would be a better idea to track your constraints with a sorted data structure. That way you can to better than O(n) for both directions. If you have a lot of constraints with the same value, it may even be worthwhile to have a two stage structure where for instance you use a rbtree for the unique values and list for identical constraints.
Quoted 6 lines
I don't agree, we went through this tree vrs list discussion a few times before in other areas of the kernel. Wherever the list tended to be short, a simple list wins. However; we can try it, after we have some metrics and stress test cases identified we can measure its effectivenes against.
Quoted 4 lines
The list is not short. You have all the inactive and active constraints on the same list. If you change it to a two level list though, the list of unique values (which is the list you have to walk) may be short enough for a tree to be overkill.
what have you seen in practice from the wake-lock stats?
I'm having a hard time seeing where you could get more than just a handfull. However; one could go to a dual list (like the scheduler) and move inactive nodes from an active to inactive list, or we could simply remove them from the list uppon inactivity. which would would well after I change the api to have the client allocate the memory for the nodes... BUT, if your moving things in and out of a list a lot, I'm not sure the break even point where changing the structure helps.
We'll need to try it.
I think we will almost never see more than 10 list elements.
--mgross
Quoted 27 lines · mark gross
Quoted 19 lines · Arve Hjønnevåg
Quoted 1 line · mark gross
On Tue, Jun 01, 2010 at 09:07:37AM +0200, Florian Mickler wrote:
...
Quoted 6 lines
Quoted 6 lines
kernel/pm_qos_params.c +6
-0+static void update_target_val (int pm_qos_class,s32 val) +{ +s32 extreme_value; +s32 new_value; + extreme_value =atomic_read (&pm_qos_array[pm_qos_class]->target_value); + new_value = pm_qos_array[pm_qos_class]->comparitor (val,extreme_value);Quoted 9 lines
kernel/pm_qos_params.c static s32 min_compare(s32 v1, s32 v2) · line 148
Quoted 4 lines
kernel/pm_qos_params.c +4
-0+if (extreme_value != new_value) +atomic_set (&pm_qos_array[pm_qos_class]->target_value,new_value); +} +Only works 1/2 the time, but I like the idea!
It fails to get the righ answer when constraints are reduced. But, this idea is a good improvement i'll roll into the nextpm_qosupdate!Quoted 6 lines
I think it would be a better idea to track your constraints with a sorted data structure. That way you can to better than O(n) for both directions. If you have a lot of constraints with the same value, it may even be worthwhile to have a two stage structure where for instance you use a rbtree for the unique values and list for identical constraints.
Quoted 5 lines
I don't agree, we went through this tree vrs list discussion a few times before in other areas of the kernel. Wherever the list tended to be short, a simple list wins. However; we can try it, after we have some metrics and stress test cases identified we can measure its effectivenes against.
How many different values are there to handle?
Rafael
Quoted 28 lines · Rafael J. Wysocki
Quoted 27 lines · mark gross
Quoted 25 lines · Arve Hjønnevåg
Quoted 1 line · mark gross
On Tue, Jun 01, 2010 at 09:07:37AM +0200, Florian Mickler wrote:
...
Quoted 6 lines
Quoted 6 lines
kernel/pm_qos_params.c +6
-0+static void update_target_val (int pm_qos_class,s32 val) +{ +s32 extreme_value; +s32 new_value; + extreme_value =atomic_read (&pm_qos_array[pm_qos_class]->target_value); + new_value = pm_qos_array[pm_qos_class]->comparitor (val,extreme_value);Quoted 9 lines
kernel/pm_qos_params.c static s32 min_compare(s32 v1, s32 v2) · line 148
Quoted 4 lines
kernel/pm_qos_params.c +4
-0+if (extreme_value != new_value) +atomic_set (&pm_qos_array[pm_qos_class]->target_value,new_value); +} +Only works 1/2 the time, but I like the idea!
It fails to get the righ answer when constraints are reduced. But, this idea is a good improvement i'll roll into the nextpm_qosupdate!I think it would be a better idea to track your constraints with a sorted data structure. That way you can to better than O(n) for both directions. If you have a lot of constraints with the same value, it may even be worthwhile to have a two stage structure where for instance you use a rbtree for the unique values and list for identical constraints.
Quoted 8 lines
Quoted 5 lines
I don't agree, we went through this tree vrs list discussion a few times before in other areas of the kernel. Wherever the list tended to be short, a simple list wins. However; we can try it, after we have some metrics and stress test cases identified we can measure its effectivenes against.
How many different values are there to handle?
for the current pm_qos users its tiny. I've never heard of more than a few < 10. However; for the new "interactive" class to provide suspend blocker functionality, I expect the number to be up to 20.
but realistically I bet we never get more than 10ish.
One constraint constraint request per module from isr to user mode. Once in user mode there would be only a few (assuming Android user space) I think just from the power HAL, input HAL, and the RIL.
Still a pretty small number I don't think we need to worry about scaling as much as we need to worry about performance.
--mgross
Quoted 42 lines · mark gross
Quoted 28 lines · Rafael J. Wysocki
Quoted 27 lines · mark gross
Quoted 25 lines · Arve Hjønnevåg
Quoted 1 line · mark gross
On Tue, Jun 01, 2010 at 09:07:37AM +0200, Florian Mickler wrote:
...
Quoted 6 lines
Quoted 6 lines
kernel/pm_qos_params.c +6
-0+static void update_target_val (int pm_qos_class,s32 val) +{ +s32 extreme_value; +s32 new_value; + extreme_value =atomic_read (&pm_qos_array[pm_qos_class]->target_value); + new_value = pm_qos_array[pm_qos_class]->comparitor (val,extreme_value);Quoted 9 lines
kernel/pm_qos_params.c static s32 min_compare(s32 v1, s32 v2) · line 148
Quoted 4 lines
kernel/pm_qos_params.c +4
-0+if (extreme_value != new_value) +atomic_set (&pm_qos_array[pm_qos_class]->target_value,new_value); +} +Only works 1/2 the time, but I like the idea!
It fails to get the righ answer when constraints are reduced. But, this idea is a good improvement i'll roll into the nextpm_qosupdate!I think it would be a better idea to track your constraints with a sorted data structure. That way you can to better than O(n) for both directions. If you have a lot of constraints with the same value, it may even be worthwhile to have a two stage structure where for instance you use a rbtree for the unique values and list for identical constraints.
Quoted 8 lines
Quoted 5 lines
I don't agree, we went through this tree vrs list discussion a few times before in other areas of the kernel. Wherever the list tended to be short, a simple list wins. However; we can try it, after we have some metrics and stress test cases identified we can measure its effectivenes against.
How many different values are there to handle?
for the current
pm_qosusers its tiny. I've never heard of more than a few < 10. However; for the new "interactive" class to provide suspend blocker functionality, I expect the number to be up to 20.
Quoted 8 lines
but realistically I bet we never get more than 10ish.
One constraint constraint request per module from isr to user mode. Once in user mode there would be only a few (assuming Android user space) I think just from the power HAL, input HAL, and the RIL.
Still a pretty small number I don't think we need to worry about scaling as much as we need to worry about performance.
In that case sorting the structure is rather not going to improve things, but it might be worth using a hashtable or something similar.
Rafael
Quoted 42 lines · mark gross
Quoted 28 lines · Rafael J. Wysocki
Quoted 27 lines · mark gross
Quoted 25 lines · Arve Hjønnevåg
Quoted 1 line · mark gross
On Tue, Jun 01, 2010 at 09:07:37AM +0200, Florian Mickler wrote:
...
Quoted 6 lines
Quoted 6 lines
kernel/pm_qos_params.c +6
-0+static void update_target_val (int pm_qos_class,s32 val) +{ +s32 extreme_value; +s32 new_value; + extreme_value =atomic_read (&pm_qos_array[pm_qos_class]->target_value); + new_value = pm_qos_array[pm_qos_class]->comparitor (val,extreme_value);Quoted 9 lines
kernel/pm_qos_params.c static s32 min_compare(s32 v1, s32 v2) · line 148
Quoted 4 lines
kernel/pm_qos_params.c +4
-0+if (extreme_value != new_value) +atomic_set (&pm_qos_array[pm_qos_class]->target_value,new_value); +} +Only works 1/2 the time, but I like the idea!
It fails to get the righ answer when constraints are reduced. But, this idea is a good improvement i'll roll into the nextpm_qosupdate!I think it would be a better idea to track your constraints with a sorted data structure. That way you can to better than O(n) for both directions. If you have a lot of constraints with the same value, it may even be worthwhile to have a two stage structure where for instance you use a rbtree for the unique values and list for identical constraints.
Quoted 8 lines
Quoted 5 lines
I don't agree, we went through this tree vrs list discussion a few times before in other areas of the kernel. Wherever the list tended to be short, a simple list wins. However; we can try it, after we have some metrics and stress test cases identified we can measure its effectivenes against.
How many different values are there to handle?
for the current
pm_qosusers its tiny. I've never heard of more than a few < 10. However; for the new "interactive" class to provide suspend blocker functionality, I expect the number to be up to 20.
Quoted 8 lines
but realistically I bet we never get more than 10ish.
One constraint constraint request per module from isr to user mode. Once in user mode there would be only a few (assuming Android user space) I think just from the power HAL, input HAL, and the RIL.
Still a pretty small number I don't think we need to worry about scaling as much as we need to worry about performance.
In that case sorting the structure is rather not going to improve things, but it might be worth using a hashtable or something similar.
Rafael
Quoted 28 lines · Rafael J. Wysocki
Quoted 27 lines · mark gross
Quoted 25 lines · Arve Hjønnevåg
Quoted 1 line · mark gross
On Tue, Jun 01, 2010 at 09:07:37AM +0200, Florian Mickler wrote:
...
Quoted 6 lines
Quoted 6 lines
kernel/pm_qos_params.c +6
-0+static void update_target_val (int pm_qos_class,s32 val) +{ +s32 extreme_value; +s32 new_value; + extreme_value =atomic_read (&pm_qos_array[pm_qos_class]->target_value); + new_value = pm_qos_array[pm_qos_class]->comparitor (val,extreme_value);Quoted 9 lines
kernel/pm_qos_params.c static s32 min_compare(s32 v1, s32 v2) · line 148
Quoted 4 lines
kernel/pm_qos_params.c +4
-0+if (extreme_value != new_value) +atomic_set (&pm_qos_array[pm_qos_class]->target_value,new_value); +} +Only works 1/2 the time, but I like the idea!
It fails to get the righ answer when constraints are reduced. But, this idea is a good improvement i'll roll into the nextpm_qosupdate!I think it would be a better idea to track your constraints with a sorted data structure. That way you can to better than O(n) for both directions. If you have a lot of constraints with the same value, it may even be worthwhile to have a two stage structure where for instance you use a rbtree for the unique values and list for identical constraints.
Quoted 8 lines
Quoted 5 lines
I don't agree, we went through this tree vrs list discussion a few times before in other areas of the kernel. Wherever the list tended to be short, a simple list wins. However; we can try it, after we have some metrics and stress test cases identified we can measure its effectivenes against.
How many different values are there to handle?
for the current pm_qos users its tiny. I've never heard of more than a few < 10. However; for the new "interactive" class to provide suspend blocker functionality, I expect the number to be up to 20.
but realistically I bet we never get more than 10ish.
One constraint constraint request per module from isr to user mode. Once in user mode there would be only a few (assuming Android user space) I think just from the power HAL, input HAL, and the RIL.
Still a pretty small number I don't think we need to worry about scaling as much as we need to worry about performance.
--mgross
Quoted 27 lines · mark gross
Quoted 19 lines · Arve Hjønnevåg
Quoted 1 line · mark gross
On Tue, Jun 01, 2010 at 09:07:37AM +0200, Florian Mickler wrote:
...
Quoted 6 lines
Quoted 6 lines
kernel/pm_qos_params.c +6
-0+static void update_target_val (int pm_qos_class,s32 val) +{ +s32 extreme_value; +s32 new_value; + extreme_value =atomic_read (&pm_qos_array[pm_qos_class]->target_value); + new_value = pm_qos_array[pm_qos_class]->comparitor (val,extreme_value);Quoted 9 lines
kernel/pm_qos_params.c static s32 min_compare(s32 v1, s32 v2) · line 148
Quoted 4 lines
kernel/pm_qos_params.c +4
-0+if (extreme_value != new_value) +atomic_set (&pm_qos_array[pm_qos_class]->target_value,new_value); +} +Only works 1/2 the time, but I like the idea!
It fails to get the righ answer when constraints are reduced. But, this idea is a good improvement i'll roll into the nextpm_qosupdate!Quoted 6 lines
I think it would be a better idea to track your constraints with a sorted data structure. That way you can to better than O(n) for both directions. If you have a lot of constraints with the same value, it may even be worthwhile to have a two stage structure where for instance you use a rbtree for the unique values and list for identical constraints.
Quoted 5 lines
I don't agree, we went through this tree vrs list discussion a few times before in other areas of the kernel. Wherever the list tended to be short, a simple list wins. However; we can try it, after we have some metrics and stress test cases identified we can measure its effectivenes against.
How many different values are there to handle?
Rafael
Quoted 19 lines · Arve Hjønnevåg
Quoted 1 line · mark gross
On Tue, Jun 01, 2010 at 09:07:37AM +0200, Florian Mickler wrote:
...
Quoted 6 lines
Quoted 6 lines
kernel/pm_qos_params.c +6
-0+static void update_target_val (int pm_qos_class,s32 val) +{ + s32 extreme_value; + s32 new_value; + extreme_value = atomic_read(&pm_qos_array[pm_qos_class]->target_value); + new_value = pm_qos_array[pm_qos_class]->comparitor(val,extreme_value);Quoted 9 lines
kernel/pm_qos_params.c static s32 min_compare(s32 v1, s32 v2) · line 148
Quoted 4 lines
+ if (
extreme_value!=new_value)
+atomic_set(&pm_qos_array[pm_qos_class]->target_value,new_value);kernel/pm_qos_params.c +2
-0+} +Only works 1/2 the time, but I like the idea!
It fails to get the righ answer when constraints are reduced. But, this idea is a good improvement i'll roll into the nextpm_qosupdate!
Quoted 6 lines
I think it would be a better idea to track your constraints with a sorted data structure. That way you can to better than O(n) for both directions. If you have a lot of constraints with the same value, it may even be worthwhile to have a two stage structure where for instance you use a rbtree for the unique values and list for identical constraints.
I don't agree, we went through this tree vrs list discussion a few times before in other areas of the kernel. Wherever the list tended to be short, a simple list wins. However; we can try it, after we have some metrics and stress test cases identified we can measure its effectivenes against.
--mgross
Quoted 66 lines · Florian Mickler
Quoted 26 lines · On Mon, 31 May 2010 16:26:17 -0700 mark gross <[email protected]> wrote:
Quoted 18 lines · Rafael J. Wysocki
Quoted 17 lines · Arve Hjønnevåg
2010/5/29 Alan Stern <[email protected]>:
Quoted 15 lines · Arve Hjønnevåg
Quoted 9 lines
Quoted 6 lines
In place of in-kernel suspend blockers, there will be a new type of QoS constraint -- call it
QOS_EVENTUALLY. It's a very weak constraint, compatible with all cpuidle modes in which runnable threads are allowed to run (which is all of them), but not compatible with suspend.This sound just like another API rename. It will work, but given that suspend blockers was the name least objectionable last time around, I'm not sure what this would solve.
It's not just a rename. By changing this into a QoS constraint, we make it more generally useful. Instead of standing on its own, it becomes part of the PM-QOS framework.
Quoted 6 lines
Quoted 2 lines
We cannot use the existing pm-qos framework. It is not safe to call from atomic context.
We've just merged a patch that fixed that if I'm not mistaken. Mark, did your PM QoS update fix that?
Quoted 7 lines
I'm pretty sure it can be called in atomic context, and if its not I'm sure we can fix that. It can be called in atomic context. I don't think it was ever a problem to call it in atomic context. The problem it had was that crappy list of string compares. Thats been fixed.
--mgross
Well, the register call uses kzalloc. Apart from that I think we're good.
The outstanding list traversals can be fixed also. (see below)
Cheers,
FloFrom
66fdd76f8cc4be722dba3859ddadfe07e7a4b755Mon Sep 17 00:00:00 2001
From: Florian Mickler <[email protected]>
Date: Tue, 1 Jun 2010 09:04:26 +0200
Subject: [PATCH]pm_qos: remove unnecessary list-traversalThe new
extreme_valueis only depending on the oldextreme_valueand the changing value.Signed-off-by Florian Mickler <[email protected]>--- kernel/pm_qos_params.c | 20 ++++++++++++++------ 1 files changed, 14 insertions(+), 6 deletions(-)kernel/pm_qos_params.c +0
-0@@ -136,6 +136,16 @@ static s32 min_compare(s32 v1, s32 v2) }
kernel/pm_qos_params.c static s32 min_compare(s32 v1, s32 v2) · line 148
Quoted 10 lines
kernel/pm_qos_params.c +10
-0+static void update_target_val (int pm_qos_class,s32 val) +{ +s32 extreme_value; +s32 new_value; + extreme_value =atomic_read (&pm_qos_array[pm_qos_class]->target_value); + new_value = pm_qos_array[pm_qos_class]->comparitor (val,extreme_value); +if (extreme_value != new_value) +atomic_set (&pm_qos_array[pm_qos_class]->target_value,new_value); +} +
Only works 1/2 the time, but I like the idea!
It fails to get the righ answer when constraints are reduced. But, this idea is a good improvement i'll roll into the next pm_qos update!
thanks!
--mgross
Quoted 43 lines
kernel/pm_qos_params.c +4
-6static void update_target (int pm_qos_class) {s32 extreme_value;@@ -227,8 +237,8 @@ struct pm_qos_request_list *pm_qos_add_request(int pm_qos_class, s32 value)spin_lock_irqsave (&pm_qos_lock, flags);list_add (&dep->list, &pm_qos_array[pm_qos_class]->requests.list); +update_target_val (pm_qos_class,dep->value);spin_unlock_irqrestore (&pm_qos_lock, flags); -update_target (pm_qos_class); }return dep;@@ -249,23 +259,21 @@ void pm_qos_update_request(struct pm_qos_request_list *pm_qos_req, s32 new_value) {unsigned long flags; -int pending_update =0 ;s32 temp;if (pm_qos_req) {/*guard against callers passing in null */ +int target = pm_qos_req->pm_qos_class;spin_lock_irqsave (&pm_qos_lock, flags);if (new_value ==PM_QOS_DEFAULT_VALUE ) - temp = pm_qos_array[pm_qos_req->pm_qos_class]->default_value; + temp = pm_qos_array[target]->default_value;else temp = new_value;if (temp != pm_qos_req->value) { - pending_update =1 ; pm_qos_req->value = temp; +update_target_val (target,temp); }spin_unlock_irqrestore (&pm_qos_lock, flags); -if (pending_update) -update_target (pm_qos_req->pm_qos_class); } }EXPORT_SYMBOL_GPL (pm_qos_update_request);Signature · 1 line
1.7.1
Quoted 34 lines · Florian Mickler
Quoted 31 lines · On Mon, 31 May 2010 16:26:17 -0700 mark gross <[email protected]> wrote:
Quoted 18 lines · Rafael J. Wysocki
Quoted 17 lines · Arve Hjønnevåg
2010/5/29 Alan Stern <[email protected]>:
Quoted 15 lines · Arve Hjønnevåg
Quoted 9 lines
Quoted 6 lines
In place of in-kernel suspend blockers, there will be a new type of QoS constraint -- call it
QOS_EVENTUALLY. It's a very weak constraint, compatible with all cpuidle modes in which runnable threads are allowed to run (which is all of them), but not compatible with suspend.This sound just like another API rename. It will work, but given that suspend blockers was the name least objectionable last time around, I'm not sure what this would solve.
It's not just a rename. By changing this into a QoS constraint, we make it more generally useful. Instead of standing on its own, it becomes part of the PM-QOS framework.
Quoted 6 lines
Quoted 2 lines
We cannot use the existing pm-qos framework. It is not safe to call from atomic context.
We've just merged a patch that fixed that if I'm not mistaken. Mark, did your PM QoS update fix that?
I'm pretty sure it can be called in atomic context, and if its not I'm sure we can fix that. It can be called in atomic context. I don't think it was ever a problem to call it in atomic context. The problem it had was that crappy list of string compares. Thats been fixed.
Quoted 5 lines
Quoted 2 lines
--mgross
Well, the register call uses kzalloc. Apart from that I think we're good.
registering shouldn't need to be called in atomic context. Its the update_request that needs to be callible form atomic context.
--mgross
Quoted 34 lines · Florian Mickler
Quoted 31 lines · On Mon, 31 May 2010 16:26:17 -0700 mark gross <[email protected]> wrote:
Quoted 18 lines · Rafael J. Wysocki
Quoted 17 lines · Arve Hjønnevåg
2010/5/29 Alan Stern <[email protected]>:
Quoted 15 lines · Arve Hjønnevåg
Quoted 9 lines
Quoted 6 lines
In place of in-kernel suspend blockers, there will be a new type of QoS constraint -- call it
QOS_EVENTUALLY. It's a very weak constraint, compatible with all cpuidle modes in which runnable threads are allowed to run (which is all of them), but not compatible with suspend.This sound just like another API rename. It will work, but given that suspend blockers was the name least objectionable last time around, I'm not sure what this would solve.
It's not just a rename. By changing this into a QoS constraint, we make it more generally useful. Instead of standing on its own, it becomes part of the PM-QOS framework.
Quoted 6 lines
Quoted 2 lines
We cannot use the existing pm-qos framework. It is not safe to call from atomic context.
We've just merged a patch that fixed that if I'm not mistaken. Mark, did your PM QoS update fix that?
I'm pretty sure it can be called in atomic context, and if its not I'm sure we can fix that. It can be called in atomic context. I don't think it was ever a problem to call it in atomic context. The problem it had was that crappy list of string compares. Thats been fixed.
Quoted 5 lines
Quoted 2 lines
--mgross
Well, the register call uses kzalloc. Apart from that I think we're good.
registering shouldn't need to be called in atomic context. Its the update_request that needs to be callible form atomic context.
--mgross
Quoted 22 lines · mark gross
Quoted 21 lines · Rafael J. Wysocki
Quoted 19 lines · Arve Hjønnevåg
2010/5/29 Alan Stern <[email protected]>:
Quoted 7 lines · Arve Hjønnevåg
Quoted 6 lines
Quoted 6 lines
In place of in-kernel suspend blockers, there will be a new type of QoS constraint -- call it
QOS_EVENTUALLY. It's a very weak constraint, compatible with all cpuidle modes in which runnable threads are allowed to run (which is all of them), but not compatible with suspend.Quoted 8 lines
Quoted 3 lines
This sound just like another API rename. It will work, but given that suspend blockers was the name least objectionable last time around, I'm not sure what this would solve.
It's not just a rename. By changing this into a QoS constraint, we make it more generally useful. Instead of standing on its own, it becomes part of the PM-QOS framework.
We cannot use the existing pm-qos framework. It is not safe to call from atomic context.
Quoted 9 lines
Quoted 3 lines
We've just merged a patch that fixed that if I'm not mistaken. Mark, did your PM QoS update fix that?
I'm pretty sure it can be called in atomic context, and if its not I'm sure we can fix that. It can be called in atomic context. I don't think it was ever a problem to call it in atomic context. The problem it had was that crappy list of string compares. Thats been fixed.
um, the notifiers that are currently used may not be cool in atomic context :(
--mgross
Quoted 21 lines
--mgross
Quoted 19 lines
Quoted 2 lines
Also, it does not have any state constraints, so it iterates over every registered constraint each time one of them changes.
That's fixable IMO.
Quoted 1 line
Nor does is currently provide any stats for debugging.
That's why Alan is proposing to add that.
Quoted 4 lines
The original wakelock patchset supported a wakelock type so it could be used to block more then suspend, but I had to remove this because it "overlapped" with pm-qos. So, yes I do consider this just another rename.
It's an extension of an existing framework rather than an addition of a new one, with entirely new API and so on. Extending existing APIs is much preferred to adding new ones, in general.
Rafael
Quoted 22 lines · mark gross
Quoted 21 lines · Rafael J. Wysocki
Quoted 19 lines · Arve Hjønnevåg
2010/5/29 Alan Stern <[email protected]>:
Quoted 7 lines · Arve Hjønnevåg
Quoted 6 lines
Quoted 6 lines
In place of in-kernel suspend blockers, there will be a new type of QoS constraint -- call it
QOS_EVENTUALLY. It's a very weak constraint, compatible with all cpuidle modes in which runnable threads are allowed to run (which is all of them), but not compatible with suspend.Quoted 8 lines
Quoted 3 lines
This sound just like another API rename. It will work, but given that suspend blockers was the name least objectionable last time around, I'm not sure what this would solve.
It's not just a rename. By changing this into a QoS constraint, we make it more generally useful. Instead of standing on its own, it becomes part of the PM-QOS framework.
We cannot use the existing pm-qos framework. It is not safe to call from atomic context.
Quoted 9 lines
Quoted 3 lines
We've just merged a patch that fixed that if I'm not mistaken. Mark, did your PM QoS update fix that?
I'm pretty sure it can be called in atomic context, and if its not I'm sure we can fix that. It can be called in atomic context. I don't think it was ever a problem to call it in atomic context. The problem it had was that crappy list of string compares. Thats been fixed.
um, the notifiers that are currently used may not be cool in atomic context :(
--mgross
Quoted 21 lines
--mgross
Quoted 19 lines
Quoted 2 lines
Also, it does not have any state constraints, so it iterates over every registered constraint each time one of them changes.
That's fixable IMO.
Quoted 1 line
Nor does is currently provide any stats for debugging.
That's why Alan is proposing to add that.
Quoted 4 lines
The original wakelock patchset supported a wakelock type so it could be used to block more then suspend, but I had to remove this because it "overlapped" with pm-qos. So, yes I do consider this just another rename.
It's an extension of an existing framework rather than an addition of a new one, with entirely new API and so on. Extending existing APIs is much preferred to adding new ones, in general.
Rafael
Quoted 18 lines · Rafael J. Wysocki
Quoted 17 lines · Arve Hjønnevåg
2010/5/29 Alan Stern <[email protected]>:
Quoted 15 lines · Arve Hjønnevåg
Quoted 9 lines
Quoted 6 lines
In place of in-kernel suspend blockers, there will be a new type of QoS constraint -- call it
QOS_EVENTUALLY. It's a very weak constraint, compatible with all cpuidle modes in which runnable threads are allowed to run (which is all of them), but not compatible with suspend.This sound just like another API rename. It will work, but given that suspend blockers was the name least objectionable last time around, I'm not sure what this would solve.
It's not just a rename. By changing this into a QoS constraint, we make it more generally useful. Instead of standing on its own, it becomes part of the PM-QOS framework.
Quoted 6 lines
Quoted 2 lines
We cannot use the existing pm-qos framework. It is not safe to call from atomic context.
We've just merged a patch that fixed that if I'm not mistaken. Mark, did your PM QoS update fix that?
I'm pretty sure it can be called in atomic context, and if its not I'm sure we can fix that. It can be called in atomic context. I don't think it was ever a problem to call it in atomic context. The problem it had was that crappy list of string compares. Thats been fixed.
--mgross
Quoted 19 lines
Quoted 2 lines
Also, it does not have any state constraints, so it iterates over every registered constraint each time one of them changes.
That's fixable IMO.
Quoted 1 line
Nor does is currently provide any stats for debugging.
That's why Alan is proposing to add that.
Quoted 4 lines
The original wakelock patchset supported a wakelock type so it could be used to block more then suspend, but I had to remove this because it "overlapped" with pm-qos. So, yes I do consider this just another rename.
It's an extension of an existing framework rather than an addition of a new one, with entirely new API and so on. Extending existing APIs is much preferred to adding new ones, in general.
Rafael
Quoted 12 lines · Arve Hjønnevåg
2010/5/29 Alan Stern <[email protected]>:
Quoted 11 lines · Arve Hjønnevåg
Quoted 9 lines
Quoted 6 lines
In place of in-kernel suspend blockers, there will be a new type of QoS constraint -- call it
QOS_EVENTUALLY. It's a very weak constraint, compatible with all cpuidle modes in which runnable threads are allowed to run (which is all of them), but not compatible with suspend.This sound just like another API rename. It will work, but given that suspend blockers was the name least objectionable last time around, I'm not sure what this would solve.
Quoted 7 lines
Quoted 4 lines
It's not just a rename. By changing this into a QoS constraint, we make it more generally useful. Instead of standing on its own, it becomes part of the PM-QOS framework.
We cannot use the existing pm-qos framework. It is not safe to call from atomic context.
We've just merged a patch that fixed that if I'm not mistaken. Mark, did your PM QoS update fix that?
Quoted 2 lines
Also, it does not have any state constraints, so it iterates over every registered constraint each time one of them changes.
That's fixable IMO.
Quoted 1 line
Nor does is currently provide any stats for debugging.
That's why Alan is proposing to add that.
Quoted 4 lines
The original wakelock patchset supported a wakelock type so it could be used to block more then suspend, but I had to remove this because it "overlapped" with pm-qos. So, yes I do consider this just another rename.
It's an extension of an existing framework rather than an addition of a new one, with entirely new API and so on. Extending existing APIs is much preferred to adding new ones, in general.
Rafael
Quoted 8 lines · Peter Zijlstra
Quoted 7 lines · Florian Mickler
Quoted 3 lines · On Sat, 29 May 2010 00:11:32 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Having reconsidered the suspend blockers idea I came to the conclusion that in fact it was a workaround for three different problems.
Quoted 8 lines
Quoted 5 lines
But it is also a change of paradigm. The scheduler should strive to have the system idle as long as possible to conserve battery. And everything that does not serve the purpose of the device has to be considered as not worth running, except if there are other purpose-fullfilling tasks to run anyway.
No the purpose of the scheduler is to run tasks when they are runnable. Not to second guess whatever caused them to become runnable.
I still think there is a semantic issue here ... see other email.
Quoted 2 lines
If you start to randomly not run tasks, the inversion chaos that ensues is terrible.
As a sweeping statement, I disagree because you're explicitly saying we can't solve the actual problem. If you're saying the scheduler shouldn't do this and something external has to make the tasks idle somehow first, I agree.
Quoted 3 lines
You can apply the regular means of alleviating that and
that entails adding *-inheritance to all blockable resources. The -rt patch set is doing that in part.
So as a mechanism for idling tasks, this looks possible. I don't like it from a theoretical viewpoint because it can't idle cpu bound tasks. I'd like a solution that solved all of the problem, not just all except stuff we think probably won't happen on a phone because experience tells me that partial solutions eventually turn up gotchas down the road.
Quoted 8 lines
You really need to make applications not want to run and block on their own volition (in a resource free point) and otherwise make them block on something forcefully and disregard any malfunctioning that would result from that, and in extreme cases terminate (releasing all resources).
But really Android shouldn't even need kernel support to do all this, since its hosted on this massive middle-ware that intercepts everything, called a Java Virtual Machine.
The timers for a polling main loop have to be stopped ... this isn't possible with the current interface today, therefore we have to have kernel changes in some form.
Quoted 3 lines
Now, all I'm interested in is providing interfaces from the kernel where needed, so that userspace can be optimally frugal with power usage, and can monitor/contain badly behaving tasks.
So, that sounds like the goal of just about everyone on the thread.
Quoted 4 lines
If Android is so set in its ways that they don't want to adopt (like saying Android requires suspend for power management) then they can go their own merry way and I'm not interested anymore (it would be a shame though).
They haven't actually said this. They've said they've implemented opportunistic suspend because it solves two problems: power savings for devices whose C states don't go as low as S3 and forced idling of tasks. Their main goal is extending battery life per charge, and what I've heard them say is any solution that does this is fine ... as long as the life per charge is as good as (or preferably better than) their current implementation ... I don't think that's unreasonable, and I think it might be achievable with some of the ideas in this thread.
James
Quoted 8 lines · Peter Zijlstra
Quoted 7 lines · Florian Mickler
Quoted 3 lines · On Sat, 29 May 2010 00:11:32 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Having reconsidered the suspend blockers idea I came to the conclusion that in fact it was a workaround for three different problems.
Quoted 8 lines
Quoted 5 lines
But it is also a change of paradigm. The scheduler should strive to have the system idle as long as possible to conserve battery. And everything that does not serve the purpose of the device has to be considered as not worth running, except if there are other purpose-fullfilling tasks to run anyway.
No the purpose of the scheduler is to run tasks when they are runnable. Not to second guess whatever caused them to become runnable.
I still think there is a semantic issue here ... see other email.
Quoted 2 lines
If you start to randomly not run tasks, the inversion chaos that ensues is terrible.
As a sweeping statement, I disagree because you're explicitly saying we can't solve the actual problem. If you're saying the scheduler shouldn't do this and something external has to make the tasks idle somehow first, I agree.
Quoted 3 lines
You can apply the regular means of alleviating that and
that entails adding *-inheritance to all blockable resources. The -rt patch set is doing that in part.
So as a mechanism for idling tasks, this looks possible. I don't like it from a theoretical viewpoint because it can't idle cpu bound tasks. I'd like a solution that solved all of the problem, not just all except stuff we think probably won't happen on a phone because experience tells me that partial solutions eventually turn up gotchas down the road.
Quoted 8 lines
You really need to make applications not want to run and block on their own volition (in a resource free point) and otherwise make them block on something forcefully and disregard any malfunctioning that would result from that, and in extreme cases terminate (releasing all resources).
But really Android shouldn't even need kernel support to do all this, since its hosted on this massive middle-ware that intercepts everything, called a Java Virtual Machine.
The timers for a polling main loop have to be stopped ... this isn't possible with the current interface today, therefore we have to have kernel changes in some form.
Quoted 3 lines
Now, all I'm interested in is providing interfaces from the kernel where needed, so that userspace can be optimally frugal with power usage, and can monitor/contain badly behaving tasks.
So, that sounds like the goal of just about everyone on the thread.
Quoted 4 lines
If Android is so set in its ways that they don't want to adopt (like saying Android requires suspend for power management) then they can go their own merry way and I'm not interested anymore (it would be a shame though).
They haven't actually said this. They've said they've implemented opportunistic suspend because it solves two problems: power savings for devices whose C states don't go as low as S3 and forced idling of tasks. Their main goal is extending battery life per charge, and what I've heard them say is any solution that does this is fine ... as long as the life per charge is as good as (or preferably better than) their current implementation ... I don't think that's unreasonable, and I think it might be achievable with some of the ideas in this thread.
James
Quoted 12 lines · Peter Zijlstra
Quoted 7 lines · Arve Hjønnevåg
What happens if the user presses the button right before you set QoS of 'user apps' to
QS_NONE?
To me it looks like this solution would result in this sequence which may ignore the button press:
Button pushed
Button driver sets QoS of app it wakes toQS_ABOVESUSPENDSet QoS of 'user apps' toQS_NONEI don't think we should change app QoS parameters, but change service provider parameters.
Quoted 8 lines
For instance, suppose the filesystem-IO QoS has 3 levels:
High, Normal and Idle.Then if we assign Idle to updatedb, we'll service it as long as the filesystem-server QoS has a higher level (High and Normal). When we change the filesystem-serves' QoS to idle, it finds there is nothing to keep it servicing stuff and it'll block pending requests, updatedb stops being runnable and we're good.
Yeah, that's what I was thinking. It would be nice to have a mechanism that would prevent tasks from being runnable in specific conditions (not necessarily related to power management even).
Having reconsidered the suspend blockers idea I came to the conclusion that in fact it was a workaround for three different problems.
The first one was that we couldn't power manage I/O devices at run time and the only way to put them into low-power states was to carry out full system suspend. That's changed with the introduction of the runtime PM framework, but the situation is still not ideal, because in general there's no connection between the idle infrastructure and runtime PM.
This IMO is the second problem worked around by suspend blockers. Namely, it generally would be nice to suspend I/O devices when CPUs are idle for a sufficiently long time. For this to work, there should be a way to register a device with the idle framework so that it can tell the device's driver to suspend the device when it makes sense. Something like <vague idea>idle_register_device(dev, t), where t means "suspend that device after all CPUs have been idle for time t", so basically the idle framework will only need to run pm_schedule_suspend(dev, t) for that device right before idling the last CPU</vague idea>.
The third problem is exactly that on Android system there are (or at least there may be) tasks that in specific situations should not be regarded as runnable at all and currently there's no way to ensure they won't run other than going to a full suspend.
If we could address these issues somehow, I think suspend blockers would not be necessary for maximizing battery life (well, there are some technical details like automatic going to full suspend when the CPUs and I/O have been idle for sufficiently long etc., but they all seem to be tractable).
[And there's a problem of periodic timers that trigger too often, but I think that's just a general issue that need to be fixed anyway.]
Thanks,
Rafael
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 7 lines · Arve Hjønnevåg
What happens if the user presses the button right before you set QoS of 'user apps' to
QS_NONE?
To me it looks like this solution would result in this sequence which may ignore the button press:
Button pushed
Button driver sets QoS of app it wakes toQS_ABOVESUSPENDSet QoS of 'user apps' toQS_NONE
I don't think we should change app QoS parameters, but change service provider parameters.
For instance, suppose the filesystem-IO QoS has 3 levels:
High, Normal and Idle.
Then if we assign Idle to updatedb, we'll service it as long as the filesystem-server QoS has a higher level (High and Normal). When we change the filesystem-serves' QoS to idle, it finds there is nothing to keep it servicing stuff and it'll block pending requests, updatedb stops being runnable and we're good.
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 3 lines
This is a much harder question to answer that what we need to use opportunistic suspend. The question we ask is more like this: "Is all important work complete?". In the simplest case these can be the same,
I don't believe you can answer that question without telepathy and a crystal ball.
The application doesn't know because it has no idea how to balance conflicting resource demands or to infer the users requirements and wishes. Most apps will misbehave anyway.
The OS doesn't know because it cannot tell what the app wants
So at best you have a heuristic.
Quoted 2 lines
What happens if the user presses the button right before you set QoS of 'user apps' to
QS_NONE?
Read down a paragraph.
Quoted 15 lines
To me it looks like this solution would result in this sequence which may ignore the button press:
Button pushed
Button driver sets QoS of app it wakes toQS_ABOVESUSPENDSet QoS of 'user apps' toQS_NONEQuoted 7 lines
That would I think solve the reliable wakeup case although drivers raising a QoS parameter is a bit unusual in the kernel. That would at least however be specific to a few Android drivers and maybe a tiny amount of shared driver stuff so probably not unacceptable. (
wake_up_pri(&queue, priority); isn't going to kill anyone is it - especially if it usually ignores the priority argument)
Quoted 1 line
Why is "
wake_up_pri(&queue, priority)" more acceptable than "suspend_block(..."?
We keep it kernel side
It expresses policy and wishes rather than enforcing a behaviour.
What for example does "suspend_block" mean on a virtual machine ?
I would prefer "priority" was some kind of resource constraint model instead but I'm just trying to think how to be absolutely minimally invasible at this point.
Quoted 11 lines
What happens if the button press happend before this line:
Quoted 10 lines
count2 = tasks to
QS_NONE|QS_NOTCHANGEDScreen off
Button Press task toQS_ABOVESUSPENDcount = tasks that areQS_NOTCHANGEDtoQS_NONEif (count != count2) {
Stuff happened ... rethink
}
Quoted 8 lines
Quoted 5 lines
That is still a bit weird and wonderful but all the logic is in the right places. The special magic remains in the Android policy code and in the kernel specifics for Android.
Thoughts ?
I don't think it works. Also, it does not seem much less invasive than suspend blockers.
"I don't think it works" isn't that helpful. I don't think it works because .. would help me a lot more.
I think it's a loss let invasive because you are not exposing a ton of stuff to user space in general (just some private chit chat between a couple of processes). I would prefer it didn't even do that but simply used QoS guarantees. However I don't see a way to achieve that given your intended QoS guarantees change according to actions like screen off.
Alan
2010/5/28 Alan Cox <[email protected]>:
Quoted 7 lines
Quoted 3 lines
This is a much harder question to answer that what we need to use opportunistic suspend. The question we ask is more like this: "Is all important work complete?". In the simplest case these can be the same,
I don't believe you can answer that question without telepathy and a crystal ball.
But we have answered this question.
Quoted 54 lines
The application doesn't know because it has no idea how to balance conflicting resource demands or to infer the users requirements and wishes. Most apps will misbehave anyway.
The OS doesn't know because it cannot tell what the app wants
So at best you have a heuristic.
Quoted 2 lines
What happens if the user presses the button right before you set QoS of 'user apps' to QS_NONE?
Read down a paragraph.
Quoted 15 lines
To me it looks like this solution would result in this sequence which may ignore the button press:
Button pushed
Button driver sets QoS of app it wakes toQS_ABOVESUSPENDSet QoS of 'user apps' toQS_NONEQuoted 7 lines
That would I think solve the reliable wakeup case although drivers raising a QoS parameter is a bit unusual in the kernel. That would at least however be specific to a few Android drivers and maybe a tiny amount of shared driver stuff so probably not unacceptable. (
wake_up_pri(&queue, priority); isn't going to kill anyone is it - especially if it usually ignores the priority argument)Quoted 1 line
Why is "
wake_up_pri(&queue, priority)" more acceptable than "suspend_block(..."?We keep it kernel side
It expresses policy and wishes rather than enforcing a behaviour.What for example does "
suspend_block" mean on a virtual machine ?I would prefer "priority" was some kind of resource constraint model instead but I'm just trying to think how to be absolutely minimally invasible at this point.
Quoted 15 lines
What happens if the button press happend before this line:
Quoted 14 lines
count2 = tasks to
QS_NONE|QS_NOTCHANGEDScreen off
Button Press task toQS_ABOVESUSPENDcount = tasks that areQS_NOTCHANGEDtoQS_NONEif (count != count2) {
Stuff happened ... rethink
}That is still a bit weird and wonderful but all the logic is in the right places. The special magic remains in the Android policy code and in the kernel specifics for Android.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Thoughts ?
I don't think it works. Also, it does not seem much less invasive than suspend blockers.
"I don't think it works" isn't that helpful. I don't think it works because .. would help me a lot more.
Did you miss this:
Quoted 2 lines
Quoted 2 lines
What happens if the button press happend before this line:
Quoted 1 line
count2 = tasks to
QS_NONE|QS_NOTCHANGED
As far as I can tell this is the same race I described where you just told me to read down a paragraph.
Signature · 1 line
Arve Hjønnevåg
2010/5/28 Alan Cox <[email protected]>:
Quoted 7 lines
Quoted 3 lines
This is a much harder question to answer that what we need to use opportunistic suspend. The question we ask is more like this: "Is all important work complete?". In the simplest case these can be the same,
I don't believe you can answer that question without telepathy and a crystal ball.
But we have answered this question.
Quoted 54 lines
The application doesn't know because it has no idea how to balance conflicting resource demands or to infer the users requirements and wishes. Most apps will misbehave anyway.
The OS doesn't know because it cannot tell what the app wants
So at best you have a heuristic.
Quoted 2 lines
What happens if the user presses the button right before you set QoS of 'user apps' to QS_NONE?
Read down a paragraph.
Quoted 15 lines
To me it looks like this solution would result in this sequence which may ignore the button press:
Button pushed
Button driver sets QoS of app it wakes toQS_ABOVESUSPENDSet QoS of 'user apps' toQS_NONEQuoted 7 lines
That would I think solve the reliable wakeup case although drivers raising a QoS parameter is a bit unusual in the kernel. That would at least however be specific to a few Android drivers and maybe a tiny amount of shared driver stuff so probably not unacceptable. (
wake_up_pri(&queue, priority); isn't going to kill anyone is it - especially if it usually ignores the priority argument)Quoted 1 line
Why is "
wake_up_pri(&queue, priority)" more acceptable than "suspend_block(..."?We keep it kernel side
It expresses policy and wishes rather than enforcing a behaviour.What for example does "
suspend_block" mean on a virtual machine ?I would prefer "priority" was some kind of resource constraint model instead but I'm just trying to think how to be absolutely minimally invasible at this point.
Quoted 15 lines
What happens if the button press happend before this line:
Quoted 14 lines
count2 = tasks to
QS_NONE|QS_NOTCHANGEDScreen off
Button Press task toQS_ABOVESUSPENDcount = tasks that areQS_NOTCHANGEDtoQS_NONEif (count != count2) {
Stuff happened ... rethink
}That is still a bit weird and wonderful but all the logic is in the right places. The special magic remains in the Android policy code and in the kernel specifics for Android.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Thoughts ?
I don't think it works. Also, it does not seem much less invasive than suspend blockers.
"I don't think it works" isn't that helpful. I don't think it works because .. would help me a lot more.
Did you miss this:
Quoted 2 lines
Quoted 2 lines
What happens if the button press happend before this line:
Quoted 1 line
count2 = tasks to
QS_NONE|QS_NOTCHANGED
As far as I can tell this is the same race I described where you just told me to read down a paragraph.
Signature · 1 line
Arve Hjønnevåg
Quoted 17 lines · Alan Cox
Quoted 9 lines
That's correct, but to me the Arve's goal is simply to maximize battery life and he found experimentally that the longest battery life is achieved if system suspend is used whenever the system doesn't need to be active (from its user's perspective). This actually is different from "when the system is idle", because the system isn't idle, for example, when updatedb is running. However, from the user's perspective the updatedb process doesn't really need to run at this particular time, it can very well do it's job in parallel with the user typing or reading news. So, the system may very well be suspended when updatedb is running.
This is where the original questions around QoS came in
Quoted 4 lines
Since I think we've now rejected the feature, do we have a clear picture about what the Android people should do _instead_ and yet keep the battery life they want? Because I don't think telling "let them do what they want, who cares" is right.
Quoted 7 lines
Today "idle" means "no task running"
If you are prepared to rephrase that as "no task that matters is running" what would need to answer ?
- How do we define who matters: QoS ?
This is a much harder question to answer that what we need to use opportunistic suspend. The question we ask is more like this: "Is all important work complete?". In the simplest case these can be the same, but on Android they are not. Some wakeup events require work to be performed in many processes. A thread that needs to respond to a wakeup event may currently be busy doing unimportant work. This could possibly be solved by saying all important work must be above priority N, but you would need full priority inheritance support and we are not there today.
Quoted 9 lines
- Can you describe "idle" in terms of QoS without then breaking the reliable wakeup for an event (and do you need to ?)
Could this for example look like
Set QoS of 'user apps' to
QS_NONE
Button pushed
Button driver sets QoS of app it wakes toQS_ABOVESUSPEND
What happens if the user presses the button right before you set QoS of 'user apps' to QS_NONE?
To me it looks like this solution would result in this sequence which may ignore the button press:
Button pushed
Button driver sets QoS of app it wakes to QS_ABOVESUSPEND Set QoS of 'user apps' to QS_NONE
Quoted 7 lines
That would I think solve the reliable wakeup case although drivers raising a QoS parameter is a bit unusual in the kernel. That would at least however be specific to a few Android drivers and maybe a tiny amount of shared driver stuff so probably not unacceptable. (
wake_up_pri(&queue, priority); isn't going to kill anyone is it - especially if it usually ignores the priority argument)
Why is "wake_up_pri(&queue, priority)" more acceptable than "suspend_block(..."?
Quoted 28 lines
I am curious Thomas how that would tie in with PI in the RT world, it's effectively inheriting priority from the users finger.
- Would a model where the UI side behaviour looked like
Timeout
Screen Off
Set QoS of 'user apps' toQS_NONEEvent
[Some chain of activity]
Screen On
Set QoS of 'user apps' toQS_ABOVESUSPENDdo the job combined with the ability to see who is stopping us dropping to suspend so user space can take action. This could be a data table from the Android cpu manager provided to Android specific policy in whoever owns the display.
If so how do we fix the UI policy code doing
Screen Off
Button Press task toQS_ABOVESUSPENDtask toQS_NONE
Quoted 5 lines
without touching the app userspace code
Perhaps
What happens if the button press happend before this line:
Quoted 10 lines
count2 = tasks to
QS_NONE|QS_NOTCHANGEDScreen off
Button Press task toQS_ABOVESUSPENDcount = tasks that areQS_NOTCHANGEDtoQS_NONEif (count != count2) {
Stuff happened ... rethink
}
Quoted 5 lines
That is still a bit weird and wonderful but all the logic is in the right places. The special magic remains in the Android policy code and in the kernel specifics for Android.
Thoughts ?
I don't think it works. Also, it does not seem much less invasive than suspend blockers.
Signature · 1 line
Arve Hjønnevåg
Quoted 4 lines · Alan Cox
Today "idle" means "no task running"
If you are prepared to rephrase that as "no task that matters is running" what would need to answer ?
I'm not sure we need or want to go there.
Why not simply let upatedb block on its IO because its QoS policy tells us that its IO priority is idle. Therefore it will not avoid the IO device from going idle and indefinitely delaying servicing requests.
When updatedb blocks, the runqueue becomes empty and we gain goodness.
Or are we talking about the same thing?
Quoted 8 lines · Peter Zijlstra
Quoted 4 lines · Alan Cox
Today "idle" means "no task running"
If you are prepared to rephrase that as "no task that matters is running" what would need to answer ?
I'm not sure we need or want to go there.
Quoted 7 lines
Why not simply let upatedb block on its IO because its QoS policy tells us that its IO priority is idle. Therefore it will not avoid the IO device from going idle and indefinitely delaying servicing requests.
When updatedb blocks, the runqueue becomes empty and we gain goodness.
Or are we talking about the same thing?
There may be apps that don't actually do I/O that we may want to be treated that way too.
Consider the following scenario. I have a purely computational task that's running on my laptop in the background (say it's a folding@home or something similar), but I only want it to run when (a) the box is on AC power and (b) when user interface is "active" (the latter would have to be defined precisely, but for the purpose of this thought experiment let's assume we have such a definition). Then, I'd only like it to be regarded as runnable if (a) and (b) both happen at the same time, but it can't block on I/O.
Thanks,
Rafael
Quoted 20 lines · Rafael J. Wysocki
Quoted 8 lines · Peter Zijlstra
Quoted 4 lines · Alan Cox
Today "idle" means "no task running"
If you are prepared to rephrase that as "no task that matters is running" what would need to answer ?
I'm not sure we need or want to go there.
Quoted 7 lines
Why not simply let upatedb block on its IO because its QoS policy tells us that its IO priority is idle. Therefore it will not avoid the IO device from going idle and indefinitely delaying servicing requests.
When updatedb blocks, the runqueue becomes empty and we gain goodness.
Or are we talking about the same thing?
There may be apps that don't actually do I/O that we may want to be treated that way too.
Quoted 7 lines
Consider the following scenario. I have a purely computational task that's running on my laptop in the background (say it's a folding@home or something similar), but I only want it to run when (a) the box is on AC power and (b) when user interface is "active" (the latter would have to be defined precisely, but for the purpose of this thought experiment let's assume we have such a definition). Then, I'd only like it to be regarded as runnable if (a) and (b) both happen at the same time, but it can't block on I/O.
Well, both folding@home and Seti will need to do some IO in order to get new data and report results, although the computational task might indeed take quite a while before it does so.
Such tasks should listen to general environment hints, we already have battery power state exposed, make it use that information. The user interface is active can be gotten from X.
The thing is, if its a well behaved app and listens to the environment hints, it will work as you want (could be done by policy knobs all-round).
The only problem is dealing with apps that don't listen, those are considered bad/buggy and hence we don't particularly care if they don't function properly.
For long-running computational tasks we will send a progression of SIGXCPU, SIGSTOP, SIGTERM and eventually SIGKILL if they keep violating policy.
Quoted 20 lines · Rafael J. Wysocki
Quoted 8 lines · Peter Zijlstra
Quoted 4 lines · Alan Cox
Today "idle" means "no task running"
If you are prepared to rephrase that as "no task that matters is running" what would need to answer ?
I'm not sure we need or want to go there.
Quoted 7 lines
Why not simply let upatedb block on its IO because its QoS policy tells us that its IO priority is idle. Therefore it will not avoid the IO device from going idle and indefinitely delaying servicing requests.
When updatedb blocks, the runqueue becomes empty and we gain goodness.
Or are we talking about the same thing?
There may be apps that don't actually do I/O that we may want to be treated that way too.
Quoted 7 lines
Consider the following scenario. I have a purely computational task that's running on my laptop in the background (say it's a folding@home or something similar), but I only want it to run when (a) the box is on AC power and (b) when user interface is "active" (the latter would have to be defined precisely, but for the purpose of this thought experiment let's assume we have such a definition). Then, I'd only like it to be regarded as runnable if (a) and (b) both happen at the same time, but it can't block on I/O.
Well, both folding@home and Seti will need to do some IO in order to get new data and report results, although the computational task might indeed take quite a while before it does so.
Such tasks should listen to general environment hints, we already have battery power state exposed, make it use that information. The user interface is active can be gotten from X.
The thing is, if its a well behaved app and listens to the environment hints, it will work as you want (could be done by policy knobs all-round).
The only problem is dealing with apps that don't listen, those are considered bad/buggy and hence we don't particularly care if they don't function properly.
For long-running computational tasks we will send a progression of SIGXCPU, SIGSTOP, SIGTERM and eventually SIGKILL if they keep violating policy.
Quoted 8 lines · Peter Zijlstra
Quoted 4 lines · Alan Cox
Today "idle" means "no task running"
If you are prepared to rephrase that as "no task that matters is running" what would need to answer ?
I'm not sure we need or want to go there.
Quoted 7 lines
Why not simply let upatedb block on its IO because its QoS policy tells us that its IO priority is idle. Therefore it will not avoid the IO device from going idle and indefinitely delaying servicing requests.
When updatedb blocks, the runqueue becomes empty and we gain goodness.
Or are we talking about the same thing?
There may be apps that don't actually do I/O that we may want to be treated that way too.
Consider the following scenario. I have a purely computational task that's running on my laptop in the background (say it's a folding@home or something similar), but I only want it to run when (a) the box is on AC power and (b) when user interface is "active" (the latter would have to be defined precisely, but for the purpose of this thought experiment let's assume we have such a definition). Then, I'd only like it to be regarded as runnable if (a) and (b) both happen at the same time, but it can't block on I/O.
Thanks,
Rafael
Quoted 4 lines · Alan Cox
Today "idle" means "no task running"
If you are prepared to rephrase that as "no task that matters is running" what would need to answer ?
I'm not sure we need or want to go there.
Why not simply let upatedb block on its IO because its QoS policy tells us that its IO priority is idle. Therefore it will not avoid the IO device from going idle and indefinitely delaying servicing requests.
When updatedb blocks, the runqueue becomes empty and we gain goodness.
Or are we talking about the same thing?
Quoted 9 lines
That's correct, but to me the Arve's goal is simply to maximize battery life and he found experimentally that the longest battery life is achieved if system suspend is used whenever the system doesn't need to be active (from its user's perspective). This actually is different from "when the system is idle", because the system isn't idle, for example, when updatedb is running. However, from the user's perspective the updatedb process doesn't really need to run at this particular time, it can very well do it's job in parallel with the user typing or reading news. So, the system may very well be suspended when updatedb is running.
This is where the original questions around QoS came in
Quoted 4 lines
Since I think we've now rejected the feature, do we have a clear picture about what the Android people should do _instead_ and yet keep the battery life they want? Because I don't think telling "let them do what they want, who cares" is right.
Today "idle" means "no task running"
If you are prepared to rephrase that as "no task that matters is running" what would need to answer ?
- How do we define who matters: QoS ?
- Can you describe "idle" in terms of QoS without then breaking the reliable wakeup for an event (and do you need to ?)
Could this for example look like
Set QoS of 'user apps' to QS_NONE
Button pushed
Button driver sets QoS of app it wakes to QS_ABOVESUSPEND
That would I think solve the reliable wakeup case although drivers raising a QoS parameter is a bit unusual in the kernel. That would at least however be specific to a few Android drivers and maybe a tiny amount of shared driver stuff so probably not unacceptable. (wake_up_pri(&queue, priority); isn't going to kill anyone is it - especially if it usually ignores the priority argument)
I am curious Thomas how that would tie in with PI in the RT world, it's effectively inheriting priority from the users finger.
- Would a model where the UI side behaviour looked like
Timeout
Screen Off
Set QoS of 'user apps' to QS_NONE
Event
[Some chain of activity]
Screen On
Set QoS of 'user apps' to QS_ABOVESUSPEND
do the job combined with the ability to see who is stopping us dropping to suspend so user space can take action. This could be a data table from the Android cpu manager provided to Android specific policy in whoever owns the display.
If so how do we fix the UI policy code doing
Screen Off
Button Press task to QS_ABOVESUSPEND
task to QS_NONE
without touching the app userspace code
Perhaps
count2 = tasks to QS_NONE | QS_NOTCHANGED Screen off
Button Press task to QS_ABOVESUSPEND
count = tasks that are QS_NOTCHANGED to QS_NONE
if (count != count2) {
Stuff happened ... rethink
}
That is still a bit weird and wonderful but all the logic is in the right places. The special magic remains in the Android policy code and in the kernel specifics for Android.
Thoughts ?
Quoted 1 line
No, it's not. Forced suspend may be in response to hitting a key, but it
You are the only person here talking about 'forced' suspends. The rest of us are talking about idling down and ensuring we are always in a state we un-idle correctly.
Quoted 3 lines
may also be in response to a 30 minute timeout expiring. If I get a WoL packet in the 0.5 of a second between userspace deciding to suspend and actually doing so, the system shouldn't suspend.
I don't think that argument holds water in the form you have it
What about 5 nanoseconds before you suspend. Now you can't do that (laws of physics and stuff).
So your position would seem to be "we have a race but can debate how big is permissible"
The usual model is
"At no point should we be in a position when entering a suspend style
deep sleep where we neither abort the suspend, nor commit to a suspend/resume sequence if the events we care about occur"
and that is why the hardware model is
Set wake flags
Check if idle
If idle
Suspend
else
Clear wake flags
Unwind
and the wake flags guarantee that an event at any point after the wake flags are set until they are cleared will cause a suspend to be resumed, possibly immediately after the suspend.
Alan
Quoted 8 lines · Matthew Garrett
Quoted 2 lines · Peter Zijlstra
Shall we henceforth stop confusing forced suspend for laptops and powersaving a running system?
If you want to support forced suspend for laptops and you want to avoid the risk of losing wakeups then you need in-kernel suspend blockers. That's entirely orthogonal to Android's runtime power management.
The simple fact of life is, on PC style hardware suspend is mostly about missing events. I really _really_ want to miss mouse movement of my bluetooth mouse when the gear is stowed in my backpack.
Its perfectly OK to miss events on _forced_ suspend.
Quoted 7 lines · On Thu, 27 May 2010 18:57:19 +0100 Matthew Garrett <[email protected]> wrote:
Quoted 2 lines · Peter Zijlstra
Shall we henceforth stop confusing forced suspend for laptops and powersaving a running system?
If you want to support forced suspend for laptops and you want to avoid the risk of losing wakeups then you need in-kernel suspend blockers.
It isn't suspend blockers or nothing. Look at the bigger picture.
Quoted 7 lines · On Thu, 27 May 2010 18:57:19 +0100 Matthew Garrett <[email protected]> wrote:
Quoted 2 lines · Peter Zijlstra
Shall we henceforth stop confusing forced suspend for laptops and powersaving a running system?
If you want to support forced suspend for laptops and you want to avoid the risk of losing wakeups then you need in-kernel suspend blockers.
It isn't suspend blockers or nothing. Look at the bigger picture.
Quoted 8 lines · Matthew Garrett
Quoted 2 lines · Peter Zijlstra
Shall we henceforth stop confusing forced suspend for laptops and powersaving a running system?
If you want to support forced suspend for laptops and you want to avoid the risk of losing wakeups then you need in-kernel suspend blockers. That's entirely orthogonal to Android's runtime power management.
Rather than continue going around in circles, let's agree that what the Android people want is a new version of forced suspend -- not a power-saving idle mode. As such, latency is simply not relevant.
Here's an idea for a new approach that avoids the need for in-kernel suspend blockers. I don't know exactly how or if it can be made to work, but at least it's a different way of looking at the problem.
A normal forced suspend is unconditional: It stops the system no matter what is happening. The Android people want to make it conditional:
Don't stop the system until nothing "important" is happening.
So what is "important"? A possible definition could go like this. Let's add a per-process (or per-thread) flag to mark "important" processes. And let's say that a process with this flag set is doing "important" work unless it is blocked inside a poll() system call.
Given that definition, an opportunistic suspend is a forced suspend that waits until no important processes are doing important work (i.e., all important processes are stuck inside poll).
Is this adequate to meet Android's needs? I don't know. It can handle the case of a program waiting for a keystroke or network packet to arrive.
Does it allow for sufficient accounting statistics and debugging capability? I don't know -- no doubt this depends on how it is implemented.
Can it be made to work? I don't know -- in fact, I don't even know how the poll() system call works internally. Certainly there is one complication that needs to be handled: While a suspend is underway, the important processes will be frozen and hence not sitting inside the poll() call. If an event occurs that normally would cause the poll to complete, we would need to make it abort the suspend. But it's difficult to detect when this happens. It may be necessary to _avoid_ freezing the important processes in order for this to work.
The advantages:
No more suspend blockers cluttering up random drivers all over the kernel. All the work is centralized in the poll() routines and the PM core.
It is driven by userspace policy (which processes to mark as "important") rather than kernel choice.
Is this doable? Is it worth doing? Is it better than using suspend blockers?
Alan Stern
Quoted 8 lines · Matthew Garrett
Quoted 2 lines · Peter Zijlstra
Shall we henceforth stop confusing forced suspend for laptops and powersaving a running system?
If you want to support forced suspend for laptops and you want to avoid the risk of losing wakeups then you need in-kernel suspend blockers. That's entirely orthogonal to Android's runtime power management.
Rather than continue going around in circles, let's agree that what the Android people want is a new version of forced suspend -- not a power-saving idle mode. As such, latency is simply not relevant.
Here's an idea for a new approach that avoids the need for in-kernel suspend blockers. I don't know exactly how or if it can be made to work, but at least it's a different way of looking at the problem.
A normal forced suspend is unconditional: It stops the system no matter what is happening. The Android people want to make it conditional:
Don't stop the system until nothing "important" is happening.
So what is "important"? A possible definition could go like this. Let's add a per-process (or per-thread) flag to mark "important" processes. And let's say that a process with this flag set is doing "important" work unless it is blocked inside a poll() system call.
Given that definition, an opportunistic suspend is a forced suspend that waits until no important processes are doing important work (i.e., all important processes are stuck inside poll).
Is this adequate to meet Android's needs? I don't know. It can handle the case of a program waiting for a keystroke or network packet to arrive.
Does it allow for sufficient accounting statistics and debugging capability? I don't know -- no doubt this depends on how it is implemented.
Can it be made to work? I don't know -- in fact, I don't even know how the poll() system call works internally. Certainly there is one complication that needs to be handled: While a suspend is underway, the important processes will be frozen and hence not sitting inside the poll() call. If an event occurs that normally would cause the poll to complete, we would need to make it abort the suspend. But it's difficult to detect when this happens. It may be necessary to _avoid_ freezing the important processes in order for this to work.
The advantages:
No more suspend blockers cluttering up random drivers all over the kernel. All the work is centralized in the poll() routines and the PM core.
It is driven by userspace policy (which processes to mark as "important") rather than kernel choice.
Is this doable? Is it worth doing? Is it better than using suspend blockers?
Alan Stern
Quoted 2 lines
Rather than continue going around in circles, let's agree that what the Android people want is a new version of forced suspend -- not a
I don't think this is true. I think that is the root of the problem.
I don't disagree with the user experience they are trying to create or the fact something is needed to make it possible (if it turns out we can't already do it).
Forced suspend is sticking stuff in running state into suspend
Power management models (such as Thomas ARM box) which we know work are 'when nothing is running' into suspend.
So for me the real question on that side of this specific case is 'how do you make sure those tasks are idle when you need them to be'
QoS ?
Spanking them from user space ?
Drivers enforcing policy elements by blocking tasks ?
Alan
Quoted 4 lines · Alan Cox
Quoted 2 lines
Rather than continue going around in circles, let's agree that what the Android people want is a new version of forced suspend -- not a
I don't think this is true. I think that is the root of the problem.
Of course it's true. Just ask Arve -- he wants opportunistic suspend and it _is_ a variant of forced suspend. Ergo he wants a new type of forced suspend.
Maybe that's not what he _ought_ to want. Nevertheless, there are valid reasons for wanting it.
Quoted 9 lines
I don't disagree with the user experience they are trying to create or the fact something is needed to make it possible (if it turns out we can't already do it).
Forced suspend is sticking stuff in running state into suspend
Power management models (such as Thomas ARM box) which we know work are 'when nothing is running' into suspend.
Quoted 6 lines
So for me the real question on that side of this specific case is 'how do you make sure those tasks are idle when you need them to be'
QoS ?
Spanking them from user space ?
Drivers enforcing policy elements by blocking tasks ?
Currently we use the freezer. But it is a blunt tool -- it freezes every user process. Also, it doesn't actually make processes unrunnable; it just arranges things so that when they do run, they immediately put themselves back to sleep.
And the forced-suspend design relies on the fact that processes remain frozen throughout. If we leave some processes unfrozen and one of them somehow becomes runnable, that means we have to abort the forced suspend before the process is allowed to run.
Alan Stern
Quoted 4 lines · Alan Cox
Quoted 2 lines
Rather than continue going around in circles, let's agree that what the Android people want is a new version of forced suspend -- not a
I don't think this is true. I think that is the root of the problem.
Of course it's true. Just ask Arve -- he wants opportunistic suspend and it _is_ a variant of forced suspend. Ergo he wants a new type of forced suspend.
Maybe that's not what he _ought_ to want. Nevertheless, there are valid reasons for wanting it.
Quoted 9 lines
I don't disagree with the user experience they are trying to create or the fact something is needed to make it possible (if it turns out we can't already do it).
Forced suspend is sticking stuff in running state into suspend
Power management models (such as Thomas ARM box) which we know work are 'when nothing is running' into suspend.
Quoted 6 lines
So for me the real question on that side of this specific case is 'how do you make sure those tasks are idle when you need them to be'
QoS ?
Spanking them from user space ?
Drivers enforcing policy elements by blocking tasks ?
Currently we use the freezer. But it is a blunt tool -- it freezes every user process. Also, it doesn't actually make processes unrunnable; it just arranges things so that when they do run, they immediately put themselves back to sleep.
And the forced-suspend design relies on the fact that processes remain frozen throughout. If we leave some processes unfrozen and one of them somehow becomes runnable, that means we have to abort the forced suspend before the process is allowed to run.
Alan Stern
Quoted 10 lines · Alan Stern
Quoted 4 lines · Alan Cox
Quoted 2 lines
Rather than continue going around in circles, let's agree that what the Android people want is a new version of forced suspend -- not a
I don't think this is true. I think that is the root of the problem.
Of course it's true. Just ask Arve -- he wants opportunistic suspend and it _is_ a variant of forced suspend. Ergo he wants a new type of forced suspend.
Well, as I just wrote in a different message, what he _really_ wants is to get maximum possible battery life and he found experimentally that this is achieved by suspending the whole system as often as reasonably possible.
Of course, the "reasonably possible" part needs clarification.
Quoted 24 lines
Maybe that's not what he _ought_ to want. Nevertheless, there are valid reasons for wanting it.
Quoted 9 lines
I don't disagree with the user experience they are trying to create or the fact something is needed to make it possible (if it turns out we can't already do it).
Forced suspend is sticking stuff in running state into suspend
Power management models (such as Thomas ARM box) which we know work are 'when nothing is running' into suspend.
Quoted 6 lines
So for me the real question on that side of this specific case is 'how do you make sure those tasks are idle when you need them to be'
QoS ?
Spanking them from user space ?
Drivers enforcing policy elements by blocking tasks ?Currently we use the freezer. But it is a blunt tool -- it freezes every user process. Also, it doesn't actually make processes unrunnable; it just arranges things so that when they do run, they immediately put themselves back to sleep.
Quoted 4 lines
And the forced-suspend design relies on the fact that processes remain frozen throughout. If we leave some processes unfrozen and one of them somehow becomes runnable, that means we have to abort the forced suspend before the process is allowed to run.
We could avoid that if drivers could block tasks, but there are questions to answer. First off, how a driver is supposed to know when to block the task using it and when to do its power management transparently for the task? Second, how to intercept and block all possible interfaces that user space can use to talk to drivers (how to intercept a task using mmapped device, for example)?
Rafael
Quoted 11 lines · Rafael J. Wysocki
Quoted 4 lines
And the forced-suspend design relies on the fact that processes remain frozen throughout. If we leave some processes unfrozen and one of them somehow becomes runnable, that means we have to abort the forced suspend before the process is allowed to run.
We could avoid that if drivers could block tasks, but there are questions to answer. First off, how a driver is supposed to know when to block the task using it and when to do its power management transparently for the task? Second, how to intercept and block all possible interfaces that user space can use to talk to drivers (how to intercept a task using mmapped device, for example)?
We talked about this a few years ago and decided it was not feasible. It would require substantial changes to every device driver.
Alan Stern
Quoted 14 lines · Alan Stern
Quoted 11 lines · Rafael J. Wysocki
Quoted 4 lines
And the forced-suspend design relies on the fact that processes remain frozen throughout. If we leave some processes unfrozen and one of them somehow becomes runnable, that means we have to abort the forced suspend before the process is allowed to run.
We could avoid that if drivers could block tasks, but there are questions to answer. First off, how a driver is supposed to know when to block the task using it and when to do its power management transparently for the task? Second, how to intercept and block all possible interfaces that user space can use to talk to drivers (how to intercept a task using mmapped device, for example)?
Quoted 2 lines
We talked about this a few years ago and decided it was not feasible. It would require substantial changes to every device driver.
But what if its the _right_ thing to do? We make changes to every device driver out there on a regular basis. Also, why won't an incremental process work? Add the interface with a fallback for drivers that haven't implemented it and implement it for those drivers its most urgent (like those in use on an Android phone).
Not doing the right thing simply because its a lot of work seems like a fine way to let the kernel rot into an unmaintainable mess.
Quoted 14 lines · Alan Stern
Quoted 11 lines · Rafael J. Wysocki
Quoted 4 lines
And the forced-suspend design relies on the fact that processes remain frozen throughout. If we leave some processes unfrozen and one of them somehow becomes runnable, that means we have to abort the forced suspend before the process is allowed to run.
We could avoid that if drivers could block tasks, but there are questions to answer. First off, how a driver is supposed to know when to block the task using it and when to do its power management transparently for the task? Second, how to intercept and block all possible interfaces that user space can use to talk to drivers (how to intercept a task using mmapped device, for example)?
Quoted 2 lines
We talked about this a few years ago and decided it was not feasible. It would require substantial changes to every device driver.
But what if its the _right_ thing to do? We make changes to every device driver out there on a regular basis. Also, why won't an incremental process work? Add the interface with a fallback for drivers that haven't implemented it and implement it for those drivers its most urgent (like those in use on an Android phone).
Not doing the right thing simply because its a lot of work seems like a fine way to let the kernel rot into an unmaintainable mess.
Quoted 15 lines · Peter Zijlstra
Quoted 14 lines · Alan Stern
Quoted 11 lines · Rafael J. Wysocki
Quoted 4 lines
And the forced-suspend design relies on the fact that processes remain frozen throughout. If we leave some processes unfrozen and one of them somehow becomes runnable, that means we have to abort the forced suspend before the process is allowed to run.
We could avoid that if drivers could block tasks, but there are questions to answer. First off, how a driver is supposed to know when to block the task using it and when to do its power management transparently for the task? Second, how to intercept and block all possible interfaces that user space can use to talk to drivers (how to intercept a task using mmapped device, for example)?
Quoted 8 lines
Quoted 2 lines
We talked about this a few years ago and decided it was not feasible. It would require substantial changes to every device driver.
But what if its the _right_ thing to do? We make changes to every device driver out there on a regular basis. Also, why won't an incremental process work? Add the interface with a fallback for drivers that haven't implemented it and implement it for those drivers its most urgent (like those in use on an Android phone).
There is no reasonable fallback. In fact, I seriously doubt that there's any way to carry this out at all, reasonable or not. For example, how do you handle the situation where a user task gets an error because it accessed an mmapped address belonging to a device that has been suspended?
Quoted 2 lines
Not doing the right thing simply because its a lot of work seems like a fine way to let the kernel rot into an unmaintainable mess.
Firstly, it's not at all clear that this _is_ the right thing.
Secondly, when doing the right thing involves making invasive changes to half the .c files in the kernel, people might stop to think that it would add more bugs than it would solve problems.
Alan Stern
Quoted 15 lines · Peter Zijlstra
Quoted 14 lines · Alan Stern
Quoted 11 lines · Rafael J. Wysocki
Quoted 4 lines
And the forced-suspend design relies on the fact that processes remain frozen throughout. If we leave some processes unfrozen and one of them somehow becomes runnable, that means we have to abort the forced suspend before the process is allowed to run.
We could avoid that if drivers could block tasks, but there are questions to answer. First off, how a driver is supposed to know when to block the task using it and when to do its power management transparently for the task? Second, how to intercept and block all possible interfaces that user space can use to talk to drivers (how to intercept a task using mmapped device, for example)?
Quoted 8 lines
Quoted 2 lines
We talked about this a few years ago and decided it was not feasible. It would require substantial changes to every device driver.
But what if its the _right_ thing to do? We make changes to every device driver out there on a regular basis. Also, why won't an incremental process work? Add the interface with a fallback for drivers that haven't implemented it and implement it for those drivers its most urgent (like those in use on an Android phone).
There is no reasonable fallback. In fact, I seriously doubt that there's any way to carry this out at all, reasonable or not. For example, how do you handle the situation where a user task gets an error because it accessed an mmapped address belonging to a device that has been suspended?
Quoted 2 lines
Not doing the right thing simply because its a lot of work seems like a fine way to let the kernel rot into an unmaintainable mess.
Firstly, it's not at all clear that this _is_ the right thing.
Secondly, when doing the right thing involves making invasive changes to half the .c files in the kernel, people might stop to think that it would add more bugs than it would solve problems.
Alan Stern
Quoted 10 lines · Alan Stern
Quoted 4 lines · Alan Cox
Quoted 2 lines
Rather than continue going around in circles, let's agree that what the Android people want is a new version of forced suspend -- not a
I don't think this is true. I think that is the root of the problem.
Of course it's true. Just ask Arve -- he wants opportunistic suspend and it _is_ a variant of forced suspend. Ergo he wants a new type of forced suspend.
Well, as I just wrote in a different message, what he _really_ wants is to get maximum possible battery life and he found experimentally that this is achieved by suspending the whole system as often as reasonably possible.
Of course, the "reasonably possible" part needs clarification.
Quoted 24 lines
Maybe that's not what he _ought_ to want. Nevertheless, there are valid reasons for wanting it.
Quoted 9 lines
I don't disagree with the user experience they are trying to create or the fact something is needed to make it possible (if it turns out we can't already do it).
Forced suspend is sticking stuff in running state into suspend
Power management models (such as Thomas ARM box) which we know work are 'when nothing is running' into suspend.
Quoted 6 lines
So for me the real question on that side of this specific case is 'how do you make sure those tasks are idle when you need them to be'
QoS ?
Spanking them from user space ?
Drivers enforcing policy elements by blocking tasks ?Currently we use the freezer. But it is a blunt tool -- it freezes every user process. Also, it doesn't actually make processes unrunnable; it just arranges things so that when they do run, they immediately put themselves back to sleep.
Quoted 4 lines
And the forced-suspend design relies on the fact that processes remain frozen throughout. If we leave some processes unfrozen and one of them somehow becomes runnable, that means we have to abort the forced suspend before the process is allowed to run.
We could avoid that if drivers could block tasks, but there are questions to answer. First off, how a driver is supposed to know when to block the task using it and when to do its power management transparently for the task? Second, how to intercept and block all possible interfaces that user space can use to talk to drivers (how to intercept a task using mmapped device, for example)?
Rafael
Quoted 2 lines
Rather than continue going around in circles, let's agree that what the Android people want is a new version of forced suspend -- not a
I don't think this is true. I think that is the root of the problem.
I don't disagree with the user experience they are trying to create or the fact something is needed to make it possible (if it turns out we can't already do it).
Forced suspend is sticking stuff in running state into suspend
Power management models (such as Thomas ARM box) which we know work are 'when nothing is running' into suspend.
So for me the real question on that side of this specific case is 'how do you make sure those tasks are idle when you need them to be'
QoS ?
Spanking them from user space ?
Drivers enforcing policy elements by blocking tasks ?
Alan
Quoted 2 lines · Peter Zijlstra
Shall we henceforth stop confusing forced suspend for laptops and powersaving a running system?
If you want to support forced suspend for laptops and you want to avoid the risk of losing wakeups then you need in-kernel suspend blockers. That's entirely orthogonal to Android's runtime power management.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 9 lines · Peter Zijlstra
Quoted 1 line · Matthew Garrett
Even if we could use suspend-via-deep-idle-state on PCs,
( see Alan Cox's argument on PCs )
Quoted 1 line
we still need to be able to enter suspend while the system isn't idle.
_WHY_!?
You close your laptop's lid and throw the machine into a backpack. At that time you want it to suspend even though it may not be idle.
Quoted 1 line
We've been trying to tell you you don't need that.
And I'm trying to tell you that you do.
Alan Stern
Quoted 1 line · Matthew Garrett
Even if we could use suspend-via-deep-idle-state on PCs,
( see Alan Cox's argument on PCs )
Quoted 1 line
we still need to be able to enter suspend while the system isn't idle.
_WHY_!?
We've been trying to tell you you don't need that.
Quoted 11 lines · Matthew Garrett
Quoted 4 lines · Thomas Gleixner
Oh no. They paper over a short coming. If there is a pending event, the kernel knows that. It just does not make use of this information. Blockers just paper over this by sprinkling
do_not_suspend()calls all over the place. What a sensible solution.Even if we could use suspend-via-deep-idle-state on PCs, we still need to be able to enter suspend while the system isn't idle. There's two ways to do that:
Quoted 7 lines
1) Force the system to be idle. Doing this race-free is difficult.
2) Enter suspend even though the system isn't idle. Since we can't rely on the scheduler, we need drivers to know whether userspace has consumed all wakeup events before allowing the transition to occur. Doing so requires either in-kernel suspend blockers or something that's almost identical.
You're just not getting it. If user space has consumed the event is not relevant at all.
What's relevant is whether the app has processed the event and reacted accordingly. That's all that matters.
Emptying your input queue is just the wrong indicator.
And as I explained several times now: It does _NOT_ matter when the app goes back in to blocked/idle state. You have to spend the CPU cycles and power for that anyway.
And for the apps which do not use the user space blockers the queue empty indicator is just bullshit, because after emptying the queue the kernel can go into suspend w/o any guarantee that the event has been processed.
The whole concept sucks, as it does not solve anything. Burning power now or in 100ms is the same thing power consumption wise.
Thanks,
tglx
Quoted 5 lines · Thomas Gleixner
You're just not getting it. If user space has consumed the event is not relevant at all.
What's relevant is whether the app has processed the event and reacted accordingly. That's all that matters.
And how do you know that? We can't rely on the process scheduler.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 5 lines · Thomas Gleixner
You're just not getting it. If user space has consumed the event is not relevant at all.
What's relevant is whether the app has processed the event and reacted accordingly. That's all that matters.
And how do you know that? We can't rely on the process scheduler.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 38 lines · On Thu, 27 May 2010 20:05:39 +0200 (CEST) Thomas Gleixner <[email protected]>…
Quoted 11 lines · Matthew Garrett
Quoted 4 lines · Thomas Gleixner
Oh no. They paper over a short coming. If there is a pending event, the kernel knows that. It just does not make use of this information. Blockers just paper over this by sprinkling
do_not_suspend()calls all over the place. What a sensible solution.Even if we could use suspend-via-deep-idle-state on PCs, we still need to be able to enter suspend while the system isn't idle. There's two ways to do that:
Quoted 7 lines
1) Force the system to be idle. Doing this race-free is difficult.
2) Enter suspend even though the system isn't idle. Since we can't rely on the scheduler, we need drivers to know whether userspace has consumed all wakeup events before allowing the transition to occur. Doing so requires either in-kernel suspend blockers or something that's almost identical.
You're just not getting it. If user space has consumed the event is not relevant at all.
What's relevant is whether the app has processed the event and reacted accordingly. That's all that matters.
Emptying your input queue is just the wrong indicator.
And as I explained several times now: It does _NOT_ matter when the app goes back in to blocked/idle state. You have to spend the CPU cycles and power for that anyway.
And for the apps which do not use the user space blockers the queue empty indicator is just bullshit, because after emptying the queue the kernel can go into suspend w/o any guarantee that the event has been processed.
Quoted 6 lines
The whole concept sucks, as it does not solve anything. Burning power now or in 100ms is the same thing power consumption wise.
Thanks,
tglx
Thomas,
do you really have a problem with the actual concept? Or do you just don't like the way it is done?
IMO, the whole concept is defining 2 modes of operation:
1. user interacts with the device (at least one suspend block active)
2. user doesn't interact with the device (zero suspend block active)
In case 1. the device wants _everything_ sheduled as normal (and save maximum possible power, i.e. runtime pm with every technology available now).
In case 2. we want nothing sheduled (and save maximum possible power, i.e. suspend)
And now, every application and every kernel driver annotates (on behalve of the user) if it (possibly) interacts with the user.
(Is this really the problematic bit, that userspace is giving the kernel hints? Or is it that the hints are called "blocker"?)
We can only enter mode 2, if _nothing_ (claims) to interact with the user.
To integrate this with the current way of doing things, i gathered it needs to be implemented as an idle-state that does the suspend()-call?
Attributes of the idle states could be smth like this:
c3
cost-to-transition-to-this-state: X
powersavings-per-time: Y
expected time we stay in this state: relative short, there is a
timer sheduled
suspend-blockers: ignored
suspend
cost-to-transition-to-this-state: depends, how much drivers to suspend, how much processes to freeze, how much state to save
powersavings-per-time: Y
expected time we stay in this state: long, independent of
sheduled timers
suspend-blockers: must not be activated
Now all transitions and opportunistic suspend could be handled by the same algorithms.
Would this work?
Cheers,
Flo
Quoted 38 lines · On Thu, 27 May 2010 20:05:39 +0200 (CEST) Thomas Gleixner <[email protected]>…
Quoted 11 lines · Matthew Garrett
Quoted 4 lines · Thomas Gleixner
Oh no. They paper over a short coming. If there is a pending event, the kernel knows that. It just does not make use of this information. Blockers just paper over this by sprinkling
do_not_suspend()calls all over the place. What a sensible solution.Even if we could use suspend-via-deep-idle-state on PCs, we still need to be able to enter suspend while the system isn't idle. There's two ways to do that:
Quoted 7 lines
1) Force the system to be idle. Doing this race-free is difficult.
2) Enter suspend even though the system isn't idle. Since we can't rely on the scheduler, we need drivers to know whether userspace has consumed all wakeup events before allowing the transition to occur. Doing so requires either in-kernel suspend blockers or something that's almost identical.
You're just not getting it. If user space has consumed the event is not relevant at all.
What's relevant is whether the app has processed the event and reacted accordingly. That's all that matters.
Emptying your input queue is just the wrong indicator.
And as I explained several times now: It does _NOT_ matter when the app goes back in to blocked/idle state. You have to spend the CPU cycles and power for that anyway.
And for the apps which do not use the user space blockers the queue empty indicator is just bullshit, because after emptying the queue the kernel can go into suspend w/o any guarantee that the event has been processed.
Quoted 6 lines
The whole concept sucks, as it does not solve anything. Burning power now or in 100ms is the same thing power consumption wise.
Thanks,
tglx
Thomas,
do you really have a problem with the actual concept? Or do you just don't like the way it is done?
IMO, the whole concept is defining 2 modes of operation:
1. user interacts with the device (at least one suspend block active)
2. user doesn't interact with the device (zero suspend block active)
In case 1. the device wants _everything_ sheduled as normal (and save maximum possible power, i.e. runtime pm with every technology available now).
In case 2. we want nothing sheduled (and save maximum possible power, i.e. suspend)
And now, every application and every kernel driver annotates (on behalve of the user) if it (possibly) interacts with the user.
(Is this really the problematic bit, that userspace is giving the kernel hints? Or is it that the hints are called "blocker"?)
We can only enter mode 2, if _nothing_ (claims) to interact with the user.
To integrate this with the current way of doing things, i gathered it needs to be implemented as an idle-state that does the suspend()-call?
Attributes of the idle states could be smth like this:
c3
cost-to-transition-to-this-state: X
powersavings-per-time: Y
expected time we stay in this state: relative short, there is a
timer sheduled
suspend-blockers: ignored
suspend
cost-to-transition-to-this-state: depends, how much drivers to suspend, how much processes to freeze, how much state to save
powersavings-per-time: Y
expected time we stay in this state: long, independent of
sheduled timers
suspend-blockers: must not be activated
Now all transitions and opportunistic suspend could be handled by the same algorithms.
Would this work?
Cheers,
Flo
Quoted 48 lines · Florian Mickler
Quoted 38 lines · On Thu, 27 May 2010 20:05:39 +0200 (CEST) Thomas Gleixner <[email protected]>…
Quoted 11 lines · Matthew Garrett
Quoted 4 lines · Thomas Gleixner
Oh no. They paper over a short coming. If there is a pending event, the kernel knows that. It just does not make use of this information. Blockers just paper over this by sprinkling
do_not_suspend()calls all over the place. What a sensible solution.Even if we could use suspend-via-deep-idle-state on PCs, we still need to be able to enter suspend while the system isn't idle. There's two ways to do that:
Quoted 7 lines
1) Force the system to be idle. Doing this race-free is difficult.
2) Enter suspend even though the system isn't idle. Since we can't rely on the scheduler, we need drivers to know whether userspace has consumed all wakeup events before allowing the transition to occur. Doing so requires either in-kernel suspend blockers or something that's almost identical.
You're just not getting it. If user space has consumed the event is not relevant at all.
What's relevant is whether the app has processed the event and reacted accordingly. That's all that matters.
Emptying your input queue is just the wrong indicator.
And as I explained several times now: It does _NOT_ matter when the app goes back in to blocked/idle state. You have to spend the CPU cycles and power for that anyway.
And for the apps which do not use the user space blockers the queue empty indicator is just bullshit, because after emptying the queue the kernel can go into suspend w/o any guarantee that the event has been processed.
Quoted 6 lines
The whole concept sucks, as it does not solve anything. Burning power now or in 100ms is the same thing power consumption wise.
Thanks,
tglx
Quoted 8 lines
Thomas,
do you really have a problem with the actual concept? Or do you just don't like the way it is done?IMO, the whole concept is defining 2 modes of operation:
1. user interacts with the device (at least one suspend block active)
2. user doesn't interact with the device (zero suspend block active)
That is a somewhat odd way of looking at it. Yes we have two modes of operation, but an active suspend blocker does not mean that the user is interacting with the device. The way we use it, the "main" suspend blocker is active when the user interacts with the device (controlled by writing to /sys/power/state). All other suspend blockers are used to prevent suspend when user space has decided that the user is not interacting with the device. This includes blocking suspend in the kernel on key events which means the user actually is interacting with the device, even if user-space has not realized it yet. For other events, like an incoming phone call, we block suspend and make some noise with the hope that the user will start interacting with the device.
Quoted 8 lines
In case 1. the device wants _everything_ sheduled as normal (and save maximum possible power, i.e. runtime pm with every technology available now).
In case 2. we want nothing sheduled (and save maximum possible power, i.e. suspend)
OK.
Quoted 3 lines
And now, every application and every kernel driver annotates (on behalve of the user) if it (possibly) interacts with the user.
Applications that interact with the user do not normally need to block suspend. The user interacting with the device blocks suspend (just like with your desktop screen saver). Not every kernel driver needs to be annotated either, only potential wakeup events need to be annotated.
Quoted 6 lines
(Is this really the problematic bit, that userspace is giving the kernel hints? Or is it that the hints are called "blocker"?)
We can only enter mode 2, if _nothing_ (claims) to interact with the user.
If nothing blocks suspend. The reason to block suspend does not have to be direct user interaction.
Quoted 3 lines
To integrate this with the current way of doing things, i gathered it needs to be implemented as an idle-state that does the suspend()-call?
I think it is better no not confuse this with idle. Since initiating suspend will cause the system to become not-idle, I don't think is is beneficial to initiate suspend from idle.
Quoted 18 lines
Attributes of the idle states could be smth like this:
c3
cost-to-transition-to-this-state: X
powersavings-per-time: Y
expected time we stay in this state: relative short, there is a timer sheduled
suspend-blockers: ignoredsuspend
cost-to-transition-to-this-state: depends, how much drivers to suspend, how much processes to freeze, how much state to save
powersavings-per-time: Y
expected time we stay in this state: long, independent of sheduled timers
suspend-blockers: must not be activated
Quoted 5 lines
Now all transitions and opportunistic suspend could be handled by the same algorithms.
Would this work?
I'm not sure what you mean.
Signature · 1 line
Arve Hjønnevåg
Quoted 48 lines · Florian Mickler
Quoted 38 lines · On Thu, 27 May 2010 20:05:39 +0200 (CEST) Thomas Gleixner <[email protected]>…
Quoted 11 lines · Matthew Garrett
Quoted 4 lines · Thomas Gleixner
Oh no. They paper over a short coming. If there is a pending event, the kernel knows that. It just does not make use of this information. Blockers just paper over this by sprinkling
do_not_suspend()calls all over the place. What a sensible solution.Even if we could use suspend-via-deep-idle-state on PCs, we still need to be able to enter suspend while the system isn't idle. There's two ways to do that:
Quoted 7 lines
1) Force the system to be idle. Doing this race-free is difficult.
2) Enter suspend even though the system isn't idle. Since we can't rely on the scheduler, we need drivers to know whether userspace has consumed all wakeup events before allowing the transition to occur. Doing so requires either in-kernel suspend blockers or something that's almost identical.
You're just not getting it. If user space has consumed the event is not relevant at all.
What's relevant is whether the app has processed the event and reacted accordingly. That's all that matters.
Emptying your input queue is just the wrong indicator.
And as I explained several times now: It does _NOT_ matter when the app goes back in to blocked/idle state. You have to spend the CPU cycles and power for that anyway.
And for the apps which do not use the user space blockers the queue empty indicator is just bullshit, because after emptying the queue the kernel can go into suspend w/o any guarantee that the event has been processed.
Quoted 6 lines
The whole concept sucks, as it does not solve anything. Burning power now or in 100ms is the same thing power consumption wise.
Thanks,
tglx
Quoted 8 lines
Thomas,
do you really have a problem with the actual concept? Or do you just don't like the way it is done?IMO, the whole concept is defining 2 modes of operation:
1. user interacts with the device (at least one suspend block active)
2. user doesn't interact with the device (zero suspend block active)
That is a somewhat odd way of looking at it. Yes we have two modes of operation, but an active suspend blocker does not mean that the user is interacting with the device. The way we use it, the "main" suspend blocker is active when the user interacts with the device (controlled by writing to /sys/power/state). All other suspend blockers are used to prevent suspend when user space has decided that the user is not interacting with the device. This includes blocking suspend in the kernel on key events which means the user actually is interacting with the device, even if user-space has not realized it yet. For other events, like an incoming phone call, we block suspend and make some noise with the hope that the user will start interacting with the device.
Quoted 8 lines
In case 1. the device wants _everything_ sheduled as normal (and save maximum possible power, i.e. runtime pm with every technology available now).
In case 2. we want nothing sheduled (and save maximum possible power, i.e. suspend)
OK.
Quoted 3 lines
And now, every application and every kernel driver annotates (on behalve of the user) if it (possibly) interacts with the user.
Applications that interact with the user do not normally need to block suspend. The user interacting with the device blocks suspend (just like with your desktop screen saver). Not every kernel driver needs to be annotated either, only potential wakeup events need to be annotated.
Quoted 6 lines
(Is this really the problematic bit, that userspace is giving the kernel hints? Or is it that the hints are called "blocker"?)
We can only enter mode 2, if _nothing_ (claims) to interact with the user.
If nothing blocks suspend. The reason to block suspend does not have to be direct user interaction.
Quoted 3 lines
To integrate this with the current way of doing things, i gathered it needs to be implemented as an idle-state that does the suspend()-call?
I think it is better no not confuse this with idle. Since initiating suspend will cause the system to become not-idle, I don't think is is beneficial to initiate suspend from idle.
Quoted 18 lines
Attributes of the idle states could be smth like this:
c3
cost-to-transition-to-this-state: X
powersavings-per-time: Y
expected time we stay in this state: relative short, there is a timer sheduled
suspend-blockers: ignoredsuspend
cost-to-transition-to-this-state: depends, how much drivers to suspend, how much processes to freeze, how much state to save
powersavings-per-time: Y
expected time we stay in this state: long, independent of sheduled timers
suspend-blockers: must not be activated
Quoted 5 lines
Now all transitions and opportunistic suspend could be handled by the same algorithms.
Would this work?
I'm not sure what you mean.
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 · On Fri, 28 May 2010 02:18:06 -0700 Arve Hjønnevåg <[email protected]> wrote:
Quoted 4 lines
IMO, the whole concept is defining 2 modes of operation:
1. user interacts with the device (at least one suspend block active)
2. user doesn't interact with the device (zero suspend block active)
Quoted 12 lines
That is a somewhat odd way of looking at it. Yes we have two modes of operation, but an active suspend blocker does not mean that the user is interacting with the device. The way we use it, the "main" suspend blocker is active when the user interacts with the device (controlled by writing to
/sys/power/state). All other suspend blockers are used to prevent suspend when user space has decided that the user is not interacting with the device. This includes blocking suspend in the kernel on key events which means the user actually is interacting with the device, even if user-space has not realized it yet. For other events, like an incoming phone call, we block suspend and make some noise with the hope that the user will start interacting with the device.
Damn. I just want to put some abstract notion around this approach to power saving.
But one could say instead of "direct" interaction, that every time a suspend blocker is taken it is "on behalf of the user"?
So if a suspend blocker is taken, because a download is in progress, it is on behalf of (direct, or indirect) user interaction.
If a suspend blocker is taken, because a key-press has to trickle up to userspace, it is because of the user.
If a call comes in, a suspend blocker is taken, because the user wants to receive incomming calls.
So suspend blockers are always a hint to the kernel, that the action is "on behalf of the user" and it is therefore ok to not suspend the device?
Quoted 10 lines
Quoted 9 lines
In case 1. the device wants _everything_ sheduled as normal (and save maximum possible power, i.e. runtime pm with every technology available now).
In case 2. we want nothing sheduled (and save maximum possible power, i.e. suspend)
OK.
Good. I got this right at least.
Quoted 10 lines
Quoted 4 lines
And now, every application and every kernel driver annotates (on behalve of the user) if it (possibly) interacts with the user.
Applications that interact with the user do not normally need to block suspend. The user interacting with the device blocks suspend (just like with your desktop screen saver). Not every kernel driver needs to be annotated either, only potential wakeup events need to be annotated.
The applications interacting with the user rely on other parts of the system to block suspend then.
So it is (in general) not the application which determines if the user interacts, but other sources (like input-drivers) and possible a timeout?
Quoted 10 lines
Quoted 7 lines
(Is this really the problematic bit, that userspace is giving the kernel hints? Or is it that the hints are called "blocker"?)
We can only enter mode 2, if _nothing_ (claims) to interact with the user.
If nothing blocks suspend. The reason to block suspend does not have to be direct user interaction.
But couldn't you say, that the suspend blockers are always due to the user? Or is this too narrow? I mean we talk about a device here. And the device's purpose is it to serve the user. So it might be better to
say: suspend blockers annotate if a task is needed to fullfill the devices purpose?
It is an easy to understand concept if one says, the device suspends if it has nothing to do to further the cause.
I really want to get to a well expressed definition. suspend blockers block suspend. Shure. Buy why?
Quoted 8 lines
Quoted 4 lines
To integrate this with the current way of doing things, i gathered it needs to be implemented as an idle-state that does the suspend()-call?
I think it is better no not confuse this with idle. Since initiating suspend will cause the system to become not-idle, I don't think is is beneficial to initiate suspend from idle.
I'm not shure. But then again, i'm not too familiar with the kernel. It sounds like it could save some duplication of effort to integrate suspend into the idle-framework. "Purpose-fulness" could be just another measure of "idle".
Quoted 19 lines
Quoted 19 lines
Attributes of the idle states could be smth like this:
c3
cost-to-transition-to-this-state: X
powersavings-per-time: Y
expected time we stay in this state: relative short, there is a timer sheduled
suspend-blockers: ignoredsuspend
cost-to-transition-to-this-state: depends, how much drivers to suspend, how much processes to freeze, how much state to save
powersavings-per-time: Y
expected time we stay in this state: long, independent of sheduled timers
suspend-blockers: must not be activated
Quoted 7 lines
Quoted 5 lines
Now all transitions and opportunistic suspend could be handled by the same algorithms.
Would this work?
I'm not sure what you mean.
Yeah. It's a "little bit" handwavy.
But the concept I have in mind:
int what_good_would_it_be_to_go_into_this_state( state )
{
/*
cur_state = get_current_state();
benefit = ( get_power_per_time(cur_state)
- get_power_per_time(state) ) *
get_expected_time_we_stay_there( state );
cost = get_transition_cost(cur_state,state);
return benefit-cost;
*/
}and a constraint function:
bool is_this_state_possible( state )
{
/*
ret = true;
cur_latency_requirement = get_cur_latency_req();
ret &= (cur_latency_requirement >=state_latency_guaranty( state ) );
ret &= (some other QOS thingy);
return ret;
*/
}And now, a loop would enter the state which has the biggest score and is possible at the time.
Afaik this is already implemented for c-states in the cpu_idle drivers?
cheers,
Flo
2010/5/28 Florian Mickler <[email protected]>:
Quoted 33 lines
Quoted 5 lines · On Fri, 28 May 2010 02:18:06 -0700 Arve Hjønnevåg <[email protected]> wrote:
Quoted 4 lines
IMO, the whole concept is defining 2 modes of operation:
1. user interacts with the device (at least one suspend block active)
2. user doesn't interact with the device (zero suspend block active)Quoted 12 lines
That is a somewhat odd way of looking at it. Yes we have two modes of operation, but an active suspend blocker does not mean that the user is interacting with the device. The way we use it, the "main" suspend blocker is active when the user interacts with the device (controlled by writing to
/sys/power/state). All other suspend blockers are used to prevent suspend when user space has decided that the user is not interacting with the device. This includes blocking suspend in the kernel on key events which means the user actually is interacting with the device, even if user-space has not realized it yet. For other events, like an incoming phone call, we block suspend and make some noise with the hope that the user will start interacting with the device.Damn. I just want to put some abstract notion around this approach to power saving.
But one could say instead of "direct" interaction, that every time a suspend blocker is taken it is "on behalf of the user"?
So if a suspend blocker is taken, because a download is in progress, it is on behalf of (direct, or indirect) user interaction.
If a suspend blocker is taken, because a key-press has to trickle up to userspace, it is because of the user.
Quoted 7 lines
If a call comes in, a suspend blocker is taken, because the user wants to receive incomming calls.
So suspend blockers are always a hint to the kernel, that the action is "on behalf of the user" and it is therefore ok to not suspend the device?
We also use suspend blockers for work that is not visible to the user. The battery driver on the Nexus One wakes up periodically while charging to monitor the battery temperature and turn down the charge current if it gets too hot.
Quoted 24 lines
Quoted 10 lines
Quoted 9 lines
In case 1. the device wants _everything_ sheduled as normal (and save maximum possible power, i.e. runtime pm with every technology available now).
In case 2. we want nothing sheduled (and save maximum possible power, i.e. suspend)
OK.
Good. I got this right at least.
Quoted 10 lines
Quoted 4 lines
And now, every application and every kernel driver annotates (on behalve of the user) if it (possibly) interacts with the user.
Applications that interact with the user do not normally need to block suspend. The user interacting with the device blocks suspend (just like with your desktop screen saver). Not every kernel driver needs to be annotated either, only potential wakeup events need to be annotated.
Quoted 7 lines
The applications interacting with the user rely on other parts of the system to block suspend then.
So it is (in general) not the application which determines if the user interacts, but other sources (like input-drivers) and possible a timeout?
The user-space framework decides if the device is in an interactive mode or not (on Android phones the screen is off when it is not interactive). Input driver need to block suspend so the user-space framework gets the event when it is not already in interactive mode.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
(Is this really the problematic bit, that userspace is giving the kernel hints? Or is it that the hints are called "blocker"?)
We can only enter mode 2, if _nothing_ (claims) to interact with the user.
Quoted 9 lines
Quoted 2 lines
If nothing blocks suspend. The reason to block suspend does not have to be direct user interaction.
But couldn't you say, that the suspend blockers are always due to the user? Or is this too narrow? I mean we talk about a device here. And the device's purpose is it to serve the user. So it might be better to
say: suspend blockers annotate if a task is needed to fullfill the devices purpose?
I think it is more useful to say that suspend blockers annotate that some event needs to be processed even if the device is currently not in an interactive mode.
Quoted 12 lines
It is an easy to understand concept if one says, the device suspends if it has nothing to do to further the cause.
I really want to get to a well expressed definition. suspend blockers block suspend. Shure. Buy why?
Quoted 5 lines
Quoted 4 lines
To integrate this with the current way of doing things, i gathered it needs to be implemented as an idle-state that does the suspend()-call?
Quoted 9 lines
Quoted 3 lines
I think it is better no not confuse this with idle. Since initiating suspend will cause the system to become not-idle, I don't think is is beneficial to initiate suspend from idle.
I'm not shure. But then again, i'm not too familiar with the kernel. It sounds like it could save some duplication of effort to integrate suspend into the idle-framework. "Purpose-fulness" could be just another measure of "idle".
To me idle means that no threads are ready to run and no interrupts are pending.
Quoted 57 lines
Quoted 20 lines
Quoted 20 lines
Attributes of the idle states could be smth like this:
c3
cost-to-transition-to-this-state: X
powersavings-per-time: Y
expected time we stay in this state: relative short, there is a timer sheduled
suspend-blockers: ignoredsuspend
cost-to-transition-to-this-state: depends, how much drivers to suspend, how much processes to freeze, how much state to save
powersavings-per-time: Y
expected time we stay in this state: long, independent of sheduled timers
suspend-blockers: must not be activatedQuoted 7 lines
Quoted 5 lines
Now all transitions and opportunistic suspend could be handled by the same algorithms.
Would this work?
I'm not sure what you mean.
Yeah. It's a "little bit" handwavy.
But the concept I have in mind:
int
what_good_would_it_be_to_go_into_this_state( state ){
/*cur_state =
get_current_state(); benefit = (get_power_per_time(cur_state)
-get_power_per_time(state)) *get_expected_time_we_stay_there( state ); cost =get_transition_cost(cur_state,state); return benefit-cost;*/
}and a constraint function:
bool
is_this_state_possible( state )
{
/*ret = true;
cur_latency_requirement =get_cur_latency_req();
ret &= (cur_latency_requirement>=state_latency_guaranty( state ) ); ret &= (some other QOS thingy);
Quoted 9 lines
return ret;
*/
}And now, a loop would enter the state which has the biggest score and is possible at the time.
Afaik this is already implemented for c-states in the
cpu_idledrivers?
I don't think we can plug suspend in as a cpu idle state. 1. we want to suspend even the cpu is not idle. 2. starting suspend will cause the cpu to not be idle.
Signature · 1 line
Arve Hjønnevåg
Quoted 8 lines · On Fri, 28 May 2010 04:35:34 -0700 Arve Hjønnevåg <[email protected]> wrote:
2010/5/28 Florian Mickler <[email protected]>:
Quoted 4 lines
It sounds like it could save some duplication of effort to integrate suspend into the idle-framework. "Purpose-fulness" could be just another measure of "idle".
To me idle means that no threads are ready to run and no interrupts are pending.
I misused the term "idle". I tried to express this by "quoting" it.
Quoted 5 lines
I don't think we can plug suspend in as a cpu idle state. 1. we want to suspend even the cpu is not idle. 2. starting suspend will cause the cpu to not be idle.
yeah. it would have to move out of the cpu-specific context. it would be a more general "system-state" thing.
if the properties of the state's are well expressed, it does not matter that starting suspend will cause the cpu to not be idle, because our target-state(suspend) has better properties than any other state.
(or maybe there needs to be a "state-transition-in-flight" flag.)
if we take the "approximated duration of staying in that state" into account, we could provoke the pm-framework to always suspend if no constraint(i.e. blocker) is there.
But really. I think I can't implement something like that. Also I really have _no_ idea how much work this would be.
_And_ I am not really shure if this is a better approach than the current solution.
Just an idea.
Cheers,
Flo
Quoted 8 lines · On Fri, 28 May 2010 04:35:34 -0700 Arve Hjønnevåg <[email protected]> wrote:
2010/5/28 Florian Mickler <[email protected]>:
Quoted 4 lines
It sounds like it could save some duplication of effort to integrate suspend into the idle-framework. "Purpose-fulness" could be just another measure of "idle".
To me idle means that no threads are ready to run and no interrupts are pending.
I misused the term "idle". I tried to express this by "quoting" it.
Quoted 5 lines
I don't think we can plug suspend in as a cpu idle state. 1. we want to suspend even the cpu is not idle. 2. starting suspend will cause the cpu to not be idle.
yeah. it would have to move out of the cpu-specific context. it would be a more general "system-state" thing.
if the properties of the state's are well expressed, it does not matter that starting suspend will cause the cpu to not be idle, because our target-state(suspend) has better properties than any other state.
(or maybe there needs to be a "state-transition-in-flight" flag.)
if we take the "approximated duration of staying in that state" into account, we could provoke the pm-framework to always suspend if no constraint(i.e. blocker) is there.
But really. I think I can't implement something like that. Also I really have _no_ idea how much work this would be.
_And_ I am not really shure if this is a better approach than the current solution.
Just an idea.
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
2010/5/28 Florian Mickler <[email protected]>:
Quoted 33 lines
Quoted 5 lines · On Fri, 28 May 2010 02:18:06 -0700 Arve Hjønnevåg <[email protected]> wrote:
Quoted 4 lines
IMO, the whole concept is defining 2 modes of operation:
1. user interacts with the device (at least one suspend block active)
2. user doesn't interact with the device (zero suspend block active)Quoted 12 lines
That is a somewhat odd way of looking at it. Yes we have two modes of operation, but an active suspend blocker does not mean that the user is interacting with the device. The way we use it, the "main" suspend blocker is active when the user interacts with the device (controlled by writing to
/sys/power/state). All other suspend blockers are used to prevent suspend when user space has decided that the user is not interacting with the device. This includes blocking suspend in the kernel on key events which means the user actually is interacting with the device, even if user-space has not realized it yet. For other events, like an incoming phone call, we block suspend and make some noise with the hope that the user will start interacting with the device.Damn. I just want to put some abstract notion around this approach to power saving.
But one could say instead of "direct" interaction, that every time a suspend blocker is taken it is "on behalf of the user"?
So if a suspend blocker is taken, because a download is in progress, it is on behalf of (direct, or indirect) user interaction.
If a suspend blocker is taken, because a key-press has to trickle up to userspace, it is because of the user.
Quoted 7 lines
If a call comes in, a suspend blocker is taken, because the user wants to receive incomming calls.
So suspend blockers are always a hint to the kernel, that the action is "on behalf of the user" and it is therefore ok to not suspend the device?
We also use suspend blockers for work that is not visible to the user. The battery driver on the Nexus One wakes up periodically while charging to monitor the battery temperature and turn down the charge current if it gets too hot.
Quoted 24 lines
Quoted 10 lines
Quoted 9 lines
In case 1. the device wants _everything_ sheduled as normal (and save maximum possible power, i.e. runtime pm with every technology available now).
In case 2. we want nothing sheduled (and save maximum possible power, i.e. suspend)
OK.
Good. I got this right at least.
Quoted 10 lines
Quoted 4 lines
And now, every application and every kernel driver annotates (on behalve of the user) if it (possibly) interacts with the user.
Applications that interact with the user do not normally need to block suspend. The user interacting with the device blocks suspend (just like with your desktop screen saver). Not every kernel driver needs to be annotated either, only potential wakeup events need to be annotated.
Quoted 7 lines
The applications interacting with the user rely on other parts of the system to block suspend then.
So it is (in general) not the application which determines if the user interacts, but other sources (like input-drivers) and possible a timeout?
The user-space framework decides if the device is in an interactive mode or not (on Android phones the screen is off when it is not interactive). Input driver need to block suspend so the user-space framework gets the event when it is not already in interactive mode.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
(Is this really the problematic bit, that userspace is giving the kernel hints? Or is it that the hints are called "blocker"?)
We can only enter mode 2, if _nothing_ (claims) to interact with the user.
Quoted 9 lines
Quoted 2 lines
If nothing blocks suspend. The reason to block suspend does not have to be direct user interaction.
But couldn't you say, that the suspend blockers are always due to the user? Or is this too narrow? I mean we talk about a device here. And the device's purpose is it to serve the user. So it might be better to
say: suspend blockers annotate if a task is needed to fullfill the devices purpose?
I think it is more useful to say that suspend blockers annotate that some event needs to be processed even if the device is currently not in an interactive mode.
Quoted 12 lines
It is an easy to understand concept if one says, the device suspends if it has nothing to do to further the cause.
I really want to get to a well expressed definition. suspend blockers block suspend. Shure. Buy why?
Quoted 5 lines
Quoted 4 lines
To integrate this with the current way of doing things, i gathered it needs to be implemented as an idle-state that does the suspend()-call?
Quoted 9 lines
Quoted 3 lines
I think it is better no not confuse this with idle. Since initiating suspend will cause the system to become not-idle, I don't think is is beneficial to initiate suspend from idle.
I'm not shure. But then again, i'm not too familiar with the kernel. It sounds like it could save some duplication of effort to integrate suspend into the idle-framework. "Purpose-fulness" could be just another measure of "idle".
To me idle means that no threads are ready to run and no interrupts are pending.
Quoted 57 lines
Quoted 20 lines
Quoted 20 lines
Attributes of the idle states could be smth like this:
c3
cost-to-transition-to-this-state: X
powersavings-per-time: Y
expected time we stay in this state: relative short, there is a timer sheduled
suspend-blockers: ignoredsuspend
cost-to-transition-to-this-state: depends, how much drivers to suspend, how much processes to freeze, how much state to save
powersavings-per-time: Y
expected time we stay in this state: long, independent of sheduled timers
suspend-blockers: must not be activatedQuoted 7 lines
Quoted 5 lines
Now all transitions and opportunistic suspend could be handled by the same algorithms.
Would this work?
I'm not sure what you mean.
Yeah. It's a "little bit" handwavy.
But the concept I have in mind:
int
what_good_would_it_be_to_go_into_this_state( state ){
/*cur_state =
get_current_state(); benefit = (get_power_per_time(cur_state)
-get_power_per_time(state)) *get_expected_time_we_stay_there( state ); cost =get_transition_cost(cur_state,state); return benefit-cost;*/
}and a constraint function:
bool
is_this_state_possible( state )
{
/*ret = true;
cur_latency_requirement =get_cur_latency_req();
ret &= (cur_latency_requirement>=state_latency_guaranty( state ) ); ret &= (some other QOS thingy);
Quoted 9 lines
return ret;
*/
}And now, a loop would enter the state which has the biggest score and is possible at the time.
Afaik this is already implemented for c-states in the
cpu_idledrivers?
I don't think we can plug suspend in as a cpu idle state. 1. we want to suspend even the cpu is not idle. 2. starting suspend will cause the cpu to not be idle.
Signature · 1 line
Arve Hjønnevåg
Quoted 5 lines · On Fri, 28 May 2010 02:18:06 -0700 Arve Hjønnevåg <[email protected]> wrote:
Quoted 4 lines
IMO, the whole concept is defining 2 modes of operation:
1. user interacts with the device (at least one suspend block active)
2. user doesn't interact with the device (zero suspend block active)
Quoted 12 lines
That is a somewhat odd way of looking at it. Yes we have two modes of operation, but an active suspend blocker does not mean that the user is interacting with the device. The way we use it, the "main" suspend blocker is active when the user interacts with the device (controlled by writing to
/sys/power/state). All other suspend blockers are used to prevent suspend when user space has decided that the user is not interacting with the device. This includes blocking suspend in the kernel on key events which means the user actually is interacting with the device, even if user-space has not realized it yet. For other events, like an incoming phone call, we block suspend and make some noise with the hope that the user will start interacting with the device.
Damn. I just want to put some abstract notion around this approach to power saving.
But one could say instead of "direct" interaction, that every time a suspend blocker is taken it is "on behalf of the user"?
So if a suspend blocker is taken, because a download is in progress, it is on behalf of (direct, or indirect) user interaction.
If a suspend blocker is taken, because a key-press has to trickle up to userspace, it is because of the user.
If a call comes in, a suspend blocker is taken, because the user wants to receive incomming calls.
So suspend blockers are always a hint to the kernel, that the action is "on behalf of the user" and it is therefore ok to not suspend the device?
Quoted 10 lines
Quoted 9 lines
In case 1. the device wants _everything_ sheduled as normal (and save maximum possible power, i.e. runtime pm with every technology available now).
In case 2. we want nothing sheduled (and save maximum possible power, i.e. suspend)
OK.
Good. I got this right at least.
Quoted 10 lines
Quoted 4 lines
And now, every application and every kernel driver annotates (on behalve of the user) if it (possibly) interacts with the user.
Applications that interact with the user do not normally need to block suspend. The user interacting with the device blocks suspend (just like with your desktop screen saver). Not every kernel driver needs to be annotated either, only potential wakeup events need to be annotated.
The applications interacting with the user rely on other parts of the system to block suspend then.
So it is (in general) not the application which determines if the user interacts, but other sources (like input-drivers) and possible a timeout?
Quoted 10 lines
Quoted 7 lines
(Is this really the problematic bit, that userspace is giving the kernel hints? Or is it that the hints are called "blocker"?)
We can only enter mode 2, if _nothing_ (claims) to interact with the user.
If nothing blocks suspend. The reason to block suspend does not have to be direct user interaction.
But couldn't you say, that the suspend blockers are always due to the user? Or is this too narrow? I mean we talk about a device here. And the device's purpose is it to serve the user. So it might be better to
say: suspend blockers annotate if a task is needed to fullfill the devices purpose?
It is an easy to understand concept if one says, the device suspends if it has nothing to do to further the cause.
I really want to get to a well expressed definition. suspend blockers block suspend. Shure. Buy why?
Quoted 8 lines
Quoted 4 lines
To integrate this with the current way of doing things, i gathered it needs to be implemented as an idle-state that does the suspend()-call?
I think it is better no not confuse this with idle. Since initiating suspend will cause the system to become not-idle, I don't think is is beneficial to initiate suspend from idle.
I'm not shure. But then again, i'm not too familiar with the kernel. It sounds like it could save some duplication of effort to integrate suspend into the idle-framework. "Purpose-fulness" could be just another measure of "idle".
Quoted 19 lines
Quoted 19 lines
Attributes of the idle states could be smth like this:
c3
cost-to-transition-to-this-state: X
powersavings-per-time: Y
expected time we stay in this state: relative short, there is a timer sheduled
suspend-blockers: ignoredsuspend
cost-to-transition-to-this-state: depends, how much drivers to suspend, how much processes to freeze, how much state to save
powersavings-per-time: Y
expected time we stay in this state: long, independent of sheduled timers
suspend-blockers: must not be activated
Quoted 7 lines
Quoted 5 lines
Now all transitions and opportunistic suspend could be handled by the same algorithms.
Would this work?
I'm not sure what you mean.
Yeah. It's a "little bit" handwavy.
But the concept I have in mind:
int what_good_would_it_be_to_go_into_this_state( state )
{
/*
cur_state = get_current_state();
benefit = ( get_power_per_time(cur_state)
- get_power_per_time(state) ) *
get_expected_time_we_stay_there( state );
cost = get_transition_cost(cur_state,state);
return benefit-cost;
*/
}and a constraint function:
bool is_this_state_possible( state )
{
/*
ret = true;
cur_latency_requirement = get_cur_latency_req();
ret &= (cur_latency_requirement >=state_latency_guaranty( state ) );
ret &= (some other QOS thingy);
return ret;
*/
}And now, a loop would enter the state which has the biggest score and is possible at the time.
Afaik this is already implemented for c-states in the cpu_idle drivers?
cheers,
Flo
Quoted 3 lines · Arve Hjønnevåg
Quoted 2 lines · Florian Mickler
On Thu, 27 May 2010 20:05:39 +0200 (CEST)
Thomas Gleixner <[email protected]> wrote:
...
Quoted 7 lines
Quoted 3 lines
To integrate this with the current way of doing things, i gathered it needs to be implemented as an idle-state that does the suspend()-call?
I think it is better no not confuse this with idle. Since initiating suspend will cause the system to become not-idle, I don't think is is beneficial to initiate suspend from idle.
It is, if the following two conditions hold simultaneously:
(a) Doing full system suspend is ultimately going to bring you more energy savings than the (presumably lowest) idle state you're currently in.
(b) You anticipate that the system will stay idle for a considerably long time such that it's worth suspending.
Thanks,
Rafael
2010/5/28 Rafael J. Wysocki <[email protected]>:
Quoted 13 lines · Arve Hjønnevåg
Quoted 3 lines · Florian Mickler
Quoted 2 lines
On Thu, 27 May 2010 20:05:39 +0200 (CEST)
Thomas Gleixner <[email protected]> wrote:...
Quoted 7 lines
Quoted 3 lines
To integrate this with the current way of doing things, i gathered it needs to be implemented as an idle-state that does the suspend()-call?
I think it is better no not confuse this with idle. Since initiating suspend will cause the system to become not-idle, I don't think is is beneficial to initiate suspend from idle.
Quoted 8 lines
It is, if the following two conditions hold simultaneously:
(a) Doing full system suspend is ultimately going to bring you more energy savings than the (presumably lowest) idle state you're currently in.
(b) You anticipate that the system will stay idle for a considerably long time such that it's worth suspending.
I still don't think this matters. If you are waiting for in interrupt that cannot wake you up from suspend, then idle is not an indicator that it is safe to enter suspend. I also don't think you can avoid any user-space suspend blockers by delaying suspend until the system goes idle since any page fault could cause it to go idle. Therefore I don't see a benefit in delaying suspend until idle when the last suspend blocker is released (it would only mask possible race conditions).
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 23 lines · Arve Hjønnevåg
2010/5/28 Rafael J. Wysocki <[email protected]>:
Quoted 13 lines · Arve Hjønnevåg
Quoted 3 lines · Florian Mickler
Quoted 2 lines
On Thu, 27 May 2010 20:05:39 +0200 (CEST)
Thomas Gleixner <[email protected]> wrote:...
Quoted 7 lines
Quoted 3 lines
To integrate this with the current way of doing things, i gathered it needs to be implemented as an idle-state that does the suspend()-call?
I think it is better no not confuse this with idle. Since initiating suspend will cause the system to become not-idle, I don't think is is beneficial to initiate suspend from idle.
Quoted 8 lines
It is, if the following two conditions hold simultaneously:
(a) Doing full system suspend is ultimately going to bring you more energy savings than the (presumably lowest) idle state you're currently in.
(b) You anticipate that the system will stay idle for a considerably long time such that it's worth suspending.
Quoted 7 lines
I still don't think this matters. If you are waiting for in interrupt that cannot wake you up from suspend, then idle is not an indicator that it is safe to enter suspend. I also don't think you can avoid any user-space suspend blockers by delaying suspend until the system goes idle since any page fault could cause it to go idle. Therefore I don't see a benefit in delaying suspend until idle when the last suspend blocker is released (it would only mask possible race conditions).
I wasn't referring to suspend blockers, but to the idea of initiating full system suspend from idle, which I still think makes sense. If you are waiting for an interrupt that cannot wake you from suspend, then _obviously_ suspend should not be started. However, if you're not waiting for such an interrupt and the (a) and (b) above hold, it makes sense to start suspend from idle.
Thanks,
Rafael
2010/5/29 Rafael J. Wysocki <[email protected]>:
Quoted 32 lines · Arve Hjønnevåg
Quoted 23 lines
2010/5/28 Rafael J. Wysocki <[email protected]>:
Quoted 13 lines · Arve Hjønnevåg
Quoted 3 lines · Florian Mickler
Quoted 2 lines
On Thu, 27 May 2010 20:05:39 +0200 (CEST)
Thomas Gleixner <[email protected]> wrote:...
Quoted 7 lines
Quoted 3 lines
To integrate this with the current way of doing things, i gathered it needs to be implemented as an idle-state that does the suspend()-call?
I think it is better no not confuse this with idle. Since initiating suspend will cause the system to become not-idle, I don't think is is beneficial to initiate suspend from idle.
Quoted 8 lines
It is, if the following two conditions hold simultaneously:
(a) Doing full system suspend is ultimately going to bring you more energy savings than the (presumably lowest) idle state you're currently in.
(b) You anticipate that the system will stay idle for a considerably long time such that it's worth suspending.
Quoted 7 lines
I still don't think this matters. If you are waiting for in interrupt that cannot wake you up from suspend, then idle is not an indicator that it is safe to enter suspend. I also don't think you can avoid any user-space suspend blockers by delaying suspend until the system goes idle since any page fault could cause it to go idle. Therefore I don't see a benefit in delaying suspend until idle when the last suspend blocker is released (it would only mask possible race conditions).
Quoted 7 lines
I wasn't referring to suspend blockers, but to the idea of initiating full system suspend from idle, which I still think makes sense. If you are waiting for an interrupt that cannot wake you from suspend, then _obviously_ suspend should not be started. However, if you're not waiting for such an interrupt and the (a) and (b) above hold, it makes sense to start suspend from idle.
What about timers? When you suspend timers stop (otherwise it is just a deep-idle mode), and this could cause problems. Some drivers rely on timers if the hardware does not have a completion interrupt. It is not uncommon to see send command x then wait 200ms in a some hardware specs.
Signature · 1 line
Arve Hjønnevåg
2010/5/29 Rafael J. Wysocki <[email protected]>:
Quoted 32 lines · Arve Hjønnevåg
Quoted 23 lines
2010/5/28 Rafael J. Wysocki <[email protected]>:
Quoted 13 lines · Arve Hjønnevåg
Quoted 3 lines · Florian Mickler
Quoted 2 lines
On Thu, 27 May 2010 20:05:39 +0200 (CEST)
Thomas Gleixner <[email protected]> wrote:...
Quoted 7 lines
Quoted 3 lines
To integrate this with the current way of doing things, i gathered it needs to be implemented as an idle-state that does the suspend()-call?
I think it is better no not confuse this with idle. Since initiating suspend will cause the system to become not-idle, I don't think is is beneficial to initiate suspend from idle.
Quoted 8 lines
It is, if the following two conditions hold simultaneously:
(a) Doing full system suspend is ultimately going to bring you more energy savings than the (presumably lowest) idle state you're currently in.
(b) You anticipate that the system will stay idle for a considerably long time such that it's worth suspending.
Quoted 7 lines
I still don't think this matters. If you are waiting for in interrupt that cannot wake you up from suspend, then idle is not an indicator that it is safe to enter suspend. I also don't think you can avoid any user-space suspend blockers by delaying suspend until the system goes idle since any page fault could cause it to go idle. Therefore I don't see a benefit in delaying suspend until idle when the last suspend blocker is released (it would only mask possible race conditions).
Quoted 7 lines
I wasn't referring to suspend blockers, but to the idea of initiating full system suspend from idle, which I still think makes sense. If you are waiting for an interrupt that cannot wake you from suspend, then _obviously_ suspend should not be started. However, if you're not waiting for such an interrupt and the (a) and (b) above hold, it makes sense to start suspend from idle.
What about timers? When you suspend timers stop (otherwise it is just a deep-idle mode), and this could cause problems. Some drivers rely on timers if the hardware does not have a completion interrupt. It is not uncommon to see send command x then wait 200ms in a some hardware specs.
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 41 lines · Arve Hjønnevåg
2010/5/29 Rafael J. Wysocki <[email protected]>:
Quoted 32 lines · Arve Hjønnevåg
Quoted 23 lines
2010/5/28 Rafael J. Wysocki <[email protected]>:
Quoted 13 lines · Arve Hjønnevåg
Quoted 3 lines · Florian Mickler
Quoted 2 lines
On Thu, 27 May 2010 20:05:39 +0200 (CEST)
Thomas Gleixner <[email protected]> wrote:...
Quoted 7 lines
Quoted 3 lines
To integrate this with the current way of doing things, i gathered it needs to be implemented as an idle-state that does the suspend()-call?
I think it is better no not confuse this with idle. Since initiating suspend will cause the system to become not-idle, I don't think is is beneficial to initiate suspend from idle.
Quoted 8 lines
It is, if the following two conditions hold simultaneously:
(a) Doing full system suspend is ultimately going to bring you more energy savings than the (presumably lowest) idle state you're currently in.
(b) You anticipate that the system will stay idle for a considerably long time such that it's worth suspending.
Quoted 7 lines
I still don't think this matters. If you are waiting for in interrupt that cannot wake you up from suspend, then idle is not an indicator that it is safe to enter suspend. I also don't think you can avoid any user-space suspend blockers by delaying suspend until the system goes idle since any page fault could cause it to go idle. Therefore I don't see a benefit in delaying suspend until idle when the last suspend blocker is released (it would only mask possible race conditions).
Quoted 7 lines
I wasn't referring to suspend blockers, but to the idea of initiating full system suspend from idle, which I still think makes sense. If you are waiting for an interrupt that cannot wake you from suspend, then _obviously_ suspend should not be started. However, if you're not waiting for such an interrupt and the (a) and (b) above hold, it makes sense to start suspend from idle.
Quoted 5 lines
What about timers? When you suspend timers stop (otherwise it is just a deep-idle mode), and this could cause problems. Some drivers rely on timers if the hardware does not have a completion interrupt. It is not uncommon to see send command x then wait 200ms in a some hardware specs.
QoS should be used in such cases.
Rafael
2010/5/30 Rafael J. Wysocki <[email protected]>:
Quoted 42 lines · Arve Hjønnevåg
Quoted 41 lines
2010/5/29 Rafael J. Wysocki <[email protected]>:
Quoted 39 lines · Arve Hjønnevåg
Quoted 23 lines
2010/5/28 Rafael J. Wysocki <[email protected]>:
Quoted 13 lines · Arve Hjønnevåg
Quoted 3 lines · Florian Mickler
Quoted 2 lines
On Thu, 27 May 2010 20:05:39 +0200 (CEST)
Thomas Gleixner <[email protected]> wrote:...
Quoted 7 lines
Quoted 3 lines
To integrate this with the current way of doing things, i gathered it needs to be implemented as an idle-state that does the suspend()-call?
I think it is better no not confuse this with idle. Since initiating suspend will cause the system to become not-idle, I don't think is is beneficial to initiate suspend from idle.
Quoted 8 lines
It is, if the following two conditions hold simultaneously:
(a) Doing full system suspend is ultimately going to bring you more energy savings than the (presumably lowest) idle state you're currently in.
(b) You anticipate that the system will stay idle for a considerably long time such that it's worth suspending.
Quoted 7 lines
I still don't think this matters. If you are waiting for in interrupt that cannot wake you up from suspend, then idle is not an indicator that it is safe to enter suspend. I also don't think you can avoid any user-space suspend blockers by delaying suspend until the system goes idle since any page fault could cause it to go idle. Therefore I don't see a benefit in delaying suspend until idle when the last suspend blocker is released (it would only mask possible race conditions).
I wasn't referring to suspend blockers, but to the idea of initiating full system suspend from idle, which I still think makes sense. If you are waiting for an interrupt that cannot wake you from suspend, then _obviously_ suspend should not be started. However, if you're not waiting for such an interrupt and the (a) and (b) above hold, it makes sense to start suspend from idle.
Quoted 8 lines
Quoted 5 lines
What about timers? When you suspend timers stop (otherwise it is just a deep-idle mode), and this could cause problems. Some drivers rely on timers if the hardware does not have a completion interrupt. It is not uncommon to see send command x then wait 200ms in a some hardware specs.
QoS should be used in such cases.
I think it makes more sense to block suspend while wakeup events are pending than blocking it everywhere timers are used by code that could be called while handling wakeup events or other critical work. Also, even if you did block suspend everywhere timers where used you still have the race where a wakeup interrupt happens right after you decided to suspend. In other words, you still need to block suspend in all the same places as with the current opportunistic suspend code, so what is the benefit of delaying suspend until idle?
Signature · 1 line
Arve Hjønnevåg
Quoted 1 line · Arve Hjønnevåg
2010/5/30 Rafael J. Wysocki <[email protected]>:
...
Quoted 9 lines
I think it makes more sense to block suspend while wakeup events are pending than blocking it everywhere timers are used by code that could be called while handling wakeup events or other critical work. Also, even if you did block suspend everywhere timers where used you still have the race where a wakeup interrupt happens right after you decided to suspend. In other words, you still need to block suspend in all the same places as with the current opportunistic suspend code, so what is the benefit of delaying suspend until idle?
Assume for a while that you don't use suspend blockers, OK? I realize you think that anything else doesn't make sense, but evidently some other people have that opinion about suspend blockers.
Now, under that assumption, I think it _generally_ is reasonable to make the system go into full suspend if everything (ie. CPUs and I/O) has been idle for sufficiently long time and there are no QoS requirements that aren't compatible with full system suspend.
Rafael
2010/5/31 Rafael J. Wysocki <[email protected]>:
Quoted 13 lines · Arve Hjønnevåg
Quoted 1 line
2010/5/30 Rafael J. Wysocki <[email protected]>:
...
Quoted 9 lines
I think it makes more sense to block suspend while wakeup events are pending than blocking it everywhere timers are used by code that could be called while handling wakeup events or other critical work. Also, even if you did block suspend everywhere timers where used you still have the race where a wakeup interrupt happens right after you decided to suspend. In other words, you still need to block suspend in all the same places as with the current opportunistic suspend code, so what is the benefit of delaying suspend until idle?
Quoted 4 lines
Assume for a while that you don't use suspend blockers, OK? I realize you think that anything else doesn't make sense, but evidently some other people have that opinion about suspend blockers.
It sounded like you were suggesting that initiating suspend from idle would somehow avoid the race condition with wakeup events. All I'm saying is that you would need to block suspend in all the same places. If you don't care about ignoring wakeup events, then sure you can initiate suspend from idle.
Quoted 5 lines
Now, under that assumption, I think it _generally_ is reasonable to make the system go into full suspend if everything (ie. CPUs and I/O) has been idle for sufficiently long time and there are no QoS requirements that aren't compatible with full system suspend.
Signature · 1 line
Arve Hjønnevåg
2010/5/31 Rafael J. Wysocki <[email protected]>:
Quoted 13 lines · Arve Hjønnevåg
Quoted 1 line
2010/5/30 Rafael J. Wysocki <[email protected]>:
...
Quoted 9 lines
I think it makes more sense to block suspend while wakeup events are pending than blocking it everywhere timers are used by code that could be called while handling wakeup events or other critical work. Also, even if you did block suspend everywhere timers where used you still have the race where a wakeup interrupt happens right after you decided to suspend. In other words, you still need to block suspend in all the same places as with the current opportunistic suspend code, so what is the benefit of delaying suspend until idle?
Quoted 4 lines
Assume for a while that you don't use suspend blockers, OK? I realize you think that anything else doesn't make sense, but evidently some other people have that opinion about suspend blockers.
It sounded like you were suggesting that initiating suspend from idle would somehow avoid the race condition with wakeup events. All I'm saying is that you would need to block suspend in all the same places. If you don't care about ignoring wakeup events, then sure you can initiate suspend from idle.
Quoted 5 lines
Now, under that assumption, I think it _generally_ is reasonable to make the system go into full suspend if everything (ie. CPUs and I/O) has been idle for sufficiently long time and there are no QoS requirements that aren't compatible with full system 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
Hi,
Quoted 6 lines · ext Arve Hjønnevåg
It sounded like you were suggesting that initiating suspend from idle would somehow avoid the race condition with wakeup events. All I'm saying is that you would need to block suspend in all the same places. If you don't care about ignoring wakeup events, then sure you can initiate suspend from idle.
Sorry if i'm asking something that was already said, but the thread is quite complex and i am not sure i have been able to grasp all of it.
So, regardless of the SW implementation:
-1) are you focusing on "good" HW or do you want to address all at the same time?
-2) would you be ok with addressing "bad" HW as a special case, which requires workarounds and shouldn't dictate the overall design?
-3) do you agree with the assumption that new HW is expected to get reasonably better and therefore workarounds at point 2) will progressively be confined to devices less and less common?
-4) going to the definition of "good" and "bad" (maybe this should have come earlier in the list), can we define "good" HW as HW where:
* suspend state and lowest achievable runtime idle state are basically equivalent from both power consumption and latency pov
* the HW itself is properly able to track wakeup sources while it is in its deepest power state (as example OMAP3 has few independent wake-capable pads and a "wake ring" where one only gets the information that at least one of the pads belonging to such ring has received a wakeup)
* wakeup sources can be dynamically masked at HW level, so that if a peripheral is not interesting, it doesn't wakeup the system (for example the camera button when the camera cover is closed)
-5) HW that is not capable of properly generating asynchronous signal is most likely the cause for extra timers in kernel and it should be considered "bad" - in any other case having recurring in-kernel timers should be treated as bugs, if their existence is not tied to some meaningful work
thanks, igor
Hi,
Quoted 6 lines · ext Arve Hjønnevåg
It sounded like you were suggesting that initiating suspend from idle would somehow avoid the race condition with wakeup events. All I'm saying is that you would need to block suspend in all the same places. If you don't care about ignoring wakeup events, then sure you can initiate suspend from idle.
Sorry if i'm asking something that was already said, but the thread is quite complex and i am not sure i have been able to grasp all of it.
So, regardless of the SW implementation:
-1) are you focusing on "good" HW or do you want to address all at the same time?
-2) would you be ok with addressing "bad" HW as a special case, which requires workarounds and shouldn't dictate the overall design?
-3) do you agree with the assumption that new HW is expected to get reasonably better and therefore workarounds at point 2) will progressively be confined to devices less and less common?
-4) going to the definition of "good" and "bad" (maybe this should have come earlier in the list), can we define "good" HW as HW where:
* suspend state and lowest achievable runtime idle state are basically
equivalent from both power consumption and latency pov
* the HW itself is properly able to track wakeup sources while it is in
its deepest power state (as example OMAP3 has few independent wake-capable pads and a "wake ring" where one only gets the information that at least one of the pads belonging to such ring has received a wakeup)
* wakeup sources can be dynamically masked at HW level, so that if a
peripheral is not interesting, it doesn't wakeup the system (for example the camera button when the camera cover is closed)
-5) HW that is not capable of properly generating asynchronous signal is most likely the cause for extra timers in kernel and it should be considered "bad" - in any other case having recurring in-kernel timers should be treated as bugs, if their existence is not tied to some meaningful work
thanks, igor
Quoted 19 lines · Arve Hjønnevåg
2010/5/31 Rafael J. Wysocki <[email protected]>:
Quoted 13 lines · Arve Hjønnevåg
Quoted 1 line
2010/5/30 Rafael J. Wysocki <[email protected]>:
...
Quoted 9 lines
I think it makes more sense to block suspend while wakeup events are pending than blocking it everywhere timers are used by code that could be called while handling wakeup events or other critical work. Also, even if you did block suspend everywhere timers where used you still have the race where a wakeup interrupt happens right after you decided to suspend. In other words, you still need to block suspend in all the same places as with the current opportunistic suspend code, so what is the benefit of delaying suspend until idle?
Quoted 4 lines
Assume for a while that you don't use suspend blockers, OK? I realize you think that anything else doesn't make sense, but evidently some other people have that opinion about suspend blockers.
Quoted 5 lines
It sounded like you were suggesting that initiating suspend from idle would somehow avoid the race condition with wakeup events. All I'm saying is that you would need to block suspend in all the same places. If you don't care about ignoring wakeup events, then sure you can initiate suspend from idle.
And why should you miss a wakeup there ? If you get an interrupt in the transition, then you are not longer idle.
Thanks,
tglx
2010/6/1 Thomas Gleixner <[email protected]>:
Quoted 21 lines · Arve Hjønnevåg
Quoted 20 lines
2010/5/31 Rafael J. Wysocki <[email protected]>:
Quoted 17 lines · Arve Hjønnevåg
Quoted 1 line
2010/5/30 Rafael J. Wysocki <[email protected]>:
...
Quoted 9 lines
I think it makes more sense to block suspend while wakeup events are pending than blocking it everywhere timers are used by code that could be called while handling wakeup events or other critical work. Also, even if you did block suspend everywhere timers where used you still have the race where a wakeup interrupt happens right after you decided to suspend. In other words, you still need to block suspend in all the same places as with the current opportunistic suspend code, so what is the benefit of delaying suspend until idle?
Assume for a while that you don't use suspend blockers, OK? I realize you think that anything else doesn't make sense, but evidently some other people have that opinion about suspend blockers.
Quoted 9 lines
Quoted 5 lines
It sounded like you were suggesting that initiating suspend from idle would somehow avoid the race condition with wakeup events. All I'm saying is that you would need to block suspend in all the same places. If you don't care about ignoring wakeup events, then sure you can initiate suspend from idle.
And why should you miss a wakeup there ? If you get an interrupt in the transition, then you are not longer idle.
Because suspend itself causes you to not be idle you cannot abort suspend just because you are not idle anymore.
Signature · 1 line
Arve Hjønnevåg
2010/6/1 Thomas Gleixner <[email protected]>:
Quoted 21 lines · Arve Hjønnevåg
Quoted 20 lines
2010/5/31 Rafael J. Wysocki <[email protected]>:
Quoted 17 lines · Arve Hjønnevåg
Quoted 1 line
2010/5/30 Rafael J. Wysocki <[email protected]>:
...
Quoted 9 lines
I think it makes more sense to block suspend while wakeup events are pending than blocking it everywhere timers are used by code that could be called while handling wakeup events or other critical work. Also, even if you did block suspend everywhere timers where used you still have the race where a wakeup interrupt happens right after you decided to suspend. In other words, you still need to block suspend in all the same places as with the current opportunistic suspend code, so what is the benefit of delaying suspend until idle?
Assume for a while that you don't use suspend blockers, OK? I realize you think that anything else doesn't make sense, but evidently some other people have that opinion about suspend blockers.
Quoted 9 lines
Quoted 5 lines
It sounded like you were suggesting that initiating suspend from idle would somehow avoid the race condition with wakeup events. All I'm saying is that you would need to block suspend in all the same places. If you don't care about ignoring wakeup events, then sure you can initiate suspend from idle.
And why should you miss a wakeup there ? If you get an interrupt in the transition, then you are not longer idle.
Because suspend itself causes you to not be idle you cannot abort suspend just because you are not idle anymore.
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 28 lines · Arve Hjønnevåg
2010/6/1 Thomas Gleixner <[email protected]>:
Quoted 27 lines · Arve Hjønnevåg
Quoted 25 lines
2010/5/31 Rafael J. Wysocki <[email protected]>:
Quoted 13 lines · Arve Hjønnevåg
Quoted 1 line
2010/5/30 Rafael J. Wysocki <[email protected]>:
...
Quoted 9 lines
I think it makes more sense to block suspend while wakeup events are pending than blocking it everywhere timers are used by code that could be called while handling wakeup events or other critical work. Also, even if you did block suspend everywhere timers where used you still have the race where a wakeup interrupt happens right after you decided to suspend. In other words, you still need to block suspend in all the same places as with the current opportunistic suspend code, so what is the benefit of delaying suspend until idle?
Quoted 4 lines
Assume for a while that you don't use suspend blockers, OK? I realize you think that anything else doesn't make sense, but evidently some other people have that opinion about suspend blockers.
It sounded like you were suggesting that initiating suspend from idle would somehow avoid the race condition with wakeup events. All I'm saying is that you would need to block suspend in all the same places. If you don't care about ignoring wakeup events, then sure you can initiate suspend from idle.
Quoted 6 lines
Quoted 3 lines
And why should you miss a wakeup there ? If you get an interrupt in the transition, then you are not longer idle.
Because suspend itself causes you to not be idle you cannot abort suspend just because you are not idle anymore.
You still are addicted to the current suspend mechanism. :)
The whole point of doing it from idle in the form of a deep power state is to avoid the massive sh*tload of work which is neccesary to run the existing suspend code. But that needs runtime power management and tweaks to avoid your timers waking you, etc.
The mechanism you want to use is: suspend no matter what, like closing the lid of the laptop, but with a few tweaks around it:
1) An interrupt on a wakeup source which comes in while the suspend code runs, i.e before you transitioned into wakeup mode, must abort / prevent suspend.
2) Prevent another attempt to suspend before the event has been delivered and the apps have signaled that they have not longer any work to do.
As a side effect you confine crappy apps with that mechanism in some way.
In the laptop case we do not want the tweaks as not going into suspend might set your backpack on fire.
If I understood you correctly then you can shutdown the CPU in idle completelty already, but that's not enough due to:
1) crappy applications keeping the cpu away from idle
2) timers firing
Would solving those two issues be sufficient for you or am I missing something ?
Thanks,
tglx
2010/6/2 Thomas Gleixner <[email protected]>:
Quoted 29 lines · Arve Hjønnevåg
Quoted 28 lines
2010/6/1 Thomas Gleixner <[email protected]>:
Quoted 27 lines · Arve Hjønnevåg
Quoted 25 lines
2010/5/31 Rafael J. Wysocki <[email protected]>:
Quoted 13 lines · Arve Hjønnevåg
Quoted 1 line
2010/5/30 Rafael J. Wysocki <[email protected]>:
...
Quoted 9 lines
I think it makes more sense to block suspend while wakeup events are pending than blocking it everywhere timers are used by code that could be called while handling wakeup events or other critical work. Also, even if you did block suspend everywhere timers where used you still have the race where a wakeup interrupt happens right after you decided to suspend. In other words, you still need to block suspend in all the same places as with the current opportunistic suspend code, so what is the benefit of delaying suspend until idle?
Quoted 4 lines
Assume for a while that you don't use suspend blockers, OK? I realize you think that anything else doesn't make sense, but evidently some other people have that opinion about suspend blockers.
It sounded like you were suggesting that initiating suspend from idle would somehow avoid the race condition with wakeup events. All I'm saying is that you would need to block suspend in all the same places. If you don't care about ignoring wakeup events, then sure you can initiate suspend from idle.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
And why should you miss a wakeup there ? If you get an interrupt in the transition, then you are not longer idle.
Because suspend itself causes you to not be idle you cannot abort suspend just because you are not idle anymore.
You still are addicted to the current suspend mechanism. :)
No I want you to stop confusing low power idle modes with suspend. I know how to enter low power modes from idle if that low power mode is not too disruptive.
Quoted 16 lines
The whole point of doing it from idle in the form of a deep power state is to avoid the massive sh*tload of work which is neccesary to run the existing suspend code. But that needs runtime power management and tweaks to avoid your timers waking you, etc.
The mechanism you want to use is: suspend no matter what, like closing the lid of the laptop, but with a few tweaks around it:
1) An interrupt on a wakeup source which comes in while the suspend code runs, i.e before you transitioned into wakeup mode, must abort / prevent suspend.
2) Prevent another attempt to suspend before the event has been delivered and the apps have signaled that they have not longer any work to do.
Quoted 5 lines
As a side effect you confine crappy apps with that mechanism in some way.
In the laptop case we do not want the tweaks as not going into suspend might set your backpack on fire.
If that is the case you should also disable the wakeup events.
Quoted 9 lines
If I understood you correctly then you can shutdown the CPU in idle completelty already, but that's not enough due to:
1) crappy applications keeping the cpu away from idle
2) timers firingWould solving those two issues be sufficient for you or am I missing something ?
Solving those two is enough for current android phones, but it may not be enough for other android devices. 1 is not solvable (meaning we cannot fix all apps), and 2 is difficult to fix since the periodic work is useful while the device is actually in use. One possible way to solve 2 is to allow timers on a not-idle clock. Unrelated to Android, I also want to use opportunistic suspend on my desktop.
Signature · 1 line
Arve Hjønnevåg
Quoted 6 lines · Arve Hjønnevåg
2010/6/2 Thomas Gleixner <[email protected]>:
Quoted 5 lines · Arve Hjønnevåg
Quoted 3 lines
Because suspend itself causes you to not be idle you cannot abort suspend just because you are not idle anymore.
Quoted 6 lines
Quoted 2 lines
You still are addicted to the current suspend mechanism. :)
No I want you to stop confusing low power idle modes with suspend. I know how to enter low power modes from idle if that low power mode is not too disruptive.
What prevents us from going into a disruptive mode from idle ? I don't see a reason - except crappy ACPI stuff, which I'm happy to ignore.
Quoted 11 lines
Quoted 8 lines
If I understood you correctly then you can shutdown the CPU in idle completelty already, but that's not enough due to:
1) crappy applications keeping the cpu away from idle
2) timers firingWould solving those two issues be sufficient for you or am I missing something ?
Solving those two is enough for current android phones, but it may not be enough for other android devices.
In which way ? May not be enough is a pretty vague statement.
Quoted 1 line
1 is not solvable (meaning we cannot fix all apps),
We can mitigate it with cgroups and confine crap there, i.e. force idle them.
Quoted 3 lines
and 2 is difficult to fix since the periodic
work is useful while the device is actually in use. One possible way to solve 2 is to allow timers on a not-idle clock.
That's what I had in mind.
Quoted 2 lines
Unrelated to Android, I also want to use opportunistic suspend on my desktop.
I expect that intel/amd fixing their stuff is going to happen way before we sprinkled suspend blockers over a full featured desktop distro.
Thanks,
tglx
2010/6/2 Thomas Gleixner <[email protected]>:
Quoted 10 lines · Arve Hjønnevåg
Quoted 9 lines
2010/6/2 Thomas Gleixner <[email protected]>:
Quoted 7 lines · Arve Hjønnevåg
Quoted 3 lines
Because suspend itself causes you to not be idle you cannot abort suspend just because you are not idle anymore.
You still are addicted to the current suspend mechanism. :)
Quoted 7 lines
Quoted 3 lines
No I want you to stop confusing low power idle modes with suspend. I know how to enter low power modes from idle if that low power mode is not too disruptive.
What prevents us from going into a disruptive mode from idle ? I don't see a reason - except crappy ACPI stuff, which I'm happy to ignore.
What do you consider disruptive? Disabling active interrupts? Stopping the monotonic clock?
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
If I understood you correctly then you can shutdown the CPU in idle completelty already, but that's not enough due to:
1) crappy applications keeping the cpu away from idle
2) timers firing
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Would solving those two issues be sufficient for you or am I missing something ?
Solving those two is enough for current android phones, but it may not be enough for other android devices.
In which way ? May not be enough is a pretty vague statement.
They may not be based on hardware that can get to the same power mode from idle as suspend. This could be acpi based hardware, it could be like the hardware we started with that did not have regular timers that could run in the low power mode, or devices could loose their state in the lowest power mode.
Quoted 6 lines
Quoted 2 lines
1 is not solvable (meaning we cannot fix all apps),
We can mitigate it with cgroups and confine crap there, i.e. force idle them.
I think using suspend is much simpler. It avoids having to worry about dependencies between processes.
Quoted 4 lines
Quoted 3 lines
and 2 is difficult to fix since the periodic
work is useful while the device is actually in use. One possible way to solve 2 is to allow timers on a not-idle clock.
Quoted 9 lines
That's what I had in mind.
Quoted 2 lines
Unrelated to Android, I also want to use opportunistic suspend on my desktop.
I expect that intel/amd fixing their stuff is going to happen way before we sprinkled suspend blockers over a full featured desktop distro.
You do not need to sprinkle suspend blocker all over the distro for it to be useful. You can convert the existing auto-suspend code to use opportunistic suspend and all apps that don't use suspend blocker will behave as they do today while allowing apps to use suspend blockers to keep the system running after the auto-suspend timeout expired.
Signature · 1 line
Arve Hjønnevåg
2010/6/2 Thomas Gleixner <[email protected]>:
Quoted 10 lines · Arve Hjønnevåg
Quoted 9 lines
2010/6/2 Thomas Gleixner <[email protected]>:
Quoted 7 lines · Arve Hjønnevåg
Quoted 3 lines
Because suspend itself causes you to not be idle you cannot abort suspend just because you are not idle anymore.
You still are addicted to the current suspend mechanism. :)
Quoted 7 lines
Quoted 3 lines
No I want you to stop confusing low power idle modes with suspend. I know how to enter low power modes from idle if that low power mode is not too disruptive.
What prevents us from going into a disruptive mode from idle ? I don't see a reason - except crappy ACPI stuff, which I'm happy to ignore.
What do you consider disruptive? Disabling active interrupts? Stopping the monotonic clock?
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
If I understood you correctly then you can shutdown the CPU in idle completelty already, but that's not enough due to:
1) crappy applications keeping the cpu away from idle
2) timers firing
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Would solving those two issues be sufficient for you or am I missing something ?
Solving those two is enough for current android phones, but it may not be enough for other android devices.
In which way ? May not be enough is a pretty vague statement.
They may not be based on hardware that can get to the same power mode from idle as suspend. This could be acpi based hardware, it could be like the hardware we started with that did not have regular timers that could run in the low power mode, or devices could loose their state in the lowest power mode.
Quoted 6 lines
Quoted 2 lines
1 is not solvable (meaning we cannot fix all apps),
We can mitigate it with cgroups and confine crap there, i.e. force idle them.
I think using suspend is much simpler. It avoids having to worry about dependencies between processes.
Quoted 4 lines
Quoted 3 lines
and 2 is difficult to fix since the periodic
work is useful while the device is actually in use. One possible way to solve 2 is to allow timers on a not-idle clock.
Quoted 9 lines
That's what I had in mind.
Quoted 2 lines
Unrelated to Android, I also want to use opportunistic suspend on my desktop.
I expect that intel/amd fixing their stuff is going to happen way before we sprinkled suspend blockers over a full featured desktop distro.
You do not need to sprinkle suspend blocker all over the distro for it to be useful. You can convert the existing auto-suspend code to use opportunistic suspend and all apps that don't use suspend blocker will behave as they do today while allowing apps to use suspend blockers to keep the system running after the auto-suspend timeout expired.
Signature · 1 line
Arve Hjønnevåg
Quoted 6 lines · Arve Hjønnevåg
2010/6/2 Thomas Gleixner <[email protected]>:
Quoted 5 lines · Arve Hjønnevåg
Quoted 3 lines
Because suspend itself causes you to not be idle you cannot abort suspend just because you are not idle anymore.
Quoted 6 lines
Quoted 2 lines
You still are addicted to the current suspend mechanism. :)
No I want you to stop confusing low power idle modes with suspend. I know how to enter low power modes from idle if that low power mode is not too disruptive.
What prevents us from going into a disruptive mode from idle ? I don't see a reason - except crappy ACPI stuff, which I'm happy to ignore.
Quoted 11 lines
Quoted 8 lines
If I understood you correctly then you can shutdown the CPU in idle completelty already, but that's not enough due to:
1) crappy applications keeping the cpu away from idle
2) timers firingWould solving those two issues be sufficient for you or am I missing something ?
Solving those two is enough for current android phones, but it may not be enough for other android devices.
In which way ? May not be enough is a pretty vague statement.
Quoted 1 line
1 is not solvable (meaning we cannot fix all apps),
We can mitigate it with cgroups and confine crap there, i.e. force idle them.
Quoted 3 lines
and 2 is difficult to fix since the periodic
work is useful while the device is actually in use. One possible way to solve 2 is to allow timers on a not-idle clock.
That's what I had in mind.
Quoted 2 lines
Unrelated to Android, I also want to use opportunistic suspend on my desktop.
I expect that intel/amd fixing their stuff is going to happen way before we sprinkled suspend blockers over a full featured desktop distro.
Thanks,
tglx
Quoted 1 line · Arve Hjønnevåg
No I want you to stop confusing low power idle modes with suspend.
I think it is you who is confused. For power management purposes suspend is nothing more but a deep idle state.
(and please don't mention @#$@ up x86 ACPI again, Intel knows, they're fixing it, get over it already).
Quoted 2 lines
Unrelated to
Android, I also want to use opportunistic suspend on my desktop.
So you're going to sprinkle this suspend blocker shite all over regular userspace? Why not instead work on getting apps to behave properly and idle when there's nothing to do?
After all, if you have the code to add suspend blockers into, you also have the means to fix it being stupid in the first place.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
2010/6/2 Peter Zijlstra <[email protected]>:
Quoted 5 lines · Arve Hjønnevåg
Quoted 1 line
No I want you to stop confusing low power idle modes with suspend.
I think it is you who is confused. For power management purposes suspend is nothing more but a deep idle state.
No, idle is transparent, suspend is not.
Quoted 4 lines
(and please don't mention @#$@ up x86 ACPI again, Intel knows, they're fixing it, get over it already).
I don't think it is realistic to drop support for all existing hardware.
Quoted 5 lines
Quoted 2 lines
Unrelated to
Android, I also want to use opportunistic suspend on my desktop.So you're going to sprinkle this suspend blocker shite all over regular userspace?
I have said several times, that regular user-space will not need to be modified to maintain their current behavior.
Quoted 6 lines
Why not instead work on getting apps to behave properly and idle when there's nothing to do?
After all, if you have the code to add suspend blockers into, you also have the means to fix it being stupid in the first place.
Why would I add suspend blockers to the code I want to prevent running?
Signature · 1 line
Arve Hjønnevåg
Quoted 8 lines · Arve Hjønnevåg
2010/6/2 Peter Zijlstra <[email protected]>:
Quoted 5 lines · Arve Hjønnevåg
Quoted 1 line
No I want you to stop confusing low power idle modes with suspend.
I think it is you who is confused. For power management purposes suspend is nothing more but a deep idle state.
No, idle is transparent, suspend is not.
Which is where the problem is, it should be.
Quoted 1 line
Why would I add suspend blockers to the code I want to prevent running?
Because what you want might not be what others want. Suppose you're fine with your torrent client/irc client/etc.. to loose their network connection when you're not behind your desktop so you don't add suspend blockers there.
Me, I'd be ready to administer physical violence if either of those lost their connections when I wasn't around to keep the screen-saver from kicking in.
This leads to having to sprinkle magic dust (and lots of config options) all over userspace. Something that gets esp interesting with only a boolean interface.
In the example above, having an active net connection would prevent my desktop from suspending, but what if another platform can maintain net connections while suspended? Do we then end up with arch specific code in the net-stack? I'm sure DaveM would love that.
Quoted 14 lines · On Wed, 02 Jun 2010 12:21:28 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 8 lines · Arve Hjønnevåg
2010/6/2 Peter Zijlstra <[email protected]>:
Quoted 5 lines · Arve Hjønnevåg
Quoted 1 line
No I want you to stop confusing low power idle modes with suspend.
I think it is you who is confused. For power management purposes suspend is nothing more but a deep idle state.
No, idle is transparent, suspend is not.
Which is where the problem is, it should be.
Quoted 1 line
Why would I add suspend blockers to the code I want to prevent running?
Quoted 8 lines
Because what you want might not be what others want. Suppose you're fine with your torrent client/irc client/etc.. to loose their network connection when you're not behind your desktop so you don't add suspend blockers there.
Me, I'd be ready to administer physical violence if either of those lost their connections when I wasn't around to keep the screen-saver from kicking in.
Do you switch your pc on and off manually? Sometimes? Really? (if not, you are probably a kernel hacker *g*)
I assume, in general, there are only a few reasons to shut down a machine:
1. One has to do maintainance on the hardware or somehow needs to interrupt the power supply.
2. One wants to save power.
3. One wants to go easy on the hardware.
4. ...?
Obviously, for reason 1 we need to maintain the shutdown-paths indefinitely.
But the rest are usecases that are similar to the suspend-blocker usecases. You know that you are not using the machine and going through the pain to shut down your machine. You have to do it manually. Why?
Quoted 3 lines
This leads to having to sprinkle magic dust (and lots of config options) all over userspace. Something that gets esp interesting with only a boolean interface.
A userspace daemon could keep track of what applications can be ignored. The wordprocessor probably should not keep the system busy. As well as a running firefox.
It is a hard problem. But we have _no way of deciding any of this in the kernel_!
Quoted 6 lines
In the example above, having an active net connection would prevent my desktop from suspending, but what if another platform can maintain net connections while suspended? Do we then end up with arch specific code in the net-stack? I'm sure DaveM would love that.
If it is driver knowledge, then it goes into the driver. If it is platform knowledge, then it goes into the platform code. I think that is a clear requirement to keeping sanity.
The problem is there independently of suspend blockers. If the system can suspend with network up, then you shure as hell want to suspend even if the network is up. So it would actually be a reason for any kind of "suspend blockers" scheme. Wouldn't it?
Cheers,
Flo
Quoted 5 lines · Florian Mickler
On Wed, 02 Jun 2010 12:21:28 +0200
Peter Zijlstra <[email protected]> wrote:Do you switch your pc on and off manually? Sometimes? Really? (if not, you are probably a kernel hacker *g*)
Yeah, when my Radeon GPU locks up the bus _again_, and yeah to replace parts, but no, not otherwise ;-) But I've been doing that for pretty much as long as I've had a computer.
Quoted 4 lines
But the rest are usecases that are similar to the suspend-blocker usecases. You know that you are not using the machine and going through the pain to shut down your machine. You have to do it manually. Why?
Make suspend an idle state and teach apps to go real quiet.
(Then again, that only really works when regular network packets can wake the machine for my case).
Quoted 10 lines
Quoted 3 lines
This leads to having to sprinkle magic dust (and lots of config options) all over userspace. Something that gets esp interesting with only a boolean interface.
A userspace daemon could keep track of what applications can be ignored. The wordprocessor probably should not keep the system busy. As well as a running firefox.
It is a hard problem. But we have
_noway of deciding any of this in thekernel_
Therefore I say, fix the worprocessor to not actually do anything if its not poked at -- not too hard, wordprocessors really don't need to do anything on their own, and you can do your last backup cycle when the window becomes invisible and stop the timer until the document changes again.
Same for firefox, you can teach it to not render animated gifs and run javascript for invisible tabs, and once the screen-saver kicks in, nothing is visible (and with X telling apps their window is visible or not it knows), so it should go idle all of its own.
Fix the friggin apps, don't kludge with freezing.
You really only ever want to freeze broken apps. And even for those I would prefer it if I got notified some app is stupid, then I could either fix it, or choose not to use it.
You can also teach cron to listen to dbus messages telling it about the screen state and postpone jobs -- but please make that a configurable thing, I really like all that work done at 4am when I'm (usually) not around to be bothered by it.
Quoted 4 lines
The problem is there independently of suspend blockers. If the system can suspend with network up, then you shure as hell want to suspend even if the network is up. So it would actually be a reason for any kind of "suspend blockers" scheme. Wouldn't it?
Well, at that point suspend is nothing more than an idle state, and platform code needs to somehow inform the idle state governor that active net connections need to prevent that idle state from being used.
If you want to call that suspend blockers, then sure, but its a long way away from the explicit scheme proposed at the start of this thread.
Quoted 6 lines · On Thu, 03 Jun 2010 09:40:02 +0200 Peter Zijlstra <[email protected]> wrote:
Same for firefox, you can teach it to not render animated gifs and run javascript for invisible tabs, and once the screen-saver kicks in, nothing is visible (and with X telling apps their window is visible or not it knows), so it should go idle all of its own.
Fix the friggin apps, don't kludge with freezing.
Of course programs should be as smart as possible. But that is an orthogonal problem.
Suppose firefox were fixed. It still needs to fetch my rss feeds every minute, because I'm sad if it doesn't. It just can't be fixed at the application level.
Cheers,
Flo
Quoted 6 lines · On Thu, 03 Jun 2010 09:40:02 +0200 Peter Zijlstra <[email protected]> wrote:
Same for firefox, you can teach it to not render animated gifs and run javascript for invisible tabs, and once the screen-saver kicks in, nothing is visible (and with X telling apps their window is visible or not it knows), so it should go idle all of its own.
Fix the friggin apps, don't kludge with freezing.
Of course programs should be as smart as possible. But that is an orthogonal problem.
Suppose firefox were fixed. It still needs to fetch my rss feeds every minute, because I'm sad if it doesn't. It just can't be fixed at the application level.
Cheers,
Flo
Quoted 8 lines · Florian Mickler
Quoted 5 lines · On Thu, 03 Jun 2010 09:40:02 +0200 Peter Zijlstra <[email protected]> wrote:
Same for firefox, you can teach it to not render animated gifs and run javascript for invisible tabs, and once the screen-saver kicks in, nothing is visible (and with X telling apps their window is visible or not it knows), so it should go idle all of its own.
Quoted 8 lines
Quoted 1 line
Fix the friggin apps, don't kludge with freezing.
Of course programs should be as smart as possible. But that is an orthogonal problem.
Suppose firefox were fixed. It still needs to fetch my rss feeds every minute, because I'm sad if it doesn't. It just can't be fixed at the application level.
Sure it can, why would it need to fetch RSS feeds when the screen is off and nobody could possible see the result? So you can stop the timer when you know the window isn't visible or alternatively when the screensaver is active, I think most desktops have notification of that as well.
Quoted 8 lines · Florian Mickler
Quoted 5 lines · On Thu, 03 Jun 2010 09:40:02 +0200 Peter Zijlstra <[email protected]> wrote:
Same for firefox, you can teach it to not render animated gifs and run javascript for invisible tabs, and once the screen-saver kicks in, nothing is visible (and with X telling apps their window is visible or not it knows), so it should go idle all of its own.
Quoted 8 lines
Quoted 1 line
Fix the friggin apps, don't kludge with freezing.
Of course programs should be as smart as possible. But that is an orthogonal problem.
Suppose firefox were fixed. It still needs to fetch my rss feeds every minute, because I'm sad if it doesn't. It just can't be fixed at the application level.
Sure it can, why would it need to fetch RSS feeds when the screen is off and nobody could possible see the result? So you can stop the timer when you know the window isn't visible or alternatively when the screensaver is active, I think most desktops have notification of that as well.
Quoted 14 lines · On Thu, 03 Jun 2010 17:28:01 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 13 lines · Florian Mickler
Quoted 6 lines · On Thu, 03 Jun 2010 09:40:02 +0200 Peter Zijlstra <[email protected]> wrote:
Same for firefox, you can teach it to not render animated gifs and run javascript for invisible tabs, and once the screen-saver kicks in, nothing is visible (and with X telling apps their window is visible or not it knows), so it should go idle all of its own.
Fix the friggin apps, don't kludge with freezing.
Of course programs should be as smart as possible. But that is an orthogonal problem.
Quoted 8 lines
Quoted 3 lines
Suppose firefox were fixed. It still needs to fetch my rss feeds every minute, because I'm sad if it doesn't. It just can't be fixed at the application level.
Sure it can, why would it need to fetch RSS feeds when the screen is off and nobody could possible see the result? So you can stop the timer when you know the window isn't visible or alternatively when the screensaver is active, I think most desktops have notification of that as well.
This is arguing on a very thin line. In fact it is becoming pointless.
Suppose there were an RSS-feed plugin that signals events to an event Plugin. That event plugin could be either visual notification or sending audio-signals. But the RSS feed doesn't know what specific plugin it talks to. So screen off is _not always_ the right indicator. Sometimes it is, sometimes it's not.
There would be a seperate infrastructure needed in the program to tell the different plugins that the core thinks everything should stop. How does the core knows when to stop? And then there probably need to be some kind of "suspend blockers" in the program. *g*
Just solve it at the right level, so that the apps don't need to be infected with this shit. And this belongs between the iron and the apps. And it seems it needs to be some cooperative approach of kernel and userspace-framework as it isn't right to put that much policy in the kernel.
I don't think it is a black and white thing, where you can just say "fix the friggin apps".
And this is a really f*beep*ng serious point. (at least to me)
Cheers,
Flo
Quoted 14 lines · On Thu, 03 Jun 2010 17:28:01 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 13 lines · Florian Mickler
Quoted 6 lines · On Thu, 03 Jun 2010 09:40:02 +0200 Peter Zijlstra <[email protected]> wrote:
Same for firefox, you can teach it to not render animated gifs and run javascript for invisible tabs, and once the screen-saver kicks in, nothing is visible (and with X telling apps their window is visible or not it knows), so it should go idle all of its own.
Fix the friggin apps, don't kludge with freezing.
Of course programs should be as smart as possible. But that is an orthogonal problem.
Quoted 8 lines
Quoted 3 lines
Suppose firefox were fixed. It still needs to fetch my rss feeds every minute, because I'm sad if it doesn't. It just can't be fixed at the application level.
Sure it can, why would it need to fetch RSS feeds when the screen is off and nobody could possible see the result? So you can stop the timer when you know the window isn't visible or alternatively when the screensaver is active, I think most desktops have notification of that as well.
This is arguing on a very thin line. In fact it is becoming pointless.
Suppose there were an RSS-feed plugin that signals events to an event Plugin. That event plugin could be either visual notification or sending audio-signals. But the RSS feed doesn't know what specific plugin it talks to. So screen off is _not always_ the right indicator. Sometimes it is, sometimes it's not.
There would be a seperate infrastructure needed in the program to tell the different plugins that the core thinks everything should stop. How does the core knows when to stop? And then there probably need to be some kind of "suspend blockers" in the program. *g*
Just solve it at the right level, so that the apps don't need to be infected with this shit. And this belongs between the iron and the apps. And it seems it needs to be some cooperative approach of kernel and userspace-framework as it isn't right to put that much policy in the kernel.
I don't think it is a black and white thing, where you can just say "fix the friggin apps".
And this is a really f*beep*ng serious point. (at least to me)
Cheers,
Flo
Quoted 14 lines · Peter Zijlstra
Quoted 13 lines · Florian Mickler
Quoted 6 lines · On Thu, 03 Jun 2010 09:40:02 +0200 Peter Zijlstra <[email protected]> wrote:
Same for firefox, you can teach it to not render animated gifs and run javascript for invisible tabs, and once the screen-saver kicks in, nothing is visible (and with X telling apps their window is visible or not it knows), so it should go idle all of its own.
Fix the friggin apps, don't kludge with freezing.
Of course programs should be as smart as possible. But that is an orthogonal problem.
Quoted 8 lines
Quoted 3 lines
Suppose firefox were fixed. It still needs to fetch my rss feeds every minute, because I'm sad if it doesn't. It just can't be fixed at the application level.
Sure it can, why would it need to fetch RSS feeds when the screen is off and nobody could possible see the result? So you can stop the timer when you know the window isn't visible or alternatively when the screensaver is active, I think most desktops have notification of that as well.
Exactly, and that's what applications in the N900 do. For this to work reliably, you need these notifications (network disconnected, screen off) to be easily accessible, and even transparent to the application writer.
I don't think the suspend blockers solve much. A bad application will behave bad on any system. Suppose somebody decides to port Firefox to Android, and forgets to listen to the screen off event (bad on Android or Maemo), however, notices the application behaves very badly, so by googling finds these suspend blockers, and enables them all the time the application runs.
When the user install the application, will be greeted by a warning "This application might break PM, do you want to enable suspend blockers?" (or whatever), as any typical user would do, will press Yes (whatever).
We end up in exactly the same situation.
Signature · 1 line
Felipe Contreras
Quoted 31 lines · On Sat, 5 Jun 2010 20:30:40 +0300 Felipe Contreras…
Quoted 9 lines · Peter Zijlstra
Quoted 8 lines · Florian Mickler
Quoted 1 line · On Thu, 03 Jun 2010 09:40:02 +0200 Peter Zijlstra <[email protected]> wrote:
Fix the friggin apps, don't kludge with freezing.
Of course programs should be as smart as possible. But that is an orthogonal problem.
Quoted 8 lines
Quoted 3 lines
Suppose firefox were fixed. It still needs to fetch my rss feeds every minute, because I'm sad if it doesn't. It just can't be fixed at the application level.
Sure it can, why would it need to fetch RSS feeds when the screen is off and nobody could possible see the result? So you can stop the timer when you know the window isn't visible or alternatively when the screensaver is active, I think most desktops have notification of that as well.
Exactly, and that's what applications in the N900 do. For this to work reliably, you need these notifications (network disconnected, screen off) to be easily accessible, and even transparent to the application writer.
I don't think the suspend blockers solve much. A bad application will behave bad on any system. Suppose somebody decides to port Firefox to Android, and forgets to listen to the screen off event (bad on Android or Maemo), however, notices the application behaves very badly, so by googling finds these suspend blockers, and enables them all the time the application runs.
Quoted 7 lines
When the user install the application, will be greeted by a warning "This application might break PM, do you want to enable suspend blockers?" (or whatever), as any typical user would do, will press Yes (whatever).
We end up in exactly the same situation.
No. The application will show up in the suspend blocker stats and the user will remember: "Oh, yes. There was a warning about that. Well I think I'm going to file a bug there."
The only difference is, that with suspend blockers, he can than dismiss the applications permission to block suspend and will not miss his job interview the next day because his phones battery run out. And also he can use the application to a certain extent.
Cheers,
Flo
Quoted 31 lines · On Sat, 5 Jun 2010 20:30:40 +0300 Felipe Contreras…
Quoted 9 lines · Peter Zijlstra
Quoted 8 lines · Florian Mickler
Quoted 1 line · On Thu, 03 Jun 2010 09:40:02 +0200 Peter Zijlstra <[email protected]> wrote:
Fix the friggin apps, don't kludge with freezing.
Of course programs should be as smart as possible. But that is an orthogonal problem.
Quoted 8 lines
Quoted 3 lines
Suppose firefox were fixed. It still needs to fetch my rss feeds every minute, because I'm sad if it doesn't. It just can't be fixed at the application level.
Sure it can, why would it need to fetch RSS feeds when the screen is off and nobody could possible see the result? So you can stop the timer when you know the window isn't visible or alternatively when the screensaver is active, I think most desktops have notification of that as well.
Exactly, and that's what applications in the N900 do. For this to work reliably, you need these notifications (network disconnected, screen off) to be easily accessible, and even transparent to the application writer.
I don't think the suspend blockers solve much. A bad application will behave bad on any system. Suppose somebody decides to port Firefox to Android, and forgets to listen to the screen off event (bad on Android or Maemo), however, notices the application behaves very badly, so by googling finds these suspend blockers, and enables them all the time the application runs.
Quoted 7 lines
When the user install the application, will be greeted by a warning "This application might break PM, do you want to enable suspend blockers?" (or whatever), as any typical user would do, will press Yes (whatever).
We end up in exactly the same situation.
No. The application will show up in the suspend blocker stats and the user will remember: "Oh, yes. There was a warning about that. Well I think I'm going to file a bug there."
The only difference is, that with suspend blockers, he can than dismiss the applications permission to block suspend and will not miss his job interview the next day because his phones battery run out. And also he can use the application to a certain extent.
Cheers,
Flo
Quoted 14 lines · Florian Mickler
Quoted 12 lines · On Sat, 5 Jun 2010 20:30:40 +0300 Felipe Contreras…
I don't think the suspend blockers solve much. A bad application will behave bad on any system. Suppose somebody decides to port Firefox to Android, and forgets to listen to the screen off event (bad on Android or Maemo), however, notices the application behaves very badly, so by googling finds these suspend blockers, and enables them all the time the application runs.
When the user install the application, will be greeted by a warning "This application might break PM, do you want to enable suspend blockers?" (or whatever), as any typical user would do, will press Yes (whatever).
Quoted 5 lines
Quoted 2 lines
We end up in exactly the same situation.
No. The application will show up in the suspend blocker stats and the user will remember: "Oh, yes. There was a warning about that. Well I think I'm going to file a bug there."
How would such stats be calculated? I presume at regular intervals you check which applications are holding suspend blockers and increase a counter.
How would you do that with the dynamic PM approach? At regular intervals you check for which applications are running (not idle).
Quoted 4 lines
The only difference is, that with suspend blockers, he can than dismiss the applications permission to block suspend and will not miss his job interview the next day because his phones battery run out. And also he can use the application to a certain extent.
So the difference is between removing the app, and making it run crappy. I don't think that's a strong argument in favor of suspend blockers.
Signature · 1 line
Felipe Contreras
Quoted 21 lines · On Sat, 5 Jun 2010 23:06:03 +0300 Felipe Contreras…
Quoted 14 lines · Florian Mickler
Quoted 12 lines · On Sat, 5 Jun 2010 20:30:40 +0300 Felipe Contreras…
I don't think the suspend blockers solve much. A bad application will behave bad on any system. Suppose somebody decides to port Firefox to Android, and forgets to listen to the screen off event (bad on Android or Maemo), however, notices the application behaves very badly, so by googling finds these suspend blockers, and enables them all the time the application runs.
When the user install the application, will be greeted by a warning "This application might break PM, do you want to enable suspend blockers?" (or whatever), as any typical user would do, will press Yes (whatever).
Quoted 5 lines
Quoted 2 lines
We end up in exactly the same situation.
No. The application will show up in the suspend blocker stats and the user will remember: "Oh, yes. There was a warning about that. Well I think I'm going to file a bug there."
Quoted 6 lines
How would such stats be calculated? I presume at regular intervals you check which applications are holding suspend blockers and increase a counter.
How would you do that with the dynamic PM approach? At regular intervals you check for which applications are running (not idle).
IIRC, the patches discussed have debugging infrastructure in them. The kernel does the accounting.
Quoted 10 lines
Quoted 5 lines
The only difference is, that with suspend blockers, he can than dismiss the applications permission to block suspend and will not miss his job interview the next day because his phones battery run out. And also he can use the application to a certain extent.
So the difference is between removing the app, and making it run crappy. I don't think that's a strong argument in favor of suspend blockers.
If you think a little about it, it is. Because if the app wouldn't be usable at all, the bug wouldn't get fixed because the user wouldn't use it. Or not?
Cheers,
Flo
Quoted 11 lines · Florian Mickler
Quoted 6 lines · On Sat, 5 Jun 2010 23:06:03 +0300 Felipe Contreras…
How would such stats be calculated? I presume at regular intervals you check which applications are holding suspend blockers and increase a counter.
How would you do that with the dynamic PM approach? At regular intervals you check for which applications are running (not idle).
IIRC, the patches discussed have debugging infrastructure in them. The kernel does the accounting.
We are not talking about debugging, we are talking about stats shown in user-space so that users can see the offending apps. It doesn't matter where the accounting is done, it would be at regular intervals and there's nothing that prevents the dynamic PM approach to offer similar stats.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
The only difference is, that with suspend blockers, he can than dismiss the applications permission to block suspend and will not miss his job interview the next day because his phones battery run out. And also he can use the application to a certain extent.
Quoted 7 lines
Quoted 4 lines
So the difference is between removing the app, and making it run crappy. I don't think that's a strong argument in favor of suspend blockers.
If you think a little about it, it is. Because if the app wouldn't be usable at all, the bug wouldn't get fixed because the user wouldn't use it. Or not?
I'm not sure what's your point here. One user not using a certain application doesn't prevent bugs to get fixed. In fact, less people using an app will cause less buzz, and less downloads, and less positive votes... which might wake up the author to think: hey, maybe I'm doing something wrong? Maybe I should really listen to those bug reports.
Anyway, my point is that there's nothing special about 3rd party app stats with suspend blockers.
Signature · 1 line
Felipe Contreras
Quoted 11 lines · Florian Mickler
Quoted 6 lines · On Sat, 5 Jun 2010 23:06:03 +0300 Felipe Contreras…
How would such stats be calculated? I presume at regular intervals you check which applications are holding suspend blockers and increase a counter.
How would you do that with the dynamic PM approach? At regular intervals you check for which applications are running (not idle).
IIRC, the patches discussed have debugging infrastructure in them. The kernel does the accounting.
We are not talking about debugging, we are talking about stats shown in user-space so that users can see the offending apps. It doesn't matter where the accounting is done, it would be at regular intervals and there's nothing that prevents the dynamic PM approach to offer similar stats.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
The only difference is, that with suspend blockers, he can than dismiss the applications permission to block suspend and will not miss his job interview the next day because his phones battery run out. And also he can use the application to a certain extent.
Quoted 7 lines
Quoted 4 lines
So the difference is between removing the app, and making it run crappy. I don't think that's a strong argument in favor of suspend blockers.
If you think a little about it, it is. Because if the app wouldn't be usable at all, the bug wouldn't get fixed because the user wouldn't use it. Or not?
I'm not sure what's your point here. One user not using a certain application doesn't prevent bugs to get fixed. In fact, less people using an app will cause less buzz, and less downloads, and less positive votes... which might wake up the author to think: hey, maybe I'm doing something wrong? Maybe I should really listen to those bug reports.
Anyway, my point is that there's nothing special about 3rd party app stats with suspend blockers.
Signature · 1 line
Felipe Contreras
Quoted 21 lines · On Sat, 5 Jun 2010 23:06:03 +0300 Felipe Contreras…
Quoted 14 lines · Florian Mickler
Quoted 12 lines · On Sat, 5 Jun 2010 20:30:40 +0300 Felipe Contreras…
I don't think the suspend blockers solve much. A bad application will behave bad on any system. Suppose somebody decides to port Firefox to Android, and forgets to listen to the screen off event (bad on Android or Maemo), however, notices the application behaves very badly, so by googling finds these suspend blockers, and enables them all the time the application runs.
When the user install the application, will be greeted by a warning "This application might break PM, do you want to enable suspend blockers?" (or whatever), as any typical user would do, will press Yes (whatever).
Quoted 5 lines
Quoted 2 lines
We end up in exactly the same situation.
No. The application will show up in the suspend blocker stats and the user will remember: "Oh, yes. There was a warning about that. Well I think I'm going to file a bug there."
Quoted 6 lines
How would such stats be calculated? I presume at regular intervals you check which applications are holding suspend blockers and increase a counter.
How would you do that with the dynamic PM approach? At regular intervals you check for which applications are running (not idle).
IIRC, the patches discussed have debugging infrastructure in them. The kernel does the accounting.
Quoted 10 lines
Quoted 5 lines
The only difference is, that with suspend blockers, he can than dismiss the applications permission to block suspend and will not miss his job interview the next day because his phones battery run out. And also he can use the application to a certain extent.
So the difference is between removing the app, and making it run crappy. I don't think that's a strong argument in favor of suspend blockers.
If you think a little about it, it is. Because if the app wouldn't be usable at all, the bug wouldn't get fixed because the user wouldn't use it. Or not?
Cheers,
Flo
Quoted 14 lines · Florian Mickler
Quoted 12 lines · On Sat, 5 Jun 2010 20:30:40 +0300 Felipe Contreras…
I don't think the suspend blockers solve much. A bad application will behave bad on any system. Suppose somebody decides to port Firefox to Android, and forgets to listen to the screen off event (bad on Android or Maemo), however, notices the application behaves very badly, so by googling finds these suspend blockers, and enables them all the time the application runs.
When the user install the application, will be greeted by a warning "This application might break PM, do you want to enable suspend blockers?" (or whatever), as any typical user would do, will press Yes (whatever).
Quoted 5 lines
Quoted 2 lines
We end up in exactly the same situation.
No. The application will show up in the suspend blocker stats and the user will remember: "Oh, yes. There was a warning about that. Well I think I'm going to file a bug there."
How would such stats be calculated? I presume at regular intervals you check which applications are holding suspend blockers and increase a counter.
How would you do that with the dynamic PM approach? At regular intervals you check for which applications are running (not idle).
Quoted 4 lines
The only difference is, that with suspend blockers, he can than dismiss the applications permission to block suspend and will not miss his job interview the next day because his phones battery run out. And also he can use the application to a certain extent.
So the difference is between removing the app, and making it run crappy. I don't think that's a strong argument in favor of suspend blockers.
Signature · 1 line
Felipe Contreras
Quoted 14 lines · Peter Zijlstra
Quoted 13 lines · Florian Mickler
Quoted 6 lines · On Thu, 03 Jun 2010 09:40:02 +0200 Peter Zijlstra <[email protected]> wrote:
Same for firefox, you can teach it to not render animated gifs and run javascript for invisible tabs, and once the screen-saver kicks in, nothing is visible (and with X telling apps their window is visible or not it knows), so it should go idle all of its own.
Fix the friggin apps, don't kludge with freezing.
Of course programs should be as smart as possible. But that is an orthogonal problem.
Quoted 8 lines
Quoted 3 lines
Suppose firefox were fixed. It still needs to fetch my rss feeds every minute, because I'm sad if it doesn't. It just can't be fixed at the application level.
Sure it can, why would it need to fetch RSS feeds when the screen is off and nobody could possible see the result? So you can stop the timer when you know the window isn't visible or alternatively when the screensaver is active, I think most desktops have notification of that as well.
Exactly, and that's what applications in the N900 do. For this to work reliably, you need these notifications (network disconnected, screen off) to be easily accessible, and even transparent to the application writer.
I don't think the suspend blockers solve much. A bad application will behave bad on any system. Suppose somebody decides to port Firefox to Android, and forgets to listen to the screen off event (bad on Android or Maemo), however, notices the application behaves very badly, so by googling finds these suspend blockers, and enables them all the time the application runs.
When the user install the application, will be greeted by a warning "This application might break PM, do you want to enable suspend blockers?" (or whatever), as any typical user would do, will press Yes (whatever).
We end up in exactly the same situation.
Signature · 1 line
Felipe Contreras
Quoted 5 lines · Florian Mickler
On Wed, 02 Jun 2010 12:21:28 +0200
Peter Zijlstra <[email protected]> wrote:Do you switch your pc on and off manually? Sometimes? Really? (if not, you are probably a kernel hacker *g*)
Yeah, when my Radeon GPU locks up the bus _again_, and yeah to replace parts, but no, not otherwise ;-) But I've been doing that for pretty much as long as I've had a computer.
Quoted 4 lines
But the rest are usecases that are similar to the suspend-blocker usecases. You know that you are not using the machine and going through the pain to shut down your machine. You have to do it manually. Why?
Make suspend an idle state and teach apps to go real quiet.
(Then again, that only really works when regular network packets can wake the machine for my case).
Quoted 10 lines
Quoted 3 lines
This leads to having to sprinkle magic dust (and lots of config options) all over userspace. Something that gets esp interesting with only a boolean interface.
A userspace daemon could keep track of what applications can be ignored. The wordprocessor probably should not keep the system busy. As well as a running firefox.
It is a hard problem. But we have
_noway of deciding any of this in thekernel_
Therefore I say, fix the worprocessor to not actually do anything if its not poked at -- not too hard, wordprocessors really don't need to do anything on their own, and you can do your last backup cycle when the window becomes invisible and stop the timer until the document changes again.
Same for firefox, you can teach it to not render animated gifs and run javascript for invisible tabs, and once the screen-saver kicks in, nothing is visible (and with X telling apps their window is visible or not it knows), so it should go idle all of its own.
Fix the friggin apps, don't kludge with freezing.
You really only ever want to freeze broken apps. And even for those I would prefer it if I got notified some app is stupid, then I could either fix it, or choose not to use it.
You can also teach cron to listen to dbus messages telling it about the screen state and postpone jobs -- but please make that a configurable thing, I really like all that work done at 4am when I'm (usually) not around to be bothered by it.
Quoted 4 lines
The problem is there independently of suspend blockers. If the system can suspend with network up, then you shure as hell want to suspend even if the network is up. So it would actually be a reason for any kind of "suspend blockers" scheme. Wouldn't it?
Well, at that point suspend is nothing more than an idle state, and platform code needs to somehow inform the idle state governor that active net connections need to prevent that idle state from being used.
If you want to call that suspend blockers, then sure, but its a long way away from the explicit scheme proposed at the start of this thread.
Quoted 14 lines · On Wed, 02 Jun 2010 12:21:28 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 8 lines · Arve Hjønnevåg
2010/6/2 Peter Zijlstra <[email protected]>:
Quoted 5 lines · Arve Hjønnevåg
Quoted 1 line
No I want you to stop confusing low power idle modes with suspend.
I think it is you who is confused. For power management purposes suspend is nothing more but a deep idle state.
No, idle is transparent, suspend is not.
Which is where the problem is, it should be.
Quoted 1 line
Why would I add suspend blockers to the code I want to prevent running?
Quoted 8 lines
Because what you want might not be what others want. Suppose you're fine with your torrent client/irc client/etc.. to loose their network connection when you're not behind your desktop so you don't add suspend blockers there.
Me, I'd be ready to administer physical violence if either of those lost their connections when I wasn't around to keep the screen-saver from kicking in.
Do you switch your pc on and off manually? Sometimes? Really? (if not, you are probably a kernel hacker *g*)
I assume, in general, there are only a few reasons to shut down a machine:
1. One has to do maintainance on the hardware or somehow needs to interrupt the power supply.
2. One wants to save power.
3. One wants to go easy on the hardware.
4. ...?
Obviously, for reason 1 we need to maintain the shutdown-paths indefinitely.
But the rest are usecases that are similar to the suspend-blocker usecases. You know that you are not using the machine and going through the pain to shut down your machine. You have to do it manually. Why?
Quoted 3 lines
This leads to having to sprinkle magic dust (and lots of config options) all over userspace. Something that gets esp interesting with only a boolean interface.
A userspace daemon could keep track of what applications can be ignored. The wordprocessor probably should not keep the system busy. As well as a running firefox.
It is a hard problem. But we have _no way of deciding any of this in the kernel_!
Quoted 6 lines
In the example above, having an active net connection would prevent my desktop from suspending, but what if another platform can maintain net connections while suspended? Do we then end up with arch specific code in the net-stack? I'm sure DaveM would love that.
If it is driver knowledge, then it goes into the driver. If it is platform knowledge, then it goes into the platform code. I think that is a clear requirement to keeping sanity.
The problem is there independently of suspend blockers. If the system can suspend with network up, then you shure as hell want to suspend even if the network is up. So it would actually be a reason for any kind of "suspend blockers" scheme. Wouldn't it?
Cheers,
Flo
Quoted 8 lines · Arve Hjønnevåg
2010/6/2 Peter Zijlstra <[email protected]>:
Quoted 5 lines · Arve Hjønnevåg
Quoted 1 line
No I want you to stop confusing low power idle modes with suspend.
I think it is you who is confused. For power management purposes suspend is nothing more but a deep idle state.
No, idle is transparent, suspend is not.
Which is where the problem is, it should be.
Quoted 1 line
Why would I add suspend blockers to the code I want to prevent running?
Because what you want might not be what others want. Suppose you're fine with your torrent client/irc client/etc.. to loose their network connection when you're not behind your desktop so you don't add suspend blockers there.
Me, I'd be ready to administer physical violence if either of those lost their connections when I wasn't around to keep the screen-saver from kicking in.
This leads to having to sprinkle magic dust (and lots of config options) all over userspace. Something that gets esp interesting with only a boolean interface.
In the example above, having an active net connection would prevent my desktop from suspending, but what if another platform can maintain net connections while suspended? Do we then end up with arch specific code in the net-stack? I'm sure DaveM would love that.
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
2010/6/2 Arve Hjønnevåg <[email protected]>:
Quoted 6 lines
2010/6/2 Peter Zijlstra <[email protected]>:
Quoted 3 lines
(and please don't mention @#$@ up x86 ACPI again, Intel knows, they're fixing it, get over it already).
I don't think it is realistic to drop support for all existing hardware.
We are talking about mainline here, there's no support for suspend blockers, so nothing is dropped.
In the mind of everybody, suspend blockers is for opportunistic suspend, which only makes sense on sensible hw (not current x86). So in the mind of everybody, x86 should be out of scope for the analysis of suspend blockers.
Are you seriously suggesting that one of the strong arguments in favor of suspend blockers is x86 usage (nobody agrees)? If not, then drop it.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Unrelated to
Android, I also want to use opportunistic suspend on my desktop.So you're going to sprinkle this suspend blocker shite all over regular userspace?
I have said several times, that regular user-space will not need to be modified to maintain their current behavior.
If I enable suspend blockers on my laptop, I have to modify my user-space. Otherwise my system will behave horribly.
Signature · 1 line
Felipe Contreras
Quoted 11 lines · On Sat, 5 Jun 2010 20:44:24 +0300 Felipe Contreras…
2010/6/2 Arve Hjønnevåg <[email protected]>:
Quoted 6 lines
2010/6/2 Peter Zijlstra <[email protected]>:
Quoted 3 lines
(and please don't mention @#$@ up x86 ACPI again, Intel knows, they're fixing it, get over it already).
I don't think it is realistic to drop support for all existing hardware.
We are talking about mainline here, there's no support for suspend blockers, so nothing is dropped.
Quoted 8 lines
In the mind of everybody, suspend blockers is for opportunistic suspend, which only makes sense on sensible hw (not current x86). So in the mind of everybody, x86 should be out of scope for the analysis of suspend blockers.
Are you seriously suggesting that one of the strong arguments in favor of suspend blockers is x86 usage (nobody agrees)? If not, then drop it.
I think they have an advantage over the 30-minute-screensaver-then-suspend that current desktops do. Because you can define what keeps the system up. I.e. the screensaver/powermanager is not limited to keyboard- and mouse-inactivity.
Quoted 3 lines
If I enable suspend blockers on my laptop, I have to modify my user-space. Otherwise my system will behave horribly.
In the simplest case you have a shell script which takes a suspend blocker and reads from stdinput. When you write "mem" to it, it releases the suspend blocker and acquires it back again. Voila, forced suspend reimplemented on top of opportunistic suspend.
That wasn't hard, was it?
Cheers,
Flo
Quoted 23 lines · Florian Mickler
Quoted 11 lines · On Sat, 5 Jun 2010 20:44:24 +0300 Felipe Contreras…
2010/6/2 Arve Hjønnevåg <[email protected]>:
Quoted 6 lines
2010/6/2 Peter Zijlstra <[email protected]>:
Quoted 3 lines
(and please don't mention @#$@ up x86 ACPI again, Intel knows, they're fixing it, get over it already).
I don't think it is realistic to drop support for all existing hardware.
We are talking about mainline here, there's no support for suspend blockers, so nothing is dropped.
Quoted 8 lines
In the mind of everybody, suspend blockers is for opportunistic suspend, which only makes sense on sensible hw (not current x86). So in the mind of everybody, x86 should be out of scope for the analysis of suspend blockers.
Are you seriously suggesting that one of the strong arguments in favor of suspend blockers is x86 usage (nobody agrees)? If not, then drop it.
Quoted 5 lines
I think they have an advantage over the 30-minute-screensaver-then-suspend that current desktops do. Because you can define what keeps the system up. I.e. the screensaver/powermanager is not limited to keyboard- and mouse-inactivity.
What prevents you from defining other things keeping the system up right now? Nothing. It's up to user-space to decide when to suspend. In fact applications already block suspend; Transmission has the option to block suspend when downloading torrents.
Quoted 10 lines
Quoted 3 lines
If I enable suspend blockers on my laptop, I have to modify my user-space. Otherwise my system will behave horribly.
In the simplest case you have a shell script which takes a suspend blocker and reads from stdinput. When you write "mem" to it, it releases the suspend blocker and acquires it back again. Voila, forced suspend reimplemented on top of opportunistic suspend.
That wasn't hard, was it?
Not hard, but still a modification of user-space, and a pretty bad one because it will prevent typical forced suspend, and typical suspend delaying (like with Transmission). Supposing the opportunistic suspend doesn't block the forced suspend, still, absolutely nothing will be achieved by enabling suspend blockers.
If you want to take even a minimal advantage of suspend blockers you need serious modifications to user-space.
Supposing there's a perfect usage of suspend blockers from user-space on current x86 platforms (in theory Android would have that), is the benefit that big to consider this a strong argument in favor of suspend blockers? Considering the small amount of x86 platforms using Android (is there any?), the fact that nobody else will use suspend blockers, and that x86 is already being fixed (as mentioned many times before) so dynamic PM is possible, I don't think we should be considering current x86 at all for suspend blockers.
Signature · 5 lines
Felipe Contreras _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 8 lines · On Sat, 5 Jun 2010 23:26:27 +0300 Felipe Contreras…
Supposing there's a perfect usage of suspend blockers from user-space on current x86 platforms (in theory Android would have that), is the benefit that big to consider this a strong argument in favor of suspend blockers? Considering the small amount of x86 platforms using Android (is there any?), the fact that nobody else will use suspend blockers, and that x86 is already being fixed (as mentioned many times before) so dynamic PM is possible, I don't think we should be considering current x86 at all for suspend blockers.
A solution for the desktop to deprecate having to shut down the machine would not be that bad, wouldn;t it? (Why have I to shut down my machine anyway?)
In my opinion such a decision (when to shutdown) has to be guided by userspace knowledge.
Future x86 hardware is to be fixed (as I read in this discussion), so using suspend blockers could be the tool of choice.
But alright. Let's be a little bit more focused on the present situation:
1) There currently is no other solution.
2) It is a first stepping stone to bringing android to mainline.
3) Any "perfect" solution will emerge anyway. As there are so many people with so strong opinions engaged in this discussion, I'm confident.
4) If there is a better solution, android will shurely adapt it as soon as it is there.
Cheers,
Flo
Quoted 21 lines · Florian Mickler
Quoted 8 lines · On Sat, 5 Jun 2010 23:26:27 +0300 Felipe Contreras…
Supposing there's a perfect usage of suspend blockers from user-space on current x86 platforms (in theory Android would have that), is the benefit that big to consider this a strong argument in favor of suspend blockers? Considering the small amount of x86 platforms using Android (is there any?), the fact that nobody else will use suspend blockers, and that x86 is already being fixed (as mentioned many times before) so dynamic PM is possible, I don't think we should be considering current x86 at all for suspend blockers.
A solution for the desktop to deprecate having to shut down the machine would not be that bad, wouldn;t it? (Why have I to shut down my machine anyway?)
In my opinion such a decision (when to shutdown) has to be guided by userspace knowledge.
Future x86 hardware is to be fixed (as I read in this discussion), so using suspend blockers could be the tool of choice.
Quoted 4 lines
But alright. Let's be a little bit more focused on the present situation:
1) There currently is no other solution.
Wrong. The solutions are there, just being refused.
Quoted 1 line
2) It is a first stepping stone to bringing android to mainline.
Crap. Once we have an userspace API we are bound to it. Period.
Also there is no technical reason why the whole driver stack cannot be merged w/o the suspend blockers.
Quoted 3 lines
3) Any "perfect" solution will emerge anyway. As there are so many people with so strong opinions engaged in this discussion, I'm confident.
Yes, and that needs cooperation and compromises from both sides and not just blindly defining that there is no other solution.
Quoted 2 lines
4) If there is a better solution, android will shurely adapt it as soon as it is there.
Sure, after we accepted the crap there is no incentive at all.
Stop that advertising campaing already.
No thanks,
tglx
Quoted 1 line · On Sat, 5 Jun 2010 23:24:40 +0200 (CEST) Thomas Gleixner <[email protected]>…
Stop that advertising campaing already.
Stop advertising that there is no problem.
Quoted 4 lines
No thanks,
tglx
Cheers,
Flo
(Sorry, crossfire. Caused
by you answering in the wrong subthread. I know that you are
engineering and not dismissing the problem. This was pointed at
Felipes "There is no problem"/"suspend blockers don't do what they are designed to do well")
Quoted 12 lines · Florian Mickler
Quoted 1 line · On Sat, 5 Jun 2010 23:24:40 +0200 (CEST) Thomas Gleixner <[email protected]>…
Stop that advertising campaing already.
Stop advertising that there is no problem.
Quoted 4 lines
No thanks,
tglx
Quoted 7 lines
Cheers,
Flo(Sorry, crossfire. Caused
by you answering in the wrong subthread. I know that you are
engineering and not dismissing the problem. This was pointed at
Felipes "There is no problem"/"suspend blockers don't do what they are designed to do well")
Welcome to my killfile.
Quoted 12 lines · Florian Mickler
Quoted 1 line · On Sat, 5 Jun 2010 23:24:40 +0200 (CEST) Thomas Gleixner <[email protected]>…
Stop that advertising campaing already.
Stop advertising that there is no problem.
Quoted 4 lines
No thanks,
tglx
Quoted 7 lines
Cheers,
Flo(Sorry, crossfire. Caused
by you answering in the wrong subthread. I know that you are
engineering and not dismissing the problem. This was pointed at
Felipes "There is no problem"/"suspend blockers don't do what they are designed to do well")
Welcome to my killfile.
Quoted 1 line · On Sat, 5 Jun 2010 23:24:40 +0200 (CEST) Thomas Gleixner <[email protected]>…
Stop that advertising campaing already.
Stop advertising that there is no problem.
Quoted 4 lines
No thanks,
tglx
Cheers,
Flo
(Sorry, crossfire. Caused
by you answering in the wrong subthread. I know that you are
engineering and not dismissing the problem. This was pointed at
Felipes "There is no problem"/"suspend blockers don't do what they are designed to do well")
Quoted 21 lines · Florian Mickler
Quoted 8 lines · On Sat, 5 Jun 2010 23:26:27 +0300 Felipe Contreras…
Supposing there's a perfect usage of suspend blockers from user-space on current x86 platforms (in theory Android would have that), is the benefit that big to consider this a strong argument in favor of suspend blockers? Considering the small amount of x86 platforms using Android (is there any?), the fact that nobody else will use suspend blockers, and that x86 is already being fixed (as mentioned many times before) so dynamic PM is possible, I don't think we should be considering current x86 at all for suspend blockers.
A solution for the desktop to deprecate having to shut down the machine would not be that bad, wouldn;t it? (Why have I to shut down my machine anyway?)
In my opinion such a decision (when to shutdown) has to be guided by userspace knowledge.
Future x86 hardware is to be fixed (as I read in this discussion), so using suspend blockers could be the tool of choice.
Quoted 4 lines
But alright. Let's be a little bit more focused on the present situation:
1) There currently is no other solution.
Wrong. The solutions are there, just being refused.
Quoted 1 line
2) It is a first stepping stone to bringing android to mainline.
Crap. Once we have an userspace API we are bound to it. Period.
Also there is no technical reason why the whole driver stack cannot be merged w/o the suspend blockers.
Quoted 3 lines
3) Any "perfect" solution will emerge anyway. As there are so many people with so strong opinions engaged in this discussion, I'm confident.
Yes, and that needs cooperation and compromises from both sides and not just blindly defining that there is no other solution.
Quoted 2 lines
4) If there is a better solution, android will shurely adapt it as soon as it is there.
Sure, after we accepted the crap there is no incentive at all.
Stop that advertising campaing already.
No thanks,
tglx
Quoted 8 lines · On Sat, 5 Jun 2010 23:26:27 +0300 Felipe Contreras…
Supposing there's a perfect usage of suspend blockers from user-space on current x86 platforms (in theory Android would have that), is the benefit that big to consider this a strong argument in favor of suspend blockers? Considering the small amount of x86 platforms using Android (is there any?), the fact that nobody else will use suspend blockers, and that x86 is already being fixed (as mentioned many times before) so dynamic PM is possible, I don't think we should be considering current x86 at all for suspend blockers.
A solution for the desktop to deprecate having to shut down the machine would not be that bad, wouldn;t it? (Why have I to shut down my machine anyway?)
In my opinion such a decision (when to shutdown) has to be guided by userspace knowledge.
Future x86 hardware is to be fixed (as I read in this discussion), so using suspend blockers could be the tool of choice.
But alright. Let's be a little bit more focused on the present situation:
1) There currently is no other solution.
2) It is a first stepping stone to bringing android to mainline.
3) Any "perfect" solution will emerge anyway. As there are so many people with so strong opinions engaged in this discussion, I'm confident.
4) If there is a better solution, android will shurely adapt it as soon as it is there.
Cheers,
Flo
Quoted 11 lines · On Sat, 5 Jun 2010 20:44:24 +0300 Felipe Contreras…
2010/6/2 Arve Hjønnevåg <[email protected]>:
Quoted 6 lines
2010/6/2 Peter Zijlstra <[email protected]>:
Quoted 3 lines
(and please don't mention @#$@ up x86 ACPI again, Intel knows, they're fixing it, get over it already).
I don't think it is realistic to drop support for all existing hardware.
We are talking about mainline here, there's no support for suspend blockers, so nothing is dropped.
Quoted 8 lines
In the mind of everybody, suspend blockers is for opportunistic suspend, which only makes sense on sensible hw (not current x86). So in the mind of everybody, x86 should be out of scope for the analysis of suspend blockers.
Are you seriously suggesting that one of the strong arguments in favor of suspend blockers is x86 usage (nobody agrees)? If not, then drop it.
I think they have an advantage over the 30-minute-screensaver-then-suspend that current desktops do. Because you can define what keeps the system up. I.e. the screensaver/powermanager is not limited to keyboard- and mouse-inactivity.
Quoted 3 lines
If I enable suspend blockers on my laptop, I have to modify my user-space. Otherwise my system will behave horribly.
In the simplest case you have a shell script which takes a suspend blocker and reads from stdinput. When you write "mem" to it, it releases the suspend blocker and acquires it back again. Voila, forced suspend reimplemented on top of opportunistic suspend.
That wasn't hard, was it?
Cheers,
Flo
2010/6/2 Arve Hjønnevåg <[email protected]>:
Quoted 6 lines
2010/6/2 Peter Zijlstra <[email protected]>:
Quoted 3 lines
(and please don't mention @#$@ up x86 ACPI again, Intel knows, they're fixing it, get over it already).
I don't think it is realistic to drop support for all existing hardware.
We are talking about mainline here, there's no support for suspend blockers, so nothing is dropped.
In the mind of everybody, suspend blockers is for opportunistic suspend, which only makes sense on sensible hw (not current x86). So in the mind of everybody, x86 should be out of scope for the analysis of suspend blockers.
Are you seriously suggesting that one of the strong arguments in favor of suspend blockers is x86 usage (nobody agrees)? If not, then drop it.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Unrelated to
Android, I also want to use opportunistic suspend on my desktop.So you're going to sprinkle this suspend blocker shite all over regular userspace?
I have said several times, that regular user-space will not need to be modified to maintain their current behavior.
If I enable suspend blockers on my laptop, I have to modify my user-space. Otherwise my system will behave horribly.
Signature · 5 lines
Felipe Contreras _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
2010/6/2 Peter Zijlstra <[email protected]>:
Quoted 5 lines · Arve Hjønnevåg
Quoted 1 line
No I want you to stop confusing low power idle modes with suspend.
I think it is you who is confused. For power management purposes suspend is nothing more but a deep idle state.
No, idle is transparent, suspend is not.
Quoted 4 lines
(and please don't mention @#$@ up x86 ACPI again, Intel knows, they're fixing it, get over it already).
I don't think it is realistic to drop support for all existing hardware.
Quoted 5 lines
Quoted 2 lines
Unrelated to
Android, I also want to use opportunistic suspend on my desktop.So you're going to sprinkle this suspend blocker shite all over regular userspace?
I have said several times, that regular user-space will not need to be modified to maintain their current behavior.
Quoted 6 lines
Why not instead work on getting apps to behave properly and idle when there's nothing to do?
After all, if you have the code to add suspend blockers into, you also have the means to fix it being stupid in the first place.
Why would I add suspend blockers to the code I want to prevent running?
Signature · 1 line
Arve Hjønnevåg
Quoted 1 line · Arve Hjønnevåg
No I want you to stop confusing low power idle modes with suspend.
I think it is you who is confused. For power management purposes suspend is nothing more but a deep idle state.
(and please don't mention @#$@ up x86 ACPI again, Intel knows, they're fixing it, get over it already).
Quoted 2 lines
Unrelated to
Android, I also want to use opportunistic suspend on my desktop.
So you're going to sprinkle this suspend blocker shite all over regular userspace? Why not instead work on getting apps to behave properly and idle when there's nothing to do?
After all, if you have the code to add suspend blockers into, you also have the means to fix it being stupid in the first place.
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
2010/6/2 Thomas Gleixner <[email protected]>:
Quoted 29 lines · Arve Hjønnevåg
Quoted 28 lines
2010/6/1 Thomas Gleixner <[email protected]>:
Quoted 27 lines · Arve Hjønnevåg
Quoted 25 lines
2010/5/31 Rafael J. Wysocki <[email protected]>:
Quoted 13 lines · Arve Hjønnevåg
Quoted 1 line
2010/5/30 Rafael J. Wysocki <[email protected]>:
...
Quoted 9 lines
I think it makes more sense to block suspend while wakeup events are pending than blocking it everywhere timers are used by code that could be called while handling wakeup events or other critical work. Also, even if you did block suspend everywhere timers where used you still have the race where a wakeup interrupt happens right after you decided to suspend. In other words, you still need to block suspend in all the same places as with the current opportunistic suspend code, so what is the benefit of delaying suspend until idle?
Quoted 4 lines
Assume for a while that you don't use suspend blockers, OK? I realize you think that anything else doesn't make sense, but evidently some other people have that opinion about suspend blockers.
It sounded like you were suggesting that initiating suspend from idle would somehow avoid the race condition with wakeup events. All I'm saying is that you would need to block suspend in all the same places. If you don't care about ignoring wakeup events, then sure you can initiate suspend from idle.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
And why should you miss a wakeup there ? If you get an interrupt in the transition, then you are not longer idle.
Because suspend itself causes you to not be idle you cannot abort suspend just because you are not idle anymore.
You still are addicted to the current suspend mechanism. :)
No I want you to stop confusing low power idle modes with suspend. I know how to enter low power modes from idle if that low power mode is not too disruptive.
Quoted 16 lines
The whole point of doing it from idle in the form of a deep power state is to avoid the massive sh*tload of work which is neccesary to run the existing suspend code. But that needs runtime power management and tweaks to avoid your timers waking you, etc.
The mechanism you want to use is: suspend no matter what, like closing the lid of the laptop, but with a few tweaks around it:
1) An interrupt on a wakeup source which comes in while the suspend code runs, i.e before you transitioned into wakeup mode, must abort / prevent suspend.
2) Prevent another attempt to suspend before the event has been delivered and the apps have signaled that they have not longer any work to do.
Quoted 5 lines
As a side effect you confine crappy apps with that mechanism in some way.
In the laptop case we do not want the tweaks as not going into suspend might set your backpack on fire.
If that is the case you should also disable the wakeup events.
Quoted 9 lines
If I understood you correctly then you can shutdown the CPU in idle completelty already, but that's not enough due to:
1) crappy applications keeping the cpu away from idle
2) timers firingWould solving those two issues be sufficient for you or am I missing something ?
Solving those two is enough for current android phones, but it may not be enough for other android devices. 1 is not solvable (meaning we cannot fix all apps), and 2 is difficult to fix since the periodic work is useful while the device is actually in use. One possible way to solve 2 is to allow timers on a not-idle clock. Unrelated to Android, I also want to use opportunistic suspend on my desktop.
Signature · 1 line
Arve Hjønnevåg
Quoted 8 lines · Thomas Gleixner
If I understood you correctly then you can shutdown the CPU in idle completelty already, but that's not enough due to:
1) crappy applications keeping the cpu away from idle
2) timers firingWould solving those two issues be sufficient for you or am I missing something ?
Aren't the container snapshot/resume people fighting the same set of problems here?
Quoted 6 lines · On Wed, 02 Jun 2010 11:10:51 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 3 lines · Thomas Gleixner
If I understood you correctly then you can shutdown the CPU in idle completelty already, but that's not enough due to:
Quoted 8 lines
Quoted 5 lines
1) crappy applications keeping the cpu away from idle
2) timers firingWould solving those two issues be sufficient for you or am I missing something ?
Aren't the container snapshot/resume people fighting the same set of problems here?
And virtualisation - its a big one for virtualisation because if you've got 1000 misbehaving guests generating 100 wakeups a second you've got a problem ....
Alan
Quoted 8 lines · Thomas Gleixner
If I understood you correctly then you can shutdown the CPU in idle completelty already, but that's not enough due to:
1) crappy applications keeping the cpu away from idle
2) timers firingWould solving those two issues be sufficient for you or am I missing something ?
Aren't the container snapshot/resume people fighting the same set of problems here?
Quoted 28 lines · Arve Hjønnevåg
2010/6/1 Thomas Gleixner <[email protected]>:
Quoted 27 lines · Arve Hjønnevåg
Quoted 25 lines
2010/5/31 Rafael J. Wysocki <[email protected]>:
Quoted 13 lines · Arve Hjønnevåg
Quoted 1 line
2010/5/30 Rafael J. Wysocki <[email protected]>:
...
Quoted 9 lines
I think it makes more sense to block suspend while wakeup events are pending than blocking it everywhere timers are used by code that could be called while handling wakeup events or other critical work. Also, even if you did block suspend everywhere timers where used you still have the race where a wakeup interrupt happens right after you decided to suspend. In other words, you still need to block suspend in all the same places as with the current opportunistic suspend code, so what is the benefit of delaying suspend until idle?
Quoted 4 lines
Assume for a while that you don't use suspend blockers, OK? I realize you think that anything else doesn't make sense, but evidently some other people have that opinion about suspend blockers.
It sounded like you were suggesting that initiating suspend from idle would somehow avoid the race condition with wakeup events. All I'm saying is that you would need to block suspend in all the same places. If you don't care about ignoring wakeup events, then sure you can initiate suspend from idle.
Quoted 6 lines
Quoted 3 lines
And why should you miss a wakeup there ? If you get an interrupt in the transition, then you are not longer idle.
Because suspend itself causes you to not be idle you cannot abort suspend just because you are not idle anymore.
You still are addicted to the current suspend mechanism. :)
The whole point of doing it from idle in the form of a deep power state is to avoid the massive sh*tload of work which is neccesary to run the existing suspend code. But that needs runtime power management and tweaks to avoid your timers waking you, etc.
The mechanism you want to use is: suspend no matter what, like closing the lid of the laptop, but with a few tweaks around it:
1) An interrupt on a wakeup source which comes in while the suspend code runs, i.e before you transitioned into wakeup mode, must abort / prevent suspend.
2) Prevent another attempt to suspend before the event has been delivered and the apps have signaled that they have not longer any work to do.
As a side effect you confine crappy apps with that mechanism in some way.
In the laptop case we do not want the tweaks as not going into suspend might set your backpack on fire.
If I understood you correctly then you can shutdown the CPU in idle completelty already, but that's not enough due to:
1) crappy applications keeping the cpu away from idle
2) timers firing
Would solving those two issues be sufficient for you or am I missing something ?
Thanks,
tglx
Quoted 19 lines · Arve Hjønnevåg
2010/5/31 Rafael J. Wysocki <[email protected]>:
Quoted 13 lines · Arve Hjønnevåg
Quoted 1 line
2010/5/30 Rafael J. Wysocki <[email protected]>:
...
Quoted 9 lines
I think it makes more sense to block suspend while wakeup events are pending than blocking it everywhere timers are used by code that could be called while handling wakeup events or other critical work. Also, even if you did block suspend everywhere timers where used you still have the race where a wakeup interrupt happens right after you decided to suspend. In other words, you still need to block suspend in all the same places as with the current opportunistic suspend code, so what is the benefit of delaying suspend until idle?
Quoted 4 lines
Assume for a while that you don't use suspend blockers, OK? I realize you think that anything else doesn't make sense, but evidently some other people have that opinion about suspend blockers.
Quoted 5 lines
It sounded like you were suggesting that initiating suspend from idle would somehow avoid the race condition with wakeup events. All I'm saying is that you would need to block suspend in all the same places. If you don't care about ignoring wakeup events, then sure you can initiate suspend from idle.
And why should you miss a wakeup there ? If you get an interrupt in the transition, then you are not longer idle.
Thanks,
tglx
Quoted 1 line · Arve Hjønnevåg
2010/5/30 Rafael J. Wysocki <[email protected]>:
...
Quoted 9 lines
I think it makes more sense to block suspend while wakeup events are pending than blocking it everywhere timers are used by code that could be called while handling wakeup events or other critical work. Also, even if you did block suspend everywhere timers where used you still have the race where a wakeup interrupt happens right after you decided to suspend. In other words, you still need to block suspend in all the same places as with the current opportunistic suspend code, so what is the benefit of delaying suspend until idle?
Assume for a while that you don't use suspend blockers, OK? I realize you think that anything else doesn't make sense, but evidently some other people have that opinion about suspend blockers.
Now, under that assumption, I think it _generally_ is reasonable to make the system go into full suspend if everything (ie. CPUs and I/O) has been idle for sufficiently long time and there are no QoS requirements that aren't compatible with full system suspend.
Rafael
2010/5/30 Rafael J. Wysocki <[email protected]>:
Quoted 42 lines · Arve Hjønnevåg
Quoted 41 lines
2010/5/29 Rafael J. Wysocki <[email protected]>:
Quoted 39 lines · Arve Hjønnevåg
Quoted 23 lines
2010/5/28 Rafael J. Wysocki <[email protected]>:
Quoted 13 lines · Arve Hjønnevåg
Quoted 3 lines · Florian Mickler
Quoted 2 lines
On Thu, 27 May 2010 20:05:39 +0200 (CEST)
Thomas Gleixner <[email protected]> wrote:...
Quoted 7 lines
Quoted 3 lines
To integrate this with the current way of doing things, i gathered it needs to be implemented as an idle-state that does the suspend()-call?
I think it is better no not confuse this with idle. Since initiating suspend will cause the system to become not-idle, I don't think is is beneficial to initiate suspend from idle.
Quoted 8 lines
It is, if the following two conditions hold simultaneously:
(a) Doing full system suspend is ultimately going to bring you more energy savings than the (presumably lowest) idle state you're currently in.
(b) You anticipate that the system will stay idle for a considerably long time such that it's worth suspending.
Quoted 7 lines
I still don't think this matters. If you are waiting for in interrupt that cannot wake you up from suspend, then idle is not an indicator that it is safe to enter suspend. I also don't think you can avoid any user-space suspend blockers by delaying suspend until the system goes idle since any page fault could cause it to go idle. Therefore I don't see a benefit in delaying suspend until idle when the last suspend blocker is released (it would only mask possible race conditions).
I wasn't referring to suspend blockers, but to the idea of initiating full system suspend from idle, which I still think makes sense. If you are waiting for an interrupt that cannot wake you from suspend, then _obviously_ suspend should not be started. However, if you're not waiting for such an interrupt and the (a) and (b) above hold, it makes sense to start suspend from idle.
Quoted 8 lines
Quoted 5 lines
What about timers? When you suspend timers stop (otherwise it is just a deep-idle mode), and this could cause problems. Some drivers rely on timers if the hardware does not have a completion interrupt. It is not uncommon to see send command x then wait 200ms in a some hardware specs.
QoS should be used in such cases.
I think it makes more sense to block suspend while wakeup events are pending than blocking it everywhere timers are used by code that could be called while handling wakeup events or other critical work. Also, even if you did block suspend everywhere timers where used you still have the race where a wakeup interrupt happens right after you decided to suspend. In other words, you still need to block suspend in all the same places as with the current opportunistic suspend code, so what is the benefit of delaying suspend until idle?
Signature · 1 line
Arve Hjønnevåg
Quoted 41 lines · Arve Hjønnevåg
2010/5/29 Rafael J. Wysocki <[email protected]>:
Quoted 32 lines · Arve Hjønnevåg
Quoted 23 lines
2010/5/28 Rafael J. Wysocki <[email protected]>:
Quoted 13 lines · Arve Hjønnevåg
Quoted 3 lines · Florian Mickler
Quoted 2 lines
On Thu, 27 May 2010 20:05:39 +0200 (CEST)
Thomas Gleixner <[email protected]> wrote:...
Quoted 7 lines
Quoted 3 lines
To integrate this with the current way of doing things, i gathered it needs to be implemented as an idle-state that does the suspend()-call?
I think it is better no not confuse this with idle. Since initiating suspend will cause the system to become not-idle, I don't think is is beneficial to initiate suspend from idle.
Quoted 8 lines
It is, if the following two conditions hold simultaneously:
(a) Doing full system suspend is ultimately going to bring you more energy savings than the (presumably lowest) idle state you're currently in.
(b) You anticipate that the system will stay idle for a considerably long time such that it's worth suspending.
Quoted 7 lines
I still don't think this matters. If you are waiting for in interrupt that cannot wake you up from suspend, then idle is not an indicator that it is safe to enter suspend. I also don't think you can avoid any user-space suspend blockers by delaying suspend until the system goes idle since any page fault could cause it to go idle. Therefore I don't see a benefit in delaying suspend until idle when the last suspend blocker is released (it would only mask possible race conditions).
Quoted 7 lines
I wasn't referring to suspend blockers, but to the idea of initiating full system suspend from idle, which I still think makes sense. If you are waiting for an interrupt that cannot wake you from suspend, then _obviously_ suspend should not be started. However, if you're not waiting for such an interrupt and the (a) and (b) above hold, it makes sense to start suspend from idle.
Quoted 5 lines
What about timers? When you suspend timers stop (otherwise it is just a deep-idle mode), and this could cause problems. Some drivers rely on timers if the hardware does not have a completion interrupt. It is not uncommon to see send command x then wait 200ms in a some hardware specs.
QoS should be used in such cases.
Rafael
2010/5/28 Rafael J. Wysocki <[email protected]>:
Quoted 13 lines · Arve Hjønnevåg
Quoted 3 lines · Florian Mickler
Quoted 2 lines
On Thu, 27 May 2010 20:05:39 +0200 (CEST)
Thomas Gleixner <[email protected]> wrote:...
Quoted 7 lines
Quoted 3 lines
To integrate this with the current way of doing things, i gathered it needs to be implemented as an idle-state that does the suspend()-call?
I think it is better no not confuse this with idle. Since initiating suspend will cause the system to become not-idle, I don't think is is beneficial to initiate suspend from idle.
Quoted 8 lines
It is, if the following two conditions hold simultaneously:
(a) Doing full system suspend is ultimately going to bring you more energy savings than the (presumably lowest) idle state you're currently in.
(b) You anticipate that the system will stay idle for a considerably long time such that it's worth suspending.
I still don't think this matters. If you are waiting for in interrupt that cannot wake you up from suspend, then idle is not an indicator that it is safe to enter suspend. I also don't think you can avoid any user-space suspend blockers by delaying suspend until the system goes idle since any page fault could cause it to go idle. Therefore I don't see a benefit in delaying suspend until idle when the last suspend blocker is released (it would only mask possible race conditions).
Signature · 1 line
Arve Hjønnevåg
Quoted 11 lines · Matthew Garrett
Quoted 4 lines · Thomas Gleixner
Oh no. They paper over a short coming. If there is a pending event, the kernel knows that. It just does not make use of this information. Blockers just paper over this by sprinkling
do_not_suspend()calls all over the place. What a sensible solution.Even if we could use suspend-via-deep-idle-state on PCs, we still need to be able to enter suspend while the system isn't idle. There's two ways to do that:
Quoted 7 lines
1) Force the system to be idle. Doing this race-free is difficult.
2) Enter suspend even though the system isn't idle. Since we can't rely on the scheduler, we need drivers to know whether userspace has consumed all wakeup events before allowing the transition to occur. Doing so requires either in-kernel suspend blockers or something that's almost identical.
You're just not getting it. If user space has consumed the event is not relevant at all.
What's relevant is whether the app has processed the event and reacted accordingly. That's all that matters.
Emptying your input queue is just the wrong indicator.
And as I explained several times now: It does _NOT_ matter when the app goes back in to blocked/idle state. You have to spend the CPU cycles and power for that anyway.
And for the apps which do not use the user space blockers the queue empty indicator is just bullshit, because after emptying the queue the kernel can go into suspend w/o any guarantee that the event has been processed.
The whole concept sucks, as it does not solve anything. Burning power now or in 100ms is the same thing power consumption wise.
Thanks,
tglx
Quoted 4 lines · Thomas Gleixner
The whole notion of treating suspend to RAM any different than a plain idle C-State is wrong. It's not different at all. You just use a different mechanism which has longer takedown and wakeup latencies and requires to shut down stuff and setup extra wakeup sources.
This is where you are wrong. Maybe not wrong in principle, but wrong in practice -- the kernel's present suspend-to-RAM (or just "suspend") implementation is _very_ different from C-states (or just "idle").
The primary difference is that the kernel can be forced into suspend even when the system isn't idle. In particular, it may be in the middle of processing a potential wakeup event -- and the current design gives the PM core no way to know if that is so. This is a weakness that in-kernel suspend blockers fix.
With C-states this can't happen. If the CPU goes into a deeper C-state then ipso facto it isn't busy processing anything, much less a wakeup event.
Now maybe this difference is a bad thing, and the whole PM suspend/hibernate infrastructure should be rewritten. But the fact, remains, that's how it works now. And it can't be changed easily or quickly.
Alan Stern
Quoted 9 lines · On Thu, 27 May 2010 18:45:25 +0200 (CEST) Thomas Gleixner <[email protected]>…
The whole notion of treating suspend to RAM any different than a plain idle C-State is wrong. It's not different at all. You just use a different mechanism which has longer takedown and wakeup latencies and requires to shut down stuff and setup extra wakeup sources.
And there is the whole problem. Switching from normal event delivery to those special wakeup sources. That needs to be engineered in any case carefuly and it does not matter whether you add suspend blockers or not.
Ok, I just don't know the answer: How is it just another idle state if the userspace gets frozen? Doesn't that bork the whole transition and you need a userspace<->kernel synchronisation point to not loose events?
Cheers,
Flo
Quoted 9 lines · On Thu, 27 May 2010 18:45:25 +0200 (CEST) Thomas Gleixner <[email protected]>…
The whole notion of treating suspend to RAM any different than a plain idle C-State is wrong. It's not different at all. You just use a different mechanism which has longer takedown and wakeup latencies and requires to shut down stuff and setup extra wakeup sources.
And there is the whole problem. Switching from normal event delivery to those special wakeup sources. That needs to be engineered in any case carefuly and it does not matter whether you add suspend blockers or not.
Ok, I just don't know the answer: How is it just another idle state if the userspace gets frozen? Doesn't that bork the whole transition and you need a userspace<->kernel synchronisation point to not loose events?
Cheers,
Flo
Quoted 8 lines · Florian Mickler
Quoted 5 lines · On Thu, 27 May 2010 18:45:25 +0200 (CEST) Thomas Gleixner <[email protected]>…
The whole notion of treating suspend to RAM any different than a plain idle C-State is wrong. It's not different at all. You just use a different mechanism which has longer takedown and wakeup latencies and requires to shut down stuff and setup extra wakeup sources.
Quoted 8 lines
Quoted 4 lines
And there is the whole problem. Switching from normal event delivery to those special wakeup sources. That needs to be engineered in any case carefuly and it does not matter whether you add suspend blockers or not.
Ok, I just don't know the answer: How is it just another idle state if the userspace gets frozen? Doesn't that bork the whole transition and you need a userspace<->kernel synchronisation point to not loose events?
There is no userspace to freeze when the runqueues are empty.
And as explained, you won't loose events if all the devices do a proper state transition. To quote:
Quoted 7 lines · Thomas Gleixner
If the interrupt happens _BEFORE_ we switch over to the quiescent state, then we need to backout. If it happens after the switch then it goes into the nirwana if the suspend wakeup has not been set up correctly. If we have it setup correctly then we go into suspend just to come back immediately. There is nothing you can do about that with suspend blockers.
Quoted 8 lines · Florian Mickler
Quoted 5 lines · On Thu, 27 May 2010 18:45:25 +0200 (CEST) Thomas Gleixner <[email protected]>…
The whole notion of treating suspend to RAM any different than a plain idle C-State is wrong. It's not different at all. You just use a different mechanism which has longer takedown and wakeup latencies and requires to shut down stuff and setup extra wakeup sources.
Quoted 8 lines
Quoted 4 lines
And there is the whole problem. Switching from normal event delivery to those special wakeup sources. That needs to be engineered in any case carefuly and it does not matter whether you add suspend blockers or not.
Ok, I just don't know the answer: How is it just another idle state if the userspace gets frozen? Doesn't that bork the whole transition and you need a userspace<->kernel synchronisation point to not loose events?
There is no userspace to freeze when the runqueues are empty.
And as explained, you won't loose events if all the devices do a proper state transition. To quote:
Quoted 7 lines · Thomas Gleixner
If the interrupt happens _BEFORE_ we switch over to the quiescent state, then we need to backout. If it happens after the switch then it goes into the nirwana if the suspend wakeup has not been set up correctly. If we have it setup correctly then we go into suspend just to come back immediately. There is nothing you can do about that with suspend blockers.
Quoted 14 lines · On Thu, 27 May 2010 19:25:27 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 13 lines · Florian Mickler
Quoted 9 lines · On Thu, 27 May 2010 18:45:25 +0200 (CEST) Thomas Gleixner <[email protected]>…
The whole notion of treating suspend to RAM any different than a plain idle C-State is wrong. It's not different at all. You just use a different mechanism which has longer takedown and wakeup latencies and requires to shut down stuff and setup extra wakeup sources.
And there is the whole problem. Switching from normal event delivery to those special wakeup sources. That needs to be engineered in any case carefuly and it does not matter whether you add suspend blockers or not.
Quoted 5 lines
Quoted 3 lines
Ok, I just don't know the answer: How is it just another idle state if the userspace gets frozen? Doesn't that bork the whole transition and you need a userspace<->kernel synchronisation point to not loose events?
There is no userspace to freeze when the runqueues are empty.
If in the imaginery situation where userspace can aquire certain wakeup-constraints and loose certain wakeup-constraints, then it could be that the system enters suspend without empty runqueues.
Quoted 2 lines
And as explained, you won't loose events if all the devices do a proper state transition. To quote:
I believe the problem beeing userspace frozen at an unopportune time. So the wakeup event is processed (kernel-side) but userspace didn't have time to reacquire the correct wakeup-constraint to process the event.
I.e. the wakeup will be effectivly ignored.
Cheers,
Flo
Quoted 3 lines · Florian Mickler
If in the imaginery situation where userspace can aquire certain wakeup-constraints and loose certain wakeup-constraints, then it could be that the system enters suspend without empty runqueues.
No. Wakeup constaints simply delay wakeups, not loose them.
If there's something runnable, we run it.
What could happen is that you try to program a timer every 5ms, but then QoS won't let you and errors the timer_create() or something. But then the app gets to deal with it.
Quoted 9 lines
Quoted 2 lines
And as explained, you won't loose events if all the devices do a proper state transition. To quote:
I believe the problem beeing userspace frozen at an unopportune time. So the wakeup event is processed (kernel-side) but userspace didn't have time to reacquire the correct wakeup-constraint to process the event.
I.e. the wakeup will be effectivly ignored.
How so, event happens on hardware level, IRQ gets raised, CPU wakes up, handler gets run, handler generates a task wakeup, runqueue isn't empty, we run stuff.
I'm not quite sure how to loose something there.
Quoted 3 lines · Peter Zijlstra
How so, event happens on hardware level, IRQ gets raised, CPU wakes up, handler gets run, handler generates a task wakeup, runqueue isn't empty, we run stuff.
If you're using idle-based suspend without any forced idling or blocking of applications then you don't lose wakeups. People keep conflating separate issues.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 3 lines · Peter Zijlstra
How so, event happens on hardware level, IRQ gets raised, CPU wakes up, handler gets run, handler generates a task wakeup, runqueue isn't empty, we run stuff.
If you're using idle-based suspend without any forced idling or blocking of applications then you don't lose wakeups. People keep conflating separate issues.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 9 lines · Matthew Garrett
Quoted 3 lines · Peter Zijlstra
How so, event happens on hardware level, IRQ gets raised, CPU wakes up, handler gets run, handler generates a task wakeup, runqueue isn't empty, we run stuff.
If you're using idle-based suspend without any forced idling or blocking of applications then you don't lose wakeups. People keep conflating separate issues.
I still don't see how blocking applications will cause missed wakeups in anything but a buggy application at worst, and even those will eventually get the event when they unblock.
What seems to be the confusion?
Quoted 9 lines · Matthew Garrett
Quoted 3 lines · Peter Zijlstra
How so, event happens on hardware level, IRQ gets raised, CPU wakes up, handler gets run, handler generates a task wakeup, runqueue isn't empty, we run stuff.
If you're using idle-based suspend without any forced idling or blocking of applications then you don't lose wakeups. People keep conflating separate issues.
I still don't see how blocking applications will cause missed wakeups in anything but a buggy application at worst, and even those will eventually get the event when they unblock.
What seems to be the confusion?
Quoted 5 lines · Peter Zijlstra
I still don't see how blocking applications will cause missed wakeups in anything but a buggy application at worst, and even those will eventually get the event when they unblock.
What seems to be the confusion?
During forced suspend, applications are block because they are frozen.
When an event occurs, the application is notified somehow. But it can't respond because it is frozen. Hence the event remains sitting in a kernel queue and the system goes ahead and suspends anyway. The application doesn't get thawed until the system wakes up at some indefinite time in the future.
Alan Stern
Quoted 8 lines · Alan Stern
Quoted 5 lines · Peter Zijlstra
I still don't see how blocking applications will cause missed wakeups in anything but a buggy application at worst, and even those will eventually get the event when they unblock.
What seems to be the confusion?
Quoted 7 lines
During forced suspend, applications are block because they are frozen.
When an event occurs, the application is notified somehow. But it can't respond because it is frozen. Hence the event remains sitting in a kernel queue and the system goes ahead and suspends anyway. The application doesn't get thawed until the system wakes up at some indefinite time in the future.
If the kernel is awake to put things in queues, we're clearly not suspended and userspace is running ?!
Quoted 11 lines · Peter Zijlstra
Quoted 10 lines · Alan Stern
Quoted 5 lines · Peter Zijlstra
I still don't see how blocking applications will cause missed wakeups in anything but a buggy application at worst, and even those will eventually get the event when they unblock.
What seems to be the confusion?
During forced suspend, applications are block because they are frozen.
Quoted 8 lines
Quoted 5 lines
When an event occurs, the application is notified somehow. But it can't respond because it is frozen. Hence the event remains sitting in a kernel queue and the system goes ahead and suspends anyway. The application doesn't get thawed until the system wakes up at some indefinite time in the future.
If the kernel is awake to put things in queues, we're clearly not suspended and userspace is running ?!
Suspend is not an atomic operation. User space is frozen before freezable kernel threads both of these happen before drivers are suspended.
Signature · 1 line
Arve Hjønnevåg
Quoted 11 lines · Peter Zijlstra
Quoted 10 lines · Alan Stern
Quoted 5 lines · Peter Zijlstra
I still don't see how blocking applications will cause missed wakeups in anything but a buggy application at worst, and even those will eventually get the event when they unblock.
What seems to be the confusion?
During forced suspend, applications are block because they are frozen.
Quoted 8 lines
Quoted 5 lines
When an event occurs, the application is notified somehow. But it can't respond because it is frozen. Hence the event remains sitting in a kernel queue and the system goes ahead and suspends anyway. The application doesn't get thawed until the system wakes up at some indefinite time in the future.
If the kernel is awake to put things in queues, we're clearly not suspended and userspace is running ?!
Suspend is not an atomic operation. User space is frozen before freezable kernel threads both of these happen before drivers are suspended.
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 8 lines · Alan Stern
Quoted 5 lines · Peter Zijlstra
I still don't see how blocking applications will cause missed wakeups in anything but a buggy application at worst, and even those will eventually get the event when they unblock.
What seems to be the confusion?
Quoted 7 lines
During forced suspend, applications are block because they are frozen.
When an event occurs, the application is notified somehow. But it can't respond because it is frozen. Hence the event remains sitting in a kernel queue and the system goes ahead and suspends anyway. The application doesn't get thawed until the system wakes up at some indefinite time in the future.
If the kernel is awake to put things in queues, we're clearly not suspended and userspace is running ?!
Quoted 5 lines · Peter Zijlstra
I still don't see how blocking applications will cause missed wakeups in anything but a buggy application at worst, and even those will eventually get the event when they unblock.
What seems to be the confusion?
During forced suspend, applications are block because they are frozen.
When an event occurs, the application is notified somehow. But it can't respond because it is frozen. Hence the event remains sitting in a kernel queue and the system goes ahead and suspends anyway. The application doesn't get thawed until the system wakes up at some indefinite time in the future.
Alan Stern
Quoted 3 lines · Florian Mickler
If in the imaginery situation where userspace can aquire certain wakeup-constraints and loose certain wakeup-constraints, then it could be that the system enters suspend without empty runqueues.
No. Wakeup constaints simply delay wakeups, not loose them.
If there's something runnable, we run it.
What could happen is that you try to program a timer every 5ms, but then QoS won't let you and errors the timer_create() or something. But then the app gets to deal with it.
Quoted 9 lines
Quoted 2 lines
And as explained, you won't loose events if all the devices do a proper state transition. To quote:
I believe the problem beeing userspace frozen at an unopportune time. So the wakeup event is processed (kernel-side) but userspace didn't have time to reacquire the correct wakeup-constraint to process the event.
I.e. the wakeup will be effectivly ignored.
How so, event happens on hardware level, IRQ gets raised, CPU wakes up, handler gets run, handler generates a task wakeup, runqueue isn't empty, we run stuff.
I'm not quite sure how to loose something there.
Quoted 14 lines · On Thu, 27 May 2010 19:25:27 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 13 lines · Florian Mickler
Quoted 9 lines · On Thu, 27 May 2010 18:45:25 +0200 (CEST) Thomas Gleixner <[email protected]>…
The whole notion of treating suspend to RAM any different than a plain idle C-State is wrong. It's not different at all. You just use a different mechanism which has longer takedown and wakeup latencies and requires to shut down stuff and setup extra wakeup sources.
And there is the whole problem. Switching from normal event delivery to those special wakeup sources. That needs to be engineered in any case carefuly and it does not matter whether you add suspend blockers or not.
Quoted 5 lines
Quoted 3 lines
Ok, I just don't know the answer: How is it just another idle state if the userspace gets frozen? Doesn't that bork the whole transition and you need a userspace<->kernel synchronisation point to not loose events?
There is no userspace to freeze when the runqueues are empty.
If in the imaginery situation where userspace can aquire certain wakeup-constraints and loose certain wakeup-constraints, then it could be that the system enters suspend without empty runqueues.
Quoted 2 lines
And as explained, you won't loose events if all the devices do a proper state transition. To quote:
I believe the problem beeing userspace frozen at an unopportune time. So the wakeup event is processed (kernel-side) but userspace didn't have time to reacquire the correct wakeup-constraint to process the event.
I.e. the wakeup will be effectivly ignored.
Cheers,
Flo
Quoted 15 lines · Matthew Garrett
Quoted 9 lines · Thomas Gleixner
Quoted 7 lines · Matthew Garrett
Now let's try this in the Android world. The user hits a key and the system wakes up. The input layer takes a suspend block. The application now draws all the cows it wants to, takes its own suspend block and reads the input device. This empties the queue and the kernel-level suspend block is released. The application then processes the event before releasing the suspend block. The event has been delivered and handled.
Quoted 4 lines
Thanks for providing this example:
1) It proves that suspend blockers are solely designed to encourage people to code crap.
Quoted 8 lines
No. Suspend blockers are designed to ensure that suspend isn't racy with respect to wakeup events. The bit that mitigates badly written applications is the bit where the scheduler doesn't run any more.
If you're happy with a single badly written application being able to cripple your power management story, you don't need opportunistic suspend. But you still have complications when it comes to deciding to enter suspend at the same time as you receive a wakeup event.
Wrong. Setting the QoS requirements of the badly written app to any latency will allow the kernel to suspend even if the crappy app is active.
And again. I'm opposing the general chant that fixing crappy applications in the kernel is a good thing. It's the worst decision we could make.
Quoted 10 lines
Quoted 4 lines
And you need to do that, because the user applications suspend blocker magic is racy as hell. To work around that you sprinkle your suspend blocker magic all over the kernel instead of telling people how to solve the problem correctly.
What /is/ the correct way to solve this problem when entering explicit suspend states? How do you guarantee that an event has been delivered to userspace before transitioning into suspend? Now, this is a less interesting problem if you're not using opportunistic suspend, but it's still a problem.
Holy crap. If an event happens _before_ we go into an idle state - and I see suspend as an deeper idle state - then we do not go there at all.
The whole notion of treating suspend to RAM any different than a plain idle C-State is wrong. It's not different at all. You just use a different mechanism which has longer takedown and wakeup latencies and requires to shut down stuff and setup extra wakeup sources.
And there is the whole problem. Switching from normal event delivery to those special wakeup sources. That needs to be engineered in any case carefuly and it does not matter whether you add suspend blockers or not.
Quoted 6 lines
Quoted 4 lines
Simply because you move the cow drawing CPU time from the point where the device wants to go into suspend to the point where the user hits a key again. You even delay the reaction of your app to the user input by the time it needs to finish drawing cows.
It's how application mainloops tend to work.
So what's the f*cking point ? You draw exactly the same amount of power and still you are claiming that it's better or what ?
Quoted 18 lines
Quoted 12 lines
Quoted 4 lines
You can't express that with resource limits or QoS constraints. If you want to deal with this kind of situation then, as far as I can tell, you need either suspend blockers or something so close to them that it makes no difference.
Wrong. If your application is interactive then you set the QoS requirement once to interactive and be done.
So the correct point to make a power state decision is when the app waits for a key press. At this point the kernel can take several pathes:
Quoted 5 lines
1) Keep the system alive because the input device is in active state and a key press is expected
2) Go into supsend because the input device is deactivated after the screen lock kicked in.
Quoted 8 lines
That's no good. If the input device has been deactivated, how does the wakeup event get delivered to the application?
Quoted 3 lines
This behaves exactly the same way in terms of power consumption as your blocker example just without all the mess you are trying to create.
And means that wakeup events don't get delivered. That's a shortcoming.
That's utter nonsense. If we have a problem with missed wakeups then it needs to be fixed and not papered over with suspend blocker magic.
I'm starting to get really grumpy about the chant that suspend blockers are the only way to fix missed wakeups. That might be the only way you can think of with your pink android glasses on, but again this is not rocket science even if it does not fit into the current way the kernel handles the whole suspend mechanism.
So if we really sit back and look at suspend as another idle state, then we have first off the same requirements for entering it as we have for any other idle state:
No running tasks (and we can solve the don't care task problem nicely with QoS)
Aside of that we need to bring devices into a quiescent state and setup the wakeup sources. That switch over needs to be done with and without suspend blockers in a careful way for each SoC implementation.
If the interrupt happens _BEFORE_ we switch over to the quiescent state, then we need to backout. If it happens after the switch then it goes into the nirwana if the suspend wakeup has not been set up correctly. If we have it setup correctly then we go into suspend just to come back immediately. There is nothing you can do about that with suspend blockers.
So if the interrupt comes in before we switch then we have that information already today. We might not make use of it or just in a racy way, but that does not warrant to work around that problem with a big hammer approach.
You can try to lull me into cozy suspend blocker acceptance as long as you want, but you better spend your time on either giving a coherent explanation why suspend blockers are necessary or looking at the underlying problem and fixing it in a technical correct way.
Thanks,
tglx
Quoted 9 lines · Thomas Gleixner
Quoted 7 lines · Matthew Garrett
Now let's try this in the Android world. The user hits a key and the system wakes up. The input layer takes a suspend block. The application now draws all the cows it wants to, takes its own suspend block and reads the input device. This empties the queue and the kernel-level suspend block is released. The application then processes the event before releasing the suspend block. The event has been delivered and handled.
Quoted 4 lines
Thanks for providing this example:
1) It proves that suspend blockers are solely designed to encourage people to code crap.
No. Suspend blockers are designed to ensure that suspend isn't racy with respect to wakeup events. The bit that mitigates badly written applications is the bit where the scheduler doesn't run any more.
If you're happy with a single badly written application being able to cripple your power management story, you don't need opportunistic suspend. But you still have complications when it comes to deciding to enter suspend at the same time as you receive a wakeup event.
Quoted 4 lines
And you need to do that, because the user applications suspend blocker magic is racy as hell. To work around that you sprinkle your suspend blocker magic all over the kernel instead of telling people how to solve the problem correctly.
What /is/ the correct way to solve this problem when entering explicit suspend states? How do you guarantee that an event has been delivered to userspace before transitioning into suspend? Now, this is a less interesting problem if you're not using opportunistic suspend, but it's still a problem.
Quoted 4 lines
Simply because you move the cow drawing CPU time from the point where the device wants to go into suspend to the point where the user hits a key again. You even delay the reaction of your app to the user input by the time it needs to finish drawing cows.
It's how application mainloops tend to work.
Quoted 12 lines
Quoted 4 lines
You can't express that with resource limits or QoS constraints. If you want to deal with this kind of situation then, as far as I can tell, you need either suspend blockers or something so close to them that it makes no difference.
Wrong. If your application is interactive then you set the QoS requirement once to interactive and be done.
So the correct point to make a power state decision is when the app waits for a key press. At this point the kernel can take several pathes:
Quoted 5 lines
1) Keep the system alive because the input device is in active state and a key press is expected
2) Go into supsend because the input device is deactivated after the screen lock kicked in.
That's no good. If the input device has been deactivated, how does the wakeup event get delivered to the application?
Quoted 3 lines
This behaves exactly the same way in terms of power consumption as your blocker example just without all the mess you are trying to create.
And means that wakeup events don't get delivered. That's a shortcoming.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 11 lines · Alan Cox
- Supporting Android needs well good
- Opportunistic suspend good
- Manner in which interface is expressed to userspace bad
- Latency constraint interface would be better
- Your existing behaviour can be implemented by a simplistic use of a latency constraint interface
- We can fix a pile of other directly connected things at the same time
- Implementation internals I care far less about because we can fix those later
- Suspend is just a power state
Quoted 1 line
How does that fit your model and vision ?
I don't entirely see how this works. In order to deal with poorly written applications, it's necessary to (optionally, based on some policy) ignore them when it comes to the scheduler. The problem is how to implement the optional nature of this in a race-free manner. This is obviously a pathological case, but imagine an application that does something along the following lines:
int input = open ("/dev/input", O_RDONLY|O_NONBLOCK); char foo;
while (1) {
suspend_block();
if (read(input, &foo, 1) > 0) {
(do something)
suspend_unblock();
} else {
suspend_unblock();
(draw bouncing cows and clouds and tractor beams briefly)
}
}Now, if the user is playing this game, you want it to be scheduled. If the user has put down their phone and the screen lock has kicked in, you don't want it to be scheduled. So we could imagine some sort of cgroup that contains untrusted tasks - when the session is active we set a flag one way which indicates to the scheduler that tasks in TASK_RUNNING should be scheduled, and when the session is idle we set the flag the other way and all processes in that cgroup get shifted to TASK_INTERRUPTIBLE or something.
Except that doesn't work. If the session goes idle in the middle of the app drawing a frame, we'll stop the process and the task will never call read(). So the user hits a key, we wake up, nothing shifts from TASK_INTERRUPTIBLE into TASK_RUNNING, the key never gets read, we go back to sleep. The event never gets delivered.
Now let's try this in the Android world. The user hits a key and the system wakes up. The input layer takes a suspend block. The application now draws all the cows it wants to, takes its own suspend block and reads the input device. This empties the queue and the kernel-level suspend block is released. The application then processes the event before releasing the suspend block. The event has been delivered and handled.
You can't express that with resource limits or QoS constraints. If you want to deal with this kind of situation then, as far as I can tell, you need either suspend blockers or something so close to them that it makes no difference.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 9 lines · On Wed, 26 May 2010 15:30:58 -0700 Arve Hjønnevåg <[email protected]> wrote:
Quoted 8 lines · Alan Cox
Quoted 7 lines
Really, what are you getting at? Do you deny that there are programs, that prevent a device from sleeping? (Just think of the bouncing cows app)
And if you have two kernels, one with which your device is dead after 1 hour and one with which your device is dead after 10 hours. Which would you prefer? I mean really... this is ridiculous.
Quoted 6 lines
Quoted 3 lines
The problem you have is that this is policy. If I have the device wired to a big screen and I want cows bouncing on it I'll be most upset if instead it suspends.
We never suspend when the screen is on. If the screen is off, I would not be upset if it suspends.
This is policy and platform specific. The OLPC can suspend with the screen on. Should I write my app to know about this once for Android and once for OLPC (and no doubt once for Apple). In the OLPC case cows could indeed suspend to RAM between frames if the wakeup time was suitable.
My app simply should not have to know this sort of crap, that's the whole point of an OS.
Quoted 7 lines
Quoted 2 lines
What you are essentially arguing for is for the
kernel to disobey the userspace.No I'm not. User-space asked the kernel to suspend when possible. Suspend is an existing kernel feature. All opportunistic suspend adds is the ability to use it safely when there are wakeup event you cannot afford to ignore.
Don't get me wrong - opportunistic suspend isn't the problem. Suspend blockers are - or more precisely - the manner in which they express intent from userspace. Opportunistic suspend is wonderful stuff for all sorts of things and if it persuades people like netbook manufacturers to think harder, and Linux driver authors to optimise their suspend/resume paths we all win.
Quoted 6 lines
Our actual stating point is this: Some systems can only enter their lowest power state from suspend. So we added an api that allowed us to use suspend without loosing wakeup events. Since suspending also improves our battery life on platforms that enter the same power state from idle and suspend and we already have a way to safely use suspend, we would be crazy not to use it.
Opportunistic suspend isn't special. Suspend is just a very deep idle. In fact some of the low power states on processors look little different to suspend - the OS executes a whole pile of CPU state saving and cache flushing. It might be a hardware state machine, it might be buried in firmware or it might be quite explicit (eg mrst). So we already have differing degrees of doing additional work in different states.
User triggered suspend is a bit special in that the user is usually right in that case to override the power management policy.
Note I'm not suggesting we run off and restructure all our power management code to take this view right now. I'm suggesting we need a clean 'opportunistic suspend is not special' view by user space. How the kernel handles this is addressible later without app breakage, but only if we get the interface wrong to begin with.
Quoted 8 lines
Quoted 2 lines
Sandboxing/Resource Limits: handling apps that can't be trusted. So the phone runs the appstore code via something like
Sandboxing is problematic on Android since there are a lot of cross process dependencies. When a call comes in I don't know where the name and picture to display comes from. With suspend blockers we block suspend when we get notified that we have an incoming call and we can call into any process and get a response.
But you can express user suspend blocking in this manner. Your call incoming code would say 'I want good latency'. As someone needs good latency the box won't suspend. If your approach is to start with an initial 'anyone can set a low latency we don't care' then anyone can block suspends.
Equally your call handling example is about latency not about suspend. You want the phone to stay on, to fetch a picture and display it promptly.
So what are expressing
'I am using device 'screen' please keep it live' (which may or may not block suspend - see OLPC). I guess your display server and kernel support manage this bit.
'I want the photo to appear in a resonable timescale' (latency). It's not a suspend question - an imaginary non suspend idle mode with a 20 second latency would be just as annoying yes ?
At the moment we have a very real bigger problem that your problem is part of.
- Hard real time people want to be able to limit the CPU sleeping behaviour based upon what tasks are running
- Certain gaming types want their boxes to be good power citizens except when committing digital mass murder. Right now that involves wrapping the game in a script with bits occurring as root and that generally breaks if the game crashes so the script doesn't run nicely on exit
- Virtual machine people desperately want to see latency data to help schedule stuff in a power efficient manner. In a virtual machine environment its vital information about how you schedule a virtual machine, whether now is a good time to live migrate it and how best to optimise power/performance on the server end.
- Some drivers want to constrain idling because they know platform/hardware stuff the core power management code doesn't (eg serial ports at high speed). We want that expressed in a way that keeps the power management code clean of such device knowledge
Now I don't care if we have an elegant kernel interface and Android uses it as a big hammer - if that makes Android work well everyone can be happy. What I don't want is to have a big hammer when it doesn't solve the underlying big picture problem for everyone.
So my working position is summarised thusly
- Supporting Android needs well good
- Opportunistic suspend good
- Manner in which interface is expressed to userspace bad
- Latency constraint interface would be better
- Your existing behaviour can be implemented by a simplistic use of a latency constraint interface
- We can fix a pile of other directly connected things at the same time
- Implementation internals I care far less about because we can fix those later
- Suspend is just a power state
How does that fit your model and vision ?
Quoted 2 lines
What about platforms that currently cannot enter low power states from idle? Do you remove suspend support from the kernel?
I would actually expect a system that can't do any low power states to support the user API and blissfully ignore it. Applications will ask for various latency guarantees and of course always get them. The apps will be portable, the device will be offering it's best behaviour and everyone will be happy.
If your device only supports full on and suspend I don't see why opportunistic suspend couldn't be provided assuming sufficient wakeup support was present. It won't be the most exciting power management policy to write but it's perfectly doable and the apps again will not need recoding to handle it.
The latency goal data is also priceless for another consumer - in a virtual machine environment its vital information about how you schedule a virtual machine, whether now is a good time to live migrate it and how best to optimise power/performance on the server end.
Alan
2010/5/27 Arve Hjønnevåg <[email protected]>:
Quoted 9 lines · Alan Cox
Quoted 8 lines
Quoted 7 lines
Really, what are you getting at? Do you deny that there are programs, that prevent a device from sleeping? (Just think of the bouncing cows app)
And if you have two kernels, one with which your device is dead after 1 hour and one with which your device is dead after 10 hours. Which would you prefer? I mean really... this is ridiculous.
Quoted 6 lines
Quoted 3 lines
The problem you have is that this is policy. If I have the device wired to a big screen and I want cows bouncing on it I'll be most upset if instead it suspends.
We never suspend when the screen is on. If the screen is off, I would not be upset if it suspends.
That's /wrong/. What if you have an active download ongoing when the screen is off? This ugly simplistic approach is one of the worst things in Android.
~Vitaly
2010/5/27 Vitaly Wool <[email protected]>:
Quoted 14 lines
2010/5/27 Arve Hjønnevåg <[email protected]>:
Quoted 13 lines · Alan Cox
Quoted 11 lines
Quoted 7 lines
Really, what are you getting at? Do you deny that there are programs, that prevent a device from sleeping? (Just think of the bouncing cows app)
And if you have two kernels, one with which your device is dead after 1 hour and one with which your device is dead after 10 hours. Which would you prefer? I mean really... this is ridiculous.
The problem you have is that this is policy. If I have the device wired to a big screen and I want cows bouncing on it I'll be most upset if instead it suspends.
Quoted 6 lines
Quoted 2 lines
We never suspend when the screen is on. If the screen is off, I would not be upset if it suspends.
That's /wrong/. What if you have an active download ongoing when the screen is off? This ugly simplistic approach is one of the worst things in Android.
On android we have code that blocks suspend while downloading. On non-android systems I have used if the download has not finished by the time the auto-sleep timeout kicks in, the system will suspend and the download halts.
Signature · 1 line
Arve Hjønnevåg
2010/5/27 Vitaly Wool <[email protected]>:
Quoted 14 lines
2010/5/27 Arve Hjønnevåg <[email protected]>:
Quoted 13 lines · Alan Cox
Quoted 11 lines
Quoted 7 lines
Really, what are you getting at? Do you deny that there are programs, that prevent a device from sleeping? (Just think of the bouncing cows app)
And if you have two kernels, one with which your device is dead after 1 hour and one with which your device is dead after 10 hours. Which would you prefer? I mean really... this is ridiculous.
The problem you have is that this is policy. If I have the device wired to a big screen and I want cows bouncing on it I'll be most upset if instead it suspends.
Quoted 6 lines
Quoted 2 lines
We never suspend when the screen is on. If the screen is off, I would not be upset if it suspends.
That's /wrong/. What if you have an active download ongoing when the screen is off? This ugly simplistic approach is one of the worst things in Android.
On android we have code that blocks suspend while downloading. On non-android systems I have used if the download has not finished by the time the auto-sleep timeout kicks in, the system will suspend and the download halts.
Signature · 1 line
Arve Hjønnevåg
2010/5/27 Arve Hjønnevåg <[email protected]>:
Quoted 9 lines · Alan Cox
Quoted 8 lines
Quoted 7 lines
Really, what are you getting at? Do you deny that there are programs, that prevent a device from sleeping? (Just think of the bouncing cows app)
And if you have two kernels, one with which your device is dead after 1 hour and one with which your device is dead after 10 hours. Which would you prefer? I mean really... this is ridiculous.
Quoted 6 lines
Quoted 3 lines
The problem you have is that this is policy. If I have the device wired to a big screen and I want cows bouncing on it I'll be most upset if instead it suspends.
We never suspend when the screen is on. If the screen is off, I would not be upset if it suspends.
That's /wrong/. What if you have an active download ongoing when the screen is off? This ugly simplistic approach is one of the worst things in Android.
~Vitaly
Quoted 7 lines
Really, what are you getting at? Do you deny that there are programs, that prevent a device from sleeping? (Just think of the bouncing cows app)
And if you have two kernels, one with which your device is dead after 1 hour and one with which your device is dead after 10 hours. Which would you prefer? I mean really... this is ridiculous.
The problem you have is that this is policy. If I have the device wired to a big screen and I want cows bouncing on it I'll be most upset if instead it suspends. What you are essentially arguing for is for the kernel to disobey the userspace. It's as ridiculous (albeit usually less damaging) as a file system saying "Ooh thats a rude file name, the app can't have meant it, I'll put your document soemwhere else"
The whole API feels wrong to me. It's breaking rule #1 of technology "You cannot solve a social problem with technology". In this case you have a social/economic problem which is crap code. You solve it with an economics solution - creative incentives not to produce crap code like boxes that keep popping up saying "App XYZ is using all your battery" and red-amber-green powermeter scores in app stores.
That said if you want technical mitigation I think it makes more sense if you look at it from a different starting point. The starting point being this: We have idling logic in the kernel and improving this helps everyone. What is needed to improve the existing logic ?
- You don't know which processes should be ignored for the purpose of suspend (except for kernel threads) and there is no way to set this
- You don't know whether a move from a deep idle to a 'suspend' (which is just a really deep idle in truth anyway) might break wakeups requirements because a device has wake dependencies due to hardware design (eg a port that has no electronics to kick the box out of suspend into running). This is a problem we have already. [1]
That maps onto two existing ideas
Sandboxing/Resource Limits: handling apps that can't be trusted. So the phone runs the appstore code via something like
setpidle(getpid(), something); exec()
where 'something' is a value with meaning to both user space and to the existing idling logic in the kernel that basically says to what extent it is permitted to block idling/suspend. That also seems to tie into some of the realtime + idle problems. This I think deals with Kevin Hillman's thoughts on dealing with untrustworthy app code more cleanly and avoids the need for userspace hackery like the blocker API.
And an entirely in kernel API where device drivers can indicate that in their current situation they require that the power level doesn't drop below some limit unless user requested. This is really important because the platform vendor of the phone/pda/tablet whatever effectively owns the kernel - so it's *their* problem, *their* control, *their* hardware and they can make it work as best for the device. Best of all it means its all free software stuff so if the vendor screws up you can still fix your phone.
Implementation-wise it probably ties into setpidle, its simply that a task has a pair of idle values, a dynamic one and a base one, the dynamic one being the base one but updatable temporarily by drivers.
Alan
--
[1] Note I disagree with Kevin here on static/dynamic power management. There are IMHO two types of PM but they are 'user invoked' and 'automatic'. "Static" simply means it's not been made fast enough yet but its just a policy divide dependant on the users 'acceptable' resume time (which for hard RT may just as well rule out some more usual power states)
Quoted 3 lines · Florian Mickler
Because he is using a robust kernel that provides suspend blockers and is preventing the vampire from sucking power?
Suspend blockers are only a flawed and indirect way to keep the vampire from sucking.
Quoted 6 lines
Most users don't even grasp the simple concept of different "programs". They just have a device and click here and there and are happy.
Really, what are you getting at? Do you deny that there are programs, that prevent a device from sleeping? (Just think of the bouncing cows app)
He's getting at the fact that there are much better ways to deal with this problem. The issue here is that we seem to be expected to swallow whatever Google throws at us, regardless of the quality of the solution. It seems like the best argument we have for merging is "we couldn't think of anything better and we need it yesterday." This might be a good enough reason for shipping, but it certainly doesn't satisfy the requirements for merging.
Quoted 4 lines
And if you have two kernels, one with which your device is dead after 1 hour and one with which your device is dead after 10 hours. Which would you prefer? I mean really... this is ridiculous.
It is absolutely not. If you want to keep power usage down, then implement real resource management in the scheduler. Suspend blockers are nothing but a clunky and ineffective means of resource allocation. As has been pointed out in this thread, there are much better ways of dealing with this problem.
- Ben
Quoted 17 lines · On Thu, 27 May 2010 22:09:37 -0400 Ben Gamari <[email protected]> wrote:
Quoted 3 lines · Florian Mickler
Because he is using a robust kernel that provides suspend blockers and is preventing the vampire from sucking power?
Suspend blockers are only a flawed and indirect way to keep the vampire from sucking.
Quoted 6 lines
Most users don't even grasp the simple concept of different "programs". They just have a device and click here and there and are happy.
Really, what are you getting at? Do you deny that there are programs, that prevent a device from sleeping? (Just think of the bouncing cows app)
Quoted 7 lines
He's getting at the fact that there are much better ways to deal with this problem. The issue here is that we seem to be expected to swallow whatever Google throws at us, regardless of the quality of the solution. It seems like the best argument we have for merging is "we couldn't think of anything better and we need it yesterday." This might be a good enough reason for shipping, but it certainly doesn't satisfy the requirements for merging.
I don't disagree on the quality. But I don't think it is because of the patches, but because of how the kernel is architectured in that area (suspend not being an idle state).
Look, probably suspend needs to be integrated into the idle states and used from there. I could imagine a cost-specification for idle states:
c3
cost-to-transition-to-this-state: X
powersavings-per-time: Y
expected time we stay in this state: relative short, there is a timer sheduled
suspend-blockers: ignored
suspend
cost-to-transition-to-this-state: depends, how much drivers to suspend, how much processes to freeze, ...
powersavings-per-time: Y
expected time we stay in this state: long, independent of sheduled timers
suspend-blockers: need not be activated
Now, a governor could compute if it is ok, to enter suspend or only wait for idle-c3. And maybe it would never transition from idle-c3 to suspend but only from c1. because the cost to enter suspend would mean it just has to go to c1 anyway.
what do ya think?
Quoted 11 lines
Quoted 3 lines
And if you have two kernels, one with which your device is dead after 1 hour and one with which your device is dead after 10 hours. Which would you prefer? I mean really... this is ridiculous.
It is absolutely not. If you want to keep power usage down, then implement real resource management in the scheduler. Suspend blockers are nothing but a clunky and ineffective means of resource allocation. As has been pointed out in this thread, there are much better ways of dealing with this problem.
- Ben
I think this has to be independently to the scheduler, because as soon as the user interacts with the phone, everything needs to be scheduled. even the stuff that doesn't directly interact with the user. as soon as _nothing_ interacts with the user, the phone does schedule _nothing_ anymore.
Cheers,
Flo
Quoted 17 lines · On Thu, 27 May 2010 22:09:37 -0400 Ben Gamari <[email protected]> wrote:
Quoted 3 lines · Florian Mickler
Because he is using a robust kernel that provides suspend blockers and is preventing the vampire from sucking power?
Suspend blockers are only a flawed and indirect way to keep the vampire from sucking.
Quoted 6 lines
Most users don't even grasp the simple concept of different "programs". They just have a device and click here and there and are happy.
Really, what are you getting at? Do you deny that there are programs, that prevent a device from sleeping? (Just think of the bouncing cows app)
Quoted 7 lines
He's getting at the fact that there are much better ways to deal with this problem. The issue here is that we seem to be expected to swallow whatever Google throws at us, regardless of the quality of the solution. It seems like the best argument we have for merging is "we couldn't think of anything better and we need it yesterday." This might be a good enough reason for shipping, but it certainly doesn't satisfy the requirements for merging.
I don't disagree on the quality. But I don't think it is because of the patches, but because of how the kernel is architectured in that area (suspend not being an idle state).
Look, probably suspend needs to be integrated into the idle states and used from there. I could imagine a cost-specification for idle states:
c3
cost-to-transition-to-this-state: X
powersavings-per-time: Y
expected time we stay in this state: relative short, there is a timer sheduled
suspend-blockers: ignored
suspend
cost-to-transition-to-this-state: depends, how much drivers to suspend, how much processes to freeze, ...
powersavings-per-time: Y
expected time we stay in this state: long, independent of sheduled timers
suspend-blockers: need not be activated
Now, a governor could compute if it is ok, to enter suspend or only wait for idle-c3. And maybe it would never transition from idle-c3 to suspend but only from c1. because the cost to enter suspend would mean it just has to go to c1 anyway.
what do ya think?
Quoted 11 lines
Quoted 3 lines
And if you have two kernels, one with which your device is dead after 1 hour and one with which your device is dead after 10 hours. Which would you prefer? I mean really... this is ridiculous.
It is absolutely not. If you want to keep power usage down, then implement real resource management in the scheduler. Suspend blockers are nothing but a clunky and ineffective means of resource allocation. As has been pointed out in this thread, there are much better ways of dealing with this problem.
- Ben
I think this has to be independently to the scheduler, because as soon as the user interacts with the phone, everything needs to be scheduled. even the stuff that doesn't directly interact with the user. as soon as _nothing_ interacts with the user, the phone does schedule _nothing_ anymore.
Cheers,
Flo
Quoted 3 lines · Florian Mickler
Because he is using a robust kernel that provides suspend blockers and is preventing the vampire from sucking power?
Suspend blockers are only a flawed and indirect way to keep the vampire from sucking.
Quoted 6 lines
Most users don't even grasp the simple concept of different "programs". They just have a device and click here and there and are happy.
Really, what are you getting at? Do you deny that there are programs, that prevent a device from sleeping? (Just think of the bouncing cows app)
He's getting at the fact that there are much better ways to deal with this problem. The issue here is that we seem to be expected to swallow whatever Google throws at us, regardless of the quality of the solution. It seems like the best argument we have for merging is "we couldn't think of anything better and we need it yesterday." This might be a good enough reason for shipping, but it certainly doesn't satisfy the requirements for merging.
Quoted 4 lines
And if you have two kernels, one with which your device is dead after 1 hour and one with which your device is dead after 10 hours. Which would you prefer? I mean really... this is ridiculous.
It is absolutely not. If you want to keep power usage down, then implement real resource management in the scheduler. Suspend blockers are nothing but a clunky and ineffective means of resource allocation. As has been pointed out in this thread, there are much better ways of dealing with this problem.
- Ben
Quoted 14 lines · On Wed, 26 May 2010 13:18:51 +0200 Vitaly Wool <[email protected]> wrote:
Quoted 11 lines · Florian Mickler
Quoted 2 lines
So why again was this such a great scheme? Go fix your userspace to not not run when not needed.
Hi Peter!
This was already mentioned in one of these threads.
The summary is: The device this kernel is running on dosn't want to (or can) rely on userspace to save power. This is because it is an open system, without an app-store or the like. Everyone can run what he wants.
Quoted 5 lines
I don't see this as a valid point. Everyone can run a different kernel where nothing will just work. Are you aiming protection against that as well?
~Vitaly
This is not "protection". This is functioning properly in a real world scenario. Why would the user change the kernel, if the device would be buggy after that? (Except maybe he is a geek)
Cheers,
Flo
Quoted 11 lines · Florian Mickler
Quoted 2 lines
So why again was this such a great scheme? Go fix your userspace to not not run when not needed.
Hi Peter!
This was already mentioned in one of these threads.
The summary is: The device this kernel is running on dosn't want to (or can) rely on userspace to save power. This is because it is an open system, without an app-store or the like. Everyone can run what he wants.
I don't see this as a valid point. Everyone can run a different kernel where nothing will just work. Are you aiming protection against that as well?
~Vitaly
2010/5/26 Peter Zijlstra <[email protected]>:
Quoted 14 lines · Arve Hjønnevåg
Quoted 13 lines · Peter Zijlstra
Quoted 11 lines · Rafael J. Wysocki
Quoted 6 lines
Quoted 3 lines
This of course will lead to a scattering of suspend blockers into any
drivers/subsystemsconsidered "useful", which by looking through current Android kernels is many of them.That depends on the maintainers of these subsystems, who still have the power to reject requested changes.
So as a scheduler maintainer I'm going to merge a patch that does a
suspend_blockerwhen the runqueue's aren't empty... how about that?
Quoted 7 lines
Quoted 3 lines
I don't know if you are serious, since the all the runqueues are never empty while suspending, this would disable opportunistic suspend altogether.
So why again was this such a great scheme? Go fix your userspace to not not run when not needed.
I was not talking about our user-space code. Suspend has to be called by a running thread, so at least one runqueue is not empty.
Signature · 1 line
Arve Hjønnevåg
Quoted 2 lines · Arve Hjønnevåg
I was not talking about our user-space code. Suspend has to be called by a running thread, so at least one runqueue is not empty.
But why would you need to suspend if the machine is fully idle?
Is it because you're using broken hardware that has lower power consumption in suspend state as in idle?
Couldn't you make the runtime-pm smarter and utilize the suspend states?
2010/5/26 Peter Zijlstra <[email protected]>:
Quoted 7 lines · Arve Hjønnevåg
Quoted 3 lines
I was not talking about our user-space code. Suspend has to be called by a running thread, so at least one runqueue is not empty.
But why would you need to suspend if the machine is fully idle?
I have never seen a system that is fully idle for hours or even minutes.
Quoted 3 lines
Is it because you're using broken hardware that has lower power consumption in suspend state as in idle?
Initially, yes, but for shipping android phones, no.
Quoted 2 lines
Couldn't you make the runtime-pm smarter and utilize the suspend states?
I don't think runtime-pm is relevant here. We don't use suspend to power down devices that are not in use, we use suspend to enter system power states that we cannot enter from idle, and on systems where the same power state can be used from idle and suspend, we use suspend so we can stay in the low power state for minutes to hours instead of milliseconds to seconds.
Signature · 1 line
Arve Hjønnevåg
2010/5/26 Peter Zijlstra <[email protected]>:
Quoted 7 lines · Arve Hjønnevåg
Quoted 3 lines
I was not talking about our user-space code. Suspend has to be called by a running thread, so at least one runqueue is not empty.
But why would you need to suspend if the machine is fully idle?
I have never seen a system that is fully idle for hours or even minutes.
Quoted 3 lines
Is it because you're using broken hardware that has lower power consumption in suspend state as in idle?
Initially, yes, but for shipping android phones, no.
Quoted 2 lines
Couldn't you make the runtime-pm smarter and utilize the suspend states?
I don't think runtime-pm is relevant here. We don't use suspend to power down devices that are not in use, we use suspend to enter system power states that we cannot enter from idle, and on systems where the same power state can be used from idle and suspend, we use suspend so we can stay in the low power state for minutes to hours instead of milliseconds to seconds.
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 4 lines · Arve Hjønnevåg
and on systems where the
same power state can be used from idle and suspend, we use suspend so we can stay in the low power state for minutes to hours instead of milliseconds to seconds.
So don't you think working on making it possible for systems to be idle _that_ long would improve things for everybody? as opposed to this auto-suspend which only improves matters for those that (can) use it?
Quoted 10 lines · Peter Zijlstra
Quoted 4 lines · Arve Hjønnevåg
and on systems where the
same power state can be used from idle and suspend, we use suspend so we can stay in the low power state for minutes to hours instead of milliseconds to seconds.So don't you think working on making it possible for systems to be idle _that_ long would improve things for everybody? as opposed to this auto-suspend which only improves matters for those that (can) use it?
As we've stated a number of times in the several weeks of discussion (this time around) of this patchset, we are all in favor of improving runtime pm, finding and resolving issues that prevent idle, and heading toward ever lower power states in idle -- after all, this benefits our battery life in the cases when the system is not suspended as well as moving us closer to a future where the power savings between actively entering suspend and not doing so approach zero. Aggressively entering the lowest possible power state at all times is our goal here.
At the moment, the power savings from opportunistic suspend do directly lead to improved battery life, and there are some advantages to this model in the face of a non-optimal userspace (as we encounter in a world where there are not restrictions on what applications users may install and run).
Brian
Quoted 10 lines · Peter Zijlstra
Quoted 4 lines · Arve Hjønnevåg
and on systems where the
same power state can be used from idle and suspend, we use suspend so we can stay in the low power state for minutes to hours instead of milliseconds to seconds.So don't you think working on making it possible for systems to be idle _that_ long would improve things for everybody? as opposed to this auto-suspend which only improves matters for those that (can) use it?
As we've stated a number of times in the several weeks of discussion (this time around) of this patchset, we are all in favor of improving runtime pm, finding and resolving issues that prevent idle, and heading toward ever lower power states in idle -- after all, this benefits our battery life in the cases when the system is not suspended as well as moving us closer to a future where the power savings between actively entering suspend and not doing so approach zero. Aggressively entering the lowest possible power state at all times is our goal here.
At the moment, the power savings from opportunistic suspend do directly lead to improved battery life, and there are some advantages to this model in the face of a non-optimal userspace (as we encounter in a world where there are not restrictions on what applications users may install and run).
Brian
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
2010/5/26 Peter Zijlstra <[email protected]>:
Quoted 10 lines · Arve Hjønnevåg
Quoted 5 lines
and on systems where the
same power state can be used from idle and suspend, we use suspend so we can stay in the low power state for minutes to hours instead of milliseconds to seconds.So don't you think working on making it possible for systems to be idle _that_ long would improve things for everybody? as opposed to this auto-suspend which only improves matters for those that (can) use it?
I'm not preventing anyone from working on improving this. Currently both the kernel and our user-space code polls way too much. I don't think it is reasonable to demand that no one should run any user-space code with periodic timers when we have not even fixed the kernel to not do this.
Signature · 1 line
Arve Hjønnevåg
Quoted 12 lines · Arve Hjønnevåg
2010/5/26 Peter Zijlstra <[email protected]>:
Quoted 10 lines · Arve Hjønnevåg
Quoted 5 lines
and on systems where the
same power state can be used from idle and suspend, we use suspend so we can stay in the low power state for minutes to hours instead of milliseconds to seconds.So don't you think working on making it possible for systems to be idle _that_ long would improve things for everybody? as opposed to this auto-suspend which only improves matters for those that (can) use it?
Quoted 5 lines
I'm not preventing anyone from working on improving this. Currently both the kernel and our user-space code polls way too much. I don't think it is reasonable to demand that no one should run any user-space code with periodic timers when we have not even fixed the kernel to not do this.
All I'm saying is that merging a stop-gap measure will decrease the urgency and thus the time spend fixing the actual issues while adding the burden of maintaining this stop-gap measure.
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 12 lines · Arve Hjønnevåg
2010/5/26 Peter Zijlstra <[email protected]>:
Quoted 10 lines · Arve Hjønnevåg
Quoted 5 lines
and on systems where the
same power state can be used from idle and suspend, we use suspend so we can stay in the low power state for minutes to hours instead of milliseconds to seconds.So don't you think working on making it possible for systems to be idle _that_ long would improve things for everybody? as opposed to this auto-suspend which only improves matters for those that (can) use it?
Quoted 5 lines
I'm not preventing anyone from working on improving this. Currently both the kernel and our user-space code polls way too much. I don't think it is reasonable to demand that no one should run any user-space code with periodic timers when we have not even fixed the kernel to not do this.
All I'm saying is that merging a stop-gap measure will decrease the urgency and thus the time spend fixing the actual issues while adding the burden of maintaining this stop-gap measure.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
2010/5/26 Peter Zijlstra <[email protected]>:
Quoted 19 lines · Arve Hjønnevåg
Quoted 12 lines
2010/5/26 Peter Zijlstra <[email protected]>:
Quoted 10 lines · Arve Hjønnevåg
Quoted 5 lines
and on systems where the
same power state can be used from idle and suspend, we use suspend so we can stay in the low power state for minutes to hours instead of milliseconds to seconds.So don't you think working on making it possible for systems to be idle _that_ long would improve things for everybody? as opposed to this auto-suspend which only improves matters for those that (can) use it?
Quoted 5 lines
I'm not preventing anyone from working on improving this. Currently both the kernel and our user-space code polls way too much. I don't think it is reasonable to demand that no one should run any user-space code with periodic timers when we have not even fixed the kernel to not do this.
Quoted 4 lines
All I'm saying is that merging a stop-gap measure will decrease the urgency and thus the time spend fixing the actual issues while adding the burden of maintaining this stop-gap measure.
Fixing the actually issue means fixing all user-space code, and replacing most x86 hardware. I don't think keeping this feature out of the kernel will significantly accelerate this.
Signature · 1 line
Arve Hjønnevåg
Quoted 20 lines · Arve Hjønnevåg
2010/5/26 Peter Zijlstra <[email protected]>:
Quoted 19 lines · Arve Hjønnevåg
Quoted 17 lines
2010/5/26 Peter Zijlstra <[email protected]>:
Quoted 10 lines · Arve Hjønnevåg
Quoted 5 lines
and on systems where the
same power state can be used from idle and suspend, we use suspend so we can stay in the low power state for minutes to hours instead of milliseconds to seconds.So don't you think working on making it possible for systems to be idle _that_ long would improve things for everybody? as opposed to this auto-suspend which only improves matters for those that (can) use it?
I'm not preventing anyone from working on improving this. Currently both the kernel and our user-space code polls way too much. I don't think it is reasonable to demand that no one should run any user-space code with periodic timers when we have not even fixed the kernel to not do this.
Quoted 8 lines
Quoted 4 lines
All I'm saying is that merging a stop-gap measure will decrease the urgency and thus the time spend fixing the actual issues while adding the burden of maintaining this stop-gap measure.
Fixing the actually issue means fixing all user-space code, and replacing most x86 hardware. I don't think keeping this feature out of the kernel will significantly accelerate this.
I don't think x86 is relevant anyway, it doesn't suspend/resume anywhere near fast enough for this to be usable.
My laptop still takes several seconds to suspend (Lenovo T500), and resume (aside from some userspace bustage) takes the same amount of time. That is quick enough for manual suspend, but I'd hate it to try and auto-suspend.
Getting longer idle periods however is something that everybody benefits from. On x86 we're nowhere close to hitting the max idle time of the platform, you get _tons_ of wakeups on current 'desktop' software.
But x86 being a PITA shouldn't stop people from working on this, there's plenty other architectures out there, I remember fixing a NO_HZ bug with davem on sparc64 because his niagra had cores idling for very long times indeed.
So yes, I do think merging this will delay the effort in fixing userspace, simply because all the mobile/embedded folks don't care about it anymore.
Quoted 2 lines
I don't think x86 is relevant anyway, it doesn't suspend/resume anywhere near fast enough for this to be usable.
Yet...
Quoted 4 lines
My laptop still takes several seconds to suspend (Lenovo T500), and resume (aside from some userspace bustage) takes the same amount of time. That is quick enough for manual suspend, but I'd hate it to try and auto-suspend.
This is an area where machines are improving and where the ability to do stuff like autosuspend, the technology like the OLPC screen and so on create an incentive for the BIOS and platform people to improve their bits of it.
Quoted 3 lines
So yes, I do think merging this will delay the effort in fixing userspace, simply because all the mobile/embedded folks don't care about it anymore.
The mobile space probably doesn't care too much about many of the large bloated desktop apps anyway and traditional embedded generally has a very small fixed application set where the optimise both halves of the system together.
Alan
Quoted 4 lines · Alan Cox
This is an area where machines are improving and where the ability to do stuff like autosuspend, the technology like the OLPC screen and so on create an incentive for the BIOS and platform people to improve their bits of it.
But do you think its a sensible thing to do? Explicitly not running runnable tasks just sounds wrong. Also, at the extreme end, super fast suspend is basically an efficient idle mode.
Why would the code holding suspend blockers be any more or less important than any other piece of runnable code.
In fact, having runnable but non suspend blocking tasks around will delay the completion of the suspend blocker, so will we start removing those?
This whole thing introduces an artificial segregation of code. My 'cool' code is more important than your 'uncool' code. Without a clear definition of what makes code cool or not.
Quoted 8 lines
Quoted 3 lines
So yes, I do think merging this will delay the effort in fixing userspace, simply because all the mobile/embedded folks don't care about it anymore.
The mobile space probably doesn't care too much about many of the large bloated desktop apps anyway and traditional embedded generally has a very small fixed application set where the optimise both halves of the system together.
Sure, but at least we share the kernel. It was said that the kernel generates too many wakeups (and iwlagn certainly is the top most waker on my laptop). Improvements to the kernel will benefit all, regardless of whatever userspace we run.
Quoted 4 lines · Alan Cox
This is an area where machines are improving and where the ability to do stuff like autosuspend, the technology like the OLPC screen and so on create an incentive for the BIOS and platform people to improve their bits of it.
But do you think its a sensible thing to do? Explicitly not running runnable tasks just sounds wrong. Also, at the extreme end, super fast suspend is basically an efficient idle mode.
Why would the code holding suspend blockers be any more or less important than any other piece of runnable code.
In fact, having runnable but non suspend blocking tasks around will delay the completion of the suspend blocker, so will we start removing those?
This whole thing introduces an artificial segregation of code. My 'cool' code is more important than your 'uncool' code. Without a clear definition of what makes code cool or not.
Quoted 8 lines
Quoted 3 lines
So yes, I do think merging this will delay the effort in fixing userspace, simply because all the mobile/embedded folks don't care about it anymore.
The mobile space probably doesn't care too much about many of the large bloated desktop apps anyway and traditional embedded generally has a very small fixed application set where the optimise both halves of the system together.
Sure, but at least we share the kernel. It was said that the kernel generates too many wakeups (and iwlagn certainly is the top most waker on my laptop). Improvements to the kernel will benefit all, regardless of whatever userspace we run.
Quoted 8 lines · Peter Zijlstra
Quoted 4 lines · Alan Cox
This is an area where machines are improving and where the ability to do stuff like autosuspend, the technology like the OLPC screen and so on create an incentive for the BIOS and platform people to improve their bits of it.
But do you think its a sensible thing to do? Explicitly not running runnable tasks just sounds wrong.
[...]
Quoted 2 lines
Why would the code holding suspend blockers be any more or less important than any other piece of runnable code.
With my userspace developer hat on, I'd *kill* for a way to tell the kernel that there are more important things for the system to be doing than executing my runnable task. In some cases, the set of "more important things" the system might include running other tasks, but it also might include conserving power. I'd like to have my program tell the kernel things like "wake me up in 0.1 seconds, plus or minus a year if you have something better to do."
With my sysadmin hat on (which is nearly identical to my phone owner hat, BTW), I'd like whatever syscall implements those features to take a PID argument, so I can impose my importance decisions on other processes. I'd also like to set the relative importance of keeping the CPU idle on the same scale, so that I could raise or lower the importance of keeping the CPU idle as power availability changes.
Quoted 3 lines
This whole thing introduces an artificial segregation of code. My 'cool' code is more important than your 'uncool' code. Without a clear definition of what makes code cool or not.
It's impossible in the general case for an application to know whether it's important or not, so it's also impossible for the kernel to derive this information from the application's behavior--and impossible, in the general case, to decide whether the application is more important than the battery or some other scarce resource the kernel might also be managing (e.g. if the machine is running hot, heat dissipation might be scarce, and we'd want to be idle then too). This is similar to niceness and SCHED_RR/FIFO: there's no way for the kernel to automatically assign those values either, they have to be specified by a user or administrator. Of course, programs are free--within limits--to specify these values about themselves.
Consider a traditional Unix program like "sort". Seriously, how is "sort" supposed to know that it's the most important application on the system (because I need my contacts list alphabetized *now*), or the least (because the screensaver needs to know which is the oldest graphics hack in the list)?
"sort" gets invoked from a shell, cooperating with other processes to do its work. It knows very little about the context in which it is executing (nor should it). Should "sort" sprout command-line arguments for every possible scheduling latency and power management policy option, or should "sort" not care, and defer such decisions to other command-line tools which set these options before exec()ing "sort", or to a management utility like "top" that implements policy across the entire system?
Quoted 8 lines · Peter Zijlstra
Quoted 4 lines · Alan Cox
This is an area where machines are improving and where the ability to do stuff like autosuspend, the technology like the OLPC screen and so on create an incentive for the BIOS and platform people to improve their bits of it.
But do you think its a sensible thing to do? Explicitly not running runnable tasks just sounds wrong.
[...]
Quoted 2 lines
Why would the code holding suspend blockers be any more or less important than any other piece of runnable code.
With my userspace developer hat on, I'd *kill* for a way to tell the kernel that there are more important things for the system to be doing than executing my runnable task. In some cases, the set of "more important things" the system might include running other tasks, but it also might include conserving power. I'd like to have my program tell the kernel things like "wake me up in 0.1 seconds, plus or minus a year if you have something better to do."
With my sysadmin hat on (which is nearly identical to my phone owner hat, BTW), I'd like whatever syscall implements those features to take a PID argument, so I can impose my importance decisions on other processes. I'd also like to set the relative importance of keeping the CPU idle on the same scale, so that I could raise or lower the importance of keeping the CPU idle as power availability changes.
Quoted 3 lines
This whole thing introduces an artificial segregation of code. My 'cool' code is more important than your 'uncool' code. Without a clear definition of what makes code cool or not.
It's impossible in the general case for an application to know whether it's important or not, so it's also impossible for the kernel to derive this information from the application's behavior--and impossible, in the general case, to decide whether the application is more important than the battery or some other scarce resource the kernel might also be managing (e.g. if the machine is running hot, heat dissipation might be scarce, and we'd want to be idle then too). This is similar to niceness and SCHED_RR/FIFO: there's no way for the kernel to automatically assign those values either, they have to be specified by a user or administrator. Of course, programs are free--within limits--to specify these values about themselves.
Consider a traditional Unix program like "sort". Seriously, how is "sort" supposed to know that it's the most important application on the system (because I need my contacts list alphabetized *now*), or the least (because the screensaver needs to know which is the oldest graphics hack in the list)?
"sort" gets invoked from a shell, cooperating with other processes to do its work. It knows very little about the context in which it is executing (nor should it). Should "sort" sprout command-line arguments for every possible scheduling latency and power management policy option, or should "sort" not care, and defer such decisions to other command-line tools which set these options before exec()ing "sort", or to a management utility like "top" that implements policy across the entire system?
2010/5/26 Peter Zijlstra <[email protected]>:
Quoted 26 lines · Arve Hjønnevåg
Quoted 25 lines
2010/5/26 Peter Zijlstra <[email protected]>:
Quoted 23 lines · Arve Hjønnevåg
Quoted 12 lines
2010/5/26 Peter Zijlstra <[email protected]>:
Quoted 10 lines · Arve Hjønnevåg
Quoted 5 lines
and on systems where the
same power state can be used from idle and suspend, we use suspend so we can stay in the low power state for minutes to hours instead of milliseconds to seconds.So don't you think working on making it possible for systems to be idle _that_ long would improve things for everybody? as opposed to this auto-suspend which only improves matters for those that (can) use it?
Quoted 5 lines
I'm not preventing anyone from working on improving this. Currently both the kernel and our user-space code polls way too much. I don't think it is reasonable to demand that no one should run any user-space code with periodic timers when we have not even fixed the kernel to not do this.
All I'm saying is that merging a stop-gap measure will decrease the urgency and thus the time spend fixing the actual issues while adding the burden of maintaining this stop-gap measure.
Quoted 6 lines
Quoted 3 lines
Fixing the actually issue means fixing all user-space code, and replacing most x86 hardware. I don't think keeping this feature out of the kernel will significantly accelerate this.
I don't think x86 is relevant anyway, it doesn't suspend/resume anywhere near fast enough for this to be usable.
x86 systems already auto-suspend.
Quoted 6 lines
My laptop still takes several seconds to suspend (Lenovo T500), and resume (aside from some userspace bustage) takes the same amount of time. That is quick enough for manual suspend, but I'd hate it to try and auto-suspend.
Why? If your suspend is currently set to sleep after 30 minutes of inactivity, you can still have the same setting with opportunistic suspend. With opportunistic suspend you can have an alarm set to run a task at a specific time without risking that this task does not run at that time just because your inactivity timer expired at the same time as the alarm went off.
Quoted 4 lines
Getting longer idle periods however is something that everybody benefits from. On x86 we're nowhere close to hitting the max idle time of the platform, you get _tons_ of wakeups on current 'desktop' software.
Quoted 9 lines
But x86 being a PITA shouldn't stop people from working on this, there's plenty other architectures out there, I remember fixing a
NO_HZbug with davem on sparc64 because his niagra had cores idling for very long times indeed.So yes, I do think merging this will delay the effort in fixing userspace, simply because all the mobile/embedded folks don't care about it anymore.
To me this is not a good argument for not merging the code. If people stop caring about the problem if this feature is merged that means it solved a problem for them. You want to prevent merging a feature _because_ it solves a problem.
Signature · 1 line
Arve Hjønnevåg
2010/5/26 Peter Zijlstra <[email protected]>:
Quoted 26 lines · Arve Hjønnevåg
Quoted 25 lines
2010/5/26 Peter Zijlstra <[email protected]>:
Quoted 23 lines · Arve Hjønnevåg
Quoted 12 lines
2010/5/26 Peter Zijlstra <[email protected]>:
Quoted 10 lines · Arve Hjønnevåg
Quoted 5 lines
and on systems where the
same power state can be used from idle and suspend, we use suspend so we can stay in the low power state for minutes to hours instead of milliseconds to seconds.So don't you think working on making it possible for systems to be idle _that_ long would improve things for everybody? as opposed to this auto-suspend which only improves matters for those that (can) use it?
Quoted 5 lines
I'm not preventing anyone from working on improving this. Currently both the kernel and our user-space code polls way too much. I don't think it is reasonable to demand that no one should run any user-space code with periodic timers when we have not even fixed the kernel to not do this.
All I'm saying is that merging a stop-gap measure will decrease the urgency and thus the time spend fixing the actual issues while adding the burden of maintaining this stop-gap measure.
Quoted 6 lines
Quoted 3 lines
Fixing the actually issue means fixing all user-space code, and replacing most x86 hardware. I don't think keeping this feature out of the kernel will significantly accelerate this.
I don't think x86 is relevant anyway, it doesn't suspend/resume anywhere near fast enough for this to be usable.
x86 systems already auto-suspend.
Quoted 6 lines
My laptop still takes several seconds to suspend (Lenovo T500), and resume (aside from some userspace bustage) takes the same amount of time. That is quick enough for manual suspend, but I'd hate it to try and auto-suspend.
Why? If your suspend is currently set to sleep after 30 minutes of inactivity, you can still have the same setting with opportunistic suspend. With opportunistic suspend you can have an alarm set to run a task at a specific time without risking that this task does not run at that time just because your inactivity timer expired at the same time as the alarm went off.
Quoted 4 lines
Getting longer idle periods however is something that everybody benefits from. On x86 we're nowhere close to hitting the max idle time of the platform, you get _tons_ of wakeups on current 'desktop' software.
Quoted 9 lines
But x86 being a PITA shouldn't stop people from working on this, there's plenty other architectures out there, I remember fixing a
NO_HZbug with davem on sparc64 because his niagra had cores idling for very long times indeed.So yes, I do think merging this will delay the effort in fixing userspace, simply because all the mobile/embedded folks don't care about it anymore.
To me this is not a good argument for not merging the code. If people stop caring about the problem if this feature is merged that means it solved a problem for them. You want to prevent merging a feature _because_ it solves a problem.
Signature · 1 line
Arve Hjønnevåg
Quoted 20 lines · Arve Hjønnevåg
2010/5/26 Peter Zijlstra <[email protected]>:
Quoted 19 lines · Arve Hjønnevåg
Quoted 17 lines
2010/5/26 Peter Zijlstra <[email protected]>:
Quoted 10 lines · Arve Hjønnevåg
Quoted 5 lines
and on systems where the
same power state can be used from idle and suspend, we use suspend so we can stay in the low power state for minutes to hours instead of milliseconds to seconds.So don't you think working on making it possible for systems to be idle _that_ long would improve things for everybody? as opposed to this auto-suspend which only improves matters for those that (can) use it?
I'm not preventing anyone from working on improving this. Currently both the kernel and our user-space code polls way too much. I don't think it is reasonable to demand that no one should run any user-space code with periodic timers when we have not even fixed the kernel to not do this.
Quoted 8 lines
Quoted 4 lines
All I'm saying is that merging a stop-gap measure will decrease the urgency and thus the time spend fixing the actual issues while adding the burden of maintaining this stop-gap measure.
Fixing the actually issue means fixing all user-space code, and replacing most x86 hardware. I don't think keeping this feature out of the kernel will significantly accelerate this.
I don't think x86 is relevant anyway, it doesn't suspend/resume anywhere near fast enough for this to be usable.
My laptop still takes several seconds to suspend (Lenovo T500), and resume (aside from some userspace bustage) takes the same amount of time. That is quick enough for manual suspend, but I'd hate it to try and auto-suspend.
Getting longer idle periods however is something that everybody benefits from. On x86 we're nowhere close to hitting the max idle time of the platform, you get _tons_ of wakeups on current 'desktop' software.
But x86 being a PITA shouldn't stop people from working on this, there's plenty other architectures out there, I remember fixing a NO_HZ bug with davem on sparc64 because his niagra had cores idling for very long times indeed.
So yes, I do think merging this will delay the effort in fixing userspace, simply because all the mobile/embedded folks don't care about it anymore.
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
2010/5/26 Arve Hjønnevåg <[email protected]>:
Quoted 3 lines
Fixing the actually issue means fixing all user-space code, and replacing most x86 hardware. I don't think keeping this feature out of the kernel will significantly accelerate this.
But if this feature gets merged, I bet you'll find another 100 reasons to not fix the actual issue. I wouldn't say so if you haven't provided the irrelevant points already, like "replacing x86 hardware". You're trying to merge the approach which makes the bad way of handing things the easiest way. This shouldn't get in as it is IMO.
~Vitaly
2010/5/26 Arve Hjønnevåg <[email protected]>:
Quoted 3 lines
Fixing the actually issue means fixing all user-space code, and replacing most x86 hardware. I don't think keeping this feature out of the kernel will significantly accelerate this.
But if this feature gets merged, I bet you'll find another 100 reasons to not fix the actual issue. I wouldn't say so if you haven't provided the irrelevant points already, like "replacing x86 hardware". You're trying to merge the approach which makes the bad way of handing things the easiest way. This shouldn't get in as it is IMO.
~Vitaly
2010/5/26 Peter Zijlstra <[email protected]>:
Quoted 19 lines · Arve Hjønnevåg
Quoted 12 lines
2010/5/26 Peter Zijlstra <[email protected]>:
Quoted 10 lines · Arve Hjønnevåg
Quoted 5 lines
and on systems where the
same power state can be used from idle and suspend, we use suspend so we can stay in the low power state for minutes to hours instead of milliseconds to seconds.So don't you think working on making it possible for systems to be idle _that_ long would improve things for everybody? as opposed to this auto-suspend which only improves matters for those that (can) use it?
Quoted 5 lines
I'm not preventing anyone from working on improving this. Currently both the kernel and our user-space code polls way too much. I don't think it is reasonable to demand that no one should run any user-space code with periodic timers when we have not even fixed the kernel to not do this.
Quoted 4 lines
All I'm saying is that merging a stop-gap measure will decrease the urgency and thus the time spend fixing the actual issues while adding the burden of maintaining this stop-gap measure.
Fixing the actually issue means fixing all user-space code, and replacing most x86 hardware. I don't think keeping this feature out of the kernel will significantly accelerate this.
Signature · 1 line
Arve Hjønnevåg
2010/5/26 Peter Zijlstra <[email protected]>:
Quoted 10 lines · Arve Hjønnevåg
Quoted 5 lines
and on systems where the
same power state can be used from idle and suspend, we use suspend so we can stay in the low power state for minutes to hours instead of milliseconds to seconds.So don't you think working on making it possible for systems to be idle _that_ long would improve things for everybody? as opposed to this auto-suspend which only improves matters for those that (can) use it?
I'm not preventing anyone from working on improving this. Currently both the kernel and our user-space code polls way too much. I don't think it is reasonable to demand that no one should run any user-space code with periodic timers when we have not even fixed the kernel to not do this.
Signature · 1 line
Arve Hjønnevåg
Quoted 4 lines · Arve Hjønnevåg
and on systems where the
same power state can be used from idle and suspend, we use suspend so we can stay in the low power state for minutes to hours instead of milliseconds to seconds.
So don't you think working on making it possible for systems to be idle _that_ long would improve things for everybody? as opposed to this auto-suspend which only improves matters for those that (can) use it?
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 2 lines · Arve Hjønnevåg
I was not talking about our user-space code. Suspend has to be called by a running thread, so at least one runqueue is not empty.
But why would you need to suspend if the machine is fully idle?
Is it because you're using broken hardware that has lower power consumption in suspend state as in idle?
Couldn't you make the runtime-pm smarter and utilize the suspend states?
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
2010/5/26 Peter Zijlstra <[email protected]>:
Quoted 14 lines · Arve Hjønnevåg
Quoted 13 lines · Peter Zijlstra
Quoted 11 lines · Rafael J. Wysocki
Quoted 6 lines
Quoted 3 lines
This of course will lead to a scattering of suspend blockers into any
drivers/subsystemsconsidered "useful", which by looking through current Android kernels is many of them.That depends on the maintainers of these subsystems, who still have the power to reject requested changes.
So as a scheduler maintainer I'm going to merge a patch that does a
suspend_blockerwhen the runqueue's aren't empty... how about that?
Quoted 7 lines
Quoted 3 lines
I don't know if you are serious, since the all the runqueues are never empty while suspending, this would disable opportunistic suspend altogether.
So why again was this such a great scheme? Go fix your userspace to not not run when not needed.
I was not talking about our user-space code. Suspend has to be called by a running thread, so at least one runqueue is not empty.
Signature · 1 line
Arve Hjønnevåg
Quoted 6 lines · Rafael J. Wysocki
Quoted 3 lines
This of course will lead to a scattering of suspend blockers into any
drivers/subsystemsconsidered "useful", which by looking through current Android kernels is many of them.That depends on the maintainers of these subsystems, who still have the power to reject requested changes.
So as a scheduler maintainer I'm going to merge a patch that does a suspend_blocker when the runqueue's aren't empty... how about that?
Quoted 33 lines · Kevin Hilman
Quoted 14 lines · Rafael J. Wysocki
Quoted 7 lines · Felipe Balbi
Quoted 6 lines · ext Rafael J. Wysocki
Quoted 4 lines · Arve Hjønnevåg
This patch series adds a suspend-block api that provides the same functionality as the android wakelock api. This version adds a delay before suspending again if no suspend blockers were used during the last suspend attempt.
Quoted 5 lines
Quoted 1 line
Patches [1-6/8] applied to suspend-2.6/linux-next
funny thing is that even without sorting out the concerns plenty of developers had on the other thread, this series is still taken. What's the point in dicussing/reviewing the patches then ?
Quoted 6 lines
I don't think the concerns you're referring to can be solved out. Some people just don't like the whole idea and I don't think there's any way we can improve the patches to make them happy. The only "solution" they would be satisfied with would simply be rejecting the feature altogether, although there are no practically viable alternatives known to me.
I'm not sure who the "some people" you're referring to are, but I'll assume I'm included in that group.
I don't think this is a fair characterization of the objections, nor do I think "rejecting the feature altogether" is the only satisfactory answer. Speaking for myself, I find the idea of being able to suspend while idle a valid objective, and certainly see the usefulness of it for embedded systems. I'm also an owner and user of an Android phone, so I am certainly not out just to make life difficult for Android.
Quoted 5 lines
The primary objection is not the end goal, but rather the implementation. In particular, the problematic redefintion of what it means to be idle, or "not doing work that's immediately useful to the user" to use the phrase from the changelog (where "useful" is still not defined.)
So, in fact, you don't like the _idea_, because the _idea_ is to use suspend blockers instead of trying to define what "idle" means.
I don't think it's generally possible to define "idle" to match every possible criteria one can imagine, so you're request to do that simply cannot be satisfied.
Quoted 3 lines
This (re)definition completely bypasses all current idle infrastructure based on timers, scheduler, etc. and makes "usefulness" defined in terms of who holds suspend blockers.
That's because the point is not to suspend when the system is "idle", because that would mean "suspend transparently from the applications' point of view", which is what the Android people _don't_ _want_ _to_ _do_, because in that case their battery life would go to the toilet. The idea is to suspend even when the system is not techincally "idle" and you don't like _that_.
Quoted 3 lines
This of course will lead to a scattering of suspend blockers into any
drivers/subsystemsconsidered "useful", which by looking through current Android kernels is many of them.
That depends on the maintainers of these subsystems, who still have the power to reject requested changes.
As I said before, I don't think there's a way to resolve this so that everyone is happy and in my opinion there are reasons to merge the feature.
Also I don't think we can make any progress discussing it. We've already discussed it for a month or so without any real progress and I don't see how that's going to change now.
Thanks,
Rafael
Quoted 14 lines · Rafael J. Wysocki
Quoted 7 lines · Felipe Balbi
Quoted 6 lines · ext Rafael J. Wysocki
Quoted 4 lines · Arve Hjønnevåg
This patch series adds a suspend-block api that provides the same functionality as the android wakelock api. This version adds a delay before suspending again if no suspend blockers were used during the last suspend attempt.
Quoted 5 lines
Quoted 1 line
Patches [1-6/8] applied to suspend-2.6/linux-next
funny thing is that even without sorting out the concerns plenty of developers had on the other thread, this series is still taken. What's the point in dicussing/reviewing the patches then ?
Quoted 6 lines
I don't think the concerns you're referring to can be solved out. Some people just don't like the whole idea and I don't think there's any way we can improve the patches to make them happy. The only "solution" they would be satisfied with would simply be rejecting the feature altogether, although there are no practically viable alternatives known to me.
I'm not sure who the "some people" you're referring to are, but I'll assume I'm included in that group.
I don't think this is a fair characterization of the objections, nor do I think "rejecting the feature altogether" is the only satisfactory answer. Speaking for myself, I find the idea of being able to suspend while idle a valid objective, and certainly see the usefulness of it for embedded systems. I'm also an owner and user of an Android phone, so I am certainly not out just to make life difficult for Android.
The primary objection is not the end goal, but rather the implementation. In particular, the problematic redefintion of what it means to be idle, or "not doing work that's immediately useful to the user" to use the phrase from the changelog (where "useful" is still not defined.)
This (re)definition completely bypasses all current idle infrastructure based on timers, scheduler, etc. and makes "usefulness" defined in terms of who holds suspend blockers. This of course will lead to a scattering of suspend blockers into any drivers/subsystems considered "useful", which by looking through current Android kernels is many of them.
Kevin
Quoted 7 lines · Felipe Balbi
Quoted 6 lines · ext Rafael J. Wysocki
Quoted 4 lines · Arve Hjønnevåg
This patch series adds a suspend-block api that provides the same functionality as the android wakelock api. This version adds a delay before suspending again if no suspend blockers were used during the last suspend attempt.
Quoted 5 lines
Quoted 1 line
Patches [1-6/8] applied to suspend-2.6/linux-next
funny thing is that even without sorting out the concerns plenty of developers had on the other thread, this series is still taken. What's the point in dicussing/reviewing the patches then ?
I don't think the concerns you're referring to can be solved out. Some people just don't like the whole idea and I don't think there's any way we can improve the patches to make them happy. The only "solution" they would be satisfied with would simply be rejecting the feature altogether, although there are no practically viable alternatives known to me.
OTOH I do think there are quite a few reasons to take the patchset, so I'm going to push it to Linus as I told in one of my replies to Kevin. If Linus decides not to pull it, so be it.
Thanks,
Rafael
Quoted 7 lines · Rafael J. Wysocki
Quoted 4 lines · Arve Hjønnevåg
This patch series adds a suspend-block api that provides the same functionality as the android wakelock api. This version adds a delay before suspending again if no suspend blockers were used during the last suspend attempt.
Patches [1-6/8] applied to suspend-2.6/linux-next
So you're going to merge this junk?
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 7 lines · Rafael J. Wysocki
Quoted 4 lines · Arve Hjønnevåg
This patch series adds a suspend-block api that provides the same functionality as the android wakelock api. This version adds a delay before suspending again if no suspend blockers were used during the last suspend attempt.
Patches [1-6/8] applied to suspend-2.6/linux-next
So you're going to merge this junk?
Quoted 12 lines · On Wed, 26 May 2010 10:45:33 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 7 lines · Rafael J. Wysocki
Quoted 4 lines · Arve Hjønnevåg
This patch series adds a suspend-block api that provides the same functionality as the android wakelock api. This version adds a delay before suspending again if no suspend blockers were used during the last suspend attempt.
Patches [1-6/8] applied to suspend-2.6/linux-next
So you're going to merge this junk?
Yes. By now, everyone reading the posts should know all points. Raffael obviously was part of this discussion and came to the decision to merge it.
My take of the discussion:
_IF_ you want to suspend aggressively, I don't see another way.
The thing is, this is a paradigm change. Suspend is not anymore controlled by userspace. In order to let userspace control/work with this scheme, it needs to know when a suspend will be successfull or poll:
1. kernel sees suspend may be possible on his side of things
2. kernel sends a message to userspace that i could be possibly possible to suspend, but it may well be that by the time userspace suspends it is not possible anymore
3. userspace decides to suspend.
<- system suspends... or not ..->
4. userspace retries ... retries ... retries ...
And then you have the whole can of worms and races.
Or you have the suspend-blocker scheme:
1. kernel sees suspend is possible.
2. kernel suspends.
3. bingo.
Cheers,
Flo
Quoted 12 lines · On Wed, 26 May 2010 10:45:33 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 7 lines · Rafael J. Wysocki
Quoted 4 lines · Arve Hjønnevåg
This patch series adds a suspend-block api that provides the same functionality as the android wakelock api. This version adds a delay before suspending again if no suspend blockers were used during the last suspend attempt.
Patches [1-6/8] applied to suspend-2.6/linux-next
So you're going to merge this junk?
Yes. By now, everyone reading the posts should know all points. Raffael obviously was part of this discussion and came to the decision to merge it.
My take of the discussion:
_IF_ you want to suspend aggressively, I don't see another way.
The thing is, this is a paradigm change. Suspend is not anymore controlled by userspace. In order to let userspace control/work with this scheme, it needs to know when a suspend will be successfull or poll:
1. kernel sees suspend may be possible on his side of things
2. kernel sends a message to userspace that i could be possibly possible to suspend, but it may well be that by the time userspace suspends it is not possible anymore
3. userspace decides to suspend.
<- system suspends... or not ..->
4. userspace retries ... retries ... retries ...
And then you have the whole can of worms and races.
Or you have the suspend-blocker scheme:
1. kernel sees suspend is possible.
2. kernel suspends.
3. bingo.
Cheers,
Flo
Quoted 35 lines · Florian Mickler
Quoted 12 lines · On Wed, 26 May 2010 10:45:33 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 7 lines · Rafael J. Wysocki
Quoted 4 lines · Arve Hjønnevåg
This patch series adds a suspend-block api that provides the same functionality as the android wakelock api. This version adds a delay before suspending again if no suspend blockers were used during the last suspend attempt.
Patches [1-6/8] applied to suspend-2.6/linux-next
So you're going to merge this junk?
Yes. By now, everyone reading the posts should know all points. Raffael obviously was part of this discussion and came to the decision to merge it.
My take of the discussion:
_IF_ you want to suspend aggressively, I don't see another way.The thing is, this is a paradigm change. Suspend is not anymore controlled by userspace. In order to let userspace control/work with this scheme, it needs to know when a suspend will be successfull or poll:
1. kernel sees suspend may be possible on his side of things
2. kernel sends a message to userspace that i could be possibly possible to suspend, but it may well be that by the time userspace suspends it is not possible anymore
Quoted 7 lines
3. userspace decides to suspend.
<- system suspends... or not ..->
4. userspace retries ... retries ... retries ...
And then you have the whole can of worms and races.
I don't see any races, nor retry loops.
There is always the race of an event arriving whilst in the process of suspending, that is not solved by either the kernel nor user part of suspend-blockers. The only thing is not to loose the event.
You simply have to deal with that, the suspend gets canceled, you do deal with the event, and suspend again. How does making that 'retry' as you call it happen from a kernel thread or from a userspace thread any difference?
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 35 lines · Florian Mickler
Quoted 12 lines · On Wed, 26 May 2010 10:45:33 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 7 lines · Rafael J. Wysocki
Quoted 4 lines · Arve Hjønnevåg
This patch series adds a suspend-block api that provides the same functionality as the android wakelock api. This version adds a delay before suspending again if no suspend blockers were used during the last suspend attempt.
Patches [1-6/8] applied to suspend-2.6/linux-next
So you're going to merge this junk?
Yes. By now, everyone reading the posts should know all points. Raffael obviously was part of this discussion and came to the decision to merge it.
My take of the discussion:
_IF_ you want to suspend aggressively, I don't see another way.The thing is, this is a paradigm change. Suspend is not anymore controlled by userspace. In order to let userspace control/work with this scheme, it needs to know when a suspend will be successfull or poll:
1. kernel sees suspend may be possible on his side of things
2. kernel sends a message to userspace that i could be possibly possible to suspend, but it may well be that by the time userspace suspends it is not possible anymore
Quoted 7 lines
3. userspace decides to suspend.
<- system suspends... or not ..->
4. userspace retries ... retries ... retries ...
And then you have the whole can of worms and races.
I don't see any races, nor retry loops.
There is always the race of an event arriving whilst in the process of suspending, that is not solved by either the kernel nor user part of suspend-blockers. The only thing is not to loose the event.
You simply have to deal with that, the suspend gets canceled, you do deal with the event, and suspend again. How does making that 'retry' as you call it happen from a kernel thread or from a userspace thread any difference?
Quoted 17 lines · On Wed, 26 May 2010 11:54:37 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 16 lines · Florian Mickler
_IF_ you want to suspend aggressively, I don't see another way.
The thing is, this is a paradigm change. Suspend is not anymore controlled by userspace. In order to let userspace control/work with this scheme, it needs to know when a suspend will be successfull or poll:
1. kernel sees suspend may be possible on his side of things
2. kernel sends a message to userspace that i could be possibly possible to suspend, but it may well be that by the time userspace suspends it is not possible anymore
3. userspace decides to suspend.
Quoted 7 lines
Quoted 5 lines
<- system suspends... or not ..->
4. userspace retries ... retries ... retries ...
And then you have the whole can of worms and races.
I don't see any races, nor retry loops.
What about the worms? :)
I referred to retrying steps 1 through 3 as being the loop.
Quoted 10 lines
There is always the race of an event arriving whilst in the process of suspending, that is not solved by either the kernel nor user part of suspend-blockers. The only thing is not to loose the event.
You simply have to deal with that, the suspend gets canceled, you do deal with the event, and suspend again. How does making that 'retry' as you call it happen from a kernel thread or from a userspace thread any difference?
You have a point there. But what follows?
You either need to let userspace know that the kernel is now able to suspend or you let the kernel know that userspace is now able to suspend.
Else you can not make a well informed suspend-decision and have to guess and retry.
Why not look at blocking and unblocking as these events you want to have? Without wiggle room and retrying.
And not having to route through userspace simplifies the auto-suspend scheme further.
Cheers,
Flo
Quoted 17 lines · On Wed, 26 May 2010 11:54:37 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 16 lines · Florian Mickler
_IF_ you want to suspend aggressively, I don't see another way.
The thing is, this is a paradigm change. Suspend is not anymore controlled by userspace. In order to let userspace control/work with this scheme, it needs to know when a suspend will be successfull or poll:
1. kernel sees suspend may be possible on his side of things
2. kernel sends a message to userspace that i could be possibly possible to suspend, but it may well be that by the time userspace suspends it is not possible anymore
3. userspace decides to suspend.
Quoted 7 lines
Quoted 5 lines
<- system suspends... or not ..->
4. userspace retries ... retries ... retries ...
And then you have the whole can of worms and races.
I don't see any races, nor retry loops.
What about the worms? :)
I referred to retrying steps 1 through 3 as being the loop.
Quoted 10 lines
There is always the race of an event arriving whilst in the process of suspending, that is not solved by either the kernel nor user part of suspend-blockers. The only thing is not to loose the event.
You simply have to deal with that, the suspend gets canceled, you do deal with the event, and suspend again. How does making that 'retry' as you call it happen from a kernel thread or from a userspace thread any difference?
You have a point there. But what follows?
You either need to let userspace know that the kernel is now able to suspend or you let the kernel know that userspace is now able to suspend.
Else you can not make a well informed suspend-decision and have to guess and retry.
Why not look at blocking and unblocking as these events you want to have? Without wiggle room and retrying.
And not having to route through userspace simplifies the auto-suspend scheme further.
Cheers,
Flo
Quoted 4 lines · Arve Hjønnevåg
This patch series adds a suspend-block api that provides the same functionality as the android wakelock api. This version adds a delay before suspending again if no suspend blockers were used during the last suspend attempt.
Patches [1-6/8] applied to suspend-2.6/linux-next
Thanks,
Rafael
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm