Linux Serial subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Bradley Morgan" <brads@mainlining.org>
Cc: media-ci@linuxtv.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH v2 5/5] kthread: remove worker->task self assignment
Date: Sat, 05 Sep 2026 09:40:38 +0000	[thread overview]
Message-ID: <20260905094039.3490D1F00A3E@smtp.kernel.org> (raw)
In-Reply-To: <c925e99c73bea9e0cdab656ba09453df7e81dcb2.1788513591.git.brads@mainlining.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Removing the self-assignment `worker->task = current;` breaks out-of-tree (OOT) users of the old `kthread_run(kthread_worker_fn, ...)` API, causing them to permanently deadlock due to missed wakeups.
--

commit 4e8323d40e4fe5053d4171cbca8193f9bd6080b8
Author: Bradley Morgan <brads@mainlining.org>

kthread: remove worker->task self assignment

All kthread worker users now create their workers with kthread_create_worker*(),
which sets worker->task before the worker starts. The self assignment in
kthread_worker_fn() is removed, leaving a warning check for out-of-tree users.

> diff --git a/kernel/kthread.c b/kernel/kthread.c
> index 63beb59b7a3d1..643407647e79d 100644
> --- a/kernel/kthread.c
> +++ b/kernel/kthread.c
> @@ -987,12 +987,10 @@ int kthread_worker_fn(void *worker_ptr)
>  	struct kthread_worker *worker = worker_ptr;
>  	struct kthread_work *work;
>  
> -	/*
> -	 * FIXME: Update the check and remove the assignment when all kthread
> -	 * worker users are created using kthread_create_worker*() functions.
> +	/* All workers are created with worker->task set. If this fires,
> +	 * the caller is broken.
>  	 */
> -	WARN_ON(worker->task && worker->task != current);
> -	worker->task = current;
> +	WARN_ON(worker->task != current);

[Severity: Medium]
Does removing this assignment cause out-of-tree users of the old
kthread_run() API to hang permanently?

Because the self-assignment is removed, worker->task will remain NULL for any
callers still using the old API. When new work is inserted, the wakeup will be
silently skipped in kthread_insert_work():

kernel/kthread.c:kthread_insert_work() {
	...
	if (!worker->current_work && likely(worker->task))
		wake_up_process(worker->task);
	...
}

This means the warning intended as a sanity check turns into a silent, fatal
breakage where the worker hangs in TASK_INTERRUPTIBLE and queued work is never
processed.

>  
>  	if (worker->flags & KTW_FREEZABLE)
>  		set_freezable();

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1788513591.git.brads@mainlining.org?part=5

  reply	other threads:[~2026-09-05  9:40 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04  9:37 [PATCH v2 0/5] kthread: convert remaining users to kthread_create_worker Bradley Morgan
2026-09-04  9:37 ` [PATCH v2 1/5] media: ivtv: convert to kthread_run_worker Bradley Morgan
2026-09-04 10:44   ` Bradley Morgan
2026-09-05  9:40   ` sashiko-bot
2026-09-05  9:51     ` Bradley Morgan
2026-09-04  9:40 ` [PATCH v2 2/5] net: encx24j600: " Bradley Morgan
2026-09-05  9:40   ` sashiko-bot
2026-09-05  9:54     ` Bradley Morgan
2026-09-04  9:40 ` [PATCH v2 4/5] cpufreq: schedutil: convert to kthread_create_worker Bradley Morgan
2026-09-05  9:40   ` sashiko-bot
2026-09-04  9:40 ` [PATCH v2 3/5] tty: sc16is7xx: convert to kthread_run_worker Bradley Morgan
2026-09-05  9:40   ` sashiko-bot
2026-09-05  9:51     ` Bradley Morgan
2026-09-04  9:40 ` [PATCH v2 5/5] kthread: remove worker->task self assignment Bradley Morgan
2026-09-05  9:40   ` sashiko-bot [this message]
2026-09-05  9:50     ` Bradley Morgan
2026-09-05 14:37   ` kernel test robot
2026-09-05 14:50     ` Bradley Morgan
2026-09-05 15:11   ` kernel test robot
2026-09-04 15:54 ` [PATCH v2 0/5] kthread: convert remaining users to kthread_create_worker Jakub Kicinski
2026-09-04 15:56   ` Bradley Morgan
2026-09-04 21:10     ` Jakub Kicinski
2026-09-04 21:13       ` Bradley Morgan
2026-09-05 11:19         ` Greg Kroah-Hartman
2026-09-05 12:55           ` Bradley Morgan
2026-09-05 17:10             ` Greg Kroah-Hartman
2026-09-05 17:56               ` Bradley Morgan

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=20260905094039.3490D1F00A3E@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=brads@mainlining.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=media-ci@linuxtv.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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