mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
To: Tejun Heo <tj@kernel.org>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	kernel-dev@igalia.com,
	Boris Brezillon <boris.brezillon@collabora.com>,
	Bradley Morgan <include@grrlz.net>, Chia-I Wu <olv@google.com>,
	Liviu Dudau <liviu.dudau@arm.com>,
	Matthew Brost <matthew.brost@intel.com>,
	Steven Price <steven.price@arm.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Breno Leitao <leitao@debian.org>
Subject: Re: [PATCH v7 2/4] workqueue: Separate sysfs mutable vs immutable wq attribute sanitizing
Date: Mon, 2 Nov 2026 18:01:10 +0000	[thread overview]
Message-ID: <ab160c52-1645-4ec9-9ea2-5b8bc36d9284@igalia.com> (raw)
In-Reply-To: <91711e517792f2e607258d75b633898e@kernel.org>


On 23/10/2026 22:28, Tejun Heo wrote:
> Hello, Tvrtko.
> 
> On Thu, Oct 22, 2026 at 10:38:46AM +0100, Tvrtko Ursulin wrote:
>> +/* Sanitize attributes not modifiable via sysfs. */
>> +static void
>> +sanitize_immutable_workqueue_attrs(struct workqueue_struct *wq,
>> +				   struct workqueue_attrs *attrs)
>> ...
>> +/* Sanitize attributes modifiable via sysfs. */
>> +static void
>> +sanitize_mutable_workqueue_attrs(struct workqueue_struct *wq,
>> +				 struct workqueue_attrs *attrs)
>> ...
>> +static void
>> +sanitize_workqueue_attrs(struct workqueue_struct *wq,
>> +				 struct workqueue_attrs *attrs)
>> +{
>> +	sanitize_immutable_workqueue_attrs(wq, attrs);
>> +	sanitize_mutable_workqueue_attrs(wq, attrs);
>> +}
> 
> The three helpers seem a bit excessive for what they do, and the
> immutable call in sanitize_workqueue_attrs() is redundant, as
> apply_wqattrs_prepare() runs sanitize_immutable_workqueue_attrs() on
> both of its copies anyway.

Okay I dropped sanitize_workqueue_attrs() locally. I was trying to 
express the logic behind mutable and immutable, which also leads me to...

> Could the comment on sanitize_immutable_workqueue_attrs() state the
> contract? These attrs follow from the workqueue flags and are enforced
> on every apply, apply_workqueue_attrs() callers included, not only
> sysfs.

...the topic of what would be the best commentary for both.

Would these comments work:

/*
  * Sanitize attributes derived from the workqueue flags and which need 
to be
  * enforced on every attribute application.
  */
static void
sanitize_immutable_workqueue_attrs(struct workqueue_struct *wq,
				   struct workqueue_attrs *attrs)
{
	if (wq->flags & __WQ_ORDERED)
		attrs->ordered = true;
}

/*
  * Sanitize attributes derived from the workqueue flags and which need 
to be
  * enforced only on workqueue creation.
  */
static void
sanitize_mutable_workqueue_attrs(struct workqueue_struct *wq,
				 struct workqueue_attrs *attrs)
{
	if (wq->flags & WQ_HIGHPRI)
		attrs->nice = HIGHPRI_NICE_LEVEL;
}

Regards,

Tvrtko


  reply	other threads:[~2026-11-02 18:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22  9:38 [PATCH v7 0/4] Realtime workqueues and panthor realtime submission Tvrtko Ursulin
2026-10-22  9:38 ` [PATCH v7 1/4] workqueue: Simplify unbound sysfs attribute registration Tvrtko Ursulin
2026-10-23 13:14   ` Liviu Dudau
2026-10-23 21:04   ` Tejun Heo
2026-10-22  9:38 ` [PATCH v7 2/4] workqueue: Separate sysfs mutable vs immutable wq attribute sanitizing Tvrtko Ursulin
2026-10-23 13:17   ` Liviu Dudau
2026-10-23 21:28   ` Tejun Heo
2026-11-02 18:01     ` Tvrtko Ursulin [this message]
2026-10-22  9:38 ` [PATCH v7 3/4] workqueue: Add support for real-time workers Tvrtko Ursulin
2026-10-23 13:23   ` Liviu Dudau
2026-10-23 21:28   ` Tejun Heo
2026-10-24  8:33     ` Tvrtko Ursulin
2026-10-26 18:37       ` Tejun Heo
2026-11-03 11:36         ` Tvrtko Ursulin
2026-10-22  9:38 ` [PATCH v7 4/4] drm/panthor: Create per queue priority workqueues Tvrtko Ursulin
2026-10-23 13:26   ` Liviu Dudau

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=ab160c52-1645-4ec9-9ea2-5b8bc36d9284@igalia.com \
    --to=tvrtko.ursulin@igalia.com \
    --cc=boris.brezillon@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=include@grrlz.net \
    --cc=jiangshanlai@gmail.com \
    --cc=kernel-dev@igalia.com \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=matthew.brost@intel.com \
    --cc=olv@google.com \
    --cc=steven.price@arm.com \
    --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

all inboxes | Powered by JetHome®