mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	the arch/x86 maintainers <x86@kernel.org>
Subject: Re: [GIT pull] locking/urgent for 5.19-rc3
Date: Sun, 19 Jun 2022 18:38:11 +0200	[thread overview]
Message-ID: <Yq9Q84H6HIfkJpoR@zx2c4.com> (raw)
In-Reply-To: <CAHk-=wgfrUdWBXA-Jx7ZC1x3wwsomou0L6niGgpRS2Hd5rQxyg@mail.gmail.com>

Hi Linus,

On Sun, Jun 19, 2022 at 09:50:32AM -0500, Linus Torvalds wrote:
> On Sun, Jun 19, 2022 at 8:12 AM Thomas Gleixner <tglx@linutronix.de> wrote:
> >
> > A RT fix for lockdep. lockdep invokes prandom_u32() to create cookies. This
> > worked until prandom_u32() was switched to the real random generator, which
> > takes a spinlock for extraction, which does not work on RT when invoked
> > from atomic contexts. lockdep has no requirement for real random numbers
> > and it turns out sched_clock() is good enough to create the cookie. That
> > works everywhere and is faster.
> 
> So this is obviously fine and works ok, but I do think it highlights
> that maybe that prandom change was a bad bad idea.
> 
> Even outside of RT, you might end up getting nasty locks within locks.
> Not a deadlock, but a "this was just pointless".

This was initially my concern too, which I expressed to Sebastian, but
he made the point that this area here is rather "special". Actually,
randomness isn't really required here. A counter would have worked, but
Peter thought that sched_clock() would be faster than incrementing a
counter. And if it did want some sort of max period generator that's not
sequential, there's still the deterministic prandom_u32_state()
function.

Anyway, if it turns out that this is terrible, and we're running into
issues all over the place, I'll start looking for more comprehensive
solutions. But as long as very special cases are fairly few and rare, it
seems like it's going to be okay. I guess we'll see. For now, I'm
undeterred.

Jason

  reply	other threads:[~2022-06-19 16:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-19 13:12 [GIT pull] irq/urgent " Thomas Gleixner
2022-06-19 13:12 ` [GIT pull] locking/urgent " Thomas Gleixner
2022-06-19 14:50   ` Linus Torvalds
2022-06-19 16:38     ` Jason A. Donenfeld [this message]
2022-06-19 20:05       ` Linus Torvalds
2022-06-19 20:28         ` Jason A. Donenfeld
2022-06-19 15:01   ` pr-tracker-bot
2022-06-19 13:12 ` [GIT pull] objtool/urgent " Thomas Gleixner
2022-06-19 15:01   ` pr-tracker-bot
2022-06-19 13:12 ` [GIT pull] sched/urgent " Thomas Gleixner
2022-06-19 15:01   ` pr-tracker-bot
2022-06-19 13:12 ` [GIT pull] x86/urgent " Thomas Gleixner
2022-06-19 15:01   ` pr-tracker-bot
2022-06-19 15:01 ` [GIT pull] irq/urgent " pr-tracker-bot

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=Yq9Q84H6HIfkJpoR@zx2c4.com \
    --to=jason@zx2c4.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --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®