public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: "'Jason A. Donenfeld'" <Jason@zx2c4.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>
Subject: RE: [PATCH] random: use raw spinlocks for use on RT
Date: Mon, 15 Aug 2022 10:26:58 +0000	[thread overview]
Message-ID: <cec92c1b79be45c6b70bc890a07764cd@AcuMS.aculab.com> (raw)
In-Reply-To: <YvUQJTDREXSAA9J6@zx2c4.com>

...
> So why don't we actually fix this, so we don't have to keep coming up
> with hacks? The question is: does using raw spinlocks over this code
> result in any real issue for RT latency? If so, I'd like to know where,
> and maybe I can do something about that (or maybe I can't). If not, then
> this is a non problem and I'll apply this patch with your blessing.
> 
> If you don't want to spend time doing latency measurements, could you
> instead share a document or similar to the type of methodology you
> usually use for that, so I can do the same? And at the very least, I am
> simply curious and want to know more about the RT world.

I'd have thought that the majority of kernel spinlocks are
held for much less than the time taken to do a context switch.
So converting them to sleep locks is always going to harm
lock acquisition time.

The other problem the is inherent with sleep locks is priority
inversion.
I've have terrible problems getting a multithreaded RT application
to run reliably.
The main fix required removing ALL the mutex from the hot paths.
Basically you can't ensure that mutex are only held for short
periods (an ethernet hardware interrupt and then the softint code)
will mean the mutex is held for far too long.
This means you can't use linked lists unless they can be managed
with cmpxchg (etc).

Now there may be some kernel spinlocks that are held for 'too long'
but they should probably be changed anyway.

Making the kernel 'mostly pre-emptable' (which isn't really that
much different from SMP) would fix a lot of RT issues (like RT
processes not being scheduled because a low priority process
in running in kernel on the same cpu) without the complete
scheduling train-wreck of making every spinlock a sleeplock.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

  reply	other threads:[~2022-08-15 10:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-01 14:25 [PATCH] random: use raw spinlocks for use on RT Jason A. Donenfeld
2022-08-01 14:34 ` Sebastian Andrzej Siewior
2022-08-01 14:41   ` Jason A. Donenfeld
2022-08-11  0:17   ` Jason A. Donenfeld
2022-08-11  7:15     ` Sebastian Andrzej Siewior
2022-08-11 14:20       ` Jason A. Donenfeld
2022-08-15 10:26         ` David Laight [this message]
2022-08-16 14:02         ` Jason A. Donenfeld
2022-08-29 19:45         ` Sebastian Andrzej Siewior
2022-08-29 19:56           ` Jason A. Donenfeld
2022-08-30 10:13             ` Sebastian Andrzej Siewior
2022-08-30 15:24               ` Jason A. Donenfeld
2022-08-30 18:57                 ` Sebastian Andrzej Siewior
2022-08-31 16:27                   ` Jason A. Donenfeld

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=cec92c1b79be45c6b70bc890a07764cd@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=Jason@zx2c4.com \
    --cc=bigeasy@linutronix.de \
    --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