mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Sebastian Andrzej Siewior" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: locking/core] locking/rt: Annotate unlock followed by lock for sparse.
Date: Thu, 24 Oct 2024 09:37:05 -0000	[thread overview]
Message-ID: <172976262580.1442.4617419905991721713.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20240812104200.2239232-5-bigeasy@linutronix.de>

The following commit has been merged into the locking/core branch of tip:

Commit-ID:     77abd3b7d9bf384306872b6201b1dfeb1e899892
Gitweb:        https://git.kernel.org/tip/77abd3b7d9bf384306872b6201b1dfeb1e899892
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Mon, 12 Aug 2024 12:39:05 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Thu, 24 Oct 2024 11:27:02 +02:00

locking/rt: Annotate unlock followed by lock for sparse.

rt_mutex_slowlock_block() and rtlock_slowlock_locked() both unlock
lock::wait_lock and then lock it later. This is unusual and sparse
complains about it.

Add __releases() + __acquires() annotation to mark that it is expected.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240812104200.2239232-5-bigeasy@linutronix.de

---
 kernel/locking/rtmutex.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
index ebebd0e..d3b72c2 100644
--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -1601,6 +1601,7 @@ static int __sched rt_mutex_slowlock_block(struct rt_mutex_base *lock,
 					   unsigned int state,
 					   struct hrtimer_sleeper *timeout,
 					   struct rt_mutex_waiter *waiter)
+	__releases(&lock->wait_lock) __acquires(&lock->wait_lock)
 {
 	struct rt_mutex *rtm = container_of(lock, struct rt_mutex, rtmutex);
 	struct task_struct *owner;
@@ -1805,6 +1806,7 @@ static __always_inline int __rt_mutex_lock(struct rt_mutex_base *lock,
  * @lock:	The underlying RT mutex
  */
 static void __sched rtlock_slowlock_locked(struct rt_mutex_base *lock)
+	__releases(&lock->wait_lock) __acquires(&lock->wait_lock)
 {
 	struct rt_mutex_waiter waiter;
 	struct task_struct *owner;

  reply	other threads:[~2024-10-24  9:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-12 10:39 [PATCH 0/4] locking/rt: Add sparse annotation PREEMPT_RT's locking Sebastian Andrzej Siewior
2024-08-12 10:39 ` [PATCH 1/4] locking/rt: Add sparse annotation PREEMPT_RT's sleeping locks Sebastian Andrzej Siewior
2024-10-24  9:37   ` [tip: locking/core] " tip-bot2 for Sebastian Andrzej Siewior
2024-08-12 10:39 ` [PATCH 2/4] locking/rt: Remove one __cond_lock() in RT's spin_trylock_irqsave() Sebastian Andrzej Siewior
2024-10-24  9:37   ` [tip: locking/core] " tip-bot2 for Sebastian Andrzej Siewior
2024-08-12 10:39 ` [PATCH 3/4] locking/rt: Add sparse annotation for RCU Sebastian Andrzej Siewior
2024-10-24  9:37   ` [tip: locking/core] " tip-bot2 for Sebastian Andrzej Siewior
2024-08-12 10:39 ` [PATCH 4/4] locking/rt: Annotate unlock followed by lock for sparse Sebastian Andrzej Siewior
2024-10-24  9:37   ` tip-bot2 for Sebastian Andrzej Siewior [this message]
2024-10-01  7:17 ` [PATCH 0/4] locking/rt: Add sparse annotation PREEMPT_RT's locking 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=172976262580.1442.4617419905991721713.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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

all inboxes | Powered by JetHome®