This is a quite naive implementation to track whether a clocksource is enabled.
I chose not to add a member in struct clocksource and use a flag instead.
I found that timekeeping.c is the only consumer for clocksource and I converted
it to use clocksource_enable and clocksource_disable.
Changes in v2:
- removed the check on enable in timekeeping.c to ensure all clocksources are
going through clocksource_enable
- rework clocksource_enable to set CLOCK_SOURCE_USED when enable is successful
if present
Alexandre Belloni (2):
clocksource: track usage
clocksource: don't suspend/resume when unused
include/linux/clocksource.h | 4 ++++
kernel/time/clocksource.c | 34 ++++++++++++++++++++++++++++++++--
kernel/time/timekeeping.c | 8 +++-----
3 files changed, 39 insertions(+), 7 deletions(-)
--
2.1.0
There is no point in calling suspend/resume for unused
clocksources.
Signed-off-by: Alexandre Belloni <redacted>
---
kernel/time/clocksource.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Boris Brezillon <hidden> Date: 2015-01-16 17:45:20
On Fri, 16 Jan 2015 17:57:17 +0100
Alexandre Belloni [off-list ref] wrote:
This is a quite naive implementation to track whether a clocksource is enabled.
I chose not to add a member in struct clocksource and use a flag instead.
I found that timekeeping.c is the only consumer for clocksource and I converted
it to use clocksource_enable and clocksource_disable.
To the whole series:
Reviewed-by: Boris Brezillon <redacted>
Changes in v2:
- removed the check on enable in timekeeping.c to ensure all clocksources are
going through clocksource_enable
- rework clocksource_enable to set CLOCK_SOURCE_USED when enable is successful
if present
Alexandre Belloni (2):
clocksource: track usage
clocksource: don't suspend/resume when unused
include/linux/clocksource.h | 4 ++++
kernel/time/clocksource.c | 34 ++++++++++++++++++++++++++++++++--
kernel/time/timekeeping.c | 8 +++-----
3 files changed, 39 insertions(+), 7 deletions(-)
Hi,
On 16/01/2015 at 11:05:46 -0800, John Stultz wrote :
On Fri, Jan 16, 2015 at 8:57 AM, Alexandre Belloni
[off-list ref] wrote:
quoted
Track whether the clocksource is enabled or disabled.
So.. this commit message needs work. Why do we care to track the
clocksource enabled/disabled state?
What about:
Track whether the clocksource is enabled or disabled. This will allow to
select whether an action is necessary, for example suspend or resume.
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
I had a deeper look at the clocksources which have a resume
callback. We have implementations, which rely on the resume callback
being called unconditionally. e.g.: arch/x86/kernel/hpet.c. And there
are a few others which have extra PM code in the suspend/resume path
independent of the fact whether the clocksource is enabled or not.
So we really need to make this opt-in with a per clocksource flag.
Thanks,
tglx