Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1480324
| From | Nicolai Stange <nicstange@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [RFC v6 22/23] clockevents: make setting of ->mult and ->mult_adjusted atomic |
| Date | 2016-09-09 22:20 +0200 |
| Message-ID | <sfArg-7zf-15@gated-at.bofh.it> (permalink) |
| References | <sfAhA-7rj-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
In order to avoid races between setting a struct clock_event_device's ->mult_adjusted in clockevents_update_freq() and yet to be implemented updates triggered from the timekeeping core, the setting of ->mult and ->mult_adjusted should be made atomic. Protect the update in clockevents_update_freq() by locking the clockevents_lock spinlock. Frequency updates are expected to be done seldomly and thus, taking this subsystem lock should not have any impact on performance. Note that the call to tick_broadcast_update_freq() is also protected by this clockevents_lock and thus, this patch can take the tick_broadcast_lock with the clockevents_lock being held. However, this is supposed to be safe since the sequence __clockevents_unbind() -> clockevents_replace() -> tick_install_replacement() -> tick_setup_device() -> tick_device_uses_broadcast() already does this, too. Signed-off-by: Nicolai Stange <nicstange@gmail.com> --- kernel/time/clockevents.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index 67d572e..b121932 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c @@ -658,11 +658,11 @@ int clockevents_update_freq(struct clock_event_device *dev, u32 freq) unsigned long flags; int ret; - local_irq_save(flags); + raw_spin_lock_irqsave(&clockevents_lock, flags); ret = tick_broadcast_update_freq(dev, freq); if (ret == -ENODEV) ret = __clockevents_update_freq(dev, freq); - local_irq_restore(flags); + raw_spin_unlock_irqrestore(&clockevents_lock, flags); return ret; } -- 2.9.3
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC v6 00/23] adapt clockevents frequencies to mono clock Nicolai Stange <nicstange@gmail.com> - 2016-09-09 22:10 +0200 [RFC v6 07/23] many clockevent drivers: set ->min_delta_ticks and ->max_delta_ticks Nicolai Stange <nicstange@gmail.com> - 2016-09-09 22:10 +0200 [RFC v6 04/23] clocksource: em_sti: compute rate before registration Nicolai Stange <nicstange@gmail.com> - 2016-09-09 22:10 +0200 [RFC v6 19/23] timer_list: print_tickdevice(): calculate ->min_delta_ns dynamically Nicolai Stange <nicstange@gmail.com> - 2016-09-09 22:20 +0200 [RFC v6 22/23] clockevents: make setting of ->mult and ->mult_adjusted atomic Nicolai Stange <nicstange@gmail.com> - 2016-09-09 22:20 +0200 [RFC v6 18/23] clockevents: min delta increment: calculate min_delta_ns from ticks Nicolai Stange <nicstange@gmail.com> - 2016-09-09 22:20 +0200 [RFC v6 21/23] clockevents: initial support for mono to raw time conversion Nicolai Stange <nicstange@gmail.com> - 2016-09-09 22:20 +0200 [RFC v6 20/23] clockevents: purge ->min_delta_ns Nicolai Stange <nicstange@gmail.com> - 2016-09-09 22:20 +0200 [RFC v6 23/23] timekeeping: inform clockevents about freq adjustments Nicolai Stange <nicstange@gmail.com> - 2016-09-09 22:20 +0200 [RFC v6 16/23] clockevents: clockevents_program_min_delta(): don't set ->next_event Nicolai Stange <nicstange@gmail.com> - 2016-09-09 22:20 +0200 [RFC v6 17/23] clockevents: use ->min_delta_ticks_adjusted to program minimum delta Nicolai Stange <nicstange@gmail.com> - 2016-09-09 22:30 +0200
csiph-web