Commit 44afa9a4 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'timers-fixes-for-linus' of...

Merge branch 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  clockevent: Prevent dead lock on clockevents_lock
  timers: Drop write permission on /proc/timer_list
parents 7d63e635 f833bab8
...@@ -519,16 +519,12 @@ static void c1e_idle(void) ...@@ -519,16 +519,12 @@ static void c1e_idle(void)
if (!cpumask_test_cpu(cpu, c1e_mask)) { if (!cpumask_test_cpu(cpu, c1e_mask)) {
cpumask_set_cpu(cpu, c1e_mask); cpumask_set_cpu(cpu, c1e_mask);
/* /*
* Force broadcast so ACPI can not interfere. Needs * Force broadcast so ACPI can not interfere.
* to run with interrupts enabled as it uses
* smp_function_call.
*/ */
local_irq_enable();
clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_FORCE, clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_FORCE,
&cpu); &cpu);
printk(KERN_INFO "Switch to broadcast mode on CPU%d\n", printk(KERN_INFO "Switch to broadcast mode on CPU%d\n",
cpu); cpu);
local_irq_disable();
} }
clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu); clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu);
......
...@@ -162,8 +162,9 @@ static void lapic_timer_check_state(int state, struct acpi_processor *pr, ...@@ -162,8 +162,9 @@ static void lapic_timer_check_state(int state, struct acpi_processor *pr,
pr->power.timer_broadcast_on_state = state; pr->power.timer_broadcast_on_state = state;
} }
static void lapic_timer_propagate_broadcast(struct acpi_processor *pr) static void lapic_timer_propagate_broadcast(void *arg)
{ {
struct acpi_processor *pr = (struct acpi_processor *) arg;
unsigned long reason; unsigned long reason;
reason = pr->power.timer_broadcast_on_state < INT_MAX ? reason = pr->power.timer_broadcast_on_state < INT_MAX ?
...@@ -635,7 +636,8 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) ...@@ -635,7 +636,8 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
working++; working++;
} }
lapic_timer_propagate_broadcast(pr); smp_call_function_single(pr->id, lapic_timer_propagate_broadcast,
pr, 1);
return (working); return (working);
} }
......
...@@ -137,11 +137,12 @@ int clockevents_program_event(struct clock_event_device *dev, ktime_t expires, ...@@ -137,11 +137,12 @@ int clockevents_program_event(struct clock_event_device *dev, ktime_t expires,
*/ */
int clockevents_register_notifier(struct notifier_block *nb) int clockevents_register_notifier(struct notifier_block *nb)
{ {
unsigned long flags;
int ret; int ret;
spin_lock(&clockevents_lock); spin_lock_irqsave(&clockevents_lock, flags);
ret = raw_notifier_chain_register(&clockevents_chain, nb); ret = raw_notifier_chain_register(&clockevents_chain, nb);
spin_unlock(&clockevents_lock); spin_unlock_irqrestore(&clockevents_lock, flags);
return ret; return ret;
} }
...@@ -178,16 +179,18 @@ static void clockevents_notify_released(void) ...@@ -178,16 +179,18 @@ static void clockevents_notify_released(void)
*/ */
void clockevents_register_device(struct clock_event_device *dev) void clockevents_register_device(struct clock_event_device *dev)
{ {
unsigned long flags;
BUG_ON(dev->mode != CLOCK_EVT_MODE_UNUSED); BUG_ON(dev->mode != CLOCK_EVT_MODE_UNUSED);
BUG_ON(!dev->cpumask); BUG_ON(!dev->cpumask);
spin_lock(&clockevents_lock); spin_lock_irqsave(&clockevents_lock, flags);
list_add(&dev->list, &clockevent_devices); list_add(&dev->list, &clockevent_devices);
clockevents_do_notify(CLOCK_EVT_NOTIFY_ADD, dev); clockevents_do_notify(CLOCK_EVT_NOTIFY_ADD, dev);
clockevents_notify_released(); clockevents_notify_released();
spin_unlock(&clockevents_lock); spin_unlock_irqrestore(&clockevents_lock, flags);
} }
EXPORT_SYMBOL_GPL(clockevents_register_device); EXPORT_SYMBOL_GPL(clockevents_register_device);
...@@ -235,8 +238,9 @@ void clockevents_exchange_device(struct clock_event_device *old, ...@@ -235,8 +238,9 @@ void clockevents_exchange_device(struct clock_event_device *old,
void clockevents_notify(unsigned long reason, void *arg) void clockevents_notify(unsigned long reason, void *arg)
{ {
struct list_head *node, *tmp; struct list_head *node, *tmp;
unsigned long flags;
spin_lock(&clockevents_lock); spin_lock_irqsave(&clockevents_lock, flags);
clockevents_do_notify(reason, arg); clockevents_do_notify(reason, arg);
switch (reason) { switch (reason) {
...@@ -251,7 +255,7 @@ void clockevents_notify(unsigned long reason, void *arg) ...@@ -251,7 +255,7 @@ void clockevents_notify(unsigned long reason, void *arg)
default: default:
break; break;
} }
spin_unlock(&clockevents_lock); spin_unlock_irqrestore(&clockevents_lock, flags);
} }
EXPORT_SYMBOL_GPL(clockevents_notify); EXPORT_SYMBOL_GPL(clockevents_notify);
#endif #endif
...@@ -205,11 +205,11 @@ static void tick_handle_periodic_broadcast(struct clock_event_device *dev) ...@@ -205,11 +205,11 @@ static void tick_handle_periodic_broadcast(struct clock_event_device *dev)
* Powerstate information: The system enters/leaves a state, where * Powerstate information: The system enters/leaves a state, where
* affected devices might stop * affected devices might stop
*/ */
static void tick_do_broadcast_on_off(void *why) static void tick_do_broadcast_on_off(unsigned long *reason)
{ {
struct clock_event_device *bc, *dev; struct clock_event_device *bc, *dev;
struct tick_device *td; struct tick_device *td;
unsigned long flags, *reason = why; unsigned long flags;
int cpu, bc_stopped; int cpu, bc_stopped;
spin_lock_irqsave(&tick_broadcast_lock, flags); spin_lock_irqsave(&tick_broadcast_lock, flags);
...@@ -276,8 +276,7 @@ void tick_broadcast_on_off(unsigned long reason, int *oncpu) ...@@ -276,8 +276,7 @@ void tick_broadcast_on_off(unsigned long reason, int *oncpu)
printk(KERN_ERR "tick-broadcast: ignoring broadcast for " printk(KERN_ERR "tick-broadcast: ignoring broadcast for "
"offline CPU #%d\n", *oncpu); "offline CPU #%d\n", *oncpu);
else else
smp_call_function_single(*oncpu, tick_do_broadcast_on_off, tick_do_broadcast_on_off(&reason);
&reason, 1);
} }
/* /*
......
...@@ -286,7 +286,7 @@ static int __init init_timer_list_procfs(void) ...@@ -286,7 +286,7 @@ static int __init init_timer_list_procfs(void)
{ {
struct proc_dir_entry *pe; struct proc_dir_entry *pe;
pe = proc_create("timer_list", 0644, NULL, &timer_list_fops); pe = proc_create("timer_list", 0444, NULL, &timer_list_fops);
if (!pe) if (!pe)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment