Re: [PATCH] rcu: Stop re-initializing ->boost_mtx on every boost cycle

From: kernel test robot

Date: Sat Dec 05 2026 - 04:56:23 EST


Hi Ziwei,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tip/locking/core]
[also build test WARNING on linus/master v7.4-rc5 next-20261203]
[cannot apply to rcu/rcu/dev]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Ziwei-Dai/rcu-Stop-re-initializing-boost_mtx-on-every-boost-cycle/20261204-180830
base: tip/locking/core
patch link: https://lore.kernel.org/r/20261204100830.226336-1-ziwei.dai%40unisoc.com
patch subject: [PATCH] rcu: Stop re-initializing ->boost_mtx on every boost cycle
config: um-x86_64_defconfig (https://download.01.org/0day-ci/archive/20261204/20261204223109.UDO9Isj1-lkp@xxxxxxxxx/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 63b30c97f6082ebf34b31bdd81bb50df7672b67b)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261204/20261204223109.UDO9Isj1-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/20261204223109.UDO9Isj1-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> kernel/locking/rtmutex_api.c:329:2: warning: calling function 'rt_mutex_set_owner' requires holding raw_spinlock 'lock->wait_lock' exclusively [-Wthread-safety-analysis]
329 | rt_mutex_set_owner(lock, proxy_owner);
| ^
1 warning generated.


vim +329 kernel/locking/rtmutex_api.c

296
297 /**
298 * rt_mutex_boost_set_owner - make an initialized rt_mutex appear to be held
299 by @proxy_owner
300 * @lock: the rt_mutex, which must have been initialized already
301 * @proxy_owner: the task to set as owner
302 *
303 * No locking. Caller has to do serializing itself.
304 *
305 * Counterpart of rt_mutex_init_proxy_locked() for RCU priority boosting,
306 * which reuses a single, permanently embedded rt_mutex
307 * (rcu_node::boost_mtx) for every boost cycle. This performs exactly the
308 * same owner assignment, but deliberately does *not* re-initialize @lock
309 * and therefore does not rewrite lock->wait_lock.
310 *
311 * Re-initializing ->wait_lock is not possible once the mutex is in use.
312 * The task which was boosted in the previous cycle releases ->boost_mtx
313 * via rt_mutex_futex_unlock(), and it does so without holding the rcu_node
314 * lock. The ->owner = NULL store in that path happens while ->wait_lock
315 * is held, so the fast path of rt_mutex_lock() can already succeed at
316 * that point. Rewriting ->wait_lock from the boost kthread in this
317 * window lands on a spinlock which the other CPU still holds, which
318 * corrupts the lock word (on ARM32 ticket spinlocks the previous holder
319 * then trips "BUG: spinlock already unlocked") or, worse, lets two CPUs
320 * run inside the wait_lock protected section at the same time.
321 *
322 * Callers must initialize @lock once, up front, and use this function for
323 * every subsequent ownership transfer. @lock must be free and have no
324 * waiters queued when this is called.
325 */
326 void __sched rt_mutex_boost_set_owner(struct rt_mutex_base *lock,
327 struct task_struct *proxy_owner)
328 {
> 329 rt_mutex_set_owner(lock, proxy_owner);
330 }
331

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki