[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251023152942.GC26461@redhat.com>
Date: Thu, 23 Oct 2025 17:29:43 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: "Luis Claudio R. Goncalves" <lgoncalv@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Clark Williams <clrkwllms@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>, Tejun Heo <tj@...nel.org>,
David Vernet <dvernet@...a.com>, Barret Rhoden <brho@...gle.com>,
Josh Don <joshdon@...gle.com>, Crystal Wood <crwood@...hat.com>,
linux-kernel@...r.kernel.org, linux-rt-devel@...ts.linux.dev,
Juri Lelli <juri.lelli@...hat.com>, Ben Segall <bsegall@...gle.com>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Ingo Molnar <mingo@...hat.com>, Mel Gorman <mgorman@...e.de>,
Valentin Schneider <vschneid@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Thomas Gleixner <tglx@...utronix.de>,
Wander Lairson Costa <wander@...hat.com>
Subject: Re: usage of DEFINE_WAIT_OVERRIDE_MAP(LD_WAIT_SLEEP)
On 10/23, Sebastian Andrzej Siewior wrote:
>
> On 2025-10-20 16:53:10 [+0200], Oleg Nesterov wrote:
> >
> > If CONFIG_PREEMPT_RT=y and preemptible() is true, LD_WAIT_CONFIG won't work.
> > lockdep will complain if fill_pool() takes a spinlock_t, spinlock is
> > LD_WAIT_SLEEP on RT.
>
> Where is this? This is then wrong then because _SLEEP is for MUTEX and
> those things that sleep-sleep and pretend to sleep.
>
> spinlock_t should be LD_WAIT_CONFIG. This is used in
> include/linux/spinlock_types.h via SPIN_DEP_MAP_INIT which is only
> defined once as LD_WAIT_CONFIG.
Hmm. I'll recheck, quite possibly I missed something.
But. From include/linux/spinlock_types.h
/* PREEMPT_RT kernels map spinlock to rt_mutex */
#include <linux/rtmutex.h>
typedef struct spinlock {
struct rt_mutex_base lock;
#ifdef CONFIG_DEBUG_LOCK_ALLOC
struct lockdep_map dep_map;
#endif
} spinlock_t;
> rt_mutex is defined as LD_WAIT_SLEEP but this one is not the one we use
> for spinlock_t.
see above...
> What you want to have working in the end is the following scenario:
>
> |static DEFINE_SPINLOCK(lock_spinlock);
> |static DEFINE_RAW_SPINLOCK(lock_raw_spinlock);
> |static DEFINE_RAW_SPINLOCK(lock_raw_spinlock2);
> |
> |static void lockdep_test(void)
> |{
> | static DEFINE_WAIT_OVERRIDE_MAP(put_task_map, LD_WAIT_CONFIG);
> |
> | raw_spin_lock(&lock_raw_spinlock);
> | lock_map_acquire_try(&put_task_map);
> |
> | spin_lock(&lock_spinlock);
Yes, but this won't work on RT? Again, I didn't check (yet), possibly I am
wrong...
> This will work. On RT as well but is wrong and will not happen due to
> the preemptible() check. On !RT it will so you want lockdep to be quiet.
See above and please correct me.
Oleg.
Powered by blists - more mailing lists