Skip to contentSkip to conversation

ARM: smp_twd: create a percpu reference to the clockevent

PATCH New Linus Walleij 3 participants 3 messages Dec 12, 2011 – Dec 13, 2011 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 2/4 ARM: smp_twd: create a percpu reference to the clockevent

From: Linus Walleij <[email protected]>

This break-out from Colin Cross' cpufreq-aware TWD patch will create a local percpu reference to the clock event, so we can reference the event when the frequency of the TWD clock input changes at runtime.

---
 arch/arm/kernel/smp_twd.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
arch/arm/kernel/smp_twd.c +4 -0
index f057561..20cce4e 100644
@@ -17,6 +17,7 @@
 #include <linux/clockchips.h>
 #include <linux/irq.h>
 #include <linux/io.h>
+#include <linux/percpu.h>
 
 #include <asm/smp_twd.h>
 #include <asm/localtimer.h>
@@ -26,6 +27,7 @@
 void __iomem *twd_base;
 
 static unsigned long twd_timer_rate;
+static DEFINE_PER_CPU(struct clock_event_device *, twd_ce);
 
 static struct clock_event_device __percpu **twd_evt;
 
@@ -177,6 +179,8 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk)
 	this_cpu_clk = __this_cpu_ptr(twd_evt);
 	*this_cpu_clk = clk;
 
+	__get_cpu_var(twd_ce) = clk;
+
 	clockevents_config_and_register(clk, twd_timer_rate,
 					0xf, 0xffffffff);
 	enable_percpu_irq(clk->irq, 0);
Signature · 1 line
1.7.3.2
#1 lore raw

PATCH 2/4 ARM: smp_twd: create a percpu reference to the clockevent

Quoted 4 lines · Linus Walleij

static unsigned long twd_timer_rate;
+static DEFINE_PER_CPU(struct clock_event_device *, twd_ce);

static struct clock_event_device __percpu **twd_evt;

So, one pointer to the clock_event_device is not enough? Could we have one or the other?

#2 lore raw

PATCH 2/4 ARM: smp_twd: create a percpu reference to the clockevent

Quoted 8 lines · Russell King - ARM Linux
Quoted 4 lines · Linus Walleij

?static unsigned long twd_timer_rate;
+static DEFINE_PER_CPU(struct clock_event_device *, twd_ce);

?static struct clock_event_device __percpu **twd_evt;

So, one pointer to the clock_event_device is not enough? ?Could we have one or the other?

Bah, just me being lame and not seeing that Marc already made these events per-cpu.

I'll update the CPUfreq patch and drop this crap.

Thanks,
Linus Walleij