Re: [patch 58/63] futex: Prevent requeue_pi() lock nesting issue on RT

From: Peter Zijlstra
Date: Tue Aug 03 2021 - 06:07:42 EST


On Fri, Jul 30, 2021 at 03:51:05PM +0200, Thomas Gleixner wrote:
> @@ -219,6 +221,10 @@ struct futex_q {
> struct rt_mutex_waiter *rt_waiter;
> union futex_key *requeue_pi_key;
> u32 bitset;
> + atomic_t requeue_state;
> +#ifdef CONFIG_PREEMPT_RT
> + struct rcuwait requeue_wait;
> +#endif
> } __randomize_layout;
>
> static const struct futex_q futex_q_init = {

Do we want to explicitly initialize requeue_state in futex_q_init? I was
looking where we reset the state machine and eventually figured it out,
but I'm thinking something more explicit might help avoid this for the
next time.