With current tick_do_broadcast_on_off() and tick_broadcast_on_off(),
it only cares host cpu, and doesn't really support to make the on/off
for another target CPU as it seems to be. So remove the unneeded
online check and add a WARN to notify user who doesn't know this
new usage model.

Next step should be to remove those cases that sends the BROADCAST
ON/OFF/FORCE msg on one cpu for another CPU, if this patch is reviewed
to be ok.

Signed-off-by: Feng Tang <feng.t...@intel.com>
Cc: Suresh Siddha <suresh.b.sid...@intel.com>
Cc: Thomas Gleixner <t...@linutronix.de>
---
 kernel/time/tick-broadcast.c |   15 +--------------
 kernel/time/tick-common.c    |    6 +++++-
 kernel/time/tick-internal.h  |    4 ++--
 3 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index f113755..0433274 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -204,7 +204,7 @@ static void tick_handle_periodic_broadcast(struct 
clock_event_device *dev)
  * Powerstate information: The system enters/leaves a state, where
  * affected devices might stop
  */
-static void tick_do_broadcast_on_off(unsigned long *reason)
+void tick_broadcast_on_off(unsigned long *reason)
 {
        struct clock_event_device *bc, *dev;
        struct tick_device *td;
@@ -266,19 +266,6 @@ out:
 }
 
 /*
- * Powerstate information: The system enters/leaves a state, where
- * affected devices might stop.
- */
-void tick_broadcast_on_off(unsigned long reason, int *oncpu)
-{
-       if (!cpumask_test_cpu(*oncpu, cpu_online_mask))
-               printk(KERN_ERR "tick-broadcast: ignoring broadcast for "
-                      "offline CPU #%d\n", *oncpu);
-       else
-               tick_do_broadcast_on_off(&reason);
-}
-
-/*
  * Set the periodic handler depending on broadcast on/off
  */
 void tick_set_periodic_handler(struct clock_event_device *dev, int broadcast)
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
index da6c9ec..950c635 100644
--- a/kernel/time/tick-common.c
+++ b/kernel/time/tick-common.c
@@ -362,6 +362,8 @@ static void tick_resume(void)
 static int tick_notify(struct notifier_block *nb, unsigned long reason,
                               void *dev)
 {
+       int *cpu = dev;
+
        switch (reason) {
 
        case CLOCK_EVT_NOTIFY_ADD:
@@ -370,7 +372,9 @@ static int tick_notify(struct notifier_block *nb, unsigned 
long reason,
        case CLOCK_EVT_NOTIFY_BROADCAST_ON:
        case CLOCK_EVT_NOTIFY_BROADCAST_OFF:
        case CLOCK_EVT_NOTIFY_BROADCAST_FORCE:
-               tick_broadcast_on_off(reason, dev);
+               WARN((*cpu != smp_processor_id()),
+                       "BROADCAST ON/OFF/FORCE should only be fired for host 
CPU\n");
+               tick_broadcast_on_off(&reason);
                break;
 
        case CLOCK_EVT_NOTIFY_BROADCAST_ENTER:
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h
index 4e265b9..40e4a8b 100644
--- a/kernel/time/tick-internal.h
+++ b/kernel/time/tick-internal.h
@@ -90,7 +90,7 @@ static inline bool tick_broadcast_oneshot_available(void) { 
return false; }
 extern int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu);
 extern int tick_check_broadcast_device(struct clock_event_device *dev);
 extern int tick_is_broadcast_device(struct clock_event_device *dev);
-extern void tick_broadcast_on_off(unsigned long reason, int *oncpu);
+extern void tick_broadcast_on_off(unsigned long *reason);
 extern void tick_shutdown_broadcast(unsigned int *cpup);
 extern void tick_suspend_broadcast(void);
 extern int tick_resume_broadcast(void);
@@ -115,7 +115,7 @@ static inline int tick_device_uses_broadcast(struct 
clock_event_device *dev,
        return 0;
 }
 static inline void tick_do_periodic_broadcast(struct clock_event_device *d) { }
-static inline void tick_broadcast_on_off(unsigned long reason, int *oncpu) { }
+static inline void tick_broadcast_on_off(unsigned long *reason) { }
 static inline void tick_shutdown_broadcast(unsigned int *cpup) { }
 static inline void tick_suspend_broadcast(void) { }
 static inline int tick_resume_broadcast(void) { return 0; }
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to