Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1480334
| From | Nicolai Stange <nicstange@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [RFC v6 17/23] clockevents: use ->min_delta_ticks_adjusted to program minimum delta |
| Date | 2016-09-09 22:30 +0200 |
| Message-ID | <sfAAV-7Cd-3@gated-at.bofh.it> (permalink) |
| References | <sfAhA-7rj-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
The use of a clockevent device's ->min_delta_ns in the event programming
path hinders upcoming changes to the clockevent core making it NTP
correction aware: both, ->mult and ->min_delta_ns would need to get
updated as well as consumed atomically and we'd rather like to avoid any
locking here.
We already have got ->min_delta_ticks_adjusted which
- resembles the value of ->min_delta_ns
- and is guaranteed to be always >= the hardware's hard limit
->min_delta_ticks and thus, can be used w/o locking as we don't care
for small deviations.
In both implementations of clockevents_program_min_delta(),
don't calculate the event's deadline from ->min_delta_ns, but use its
drop-in replacement ->min_delta_ticks_adjusted.
Signed-off-by: Nicolai Stange <nicstange@gmail.com>
---
kernel/time/clockevents.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 8983fee..aa7b325 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -246,19 +246,14 @@ static int clockevents_increase_min_delta(struct clock_event_device *dev)
*/
static int clockevents_program_min_delta(struct clock_event_device *dev)
{
- unsigned long long clc;
- int64_t delta;
int i;
for (i = 0;;) {
- delta = dev->min_delta_ns;
-
if (clockevent_state_shutdown(dev))
return 0;
dev->retries++;
- clc = ((unsigned long long) delta * dev->mult) >> dev->shift;
- if (dev->set_next_event((unsigned long) clc, dev) == 0)
+ if (!dev->set_next_event(dev->min_delta_ticks_adjusted, dev))
return 0;
if (++i > 2) {
@@ -284,17 +279,11 @@ static int clockevents_program_min_delta(struct clock_event_device *dev)
*/
static int clockevents_program_min_delta(struct clock_event_device *dev)
{
- unsigned long long clc;
- int64_t delta;
-
- delta = dev->min_delta_ns;
-
if (clockevent_state_shutdown(dev))
return 0;
dev->retries++;
- clc = ((unsigned long long) delta * dev->mult) >> dev->shift;
- return dev->set_next_event((unsigned long) clc, dev);
+ return dev->set_next_event(dev->min_delta_ticks_adjusted, dev);
}
#endif /* CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST */
--
2.9.3
Back to linux.kernel | Previous | Next — Previous 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