diff options
author | Paul Gortmaker <paul.gortmaker@windriver.com> | 2017-10-02 10:30:02 -0400 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2017-10-02 10:30:02 -0400 |
commit | 3a6bcfe1c5cff7887b340f613880ead967790348 (patch) | |
tree | 0028e651a749d86fa237bf6aace73b94f67148d9 | |
parent | fd467520cdbcd355e4f499edd575f37d3adfd75d (diff) | |
download | 4.12-rt-patches-3a6bcfe1c5cff7887b340f613880ead967790348.tar.gz |
refresh hrtimers-prepare-full-preemption.patch
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r-- | patches/hrtimers-prepare-full-preemption.patch | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/patches/hrtimers-prepare-full-preemption.patch b/patches/hrtimers-prepare-full-preemption.patch index 91b349cf821026..e5039c523699c7 100644 --- a/patches/hrtimers-prepare-full-preemption.patch +++ b/patches/hrtimers-prepare-full-preemption.patch @@ -1,6 +1,7 @@ +From 950680b1d7b6d31c07a15fefb32df89477b9122c Mon Sep 17 00:00:00 2001 From: Ingo Molnar <mingo@elte.hu> Date: Fri, 3 Jul 2009 08:29:34 -0500 -Subject: hrtimers: Prepare full preemption +Subject: [PATCH] hrtimers: Prepare full preemption Make cancellation of a running callback in softirq context safe against preemption. @@ -8,13 +9,8 @@ against preemption. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> ---- - include/linux/hrtimer.h | 13 ++++++++++++- - kernel/time/hrtimer.c | 33 ++++++++++++++++++++++++++++++++- - kernel/time/itimer.c | 1 + - kernel/time/posix-timers.c | 33 +++++++++++++++++++++++++++++++++ - 4 files changed, 78 insertions(+), 2 deletions(-) - +diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h +index 3214d9ac2002..2f977fc8b679 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -22,6 +22,7 @@ @@ -35,7 +31,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; } ____cacheline_aligned; -@@ -426,6 +430,13 @@ static inline void hrtimer_restart(struc +@@ -426,6 +430,13 @@ static inline void hrtimer_restart(struct hrtimer *timer) hrtimer_start_expires(timer, HRTIMER_MODE_ABS); } @@ -49,7 +45,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> /* Query timers: */ extern ktime_t __hrtimer_get_remaining(const struct hrtimer *timer, bool adjust); -@@ -450,7 +461,7 @@ static inline int hrtimer_is_queued(stru +@@ -450,7 +461,7 @@ static inline int hrtimer_is_queued(struct hrtimer *timer) * Helper function to check, whether the timer is running the callback * function */ @@ -58,9 +54,11 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> { return timer->base->running == timer; } +diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c +index f2815da015d8..e54dfd1aa231 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c -@@ -862,6 +862,33 @@ u64 hrtimer_forward(struct hrtimer *time +@@ -862,6 +862,33 @@ u64 hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval) } EXPORT_SYMBOL_GPL(hrtimer_forward); @@ -94,7 +92,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> /* * enqueue_hrtimer - internal function to (re)start a timer * -@@ -1109,7 +1136,7 @@ int hrtimer_cancel(struct hrtimer *timer +@@ -1109,7 +1136,7 @@ int hrtimer_cancel(struct hrtimer *timer) if (ret >= 0) return ret; @@ -103,7 +101,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> } } EXPORT_SYMBOL_GPL(hrtimer_cancel); -@@ -1385,6 +1412,7 @@ static __latent_entropy void hrtimer_run +@@ -1385,6 +1412,7 @@ static __latent_entropy void hrtimer_run_softirq(struct softirq_action *h) hrtimer_update_softirq_timer(cpu_base, true); raw_spin_unlock_irq(&cpu_base->lock); @@ -111,7 +109,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> } #ifdef CONFIG_HIGH_RES_TIMERS -@@ -1727,6 +1755,9 @@ int hrtimers_prepare_cpu(unsigned int cp +@@ -1729,6 +1757,9 @@ int hrtimers_prepare_cpu(unsigned int cpu) cpu_base->hres_active = 0; cpu_base->expires_next = KTIME_MAX; cpu_base->softirq_expires_next = KTIME_MAX; @@ -121,9 +119,11 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> return 0; } +diff --git a/kernel/time/itimer.c b/kernel/time/itimer.c +index 087d6a1279b8..48b57e458294 100644 --- a/kernel/time/itimer.c +++ b/kernel/time/itimer.c -@@ -195,6 +195,7 @@ int do_setitimer(int which, struct itime +@@ -195,6 +195,7 @@ int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue) /* We are sharing ->siglock with it_real_fn() */ if (hrtimer_try_to_cancel(timer) < 0) { spin_unlock_irq(&tsk->sighand->siglock); @@ -131,9 +131,11 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> goto again; } expires = timeval_to_ktime(value->it_value); +diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c +index 2e608587bd1e..651bd0b53352 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c -@@ -829,6 +829,20 @@ SYSCALL_DEFINE1(timer_getoverrun, timer_ +@@ -831,6 +831,20 @@ SYSCALL_DEFINE1(timer_getoverrun, timer_t, timer_id) return overrun; } @@ -154,7 +156,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> /* Set a POSIX.1b interval timer. */ /* timr->it_lock is taken. */ static int -@@ -906,6 +920,7 @@ SYSCALL_DEFINE4(timer_settime, timer_t, +@@ -910,6 +924,7 @@ SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags, if (!timr) return -EINVAL; @@ -162,7 +164,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> kc = clockid_to_kclock(timr->it_clock); if (WARN_ON_ONCE(!kc || !kc->timer_set)) error = -EINVAL; -@@ -914,9 +929,12 @@ SYSCALL_DEFINE4(timer_settime, timer_t, +@@ -918,9 +933,12 @@ SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags, unlock_timer(timr, flag); if (error == TIMER_RETRY) { @@ -173,9 +175,9 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> } + rcu_read_unlock(); + old_spec = itimerspec64_to_itimerspec(&old_spec64); if (old_setting && !error && - copy_to_user(old_setting, &old_spec, sizeof (old_spec))) -@@ -954,10 +972,15 @@ SYSCALL_DEFINE1(timer_delete, timer_t, t +@@ -959,10 +977,15 @@ SYSCALL_DEFINE1(timer_delete, timer_t, timer_id) if (!timer) return -EINVAL; @@ -191,7 +193,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> spin_lock(¤t->sighand->siglock); list_del(&timer->list); -@@ -983,8 +1006,18 @@ static void itimer_delete(struct k_itime +@@ -988,8 +1011,18 @@ static void itimer_delete(struct k_itimer *timer) retry_delete: spin_lock_irqsave(&timer->it_lock, flags); @@ -210,3 +212,6 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> goto retry_delete; } list_del(&timer->list); +-- +2.1.4 + |