Re: [RFC PATCH] sysfs: Add /sys/kernel/realtime entry

Sebastian Andrzej Siewior <[email protected]> Fri, 10 Jul 2026 09:02:00 +0200
Newsgroups org.kernel.vger.linux-rt-users,dev.linux.lists.driver-core,dev.linux.lists.linux-rt-devel
Message-ID <[email protected]>
On 2026-07-09 11:02:22 [-0500], Clark Williams wrote:
> I'm hesitant to call for it's removal, because the only other way for
> startup code that want's to know if it's on a realtime kernel is to look
> for PREEMPT_RT in the 'uname -v' output. I know that the financials and
> the telcos tune specifically for RT, pretty sure there are others.=20

And the "uname -v" still reveals that. Even after PREEMPT_DYNAMIC and
other changes over years.

> > There is custom "software" that is designed for realtime environment and
> > if it is run on a regular kernel then it missed its timing requirements
> > and the software goes usually in a fail state and people start debugging
> > what has happen. If this happens often enough (booting a non-RT kernel)
> > they tend to add a check so that the software complains early enough
> > since checking the kernel is usually the last thing that is done.
> >=20
> > This could work with the file (or folder) or by parsing uname output. I
> > know of at least two individuals that switched to uname because the
> > upstream RT does not have that file.
> >=20
>=20
> Really? We always took the absence of that file to mean Not Realtime.

The upstream (without the RT queue) never had that but uname was
working.

=E2=80=A6
> The question I have is, would a folder with RT-specific information be us=
eful?=20

We did not have anything so far which does not mean we don't have it in
the future. The features were so far always part of a specific
subsystem and on by default on a RT system. For example PREEMPT_LAZY is
exposed via the scheduler. There is RCU-normal (not -expedited) which is
exposed via RCU. Ah. We have threaded interrupts which is not exposed at
all, you just see the threads in ps.

> Someone just wanting to know if they're on RT could still check for exist=
ance
> if that's all they want to know, but I'm not really coming up with any
> other information that would prove useful for someone tuning for an RT
> workload.=20
>=20
> Is there a "better" way to indicate that the system is running a
> PREEMPT_RT kernel?

I always checked for uname. Thinking about it, we could try to get a
ConditionIsRealtime for systemd unit file syntax similar to
ConditionKernelVersion and all the other things it has
	https://www.man7.org/linux/man-pages/man5/systemd.unit.5.html

That would "solve" the startup issue. It might make sense to hold off
adding the file until we have a reason to add a folder with features.
Changing it afterwards will break "test -f" users.

> Clark

Sebastian