From: Peter Zijlstra <peterz@infradead.org>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: linux-kernel@vger.kernel.org, Oleg Nesterov <oleg@redhat.com>,
"Eric W . Biederman" <ebiederm@xmission.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
Gavin Schenk <g.schenk@eckelmann.de>,
kernel@pengutronix.de
Subject: Re: [PATCH] RFC: siox: don't create a thread without starting it
Date: Mon, 25 Jun 2018 14:51:05 +0200 [thread overview]
Message-ID: <20180625125105.GZ2494@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20180625102056.28468-1-u.kleine-koenig@pengutronix.de>
On Mon, Jun 25, 2018 at 12:20:56PM +0200, Uwe Kleine-König wrote:
> when I just boot without any other siox-related action. So the kthread (created
> in drivers/siox/siox-core.c:siox_master_register()) is never started.
>
> While you could argue that there is little reason to not start the
> thread there also is little reason to actually do it.
Well, you really _should_ wake up the thread. That first wakeup really
is part of the whole 'create/setup' kthread pattern.
> peterz in #kernelnewbies said "[...] kernel/kthread.c:kthread() should
> really be using __set_current_state(TASK_IDLE), I suppose". This however
> seems to interfere with problems fixed in a076e4bca2fd ("freezer: fix
> kthread_create vs freezer theoretical race").
I don't think so, that patch has an issue with INTERRUPTIBLE, but IDLE
very much doesn't allow signals like INTERRUPTIBLE does.
> So I wonder where the real problem is and how it can be fixed.
Without the first wakeup, the kthread will not run the provided function
and we can therefore argue the creation is incomplete. I really feel you
should just wake the thing up to land in your own wait-condition-loop.
That said, irrespective of the whole UNINTERRUPTIBLE/IDLE thing, I find
this construct fairly fragile. We rely on not getting any spurious
wakeups without a 'special' state. The only reason this doesn't normally
happen is because it's a new task, but since it is already hashed, it
might well be possible to trick someone into sending a wakeup.
next prev parent reply other threads:[~2018-06-25 12:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-25 10:20 Uwe Kleine-König
2018-06-25 12:51 ` Peter Zijlstra [this message]
2018-06-25 19:21 ` Uwe Kleine-König
2018-06-26 7:31 ` Peter Zijlstra
2018-06-28 7:57 ` [PATCH] " Uwe Kleine-König
2018-06-28 8:18 ` Uwe Kleine-König
2018-06-29 6:27 ` Schenk, Gavin
2018-06-29 7:38 ` Uwe Kleine-König
2018-07-01 23:34 ` Stephen Rothwell
2018-07-02 0:40 ` Stephen Rothwell
2018-07-02 6:49 ` Uwe Kleine-König
2018-06-26 7:37 ` [PATCH] RFC: " Peter Zijlstra
2018-06-26 7:38 ` Peter Zijlstra
2018-06-28 8:03 ` Uwe Kleine-König
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=20180625125105.GZ2494@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=g.schenk@eckelmann.de \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=rafael.j.wysocki@intel.com \
--cc=u.kleine-koenig@pengutronix.de \
/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®