Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull core timer updates from Thomas Gleixner:
"Timers and timekeeping updates:
- A large overhaul of the posix CPU timer code which is a preparation
for moving the CPU timer expiry out into task work so it can be
properly accounted on the task/process.
An update to the bogus permission checks will come later during the
merge window as feedback was not complete before heading of for
travel.
- Switch the timerqueue code to use cached rbtrees and get rid of the
homebrewn caching of the leftmost node.
- Consolidate hrtimer_init() + hrtimer_init_sleeper() calls into a
single function
- Implement the separation of hrtimers to be forced to expire in hard
interrupt context even when PREEMPT_RT is enabled and mark the
affected timers accordingly.
- Implement a mechanism for hrtimers and the timer wheel to protect
RT against priority inversion and live lock issues when a (hr)timer
which should be canceled is currently executing the callback.
Instead of infinitely spinning, the task which tries to cancel the
timer blocks on a per cpu base expiry lock which is held and
released by the (hr)timer expiry code.
- Enable the Hyper-V TSC page based sched_clock for Hyper-V guests
resulting in faster access to timekeeping functions.
- Updates to various clocksource/clockevent drivers and their device
tree bindings.
- The usual small improvements all over the place"
* 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (101 commits)
posix-cpu-timers: Fix permission check regression
posix-cpu-timers: Always clear head pointer on dequeue
hrtimer: Add a missing bracket and hide `migration_base' on !SMP
posix-cpu-timers: Make expiry_active check actually work correctly
posix-timers: Unbreak CONFIG_POSIX_TIMERS=n build
tick: Mark sched_timer to expire in hard interrupt context
hrtimer: Add kernel doc annotation for HRTIMER_MODE_HARD
x86/hyperv: Hide pv_ops access for CONFIG_PARAVIRT=n
posix-cpu-timers: Utilize timerqueue for storage
posix-cpu-timers: Move state tracking to struct posix_cputimers
posix-cpu-timers: Deduplicate rlimit handling
posix-cpu-timers: Remove pointless comparisons
posix-cpu-timers: Get rid of 64bit divisions
posix-cpu-timers: Consolidate timer expiry further
posix-cpu-timers: Get rid of zero checks
rlimit: Rewrite non-sensical RLIMIT_CPU comment
posix-cpu-timers: Respect INFINITY for hard RTTIME limit
posix-cpu-timers: Switch thread group sampling to array
posix-cpu-timers: Restructure expiry array
posix-cpu-timers: Remove cputime_expires
...
This commit is contained in:
@@ -432,7 +432,7 @@ int alarm_cancel(struct alarm *alarm)
|
||||
int ret = alarm_try_to_cancel(alarm);
|
||||
if (ret >= 0)
|
||||
return ret;
|
||||
cpu_relax();
|
||||
hrtimer_cancel_wait_running(&alarm->timer);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(alarm_cancel);
|
||||
@@ -605,6 +605,19 @@ static int alarm_timer_try_to_cancel(struct k_itimer *timr)
|
||||
return alarm_try_to_cancel(&timr->it.alarm.alarmtimer);
|
||||
}
|
||||
|
||||
/**
|
||||
* alarm_timer_wait_running - Posix timer callback to wait for a timer
|
||||
* @timr: Pointer to the posixtimer data struct
|
||||
*
|
||||
* Called from the core code when timer cancel detected that the callback
|
||||
* is running. @timr is unlocked and rcu read lock is held to prevent it
|
||||
* from being freed.
|
||||
*/
|
||||
static void alarm_timer_wait_running(struct k_itimer *timr)
|
||||
{
|
||||
hrtimer_cancel_wait_running(&timr->it.alarm.alarmtimer.timer);
|
||||
}
|
||||
|
||||
/**
|
||||
* alarm_timer_arm - Posix timer callback to arm a timer
|
||||
* @timr: Pointer to the posixtimer data struct
|
||||
@@ -834,6 +847,7 @@ const struct k_clock alarm_clock = {
|
||||
.timer_forward = alarm_timer_forward,
|
||||
.timer_remaining = alarm_timer_remaining,
|
||||
.timer_try_to_cancel = alarm_timer_try_to_cancel,
|
||||
.timer_wait_running = alarm_timer_wait_running,
|
||||
.nsleep = alarm_timer_nsleep,
|
||||
};
|
||||
#endif /* CONFIG_POSIX_TIMERS */
|
||||
|
||||
Reference in New Issue
Block a user