Commit e602e700 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull timer fixes from Thomas Gleixner:
 "Two small fixes::

   - Prevent deadlock on the tick broadcast lock. Found and fixed by
     Mike.

   - Stop using printk() in the timekeeping debug code to prevent a
     deadlock against the scheduler"

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  timekeeping: Use deferred printk() in debug code
  tick/broadcast: Prevent deadlock on tick_broadcast_lock
parents 3dd9c127 f222449c
...@@ -347,17 +347,16 @@ static void tick_handle_periodic_broadcast(struct clock_event_device *dev) ...@@ -347,17 +347,16 @@ static void tick_handle_periodic_broadcast(struct clock_event_device *dev)
* *
* Called when the system enters a state where affected tick devices * Called when the system enters a state where affected tick devices
* might stop. Note: TICK_BROADCAST_FORCE cannot be undone. * might stop. Note: TICK_BROADCAST_FORCE cannot be undone.
*
* Called with interrupts disabled, so clockevents_lock is not
* required here because the local clock event device cannot go away
* under us.
*/ */
void tick_broadcast_control(enum tick_broadcast_mode mode) void tick_broadcast_control(enum tick_broadcast_mode mode)
{ {
struct clock_event_device *bc, *dev; struct clock_event_device *bc, *dev;
struct tick_device *td; struct tick_device *td;
int cpu, bc_stopped; int cpu, bc_stopped;
unsigned long flags;
/* Protects also the local clockevent device. */
raw_spin_lock_irqsave(&tick_broadcast_lock, flags);
td = this_cpu_ptr(&tick_cpu_device); td = this_cpu_ptr(&tick_cpu_device);
dev = td->evtdev; dev = td->evtdev;
...@@ -365,12 +364,11 @@ void tick_broadcast_control(enum tick_broadcast_mode mode) ...@@ -365,12 +364,11 @@ void tick_broadcast_control(enum tick_broadcast_mode mode)
* Is the device not affected by the powerstate ? * Is the device not affected by the powerstate ?
*/ */
if (!dev || !(dev->features & CLOCK_EVT_FEAT_C3STOP)) if (!dev || !(dev->features & CLOCK_EVT_FEAT_C3STOP))
return; goto out;
if (!tick_device_is_functional(dev)) if (!tick_device_is_functional(dev))
return; goto out;
raw_spin_lock(&tick_broadcast_lock);
cpu = smp_processor_id(); cpu = smp_processor_id();
bc = tick_broadcast_device.evtdev; bc = tick_broadcast_device.evtdev;
bc_stopped = cpumask_empty(tick_broadcast_mask); bc_stopped = cpumask_empty(tick_broadcast_mask);
...@@ -420,7 +418,8 @@ void tick_broadcast_control(enum tick_broadcast_mode mode) ...@@ -420,7 +418,8 @@ void tick_broadcast_control(enum tick_broadcast_mode mode)
tick_broadcast_setup_oneshot(bc); tick_broadcast_setup_oneshot(bc);
} }
} }
raw_spin_unlock(&tick_broadcast_lock); out:
raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags);
} }
EXPORT_SYMBOL_GPL(tick_broadcast_control); EXPORT_SYMBOL_GPL(tick_broadcast_control);
......
...@@ -75,7 +75,7 @@ void tk_debug_account_sleep_time(struct timespec64 *t) ...@@ -75,7 +75,7 @@ void tk_debug_account_sleep_time(struct timespec64 *t)
int bin = min(fls(t->tv_sec), NUM_BINS-1); int bin = min(fls(t->tv_sec), NUM_BINS-1);
sleep_time_bin[bin]++; sleep_time_bin[bin]++;
pr_info("Suspended for %lld.%03lu seconds\n", (s64)t->tv_sec, printk_deferred(KERN_INFO "Suspended for %lld.%03lu seconds\n",
t->tv_nsec / NSEC_PER_MSEC); (s64)t->tv_sec, t->tv_nsec / NSEC_PER_MSEC);
} }
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