4.4.1-rt6
Subsystems (10)
Dear RT folks!
I'm pleased to announce the v4.4.1-rt6 patch set.
Changes since v4.4.1-rt5:
- The rtmutex wait_lock is taken with interrupts disabled again. It fixes a possible deadlock in the posix timer code. Patch by Thomas Gleixner.
- Don't disable interrupts around atomic_dec_and_lock() in wb_congested_put()
- use a RCU lock in call_step_hook() on ARM64 to avoid sleeping while atomic issue. Patch by Yang Shi.
- In migrate_disable() we use now the fast / atomic path if were are called with interrupts disabled. This avoids a recursion with lockdep in some cases.
- The migrate_disable()/_enable() invocation has been moved from the locking macro into the used rt_mutex functions. This makes the kernel a tiny bit smaller.
- We now try to invoke migrate_enable() before we schedule() out while waiting for a lock. This optimization should allow the scheduler to put the task on another CPU once it became runnable and the original CPU is busy. This does not work for nested locks. Patch by Thomas Gleixner.
- The stop_machine.c was converted to use raw_locks. This patch has been identified to cause problems during hotplug and was reverted.
- There is a useless rcu_bh thread which has been deactivated.
- Manish Jaggi reported that a sleeping while atomic issue on AMR64 with KVM. Josh Cartwright sent a patch.
Known issues:
- bcache stays disabled
- CPU hotplug got a little better but can deadlock.
- The netlink_release() OOPS, reported by Clark, is still on the list, but unsolved due to lack of information.
Since Clark can not reproduce it anymore and hasn't seen it, it will be removed from this list and moved to the bugzilla.
The delta patch against 4.4.1-rt5 is appended below and can be found here:
https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.4/incr/patch-4.4.1-rt5-rt6.patch.xz
You can get this release via the git tree at:
git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git v4.4.1-rt6
The RT patch against 4.4.1 can be found here:
https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.4/patch-4.4.1-rt6.patch.xz
The split quilt queue is available at:
https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4.1-rt6.tar.xz
Sebastian
arch/arm/kvm/arm.c +3 -3
@@ -568,7 +568,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)* involves poking the GIC, which must be done in a * non-preemptible context. */ -preempt_disable (); +migrate_disable ();kvm_timer_flush_hwstate (vcpu);kvm_vgic_flush_hwstate (vcpu);
@@ -587,7 +587,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)local_irq_enable ();kvm_timer_sync_hwstate (vcpu);kvm_vgic_sync_hwstate (vcpu); -preempt_enable (); +migrate_enable ();continue ; }
@@ -641,7 +641,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)kvm_vgic_sync_hwstate (vcpu); -preempt_enable (); +migrate_enable (); ret =handle_exit (vcpu, run, ret); }
arch/arm64/kernel/debug-monitors.c +11 -10
@@ -186,20 +186,21 @@ static void clear_regs_spsr_ss(struct pt_regs *regs)/* EL1 Single Step Handler hooks */ static LIST_HEAD (step_hook); -static DEFINE_RWLOCK (step_hook_lock); +static DEFINE_SPINLOCK (step_hook_lock);void register_step_hook (struct step_hook *hook) { -write_lock (&step_hook_lock); -list_add (&hook->node, &step_hook); -write_unlock (&step_hook_lock); +spin_lock (&step_hook_lock); +list_add_rcu (&hook->node, &step_hook); +spin_unlock (&step_hook_lock); }void unregister_step_hook (struct step_hook *hook) { -write_lock (&step_hook_lock); -list_del (&hook->node); -write_unlock (&step_hook_lock); +spin_lock (&step_hook_lock); +list_del_rcu (&hook->node); +spin_unlock (&step_hook_lock); +synchronize_rcu (); }/*
@@ -213,15 +214,15 @@ static int call_step_hook(struct pt_regs *regs, unsigned int esr)struct step_hook *hook;int retval =DBG_HOOK_ERROR ; -read_lock (&step_hook_lock); +rcu_read_lock (); -list_for_each_entry (hook, &step_hook, node) { +list_for_each_entry_rcu (hook, &step_hook, node) { retval = hook->fn (regs, esr);if (retval ==DBG_HOOK_HANDLED )break ; } -read_unlock (&step_hook_lock); +rcu_read_unlock ();return retval; }
include/linux/locallock.h +3 -3
@@ -43,9 +43,9 @@ struct local_irq_lock {* for CONFIG_PREEMPT_BASE map to the normal spin_* calls. */ #ifdef CONFIG_PREEMPT_RT_FULL -# define spin_lock_local (lock) rt_spin_lock(lock) -# define spin_trylock_local (lock) rt_spin_trylock(lock) -# define spin_unlock_local (lock) rt_spin_unlock(lock) +# define spin_lock_local (lock) rt_spin_lock__no_mg(lock) +# define spin_trylock_local (lock) rt_spin_trylock__no_mg(lock) +# define spin_unlock_local (lock) rt_spin_unlock__no_mg(lock)#else # define spin_lock_local (lock) spin_lock(lock)# define spin_trylock_local (lock) spin_trylock(lock)
include/linux/spinlock_rt.h +7 -18
@@ -18,6 +18,10 @@ do { \ __rt_spin_lock_init(slock, #slock, &__key); \ }while (0 ) +void __lockfunc rt_spin_lock__no_mg(spinlock_t *lock); +void __lockfunc rt_spin_unlock__no_mg(spinlock_t *lock); +int __lockfunc rt_spin_trylock__no_mg(spinlock_t *lock); + extern void __lockfunc rt_spin_lock(spinlock_t *lock);extern unsigned long __lockfunc rt_spin_lock_trace_flags (spinlock_t *lock); extern void __lockfunc rt_spin_lock_nested(spinlock_t *lock, int subclass);
@@ -32,20 +36,16 @@ extern int atomic_dec_and_spin_lock(atomic_t *atomic, spinlock_t *lock);* lockdep-less calls, for derived types like rwlock: * (for trylock they can use rt_mutex_trylock() directly. */ +extern void __lockfunc __rt_spin_lock__no_mg(struct rt_mutex *lock); extern void __lockfunc __rt_spin_lock(struct rt_mutex *lock); extern void __lockfunc __rt_spin_unlock(struct rt_mutex *lock); extern int __lockfunc __rt_spin_trylock(struct rt_mutex *lock); -#define spin_lock (lock) \ - do { \ - migrate_disable(); \ - rt_spin_lock(lock); \ - } while (0) +#define spin_lock (lock) rt_spin_lock(lock)#define spin_lock_bh (lock) \ do { \ local_bh_disable(); \ - migrate_disable(); \ rt_spin_lock(lock); \ } while (0)
@@ -56,24 +56,19 @@ extern int __lockfunc __rt_spin_trylock(struct rt_mutex *lock);#define spin_trylock (lock) \ ({ \ int __locked; \ - migrate_disable(); \ __locked = spin_do_trylock(lock); \ - if (!__locked) \ - migrate_enable(); \ __locked; \ })#ifdef CONFIG_LOCKDEP # define spin_lock_nested (lock, subclass) \ do { \ - migrate_disable(); \ rt_spin_lock_nested(lock, subclass); \ } while (0)#define spin_lock_bh_nested (lock, subclass) \ do { \ local_bh_disable(); \ - migrate_disable(); \ rt_spin_lock_nested(lock, subclass); \ } while (0)
@@ -81,7 +76,6 @@ extern int __lockfunc __rt_spin_trylock(struct rt_mutex *lock);do { \ typecheck(unsigned long, flags); \ flags =0 ; \ -migrate_disable (); \rt_spin_lock_nested (lock, subclass); \ }while (0 ) #else
@@ -117,16 +111,11 @@ static inline unsigned long spin_lock_trace_flags(spinlock_t *lock)/* FIXME: we need rt_spin_lock_nest_lock */ #define spin_lock_nest_lock (lock, nest_lock) spin_lock_nested(lock, 0) -#define spin_unlock (lock) \ - do { \ - rt_spin_unlock(lock); \ - migrate_enable(); \ - } while (0) +#define spin_unlock (lock) rt_spin_unlock(lock)#define spin_unlock_bh (lock) \ do { \ rt_spin_unlock(lock); \ - migrate_enable(); \ local_bh_enable(); \ } while (0)
kernel/cpu.c +2 -2
@@ -127,8 +127,8 @@ struct hotplug_pcp { };#ifdef CONFIG_PREEMPT_RT_FULL -# define hotplug_lock (hp) rt_spin_lock(&(hp)->lock) -# define hotplug_unlock (hp) rt_spin_unlock(&(hp)->lock) +# define hotplug_lock (hp) rt_spin_lock__no_mg(&(hp)->lock) +# define hotplug_unlock (hp) rt_spin_unlock__no_mg(&(hp)->lock)#else # define hotplug_lock (hp) mutex_lock(&(hp)->mutex)# define hotplug_unlock (hp) mutex_unlock(&(hp)->mutex)
kernel/futex.c +9 -9
@@ -1226,7 +1226,7 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this,if (pi_state->owner != current)return -EINVAL ; -raw_spin_lock (&pi_state->pi_mutex.wait_lock); +raw_spin_lock_irq (&pi_state->pi_mutex.wait_lock); new_owner =rt_mutex_next_owner (&pi_state->pi_mutex);/*
@@ -1252,22 +1252,22 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this,else if (curval != uval) ret = -EINVAL ;if (ret) { -raw_spin_unlock (&pi_state->pi_mutex.wait_lock); +raw_spin_unlock_irq (&pi_state->pi_mutex.wait_lock);return ret; } -raw_spin_lock_irq (&pi_state->owner->pi_lock); +raw_spin_lock (&pi_state->owner->pi_lock);WARN_ON (list_empty (&pi_state->list));list_del_init (&pi_state->list); -raw_spin_unlock_irq (&pi_state->owner->pi_lock); +raw_spin_unlock (&pi_state->owner->pi_lock); -raw_spin_lock_irq (&new_owner->pi_lock); +raw_spin_lock (&new_owner->pi_lock);WARN_ON (!list_empty (&pi_state->list));list_add (&pi_state->list, &new_owner->pi_state_list); pi_state->owner = new_owner; -raw_spin_unlock_irq (&new_owner->pi_lock); +raw_spin_unlock (&new_owner->pi_lock); -raw_spin_unlock (&pi_state->pi_mutex.wait_lock); +raw_spin_unlock_irq (&pi_state->pi_mutex.wait_lock); deboost =rt_mutex_futex_unlock (&pi_state->pi_mutex, &wake_q, &wake_sleeper_q);
@@ -2144,11 +2144,11 @@ static int fixup_owner(u32 __user *uaddr, struct futex_q *q, int locked)* we returned due to timeout or signal without taking the * rt_mutex. Too late. */ -raw_spin_lock (&q->pi_state->pi_mutex.wait_lock); +raw_spin_lock_irq (&q->pi_state->pi_mutex.wait_lock); owner =rt_mutex_owner (&q->pi_state->pi_mutex);if (!owner) owner =rt_mutex_next_owner (&q->pi_state->pi_mutex); -raw_spin_unlock (&q->pi_state->pi_mutex.wait_lock); +raw_spin_unlock_irq (&q->pi_state->pi_mutex.wait_lock); ret =fixup_pi_state_owner (uaddr, q, owner); goto out; }
kernel/irq/manage.c +1 -1
@@ -2060,7 +2060,7 @@ EXPORT_SYMBOL_GPL(irq_get_irqchip_state);* This call sets the internal irqchip state of an interrupt, * depending on the value of @which. * -* This function should be called with preemption disabled if the +* This function should be called with migration disabled if the * interrupt controller has per-cpu registers. */ int irq_set_irqchip_state(unsigned int irq, enum irqchip_irq_state which,
kernel/locking/lglock.c +1 -1
@@ -10,7 +10,7 @@# define lg_do_unlock (l) arch_spin_unlock(l)#else # define lg_lock_ptr struct rt_mutex -# define lg_do_lock (l) __rt_spin_lock(l) +# define lg_do_lock (l) __rt_spin_lock__no_mg(l)# define lg_do_unlock (l) __rt_spin_unlock(l)#endif /*
kernel/locking/rt.c +0 -2
@@ -235,7 +235,6 @@ EXPORT_SYMBOL(rt_read_trylock); void __lockfunc rt_write_lock(rwlock_t *rwlock) {rwlock_acquire (&rwlock->dep_map,0 ,0 , _RET_IP_); -migrate_disable ();__rt_spin_lock (&rwlock->lock); }EXPORT_SYMBOL (rt_write_lock);
@@ -249,7 +248,6 @@ void __lockfunc rt_read_lock(rwlock_t *rwlock)* recursive read locks succeed when current owns the lock */ if (rt_mutex_owner (lock) != current) { -migrate_disable ();rwlock_acquire (&rwlock->dep_map,0 ,0 , _RET_IP_);__rt_spin_lock (lock); }
kernel/locking/rtmutex.c +150 -96
724 lines not on this page · raw message
kernel/rcu/tree.c +6 -0
@@ -454,11 +454,13 @@ EXPORT_SYMBOL_GPL(rcu_batches_started_sched);/* * Return the number of RCU BH batches started thus far for debug & stats. */ +#ifndef CONFIG_PREEMPT_RT_FULL unsigned long rcu_batches_started_bh (void ) {return rcu_bh_state.gpnum; }EXPORT_SYMBOL_GPL (rcu_batches_started_bh); +#endif /* * Return the number of RCU batches completed thus far for debug & stats.
@@ -563,9 +565,11 @@ void rcutorture_get_gp_data(enum rcutorture_type test_type, int *flags,case RCU_FLAVOR : rsp = rcu_state_p;break ; +#ifndef CONFIG_PREEMPT_RT_FULL case RCU_BH_FLAVOR : rsp = &rcu_bh_state;break ; +#endif case RCU_SCHED_FLAVOR : rsp = &rcu_sched_state;break ;
@@ -4695,7 +4699,9 @@ void __init rcu_init(void)rcu_bootup_announce ();rcu_init_geometry (); +#ifndef CONFIG_PREEMPT_RT_FULL rcu_init_one (&rcu_bh_state, &rcu_bh_data); +#endif rcu_init_one (&rcu_sched_state, &rcu_sched_data);if (dump_tree)rcu_dump_rcu_node_tree (&rcu_sched_state);
kernel/rcu/tree.h +2 -0
@@ -557,7 +557,9 @@ extern struct list_head rcu_struct_flavors;*/ extern struct rcu_state rcu_sched_state; +#ifndef CONFIG_PREEMPT_RT_FULL extern struct rcu_state rcu_bh_state; +#endif #ifdef CONFIG_PREEMPT_RCU extern struct rcu_state rcu_preempt_state;
kernel/sched/core.c +2 -2
@@ -3157,7 +3157,7 @@ void migrate_disable(void) {struct task_struct *p = current; -if (in_atomic ()) { +if (in_atomic () ||irqs_disabled ()) {#ifdef CONFIG_SCHED_DEBUG p->migrate_disable_atomic++;#endif
@@ -3188,7 +3188,7 @@ void migrate_enable(void) {struct task_struct *p = current; -if (in_atomic ()) { +if (in_atomic () ||irqs_disabled ()) {#ifdef CONFIG_SCHED_DEBUG p->migrate_disable_atomic--;#endif
kernel/softirq.c +3 -1
@@ -563,8 +563,10 @@ static void do_current_softirqs(void)do_single_softirq (i); }softirq_clr_runner (i); -unlock_softirq (i);WARN_ON (current->softirq_nestcnt !=1 ); +local_irq_enable (); +unlock_softirq (i); +local_irq_disable (); } }
kernel/stop_machine.c +8 -32
@@ -30,7 +30,7 @@ struct cpu_stop_done {atomic_t nr_todo;/* nr left to execute */ bool executed;/* actually executed? */ int ret;/* collected return value */ -struct task_struct *waiter;/* woken when nr_todo reaches 0 */ +struct completion completion;/* fired if nr_todo reaches 0 */ };/* the actual stopper, one per every possible cpu, enabled on online cpus */
@@ -59,7 +59,7 @@ static void cpu_stop_init_done(struct cpu_stop_done *done, unsigned int nr_todo) {memset (done,0 ,sizeof (*done));atomic_set (&done->nr_todo, nr_todo); - done->waiter = current; +init_completion (&done->completion); }/* signal completion unless @done is NULL */
@@ -68,10 +68,8 @@ static void cpu_stop_signal_done(struct cpu_stop_done *done, bool executed)if (done) {if (executed) done->executed = true; -if (atomic_dec_and_test (&done->nr_todo)) { -wake_up_process (done->waiter); - done->waiter =NULL ; - } +if (atomic_dec_and_test (&done->nr_todo)) +complete (&done->completion); } }
@@ -96,22 +94,6 @@ static void cpu_stop_queue_work(unsigned int cpu, struct cpu_stop_work *work)raw_spin_unlock_irqrestore (&stopper->lock, flags); } -static void wait_for_stop_done (struct cpu_stop_done *done) -{ -set_current_state (TASK_UNINTERRUPTIBLE ); -while (atomic_read (&done->nr_todo)) { -schedule (); -set_current_state (TASK_UNINTERRUPTIBLE ); - } -/* -* We need to wait until cpu_stop_signal_done() has cleared -* done->waiter. -*/ -while (done->waiter) -cpu_relax (); -set_current_state (TASK_RUNNING ); -} -/** * stop_one_cpu - stop a cpu * @cpu: cpu to stop
@@ -143,7 +125,7 @@ int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg)cpu_stop_init_done (&done,1 );cpu_stop_queue_work (cpu, &work); -wait_for_stop_done (&done); +wait_for_completion (&done.completion);return done.executed ? done.ret : -ENOENT ; }
@@ -302,7 +284,7 @@ int stop_two_cpus(unsigned int cpu1, unsigned int cpu2, cpu_stop_fn_t fn, void *preempt_enable_nort (); -wait_for_stop_done (&done); +wait_for_completion (&done.completion);return done.executed ? done.ret : -ENOENT ; }
@@ -364,7 +346,7 @@ static int __stop_cpus(const struct cpumask *cpumask,cpu_stop_init_done (&done,cpumask_weight (cpumask));queue_stop_cpus_work (cpumask, fn, arg, &done, false); -wait_for_stop_done (&done); +wait_for_completion (&done.completion);return done.executed ? done.ret : -ENOENT ; }
@@ -495,13 +477,7 @@ static void cpu_stopper_thread(unsigned int cpu)kallsyms_lookup ((unsigned long )fn,NULL ,NULL ,NULL , ksym_buf), arg); -/* -* Make sure that the wakeup and setting done->waiter -* to NULL is atomic. -*/ -local_irq_disable ();cpu_stop_signal_done (done, true); -local_irq_enable (); goto repeat; } }
@@ -663,7 +639,7 @@ int stop_machine_from_inactive_cpu(cpu_stop_fn_t fn, void *data, ret =multi_cpu_stop (&msdata);/* Busy wait for completion. */ -while (atomic_read (&done.nr_todo)) +while (!completion_done (&done.completion))cpu_relax ();mutex_unlock (&stop_cpus_mutex);
localversion-rt +1 -1
@@ -1 +1 @@ --rt5 +-rt6
mm/backing-dev.c +2 -2
@@ -457,9 +457,9 @@ void wb_congested_put(struct bdi_writeback_congested *congested) {unsigned long flags; -local_irq_save (flags); +local_irq_save_nort (flags);if (!atomic_dec_and_lock (&congested->refcnt, &cgwb_lock)) { -local_irq_restore (flags); +local_irq_restore_nort (flags);return ; }
Quoted 4 lines · Sebastian Andrzej Siewior
Known issues:
- bcache stays disabled- CPU hotplug got a little better but can deadlock.
My x86_64 desktop box survived 100 iterations of Steven's script. If my 64 core box survives, I'll be amazed, but it definitely is better.
I don't cringe _as_ much when I use it ;-)
-Mike
Quoted 9 lines · Mike Galbraith
Quoted 4 lines · Sebastian Andrzej Siewior
Known issues:
- bcache stays disabled- CPU hotplug got a little better but can deadlock.
My
x86_64desktop box survived 100 iterations of Steven's script. If my 64 core box survives, I'll be amazed, but it definitely is better.
64 core box restored my faith in hotplug nearly instantly. Hohum.
-Mike
Quoted 2 lines · On Sat, 13 Feb 2016 00:47:08 +0100 Sebastian Andrzej Siewior…
- There is a useless
rcu_bhthread which has been deactivated.
For some strange reason I had RCU_TORTURE_TEST defined in my config. This caused my compile to blow up because kernel/rcu/rcutorture.c wanted to test the (now ifdef'ed out) rcu_bh routines. This fixes the compile issue but is untested for actually *running* rcutorture. I'll try that on a test box tomorrow.
Clark
From a835ff3aad772520d34548dc336925788a649b17 Mon Sep 17 00:00:00 2001
From: Clark Williams <[email protected]>
Date: Mon, 15 Feb 2016 22:48:04 -0600
Subject: [PATCH] rcutorture: comment out rcu_bh ops on PREEMPT_RT_FULL
RT has dropped support of rcu_bh, comment out in rcutorture.
--- kernel/rcu/rcutorture.c | 7 +++++++ 1 file changed, 7 insertions(+)
kernel/rcu/rcutorture.c +7 -0
@@ -390,6 +390,7 @@ static struct rcu_torture_ops rcu_ops = { .name = "rcu" }; +#ifndef CONFIG_PREEMPT_RT_FULL /* * Definitions for rcu_bh torture testing. */
@@ -429,6 +430,12 @@ static struct rcu_torture_ops rcu_bh_ops = { .name = "rcu_bh" }; +#else +static struct rcu_torture_ops rcu_bh_ops = { + .ttype =INVALID_RCU_FLAVOR , +}; +#endif +/* * Don't even think about trying any of these in real life!!! * The names includes "busted", and they really means it!
Signature · 1 line
2.5.0
Quoted 9 lines · On Mon, 15 Feb 2016 22:53:58 -0600 Clark Williams <[email protected]> wrote:
Quoted 2 lines · On Sat, 13 Feb 2016 00:47:08 +0100 Sebastian Andrzej Siewior…
- There is a useless
rcu_bhthread which has been deactivated.For some strange reason I had
RCU_TORTURE_TESTdefined in my config. This caused my compile to blow up becausekernel/rcu/rcutorture.cwanted to test the (now ifdef'ed out)rcu_bhroutines. This fixes the compile issue but is untested for actually *running* rcutorture. I'll try that on a test box tomorrow.
Successfully ran rcutorture for 5m on my test system with no errors reported and no _bh_ threads started.
Clark