From: "tip-bot2 for Thomas Gleixner" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
x86@kernel.org, linux-kernel@vger.kernel.org, maz@kernel.org
Subject: [tip: irq/core] tasklets: Provide tasklet_disable_in_atomic()
Date: Wed, 17 Mar 2021 15:48:59 -0000 [thread overview]
Message-ID: <161599613929.398.10403047362776200822.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20210309084241.563164193@linutronix.de>
The following commit has been merged into the irq/core branch of tip:
Commit-ID: ca5f625118955fc544c3cb3dee7055d33ecadafb
Gitweb: https://git.kernel.org/tip/ca5f625118955fc544c3cb3dee7055d33ecadafb
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 09 Mar 2021 09:42:06 +01:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Wed, 17 Mar 2021 16:33:52 +01:00
tasklets: Provide tasklet_disable_in_atomic()
Replacing the spin wait loops in tasklet_unlock_wait() with
wait_var_event() is not possible as a handful of tasklet_disable()
invocations are happening in atomic context. All other invocations are in
teardown paths which can sleep.
Provide tasklet_disable_in_atomic() and tasklet_unlock_spin_wait() to
convert the few atomic use cases over, which allows to change
tasklet_disable() and tasklet_unlock_wait() in a later step.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20210309084241.563164193@linutronix.de
---
include/linux/interrupt.h | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 0a4ce25..3c8a291 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -675,10 +675,21 @@ static inline void tasklet_unlock_wait(struct tasklet_struct *t)
while (test_bit(TASKLET_STATE_RUN, &t->state))
cpu_relax();
}
+
+/*
+ * Do not use in new code. Waiting for tasklets from atomic contexts is
+ * error prone and should be avoided.
+ */
+static inline void tasklet_unlock_spin_wait(struct tasklet_struct *t)
+{
+ while (test_bit(TASKLET_STATE_RUN, &t->state))
+ cpu_relax();
+}
#else
static inline int tasklet_trylock(struct tasklet_struct *t) { return 1; }
static inline void tasklet_unlock(struct tasklet_struct *t) { }
static inline void tasklet_unlock_wait(struct tasklet_struct *t) { }
+static inline void tasklet_unlock_spin_wait(struct tasklet_struct *t) { }
#endif
extern void __tasklet_schedule(struct tasklet_struct *t);
@@ -703,6 +714,17 @@ static inline void tasklet_disable_nosync(struct tasklet_struct *t)
smp_mb__after_atomic();
}
+/*
+ * Do not use in new code. Disabling tasklets from atomic contexts is
+ * error prone and should be avoided.
+ */
+static inline void tasklet_disable_in_atomic(struct tasklet_struct *t)
+{
+ tasklet_disable_nosync(t);
+ tasklet_unlock_spin_wait(t);
+ smp_mb();
+}
+
static inline void tasklet_disable(struct tasklet_struct *t)
{
tasklet_disable_nosync(t);
next prev parent reply other threads:[~2021-03-17 15:50 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-09 8:42 [patch 00/14] tasklets: Replace the spin wait loops and make it RT safe Thomas Gleixner
2021-03-09 8:42 ` [patch 01/14] tasklets: Replace barrier() with cpu_relax() in tasklet_unlock_wait() Thomas Gleixner
2021-03-17 15:49 ` [tip: irq/core] " tip-bot2 for Thomas Gleixner
2021-03-09 8:42 ` [patch 02/14] tasklets: Use static inlines for stub implementations Thomas Gleixner
2021-03-17 15:48 ` [tip: irq/core] " tip-bot2 for Thomas Gleixner
2021-03-09 8:42 ` [patch 03/14] tasklets: Provide tasklet_disable_in_atomic() Thomas Gleixner
2021-03-17 15:48 ` tip-bot2 for Thomas Gleixner [this message]
2021-03-09 8:42 ` [patch 04/14] tasklets: Use spin wait in tasklet_disable() temporarily Thomas Gleixner
2021-03-17 15:48 ` [tip: irq/core] " tip-bot2 for Thomas Gleixner
2021-03-09 8:42 ` [patch 05/14] tasklets: Replace spin wait in tasklet_unlock_wait() Thomas Gleixner
2021-03-17 15:48 ` [tip: irq/core] " tip-bot2 for Peter Zijlstra
2021-03-09 8:42 ` [patch 06/14] tasklets: Replace spin wait in tasklet_kill() Thomas Gleixner
2021-03-17 15:48 ` [tip: irq/core] " tip-bot2 for Peter Zijlstra
2021-03-09 8:42 ` [patch 07/14] tasklets: Prevent tasklet_unlock_spin_wait() deadlock on RT Thomas Gleixner
2021-03-09 15:00 ` Sebastian Andrzej Siewior
2021-03-09 15:21 ` Sebastian Andrzej Siewior
2021-03-10 8:35 ` Thomas Gleixner
2021-03-17 15:48 ` [tip: irq/core] " tip-bot2 for Thomas Gleixner
2021-03-09 8:42 ` [patch 08/14] net: jme: Replace link-change tasklet with work Thomas Gleixner
2021-03-17 15:48 ` [tip: irq/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-03-09 8:42 ` [patch 09/14] net: sundance: Use tasklet_disable_in_atomic() Thomas Gleixner
2021-03-17 15:48 ` [tip: irq/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-03-09 8:42 ` [patch 10/14] ath9k: " Thomas Gleixner
2021-03-09 10:23 ` Kalle Valo
2021-03-17 15:48 ` [tip: irq/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-03-09 8:42 ` [patch 11/14] atm: eni: Use tasklet_disable_in_atomic() in the send() callback Thomas Gleixner
2021-03-17 15:48 ` [tip: irq/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-03-09 8:42 ` [patch 12/14] PCI: hv: Use tasklet_disable_in_atomic() Thomas Gleixner
2021-03-09 22:17 ` Bjorn Helgaas
2021-03-10 11:34 ` Wei Liu
2021-03-17 15:48 ` [tip: irq/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-03-09 8:42 ` [patch 13/14] firewire: ohci: Use tasklet_disable_in_atomic() where required Thomas Gleixner
2021-03-17 15:48 ` [tip: irq/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-03-09 8:42 ` [patch 14/14] tasklets: Switch tasklet_disable() to the sleep wait variant Thomas Gleixner
2021-03-17 15:48 ` [tip: irq/core] " tip-bot2 for Thomas Gleixner
2021-03-09 14:04 ` [patch 00/14] tasklets: Replace the spin wait loops and make it RT safe Peter Zijlstra
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=161599613929.398.10403047362776200822.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=maz@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).