mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
	Waiman Long <longman@redhat.com>,
	Boqun Feng <boqun.feng@gmail.com>,
	"Jason A. Donenfeld" <Jason@zx2c4.com>,
	Theodore Ts'o <tytso@mit.edu>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] locking/lockdep: Use sched_clock() for random numbers.
Date: Sun, 12 Jun 2022 11:43:47 -0400	[thread overview]
Message-ID: <YqYJs/NBw3mQGz3k@sashalap> (raw)
In-Reply-To: <YoNn3pTkm5+QzE5k@linutronix.de>

On Tue, May 17, 2022 at 11:16:14AM +0200, Sebastian Andrzej Siewior wrote:
>Since the rewrote of prandom_u32(), in the commit mentioned below, the
>function uses sleeping locks which extracing random numbers and filling
>the batch.
>This breaks lockdep on PREEMPT_RT because lock_pin_lock() disables
>interrupts while calling __lock_pin_lock(). This can't be moved earlier
>because the main user of the function (rq_pin_lock()) invokes that
>function after disabling interrupts in order to acquire the lock.
>
>The cookie does not require random numbers as its goal is to provide a
>random value in order to notice unexpected "unlock + lock" sites.
>
>Use sched_clock() to provide random numbers.
>
>Fixes: a0103f4d86f88 ("random32: use real rng for non-deterministic randomness")
>Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
>---
>
>So if the architecture does not provide sched_clock() and does not
>enabled GENERIC_SCHED_CLOCK then we use jiffies here. Most of them do
>one or the other except for alpha, csky, hexagon, ... but I don't worry
>here since arm*, power*, x86* do provide it.

I'm seeing hangs on AMD based machines with lockdep enabled, and
bisected the issue to a0103f4d86f88 ("random32: use real rng for
non-deterministic randomness").

No hangs on Intel/arm64, no hangs with lockdep disabled.

Spotted this patch on the list, and confirmed that it addresses the
issue I'm seeing.

-- 
Thanks,
Sasha

  parent reply	other threads:[~2022-06-12 15:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-17  9:16 Sebastian Andrzej Siewior
2022-05-17  9:53 ` Jason A. Donenfeld
2022-05-17  9:59   ` Jason A. Donenfeld
2022-05-17 12:08     ` Sebastian Andrzej Siewior
2022-06-13  8:11       ` Peter Zijlstra
2022-06-13  8:05   ` Peter Zijlstra
2022-06-13  8:16     ` Jason A. Donenfeld
2022-06-07 16:51 ` Sebastian Andrzej Siewior
2022-06-12 15:43 ` Sasha Levin [this message]
2022-06-13  8:36 ` [tip: locking/urgent] " tip-bot2 for 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=YqYJs/NBw3mQGz3k@sashalap \
    --to=sashal@kernel.org \
    --cc=Jason@zx2c4.com \
    --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=tytso@mit.edu \
    --cc=will@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®