* [PATCH v2 0/2] efi: Expose the runtime-services workqueue via sysfs
@ 2026-02-27 17:01 Sebastian Andrzej Siewior
2026-02-27 17:01 ` [PATCH v2 1/2] workqueue: Allow to expose ordered workqueues " Sebastian Andrzej Siewior
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-02-27 17:01 UTC (permalink / raw)
To: linux-efi, linux-kernel, linux-rt-devel
Cc: Luis Claudio R. Goncalves, Ard Biesheuvel, John Ogness,
Lai Jiangshan, Tejun Heo, Ilias Apalodimas,
Sebastian Andrzej Siewior
EFI runtime services are disabled on PREEMPT_RT by default which can be
overwritten on the boot command line. For native EFI, an invocation
requires to disable preemption an x86 while a call is made into EFI.
Even if it does not (as it is the case on arm64) the EFI function can
disable interrupts. This makes the time spent in EFI is not
deterministic.
While accessing the efi-rtc device can be avoided by using a native
driver, accessing the "variables" is important and there is no second
path.
The "runtime-wrappers" is wrapping access to the EFI callback via a
workqueue. On a SMP system one CPU could be declared as housekeeping/
not-realtime-capable and force all EFI invocation to be performed on
this CPU. This could be achieved by setting workqueue.unbound_cpus or
/sys/devices/virtual/workqueue/cpumask
at runtime. This however will affect all workqueues and might not be
desired. With an explicit setting such as
/sys/devices/virtual/workqueue/efi_runtime/cpumask
it looks like an official way to limit the CPUs involved here.
With this in place I was wondering if EFI_DISABLE_RUNTIME could be
lifted at runtime on SMP systems. But given the unbound_cpus option
and the auto-config based on NOHZ-full it might not be wise to add yet
another smart option here. Also it needs to be a subset of root cpumask
or it won't be effective.
v1…v2: https://lore.kernel.org/all/20260205115559.1625236-1-bigeasy@linutronix.de/
- For BH and WQ_ORDERED worker make the max_active RO.
Sebastian Andrzej Siewior (2):
workqueue: Allow to expose ordered workqueues via sysfs
efi: Allow to expose the workqueue via sysfs
drivers/firmware/efi/efi.c | 2 +-
kernel/workqueue.c | 28 ++++++++++++++++++++--------
2 files changed, 21 insertions(+), 9 deletions(-)
--
2.51.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 1/2] workqueue: Allow to expose ordered workqueues via sysfs
2026-02-27 17:01 [PATCH v2 0/2] efi: Expose the runtime-services workqueue via sysfs Sebastian Andrzej Siewior
@ 2026-02-27 17:01 ` Sebastian Andrzej Siewior
2026-02-27 17:12 ` Tejun Heo
2026-02-27 17:01 ` [PATCH v2 2/2] efi: Allow to expose the workqueue " Sebastian Andrzej Siewior
2026-02-27 19:10 ` [PATCH v2 0/2] efi: Expose the runtime-services " Tejun Heo
2 siblings, 1 reply; 9+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-02-27 17:01 UTC (permalink / raw)
To: linux-efi, linux-kernel, linux-rt-devel
Cc: Luis Claudio R. Goncalves, Ard Biesheuvel, John Ogness,
Lai Jiangshan, Tejun Heo, Ilias Apalodimas,
Sebastian Andrzej Siewior
Ordered workqueues are not exposed via sysfs because the 'max_active'
attribute changes the number actives worker. More than one active worker
can break ordering guarantees.
This can be avoided by forbidding writes the file for ordered
workqueues. Exposing it via sysfs allows to alter other attributes such
as the cpumask on which CPU the worker can run.
The 'max_active' value shouldn't be changed for BH worker because the
core never spawns additional worker and the worker itself can not be
preempted. So this make no sense.
Allow to expose ordered workqueues via sysfs if requested and forbid
changing 'max_active' value for ordered and BH worker.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/workqueue.c | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index aeaec79bc09c4..2f95cb0d2f1b8 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -7176,7 +7176,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)
@@ -7479,13 +7498,6 @@ int workqueue_sysfs_register(struct workqueue_struct *wq)
struct wq_device *wq_dev;
int ret;
- /*
- * Adjusting max_active breaks ordering guarantee. Disallow exposing
- * ordered workqueues.
- */
- if (WARN_ON(wq->flags & __WQ_ORDERED))
- return -EINVAL;
-
wq->wq_dev = wq_dev = kzalloc_obj(*wq_dev);
if (!wq_dev)
return -ENOMEM;
--
2.51.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 2/2] efi: Allow to expose the workqueue via sysfs
2026-02-27 17:01 [PATCH v2 0/2] efi: Expose the runtime-services workqueue via sysfs Sebastian Andrzej Siewior
2026-02-27 17:01 ` [PATCH v2 1/2] workqueue: Allow to expose ordered workqueues " Sebastian Andrzej Siewior
@ 2026-02-27 17:01 ` Sebastian Andrzej Siewior
2026-02-27 19:10 ` [PATCH v2 0/2] efi: Expose the runtime-services " Tejun Heo
2 siblings, 0 replies; 9+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-02-27 17:01 UTC (permalink / raw)
To: linux-efi, linux-kernel, linux-rt-devel
Cc: Luis Claudio R. Goncalves, Ard Biesheuvel, John Ogness,
Lai Jiangshan, Tejun Heo, Ilias Apalodimas,
Sebastian Andrzej Siewior
Exposing the efi_rts_wq workqueue via sysfs provides an easy mechanism
to restrict EFI firmware invocation to certain CPU(s).
This can be used to restrict EFI invocations to specific CPUs while
allowing other workqueue to use the remaning CPUs.
Expose the workqueue via sysfs. Change the name to efi_runtime which is
what will be visible under sysfs.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
drivers/firmware/efi/efi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index b2fb92a4bbd11..3dab284a7754d 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -423,7 +423,7 @@ static int __init efisubsys_init(void)
* ordered workqueue (which creates only one execution context)
* should suffice for all our needs.
*/
- efi_rts_wq = alloc_ordered_workqueue("efi_rts_wq", 0);
+ efi_rts_wq = alloc_ordered_workqueue("efi_runtime", WQ_SYSFS);
if (!efi_rts_wq) {
pr_err("Creating efi_rts_wq failed, EFI runtime services disabled.\n");
clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
--
2.51.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/2] workqueue: Allow to expose ordered workqueues via sysfs
2026-02-27 17:01 ` [PATCH v2 1/2] workqueue: Allow to expose ordered workqueues " Sebastian Andrzej Siewior
@ 2026-02-27 17:12 ` Tejun Heo
2026-02-27 17:14 ` Sebastian Andrzej Siewior
0 siblings, 1 reply; 9+ messages in thread
From: Tejun Heo @ 2026-02-27 17:12 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: linux-efi, linux-kernel, linux-rt-devel,
Luis Claudio R. Goncalves, Ard Biesheuvel, John Ogness,
Lai Jiangshan, Ilias Apalodimas
On Fri, Feb 27, 2026 at 06:01:02PM +0100, Sebastian Andrzej Siewior wrote:
> Ordered workqueues are not exposed via sysfs because the 'max_active'
> attribute changes the number actives worker. More than one active worker
> can break ordering guarantees.
>
> This can be avoided by forbidding writes the file for ordered
> workqueues. Exposing it via sysfs allows to alter other attributes such
> as the cpumask on which CPU the worker can run.
>
> The 'max_active' value shouldn't be changed for BH worker because the
> core never spawns additional worker and the worker itself can not be
> preempted. So this make no sense.
>
> Allow to expose ordered workqueues via sysfs if requested and forbid
> changing 'max_active' value for ordered and BH worker.
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Tejun Heo <tj@kernel.org>
I can apply this to wq/for-7.1. Would that work?
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/2] workqueue: Allow to expose ordered workqueues via sysfs
2026-02-27 17:12 ` Tejun Heo
@ 2026-02-27 17:14 ` Sebastian Andrzej Siewior
2026-02-27 17:20 ` Ard Biesheuvel
0 siblings, 1 reply; 9+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-02-27 17:14 UTC (permalink / raw)
To: Tejun Heo
Cc: linux-efi, linux-kernel, linux-rt-devel,
Luis Claudio R. Goncalves, Ard Biesheuvel, John Ogness,
Lai Jiangshan, Ilias Apalodimas
On 2026-02-27 07:12:46 [-1000], Tejun Heo wrote:
> Acked-by: Tejun Heo <tj@kernel.org>
Thank.
> I can apply this to wq/for-7.1. Would that work?
I think you need to take both since 2/2 can't be applied independently.
Maybe Ard is going to give his blessing ;)
> Thanks.
Sebastian
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/2] workqueue: Allow to expose ordered workqueues via sysfs
2026-02-27 17:14 ` Sebastian Andrzej Siewior
@ 2026-02-27 17:20 ` Ard Biesheuvel
2026-02-27 17:27 ` Tejun Heo
0 siblings, 1 reply; 9+ messages in thread
From: Ard Biesheuvel @ 2026-02-27 17:20 UTC (permalink / raw)
To: Sebastian Andrzej Siewior, Tejun Heo
Cc: linux-efi, linux-kernel, linux-rt-devel,
Luis Claudio R. Goncalves, John Ogness, Lai Jiangshan,
Ilias Apalodimas
On Fri, 27 Feb 2026, at 18:14, Sebastian Andrzej Siewior wrote:
> On 2026-02-27 07:12:46 [-1000], Tejun Heo wrote:
>> Acked-by: Tejun Heo <tj@kernel.org>
> Thank.
>
>> I can apply this to wq/for-7.1. Would that work?
>
> I think you need to take both since 2/2 can't be applied independently.
> Maybe Ard is going to give his blessing ;)
>
iIRC I already acked v1.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/2] workqueue: Allow to expose ordered workqueues via sysfs
2026-02-27 17:20 ` Ard Biesheuvel
@ 2026-02-27 17:27 ` Tejun Heo
2026-02-27 17:36 ` Ard Biesheuvel
0 siblings, 1 reply; 9+ messages in thread
From: Tejun Heo @ 2026-02-27 17:27 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: Sebastian Andrzej Siewior, linux-efi, linux-kernel,
linux-rt-devel, Luis Claudio R. Goncalves, John Ogness,
Lai Jiangshan, Ilias Apalodimas
On Fri, Feb 27, 2026 at 06:20:47PM +0100, Ard Biesheuvel wrote:
>
>
> On Fri, 27 Feb 2026, at 18:14, Sebastian Andrzej Siewior wrote:
> > On 2026-02-27 07:12:46 [-1000], Tejun Heo wrote:
> >> Acked-by: Tejun Heo <tj@kernel.org>
> > Thank.
> >
> >> I can apply this to wq/for-7.1. Would that work?
> >
> > I think you need to take both since 2/2 can't be applied independently.
> > Maybe Ard is going to give his blessing ;)
> >
>
> iIRC I already acked v1.
Ard, do you want me to take both patches or wann pull from wq/for-7.1?
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/2] workqueue: Allow to expose ordered workqueues via sysfs
2026-02-27 17:27 ` Tejun Heo
@ 2026-02-27 17:36 ` Ard Biesheuvel
0 siblings, 0 replies; 9+ messages in thread
From: Ard Biesheuvel @ 2026-02-27 17:36 UTC (permalink / raw)
To: Tejun Heo
Cc: Sebastian Andrzej Siewior, linux-efi, linux-kernel,
linux-rt-devel, Luis Claudio R. Goncalves, John Ogness,
Lai Jiangshan, Ilias Apalodimas
On Fri, 27 Feb 2026, at 18:27, Tejun Heo wrote:
> On Fri, Feb 27, 2026 at 06:20:47PM +0100, Ard Biesheuvel wrote:
>>
>>
>> On Fri, 27 Feb 2026, at 18:14, Sebastian Andrzej Siewior wrote:
>> > On 2026-02-27 07:12:46 [-1000], Tejun Heo wrote:
>> >> Acked-by: Tejun Heo <tj@kernel.org>
>> > Thank.
>> >
>> >> I can apply this to wq/for-7.1. Would that work?
>> >
>> > I think you need to take both since 2/2 can't be applied independently.
>> > Maybe Ard is going to give his blessing ;)
>> >
>>
>> iIRC I already acked v1.
>
> Ard, do you want me to take both patches or wann pull from wq/for-7.1?
>
Please take both - thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 0/2] efi: Expose the runtime-services workqueue via sysfs
2026-02-27 17:01 [PATCH v2 0/2] efi: Expose the runtime-services workqueue via sysfs Sebastian Andrzej Siewior
2026-02-27 17:01 ` [PATCH v2 1/2] workqueue: Allow to expose ordered workqueues " Sebastian Andrzej Siewior
2026-02-27 17:01 ` [PATCH v2 2/2] efi: Allow to expose the workqueue " Sebastian Andrzej Siewior
@ 2026-02-27 19:10 ` Tejun Heo
2 siblings, 0 replies; 9+ messages in thread
From: Tejun Heo @ 2026-02-27 19:10 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: linux-efi, linux-kernel, linux-rt-devel,
Luis Claudio R. Goncalves, Ard Biesheuvel, John Ogness,
Lai Jiangshan, Ilias Apalodimas
Applied to wq/for-7.1.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-02-27 19:10 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-27 17:01 [PATCH v2 0/2] efi: Expose the runtime-services workqueue via sysfs Sebastian Andrzej Siewior
2026-02-27 17:01 ` [PATCH v2 1/2] workqueue: Allow to expose ordered workqueues " Sebastian Andrzej Siewior
2026-02-27 17:12 ` Tejun Heo
2026-02-27 17:14 ` Sebastian Andrzej Siewior
2026-02-27 17:20 ` Ard Biesheuvel
2026-02-27 17:27 ` Tejun Heo
2026-02-27 17:36 ` Ard Biesheuvel
2026-02-27 17:01 ` [PATCH v2 2/2] efi: Allow to expose the workqueue " Sebastian Andrzej Siewior
2026-02-27 19:10 ` [PATCH v2 0/2] efi: Expose the runtime-services " Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox