* Re: [RFC PATCH] sysfs: Add /sys/kernel/realtime entry
[not found] <20260709143108.UYeCUUcd@linutronix.de>
@ 2026-07-09 14:38 ` sashiko-bot
0 siblings, 0 replies; only message in thread
From: sashiko-bot @ 2026-07-09 14:38 UTC (permalink / raw)
To: Sebastian Andrzej Siewior; +Cc: linux-kernel, linux-rt-devel
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] Creating `/sys/kernel/realtime` as a regular file prevents future extension into a directory, permanently locking the ABI.
- [Medium] Exposing a single-purpose boolean flag instead of a generic preemption model indicator.
- [Low] Newly added sysfs show function uses deprecated `sprintf()` instead of `sysfs_emit()`.
--
--- Patch [1]: [RFC PATCH] sysfs: Add /sys/kernel/realtime entry ---
commit b40fad0ff776ab9c6dbe7fb2b7d2cb062431ad56
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
sysfs: Add /sys/kernel/realtime entry
This commit adds a /sys/kernel/realtime entry that returns 1 when PREEMPT_RT
is enabled. This provides a way for userspace tools like udev to quickly
evaluate if the system is running a realtime kernel without parsing uname
output.
> 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)
> +{
[Severity: Medium]
The commit message asks if there are better solutions to express this state.
Instead of exposing a single-purpose boolean attribute specifically for RT,
could this be a generic preemption model indicator like
/sys/kernel/preempt_model?
The kernel supports multiple preemption models (NONE, VOLUNTARY, FULL, RT,
LAZY). Providing a unified UAPI that leverages the existing
preempt_model_str() for all configurations might be more scalable for
userspace tools than a dedicated boolean file.
> + return sprintf(buf, "%d\n", 1);
[Severity: Low]
Should this use sysfs_emit() instead of sprintf() to align with modern sysfs
API standards?
> +}
> +KERNEL_ATTR_RO(realtime);
[Severity: Medium]
The commit message mentions a past discussion about adding
/sys/kernel/realtime as a folder. Does creating it as a regular file now
permanently lock the ABI?
If future realtime features need to be exposed individually, replacing this
regular file with a directory later would cause a strict ABI breakage. Existing
userspace tools calling read() on it would suddenly receive -EISDIR.
> +#endif
> +
> /* whether file capabilities are enabled */
> static ssize_t fscaps_show(struct kobject *kobj,
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260709143108.UYeCUUcd@linutronix.de?part=1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-09 14:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260709143108.UYeCUUcd@linutronix.de>
2026-07-09 14:38 ` [RFC PATCH] sysfs: Add /sys/kernel/realtime entry sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox