The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sebastian Andrzej Siewior" <bigeasy@linutronix.de>
Cc: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev
Subject: Re: [RFC PATCH] sysfs: Add /sys/kernel/realtime entry
Date: Thu, 09 Jul 2026 14:38:51 +0000	[thread overview]
Message-ID: <20260709143851.8D8DB1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260709143108.UYeCUUcd@linutronix.de>

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

           reply	other threads:[~2026-07-09 14:38 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20260709143108.UYeCUUcd@linutronix.de>]

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=20260709143851.8D8DB1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /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