From: "Jörn Engel" <joern@purestorage.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Spencer Baugh <sbaugh@catern.com>,
Don Zickus <dzickus@redhat.com>,
Ulrich Obergfell <uobergfe@redhat.com>,
Ingo Molnar <mingo@kernel.org>, Andrew Jones <drjones@redhat.com>,
chai wen <chaiw.fnst@cn.fujitsu.com>,
Chris Metcalf <cmetcalf@ezchip.com>,
Stephane Eranian <eranian@google.com>,
open list <linux-kernel@vger.kernel.org>,
Spencer Baugh <Spencer.baugh@purestorage.com>,
Joern Engel <joern@logfs.org>
Subject: Re: [PATCH] soft lockup: kill realtime threads before panic
Date: Wed, 22 Jul 2015 16:29:46 -0700 [thread overview]
Message-ID: <20150722232946.GA18432@Sligo.logfs.org> (raw)
In-Reply-To: <20150722155436.04d66934cd423107b810f2b1@linux-foundation.org>
On Wed, Jul 22, 2015 at 03:54:36PM -0700, Andrew Morton wrote:
> On Tue, 21 Jul 2015 15:07:57 -0700 Spencer Baugh <sbaugh@catern.com> wrote:
>
> > From: Joern Engel <joern@logfs.org>
> >
> > We have observed cases where the soft lockup detector triggered, but no
> > kernel bug existed. Instead we had a buggy realtime thread that
> > monopolized a cpu. So let's kill the responsible party and not panic
> > the entire system.
> >
> > ...
> >
> > --- a/kernel/watchdog.c
> > +++ b/kernel/watchdog.c
> > @@ -428,7 +428,10 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
> > }
> >
> > add_taint(TAINT_SOFTLOCKUP, LOCKDEP_STILL_OK);
> > - if (softlockup_panic)
> > + if (rt_prio(current->prio)) {
> > + pr_emerg("killing realtime thread\n");
> > + send_sig(SIGILL, current, 0);
>
> Why choose SIGILL?
It is a random signal that happens to generate a stacktrace in
userspace.
> > + } else if (softlockup_panic)
> > panic("softlockup: hung tasks");
> > __this_cpu_write(soft_watchdog_warn, true);
>
> But what about a non-buggy realtime thread which happens to
> occasionally spend 15 seconds doing stuff?
>
> Old behaviour: kernel blurts a softlockup message, everything keeps running.
>
> New behaviour: thread gets killed, plane crashes.
>
>
> Possibly a better approach would be to only kill the thread if
> softlockup_panic was set, because the system is going down anyway.
>
> Also, perhaps some users would prefer that the kernel simply suppress
> the softlockup warning in this situation, rather than killing stuff!
>
>
>
>
> Really, what you're trying to implement here is a watchdog for runaway
> realtime threads. And that sounds a worthy project but it's a rather
> separate thing from the softlockup detector. A realtime thread
> watchdog feature might have things as
>
> - timeout duration separately configurable from softlockup
>
> - enabled independently from sotflockup: people might want one and
> not the other.
>
> - configurable signal, perhaps?
>
> Now, the *implementation* of the realtime thread watchdog may well
> share code with the softlockup detector. But from a
> conceptual/configuration/documentation point of view, it's a separate
> thing, no?
Agreed. We needed this patch exactly once and it is a rather quick hack
that yielded the necessary results. Realtime threads were well-behaved
since and the patch has seen zero polish as a result.
I think it is better to drop the patch for now. If someone else keeps
running into the same issue, it might be a starting point for a better
implementation. They will find it in list archives.
Jörn
--
I can say that I spend most of my time fixing bugs even if I have lots
of new features to implement in mind, but I give bugs more priority.
-- Andrea Arcangeli, 2000
prev parent reply other threads:[~2015-07-22 23:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-21 22:07 [PATCH] soft lockup: kill realtime threads before panic Spencer Baugh
2015-07-22 4:36 ` Mike Galbraith
2015-07-22 5:18 ` Jörn Engel
2015-07-22 5:41 ` Mike Galbraith
2015-07-22 6:33 ` Jörn Engel
2015-07-22 7:35 ` Mike Galbraith
2015-07-22 13:52 ` Don Zickus
2015-07-22 16:35 ` Jörn Engel
2015-07-22 6:59 ` yalin wang
2015-07-22 22:54 ` Andrew Morton
2015-07-22 23:29 ` Jörn Engel [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=20150722232946.GA18432@Sligo.logfs.org \
--to=joern@purestorage.com \
--cc=Spencer.baugh@purestorage.com \
--cc=akpm@linux-foundation.org \
--cc=chaiw.fnst@cn.fujitsu.com \
--cc=cmetcalf@ezchip.com \
--cc=drjones@redhat.com \
--cc=dzickus@redhat.com \
--cc=eranian@google.com \
--cc=joern@logfs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=sbaugh@catern.com \
--cc=uobergfe@redhat.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