[PATCH] tick-broadcast: Add tick road-cast affinity suport
From: Santosh Shilimkar
Date: Tue Jul 24 2012 - 18:12:33 EST
Current tick broad-cast code has affinity set to the boot CPU and hence
the boot CPU will always wakeup from low power states when broad cast timer
is armed even if the next expiry event doesn't belong to it.
Patch adds broadcast affinity functionality to avoid above and let the
tick framework set the affinity of the event for the CPU it belongs.
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@xxxxxx>
---
include/linux/clockchips.h | 2 ++
kernel/time/tick-broadcast.c | 13 ++++++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 8a7096f..5488cdc 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -95,6 +95,8 @@ struct clock_event_device {
unsigned long retries;
void (*broadcast)(const struct cpumask *mask);
+ void (*broadcast_affinity)
+ (const struct cpumask *mask, int irq);
void (*set_mode)(enum clock_event_mode mode,
struct clock_event_device *);
void (*suspend)(struct clock_event_device *);
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index f113755..2ec2425 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -39,6 +39,8 @@ static void tick_broadcast_clear_oneshot(int cpu);
static inline void tick_broadcast_clear_oneshot(int cpu) { }
#endif
+static inline void dummy_broadcast_affinity(const struct cpumask *mask,
+ int irq) { }
/*
* Debugging: see timer_list.c
*/
@@ -485,14 +487,19 @@ void tick_broadcast_oneshot_control(unsigned long reason)
if (!cpumask_test_cpu(cpu, tick_get_broadcast_oneshot_mask())) {
cpumask_set_cpu(cpu, tick_get_broadcast_oneshot_mask());
clockevents_set_mode(dev, CLOCK_EVT_MODE_SHUTDOWN);
- if (dev->next_event.tv64 < bc->next_event.tv64)
+ if (dev->next_event.tv64 < bc->next_event.tv64) {
tick_broadcast_set_event(dev->next_event, 1);
+ bc->broadcast_affinity(
+ tick_get_broadcast_oneshot_mask(), bc->irq);
+ }
}
} else {
if (cpumask_test_cpu(cpu, tick_get_broadcast_oneshot_mask())) {
cpumask_clear_cpu(cpu,
tick_get_broadcast_oneshot_mask());
clockevents_set_mode(dev, CLOCK_EVT_MODE_ONESHOT);
+ bc->broadcast_affinity(
+ tick_get_broadcast_oneshot_mask(), bc->irq);
if (dev->next_event.tv64 != KTIME_MAX)
tick_program_event(dev->next_event, 1);
}
@@ -536,6 +543,10 @@ void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
bc->event_handler = tick_handle_oneshot_broadcast;
+ /* setup dummy broadcast affinity handler if not provided */
+ if (bc->broadcast_affinity)
+ bc->broadcast_affinity = dummy_broadcast_affinity;
+
/* Take the do_timer update */
tick_do_timer_cpu = cpu;
--
1.7.9.5
--------------010603040003030705030008--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/