From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-rt-devel@lists.linux.dev
Cc: "Luis Claudio R. Goncalves" <lgoncalv@redhat.com>,
"Ard Biesheuvel" <ardb@kernel.org>,
"John Ogness" <john.ogness@linutronix.de>,
"Lai Jiangshan" <jiangshanlai@gmail.com>,
"Tejun Heo" <tj@kernel.org>,
"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
Subject: Re: [PATCH 1/2] workqueue: Allow to expose ordered workqueues via sysfs
Date: Thu, 5 Feb 2026 14:39:13 +0100 [thread overview]
Message-ID: <20260205133913.538FuakM@linutronix.de> (raw)
In-Reply-To: <20260205115559.1625236-2-bigeasy@linutronix.de>
On 2026-02-05 12:55:58 [+0100], To linux-efi@vger.kernel.org wrote:
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -7097,6 +7097,13 @@ static ssize_t max_active_store(struct device *dev,
> struct workqueue_struct *wq = dev_to_wq(dev);
> int val;
>
> + /*
> + * Adjusting max_active breaks ordering guarantee. Changing it has no
> + * effect on BH worker.
> + */
> + if (wq->flags & (WQ_BH | __WQ_ORDERED))
> + return -EACCES;
> +
> if (sscanf(buf, "%d", &val) != 1 || val <= 0)
> return -EINVAL;
I have been informed that instead of this -EACCES I could do the
following and exposing only the max_active (and per_cpu) attribute as
RO instead.
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 625ee8cc47f40..793b59ce99edb 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -7097,13 +7097,6 @@ static ssize_t max_active_store(struct device *dev,
struct workqueue_struct *wq = dev_to_wq(dev);
int val;
- /*
- * Adjusting max_active breaks ordering guarantee. Changing it has no
- * effect on BH worker.
- */
- if (wq->flags & (WQ_BH | __WQ_ORDERED))
- return -EACCES;
-
if (sscanf(buf, "%d", &val) != 1 || val <= 0)
return -EINVAL;
@@ -7117,7 +7110,26 @@ static struct attribute *wq_sysfs_attrs[] = {
&dev_attr_max_active.attr,
NULL,
};
-ATTRIBUTE_GROUPS(wq_sysfs);
+
+static umode_t wq_sysfs_is_visible(struct kobject *kobj, struct attribute *a, int n)
+{
+ struct device *dev = kobj_to_dev(kobj);
+ struct workqueue_struct *wq = dev_to_wq(dev);
+
+ /*
+ * Adjusting max_active breaks ordering guarantee. Changing it has no
+ * effect on BH worker. Limit max_active to RO in such case.
+ */
+ if (wq->flags & (WQ_BH | __WQ_ORDERED))
+ return 0444;
+ return a->mode;
+}
+
+static const struct attribute_group wq_sysfs_group = {
+ .is_visible = wq_sysfs_is_visible,
+ .attrs = wq_sysfs_attrs,
+};
+__ATTRIBUTE_GROUPS(wq_sysfs);
static ssize_t wq_nice_show(struct device *dev, struct device_attribute *attr,
char *buf)
next prev parent reply other threads:[~2026-02-05 13:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-05 11:55 [PATCH 0/2] efi: Expose the runtime-services workqueue via sysfs Sebastian Andrzej Siewior
2026-02-05 11:55 ` [PATCH 1/2] workqueue: Allow to expose ordered workqueues " Sebastian Andrzej Siewior
2026-02-05 13:39 ` Sebastian Andrzej Siewior [this message]
2026-02-05 21:59 ` Tejun Heo
2026-02-05 11:55 ` [PATCH 2/2] efi: Allow to expose the workqueue " Sebastian Andrzej Siewior
2026-02-09 15:17 ` [PATCH 0/2] efi: Expose the runtime-services " Luis Claudio R. Goncalves
2026-02-09 15:55 ` Sebastian Andrzej Siewior
2026-02-12 7:09 ` Ilias Apalodimas
2026-02-12 16:20 ` Sebastian Andrzej Siewior
2026-02-13 6:28 ` Ilias Apalodimas
2026-02-09 17:10 ` Ard Biesheuvel
2026-02-12 15:18 ` Sebastian Andrzej Siewior
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=20260205133913.538FuakM@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=ardb@kernel.org \
--cc=jiangshanlai@gmail.com \
--cc=john.ogness@linutronix.de \
--cc=lgoncalv@redhat.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=thomas.weissschuh@linutronix.de \
--cc=tj@kernel.org \
/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