From: Jules Irenge <jbi.octave@gmail.com>
To: boqun.feng@gmail.com
Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de,
Jules Irenge <jbi.octave@gmail.com>
Subject: [PATCH v2 1/2] hrtimer: Add missing annotation to lock_hrtimer_base()
Date: Mon, 27 Jan 2020 02:30:08 +0000 [thread overview]
Message-ID: <20200127023008.87124-1-jbi.octave@gmail.com> (raw)
Sparse reports several warnings;
warning: context imbalance in lock_hrtimer_base() - wrong count at exit
warning: context imbalance in hrtimer_start_range_ns() - unexpected unlock
warning: context imbalance in hrtimer_try_to_cancel() - unexpected unlock
warning: context imbalance in __hrtimer_get_remaining() - unexpected unlock
The root cause is a missing annotation of lock_hrtimer_base()
which also causes the "unexpected unlock" warnings.
To fix these,
an __acquires(timer) annotation is added to lock_hrtimer_base().
Given that lock_hrtimer_base() does actually call READ_ONCE(timer->base),
this fixes the warnings.
Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
---
kernel/time/hrtimer.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 8de90ea31280..d149b599bdf7 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -157,9 +157,9 @@ static inline bool is_migration_base(struct hrtimer_clock_base *base)
* possible to set timer->base = &migration_base and drop the lock: the timer
* remains locked.
*/
-static
-struct hrtimer_clock_base *lock_hrtimer_base(const struct hrtimer *timer,
- unsigned long *flags)
+static struct hrtimer_clock_base *
+lock_hrtimer_base(const struct hrtimer *timer,
+ unsigned long *flags) __acquires(timer)
{
struct hrtimer_clock_base *base;
--
2.24.1
reply other threads:[~2020-01-27 2:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20200127023008.87124-1-jbi.octave@gmail.com \
--to=jbi.octave@gmail.com \
--cc=boqun.feng@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/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