time/cpuidle:Fixup fallout from hrtimer broadcast mode inclusion
PATCH 1/1 time/cpuidle:Fixup fallout from hrtimer broadcast mode inclusion
The broadcast timer registration has to be done only when GENERIC_CLOCKEVENTS_BROADCAST and TICK_ONESHOT config options are enabled. Also fix max_delta_ticks value for the pseudo clock device.
---
kernel/time/tick-broadcast-hrtimer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/time/tick-broadcast-hrtimer.c +3 -1
@@ -81,7 +81,7 @@ static struct clock_event_device ce_broadcast_hrtimer = { .min_delta_ns = 1, .max_delta_ns = KTIME_MAX, .min_delta_ticks = 1, - .max_delta_ticks = KTIME_MAX, + .max_delta_ticks = ULONG_MAX, .mult = 1, .shift = 0, .cpumask = cpu_all_mask,
@@ -102,9 +102,11 @@ static enum hrtimer_restart bc_handler(struct hrtimer *t)return HRTIMER_RESTART ; } +#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST ) && defined(CONFIG_TICK_ONESHOT )void tick_setup_hrtimer_broadcast (void ) {hrtimer_init (&bctimer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS ); bctimer.function = bc_handler;clockevents_register_device (&ce_broadcast_hrtimer); } +#endif
Quoted 2 lines · Preeti U Murthy
The broadcast timer registration has to be done only when
GENERIC_CLOCKEVENTS_BROADCASTandTICK_ONESHOTconfig options are enabled.
Then we should compile that file only when those options are enabled. Where is the point to compile that code w/o the registration function?
Quoted 38 lines
Also fix
max_delta_ticksvalue for the pseudo clock device.Reported-by Fengguang Wu <[email protected]>Signed-off-by Preeti U Murthy <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>---
kernel/time/tick-broadcast-hrtimer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)kernel/time/tick-broadcast-hrtimer.c +3
-1@@ -81,7 +81,7 @@ static struct clock_event_device ce_broadcast_hrtimer = { .min_delta_ns = 1, .max_delta_ns = KTIME_MAX, .min_delta_ticks = 1, - .max_delta_ticks = KTIME_MAX, + .max_delta_ticks = ULONG_MAX, .mult = 1, .shift = 0, .cpumask = cpu_all_mask,@@ -102,9 +102,11 @@ static enum hrtimer_restart bc_handler(struct hrtimer *t)return HRTIMER_RESTART ; } +#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST ) && defined(CONFIG_TICK_ONESHOT )void tick_setup_hrtimer_broadcast (void ) {hrtimer_init (&bctimer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS ); bctimer.function = bc_handler;clockevents_register_device (&ce_broadcast_hrtimer); } +#endif
Hi Thomas,
Quoted 8 lines · Thomas Gleixner
Quoted 2 lines · Preeti U Murthy
The broadcast timer registration has to be done only when
GENERIC_CLOCKEVENTS_BROADCASTandTICK_ONESHOTconfig options are enabled.Then we should compile that file only when those options are enabled. Where is the point to compile that code w/o the registration function?
Hmm of course. The delta patch is at the end.
Another concern I have is with regard to the periodic mode of broadcast . We currently do not support the hrtimer mode of broadcast in periodic mode. The BROADCAST_ON/OFF calls which take effect in periodic mode has not yet been modified by this patchset to disable one CPU from going into deep idle, since we expect the deep idle states to never be chosen by the cpuidle governor in this mode. Do you think we should bother to modify this piece of code at all?
On the same note, my understanding is that BROADCAST_ON/OFF takes effect only in periodic mode, in oneshot mode it is a nop. But why do we expect the CPUs to avail broadcast in periodic mode when they are not supposed to be entering deep idle states? Am I missing something here? IOW what is the point of periodic mode of broadcast? Is it for malfunctioning local clock devices?
The delta patch below for fixing the compile time errors. This is based on tip/timers/core branch.
time/cpuidle:Fixup fallout from hrtimer broadcast mode inclusion
From: Preeti U Murthy <[email protected]>
The hrtimer mode of broadcast is supported only when GENERIC_CLOCKEVENTS_BROADCAST and TICK_ONESHOT config options are enabled. Hence compile in the functions for hrtimer mode of broadcast only when these options are selected. Also fix max_delta_ticks value for the pseudo clock device.
--- include/linux/clockchips.h | 1 + kernel/time/Makefile | 5 ++++- kernel/time/tick-broadcast-hrtimer.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-)
include/linux/clockchips.h +1 -0
@@ -207,6 +207,7 @@ static inline void clockevents_resume(void) {}static inline int clockevents_notify (unsigned long reason,void *arg) {return 0 ; }static inline int tick_check_broadcast_expired (void ) {return 0 ; } +static inline void tick_setup_hrtimer_broadcast (void ) {};#endif
kernel/time/Makefile +4 -1
@@ -3,7 +3,10 @@ obj-y += timeconv.o posix-clock.o alarmtimer.o obj-$(CONFIG_GENERIC_CLOCKEVENTS_BUILD) += clockevents.o obj-$(CONFIG_GENERIC_CLOCKEVENTS) += tick-common.o -obj-$(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) += tick-broadcast.o tick-broadcast-hrtimer.o +ifeq ($(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST),y) + obj-y += tick-broadcast.o + obj-$(CONFIG_TICK_ONESHOT) += tick-broadcast-hrtimer.o +endif obj-$(CONFIG_GENERIC_SCHED_CLOCK) += sched_clock.o obj-$(CONFIG_TICK_ONESHOT) += tick-oneshot.o obj-$(CONFIG_TICK_ONESHOT) += tick-sched.o
kernel/time/tick-broadcast-hrtimer.c +1 -1
@@ -82,7 +82,7 @@ static struct clock_event_device ce_broadcast_hrtimer = { .min_delta_ns = 1, .max_delta_ns = KTIME_MAX, .min_delta_ticks = 1, - .max_delta_ticks = KTIME_MAX, + .max_delta_ticks = ULONG_MAX, .mult = 1, .shift = 0, .cpumask = cpu_all_mask,
Thanks
Regards
Preeti U Murthy
Quoted 40 lines
Quoted 39 lines
Also fix
max_delta_ticksvalue for the pseudo clock device.Reported-by Fengguang Wu <[email protected]>Signed-off-by Preeti U Murthy <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>---
kernel/time/tick-broadcast-hrtimer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)kernel/time/tick-broadcast-hrtimer.c +3
-1@@ -81,7 +81,7 @@ static struct clock_event_device ce_broadcast_hrtimer = { .min_delta_ns = 1, .max_delta_ns = KTIME_MAX, .min_delta_ticks = 1, - .max_delta_ticks = KTIME_MAX, + .max_delta_ticks = ULONG_MAX, .mult = 1, .shift = 0, .cpumask = cpu_all_mask,@@ -102,9 +102,11 @@ static enum hrtimer_restart bc_handler(struct hrtimer *t)return HRTIMER_RESTART ; } +#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST ) && defined(CONFIG_TICK_ONESHOT )void tick_setup_hrtimer_broadcast (void ) {hrtimer_init (&bctimer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS ); bctimer.function = bc_handler;clockevents_register_device (&ce_broadcast_hrtimer); } +#endif
Quoted 28 lines · Preeti U Murthy
The broadcast timer registration has to be done only when
GENERIC_CLOCKEVENTS_BROADCASTandTICK_ONESHOTconfig options are enabled. Also fixmax_delta_ticksvalue for the pseudo clock device.Reported-by Fengguang Wu <[email protected]>Signed-off-by Preeti U Murthy <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>---
kernel/time/tick-broadcast-hrtimer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)kernel/time/tick-broadcast-hrtimer.c +1
-1@@ -81,7 +81,7 @@ static struct clock_event_device ce_broadcast_hrtimer = { .min_delta_ns = 1, .max_delta_ns = KTIME_MAX, .min_delta_ticks = 1, - .max_delta_ticks = KTIME_MAX, + .max_delta_ticks = ULONG_MAX, .mult = 1, .shift = 0, .cpumask = cpu_all_mask,@@ -102,9 +102,11 @@ static enum hrtimer_restart bc_handler(struct hrtimer *t)return HRTIMER_RESTART ;
kernel/time/tick-broadcast-hrtimer.c static enum hrtimer_restart bc_handler(struct hrtimer *t) · line 112
Quoted 10 lines
kernel/time/tick-broadcast-hrtimer.c +2
-0} +#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST ) && defined(CONFIG_TICK_ONESHOT )void tick_setup_hrtimer_broadcast (void ) {hrtimer_init (&bctimer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS ); bctimer.function = bc_handler;clockevents_register_device (&ce_broadcast_hrtimer); } +#endif
I see a build error in timers/core today:
kernel/time/tick-broadcast-hrtimer.c:101:6: error: redefinition of 'tick_setup_hrtimer_broadcast' include/linux/clockchips.h:194:20: note: previous definition of 'tick_setup_hrtimer_broadcast' was here
and I assume this is the intended fix for that, although it isn't mentioned in the changelog.
After it's applied, this is left over:
kernel/time/tick-broadcast-hrtimer.c:91:29: warning: ‘bc_handler’ defined but not used [-Wunused-function]
Hi David,
I have sent out a revised patch on
https://lkml.org/lkml/2014/2/9/2. Can you let me
know if this works for you?
Thanks
Regards
Preeti U Murthy
Quoted 53 lines · David Rientjes
Quoted 28 lines · Preeti U Murthy
The broadcast timer registration has to be done only when
GENERIC_CLOCKEVENTS_BROADCASTandTICK_ONESHOTconfig options are enabled. Also fixmax_delta_ticksvalue for the pseudo clock device.Reported-by Fengguang Wu <[email protected]>Signed-off-by Preeti U Murthy <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>---
kernel/time/tick-broadcast-hrtimer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)kernel/time/tick-broadcast-hrtimer.c +1
-1@@ -81,7 +81,7 @@ static struct clock_event_device ce_broadcast_hrtimer = { .min_delta_ns = 1, .max_delta_ns = KTIME_MAX, .min_delta_ticks = 1, - .max_delta_ticks = KTIME_MAX, + .max_delta_ticks = ULONG_MAX, .mult = 1, .shift = 0, .cpumask = cpu_all_mask,@@ -102,9 +102,11 @@ static enum hrtimer_restart bc_handler(struct hrtimer *t)return HRTIMER_RESTART ;kernel/time/tick-broadcast-hrtimer.c static enum hrtimer_restart bc_handler(struct hrtimer *t) · line 112
Quoted 10 lines
kernel/time/tick-broadcast-hrtimer.c +2
-0} +#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST ) && defined(CONFIG_TICK_ONESHOT )void tick_setup_hrtimer_broadcast (void ) {hrtimer_init (&bctimer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS ); bctimer.function = bc_handler;clockevents_register_device (&ce_broadcast_hrtimer); } +#endif I see a build error in timers/core today:
kernel/time/tick-broadcast-hrtimer.c:101:6: error: redefinition of 'tick_setup_hrtimer_broadcast'include/linux/clockchips.h:194:20: note: previous definition of 'tick_setup_hrtimer_broadcast' was hereand I assume this is the intended fix for that, although it isn't mentioned in the changelog.
After it's applied, this is left over:
kernel/time/tick-broadcast-hrtimer.c:91:29: warning: ‘bc_handler’ defined but not used [-Wunused-function]
tip-bot for Preeti U Murthy
merge bot[tip:timers/core] tick: Fixup more fallout from hrtimer broadcast mode
In reply to Preeti U Murthytick: Fixup more fallout from hrtimer broadcast mode
Commit-ID: 849401b66d305f3feb75b6db7459b95ad190552a Gitweb: http://git.kernel.org/tip/849401b66d305f3feb75b6db7459b95ad190552a Author: Preeti U Murthy <[email protected]> AuthorDate: Sun, 9 Feb 2014 11:32:22 +0530 Committer: Thomas Gleixner <[email protected]> CommitDate: Sun, 9 Feb 2014 15:11:47 +0100
tick: Fixup more fallout from hrtimer broadcast mode
The hrtimer mode of broadcast is supported only when GENERIC_CLOCKEVENTS_BROADCAST and TICK_ONESHOT config options are enabled. Hence compile in the functions for hrtimer mode of broadcast only when these options are selected. Also fix max_delta_ticks value for the pseudo clock device.
--- include/linux/clockchips.h | 1 + kernel/time/Makefile | 5 ++++- kernel/time/tick-broadcast-hrtimer.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-)
include/linux/clockchips.h +1 -0
@@ -207,6 +207,7 @@ static inline void clockevents_resume(void) {}static inline int clockevents_notify (unsigned long reason,void *arg) {return 0 ; }static inline int tick_check_broadcast_expired (void ) {return 0 ; } +static inline void tick_setup_hrtimer_broadcast (void ) {};#endif
kernel/time/Makefile +4 -1
@@ -3,7 +3,10 @@ obj-y += timeconv.o posix-clock.o alarmtimer.o obj-$(CONFIG_GENERIC_CLOCKEVENTS_BUILD) += clockevents.o obj-$(CONFIG_GENERIC_CLOCKEVENTS) += tick-common.o -obj-$(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) += tick-broadcast.o tick-broadcast-hrtimer.o +ifeq ($(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST),y) + obj-y += tick-broadcast.o + obj-$(CONFIG_TICK_ONESHOT) += tick-broadcast-hrtimer.o +endif obj-$(CONFIG_GENERIC_SCHED_CLOCK) += sched_clock.o obj-$(CONFIG_TICK_ONESHOT) += tick-oneshot.o obj-$(CONFIG_TICK_ONESHOT) += tick-sched.o
kernel/time/tick-broadcast-hrtimer.c +1 -1
@@ -82,7 +82,7 @@ static struct clock_event_device ce_broadcast_hrtimer = { .min_delta_ns = 1, .max_delta_ns = KTIME_MAX, .min_delta_ticks = 1, - .max_delta_ticks = KTIME_MAX, + .max_delta_ticks = ULONG_MAX, .mult = 1, .shift = 0, .cpumask = cpu_all_mask,
Quoted 6 lines · Preeti U Murthy
Hi David,
I have sent out a revised patch on
https://lkml.org/lkml/2014/2/9/2. Can you let me
know if this works for you?
This is commit 849401b66d30 ("tick: Fixup more fallout from hrtimer broadcast mode") in timers/core and it fixes it for my config.