From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-kernel@vger.kernel.org, Boqun Feng <boqun.feng@gmail.com>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Waiman Long <longman@redhat.com>, Will Deacon <will@kernel.org>,
Clark Williams <williams@redhat.com>
Subject: Re: [PATCH] Locking: Let PREEMPT_RT compile again with new rwsem asserts.
Date: Tue, 19 Mar 2024 15:15:06 +0100 [thread overview]
Message-ID: <20240319141506.DUd9NKl4@linutronix.de> (raw)
In-Reply-To: <ZfmVPid-d7cpf6Yt@casper.infradead.org>
On 2024-03-19 13:38:06 [+0000], Matthew Wilcox wrote:
> On Tue, Mar 19, 2024 at 08:05:50AM +0100, Sebastian Andrzej Siewior wrote:
> > -static inline void rwsem_assert_held_write_nolockdep(const struct rw_semaphore *sem)
> > +static __always_inline bool rwsem_held_write(const struct rw_semaphore *sem)
>
> The locking maintainers were very clear that this predicate Should Not
> Exist. It encourages people to write bad code. Assertions only!
What do you refer to? The inline vs __always_inline or
rwsem_held_write() should not exists and it should invoke directly
rw_base_is_write_locked()?
> > {
> > - rw_base_assert_held_write(sem);
> > + return rw_base_is_write_locked(&sem->rwbase);
> > +}
> > +
> > +static __always_inline void rwsem_assert_held_write_nolockdep(const struct rw_semaphore *sem)
> > +{
> > + WARN_ON(!rwsem_held_write(sem));
> > }
> >
> > static __always_inline int rwsem_is_contended(struct rw_semaphore *sem)
Sebastian
next prev parent reply other threads:[~2024-03-19 14:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-19 7:05 Sebastian Andrzej Siewior
2024-03-19 13:38 ` Matthew Wilcox
2024-03-19 14:15 ` Sebastian Andrzej Siewior [this message]
2024-03-19 15:53 ` Waiman Long
2024-03-19 18:20 ` [PATCH v2] " Sebastian Andrzej Siewior
2024-03-20 0:58 ` Waiman Long
2024-04-08 14:49 ` [tip: locking/urgent] locking: Make rwsem_assert_held_write_nolockdep() build with PREEMPT_RT=y tip-bot2 for Sebastian Andrzej Siewior
2024-03-19 16:01 ` [PATCH] Locking: Let PREEMPT_RT compile again with new rwsem asserts Matthew Wilcox
2024-03-19 18:21 ` Sebastian Andrzej Siewior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240319141506.DUd9NKl4@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=boqun.feng@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=will@kernel.org \
--cc=williams@redhat.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome