From: sashiko-bot@kernel.org
To: "Tvrtko Ursulin" <tvrtko.ursulin@igalia.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [RFC v5 2/3] workqueue: Add support for real-time workers
Date: Wed, 23 Sep 2026 16:25:54 +0000 [thread overview]
Message-ID: <20260923162555.03B1A1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260923161251.45428-3-tvrtko.ursulin@igalia.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] workqueue: Rescuer threads for WQ_RTPRI run at SCHED_NORMAL priority
- [Medium] workqueue: sysfs allows root to override strict CPU affinity for WQ_RTPRI
--
commit d6923aa9186af2fdae6943a41b86cf0fc9512111
Author: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
workqueue: Add support for real-time workers
For use cases such as the DRM scheduler submitting work to the GPU on
behalf of low latency userspace applications, where latter have sufficient
privileges to have had successfully obtained realtime Vulkan global
priority, competing with random background CPU load can create large
latency spikes which gets in the way of a smooth user experience.
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index a9e96329547c9..4be11eb7f04f1 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
[ ... ]
> @@ -6115,6 +6129,12 @@ static struct workqueue_struct *__alloc_workqueue(const char *fmt,
> return NULL;
> }
>
> + if (flags & WQ_RTPRI) {
> + if (WARN_ON_ONCE((flags & (WQ_HIGHPRI | WQ_UNBOUND)) !=
> + WQ_UNBOUND))
> + return NULL;
> + }
> +
[Severity: High]
This validation doesn't prevent combining WQ_RTPRI with WQ_MEM_RECLAIM.
If a workqueue is created with both flags, does this break the RT priority
guarantee when memory pressure triggers a rescue?
Looking at rescuer_thread() in kernel/workqueue.c, it unconditionally forces
the thread's scheduling class to SCHED_NORMAL by calling:
set_user_nice(current, RESCUER_NICE_LEVEL);
Could this cause real-time work items to execute at standard CFS priority
instead of SCHED_FIFO during a rescue?
[ ... ]
> @@ -7810,6 +7833,10 @@ static umode_t wq_sysfs_unbound_group_visible(struct kobject *kobj,
> if (!(wq->flags & WQ_UNBOUND))
> return SYSFS_GROUP_INVISIBLE;
>
> + /* Do not allow priority changes for RT workers. */
> + if ((wq->flags & WQ_RTPRI) && !strcmp(attr->name, "nice"))
> + return 0444;
> +
> return attr->mode;
> }
[Severity: Medium]
While this protects the "nice" attribute from modification for RT workqueues,
does it omit protection for "affinity_strict" and "affn_scope", leaving them
writable?
If a privileged user writes to affinity_strict, affinity_strict_store() in
kernel/workqueue.c executes:
attrs->affn_strict = (bool)v;
ret = apply_workqueue_attrs_locked(wq, attrs);
Could this silently strip the strict CPU affinity mandated for WQ_RTPRI?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260923161251.45428-1-tvrtko.ursulin@igalia.com?part=2
next prev parent reply other threads:[~2026-09-23 16:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 16:12 [RFC v5 0/3] Realtime workqueues and panthor realtime submission Tvrtko Ursulin
2026-09-23 16:12 ` [RFC v5 1/3] workqueue: Simplify unbound sysfs attribute registration Tvrtko Ursulin
2026-09-23 16:22 ` sashiko-bot
2026-09-23 17:12 ` Tvrtko Ursulin
2026-09-23 16:12 ` [RFC v5 2/3] workqueue: Add support for real-time workers Tvrtko Ursulin
2026-09-23 16:25 ` sashiko-bot [this message]
2026-09-29 0:00 ` Tejun Heo
2026-10-01 9:22 ` Tvrtko Ursulin
2026-09-23 16:12 ` [RFC v5 3/3] drm/panthor: Create per queue priority workqueues Tvrtko Ursulin
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=20260923162555.03B1A1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tvrtko.ursulin@igalia.com \
/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