All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] sysfs: Add /sys/kernel/realtime entry
@ 2026-07-09 14:31 Sebastian Andrzej Siewior
  2026-07-09 14:38 ` sashiko-bot
  2026-07-09 14:46 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 16+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-07-09 14:31 UTC (permalink / raw)
  To: driver-core, linux-rt-devel, linux-rt-users
  Cc: Rafael J. Wysocki, Arnd Bergmann, Clark Williams,
	Danilo Krummrich, Greg Kroah-Hartman, Peter Zijlstra,
	Steven Rostedt, Thomas Gleixner

Hi,

The following patch sat in the RT queue for almost 15years now. I can't
find its origin on the list.
All it does is adding /sys/kernel/realtime once PREEMPT_RT is enabled
and returns 1.

Is this something that is still wanted and considered useful?
Is this something that can be expressed better by other means?

There was an in person discussion about this and it was suggested to add
/sys/kernel/realtime as a folder and having individual realtime features
as files. I don't remember a single feature that would quality for this
today but who knows. This is all I remember so far.

Now. Discussion go!

---------------------8>-------------------------

From: Clark Williams <williams@redhat.com>
Date: Sat, 30 Jul 2011 21:55:53 -0500

Add a /sys/kernel entry to indicate that the kernel is a
realtime kernel.

Clark says that he needs this for udev rules, udev needs to evaluate
if its a PREEMPT_RT kernel a few thousand times and parsing uname
output is too slow or so.

Are there better solutions? Should it exist and return 0 on !-rt?

Signed-off-by: Clark Williams <williams@redhat.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/ksysfs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c
index f45ade718054a..670a7a57d7b23 100644
--- a/kernel/ksysfs.c
+++ b/kernel/ksysfs.c
@@ -133,6 +133,15 @@ KERNEL_ATTR_RO(vmcoreinfo);
 
 #endif /* CONFIG_VMCORE_INFO */
 
+#if defined(CONFIG_PREEMPT_RT)
+static ssize_t realtime_show(struct kobject *kobj,
+			     struct kobj_attribute *attr, char *buf)
+{
+	return sprintf(buf, "%d\n", 1);
+}
+KERNEL_ATTR_RO(realtime);
+#endif
+
 /* whether file capabilities are enabled */
 static ssize_t fscaps_show(struct kobject *kobj,
 				  struct kobj_attribute *attr, char *buf)
@@ -206,6 +215,9 @@ static struct attribute * kernel_attrs[] = {
 #ifndef CONFIG_TINY_RCU
 	&rcu_expedited_attr.attr,
 	&rcu_normal_attr.attr,
+#endif
+#ifdef CONFIG_PREEMPT_RT
+	&realtime_attr.attr,
 #endif
 	NULL
 };
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2026-07-14 11:07 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-09 14:31 [RFC PATCH] sysfs: Add /sys/kernel/realtime entry Sebastian Andrzej Siewior
2026-07-09 14:38 ` sashiko-bot
2026-07-09 14:46 ` Greg Kroah-Hartman
2026-07-09 15:22   ` Sebastian Andrzej Siewior
2026-07-09 16:02     ` Clark Williams
2026-07-10  7:02       ` Sebastian Andrzej Siewior
2026-07-10  7:05       ` Tomas Glozar
2026-07-10  7:23     ` Florian Bezdeka
2026-07-10 15:51       ` Steven Rostedt
2026-07-10 15:57         ` Sebastian Andrzej Siewior
2026-07-10 16:01         ` Florian Bezdeka
2026-07-10 16:12           ` Steven Rostedt
2026-07-14 11:07           ` Sebastian Andrzej Siewior
2026-07-10 16:05         ` Greg Kroah-Hartman
2026-07-10 16:14           ` Steven Rostedt
2026-07-09 15:54   ` Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.