When a cpu goes to a deep idle state where its local timer is shutdown, it notifies the time framework to use the broadcast timer instead.
Unfortunately, the broadcast device could wake up any CPU, including an idle one which is not concerned by the wake up at all.
This implies, in the worst case, an idle CPU will wake up to send an IPI to another idle cpu.
This patch solves this by setting the irq affinity to the cpu concerned by the nearest timer event, by this way, the CPU which is wake up is guarantee to be the one concerned by the next event and we are safe with unnecessary wakeup for another idle CPU.
As the irq affinity is not supported by all the archs, a flag is needed to specify which clocksource can handle it : CLOCK_EVT_FEAT_DYNIRQ.
Tested on a u8500 board with a test program doing indefinitely usleep 10000 wired on each CPU.
With dynamic irq affinity: Log is 10.042298 secs long with 4190 events cpu0/state0, 24 hits, total 2718.00us, avg 113.25us, min 0.00us, max 854.00us cpu0/state1, 994 hits, total 9874827.00us, avg 9934.43us, min 30.00us, max 10346.00us cpu1/state0, 73 hits, total 17001.00us, avg 232.89us, min 0.00us, max 10040.00us cpu1/state1, 1002 hits, total 9883840.00us, avg 9864.11us, min 0.00us, max 10742.00us cluster/state0, 0 hits, total 0.00us, avg 0.00us, min 0.00us, max 0.00us cluster/state1, 1931 hits, total 9762328.00us, avg 5055.58us, min 30.00us, max 9308.00us
Without dynamic irq affinity: Log is 10.036834 secs long with 6574 events cpu0/state0, 114 hits, total 20107.00us, avg 176.38us, min 0.00us, max 7233.00us cpu0/state1, 1951 hits, total 9833836.00us, avg 5040.41us, min 0.00us, max 9217.00us cpu1/state0, 223 hits, total 21140.00us, avg 94.80us, min 0.00us, max 2960.00us cpu1/state1, 997 hits, total 9879748.00us, avg 9909.48us, min 0.00us, max 10346.00us cluster/state0, 5 hits, total 5462.00us, avg 1092.40us, min 580.00us, max 2899.00us cluster/state1, 2298 hits, total 9740988.00us, avg 4238.90us, min 30.00us, max 9217.00us
Results for the specific test case 'usleep 10000' * reduced by 40% the number of wake up on the system * reduced by 49% the number of wake up for CPU0 * increased by factor two idle time for CPU0 * increase by 16% package idle hits + 16% average package idle time
Changelog:
V2 : * mentioned CLOCK_EVT_FEAT_DYNIRQ flag name in patch description * added comments for CLOCK_EVT_FEAT_DYNIRQ * replaced tick_broadcast_set_affinity parameter to use a cpumask
V1 : initial post
Daniel Lezcano (3): time : pass broadcast parameter time : set broadcast irq affinity ARM: nomadik: add dynamic irq flag to the timer
Viresh Kumar (1): ARM: timer-sp: Set dynamic irq affinity
arch/arm/common/timer-sp.c | 3 ++- drivers/clocksource/nomadik-mtu.c | 3 ++- include/linux/clockchips.h | 5 +++++ kernel/time/tick-broadcast.c | 41 +++++++++++++++++++++++++++++-------- 4 files changed, 42 insertions(+), 10 deletions(-)
The broadcast timer could be passed as parameter to the function instead of using again tick_broadcast_device.evtdev which was previously used in the caller function.
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org --- kernel/time/tick-broadcast.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 2fb8cb8..6197ac0 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -406,10 +406,9 @@ struct cpumask *tick_get_broadcast_oneshot_mask(void) return to_cpumask(tick_broadcast_oneshot_mask); }
-static int tick_broadcast_set_event(ktime_t expires, int force) +static int tick_broadcast_set_event(struct clock_event_device *bc, + ktime_t expires, int force) { - struct clock_event_device *bc = tick_broadcast_device.evtdev; - if (bc->mode != CLOCK_EVT_MODE_ONESHOT) clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT);
@@ -479,7 +478,7 @@ again: * Rearm the broadcast device. If event expired, * repeat the above */ - if (tick_broadcast_set_event(next_event, 0)) + if (tick_broadcast_set_event(dev, next_event, 0)) goto again; } raw_spin_unlock(&tick_broadcast_lock); @@ -522,7 +521,7 @@ void tick_broadcast_oneshot_control(unsigned long reason) 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) - tick_broadcast_set_event(dev->next_event, 1); + tick_broadcast_set_event(bc, dev->next_event, 1); } } else { if (cpumask_test_cpu(cpu, tick_get_broadcast_oneshot_mask())) { @@ -591,7 +590,7 @@ void tick_broadcast_setup_oneshot(struct clock_event_device *bc) clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT); tick_broadcast_init_next_event(to_cpumask(tmpmask), tick_next_period); - tick_broadcast_set_event(tick_next_period, 1); + tick_broadcast_set_event(bc, tick_next_period, 1); } else bc->next_event.tv64 = KTIME_MAX; } else {
When a cpu goes to a deep idle state where its local timer is shutdown, it notifies the time frame work to use the broadcast timer instead.
Unfortunately, the broadcast device could wake up any CPU, including an idle one which is not concerned by the wake up at all.
This implies, in the worst case, an idle CPU will wake up to send an IPI to another idle cpu.
This patch solves this by setting the irq affinity to the cpu concerned by the nearest timer event, by this way, the CPU which is wake up is guarantee to be the one concerned by the next event and we are safe with unnecessary wakeup for another idle CPU.
As the irq affinity is not supported by all the archs, a flag is needed to specify which clocksource can handle it : CLOCK_EVT_FEAT_DYNIRQ
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org --- include/linux/clockchips.h | 5 +++++ kernel/time/tick-broadcast.c | 40 +++++++++++++++++++++++++++++++++------- 2 files changed, 38 insertions(+), 7 deletions(-)
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h index 6634652..c93e2a6 100644 --- a/include/linux/clockchips.h +++ b/include/linux/clockchips.h @@ -55,6 +55,11 @@ enum clock_event_nofitiers { #define CLOCK_EVT_FEAT_C3STOP 0x000008 #define CLOCK_EVT_FEAT_DUMMY 0x000010
+/* + * Clock event device can set its irq affinity dynamically + */ +#define CLOCK_EVT_FEAT_DYNIRQ 0x000020 + /** * struct clock_event_device - clock event device descriptor * @event_handler: Assigned by the framework to be called by the low diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 6197ac0..9ca8ff5 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -406,13 +406,37 @@ struct cpumask *tick_get_broadcast_oneshot_mask(void) return to_cpumask(tick_broadcast_oneshot_mask); }
-static int tick_broadcast_set_event(struct clock_event_device *bc, +/* + * Set broadcast interrupt affinity + */ +static void tick_broadcast_set_affinity(struct clock_event_device *bc, + const struct cpumask *cpumask) +{ + if (!(bc->features & CLOCK_EVT_FEAT_DYNIRQ)) + return; + + if (cpumask_equal(bc->cpumask, cpumask)) + return; + + bc->cpumask = cpumask; + irq_set_affinity(bc->irq, bc->cpumask); +} + +static int tick_broadcast_set_event(struct clock_event_device *bc, int cpu, ktime_t expires, int force) { + int ret; + if (bc->mode != CLOCK_EVT_MODE_ONESHOT) clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT);
- return clockevents_program_event(bc, expires, force); + ret = clockevents_program_event(bc, expires, force); + if (ret) + return ret; + + tick_broadcast_set_affinity(bc, cpumask_of(cpu)); + + return 0; }
int tick_resume_broadcast_oneshot(struct clock_event_device *bc) @@ -441,7 +465,7 @@ static void tick_handle_oneshot_broadcast(struct clock_event_device *dev) { struct tick_device *td; ktime_t now, next_event; - int cpu; + int cpu, next_cpu;
raw_spin_lock(&tick_broadcast_lock); again: @@ -454,8 +478,10 @@ again: td = &per_cpu(tick_cpu_device, cpu); if (td->evtdev->next_event.tv64 <= now.tv64) cpumask_set_cpu(cpu, to_cpumask(tmpmask)); - else if (td->evtdev->next_event.tv64 < next_event.tv64) + else if (td->evtdev->next_event.tv64 < next_event.tv64) { next_event.tv64 = td->evtdev->next_event.tv64; + next_cpu = cpu; + } }
/* @@ -478,7 +504,7 @@ again: * Rearm the broadcast device. If event expired, * repeat the above */ - if (tick_broadcast_set_event(dev, next_event, 0)) + if (tick_broadcast_set_event(dev, next_cpu, next_event, 0)) goto again; } raw_spin_unlock(&tick_broadcast_lock); @@ -521,7 +547,7 @@ void tick_broadcast_oneshot_control(unsigned long reason) 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) - tick_broadcast_set_event(bc, dev->next_event, 1); + tick_broadcast_set_event(bc, cpu, dev->next_event, 1); } } else { if (cpumask_test_cpu(cpu, tick_get_broadcast_oneshot_mask())) { @@ -590,7 +616,7 @@ void tick_broadcast_setup_oneshot(struct clock_event_device *bc) clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT); tick_broadcast_init_next_event(to_cpumask(tmpmask), tick_next_period); - tick_broadcast_set_event(bc, tick_next_period, 1); + tick_broadcast_set_event(bc, cpu, tick_next_period, 1); } else bc->next_event.tv64 = KTIME_MAX; } else {
On Sat, 2 Mar 2013, Daniel Lezcano wrote:
When a cpu goes to a deep idle state where its local timer is shutdown, it notifies the time frame work to use the broadcast timer instead.
Unfortunately, the broadcast device could wake up any CPU, including an idle one which is not concerned by the wake up at all.
This implies, in the worst case, an idle CPU will wake up to send an IPI to another idle cpu.
This patch solves this by setting the irq affinity to the cpu concerned by the nearest timer event, by this way, the CPU which is wake up is guarantee to be the one concerned by the next event and we are safe with unnecessary wakeup for another idle CPU.
As the irq affinity is not supported by all the archs, a flag is needed to specify which clocksource can handle it : CLOCK_EVT_FEAT_DYNIRQ
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org
include/linux/clockchips.h | 5 +++++ kernel/time/tick-broadcast.c | 40 +++++++++++++++++++++++++++++++++------- 2 files changed, 38 insertions(+), 7 deletions(-)
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h index 6634652..c93e2a6 100644 --- a/include/linux/clockchips.h +++ b/include/linux/clockchips.h @@ -55,6 +55,11 @@ enum clock_event_nofitiers { #define CLOCK_EVT_FEAT_C3STOP 0x000008 #define CLOCK_EVT_FEAT_DUMMY 0x000010 +/*
- Clock event device can set its irq affinity dynamically
- */
+#define CLOCK_EVT_FEAT_DYNIRQ 0x000020
/**
- struct clock_event_device - clock event device descriptor
- @event_handler: Assigned by the framework to be called by the low
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 6197ac0..9ca8ff5 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -406,13 +406,37 @@ struct cpumask *tick_get_broadcast_oneshot_mask(void) return to_cpumask(tick_broadcast_oneshot_mask); } -static int tick_broadcast_set_event(struct clock_event_device *bc, +/*
- Set broadcast interrupt affinity
- */
+static void tick_broadcast_set_affinity(struct clock_event_device *bc,
const struct cpumask *cpumask)
+{
- if (!(bc->features & CLOCK_EVT_FEAT_DYNIRQ))
return;
- if (cpumask_equal(bc->cpumask, cpumask))
return;
- bc->cpumask = cpumask;
This breaks with CONFIG_CPUMASK_OFFSTACK=y. cpumask_copy() is your friend!
Thanks,
tglx
On 03/05/2013 09:40 PM, Thomas Gleixner wrote:
On Sat, 2 Mar 2013, Daniel Lezcano wrote:
When a cpu goes to a deep idle state where its local timer is shutdown, it notifies the time frame work to use the broadcast timer instead.
Unfortunately, the broadcast device could wake up any CPU, including an idle one which is not concerned by the wake up at all.
This implies, in the worst case, an idle CPU will wake up to send an IPI to another idle cpu.
This patch solves this by setting the irq affinity to the cpu concerned by the nearest timer event, by this way, the CPU which is wake up is guarantee to be the one concerned by the next event and we are safe with unnecessary wakeup for another idle CPU.
As the irq affinity is not supported by all the archs, a flag is needed to specify which clocksource can handle it : CLOCK_EVT_FEAT_DYNIRQ
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org
include/linux/clockchips.h | 5 +++++ kernel/time/tick-broadcast.c | 40 +++++++++++++++++++++++++++++++++------- 2 files changed, 38 insertions(+), 7 deletions(-)
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h index 6634652..c93e2a6 100644 --- a/include/linux/clockchips.h +++ b/include/linux/clockchips.h @@ -55,6 +55,11 @@ enum clock_event_nofitiers { #define CLOCK_EVT_FEAT_C3STOP 0x000008 #define CLOCK_EVT_FEAT_DUMMY 0x000010 +/*
- Clock event device can set its irq affinity dynamically
- */
+#define CLOCK_EVT_FEAT_DYNIRQ 0x000020
/**
- struct clock_event_device - clock event device descriptor
- @event_handler: Assigned by the framework to be called by the low
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 6197ac0..9ca8ff5 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -406,13 +406,37 @@ struct cpumask *tick_get_broadcast_oneshot_mask(void) return to_cpumask(tick_broadcast_oneshot_mask); } -static int tick_broadcast_set_event(struct clock_event_device *bc, +/*
- Set broadcast interrupt affinity
- */
+static void tick_broadcast_set_affinity(struct clock_event_device *bc,
const struct cpumask *cpumask)
+{
- if (!(bc->features & CLOCK_EVT_FEAT_DYNIRQ))
return;
- if (cpumask_equal(bc->cpumask, cpumask))
return;
- bc->cpumask = cpumask;
This breaks with CONFIG_CPUMASK_OFFSTACK=y. cpumask_copy() is your friend!
This instruction copies the pointer, not the cpumask content.
bc->cpumask is defined as a const struct cpumask * and is used to copy a cpumask pointer not the content.
The cpumask parameter is a pointer to a global cpumask provided by the cpumask_of macro.
But to be in the safe side, I compiled tested with CONFIG_CPUMASK_OFFSTACK=y without problem.
Did I missed something ?
Thanks -- Daniel
-- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, 6 Mar 2013, Daniel Lezcano wrote:
On 03/05/2013 09:40 PM, Thomas Gleixner wrote:
On Sat, 2 Mar 2013, Daniel Lezcano wrote:
When a cpu goes to a deep idle state where its local timer is shutdown, it notifies the time frame work to use the broadcast timer instead.
Unfortunately, the broadcast device could wake up any CPU, including an idle one which is not concerned by the wake up at all.
This implies, in the worst case, an idle CPU will wake up to send an IPI to another idle cpu.
This patch solves this by setting the irq affinity to the cpu concerned by the nearest timer event, by this way, the CPU which is wake up is guarantee to be the one concerned by the next event and we are safe with unnecessary wakeup for another idle CPU.
As the irq affinity is not supported by all the archs, a flag is needed to specify which clocksource can handle it : CLOCK_EVT_FEAT_DYNIRQ
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org
include/linux/clockchips.h | 5 +++++ kernel/time/tick-broadcast.c | 40 +++++++++++++++++++++++++++++++++------- 2 files changed, 38 insertions(+), 7 deletions(-)
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h index 6634652..c93e2a6 100644 --- a/include/linux/clockchips.h +++ b/include/linux/clockchips.h @@ -55,6 +55,11 @@ enum clock_event_nofitiers { #define CLOCK_EVT_FEAT_C3STOP 0x000008 #define CLOCK_EVT_FEAT_DUMMY 0x000010 +/*
- Clock event device can set its irq affinity dynamically
- */
+#define CLOCK_EVT_FEAT_DYNIRQ 0x000020
/**
- struct clock_event_device - clock event device descriptor
- @event_handler: Assigned by the framework to be called by the low
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 6197ac0..9ca8ff5 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -406,13 +406,37 @@ struct cpumask *tick_get_broadcast_oneshot_mask(void) return to_cpumask(tick_broadcast_oneshot_mask); } -static int tick_broadcast_set_event(struct clock_event_device *bc, +/*
- Set broadcast interrupt affinity
- */
+static void tick_broadcast_set_affinity(struct clock_event_device *bc,
const struct cpumask *cpumask)
+{
- if (!(bc->features & CLOCK_EVT_FEAT_DYNIRQ))
return;
- if (cpumask_equal(bc->cpumask, cpumask))
return;
- bc->cpumask = cpumask;
This breaks with CONFIG_CPUMASK_OFFSTACK=y. cpumask_copy() is your friend!
This instruction copies the pointer, not the cpumask content.
bc->cpumask is defined as a const struct cpumask * and is used to copy a cpumask pointer not the content.
The cpumask parameter is a pointer to a global cpumask provided by the cpumask_of macro.
But to be in the safe side, I compiled tested with CONFIG_CPUMASK_OFFSTACK=y without problem.
Did I missed something ?
No, I misinterpreted the patch. Assigning a pointer is safe.
Thanks,
tglx
On 03/06/2013 10:48 AM, Thomas Gleixner wrote:
On Wed, 6 Mar 2013, Daniel Lezcano wrote:
On 03/05/2013 09:40 PM, Thomas Gleixner wrote:
On Sat, 2 Mar 2013, Daniel Lezcano wrote:
When a cpu goes to a deep idle state where its local timer is shutdown, it notifies the time frame work to use the broadcast timer instead.
Unfortunately, the broadcast device could wake up any CPU, including an idle one which is not concerned by the wake up at all.
This implies, in the worst case, an idle CPU will wake up to send an IPI to another idle cpu.
This patch solves this by setting the irq affinity to the cpu concerned by the nearest timer event, by this way, the CPU which is wake up is guarantee to be the one concerned by the next event and we are safe with unnecessary wakeup for another idle CPU.
As the irq affinity is not supported by all the archs, a flag is needed to specify which clocksource can handle it : CLOCK_EVT_FEAT_DYNIRQ
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org
include/linux/clockchips.h | 5 +++++ kernel/time/tick-broadcast.c | 40 +++++++++++++++++++++++++++++++++------- 2 files changed, 38 insertions(+), 7 deletions(-)
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h index 6634652..c93e2a6 100644 --- a/include/linux/clockchips.h +++ b/include/linux/clockchips.h @@ -55,6 +55,11 @@ enum clock_event_nofitiers { #define CLOCK_EVT_FEAT_C3STOP 0x000008 #define CLOCK_EVT_FEAT_DUMMY 0x000010 +/*
- Clock event device can set its irq affinity dynamically
- */
+#define CLOCK_EVT_FEAT_DYNIRQ 0x000020
/**
- struct clock_event_device - clock event device descriptor
- @event_handler: Assigned by the framework to be called by the low
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 6197ac0..9ca8ff5 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -406,13 +406,37 @@ struct cpumask *tick_get_broadcast_oneshot_mask(void) return to_cpumask(tick_broadcast_oneshot_mask); } -static int tick_broadcast_set_event(struct clock_event_device *bc, +/*
- Set broadcast interrupt affinity
- */
+static void tick_broadcast_set_affinity(struct clock_event_device *bc,
const struct cpumask *cpumask)
+{
- if (!(bc->features & CLOCK_EVT_FEAT_DYNIRQ))
return;
- if (cpumask_equal(bc->cpumask, cpumask))
return;
- bc->cpumask = cpumask;
This breaks with CONFIG_CPUMASK_OFFSTACK=y. cpumask_copy() is your friend!
This instruction copies the pointer, not the cpumask content.
bc->cpumask is defined as a const struct cpumask * and is used to copy a cpumask pointer not the content.
The cpumask parameter is a pointer to a global cpumask provided by the cpumask_of macro.
But to be in the safe side, I compiled tested with CONFIG_CPUMASK_OFFSTACK=y without problem.
Did I missed something ?
No, I misinterpreted the patch. Assigning a pointer is safe.
Ok, thanks anyway for reviewing the patch.
Do you think it is acceptable for upstreaming ?
-- Daniel
http://www.linaro.org/ Linaro.org │ Open source software for ARM SoCs
Follow Linaro: http://www.facebook.com/pages/Linaro Facebook | http://twitter.com/#!/linaroorg Twitter | http://www.linaro.org/linaro-blog/ Blog
On 03/06/2013 10:48 AM, Thomas Gleixner wrote:
On Wed, 6 Mar 2013, Daniel Lezcano wrote:
On 03/05/2013 09:40 PM, Thomas Gleixner wrote:
On Sat, 2 Mar 2013, Daniel Lezcano wrote:
When a cpu goes to a deep idle state where its local timer is shutdown, it notifies the time frame work to use the broadcast timer instead.
Unfortunately, the broadcast device could wake up any CPU, including an idle one which is not concerned by the wake up at all.
This implies, in the worst case, an idle CPU will wake up to send an IPI to another idle cpu.
This patch solves this by setting the irq affinity to the cpu concerned by the nearest timer event, by this way, the CPU which is wake up is guarantee to be the one concerned by the next event and we are safe with unnecessary wakeup for another idle CPU.
As the irq affinity is not supported by all the archs, a flag is needed to specify which clocksource can handle it : CLOCK_EVT_FEAT_DYNIRQ
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org
include/linux/clockchips.h | 5 +++++ kernel/time/tick-broadcast.c | 40 +++++++++++++++++++++++++++++++++------- 2 files changed, 38 insertions(+), 7 deletions(-)
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h index 6634652..c93e2a6 100644 --- a/include/linux/clockchips.h +++ b/include/linux/clockchips.h @@ -55,6 +55,11 @@ enum clock_event_nofitiers { #define CLOCK_EVT_FEAT_C3STOP 0x000008 #define CLOCK_EVT_FEAT_DUMMY 0x000010 +/*
- Clock event device can set its irq affinity dynamically
- */
+#define CLOCK_EVT_FEAT_DYNIRQ 0x000020
/**
- struct clock_event_device - clock event device descriptor
- @event_handler: Assigned by the framework to be called by the low
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 6197ac0..9ca8ff5 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -406,13 +406,37 @@ struct cpumask *tick_get_broadcast_oneshot_mask(void) return to_cpumask(tick_broadcast_oneshot_mask); } -static int tick_broadcast_set_event(struct clock_event_device *bc, +/*
- Set broadcast interrupt affinity
- */
+static void tick_broadcast_set_affinity(struct clock_event_device *bc,
const struct cpumask *cpumask)
+{
- if (!(bc->features & CLOCK_EVT_FEAT_DYNIRQ))
return;
- if (cpumask_equal(bc->cpumask, cpumask))
return;
- bc->cpumask = cpumask;
This breaks with CONFIG_CPUMASK_OFFSTACK=y. cpumask_copy() is your friend!
This instruction copies the pointer, not the cpumask content.
bc->cpumask is defined as a const struct cpumask * and is used to copy a cpumask pointer not the content.
The cpumask parameter is a pointer to a global cpumask provided by the cpumask_of macro.
But to be in the safe side, I compiled tested with CONFIG_CPUMASK_OFFSTACK=y without problem.
Hi Thomas,
thanks for merging the patch 1 and 2.
I was wondering if it would be possible to take the 3/4 and 4/4 otherwise the flag dependency will prevent to send those to the maintainer's tree until they gain visibility on it.
On Fri, 8 Mar 2013, Daniel Lezcano wrote:
On 03/06/2013 10:48 AM, Thomas Gleixner wrote: I was wondering if it would be possible to take the 3/4 and 4/4 otherwise the flag dependency will prevent to send those to the maintainer's tree until they gain visibility on it.
I can take them with the ack of arm soc folks.
Thanks,
tglx
On Friday 08 March 2013, Thomas Gleixner wrote:
On Fri, 8 Mar 2013, Daniel Lezcano wrote:
On 03/06/2013 10:48 AM, Thomas Gleixner wrote: I was wondering if it would be possible to take the 3/4 and 4/4 otherwise the flag dependency will prevent to send those to the maintainer's tree until they gain visibility on it.
I can take them with the ack of arm soc folks.
Sounds good,
Acked-by: Arnd Bergmann arnd@arndb.de
Add the dynamic irq affinity feature to the timer clock device.
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org Reviewed-by: Vincent Guittot vincent.guittot@linaro.org Acked-by: Rickard Andersson rickard.andersson@stericsson.com --- drivers/clocksource/nomadik-mtu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/clocksource/nomadik-mtu.c b/drivers/clocksource/nomadik-mtu.c index 7cbcaa0..73dc540 100644 --- a/drivers/clocksource/nomadik-mtu.c +++ b/drivers/clocksource/nomadik-mtu.c @@ -136,7 +136,8 @@ static void nmdk_clkevt_mode(enum clock_event_mode mode,
static struct clock_event_device nmdk_clkevt = { .name = "mtu_1", - .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC, + .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC | + CLOCK_EVT_FEAT_DYNIRQ, .rating = 200, .set_mode = nmdk_clkevt_mode, .set_next_event = nmdk_clkevt_next,
From: Viresh Kumar viresh.kumar@linaro.org
When a cpu goes to a deep idle state where its local timer is shutdown, it notifies the time frame work to use the broadcast timer instead.
Unfortunately, the broadcast device could wake up any CPU, including an idle one which is not concerned by the wake up at all.
This implies, in the worst case, an idle CPU will wake up to send an IPI to another idle cpu.
This patch fixes this for ARM platforms using timer-sp, by setting CLOCK_EVT_FEAT_DYNIRQ feature.
Signed-off-by: Viresh Kumar viresh.kumar@linaro.org Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org --- arch/arm/common/timer-sp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c index 9d2d3ba..ae3c0f9 100644 --- a/arch/arm/common/timer-sp.c +++ b/arch/arm/common/timer-sp.c @@ -158,7 +158,8 @@ static int sp804_set_next_event(unsigned long next, }
static struct clock_event_device sp804_clockevent = { - .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, + .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT | + CLOCK_EVT_FEAT_DYNIRQ, .set_mode = sp804_set_mode, .set_next_event = sp804_set_next_event, .rating = 300,
On 03/02/2013 11:10 AM, Daniel Lezcano wrote:
From: Viresh Kumar viresh.kumar@linaro.org
When a cpu goes to a deep idle state where its local timer is shutdown, it notifies the time frame work to use the broadcast timer instead.
Unfortunately, the broadcast device could wake up any CPU, including an idle one which is not concerned by the wake up at all.
This implies, in the worst case, an idle CPU will wake up to send an IPI to another idle cpu.
This patch fixes this for ARM platforms using timer-sp, by setting CLOCK_EVT_FEAT_DYNIRQ feature.
Signed-off-by: Viresh Kumar viresh.kumar@linaro.org Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org
Hi Russell,
I asked Thomas if he could take this patch in its tree but it falls under your umbrella. Thomas agreed to take it if you ack this patch.
Is this patch acceptable for you ?
Thanks in advance -- Daniel
arch/arm/common/timer-sp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c index 9d2d3ba..ae3c0f9 100644 --- a/arch/arm/common/timer-sp.c +++ b/arch/arm/common/timer-sp.c @@ -158,7 +158,8 @@ static int sp804_set_next_event(unsigned long next, } static struct clock_event_device sp804_clockevent = {
- .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
- .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT |
.set_mode = sp804_set_mode, .set_next_event = sp804_set_next_event, .rating = 300,CLOCK_EVT_FEAT_DYNIRQ,
On Fri, Mar 08, 2013 at 04:28:55PM +0100, Daniel Lezcano wrote:
On 03/02/2013 11:10 AM, Daniel Lezcano wrote:
From: Viresh Kumar viresh.kumar@linaro.org
When a cpu goes to a deep idle state where its local timer is shutdown, it notifies the time frame work to use the broadcast timer instead.
Unfortunately, the broadcast device could wake up any CPU, including an idle one which is not concerned by the wake up at all.
This implies, in the worst case, an idle CPU will wake up to send an IPI to another idle cpu.
This patch fixes this for ARM platforms using timer-sp, by setting CLOCK_EVT_FEAT_DYNIRQ feature.
Signed-off-by: Viresh Kumar viresh.kumar@linaro.org Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org
Hi Russell,
I asked Thomas if he could take this patch in its tree but it falls under your umbrella. Thomas agreed to take it if you ack this patch.
Is this patch acceptable for you ?
It's simple enough.
Acked-by: Russell King rmk+kernel@arm.linux.org.uk
Add the dynamic irq affinity feature to the timer clock device.
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org Reviewed-by: Vincent Guittot vincent.guittot@linaro.org Acked-by: Rickard Andersson rickard.andersson@stericsson.com
Hi Linus,
AFAIU, you are ok with this patch, Rickard acked it and Vincent reviewed it.
Thomas agreed to merge it into its tree as I requested because we will need to wait for your tree to gain visibility to this new flag before submitting this patch, which can take awhile.
Could you please ack it if it is ok for you ?
Thanks -- Daniel
drivers/clocksource/nomadik-mtu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/clocksource/nomadik-mtu.c b/drivers/clocksource/nomadik-mtu.c index 7cbcaa0..73dc540 100644 --- a/drivers/clocksource/nomadik-mtu.c +++ b/drivers/clocksource/nomadik-mtu.c @@ -136,7 +136,8 @@ static void nmdk_clkevt_mode(enum clock_event_mode mode, static struct clock_event_device nmdk_clkevt = { .name = "mtu_1",
- .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
- .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC |
.rating = 200, .set_mode = nmdk_clkevt_mode, .set_next_event = nmdk_clkevt_next,CLOCK_EVT_FEAT_DYNIRQ,
-- 1.7.9.5
On Fri, 8 Mar 2013, Daniel Lezcano wrote:
Add the dynamic irq affinity feature to the timer clock device.
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org Reviewed-by: Vincent Guittot vincent.guittot@linaro.org Acked-by: Rickard Andersson rickard.andersson@stericsson.com
Hi Linus,
AFAIU, you are ok with this patch, Rickard acked it and Vincent reviewed it.
Thomas agreed to merge it into its tree as I requested because we will need to wait for your tree to gain visibility to this new flag before submitting this patch, which can take awhile.
Could you please ack it if it is ok for you ?
I can provide a for-arm tree to pull as well. Either way fine with me.
Thanks,
tglx
On 03/08/2013 05:03 PM, Thomas Gleixner wrote:
On Fri, 8 Mar 2013, Daniel Lezcano wrote:
Add the dynamic irq affinity feature to the timer clock device.
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org Reviewed-by: Vincent Guittot vincent.guittot@linaro.org Acked-by: Rickard Andersson rickard.andersson@stericsson.com
Hi Linus,
AFAIU, you are ok with this patch, Rickard acked it and Vincent reviewed it.
Thomas agreed to merge it into its tree as I requested because we will need to wait for your tree to gain visibility to this new flag before submitting this patch, which can take awhile.
Could you please ack it if it is ok for you ?
I can provide a for-arm tree to pull as well. Either way fine with me.
Hi Thomas,
the patch 3/4 and 4/4 have been acked-by the different maintainers.
I saw you created a 'for-arm' branch (thanks), but the patches 3/4 and 4/4 aren't there. Did I missed something ?
Thanks -- Daniel
On Fri, Mar 8, 2013 at 4:17 PM, Daniel Lezcano daniel.lezcano@linaro.org wrote:
Add the dynamic irq affinity feature to the timer clock device.
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org Reviewed-by: Vincent Guittot vincent.guittot@linaro.org Acked-by: Rickard Andersson rickard.andersson@stericsson.com
Hi Linus,
AFAIU, you are ok with this patch, Rickard acked it and Vincent reviewed it.
Thomas agreed to merge it into its tree as I requested because we will need to wait for your tree to gain visibility to this new flag before submitting this patch, which can take awhile.
Could you please ack it if it is ok for you ?
Oh of course! Acked-by: Linus Walleij linus.walleij@linaro.org
Yours, Linus Walleij
linaro-kernel@lists.linaro.org