diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c index 05b68931622d1..2c70213934cd4 100644 --- a/kernel/locking/mutex.c +++ b/kernel/locking/mutex.c @@ -614,7 +614,7 @@ __mutex_lock_common(struct mutex *lock, unsigned int state, unsigned int subclas debug_mutex_lock_common(lock, &waiter); waiter.task = current; - if (ww_ctx) + if (use_ww_ctx) waiter.ww_ctx = ww_ctx; lock_contended(&lock->dep_map, ip); diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index f01368a05374d..d2ef535530b10 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -61,13 +61,10 @@ MODULE_AUTHOR("Paul E. McKenney and Josh Triplett > RCUTORTURE_RDR_SHIFT) > 1); rtrsp->rt_readstate = newstate; - /* - * First, put new protection in place to avoid critical-section gap. - * Disable preemption around the ATOM disables to ensure that - * in_atomic() is true. - */ + /* First, put new protection in place to avoid critical-section gap. */ if (statesnew & RCUTORTURE_RDR_BH) local_bh_disable(); if (statesnew & RCUTORTURE_RDR_RBH) @@ -1447,29 +1440,18 @@ static void rcutorture_one_extend(int *readstate, int newstate, preempt_disable(); if (statesnew & RCUTORTURE_RDR_SCHED) rcu_read_lock_sched(); - preempt_disable(); - if (statesnew & RCUTORTURE_RDR_ATOM_BH) - local_bh_disable(); - if (statesnew & RCUTORTURE_RDR_ATOM_RBH) - rcu_read_lock_bh(); - preempt_enable(); if (statesnew & RCUTORTURE_RDR_RCU) idxnew = cur_ops->readlock() << RCUTORTURE_RDR_SHIFT; /* * Next, remove old protection, in decreasing order of strength * to avoid unlock paths that aren't safe in the stronger - * context. Disable preemption around the ATOM enables in - * case the context was only atomic due to IRQ disabling. + * context. Namely: BH can not be enabled with disabled interrupts. + * Additionally PREEMPT_RT requires that BH is enabled in preemptible + * context. */ - preempt_disable(); if (statesold & RCUTORTURE_RDR_IRQ) local_irq_enable(); - if (statesold & RCUTORTURE_RDR_ATOM_BH) - local_bh_enable(); - if (statesold & RCUTORTURE_RDR_ATOM_RBH) - rcu_read_unlock_bh(); - preempt_enable(); if (statesold & RCUTORTURE_RDR_PREEMPT) preempt_enable(); if (statesold & RCUTORTURE_RDR_SCHED) @@ -1478,7 +1460,6 @@ static void rcutorture_one_extend(int *readstate, int newstate, local_bh_enable(); if (statesold & RCUTORTURE_RDR_RBH) rcu_read_unlock_bh(); - if (statesold & RCUTORTURE_RDR_RCU) { bool lockit = !statesnew && !(torture_random(trsp) & 0xffff); @@ -1523,10 +1504,7 @@ rcutorture_extend_mask(int oldmask, struct torture_random_state *trsp) unsigned long randmask2 = randmask1 >> 3; unsigned long preempts = RCUTORTURE_RDR_PREEMPT | RCUTORTURE_RDR_SCHED; unsigned long preempts_irq = preempts | RCUTORTURE_RDR_IRQ; - unsigned long nonatomic_bhs = RCUTORTURE_RDR_BH | RCUTORTURE_RDR_RBH; - unsigned long atomic_bhs = RCUTORTURE_RDR_ATOM_BH | - RCUTORTURE_RDR_ATOM_RBH; - unsigned long tmp; + unsigned long bhs = RCUTORTURE_RDR_BH | RCUTORTURE_RDR_RBH; WARN_ON_ONCE(mask >> RCUTORTURE_RDR_SHIFT); /* Mostly only one bit (need preemption!), sometimes lots of bits. */ @@ -1538,9 +1516,8 @@ rcutorture_extend_mask(int oldmask, struct torture_random_state *trsp) /* * Can't enable bh w/irq disabled. */ - tmp = atomic_bhs | nonatomic_bhs; if (mask & RCUTORTURE_RDR_IRQ) - mask |= oldmask & tmp; + mask |= oldmask & bhs; /* * Ideally these sequences would be detected in debug builds @@ -1548,30 +1525,11 @@ rcutorture_extend_mask(int oldmask, struct torture_random_state *trsp) * them on non-RT. */ if (IS_ENABLED(CONFIG_PREEMPT_RT)) { - /* - * Can't disable bh in atomic context if bh was already - * disabled by another task on the same CPU. Instead of - * attempting to track this, just avoid disabling bh in atomic - * context. - */ - mask &= ~atomic_bhs; - /* - * Can't release the outermost rcu lock in an irq disabled - * section without preemption also being disabled, if irqs - * had ever been enabled during this RCU critical section - * (could leak a special flag and delay reporting the qs). - */ - if ((oldmask & RCUTORTURE_RDR_RCU) && - (mask & RCUTORTURE_RDR_IRQ) && - !(mask & preempts)) - mask |= RCUTORTURE_RDR_RCU; - - /* Can't modify non-atomic bh in atomic context */ - tmp = nonatomic_bhs; + /* Can't modify BH in atomic context */ if (oldmask & preempts_irq) - mask &= ~tmp; + mask &= ~bhs; if ((oldmask | mask) & preempts_irq) - mask |= oldmask & tmp; + mask |= oldmask & bhs; } return mask ?: RCUTORTURE_RDR_RCU; diff --git a/localversion-rt b/localversion-rt index 6e44e540b927b..9f7d0bdbffb18 100644 --- a/localversion-rt +++ b/localversion-rt @@ -1 +1 @@ --rt12 +-rt13