From: Chris Wilson <chris@chris-wilson.co.uk>
To: linux-kernel@vger.kernel.org
Cc: intel-gfx@lists.freedesktop.org,
Tvrtko Ursulin <tvrtko.ursulin@intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Hannes Reinecke <hare@suse.com>, Jens Axboe <axboe@kernel.dk>,
Bjorn Helgaas <bhelgaas@google.com>,
Alexander Potapenko <glider@google.com>,
Chen Fan <chen.fan.fnst@cn.fujitsu.com>,
Ingo Molnar <mingo@kernel.org>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Johannes Thumshirn <jthumshirn@suse.de>,
Emese Revfy <re.emese@gmail.com>,
Sagi Grimberg <sagi@grimberg.me>,
Eric Dumazet <edumazet@google.com>,
Tom Herbert <therbert@google.com>,
Ben Hutchings <bhutchings@solarflare.com>
Subject: Re: [PATCH] softirq: Prevent looping on disabled tasklets
Date: Sun, 12 Feb 2017 14:23:46 +0000 [thread overview]
Message-ID: <20170212142346.GC14326@nuc-i3427.alporthouse.com> (raw)
In-Reply-To: <20170212140019.3450-1-chris@chris-wilson.co.uk>
On Sun, Feb 12, 2017 at 02:00:19PM +0000, Chris Wilson wrote:
> Disabling a tasklet causes it not to run during tasklet_action, but is
> put back onto the runnable tasklet list, and a new softirq raised. As
> the softirq is raised from within __do_softirq() this causing
> __do_softirq() to loop constantly until its timeslice expires and is
> transferred to the ksoftirq thread. ksoftirq then permanently spins,
> as on each action, the disabled tasklet keeps reraising the softirq.
>
> Break this vicious cycle by moving the softirq from the action to the
> final tasklet_enable().
>
> This behaviour appears to be historic (since the first git import).
> However, the looping until timeslice duration (to a max of 2ms) was
> first introduced in commit c10d73671ad3 ("softirq: reduce latencies"),
> with the restart limit restored in commit 34376a50fb1f ("Fix lockup
> related to stop_machine being stuck in __do_softirq.")
>
> Reported-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Hannes Reinecke <hare@suse.com>
> Cc: Jens Axboe <axboe@kernel.dk>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Alexander Potapenko <glider@google.com>
> Cc: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Cc: Johannes Thumshirn <jthumshirn@suse.de>
> Cc: Emese Revfy <re.emese@gmail.com>
> Cc: Sagi Grimberg <sagi@grimberg.me>
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: Tom Herbert <therbert@google.com>
> Cc: Ben Hutchings <bhutchings@solarflare.com>
> ---
> include/linux/interrupt.h | 7 +++++--
> kernel/softirq.c | 2 --
> 2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
> index 53144e78a369..12750f00d00d 100644
> --- a/include/linux/interrupt.h
> +++ b/include/linux/interrupt.h
> @@ -613,8 +613,11 @@ static inline void tasklet_disable(struct tasklet_struct *t)
>
> static inline void tasklet_enable(struct tasklet_struct *t)
> {
> - smp_mb__before_atomic();
> - atomic_dec(&t->count);
> + if (!atomic_dec_and_test(&t->count))
> + return;
> +
> + if (test_bit(TASKLET_STATE_SCHED, &t->state))
> + raise_softirq(HI_SOFTIRQ | TASKLET_SOFTIRQ);
raise_softirq is not exported, so let's move tasklet_enable()
out-of-line and export that.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
next prev parent reply other threads:[~2017-02-12 14:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-12 14:00 Chris Wilson
2017-02-12 14:23 ` Chris Wilson [this message]
2017-02-12 14:31 ` [PATCH v2] " Chris Wilson
2017-02-12 15:04 ` [Intel-gfx] [PATCH] " kbuild test robot
2017-02-12 15:16 ` kbuild test robot
2017-02-12 15:46 ` [PATCH v3] " Chris Wilson
2017-02-12 16:03 ` Chris Wilson
2017-02-17 11:55 ` Thomas Gleixner
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=20170212142346.GC14326@nuc-i3427.alporthouse.com \
--to=chris@chris-wilson.co.uk \
--cc=axboe@kernel.dk \
--cc=bhelgaas@google.com \
--cc=bhutchings@solarflare.com \
--cc=bigeasy@linutronix.de \
--cc=chen.fan.fnst@cn.fujitsu.com \
--cc=edumazet@google.com \
--cc=glider@google.com \
--cc=hare@suse.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jthumshirn@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=re.emese@gmail.com \
--cc=sagi@grimberg.me \
--cc=tglx@linutronix.de \
--cc=therbert@google.com \
--cc=tvrtko.ursulin@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
all inboxes | Powered by JetHome®