mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	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>,
	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 11:53:50 -0400	[thread overview]
Message-ID: <9b4f3dac-779a-4eef-945b-3ca1455c0dfe@redhat.com> (raw)
In-Reply-To: <20240319141506.DUd9NKl4@linutronix.de>


On 3/19/24 10:15, Sebastian Andrzej Siewior wrote:
> 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()?

Just merge rwsem_held_write() into rwsem_assert_held_write_nolockdep() 
and we should be all set.

Cheers,
Longman

>>>   {
>>> -	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
>


  reply	other threads:[~2024-03-19 15:54 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
2024-03-19 15:53     ` Waiman Long [this message]
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=9b4f3dac-779a-4eef-945b-3ca1455c0dfe@redhat.com \
    --to=longman@redhat.com \
    --cc=bigeasy@linutronix.de \
    --cc=boqun.feng@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --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