Skip to contentSkip to conversation

Adding PM QoS parameters

DISCUSSION Premi, Sanjeev 3 participants 3 messages Apr 21, 2009 – Apr 27, 2009 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Sorry, picking-up thread late...

Quoted 72 lines

Date: Tue, 21 Apr 2009 10:08:18 +0200
From: Derkling <[email protected]>
Subject: Re: [linux-pm] Adding PM QoS parameters
To: [email protected]
Cc: Matteo Carnevali <[email protected]>, David Siorpaes
<[email protected]>, Stefano Bosisio
<[email protected]>
Message-ID:

	<[email protected]>

Content-Type: text/plain; charset=ISO-8859-1

Quoted 2 lines · mark gross
Quoted 2 lines

Hi,
we are a group that since some months is working on

"Constrained Power

Quoted 3 lines
Quoted 1 line

Management" in STMicroelectronics.

I would like to hear what your ideas are around applying

constraints to

Quoted 1 line

power management! The notion of constraint based PM has

been rattling

Quoted 1 line

around, in my head and elsewhere, for a while now (a couple

of years).

Quoted 1 line

PMQoS is just an early application of it. I think a lot

more could be

Quoted 1 line

done in this area.

We are working on the concept of constrained power management since the times
of DPM.
We ported that framework to Nomadik platform and then we started reasoning on a
different implementation with the aims of overcoming its main drawbacks.

In the meantime pm_qos had been released and since then, this topic, i.e.
constrained power management (CPM), has officially become the main subject of my
PhD study; I agree with you that a lot can be done in this area.

In the last few months have focused on these tasks:
1. define a formal model to state the CPM problem (based both on linear
programming and constraint programming)
2. evaluate pm_qos with respect to this formal model and highlight its potential wekenesses
3. identify an extension/refactoring of pm_qos in order to overcame its
limitations and perhaps advance the proposal for a more general implementation
4. code a first release of the proposal and submit it to the community for a
review ... and now we are at THIS fourth step.

Quoted 1 line

Recently I've been thinking about re-factoring PMQoS in

possibly crazy

Quoted 2 lines

ways with the goal of somehow supporting a more generic constraint notion without making the PMQoS ABI into a free for all.

Our re-factoring is for sure quite crazy. The proposal inherits many ideas and
concepts from both DPM and PM_QoS, perhaps only the strenghts of these two
frameworks:
- from DPM the concept of Operating Points (OP) (but don't
worry: it has been
highly reworked)
- from PM_QoS the concept of "aggregation function" for constraint management

Quoted 9 lines

The idea is still to consider the framework to be simply a "constraint manager"
that supports a "distributed power management model". In such a model each driver usually runs its own local optimization policy
(e.g. cpufreq), but at the same time exchanges some information with the rest of
the system in order to either require or provide QoS levels (e.g. admitted latency).

Would like to see more of this before real comment; because I am trying to see what could happen if 2 drivers sharing a common parent clock try to change the freq in 2 different directions.

Quoted 17 lines

In this big picture PM_QoS works quite well, but perhaps we have spotted two
limitations to be better investigated:
1. it is a "best-effort" framework
2. it does not handle properly "additive constraints"

* Best-effort: pm_qos cannot grant that a required QoS level can be effectively
provided, and even worst pm_qos don't provide mechanisms to notify a constraint
requester that the required qos level cannot be satisfied by other components.
This can turn into a "misconfiguration" of a device: its local policy configure
itself expecting the required level even when actually it's impossible to get

Quoted 8 lines

that.
No one notifies the device about the effective QoS levels that can be reached; all that other devices can do it is only the best they can in order to
grant the required level.
Can that leads to an only sub-optimal power optimization for the device
requesting the constraint? We have this suspect...

Once a requested level is achieved the requester should be notified for possible reconfiguration. It could be via an optional registration.

Quoted 20 lines

* additive constraints: pm_qos perhaps does not properly aggregate constraints
requests on shared resources.
If multiple applications assert a bandwidth (or throughput)
request: pm_qos
aggregate them considering the MAX (or MIN) of the collected requests:
this seems to be not properly correct.
We think that in this case (e.g. bandwidth) the driver of the service provider
should be aware of the "accumulated" requests to properly configure itself and
satisfy all concurrent requirements.
We define "additive constraints" those that refer to shared resources (e.g. bandwidth). They differ from "restrictive constraints" (e.g. latency)
since the aggregation function cannot be a simple "bound-value" (i.e. max
or min) but should be an "sum-value" in order to get the real system-wide QoS

Quoted 8 lines

requirement.
These considerations made us thinking about a rework on pm_qos in order to build
a more comprehensive framework able to:
- properly handle both restrictive and additive constraints
- provide an agreement mechanism that allows to notify constraint requester
about real system run-time capabilities.

So, again we are again looking at means to add more constraints and also the "kind" of constraint.

Quoted 10 lines

These are basically the ideas behind our rework. As soon as it will be ready we
will deliver the code for review. In the meantime we are also producing a paper
describing in details theoretical foundation of the model we advance and its
implementation.

Quoted 1 line
Quoted 1 line

I think that a good trade-off between "LKML control on

Quoted 9 lines

new parameters" and

Quoted 1 line
Quoted 1 line

"platform extensibility" is hard to identify if we don't

refine the concept of

Quoted 2 lines
Quoted 2 lines

QoS parameters first.
The QoS params defined by pm_qos should avoid to be

not-sufficiently general,

Quoted 1 line
Quoted 1 line

to be really useful to applications, but also avoid to be

too much abstract to

Quoted 1 line
Quoted 1 line

support platform-specific capabilities.

We could start with a smaller set, e.g.:
- Interrupt latency (in lieu of DMA latency)
- Sleep lateny (to control sleep in absence of cpuidle)
- Cpu frequency
- Cpu voltage

Of course, when we extend this to SoCs with multiple CPUs then we do have (possible) need of multiplicity if one of these has to act as "master".

e.g. OMAP3 allows ARM and IVA voltages and frequency to be changed independently.

Quoted 4 lines
Quoted 1 line
Quoted 1 line

Since anyway the core pm_qos implementation is

sufficiently general to handle

Quoted 1 line
Quoted 1 line

both abstract and platform-specific params, maybe we

should better distinguish

Quoted 12 lines
Quoted 1 line
Quoted 1 line

among "abstract qos parameters" (AQP) and

"platform-specific qos parameters"

Quoted 3 lines
Quoted 3 lines

PQP).

AQP should be intended to be used by applications to

assert abstract

Quoted 1 line
Quoted 1 line

requirements on system behaviors, while PQP can be added

by platform code in

Quoted 4 lines
Quoted 2 lines

order to enable the "constrained power management paradigm" for architecture/board specific devices.

Maybe.

On the first read, I believe abstract parameter+level combination can help us achieve the appliation portability across architectures and allow specific map most suitable for each arch.

Quoted 15 lines

In our model platform code can define both platform-specific and architecture
independent constraints. The formers, since are architecture specific, can be
exposed read-only to user-space (e.g. just to be used for debugging purpose).
The latter instead can be exposed read-write and applications can assert
requirements on them. These constraints should be sufficiently abstract to be
platform independent and generally usable to express high-level requirements for
an application (e.g. the network bandwidth a VoIP application requires).

Quoted 8 lines

A device drivers is in charge to "maps" abstract parameters on its own specific
params and eventually on other platform-specific parameters, whenever they are
platform driver (e.g. a network driver can map a bandwidth request on a
platform-specific constraint on dma-latency or amba-bus throughput).

I am not sure if I understood this completely, but I believe that abstract -> specific mapping should be done at system level. Letting drivers define them, may not be portable; and might lead to more confusion.

Quoted 47 lines
Quoted 1 line
Quoted 1 line

In this hypothesis the better solution would be to use a

dynamic data structure

Quoted 1 line
Quoted 1 line

that will be initialized by the core itself to contain

just the set of AQP that

Quoted 2 lines
Quoted 2 lines

has been reviewed and approved by LKML. Platform code will then have the chance to add its own

specific parameters too.

Quoted 2 lines
Quoted 2 lines

Moreover we could imagine that AQP will be exported to

user-land, in order to

Quoted 1 line
Quoted 1 line

be asserted by application software, while PQP may be

hidden within the core

Quoted 5 lines
Quoted 2 lines

and accessible only by platform drivers.

I don't know if we can keep any PQP interfaces kernel only. Policy managers really like to run in user mode, even if its just

to set the

Quoted 1 line

constraints.

This is not what is actually going on with both cpufreq and cpuidle. Really few clients of pm_qos exist now, but among them the kernel-space running
policy seems to be the more widely adopted solution... may be because of
efficiency? User-space can still be in charge of choosing the policy/governor,
but then it's up to this piece of code to manage constraints requests. In the case of it needs having a user-space policy, a simple kernel-space
wrapper defining a "forwarding policy" will be sufficient to expose the required
PQP to user-space.

Quoted 1 line
Quoted 1 line

I agree: user-land accessible params should be

platform-independent and define

Quoted 2 lines
Quoted 2 lines

a portable API for applications.
This requires also to have sufficiently abstract

parameters: e.g. network

Quoted 1 line
Quoted 1 line

bandwidth can be easily asserted by an application while

cpu-dma-latency is

Quoted 4 lines
Quoted 1 line

perhaps too difficult to identify at application level.

DMA latency is a somewhat sucky name for constraining CPU Idle / C-states, but I can't think of a better name.

Quoted 9 lines

I understand, but: is it so common to have user-space code that needs to assert
such "real-time" requirements? It seems to us that user-land should be given
access only to sufficiently abstract constraints that roughly define system
requirements. While more architecture-specific constraints should come from
drivers. This should improve solution portability, isn't it?

Or, the drivers should 'map' their constraints onto arch specific constratints making them portable. e.g. we wouldn't like an ethernet driver tied to one arch/platform... even with most of this mapping in a platform specific code.

Quoted 9 lines
Quoted 3 lines

As I type this reply I'm thinking an ok way could be to

re-factor PMQoS

Quoted 1 line

into a constraint framework that exposes platform specific

constraint

Quoted 1 line

ABI's (in some TBD sane manner---somehow), and set PMQoS on

top of this

Quoted 1 line

keeping same ABI and KABI's stable.

Agree.

Quoted 10 lines

Are you thinking to something like an abstract API that each platform code
should implements in its own way?

Quoted 2 lines

I could use some input on the way folks anticipate a constraint infrastructure to be used. How hot could the code paths

be? How complex

Quoted 1 line

could the dependencies and inter dependencies become?

Quoted 13 lines

These are interesting questions! We should deepen those aspects, anyway we think
that dependencies, e.g. among constraints, can also be an interesting concept in
order to build modular solutions.
In instance the mapping that a driver needs to provide between an (platform-independent) abstract constraint and a platform-specific one should
allow to write more portable drivers that:
1. tune on platform-independent requirements
2. translate abstract requirements into platform-specific ones

Quoted 1 line

Am I thinking about taking a walk on a slippery slope?

...if we get rope closer to ground, gravity doesn't harm much!

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

2) is it the right thing to keep pm-qos-params a

compile time array and

Quoted 1 line
Quoted 1 line
Quoted 1 line

control the growth of the ABI via these mailing lists

or make it a list

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

and enable driver creation of new parameters as they wish.

Quoted 8 lines
Quoted 1 line
Quoted 1 line

In my opinion a mixed approach, using a dynamic data

structure, could be more

Quoted 5 lines
Quoted 5 lines

interesting to target both requirements.

Quoted 1 line

Both are good things for us to discuss on the list.

We are tuned on this thread and happy to contribute to

the discussion.

Generic params that impact the apps could/should be an array; while arch/plat specific ones could be a linked list.

Best regards,
Sanjeev

Quoted 17 lines
Quoted 2 lines

very cool.

It will be interesting even just to have some shared ideas on the table before
the upcoming LPC.

Best regards,
Patrick

--
#include <best/regards.h>

DERKLING
LRU 338214 (http://counter.li.org)

#2 lore raw
Quoted 84 lines · Sanjeev

Sorry, picking-up thread late...

Quoted 72 lines

Date: Tue, 21 Apr 2009 10:08:18 +0200
From: Derkling <[email protected]>
Subject: Re: [linux-pm] Adding PM QoS parameters
To: [email protected]
Cc: Matteo Carnevali <[email protected]>, David Siorpaes
<[email protected]>, Stefano Bosisio
<[email protected]>
Message-ID:

	<[email protected]>

Content-Type: text/plain; charset=ISO-8859-1

Quoted 2 lines · mark gross
Quoted 2 lines

Hi,
we are a group that since some months is working on

"Constrained Power

Quoted 3 lines
Quoted 1 line

Management" in STMicroelectronics.

I would like to hear what your ideas are around applying

constraints to

Quoted 1 line

power management! The notion of constraint based PM has

been rattling

Quoted 1 line

around, in my head and elsewhere, for a while now (a couple

of years).

Quoted 1 line

PMQoS is just an early application of it. I think a lot

more could be

Quoted 1 line

done in this area.

We are working on the concept of constrained power management since the times
of DPM.
We ported that framework to Nomadik platform and then we started reasoning on a
different implementation with the aims of overcoming its main drawbacks.

In the meantime pm_qos had been released and since then, this topic, i.e.
constrained power management (CPM), has officially become the main subject of my
PhD study; I agree with you that a lot can be done in this area.

In the last few months have focused on these tasks:
1. define a formal model to state the CPM problem (based both on linear
programming and constraint programming)
2. evaluate pm_qos with respect to this formal model and highlight its potential wekenesses
3. identify an extension/refactoring of pm_qos in order to overcame its
limitations and perhaps advance the proposal for a more general implementation
4. code a first release of the proposal and submit it to the community for a
review ... and now we are at THIS fourth step.

Quoted 1 line

Recently I've been thinking about re-factoring PMQoS in

possibly crazy

Quoted 2 lines

ways with the goal of somehow supporting a more generic constraint notion without making the PMQoS ABI into a free for all.

Our re-factoring is for sure quite crazy. The proposal inherits many ideas and
concepts from both DPM and PM_QoS, perhaps only the strenghts of these two
frameworks:
- from DPM the concept of Operating Points (OP) (but don't
worry: it has been
highly reworked)
- from PM_QoS the concept of "aggregation function" for constraint management

Quoted 9 lines

The idea is still to consider the framework to be simply a "constraint manager"
that supports a "distributed power management model". In such a model each driver usually runs its own local optimization policy
(e.g. cpufreq), but at the same time exchanges some information with the rest of
the system in order to either require or provide QoS levels (e.g. admitted latency).

Quoted 4 lines

Would like to see more of this before real comment; because I am trying to see what could happen if 2 drivers sharing a common parent clock try to change the freq in 2 different directions.

I don't want to see PM-QoS or constraint based PM to degenerate into a DPM OppPoint type of thing. This statement reads that you are not aggregating the PMQoS requests in a sensible manner. (i.e. attempting to code DPM styled PM using pmqos interfaces)

One thing that is core to PMQoS and Constraint based PM is that there is a assumed partial ordering of the PM states. Absolute or specified performance settings are explicitly not part of PMQoS.

Quoted 26 lines
Quoted 17 lines

In this big picture PM_QoS works quite well, but perhaps we have spotted two
limitations to be better investigated:
1. it is a "best-effort" framework
2. it does not handle properly "additive constraints"

* Best-effort: pm_qos cannot grant that a required QoS level can be effectively
provided, and even worst pm_qos don't provide mechanisms to notify a constraint
requester that the required qos level cannot be satisfied by other components.
This can turn into a "misconfiguration" of a device: its local policy configure
itself expecting the required level even when actually it's impossible to get

Quoted 8 lines

that.
No one notifies the device about the effective QoS levels that can be reached; all that other devices can do it is only the best they can in order to
grant the required level.
Can that leads to an only sub-optimal power optimization for the device
requesting the constraint? We have this suspect...

Quoted 3 lines

Once a requested level is achieved the requester should be notified for possible reconfiguration. It could be via an optional registration.

performance / power state entry notification?
I think we should be careful with that idea.

Quoted 50 lines
Quoted 21 lines

* additive constraints: pm_qos perhaps does not properly aggregate constraints
requests on shared resources.
If multiple applications assert a bandwidth (or throughput)
request: pm_qos
aggregate them considering the MAX (or MIN) of the collected requests:
this seems to be not properly correct.
We think that in this case (e.g. bandwidth) the driver of the service provider
should be aware of the "accumulated" requests to properly configure itself and
satisfy all concurrent requirements.
We define "additive constraints" those that refer to shared resources (e.g. bandwidth). They differ from "restrictive constraints" (e.g. latency)
since the aggregation function cannot be a simple "bound-value" (i.e. max
or min) but should be an "sum-value" in order to get the real system-wide QoS

Quoted 8 lines

requirement.
These considerations made us thinking about a rework on pm_qos in order to build
a more comprehensive framework able to:
- properly handle both restrictive and additive constraints
- provide an agreement mechanism that allows to notify constraint requester
about real system run-time capabilities.

So, again we are again looking at means to add more constraints and also the "kind" of constraint.

Quoted 17 lines

These are basically the ideas behind our rework. As soon as it will be ready we
will deliver the code for review. In the meantime we are also producing a paper
describing in details theoretical foundation of the model we advance and its
implementation.

Quoted 1 line
Quoted 1 line

I think that a good trade-off between "LKML control on

new parameters" and

Quoted 1 line
Quoted 1 line

"platform extensibility" is hard to identify if we don't

refine the concept of

Quoted 2 lines
Quoted 2 lines

QoS parameters first.
The QoS params defined by pm_qos should avoid to be

not-sufficiently general,

Quoted 1 line
Quoted 1 line

to be really useful to applications, but also avoid to be

Quoted 8 lines
Quoted 2 lines

too much abstract to

Quoted 1 line
Quoted 1 line

support platform-specific capabilities.

We could start with a smaller set, e.g.:
- Interrupt latency (in lieu of DMA latency)
- Sleep lateny (to control sleep in absence of cpuidle)
- Cpu frequency
- Cpu voltage

These are bottom up performance parameters. Lets first go top down and keep in mind the partial ordering component of the system. You can only constrain a min or max value not both. Typically you constrain the lowest platform power a parameter is allowed to enter.

If you are looking to constrain the highest power setting the platform can go too, then you are talking PMQoS when really thinking DPM.

Quoted 53 lines

Of course, when we extend this to SoCs with multiple CPUs then we do have (possible) need of multiplicity if one of these has to act as "master".

e.g. OMAP3 allows ARM and IVA voltages and frequency to be changed independently.

Quoted 4 lines
Quoted 1 line
Quoted 1 line

Since anyway the core pm_qos implementation is

sufficiently general to handle

Quoted 1 line
Quoted 1 line

both abstract and platform-specific params, maybe we

should better distinguish

Quoted 12 lines
Quoted 1 line
Quoted 1 line

among "abstract qos parameters" (AQP) and

"platform-specific qos parameters"

Quoted 3 lines
Quoted 3 lines

PQP).

AQP should be intended to be used by applications to

assert abstract

Quoted 1 line
Quoted 1 line

requirements on system behaviors, while PQP can be added

by platform code in

Quoted 4 lines
Quoted 2 lines

order to enable the "constrained power management paradigm" for architecture/board specific devices.

Maybe.

On the first read, I believe abstract parameter+level combination can help us achieve the appliation portability across architectures and allow specific map most suitable for each arch.

Quoted 15 lines

In our model platform code can define both platform-specific and architecture
independent constraints. The formers, since are architecture specific, can be
exposed read-only to user-space (e.g. just to be used for debugging purpose).
The latter instead can be exposed read-write and applications can assert
requirements on them. These constraints should be sufficiently abstract to be
platform independent and generally usable to express high-level requirements for
an application (e.g. the network bandwidth a VoIP application requires).

Quoted 8 lines

A device drivers is in charge to "maps" abstract parameters on its own specific
params and eventually on other platform-specific parameters, whenever they are
platform driver (e.g. a network driver can map a bandwidth request on a
platform-specific constraint on dma-latency or amba-bus throughput).

Quoted 4 lines

I am not sure if I understood this completely, but I believe that abstract -> specific mapping should be done at system level. Letting drivers define them, may not be portable; and might lead to more confusion.

Parameters need to be defined at the application (solution) level and exposed to the drivers to enable them to make the best choice. Not the other way around. So if by system level you mean "solution" level then we agree, but over email I'm not sure if we do.

Quoted 96 lines
Quoted 47 lines
Quoted 1 line
Quoted 1 line

In this hypothesis the better solution would be to use a

dynamic data structure

Quoted 1 line
Quoted 1 line

that will be initialized by the core itself to contain

just the set of AQP that

Quoted 2 lines
Quoted 2 lines

has been reviewed and approved by LKML. Platform code will then have the chance to add its own

specific parameters too.

Quoted 2 lines
Quoted 2 lines

Moreover we could imagine that AQP will be exported to

user-land, in order to

Quoted 1 line
Quoted 1 line

be asserted by application software, while PQP may be

hidden within the core

Quoted 5 lines
Quoted 2 lines

and accessible only by platform drivers.

I don't know if we can keep any PQP interfaces kernel only. Policy managers really like to run in user mode, even if its just

to set the

Quoted 1 line

constraints.

This is not what is actually going on with both cpufreq and cpuidle. Really few clients of pm_qos exist now, but among them the kernel-space running
policy seems to be the more widely adopted solution... may be because of
efficiency? User-space can still be in charge of choosing the policy/governor,
but then it's up to this piece of code to manage constraints requests. In the case of it needs having a user-space policy, a simple kernel-space
wrapper defining a "forwarding policy" will be sufficient to expose the required
PQP to user-space.

Quoted 1 line
Quoted 1 line

I agree: user-land accessible params should be

platform-independent and define

Quoted 2 lines
Quoted 2 lines

a portable API for applications.
This requires also to have sufficiently abstract

parameters: e.g. network

Quoted 1 line
Quoted 1 line

bandwidth can be easily asserted by an application while

cpu-dma-latency is

Quoted 4 lines
Quoted 1 line

perhaps too difficult to identify at application level.

DMA latency is a somewhat sucky name for constraining CPU Idle / C-states, but I can't think of a better name.

Quoted 9 lines

I understand, but: is it so common to have user-space code that needs to assert
such "real-time" requirements? It seems to us that user-land should be given
access only to sufficiently abstract constraints that roughly define system
requirements. While more architecture-specific constraints should come from
drivers. This should improve solution portability, isn't it?

Or, the drivers should 'map' their constraints onto arch specific constratints making them portable. e.g. we wouldn't like an ethernet driver tied to one arch/platform... even with most of this mapping in a platform specific code.

Quoted 9 lines
Quoted 3 lines

As I type this reply I'm thinking an ok way could be to

re-factor PMQoS

Quoted 1 line

into a constraint framework that exposes platform specific

constraint

Quoted 1 line

ABI's (in some TBD sane manner---somehow), and set PMQoS on

top of this

Quoted 1 line

keeping same ABI and KABI's stable.

Agree.

Quoted 22 lines

Are you thinking to something like an abstract API that each platform code
should implements in its own way?

Quoted 2 lines

I could use some input on the way folks anticipate a constraint infrastructure to be used. How hot could the code paths

be? How complex

Quoted 1 line

could the dependencies and inter dependencies become?

These are interesting questions! We should deepen those aspects, anyway we think
that dependencies, e.g. among constraints, can also be an interesting concept in
order to build modular solutions.
In instance the mapping that a driver needs to provide between an (platform-independent) abstract constraint and a platform-specific one should
allow to write more portable drivers that:
1. tune on platform-independent requirements
2. translate abstract requirements into platform-specific ones

Quoted 3 lines
Quoted 1 line
Quoted 1 line

Am I thinking about taking a walk on a slippery slope?

...if we get rope closer to ground, gravity doesn't harm much!

true.

Quoted 12 lines
Quoted 12 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

2) is it the right thing to keep pm-qos-params a

compile time array and

Quoted 1 line
Quoted 1 line
Quoted 1 line

control the growth of the ABI via these mailing lists

or make it a list

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

and enable driver creation of new parameters as they wish.

In my opinion a mixed approach, using a dynamic data

structure, could be more

Quoted 2 lines
Quoted 2 lines

interesting to target both requirements.

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

Both are good things for us to discuss on the list.

We are tuned on this thread and happy to contribute to

the discussion.

Generic params that impact the apps could/should be an array; while arch/plat specific ones could be a linked list.

I'll look at this.

Keep in mind I am against the DPM-ification of this design. At a basic level the Linux OS is a best effort OS and although you can always bang some CR's to set power states, that isn't useful as platform independent or common code.

--mgross

#3 lore raw
In reply to Premi, Sanjeev
Quoted 3 lines · Premi, Sanjeev <premi <at> ti.com> writes:

Sorry, picking-up thread late...

Hi, I'm Matteo Carnevali and I'm working in ST with Patrick on the topic of CPM.

Quoted 6 lines

Would like to see more of this before real comment; because I am trying to see what could happen if 2 drivers sharing a common parent clock try to change the freq in 2 different directions.

Of Course, the QoS should always be granted, at least as long as system resources are available by the hardware.

In a real context is not so common that drivers (different from the cpu drivers like cpufreq or cpuidle) explicitly ask to lower cpu frequency, the cpufreq driver can do that but it relies on the governor which monitors the cpu load and consequently tunes the frequency.

Moreover the cpu frequency cannot be considered as an abstract parameter, but something very related to the physical architecture. A device driver, in our ideas, cannot state "I now need more than 200Mhz to the cpu"...

However, two conflicting requests on an abstract parameter will be actually treated as a conflict and the framework core (the controller) or a governor associated to the framework will avoid to work on such proposal. Anyway, the framework core should not be considered as a central entity that manages the control telling the driver how to act under certain circumstances, this is a feature of "Centralized power management" and it is not our idea.

Moreover, it is also not very possible that two requests to change the value of an abstract parameter (i.e. set a constraint on a parameter) happen exactly at the same time.

Quoted 5 lines

Once a requested level is achieved the requester should be notified for possible reconfiguration. It could be via an optional registration.

Yes, this is can be done with the notification chain.
Writing about the Best Effort approach of pmqos, we wanted to be sure we correctly pointed out a possible limitation of pmqos it self and we would like to know if you agree on this.

Quoted 12 lines

So, again we are again looking at means to add more constraints and also the "kind" of constraint.

We could start with a smaller set, e.g.:
- Interrupt latency (in lieu of DMA latency)
- Sleep lateny (to control sleep in absence of cpuidle)
- Cpu frequency
- Cpu voltage

Quoted 7 lines

Of course, when we extend this to SoCs with multiple CPUs then we do have (possible) need of multiplicity if one of these has to act as "master".

e.g. OMAP3 allows ARM and IVA voltages and frequency to be changed independently.

Specific hardware and platform feature should be kept confined in the driver code and not brought directly at framework level, i.e translated in parameters; on the other hand, the mapping among device operating modes (aka local driver configuration) and abstract parameters should be performed inside the device driver to support the framework.

Quoted 7 lines

On the first read, I believe abstract parameter+level combination can help us achieve the appliation portability across architectures and allow specific map most suitable for each arch.

Quoted 5 lines

I am not sure if I understood this completely, but I believe that abstract -> specific mapping should be done at system level. Letting drivers define them, may not be portable; and might lead to more confusion.

We can consider to have two mappings:
1) mapping between the driver local configuration and the abstract parameters. Hence, if abstract parameter are well defined and a device driver is well written to support them and correctly maps its operating modes to the parameters, there should not be confusion.
Let's consider a NIC driver with 3 operating modes and just one abstract parameter, the bandwidth:

op mode ---mapping--- bandwidth

idle <----------------->   0
low power <------------>   0-20 Mbit/s
max power <------------>   0-54 Mbit/s

this is just a dummy example...

Drivers using this framework should of course correctly implement the framework API.

2) mapping between the platform code and the abstract parameters, which allows the hierarchical binding of platform specific resources and the abstract parameters

If we consider the example of the NIC driver, let say that it uses an SPI bus to transfer data to the SoC: the NIC declares it wants at least x bandwidth on the bus by setting a constraint on that abstract parameter. At this point the platform code has the job to assign the correct SPI channel for that request and can do that thanks to its mapping with the abstract parameter.
The NIC driver itself does not know at which SPI channel is attached. It just sets a constraint on a abstract parameter.

Quoted 9 lines

Agree.

...if we get rope closer to ground, gravity doesn't harm much!

Quoted 6 lines

Generic params that impact the apps could/should be an array; while arch/plat specific ones could be a linked list.

Best regards,
Sanjeev

best regards,
Matteo

<-------------------------------------------------------------------->
Matteo Carnevali < rekstorm at gmail dot com>
Master student at Politecnico di Milano

<-------------------------------------------------------------------->

Quoted 2 lines
Quoted 1 line