From: Matthew Wilcox <willy@infradead.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
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 13:38:06 +0000 [thread overview]
Message-ID: <ZfmVPid-d7cpf6Yt@casper.infradead.org> (raw)
In-Reply-To: <20240319070550.ws_uO21-@linutronix.de>
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!
> {
> - 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)
> --
> 2.43.0
>
next prev parent reply other threads:[~2024-03-19 13:38 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 [this message]
2024-03-19 14:15 ` Sebastian Andrzej Siewior
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=ZfmVPid-d7cpf6Yt@casper.infradead.org \
--to=willy@infradead.org \
--cc=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 \
/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
all inboxes | Powered by JetHome®