public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: "Intel-gfx@lists.freedesktop.org"
	<Intel-gfx@lists.freedesktop.org>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	linux-kernel@vger.kernel.org, sultan@kerneltoast.com
Subject: Re: [Intel-gfx] signal: break out of wait loops on kthread_stop()
Date: Wed, 19 Oct 2022 14:19:23 -0600	[thread overview]
Message-ID: <Y1Bby6FEEWiFIjjD@zx2c4.com> (raw)
In-Reply-To: <8acc3e4a-abbc-32bc-626e-7a216f6755c3@linux.intel.com>

On Wed, Oct 19, 2022 at 09:09:28PM +0100, Tvrtko Ursulin wrote:
> Hm why is kthread_stop() after kthread_run() abuse? I don't see it in 
> kerneldoc that it must not be used for stopping threads.

Because you don't want it to stop. You want to wait until it's done. If
you call stop right after run, it will even stop it before it even
begins to run. That's why you wind up sprinkling your msleeps
everywhere, indicating that clearly this is not meant to work that way.

> Yep the yields and sleeps are horrible and will go. But they are also 
> not relevant for the topic at hand.

Except they very much are. The reason you need these is because you're
using kthread_stop() for something it's not meant to do.

> Never mind, I was not looking for anything more than a suggestion on how 
> to maybe work around it in piece as someone is dealing with the affected 
> call sites.

Sultan's kthread_work idea is probably the right direction. This would
seem to have what you need.

Jason

  reply	other threads:[~2022-10-19 20:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19 13:31 signal: break out of wait loops on kthread_stop() Tvrtko Ursulin
2022-10-19 16:00 ` Jason A. Donenfeld
2022-10-19 16:01   ` Jason A. Donenfeld
2022-10-19 17:57   ` Tvrtko Ursulin
2022-10-19 18:16     ` Jason A. Donenfeld
2022-10-19 19:05       ` Sultan Alsawaf
2022-10-19 20:09       ` Tvrtko Ursulin
2022-10-19 20:19         ` Jason A. Donenfeld [this message]
2022-10-20 13:45           ` [Intel-gfx] " Tvrtko Ursulin
2022-11-28 18:22             ` Eric W. Biederman
2022-11-28 18:27               ` Jason A. Donenfeld
2022-11-30 15:26                 ` Eric W. Biederman

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=Y1Bby6FEEWiFIjjD@zx2c4.com \
    --to=jason@zx2c4.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sultan@kerneltoast.com \
    --cc=tvrtko.ursulin@linux.intel.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