[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201123134437.GA95787@lothringen>
Date: Mon, 23 Nov 2020 14:44:37 +0100
From: Frederic Weisbecker <frederic@...nel.org>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Paul McKenney <paulmck@...nel.org>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Arnd Bergmann <arnd@...db.de>,
"James E.J. Bottomley" <James.Bottomley@...senPartnership.com>,
Helge Deller <deller@....de>, linux-parisc@...r.kernel.org,
Yoshinori Sato <ysato@...rs.sourceforge.jp>,
Rich Felker <dalias@...c.org>, linux-sh@...r.kernel.org,
Jeff Dike <jdike@...toit.com>,
Richard Weinberger <richard@....at>,
Anton Ivanov <anton.ivanov@...bridgegreys.com>,
linux-um@...ts.infradead.org, Russell King <linux@...linux.org.uk>,
Marc Zyngier <maz@...nel.org>,
Valentin Schneider <valentin.schneider@....com>,
linux-arm-kernel@...ts.infradead.org,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>
Subject: Re: [patch 14/19] softirq: Make softirq control and processing RT
aware
On Fri, Nov 13, 2020 at 03:02:21PM +0100, Thomas Gleixner wrote:
> +void __local_bh_enable_ip(unsigned long ip, unsigned int cnt)
> +{
> + bool preempt_on = preemptible();
> + unsigned long flags;
> + u32 pending;
> + int curcnt;
> +
> + WARN_ON_ONCE(in_irq());
> + lockdep_assert_irqs_enabled();
> +
> + local_irq_save(flags);
> + curcnt = this_cpu_read(softirq_ctrl.cnt);
> +
> + /*
> + * If this is not reenabling soft interrupts, no point in trying to
> + * run pending ones.
> + */
> + if (curcnt != cnt)
> + goto out;
> +
> + pending = local_softirq_pending();
> + if (!pending || ksoftirqd_running(pending))
> + goto out;
> +
> + /*
> + * If this was called from non preemptible context, wake up the
> + * softirq daemon.
> + */
> + if (!preempt_on) {
> + wakeup_softirqd();
> + goto out;
> + }
> +
> + /*
> + * Adjust softirq count to SOFTIRQ_OFFSET which makes
> + * in_serving_softirq() become true.
> + */
> + cnt = SOFTIRQ_OFFSET;
> + __local_bh_enable(cnt, false);
But then you enter __do_softirq() with softirq_count() == SOFTIRQ_OFFSET.
__do_softirq() calls softirq_handle_begin() which then sets it back to SOFTIRQ_DISABLE_OFFSET...
> + __do_softirq();
> +
> +out:
> + __local_bh_enable(cnt, preempt_on);
You escape from there with a correct preempt_count() but still the softirq executes
under SOFTIRQ_DISABLE_OFFSET and not SOFTIRQ_OFFSET, making in_serving_softirq() false.
> + local_irq_restore(flags);
> +}
> +EXPORT_SYMBOL(__local_bh_enable_ip);
Thanks.
Powered by blists - more mailing lists