linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "tip-bot2 for Thomas Gleixner" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Frederic Weisbecker <frederic@kernel.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org, maz@kernel.org
Subject: [tip: irq/core] softirq: Move related code into one section
Date: Mon, 23 Nov 2020 22:51:43 -0000	[thread overview]
Message-ID: <160617190365.11115.3838746604966137453.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20201113141733.974214480@linutronix.de>

The following commit has been merged into the irq/core branch of tip:

Commit-ID:     ae9ef58996a4447dd44aa638759f913c883ba816
Gitweb:        https://git.kernel.org/tip/ae9ef58996a4447dd44aa638759f913c883ba816
Author:        Thomas Gleixner <tglx@linutronix.de>
AuthorDate:    Fri, 13 Nov 2020 15:02:18 +01:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Mon, 23 Nov 2020 10:31:06 +01:00

softirq: Move related code into one section

To prepare for adding a RT aware variant of softirq serialization and
processing move related code into one section so the necessary #ifdeffery
is reduced to one.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Link: https://lore.kernel.org/r/20201113141733.974214480@linutronix.de

---
 kernel/softirq.c | 107 +++++++++++++++++++++++-----------------------
 1 file changed, 54 insertions(+), 53 deletions(-)

diff --git a/kernel/softirq.c b/kernel/softirq.c
index 09229ad..617009c 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -92,6 +92,13 @@ static bool ksoftirqd_running(unsigned long pending)
 		!__kthread_should_park(tsk);
 }
 
+#ifdef CONFIG_TRACE_IRQFLAGS
+DEFINE_PER_CPU(int, hardirqs_enabled);
+DEFINE_PER_CPU(int, hardirq_context);
+EXPORT_PER_CPU_SYMBOL_GPL(hardirqs_enabled);
+EXPORT_PER_CPU_SYMBOL_GPL(hardirq_context);
+#endif
+
 /*
  * preempt_count and SOFTIRQ_OFFSET usage:
  * - preempt_count is changed by SOFTIRQ_OFFSET on entering or leaving
@@ -102,17 +109,11 @@ static bool ksoftirqd_running(unsigned long pending)
  * softirq and whether we just have bh disabled.
  */
 
+#ifdef CONFIG_TRACE_IRQFLAGS
 /*
- * This one is for softirq.c-internal use,
- * where hardirqs are disabled legitimately:
+ * This is for softirq.c-internal use, where hardirqs are disabled
+ * legitimately:
  */
-#ifdef CONFIG_TRACE_IRQFLAGS
-
-DEFINE_PER_CPU(int, hardirqs_enabled);
-DEFINE_PER_CPU(int, hardirq_context);
-EXPORT_PER_CPU_SYMBOL_GPL(hardirqs_enabled);
-EXPORT_PER_CPU_SYMBOL_GPL(hardirq_context);
-
 void __local_bh_disable_ip(unsigned long ip, unsigned int cnt)
 {
 	unsigned long flags;
@@ -203,6 +204,50 @@ void __local_bh_enable_ip(unsigned long ip, unsigned int cnt)
 }
 EXPORT_SYMBOL(__local_bh_enable_ip);
 
+static inline void invoke_softirq(void)
+{
+	if (ksoftirqd_running(local_softirq_pending()))
+		return;
+
+	if (!force_irqthreads) {
+#ifdef CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK
+		/*
+		 * We can safely execute softirq on the current stack if
+		 * it is the irq stack, because it should be near empty
+		 * at this stage.
+		 */
+		__do_softirq();
+#else
+		/*
+		 * Otherwise, irq_exit() is called on the task stack that can
+		 * be potentially deep already. So call softirq in its own stack
+		 * to prevent from any overrun.
+		 */
+		do_softirq_own_stack();
+#endif
+	} else {
+		wakeup_softirqd();
+	}
+}
+
+asmlinkage __visible void do_softirq(void)
+{
+	__u32 pending;
+	unsigned long flags;
+
+	if (in_interrupt())
+		return;
+
+	local_irq_save(flags);
+
+	pending = local_softirq_pending();
+
+	if (pending && !ksoftirqd_running(pending))
+		do_softirq_own_stack();
+
+	local_irq_restore(flags);
+}
+
 /*
  * We restart softirq processing for at most MAX_SOFTIRQ_RESTART times,
  * but break the loop if need_resched() is set or after 2 ms.
@@ -327,24 +372,6 @@ restart:
 	current_restore_flags(old_flags, PF_MEMALLOC);
 }
 
-asmlinkage __visible void do_softirq(void)
-{
-	__u32 pending;
-	unsigned long flags;
-
-	if (in_interrupt())
-		return;
-
-	local_irq_save(flags);
-
-	pending = local_softirq_pending();
-
-	if (pending && !ksoftirqd_running(pending))
-		do_softirq_own_stack();
-
-	local_irq_restore(flags);
-}
-
 /**
  * irq_enter_rcu - Enter an interrupt context with RCU watching
  */
@@ -371,32 +398,6 @@ void irq_enter(void)
 	irq_enter_rcu();
 }
 
-static inline void invoke_softirq(void)
-{
-	if (ksoftirqd_running(local_softirq_pending()))
-		return;
-
-	if (!force_irqthreads) {
-#ifdef CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK
-		/*
-		 * We can safely execute softirq on the current stack if
-		 * it is the irq stack, because it should be near empty
-		 * at this stage.
-		 */
-		__do_softirq();
-#else
-		/*
-		 * Otherwise, irq_exit() is called on the task stack that can
-		 * be potentially deep already. So call softirq in its own stack
-		 * to prevent from any overrun.
-		 */
-		do_softirq_own_stack();
-#endif
-	} else {
-		wakeup_softirqd();
-	}
-}
-
 static inline void tick_irq_exit(void)
 {
 #ifdef CONFIG_NO_HZ_COMMON

  parent reply	other threads:[~2020-11-23 22:52 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-13 14:02 [patch 00/19] softirq: Cleanups and RT awareness Thomas Gleixner
2020-11-13 14:02 ` [patch 01/19] parisc: Remove bogus __IRQ_STAT macro Thomas Gleixner
2020-11-23 22:51   ` [tip: irq/core] " tip-bot2 for Thomas Gleixner
2020-11-13 14:02 ` [patch 02/19] sh: Get rid of nmi_count() Thomas Gleixner
2020-11-23 22:51   ` [tip: irq/core] " tip-bot2 for Thomas Gleixner
2021-01-01 14:27   ` [patch 02/19] " John Paul Adrian Glaubitz
2020-11-13 14:02 ` [patch 03/19] irqstat: Get rid of nmi_count() and __IRQ_STAT() Thomas Gleixner
2020-11-23 22:51   ` [tip: irq/core] " tip-bot2 for Thomas Gleixner
2020-11-13 14:02 ` [patch 04/19] um/irqstat: Get rid of the duplicated declarations Thomas Gleixner
2020-11-23 22:51   ` [tip: irq/core] " tip-bot2 for Thomas Gleixner
2020-11-13 14:02 ` [patch 05/19] ARM: irqstat: Get rid of duplicated declaration Thomas Gleixner
2020-11-16 18:19   ` Valentin Schneider
2020-11-23 22:51   ` [tip: irq/core] " tip-bot2 for Thomas Gleixner
2020-11-13 14:02 ` [patch 06/19] arm64: " Thomas Gleixner
2020-11-16 10:01   ` Will Deacon
2020-11-16 10:51   ` Marc Zyngier
2020-11-23 22:51   ` [tip: irq/core] " tip-bot2 for Thomas Gleixner
2020-11-13 14:02 ` [patch 07/19] asm-generic/irqstat: Add optional __nmi_count member Thomas Gleixner
2020-11-23 22:51   ` [tip: irq/core] " tip-bot2 for Thomas Gleixner
2020-11-13 14:02 ` [patch 08/19] sh: irqstat: Use the generic irq_cpustat_t Thomas Gleixner
2020-11-23 22:51   ` [tip: irq/core] " tip-bot2 for Thomas Gleixner
2020-11-13 14:02 ` [patch 09/19] irqstat: Move declaration into asm-generic/hardirq.h Thomas Gleixner
2020-11-23 22:51   ` [tip: irq/core] " tip-bot2 for Thomas Gleixner
2020-11-13 14:02 ` [patch 10/19] preempt: Cleanup the macro maze a bit Thomas Gleixner
2020-11-16 12:17   ` Peter Zijlstra
2020-11-16 17:42     ` Thomas Gleixner
2020-11-17 10:21       ` Peter Zijlstra
2020-11-23 22:51   ` [tip: irq/core] " tip-bot2 for Thomas Gleixner
2020-11-13 14:02 ` [patch 11/19] softirq: Move related code into one section Thomas Gleixner
2020-11-19 12:20   ` Frederic Weisbecker
2020-11-23 22:51   ` tip-bot2 for Thomas Gleixner [this message]
2020-11-13 14:02 ` [patch 12/19] softirq: Add RT specific softirq accounting Thomas Gleixner
2020-11-19 12:18   ` Frederic Weisbecker
2020-11-19 18:34     ` Thomas Gleixner
2020-11-19 22:52       ` Frederic Weisbecker
2020-11-13 14:02 ` [patch 13/19] softirq: Move various protections into inline helpers Thomas Gleixner
2020-11-13 14:02 ` [patch 14/19] softirq: Make softirq control and processing RT aware Thomas Gleixner
2020-11-20  0:26   ` Frederic Weisbecker
2020-11-20 13:27     ` Thomas Gleixner
2020-11-23 13:44   ` Frederic Weisbecker
2020-11-23 19:27     ` Thomas Gleixner
2020-11-23 19:56       ` Frederic Weisbecker
2020-11-23 23:58       ` Frederic Weisbecker
2020-11-24  0:06         ` Thomas Gleixner
2020-11-24  0:13           ` Frederic Weisbecker
2020-11-24  0:22             ` Thomas Gleixner
2020-11-13 14:02 ` [patch 15/19] tick/sched: Prevent false positive softirq pending warnings on RT Thomas Gleixner
2020-11-13 14:02 ` [patch 16/19] rcu: Prevent false positive softirq warning " Thomas Gleixner
2020-11-13 14:02 ` [patch 17/19] softirq: Replace barrier() with cpu_relax() in tasklet_unlock_wait() Thomas Gleixner
2020-11-13 14:02 ` [patch 18/19] tasklets: Use static inlines for stub implementations Thomas Gleixner
2020-11-13 14:02 ` [patch 19/19] tasklets: Prevent kill/unlock_wait deadlock on RT 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=160617190365.11115.3838746604966137453.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=maz@kernel.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).