All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "George Karagounis" <taterraster@gmail.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH 3/3] HID: logitech-hidpp: Replace create_singlethread_workqueue with alloc_ordered_workqueue
Date: Wed, 28 Oct 2026 11:31:39 +0000	[thread overview]
Message-ID: <sashiko-outbox-187819@kernel.org> (raw)
In-Reply-To: <20261028111853.22429-4-mail@taterr.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] HID: logitech-hidpp: misuse of WQ_MEM_RECLAIM in hidpp_ff_init()
--

commit 652f6e8738d9258b57261902879ab9a6f517f7aa
Author: George Karagounis <taterraster@gmail.com>

HID: logitech-hidpp: Replace create_singlethread_workqueue with alloc_ordered_workqueue

This commit replaces create_singlethread_workqueue() with
alloc_ordered_workqueue() using the WQ_MEM_RECLAIM flag for the
force-feedback sendqueue in hidpp_ff_init().

> diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
> index 27d83b8bbaaf3..4efd26450539c 100644
> --- a/drivers/hid/hid-logitech-hidpp.c
> +++ b/drivers/hid/hid-logitech-hidpp.c
> @@ -2875,7 +2875,7 @@ static int hidpp_ff_init(struct hidpp_device *hidpp,
>  		error = -ENOMEM;
>  		goto err_free_data;
>  	}
> -	data->wq = create_singlethread_workqueue("hidpp-ff-sendqueue");
> +	data->wq = alloc_ordered_workqueue("hidpp-ff-sendqueue", WQ_MEM_RECLAIM);

[Severity: Medium]
Should the flags argument to alloc_ordered_workqueue() in hidpp_ff_init()
be 0 instead of WQ_MEM_RECLAIM?

Per Documentation/core-api/workqueue.rst, WQ_MEM_RECLAIM is intended only
for workqueues that may be depended upon during memory reclaim.
create_singlethread_workqueue() was deprecated because it unconditionally
set __WQ_LEGACY | WQ_MEM_RECLAIM even on workqueues outside the reclaim
path.

Passing WQ_MEM_RECLAIM to alloc_ordered_workqueue() drops __WQ_LEGACY while
keeping WQ_MEM_RECLAIM. This spawns an unnecessary rescuer kthread via
init_rescuer() and enables check_flush_dependency() warnings:

kernel/workqueue.c:check_flush_dependency() {
	...
	WARN_ONCE(worker && worker->current_pwq && ((worker->current_pwq->wq->flags &
			      (WQ_MEM_RECLAIM | __WQ_LEGACY)) == WQ_MEM_RECLAIM),
		  "workqueue: WQ_MEM_RECLAIM %s:%ps is flushing !WQ_MEM_RECLAIM %s:%ps",
	...
}

Furthermore, the commit message states that WQ_MEM_RECLAIM is added to
ensure hardware events can be processed under memory pressure, but
hidpp-ff-sendqueue only sends outgoing force-feedback commands and relies
on GFP_KERNEL allocations both when queueing work in hidpp_ff_queue_work():

drivers/hid/hid-logitech-hidpp.c:hidpp_ff_queue_work() {
	struct hidpp_ff_work_data *wd = kzalloc_obj(*wd);
	...
}

and when executing work via
hidpp_ff_work_handler() -> hidpp_send_fap_command_sync():

drivers/hid/hid-logitech-hidpp.c:hidpp_send_fap_command_sync() {
	struct hidpp_report *message;
	int ret;

	message = kzalloc_obj(struct hidpp_report);
	if (!message)
		return -ENOMEM;
	...
}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261028111853.22429-1-mail@taterr.org?part=3

      reply	other threads:[~2026-10-28 11:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-28 11:18 [PATCH 0/3] HID: Replace deprecated create_singlethread_workqueue George Karagounis
2026-10-28 11:18 ` [PATCH 1/3] HID: haptic: Replace create_singlethread_workqueue with alloc_ordered_workqueue George Karagounis
2026-10-28 11:33   ` sashiko-bot
2026-10-28 11:18 ` [PATCH 2/3] HID: elo: " George Karagounis
2026-10-28 11:18 ` [PATCH 3/3] HID: logitech-hidpp: " George Karagounis
2026-10-28 11:31   ` sashiko-bot [this message]

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=sashiko-outbox-187819@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=taterraster@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.