linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL]
@ 2018-05-08 13:38 Frederic Weisbecker
  2018-05-08 13:38 ` [PATCH 01/11] ia64: Convert local_softirq_pending() to per-cpu ops Frederic Weisbecker
                   ` (11 more replies)
  0 siblings, 12 replies; 39+ messages in thread
From: Frederic Weisbecker @ 2018-05-08 13:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Frederic Weisbecker, Sebastian Andrzej Siewior, Tony Luck,
	Peter Zijlstra, David S . Miller, Yoshinori Sato,
	Michael Ellerman, Helge Deller, Benjamin Herrenschmidt,
	Paul Mackerras, Thomas Gleixner, Martin Schwidefsky, Rich Felker,
	Fenghua Yu, Heiko Carstens, James E . J . Bottomley

Ingo,

Please pull the softirq/mask-v4 branch that can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git
	softirq/mask-v4

HEAD: dc06cbb5e1296938211040bccdacd7a361469116

Changes since v3:

* Rebase against v4.17-rc4
* Fix build error on SH. (new patch "sh: Use nmi_count() on /proc/interrupts print out")

--
The softirq mask and its accessors/mutators have many implementations
scattered around many architectures. Most do the same things consisting
in a field in a per-cpu struct (often irq_cpustat_t) accessed through
per-cpu ops. We can provide instead a generic efficient version that
most of them can use. In fact s390 is the only exception because the
field is stored in lowcore.

Thanks,
	Frederic
---

Frederic Weisbecker (11):
      ia64: Convert local_softirq_pending() to per-cpu ops
      sparc: Convert local_softirq_pending() to use per-cpu op
      sh: Use nmi_count() on /proc/interrupts print out
      softirq: Turn default irq_cpustat_t to standard per-cpu
      softirq: Consolidate default local_softirq_pending() implementations
      ia64: Switch to generic local_softirq_pending() implementation
      parisc: Switch to generic local_softirq_pending() implementation
      powerpc: Switch to generic local_softirq_pending() implementation
      sparc: Switch to generic local_softirq_pending() implementation
      x86: Switch to generic local_softirq_pending() implementation
      softirq/s390: Move default mutators of overwritten softirq mask to s390


 arch/ia64/include/asm/hardirq.h     |  2 +-
 arch/parisc/include/asm/hardirq.h   |  8 --------
 arch/powerpc/include/asm/hardirq.h  |  7 -------
 arch/s390/include/asm/hardirq.h     |  2 ++
 arch/sh/kernel/irq.c                |  2 +-
 arch/sparc/include/asm/hardirq_64.h |  5 +++--
 arch/x86/include/asm/hardirq.h      |  8 --------
 include/linux/interrupt.h           | 13 ++++++++++---
 include/linux/irq_cpustat.h         | 10 +++-------
 kernel/softirq.c                    |  4 ++--
 10 files changed, 22 insertions(+), 39 deletions(-)

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 01/11] ia64: Convert local_softirq_pending() to per-cpu ops
  2018-05-08 13:38 [GIT PULL] Frederic Weisbecker
@ 2018-05-08 13:38 ` Frederic Weisbecker
  2018-05-14 12:47   ` [tip:irq/core] softirq/ia64: " tip-bot for Frederic Weisbecker
  2018-05-08 13:38 ` [PATCH 02/11] sparc: Convert local_softirq_pending() to use per-cpu op Frederic Weisbecker
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 39+ messages in thread
From: Frederic Weisbecker @ 2018-05-08 13:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Frederic Weisbecker, Sebastian Andrzej Siewior, Tony Luck,
	Peter Zijlstra, David S . Miller, Yoshinori Sato,
	Michael Ellerman, Helge Deller, Benjamin Herrenschmidt,
	Paul Mackerras, Thomas Gleixner, Martin Schwidefsky, Rich Felker,
	Fenghua Yu, Heiko Carstens, James E . J . Bottomley

In order to consolidate and optimize generic softirq mask accesses, we
first need to convert architectures to use per-cpu operations when
possible.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
---
 arch/ia64/include/asm/hardirq.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/ia64/include/asm/hardirq.h b/arch/ia64/include/asm/hardirq.h
index bdc4669..22fae71 100644
--- a/arch/ia64/include/asm/hardirq.h
+++ b/arch/ia64/include/asm/hardirq.h
@@ -13,7 +13,7 @@
 
 #define __ARCH_IRQ_STAT	1
 
-#define local_softirq_pending()		(local_cpu_data->softirq_pending)
+#define local_softirq_pending()	(*this_cpu_ptr(&ia64_cpu_info.softirq_pending))
 
 #include <linux/threads.h>
 #include <linux/irq.h>
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 02/11] sparc: Convert local_softirq_pending() to use per-cpu op
  2018-05-08 13:38 [GIT PULL] Frederic Weisbecker
  2018-05-08 13:38 ` [PATCH 01/11] ia64: Convert local_softirq_pending() to per-cpu ops Frederic Weisbecker
@ 2018-05-08 13:38 ` Frederic Weisbecker
  2018-05-14 12:47   ` [tip:irq/core] softirq/sparc: " tip-bot for Frederic Weisbecker
  2018-05-08 13:38 ` [PATCH 03/11] sh: Use nmi_count() on /proc/interrupts print out Frederic Weisbecker
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 39+ messages in thread
From: Frederic Weisbecker @ 2018-05-08 13:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Frederic Weisbecker, Sebastian Andrzej Siewior, Tony Luck,
	Peter Zijlstra, David S . Miller, Yoshinori Sato,
	Michael Ellerman, Helge Deller, Benjamin Herrenschmidt,
	Paul Mackerras, Thomas Gleixner, Martin Schwidefsky, Rich Felker,
	Fenghua Yu, Heiko Carstens, James E . J . Bottomley

In order to consolidate and optimize generic softirq mask accesses, we
first need to convert architectures to use per-cpu operations when
possible.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
---
 arch/sparc/include/asm/hardirq_64.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sparc/include/asm/hardirq_64.h b/arch/sparc/include/asm/hardirq_64.h
index f565402..6aba904 100644
--- a/arch/sparc/include/asm/hardirq_64.h
+++ b/arch/sparc/include/asm/hardirq_64.h
@@ -11,7 +11,7 @@
 
 #define __ARCH_IRQ_STAT
 #define local_softirq_pending() \
-	(local_cpu_data().__softirq_pending)
+	(*this_cpu_ptr(&__cpu_data.__softirq_pending))
 
 void ack_bad_irq(unsigned int irq);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 03/11] sh: Use nmi_count() on /proc/interrupts print out
  2018-05-08 13:38 [GIT PULL] Frederic Weisbecker
  2018-05-08 13:38 ` [PATCH 01/11] ia64: Convert local_softirq_pending() to per-cpu ops Frederic Weisbecker
  2018-05-08 13:38 ` [PATCH 02/11] sparc: Convert local_softirq_pending() to use per-cpu op Frederic Weisbecker
@ 2018-05-08 13:38 ` Frederic Weisbecker
  2018-05-14 12:48   ` [tip:irq/core] softirq/sh: " tip-bot for Frederic Weisbecker
  2018-05-08 13:38 ` [PATCH 04/11] softirq: Turn default irq_cpustat_t to standard per-cpu Frederic Weisbecker
                   ` (8 subsequent siblings)
  11 siblings, 1 reply; 39+ messages in thread
From: Frederic Weisbecker @ 2018-05-08 13:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Frederic Weisbecker, Sebastian Andrzej Siewior, Tony Luck,
	Peter Zijlstra, David S . Miller, Yoshinori Sato,
	Michael Ellerman, Helge Deller, Benjamin Herrenschmidt,
	Paul Mackerras, Thomas Gleixner, Martin Schwidefsky, Rich Felker,
	Fenghua Yu, Heiko Carstens, James E . J . Bottomley

Use nmi_count() instead of accessing directly the irq_stat structure.
Its implementation is going to change to use per-CPU, so defer the guts
to standard API instead.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
---
 arch/sh/kernel/irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c
index 245dbeb..5717c7c 100644
--- a/arch/sh/kernel/irq.c
+++ b/arch/sh/kernel/irq.c
@@ -44,7 +44,7 @@ int arch_show_interrupts(struct seq_file *p, int prec)
 
 	seq_printf(p, "%*s: ", prec, "NMI");
 	for_each_online_cpu(j)
-		seq_printf(p, "%10u ", irq_stat[j].__nmi_count);
+		seq_printf(p, "%10u ", nmi_count(j));
 	seq_printf(p, "  Non-maskable interrupts\n");
 
 	seq_printf(p, "%*s: %10u\n", prec, "ERR", atomic_read(&irq_err_count));
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 04/11] softirq: Turn default irq_cpustat_t to standard per-cpu
  2018-05-08 13:38 [GIT PULL] Frederic Weisbecker
                   ` (2 preceding siblings ...)
  2018-05-08 13:38 ` [PATCH 03/11] sh: Use nmi_count() on /proc/interrupts print out Frederic Weisbecker
@ 2018-05-08 13:38 ` Frederic Weisbecker
  2018-05-14 12:48   ` [tip:irq/core] softirq/core: " tip-bot for Frederic Weisbecker
  2018-05-08 13:38 ` [PATCH 05/11] softirq: Consolidate default local_softirq_pending() implementations Frederic Weisbecker
                   ` (7 subsequent siblings)
  11 siblings, 1 reply; 39+ messages in thread
From: Frederic Weisbecker @ 2018-05-08 13:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Frederic Weisbecker, Sebastian Andrzej Siewior, Tony Luck,
	Peter Zijlstra, David S . Miller, Yoshinori Sato,
	Michael Ellerman, Helge Deller, Benjamin Herrenschmidt,
	Paul Mackerras, Thomas Gleixner, Martin Schwidefsky, Rich Felker,
	Fenghua Yu, Heiko Carstens, James E . J . Bottomley

In order to optimize and consolidate softirq mask accesses, let's
convert the default irq_cpustat_t implementation to per-CPU standard API.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
---
 include/linux/irq_cpustat.h | 4 ++--
 kernel/softirq.c            | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/irq_cpustat.h b/include/linux/irq_cpustat.h
index 4954948..ddea03c 100644
--- a/include/linux/irq_cpustat.h
+++ b/include/linux/irq_cpustat.h
@@ -18,8 +18,8 @@
  */
 
 #ifndef __ARCH_IRQ_STAT
-extern irq_cpustat_t irq_stat[];		/* defined in asm/hardirq.h */
-#define __IRQ_STAT(cpu, member)	(irq_stat[cpu].member)
+DECLARE_PER_CPU_ALIGNED(irq_cpustat_t, irq_stat);	/* defined in asm/hardirq.h */
+#define __IRQ_STAT(cpu, member)	(per_cpu(irq_stat.member, cpu))
 #endif
 
   /* arch independent irq_stat fields */
diff --git a/kernel/softirq.c b/kernel/softirq.c
index 177de36..c5fafd7 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -49,8 +49,8 @@
  */
 
 #ifndef __ARCH_IRQ_STAT
-irq_cpustat_t irq_stat[NR_CPUS] ____cacheline_aligned;
-EXPORT_SYMBOL(irq_stat);
+DEFINE_PER_CPU_ALIGNED(irq_cpustat_t, irq_stat);
+EXPORT_PER_CPU_SYMBOL(irq_stat);
 #endif
 
 static struct softirq_action softirq_vec[NR_SOFTIRQS] __cacheline_aligned_in_smp;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 05/11] softirq: Consolidate default local_softirq_pending() implementations
  2018-05-08 13:38 [GIT PULL] Frederic Weisbecker
                   ` (3 preceding siblings ...)
  2018-05-08 13:38 ` [PATCH 04/11] softirq: Turn default irq_cpustat_t to standard per-cpu Frederic Weisbecker
@ 2018-05-08 13:38 ` Frederic Weisbecker
  2018-05-14 12:49   ` [tip:irq/core] softirq/core: " tip-bot for Frederic Weisbecker
  2018-05-08 13:38 ` [PATCH 06/11] ia64: Switch to generic local_softirq_pending() implementation Frederic Weisbecker
                   ` (6 subsequent siblings)
  11 siblings, 1 reply; 39+ messages in thread
From: Frederic Weisbecker @ 2018-05-08 13:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Frederic Weisbecker, Sebastian Andrzej Siewior, Tony Luck,
	Peter Zijlstra, David S . Miller, Yoshinori Sato,
	Michael Ellerman, Helge Deller, Benjamin Herrenschmidt,
	Paul Mackerras, Thomas Gleixner, Martin Schwidefsky, Rich Felker,
	Fenghua Yu, Heiko Carstens, James E . J . Bottomley

Consolidate and optimize default softirq mask API implementations.
Per-CPU operations are expected to be faster and a few architectures
already rely on them to implement local_softirq_pending() and related
accessors/mutators. Those will be migrated to the new generic code.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
---
 include/linux/interrupt.h   | 14 ++++++++++++++
 include/linux/irq_cpustat.h |  6 +-----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 5426627..7a11f73 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -432,11 +432,25 @@ extern bool force_irqthreads;
 #define force_irqthreads	(0)
 #endif
 
+#ifndef local_softirq_pending
+
+#ifndef local_softirq_pending_ref
+#define local_softirq_pending_ref irq_stat.__softirq_pending
+#endif
+
+#define local_softirq_pending()	(__this_cpu_read(local_softirq_pending_ref))
+#define set_softirq_pending(x)	(__this_cpu_write(local_softirq_pending_ref, (x)))
+#define or_softirq_pending(x)	(__this_cpu_or(local_softirq_pending_ref, (x)))
+
+#else /* local_softirq_pending */
+
 #ifndef __ARCH_SET_SOFTIRQ_PENDING
 #define set_softirq_pending(x) (local_softirq_pending() = (x))
 #define or_softirq_pending(x)  (local_softirq_pending() |= (x))
 #endif
 
+#endif /* local_softirq_pending */
+
 /* Some architectures might implement lazy enabling/disabling of
  * interrupts. In some cases, such as stop_machine, we might want
  * to ensure that after a local_irq_disable(), interrupts have
diff --git a/include/linux/irq_cpustat.h b/include/linux/irq_cpustat.h
index ddea03c..6e8895c 100644
--- a/include/linux/irq_cpustat.h
+++ b/include/linux/irq_cpustat.h
@@ -22,11 +22,7 @@ DECLARE_PER_CPU_ALIGNED(irq_cpustat_t, irq_stat);	/* defined in asm/hardirq.h */
 #define __IRQ_STAT(cpu, member)	(per_cpu(irq_stat.member, cpu))
 #endif
 
-  /* arch independent irq_stat fields */
-#define local_softirq_pending() \
-	__IRQ_STAT(smp_processor_id(), __softirq_pending)
-
-  /* arch dependent irq_stat fields */
+/* arch dependent irq_stat fields */
 #define nmi_count(cpu)		__IRQ_STAT((cpu), __nmi_count)	/* i386 */
 
 #endif	/* __irq_cpustat_h */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 06/11] ia64: Switch to generic local_softirq_pending() implementation
  2018-05-08 13:38 [GIT PULL] Frederic Weisbecker
                   ` (4 preceding siblings ...)
  2018-05-08 13:38 ` [PATCH 05/11] softirq: Consolidate default local_softirq_pending() implementations Frederic Weisbecker
@ 2018-05-08 13:38 ` Frederic Weisbecker
  2018-05-14 12:49   ` [tip:irq/core] softirq/ia64: " tip-bot for Frederic Weisbecker
  2018-05-08 13:38 ` [PATCH 07/11] parisc: " Frederic Weisbecker
                   ` (5 subsequent siblings)
  11 siblings, 1 reply; 39+ messages in thread
From: Frederic Weisbecker @ 2018-05-08 13:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Frederic Weisbecker, Sebastian Andrzej Siewior, Tony Luck,
	Peter Zijlstra, David S . Miller, Yoshinori Sato,
	Michael Ellerman, Helge Deller, Benjamin Herrenschmidt,
	Paul Mackerras, Thomas Gleixner, Martin Schwidefsky, Rich Felker,
	Fenghua Yu, Heiko Carstens, James E . J . Bottomley

Benefit from the generic softirq mask implementation that rely on per-CPU
mutators instead of working with raw operators on top of this_cpu_ptr().

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
---
 arch/ia64/include/asm/hardirq.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/ia64/include/asm/hardirq.h b/arch/ia64/include/asm/hardirq.h
index 22fae71..ccde7c2 100644
--- a/arch/ia64/include/asm/hardirq.h
+++ b/arch/ia64/include/asm/hardirq.h
@@ -13,7 +13,7 @@
 
 #define __ARCH_IRQ_STAT	1
 
-#define local_softirq_pending()	(*this_cpu_ptr(&ia64_cpu_info.softirq_pending))
+#define local_softirq_pending_ref	ia64_cpu_info.softirq_pending
 
 #include <linux/threads.h>
 #include <linux/irq.h>
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 07/11] parisc: Switch to generic local_softirq_pending() implementation
  2018-05-08 13:38 [GIT PULL] Frederic Weisbecker
                   ` (5 preceding siblings ...)
  2018-05-08 13:38 ` [PATCH 06/11] ia64: Switch to generic local_softirq_pending() implementation Frederic Weisbecker
@ 2018-05-08 13:38 ` Frederic Weisbecker
  2018-05-14 12:50   ` [tip:irq/core] softirq/parisc: " tip-bot for Frederic Weisbecker
  2018-05-08 13:38 ` [PATCH 08/11] powerpc: " Frederic Weisbecker
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 39+ messages in thread
From: Frederic Weisbecker @ 2018-05-08 13:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Frederic Weisbecker, Sebastian Andrzej Siewior, Tony Luck,
	Peter Zijlstra, David S . Miller, Yoshinori Sato,
	Michael Ellerman, Helge Deller, Benjamin Herrenschmidt,
	Paul Mackerras, Thomas Gleixner, Martin Schwidefsky, Rich Felker,
	Fenghua Yu, Heiko Carstens, James E . J . Bottomley

Remove the ad-hoc implementation, the generic code now allows us not to
reinvent the wheel.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
---
 arch/parisc/include/asm/hardirq.h | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/arch/parisc/include/asm/hardirq.h b/arch/parisc/include/asm/hardirq.h
index 0778151..1a1235a 100644
--- a/arch/parisc/include/asm/hardirq.h
+++ b/arch/parisc/include/asm/hardirq.h
@@ -34,14 +34,6 @@ DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
 #define __IRQ_STAT(cpu, member) (irq_stat[cpu].member)
 #define inc_irq_stat(member)	this_cpu_inc(irq_stat.member)
 #define __inc_irq_stat(member)	__this_cpu_inc(irq_stat.member)
-#define local_softirq_pending()	this_cpu_read(irq_stat.__softirq_pending)
-
-#define __ARCH_SET_SOFTIRQ_PENDING
-
-#define set_softirq_pending(x)	\
-		this_cpu_write(irq_stat.__softirq_pending, (x))
-#define or_softirq_pending(x)	this_cpu_or(irq_stat.__softirq_pending, (x))
-
 #define ack_bad_irq(irq) WARN(1, "unexpected IRQ trap at vector %02x\n", irq)
 
 #endif /* _PARISC_HARDIRQ_H */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 08/11] powerpc: Switch to generic local_softirq_pending() implementation
  2018-05-08 13:38 [GIT PULL] Frederic Weisbecker
                   ` (6 preceding siblings ...)
  2018-05-08 13:38 ` [PATCH 07/11] parisc: " Frederic Weisbecker
@ 2018-05-08 13:38 ` Frederic Weisbecker
  2018-05-14 12:50   ` [tip:irq/core] softirq/powerpc: " tip-bot for Frederic Weisbecker
  2018-05-08 13:38 ` [PATCH 09/11] sparc: " Frederic Weisbecker
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 39+ messages in thread
From: Frederic Weisbecker @ 2018-05-08 13:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Frederic Weisbecker, Sebastian Andrzej Siewior, Tony Luck,
	Peter Zijlstra, David S . Miller, Yoshinori Sato,
	Michael Ellerman, Helge Deller, Benjamin Herrenschmidt,
	Paul Mackerras, Thomas Gleixner, Martin Schwidefsky, Rich Felker,
	Fenghua Yu, Heiko Carstens, James E . J . Bottomley

Remove the ad-hoc implementation, the generic code now allows us not to
reinvent the wheel.

Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
---
 arch/powerpc/include/asm/hardirq.h | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/arch/powerpc/include/asm/hardirq.h b/arch/powerpc/include/asm/hardirq.h
index 5986d47..383f628 100644
--- a/arch/powerpc/include/asm/hardirq.h
+++ b/arch/powerpc/include/asm/hardirq.h
@@ -25,15 +25,8 @@ typedef struct {
 DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
 
 #define __ARCH_IRQ_STAT
-
-#define local_softirq_pending()	__this_cpu_read(irq_stat.__softirq_pending)
-
-#define __ARCH_SET_SOFTIRQ_PENDING
 #define __ARCH_IRQ_EXIT_IRQS_DISABLED
 
-#define set_softirq_pending(x) __this_cpu_write(irq_stat.__softirq_pending, (x))
-#define or_softirq_pending(x) __this_cpu_or(irq_stat.__softirq_pending, (x))
-
 static inline void ack_bad_irq(unsigned int irq)
 {
 	printk(KERN_CRIT "unexpected IRQ trap at vector %02x\n", irq);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 09/11] sparc: Switch to generic local_softirq_pending() implementation
  2018-05-08 13:38 [GIT PULL] Frederic Weisbecker
                   ` (7 preceding siblings ...)
  2018-05-08 13:38 ` [PATCH 08/11] powerpc: " Frederic Weisbecker
@ 2018-05-08 13:38 ` Frederic Weisbecker
  2018-05-14 12:51   ` [tip:irq/core] softirq/sparc: " tip-bot for Frederic Weisbecker
  2018-05-08 13:38 ` [PATCH 10/11] x86: " Frederic Weisbecker
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 39+ messages in thread
From: Frederic Weisbecker @ 2018-05-08 13:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Frederic Weisbecker, Sebastian Andrzej Siewior, Tony Luck,
	Peter Zijlstra, David S . Miller, Yoshinori Sato,
	Michael Ellerman, Helge Deller, Benjamin Herrenschmidt,
	Paul Mackerras, Thomas Gleixner, Martin Schwidefsky, Rich Felker,
	Fenghua Yu, Heiko Carstens, James E . J . Bottomley

Benefit from the generic softirq mask implementation that rely on per-CPU
mutators instead of working with raw operators on top of this_cpu_ptr().

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
---
 arch/sparc/include/asm/hardirq_64.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/sparc/include/asm/hardirq_64.h b/arch/sparc/include/asm/hardirq_64.h
index 6aba904..75b92bf 100644
--- a/arch/sparc/include/asm/hardirq_64.h
+++ b/arch/sparc/include/asm/hardirq_64.h
@@ -10,8 +10,9 @@
 #include <asm/cpudata.h>
 
 #define __ARCH_IRQ_STAT
-#define local_softirq_pending() \
-	(*this_cpu_ptr(&__cpu_data.__softirq_pending))
+
+#define local_softirq_pending_ref \
+	__cpu_data.__softirq_pending
 
 void ack_bad_irq(unsigned int irq);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 10/11] x86: Switch to generic local_softirq_pending() implementation
  2018-05-08 13:38 [GIT PULL] Frederic Weisbecker
                   ` (8 preceding siblings ...)
  2018-05-08 13:38 ` [PATCH 09/11] sparc: " Frederic Weisbecker
@ 2018-05-08 13:38 ` Frederic Weisbecker
  2018-05-14 12:51   ` [tip:irq/core] softirq/x86: " tip-bot for Frederic Weisbecker
  2018-05-08 13:38 ` [PATCH 11/11] softirq/s390: Move default mutators of overwritten softirq mask to s390 Frederic Weisbecker
  2018-05-08 13:46 ` [GIT PULL] softirq: Consolidate and optimize softirq mask v4 Frederic Weisbecker
  11 siblings, 1 reply; 39+ messages in thread
From: Frederic Weisbecker @ 2018-05-08 13:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Frederic Weisbecker, Sebastian Andrzej Siewior, Tony Luck,
	Peter Zijlstra, David S . Miller, Yoshinori Sato,
	Michael Ellerman, Helge Deller, Benjamin Herrenschmidt,
	Paul Mackerras, Thomas Gleixner, Martin Schwidefsky, Rich Felker,
	Fenghua Yu, Heiko Carstens, James E . J . Bottomley

Remove the ad-hoc implementation, the generic code now allows us not to
reinvent the wheel.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
---
 arch/x86/include/asm/hardirq.h | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/hardirq.h
index 5ea2afd..740a428a 100644
--- a/arch/x86/include/asm/hardirq.h
+++ b/arch/x86/include/asm/hardirq.h
@@ -50,14 +50,6 @@ DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
 
 #define inc_irq_stat(member)	this_cpu_inc(irq_stat.member)
 
-#define local_softirq_pending()	this_cpu_read(irq_stat.__softirq_pending)
-
-#define __ARCH_SET_SOFTIRQ_PENDING
-
-#define set_softirq_pending(x)	\
-		this_cpu_write(irq_stat.__softirq_pending, (x))
-#define or_softirq_pending(x)	this_cpu_or(irq_stat.__softirq_pending, (x))
-
 extern void ack_bad_irq(unsigned int irq);
 
 extern u64 arch_irq_stat_cpu(unsigned int cpu);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 11/11] softirq/s390: Move default mutators of overwritten softirq mask to s390
  2018-05-08 13:38 [GIT PULL] Frederic Weisbecker
                   ` (9 preceding siblings ...)
  2018-05-08 13:38 ` [PATCH 10/11] x86: " Frederic Weisbecker
@ 2018-05-08 13:38 ` Frederic Weisbecker
  2018-05-14 12:52   ` [tip:irq/core] " tip-bot for Frederic Weisbecker
  2018-05-08 13:46 ` [GIT PULL] softirq: Consolidate and optimize softirq mask v4 Frederic Weisbecker
  11 siblings, 1 reply; 39+ messages in thread
From: Frederic Weisbecker @ 2018-05-08 13:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Frederic Weisbecker, Sebastian Andrzej Siewior, Tony Luck,
	Peter Zijlstra, David S . Miller, Yoshinori Sato,
	Michael Ellerman, Helge Deller, Benjamin Herrenschmidt,
	Paul Mackerras, Thomas Gleixner, Martin Schwidefsky, Rich Felker,
	Fenghua Yu, Heiko Carstens, James E . J . Bottomley

s390 is now the last architecture that entirely overwrites
local_softirq_pending() and uses the according default definitions of
set_softirq_pending() and or_softirq_pending().

Just move these to s390 to debloat the generic code complexity.

Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
---
 arch/s390/include/asm/hardirq.h | 2 ++
 include/linux/interrupt.h       | 7 -------
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/arch/s390/include/asm/hardirq.h b/arch/s390/include/asm/hardirq.h
index a296c6a..dfbc3c6c0 100644
--- a/arch/s390/include/asm/hardirq.h
+++ b/arch/s390/include/asm/hardirq.h
@@ -14,6 +14,8 @@
 #include <asm/lowcore.h>
 
 #define local_softirq_pending() (S390_lowcore.softirq_pending)
+#define set_softirq_pending(x) (S390_lowcore.softirq_pending = (x))
+#define or_softirq_pending(x)  (S390_lowcore.softirq_pending |= (x))
 
 #define __ARCH_IRQ_STAT
 #define __ARCH_HAS_DO_SOFTIRQ
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 7a11f73..eeceac3 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -442,13 +442,6 @@ extern bool force_irqthreads;
 #define set_softirq_pending(x)	(__this_cpu_write(local_softirq_pending_ref, (x)))
 #define or_softirq_pending(x)	(__this_cpu_or(local_softirq_pending_ref, (x)))
 
-#else /* local_softirq_pending */
-
-#ifndef __ARCH_SET_SOFTIRQ_PENDING
-#define set_softirq_pending(x) (local_softirq_pending() = (x))
-#define or_softirq_pending(x)  (local_softirq_pending() |= (x))
-#endif
-
 #endif /* local_softirq_pending */
 
 /* Some architectures might implement lazy enabling/disabling of
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [GIT PULL] softirq: Consolidate and optimize softirq mask v4
  2018-05-08 13:38 [GIT PULL] Frederic Weisbecker
                   ` (10 preceding siblings ...)
  2018-05-08 13:38 ` [PATCH 11/11] softirq/s390: Move default mutators of overwritten softirq mask to s390 Frederic Weisbecker
@ 2018-05-08 13:46 ` Frederic Weisbecker
  11 siblings, 0 replies; 39+ messages in thread
From: Frederic Weisbecker @ 2018-05-08 13:46 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Sebastian Andrzej Siewior, Tony Luck, Peter Zijlstra,
	David S . Miller, Yoshinori Sato, Michael Ellerman, Helge Deller,
	Benjamin Herrenschmidt, Paul Mackerras, Thomas Gleixner,
	Martin Schwidefsky, Rich Felker, Fenghua Yu, Heiko Carstens,
	James E . J . Bottomley

The actual subject is "softirq: Consolidate and optimize softirq mask v4" :-)

Sorry...

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [tip:irq/core] softirq/ia64: Convert local_softirq_pending() to per-cpu ops
  2018-05-08 13:38 ` [PATCH 01/11] ia64: Convert local_softirq_pending() to per-cpu ops Frederic Weisbecker
@ 2018-05-14 12:47   ` tip-bot for Frederic Weisbecker
  0 siblings, 0 replies; 39+ messages in thread
From: tip-bot for Frederic Weisbecker @ 2018-05-14 12:47 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: bigeasy, mingo, deller, heiko.carstens, jejb, paulus, benh,
	frederic, dalias, peterz, tglx, schwidefsky, hpa, mpe, tony.luck,
	fenghua.yu, davem, torvalds, linux-kernel, ysato

Commit-ID:  2e5c4632dcc0365a97c36817a368507e6a4c89b2
Gitweb:     https://git.kernel.org/tip/2e5c4632dcc0365a97c36817a368507e6a4c89b2
Author:     Frederic Weisbecker <frederic@kernel.org>
AuthorDate: Tue, 8 May 2018 15:38:16 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 14 May 2018 11:25:26 +0200

softirq/ia64: Convert local_softirq_pending() to per-cpu ops

In order to consolidate and optimize generic softirq mask accesses, we
first need to convert architectures to use per-cpu operations when
possible.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Helge Deller <deller@gmx.de>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Rich Felker <dalias@libc.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Link: http://lkml.kernel.org/r/1525786706-22846-2-git-send-email-frederic@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/ia64/include/asm/hardirq.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/ia64/include/asm/hardirq.h b/arch/ia64/include/asm/hardirq.h
index bdc4669c71c3..22fae710e420 100644
--- a/arch/ia64/include/asm/hardirq.h
+++ b/arch/ia64/include/asm/hardirq.h
@@ -13,7 +13,7 @@
 
 #define __ARCH_IRQ_STAT	1
 
-#define local_softirq_pending()		(local_cpu_data->softirq_pending)
+#define local_softirq_pending()	(*this_cpu_ptr(&ia64_cpu_info.softirq_pending))
 
 #include <linux/threads.h>
 #include <linux/irq.h>

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [tip:irq/core] softirq/sparc: Convert local_softirq_pending() to use per-cpu op
  2018-05-08 13:38 ` [PATCH 02/11] sparc: Convert local_softirq_pending() to use per-cpu op Frederic Weisbecker
@ 2018-05-14 12:47   ` tip-bot for Frederic Weisbecker
  0 siblings, 0 replies; 39+ messages in thread
From: tip-bot for Frederic Weisbecker @ 2018-05-14 12:47 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, mingo, ysato, deller, jejb, heiko.carstens, mpe,
	benh, torvalds, bigeasy, dalias, peterz, hpa, frederic, davem,
	fenghua.yu, paulus, tony.luck, tglx, schwidefsky

Commit-ID:  49892dbc2cb349f78eccfc1f55eac0ec718f44bb
Gitweb:     https://git.kernel.org/tip/49892dbc2cb349f78eccfc1f55eac0ec718f44bb
Author:     Frederic Weisbecker <frederic@kernel.org>
AuthorDate: Tue, 8 May 2018 15:38:17 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 14 May 2018 11:25:26 +0200

softirq/sparc: Convert local_softirq_pending() to use per-cpu op

In order to consolidate and optimize generic softirq mask accesses, we
first need to convert architectures to use per-cpu operations when
possible.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Helge Deller <deller@gmx.de>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Rich Felker <dalias@libc.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Link: http://lkml.kernel.org/r/1525786706-22846-3-git-send-email-frederic@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/sparc/include/asm/hardirq_64.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sparc/include/asm/hardirq_64.h b/arch/sparc/include/asm/hardirq_64.h
index f56540271993..6aba904819a4 100644
--- a/arch/sparc/include/asm/hardirq_64.h
+++ b/arch/sparc/include/asm/hardirq_64.h
@@ -11,7 +11,7 @@
 
 #define __ARCH_IRQ_STAT
 #define local_softirq_pending() \
-	(local_cpu_data().__softirq_pending)
+	(*this_cpu_ptr(&__cpu_data.__softirq_pending))
 
 void ack_bad_irq(unsigned int irq);
 

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [tip:irq/core] softirq/sh: Use nmi_count() on /proc/interrupts print out
  2018-05-08 13:38 ` [PATCH 03/11] sh: Use nmi_count() on /proc/interrupts print out Frederic Weisbecker
@ 2018-05-14 12:48   ` tip-bot for Frederic Weisbecker
  0 siblings, 0 replies; 39+ messages in thread
From: tip-bot for Frederic Weisbecker @ 2018-05-14 12:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mpe, torvalds, benh, frederic, dalias, deller, tony.luck, paulus,
	linux-kernel, hpa, fenghua.yu, tglx, peterz, mingo, schwidefsky,
	bigeasy, heiko.carstens, ysato, davem, jejb

Commit-ID:  30d723340c30ff9afe200ef5ecbbdc77e6d1f816
Gitweb:     https://git.kernel.org/tip/30d723340c30ff9afe200ef5ecbbdc77e6d1f816
Author:     Frederic Weisbecker <frederic@kernel.org>
AuthorDate: Tue, 8 May 2018 15:38:18 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 14 May 2018 11:25:27 +0200

softirq/sh: Use nmi_count() on /proc/interrupts print out

Use nmi_count() instead of accessing directly the irq_stat structure.
Its implementation is going to change to use per-CPU, so defer the guts
to standard API instead.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Helge Deller <deller@gmx.de>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Rich Felker <dalias@libc.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Link: http://lkml.kernel.org/r/1525786706-22846-4-git-send-email-frederic@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/sh/kernel/irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c
index 245dbeb20afe..5717c7cbdd97 100644
--- a/arch/sh/kernel/irq.c
+++ b/arch/sh/kernel/irq.c
@@ -44,7 +44,7 @@ int arch_show_interrupts(struct seq_file *p, int prec)
 
 	seq_printf(p, "%*s: ", prec, "NMI");
 	for_each_online_cpu(j)
-		seq_printf(p, "%10u ", irq_stat[j].__nmi_count);
+		seq_printf(p, "%10u ", nmi_count(j));
 	seq_printf(p, "  Non-maskable interrupts\n");
 
 	seq_printf(p, "%*s: %10u\n", prec, "ERR", atomic_read(&irq_err_count));

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [tip:irq/core] softirq/core: Turn default irq_cpustat_t to standard per-cpu
  2018-05-08 13:38 ` [PATCH 04/11] softirq: Turn default irq_cpustat_t to standard per-cpu Frederic Weisbecker
@ 2018-05-14 12:48   ` tip-bot for Frederic Weisbecker
  0 siblings, 0 replies; 39+ messages in thread
From: tip-bot for Frederic Weisbecker @ 2018-05-14 12:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: paulus, mpe, tglx, peterz, frederic, dalias, linux-kernel,
	fenghua.yu, deller, schwidefsky, benh, davem, bigeasy, jejb,
	mingo, torvalds, ysato, heiko.carstens, hpa, tony.luck

Commit-ID:  0f6f47bacba514f4e9f61de0d85940dfb41498cc
Gitweb:     https://git.kernel.org/tip/0f6f47bacba514f4e9f61de0d85940dfb41498cc
Author:     Frederic Weisbecker <frederic@kernel.org>
AuthorDate: Tue, 8 May 2018 15:38:19 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 14 May 2018 11:25:27 +0200

softirq/core: Turn default irq_cpustat_t to standard per-cpu

In order to optimize and consolidate softirq mask accesses, let's
convert the default irq_cpustat_t implementation to per-CPU standard API.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Helge Deller <deller@gmx.de>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Rich Felker <dalias@libc.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Link: http://lkml.kernel.org/r/1525786706-22846-5-git-send-email-frederic@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/linux/irq_cpustat.h | 4 ++--
 kernel/softirq.c            | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/irq_cpustat.h b/include/linux/irq_cpustat.h
index 4954948d1973..ddea03c7c39d 100644
--- a/include/linux/irq_cpustat.h
+++ b/include/linux/irq_cpustat.h
@@ -18,8 +18,8 @@
  */
 
 #ifndef __ARCH_IRQ_STAT
-extern irq_cpustat_t irq_stat[];		/* defined in asm/hardirq.h */
-#define __IRQ_STAT(cpu, member)	(irq_stat[cpu].member)
+DECLARE_PER_CPU_ALIGNED(irq_cpustat_t, irq_stat);	/* defined in asm/hardirq.h */
+#define __IRQ_STAT(cpu, member)	(per_cpu(irq_stat.member, cpu))
 #endif
 
   /* arch independent irq_stat fields */
diff --git a/kernel/softirq.c b/kernel/softirq.c
index 177de3640c78..c5fafd792df1 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -49,8 +49,8 @@
  */
 
 #ifndef __ARCH_IRQ_STAT
-irq_cpustat_t irq_stat[NR_CPUS] ____cacheline_aligned;
-EXPORT_SYMBOL(irq_stat);
+DEFINE_PER_CPU_ALIGNED(irq_cpustat_t, irq_stat);
+EXPORT_PER_CPU_SYMBOL(irq_stat);
 #endif
 
 static struct softirq_action softirq_vec[NR_SOFTIRQS] __cacheline_aligned_in_smp;

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [tip:irq/core] softirq/core: Consolidate default local_softirq_pending() implementations
  2018-05-08 13:38 ` [PATCH 05/11] softirq: Consolidate default local_softirq_pending() implementations Frederic Weisbecker
@ 2018-05-14 12:49   ` tip-bot for Frederic Weisbecker
  0 siblings, 0 replies; 39+ messages in thread
From: tip-bot for Frederic Weisbecker @ 2018-05-14 12:49 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: frederic, benh, deller, ysato, peterz, torvalds, fenghua.yu,
	tony.luck, mpe, heiko.carstens, mingo, davem, jejb, linux-kernel,
	hpa, schwidefsky, paulus, dalias, tglx, bigeasy

Commit-ID:  0fd7d86285290ccebc0dc6eb536b6b043dd6a1e4
Gitweb:     https://git.kernel.org/tip/0fd7d86285290ccebc0dc6eb536b6b043dd6a1e4
Author:     Frederic Weisbecker <frederic@kernel.org>
AuthorDate: Tue, 8 May 2018 15:38:20 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 14 May 2018 11:25:27 +0200

softirq/core: Consolidate default local_softirq_pending() implementations

Consolidate and optimize default softirq mask API implementations.
Per-CPU operations are expected to be faster and a few architectures
already rely on them to implement local_softirq_pending() and related
accessors/mutators. Those will be migrated to the new generic code.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Helge Deller <deller@gmx.de>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Rich Felker <dalias@libc.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Link: http://lkml.kernel.org/r/1525786706-22846-6-git-send-email-frederic@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/linux/interrupt.h   | 14 ++++++++++++++
 include/linux/irq_cpustat.h |  6 +-----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 5426627f9c55..7a11f73c5c3b 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -432,11 +432,25 @@ extern bool force_irqthreads;
 #define force_irqthreads	(0)
 #endif
 
+#ifndef local_softirq_pending
+
+#ifndef local_softirq_pending_ref
+#define local_softirq_pending_ref irq_stat.__softirq_pending
+#endif
+
+#define local_softirq_pending()	(__this_cpu_read(local_softirq_pending_ref))
+#define set_softirq_pending(x)	(__this_cpu_write(local_softirq_pending_ref, (x)))
+#define or_softirq_pending(x)	(__this_cpu_or(local_softirq_pending_ref, (x)))
+
+#else /* local_softirq_pending */
+
 #ifndef __ARCH_SET_SOFTIRQ_PENDING
 #define set_softirq_pending(x) (local_softirq_pending() = (x))
 #define or_softirq_pending(x)  (local_softirq_pending() |= (x))
 #endif
 
+#endif /* local_softirq_pending */
+
 /* Some architectures might implement lazy enabling/disabling of
  * interrupts. In some cases, such as stop_machine, we might want
  * to ensure that after a local_irq_disable(), interrupts have
diff --git a/include/linux/irq_cpustat.h b/include/linux/irq_cpustat.h
index ddea03c7c39d..6e8895cd4d92 100644
--- a/include/linux/irq_cpustat.h
+++ b/include/linux/irq_cpustat.h
@@ -22,11 +22,7 @@ DECLARE_PER_CPU_ALIGNED(irq_cpustat_t, irq_stat);	/* defined in asm/hardirq.h */
 #define __IRQ_STAT(cpu, member)	(per_cpu(irq_stat.member, cpu))
 #endif
 
-  /* arch independent irq_stat fields */
-#define local_softirq_pending() \
-	__IRQ_STAT(smp_processor_id(), __softirq_pending)
-
-  /* arch dependent irq_stat fields */
+/* arch dependent irq_stat fields */
 #define nmi_count(cpu)		__IRQ_STAT((cpu), __nmi_count)	/* i386 */
 
 #endif	/* __irq_cpustat_h */

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [tip:irq/core] softirq/ia64: Switch to generic local_softirq_pending() implementation
  2018-05-08 13:38 ` [PATCH 06/11] ia64: Switch to generic local_softirq_pending() implementation Frederic Weisbecker
@ 2018-05-14 12:49   ` tip-bot for Frederic Weisbecker
  0 siblings, 0 replies; 39+ messages in thread
From: tip-bot for Frederic Weisbecker @ 2018-05-14 12:49 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: davem, linux-kernel, peterz, paulus, fenghua.yu, deller, ysato,
	tglx, mingo, dalias, bigeasy, mpe, torvalds, tony.luck, jejb,
	heiko.carstens, schwidefsky, hpa, benh, frederic

Commit-ID:  a58bdf25b98bf765b4b732f2c56097ddcb9f2d5a
Gitweb:     https://git.kernel.org/tip/a58bdf25b98bf765b4b732f2c56097ddcb9f2d5a
Author:     Frederic Weisbecker <frederic@kernel.org>
AuthorDate: Tue, 8 May 2018 15:38:21 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 14 May 2018 11:25:27 +0200

softirq/ia64: Switch to generic local_softirq_pending() implementation

Benefit from the generic softirq mask implementation that rely on per-CPU
mutators instead of working with raw operators on top of this_cpu_ptr().

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Helge Deller <deller@gmx.de>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Rich Felker <dalias@libc.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Link: http://lkml.kernel.org/r/1525786706-22846-7-git-send-email-frederic@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/ia64/include/asm/hardirq.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/ia64/include/asm/hardirq.h b/arch/ia64/include/asm/hardirq.h
index 22fae710e420..ccde7c2ba00f 100644
--- a/arch/ia64/include/asm/hardirq.h
+++ b/arch/ia64/include/asm/hardirq.h
@@ -13,7 +13,7 @@
 
 #define __ARCH_IRQ_STAT	1
 
-#define local_softirq_pending()	(*this_cpu_ptr(&ia64_cpu_info.softirq_pending))
+#define local_softirq_pending_ref	ia64_cpu_info.softirq_pending
 
 #include <linux/threads.h>
 #include <linux/irq.h>

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [tip:irq/core] softirq/parisc: Switch to generic local_softirq_pending() implementation
  2018-05-08 13:38 ` [PATCH 07/11] parisc: " Frederic Weisbecker
@ 2018-05-14 12:50   ` tip-bot for Frederic Weisbecker
  0 siblings, 0 replies; 39+ messages in thread
From: tip-bot for Frederic Weisbecker @ 2018-05-14 12:50 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: bigeasy, schwidefsky, dalias, linux-kernel, torvalds, paulus,
	hpa, tony.luck, benh, deller, mpe, davem, peterz, tglx, jejb,
	heiko.carstens, fenghua.yu, ysato, frederic, mingo

Commit-ID:  03979f8a72e6576248e7b9e3abb72a760312dd7d
Gitweb:     https://git.kernel.org/tip/03979f8a72e6576248e7b9e3abb72a760312dd7d
Author:     Frederic Weisbecker <frederic@kernel.org>
AuthorDate: Tue, 8 May 2018 15:38:22 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 14 May 2018 11:25:27 +0200

softirq/parisc: Switch to generic local_softirq_pending() implementation

Remove the ad-hoc implementation, the generic code now allows us not to
reinvent the wheel.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Helge Deller <deller@gmx.de>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Rich Felker <dalias@libc.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Link: http://lkml.kernel.org/r/1525786706-22846-8-git-send-email-frederic@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/parisc/include/asm/hardirq.h | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/arch/parisc/include/asm/hardirq.h b/arch/parisc/include/asm/hardirq.h
index 077815169258..1a1235a9d533 100644
--- a/arch/parisc/include/asm/hardirq.h
+++ b/arch/parisc/include/asm/hardirq.h
@@ -34,14 +34,6 @@ DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
 #define __IRQ_STAT(cpu, member) (irq_stat[cpu].member)
 #define inc_irq_stat(member)	this_cpu_inc(irq_stat.member)
 #define __inc_irq_stat(member)	__this_cpu_inc(irq_stat.member)
-#define local_softirq_pending()	this_cpu_read(irq_stat.__softirq_pending)
-
-#define __ARCH_SET_SOFTIRQ_PENDING
-
-#define set_softirq_pending(x)	\
-		this_cpu_write(irq_stat.__softirq_pending, (x))
-#define or_softirq_pending(x)	this_cpu_or(irq_stat.__softirq_pending, (x))
-
 #define ack_bad_irq(irq) WARN(1, "unexpected IRQ trap at vector %02x\n", irq)
 
 #endif /* _PARISC_HARDIRQ_H */

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [tip:irq/core] softirq/powerpc: Switch to generic local_softirq_pending() implementation
  2018-05-08 13:38 ` [PATCH 08/11] powerpc: " Frederic Weisbecker
@ 2018-05-14 12:50   ` tip-bot for Frederic Weisbecker
  0 siblings, 0 replies; 39+ messages in thread
From: tip-bot for Frederic Weisbecker @ 2018-05-14 12:50 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: davem, jejb, ysato, heiko.carstens, paulus, mpe, schwidefsky,
	hpa, peterz, linux-kernel, mingo, deller, fenghua.yu, tony.luck,
	dalias, bigeasy, tglx, benh, frederic, torvalds

Commit-ID:  1321a5de1ecb0d2981394ff2111c75c4dcb0c237
Gitweb:     https://git.kernel.org/tip/1321a5de1ecb0d2981394ff2111c75c4dcb0c237
Author:     Frederic Weisbecker <frederic@kernel.org>
AuthorDate: Tue, 8 May 2018 15:38:23 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 14 May 2018 11:25:28 +0200

softirq/powerpc: Switch to generic local_softirq_pending() implementation

Remove the ad-hoc implementation, the generic code now allows us not to
reinvent the wheel.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Helge Deller <deller@gmx.de>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Rich Felker <dalias@libc.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Link: http://lkml.kernel.org/r/1525786706-22846-9-git-send-email-frederic@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/powerpc/include/asm/hardirq.h | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/arch/powerpc/include/asm/hardirq.h b/arch/powerpc/include/asm/hardirq.h
index 5986d473722b..383f628acbf8 100644
--- a/arch/powerpc/include/asm/hardirq.h
+++ b/arch/powerpc/include/asm/hardirq.h
@@ -25,15 +25,8 @@ typedef struct {
 DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
 
 #define __ARCH_IRQ_STAT
-
-#define local_softirq_pending()	__this_cpu_read(irq_stat.__softirq_pending)
-
-#define __ARCH_SET_SOFTIRQ_PENDING
 #define __ARCH_IRQ_EXIT_IRQS_DISABLED
 
-#define set_softirq_pending(x) __this_cpu_write(irq_stat.__softirq_pending, (x))
-#define or_softirq_pending(x) __this_cpu_or(irq_stat.__softirq_pending, (x))
-
 static inline void ack_bad_irq(unsigned int irq)
 {
 	printk(KERN_CRIT "unexpected IRQ trap at vector %02x\n", irq);

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [tip:irq/core] softirq/sparc: Switch to generic local_softirq_pending() implementation
  2018-05-08 13:38 ` [PATCH 09/11] sparc: " Frederic Weisbecker
@ 2018-05-14 12:51   ` tip-bot for Frederic Weisbecker
  0 siblings, 0 replies; 39+ messages in thread
From: tip-bot for Frederic Weisbecker @ 2018-05-14 12:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: tony.luck, tglx, dalias, bigeasy, mingo, deller, hpa, ysato,
	heiko.carstens, paulus, benh, fenghua.yu, davem, linux-kernel,
	jejb, schwidefsky, frederic, torvalds, peterz, mpe

Commit-ID:  424f7d3e3b950c88a4127b7dfa78ea54e287413e
Gitweb:     https://git.kernel.org/tip/424f7d3e3b950c88a4127b7dfa78ea54e287413e
Author:     Frederic Weisbecker <frederic@kernel.org>
AuthorDate: Tue, 8 May 2018 15:38:24 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 14 May 2018 11:25:28 +0200

softirq/sparc: Switch to generic local_softirq_pending() implementation

Benefit from the generic softirq mask implementation that rely on per-CPU
mutators instead of working with raw operators on top of this_cpu_ptr().

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Helge Deller <deller@gmx.de>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Rich Felker <dalias@libc.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Link: http://lkml.kernel.org/r/1525786706-22846-10-git-send-email-frederic@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/sparc/include/asm/hardirq_64.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/sparc/include/asm/hardirq_64.h b/arch/sparc/include/asm/hardirq_64.h
index 6aba904819a4..75b92bfe04b5 100644
--- a/arch/sparc/include/asm/hardirq_64.h
+++ b/arch/sparc/include/asm/hardirq_64.h
@@ -10,8 +10,9 @@
 #include <asm/cpudata.h>
 
 #define __ARCH_IRQ_STAT
-#define local_softirq_pending() \
-	(*this_cpu_ptr(&__cpu_data.__softirq_pending))
+
+#define local_softirq_pending_ref \
+	__cpu_data.__softirq_pending
 
 void ack_bad_irq(unsigned int irq);
 

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [tip:irq/core] softirq/x86: Switch to generic local_softirq_pending() implementation
  2018-05-08 13:38 ` [PATCH 10/11] x86: " Frederic Weisbecker
@ 2018-05-14 12:51   ` tip-bot for Frederic Weisbecker
  0 siblings, 0 replies; 39+ messages in thread
From: tip-bot for Frederic Weisbecker @ 2018-05-14 12:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: schwidefsky, fenghua.yu, mingo, heiko.carstens, tglx, tony.luck,
	paulus, jejb, bigeasy, deller, dalias, mpe, torvalds, davem,
	linux-kernel, benh, hpa, peterz, frederic, ysato

Commit-ID:  1a8bc8f8d6a7980a999975edbd29578fbce09359
Gitweb:     https://git.kernel.org/tip/1a8bc8f8d6a7980a999975edbd29578fbce09359
Author:     Frederic Weisbecker <frederic@kernel.org>
AuthorDate: Tue, 8 May 2018 15:38:25 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 14 May 2018 11:25:28 +0200

softirq/x86: Switch to generic local_softirq_pending() implementation

Remove the ad-hoc implementation, the generic code now allows us not to
reinvent the wheel.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Helge Deller <deller@gmx.de>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Rich Felker <dalias@libc.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Link: http://lkml.kernel.org/r/1525786706-22846-11-git-send-email-frederic@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/include/asm/hardirq.h | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/hardirq.h
index 5ea2afd4c871..740a428acf1e 100644
--- a/arch/x86/include/asm/hardirq.h
+++ b/arch/x86/include/asm/hardirq.h
@@ -50,14 +50,6 @@ DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
 
 #define inc_irq_stat(member)	this_cpu_inc(irq_stat.member)
 
-#define local_softirq_pending()	this_cpu_read(irq_stat.__softirq_pending)
-
-#define __ARCH_SET_SOFTIRQ_PENDING
-
-#define set_softirq_pending(x)	\
-		this_cpu_write(irq_stat.__softirq_pending, (x))
-#define or_softirq_pending(x)	this_cpu_or(irq_stat.__softirq_pending, (x))
-
 extern void ack_bad_irq(unsigned int irq);
 
 extern u64 arch_irq_stat_cpu(unsigned int cpu);

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [tip:irq/core] softirq/s390: Move default mutators of overwritten softirq mask to s390
  2018-05-08 13:38 ` [PATCH 11/11] softirq/s390: Move default mutators of overwritten softirq mask to s390 Frederic Weisbecker
@ 2018-05-14 12:52   ` tip-bot for Frederic Weisbecker
  0 siblings, 0 replies; 39+ messages in thread
From: tip-bot for Frederic Weisbecker @ 2018-05-14 12:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mpe, jejb, torvalds, ysato, fenghua.yu, benh, mingo, tony.luck,
	heiko.carstens, paulus, linux-kernel, schwidefsky, bigeasy, hpa,
	dalias, frederic, deller, tglx, peterz, davem

Commit-ID:  48bda43eabb8d086204f543cf8bbad696b8c6391
Gitweb:     https://git.kernel.org/tip/48bda43eabb8d086204f543cf8bbad696b8c6391
Author:     Frederic Weisbecker <frederic@kernel.org>
AuthorDate: Tue, 8 May 2018 15:38:26 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 14 May 2018 11:25:28 +0200

softirq/s390: Move default mutators of overwritten softirq mask to s390

s390 is now the last architecture that entirely overwrites
local_softirq_pending() and uses the according default definitions of
set_softirq_pending() and or_softirq_pending().

Just move these to s390 to debloat the generic code complexity.

Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Helge Deller <deller@gmx.de>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Rich Felker <dalias@libc.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Link: http://lkml.kernel.org/r/1525786706-22846-12-git-send-email-frederic@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/s390/include/asm/hardirq.h | 2 ++
 include/linux/interrupt.h       | 7 -------
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/arch/s390/include/asm/hardirq.h b/arch/s390/include/asm/hardirq.h
index a296c6acfd07..dfbc3c6c0674 100644
--- a/arch/s390/include/asm/hardirq.h
+++ b/arch/s390/include/asm/hardirq.h
@@ -14,6 +14,8 @@
 #include <asm/lowcore.h>
 
 #define local_softirq_pending() (S390_lowcore.softirq_pending)
+#define set_softirq_pending(x) (S390_lowcore.softirq_pending = (x))
+#define or_softirq_pending(x)  (S390_lowcore.softirq_pending |= (x))
 
 #define __ARCH_IRQ_STAT
 #define __ARCH_HAS_DO_SOFTIRQ
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 7a11f73c5c3b..eeceac3376fc 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -442,13 +442,6 @@ extern bool force_irqthreads;
 #define set_softirq_pending(x)	(__this_cpu_write(local_softirq_pending_ref, (x)))
 #define or_softirq_pending(x)	(__this_cpu_or(local_softirq_pending_ref, (x)))
 
-#else /* local_softirq_pending */
-
-#ifndef __ARCH_SET_SOFTIRQ_PENDING
-#define set_softirq_pending(x) (local_softirq_pending() = (x))
-#define or_softirq_pending(x)  (local_softirq_pending() |= (x))
-#endif
-
 #endif /* local_softirq_pending */
 
 /* Some architectures might implement lazy enabling/disabling of

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* Re: [GIT PULL]
  2022-08-09 13:27 [GIT PULL] David Howells
@ 2022-08-09 17:29 ` pr-tracker-bot
  0 siblings, 0 replies; 39+ messages in thread
From: pr-tracker-bot @ 2022-08-09 17:29 UTC (permalink / raw)
  To: David Howells
  Cc: torvalds, dhowells, jlayton, linux-cachefs, linux-fsdevel, linux-kernel

The pull request you sent on Tue, 09 Aug 2022 14:27:25 +0100:

> git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git tags/fscache-fixes-20220809

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/15205c2829ca2cbb5ece5ceaafe1171a8470e62b

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [GIT PULL]
@ 2022-08-09 13:27 David Howells
  2022-08-09 17:29 ` pr-tracker-bot
  0 siblings, 1 reply; 39+ messages in thread
From: David Howells @ 2022-08-09 13:27 UTC (permalink / raw)
  To: torvalds; +Cc: dhowells, jlayton, linux-cachefs, linux-fsdevel, linux-kernel

Hi Linus,

Can you pull these two patches please?  The first fixes a cookie access ref
leak if a cookie is invalidated a second time before the first invalidation
is actually processed.  The second adds a tracepoint to log cookie look up
failure.

Thanks,
David

Link: https://listman.redhat.com/archives/linux-cachefs/2022-August/007061.html
Link: https://listman.redhat.com/archives/linux-cachefs/2022-August/007062.html
---
The following changes since commit 3d7cb6b04c3f3115719235cc6866b10326de34cd:

  Linux 5.19 (2022-07-31 14:03:01 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git tags/fscache-fixes-20220809

for you to fetch changes up to 1a1e3aca9d4957e282945cdc2b58e7c560b8e0d2:

  fscache: add tracepoint when failing cookie (2022-08-09 14:13:59 +0100)

----------------------------------------------------------------
fscache fixes

----------------------------------------------------------------
Jeff Layton (2):
      fscache: don't leak cookie access refs if invalidation is in progress or failed
      fscache: add tracepoint when failing cookie

 fs/fscache/cookie.c            | 9 +++++++--
 include/trace/events/fscache.h | 2 ++
 2 files changed, 9 insertions(+), 2 deletions(-)


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [GIT PULL]
  2022-06-03 19:20 Eric W. Biederman
@ 2022-06-03 23:25 ` pr-tracker-bot
  0 siblings, 0 replies; 39+ messages in thread
From: pr-tracker-bot @ 2022-06-03 23:25 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: Linus Torvalds, linux-kernel, Oleg Nesterov,
	Sebastian Andrzej Siewior, Peter Zijlstra

The pull request you sent on Fri, 03 Jun 2022 14:20:38 -0500:

> git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace.git ptrace_stop-cleanup-for-v5.19

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/67850b7bdcd2803e10d019f0da5673a92139b43a

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [GIT PULL]
@ 2022-06-03 19:20 Eric W. Biederman
  2022-06-03 23:25 ` pr-tracker-bot
  0 siblings, 1 reply; 39+ messages in thread
From: Eric W. Biederman @ 2022-06-03 19:20 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Oleg Nesterov, Sebastian Andrzej Siewior, Peter Zijlstra


Linus,

Please pull the ptrace_stop-cleanup-for-v5.19 tag from the git tree:

  git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace.git ptrace_stop-cleanup-for-v5.19
  HEAD: 31cae1eaae4fd65095ad6a3659db467bc3c2599e sched,signal,ptrace: Rework TASK_TRACED, TASK_STOPPED state

While looking at the ptrace problems with PREEMPT_RT and the problems
of Peter Zijlstra was encountering with ptrace in his freezer rewrite
I identified some cleanups to ptrace_stop that make sense on their own
and move make resolving the other problems much simpler.

The biggest issue is the habbit of the ptrace code to change task->__state
from the tracer to suppress TASK_WAKEKILL from waking up the tracee.  No
other code in the kernel does that and it is straight forward to update
signal_wake_up and friends to make that unnecessary.

Peter's task freezer sets frozen tasks to a new state TASK_FROZEN and
then it stores them by calling "wake_up_state(t, TASK_FROZEN)" relying
on the fact that all stopped states except the special stop states can
tolerate spurious wake up and recover their state.

The state of stopped and traced tasked is changed to be stored in
task->jobctl as well as in task->__state.  This makes it possible for
the freezer to recover tasks in these special states, as well as
serving as a general cleanup.  With a little more work in that
direction I believe TASK_STOPPED can learn to tolerate spurious wake
ups and become an ordinary stop state.

The TASK_TRACED state has to remain a special state as the registers for
a process are only reliably available when the process is stopped in
the scheduler.  Fundamentally ptrace needs acess to the saved
register values of a task.

There are bunch of semi-random ptrace related cleanups that were found
while looking at these issues.

One cleanup that deserves to be called out is from commit 57b6de08b5f6
("ptrace: Admit ptrace_stop can generate spuriuos SIGTRAPs").  This
makes a change that is technically user space visible, in the handling
of what happens to a tracee when a tracer dies unexpectedly.
According to our testing and our understanding of userspace nothing
cares that spurious SIGTRAPs can be generated in that case.

The entire discussion can be found at:
  https://lkml.kernel.org/r/87a6bv6dl6.fsf_-_@email.froward.int.ebiederm.org

Eric W. Biederman (11):
      signal: Rename send_signal send_signal_locked
      signal: Replace __group_send_sig_info with send_signal_locked
      ptrace/um: Replace PT_DTRACE with TIF_SINGLESTEP
      ptrace/xtensa: Replace PT_SINGLESTEP with TIF_SINGLESTEP
      ptrace: Remove arch_ptrace_attach
      signal: Use lockdep_assert_held instead of assert_spin_locked
      ptrace: Reimplement PTRACE_KILL by always sending SIGKILL
      ptrace: Document that wait_task_inactive can't fail
      ptrace: Admit ptrace_stop can generate spuriuos SIGTRAPs
      ptrace: Don't change __state
      ptrace: Always take siglock in ptrace_resume

Peter Zijlstra (1):
      sched,signal,ptrace: Rework TASK_TRACED, TASK_STOPPED state

 arch/ia64/include/asm/ptrace.h    |   4 --
 arch/ia64/kernel/ptrace.c         |  57 ----------------
 arch/um/include/asm/thread_info.h |   2 +
 arch/um/kernel/exec.c             |   2 +-
 arch/um/kernel/process.c          |   2 +-
 arch/um/kernel/ptrace.c           |   8 +--
 arch/um/kernel/signal.c           |   4 +-
 arch/x86/kernel/step.c            |   3 +-
 arch/xtensa/kernel/ptrace.c       |   4 +-
 arch/xtensa/kernel/signal.c       |   4 +-
 drivers/tty/tty_jobctrl.c         |   4 +-
 include/linux/ptrace.h            |   7 --
 include/linux/sched.h             |  10 ++-
 include/linux/sched/jobctl.h      |   8 +++
 include/linux/sched/signal.h      |  20 ++++--
 include/linux/signal.h            |   3 +-
 kernel/ptrace.c                   |  87 ++++++++---------------
 kernel/sched/core.c               |   5 +-
 kernel/signal.c                   | 140 +++++++++++++++++---------------------
 kernel/time/posix-cpu-timers.c    |   6 +-
 20 files changed, 140 insertions(+), 240 deletions(-)

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>

p.s.  My apologies this is coming in so late, everyone in my house has
been sick.

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [GIT PULL]
@ 2021-12-23 19:55 Eric W. Biederman
  0 siblings, 0 replies; 39+ messages in thread
From: Eric W. Biederman @ 2021-12-23 19:55 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Alexey Gladkov, linux-kernel, Linux Containers


Linus,

Please pull the ucount-rlimit-fixes-for-v5.16 branch from the git tree:

  git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace.git ucount-rlimit-fixes-for-v5.16

  HEAD: 59ec71575ab440cd5ca0aa53b2a2985b3639fad4 ucounts: Fix rlimit max values check

This fixes a silly logic bug in the ucount rlimits code, where it was
comparing against the wrong limit.  As the fix is quite small it is
included in it's entirety below.

Eric

From 59ec71575ab440cd5ca0aa53b2a2985b3639fad4 Mon Sep 17 00:00:00 2001
From: Alexey Gladkov <legion@kernel.org>
Date: Mon, 29 Nov 2021 21:37:25 +0100
Subject: [PATCH] ucounts: Fix rlimit max values check

The semantics of the rlimit max values differs from ucounts itself. When
creating a new userns, we store the current rlimit of the process in
ucount_max. Thus, the value of the limit in the parent userns is saved
in the created one.

The problem is that now we are taking the maximum value for counter from
the same userns. So for init_user_ns it will always be RLIM_INFINITY.

To fix the problem we need to check the counter value with the max value
stored in userns.

Reproducer:

su - test -c "ulimit -u 3; sleep 5 & sleep 6 & unshare -U --map-root-user sh -c 'sleep 7 & sleep 8 & date; wait'"

Before:

[1] 175
[2] 176
Fri Nov 26 13:48:20 UTC 2021
[1]-  Done                    sleep 5
[2]+  Done                    sleep 6

After:

[1] 167
[2] 168
sh: fork: retry: Resource temporarily unavailable
sh: fork: retry: Resource temporarily unavailable
sh: fork: retry: Resource temporarily unavailable
sh: fork: retry: Resource temporarily unavailable
sh: fork: retry: Resource temporarily unavailable
sh: fork: retry: Resource temporarily unavailable
sh: fork: retry: Resource temporarily unavailable
sh: fork: Interrupted system call
[1]-  Done                    sleep 5
[2]+  Done                    sleep 6

Fixes: c54b245d0118 ("Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace")
Reported-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Alexey Gladkov <legion@kernel.org>
Link: https://lkml.kernel.org/r/024ec805f6e16896f0b23e094773790d171d2c1c.1638218242.git.legion@kernel.org
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 kernel/ucount.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/kernel/ucount.c b/kernel/ucount.c
index 4f5613dac227..7b32c356ebc5 100644
--- a/kernel/ucount.c
+++ b/kernel/ucount.c
@@ -264,15 +264,16 @@ void dec_ucount(struct ucounts *ucounts, enum ucount_type type)
 long inc_rlimit_ucounts(struct ucounts *ucounts, enum ucount_type type, long v)
 {
 	struct ucounts *iter;
+	long max = LONG_MAX;
 	long ret = 0;
 
 	for (iter = ucounts; iter; iter = iter->ns->ucounts) {
-		long max = READ_ONCE(iter->ns->ucount_max[type]);
 		long new = atomic_long_add_return(v, &iter->ucount[type]);
 		if (new < 0 || new > max)
 			ret = LONG_MAX;
 		else if (iter == ucounts)
 			ret = new;
+		max = READ_ONCE(iter->ns->ucount_max[type]);
 	}
 	return ret;
 }
@@ -312,15 +313,16 @@ long inc_rlimit_get_ucounts(struct ucounts *ucounts, enum ucount_type type)
 {
 	/* Caller must hold a reference to ucounts */
 	struct ucounts *iter;
+	long max = LONG_MAX;
 	long dec, ret = 0;
 
 	for (iter = ucounts; iter; iter = iter->ns->ucounts) {
-		long max = READ_ONCE(iter->ns->ucount_max[type]);
 		long new = atomic_long_add_return(1, &iter->ucount[type]);
 		if (new < 0 || new > max)
 			goto unwind;
 		if (iter == ucounts)
 			ret = new;
+		max = READ_ONCE(iter->ns->ucount_max[type]);
 		/*
 		 * Grab an extra ucount reference for the caller when
 		 * the rlimit count was previously 0.
@@ -339,15 +341,16 @@ long inc_rlimit_get_ucounts(struct ucounts *ucounts, enum ucount_type type)
 	return 0;
 }
 
-bool is_ucounts_overlimit(struct ucounts *ucounts, enum ucount_type type, unsigned long max)
+bool is_ucounts_overlimit(struct ucounts *ucounts, enum ucount_type type, unsigned long rlimit)
 {
 	struct ucounts *iter;
-	if (get_ucounts_value(ucounts, type) > max)
-		return true;
+	long max = rlimit;
+	if (rlimit > LONG_MAX)
+		max = LONG_MAX;
 	for (iter = ucounts; iter; iter = iter->ns->ucounts) {
-		max = READ_ONCE(iter->ns->ucount_max[type]);
 		if (get_ucounts_value(iter, type) > max)
 			return true;
+		max = READ_ONCE(iter->ns->ucount_max[type]);
 	}
 	return false;
 }
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [GIT PULL]
@ 2016-04-12 18:34 David Howells
  0 siblings, 0 replies; 39+ messages in thread
From: David Howells @ 2016-04-12 18:34 UTC (permalink / raw)
  To: jmorris; +Cc: dhowells, keyrings, linux-security-module, linux-kernel

Hi James,

Can you pull and pass these patches on to Linus?

There are two:

 (1) Fix the assoc_array implemetation to never call the compare_object op
     on non-leaf objects.

 (2) Fix an error check in the ASN.1 decoder compiler.

Thanks,
David
---
The following changes since commit 541d8f4d59d79f5d37c8c726f723d42ff307db57:

  Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm (2016-04-05 16:16:00 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git tags/keys-fixes-20160412

for you to fetch changes up to 952cca6a724c420a1efb6025e41862dfd2c1edc3:

  ASN.1: fix open failure check on headername (2016-04-06 14:06:48 +0100)

----------------------------------------------------------------
Keyrings fixes

----------------------------------------------------------------
Colin Ian King (1):
      ASN.1: fix open failure check on headername

Jerome Marchand (1):
      assoc_array: don't call compare_object() on a node

 lib/assoc_array.c       | 4 +++-
 scripts/asn1_compiler.c | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [git pull]
@ 2012-03-13  4:56 Jesse Barnes
  0 siblings, 0 replies; 39+ messages in thread
From: Jesse Barnes @ 2012-03-13  4:56 UTC (permalink / raw)
  To: Linus Torvalds, linux-pci, linux-kernel

The following changes since commit
4f262acfde22b63498b5e4f165e53d3bb4e96400:

  Merge branch 'fixes' of git://git.linaro.org/people/rmk/linux-arm (2012-03-07 08:33:03 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci for-linus

A single fix for a regression that affects some people who try to
disable ASPM for whatever reason.

Matthew Garrett (1):
      PCI: ignore pre-1.1 ASPM quirking when ASPM is disabled

 drivers/pci/pcie/aspm.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [GIT PULL]
  2011-02-12  0:33 ` Linus Torvalds
  2011-02-12  1:41   ` Eric Sandeen
@ 2011-02-12 13:28   ` Ted Ts'o
  1 sibling, 0 replies; 39+ messages in thread
From: Ted Ts'o @ 2011-02-12 13:28 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-ext4, linux-kernel

On Fri, Feb 11, 2011 at 04:33:59PM -0800, Linus Torvalds wrote:
> This is a completely disgusting patch, and it causes warnings like this:

Mea culpa, mea culpa, mea maximum culpa.  Yes, sorry, I should have
caught the macro expansion bug and the cast warning.

I've fixed up the problems, and repushed the for_linus branch.  My
post -rc1 push came late due to travel and other business, and that no
doubt contributed to the lack of quality control, but I didn't want to
wait since they did fix a number of fairly serious regressions.  I
hope you'll take the pull with these problems fixed?

  git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git for_linus

						- Ted

Curt Wohlgemuth (1):
      ext4: Fix data corruption with multi-block writepages support

Eric Sandeen (3):
      ext4: fix panic on module unload when stopping lazyinit thread
      ext4: make grpinfo slab cache names static
      ext4: serialize unaligned asynchronous DIO

Lukas Czerner (1):
      ext4: unregister features interface on module unload

Theodore Ts'o (2):
      ext4: fix up ext4 error handling
      jbd2: call __jbd2_log_start_commit with j_state_lock write locked

 fs/ext4/ext4.h        |   10 +++++
 fs/ext4/extents.c     |   10 +++--
 fs/ext4/file.c        |   60 +++++++++++++++++++++++++++++-
 fs/ext4/mballoc.c     |  100 +++++++++++++++++++++++++++++-------------------
 fs/ext4/page-io.c     |   36 +++++++++--------
 fs/ext4/super.c       |   66 ++++++++++++++++++++++----------
 fs/jbd2/journal.c     |    9 +++-
 fs/jbd2/transaction.c |   21 +++++++---
 8 files changed, 221 insertions(+), 91 deletions(-)

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [GIT PULL]
  2011-02-12  0:33 ` Linus Torvalds
@ 2011-02-12  1:41   ` Eric Sandeen
  2011-02-12 13:28   ` Ted Ts'o
  1 sibling, 0 replies; 39+ messages in thread
From: Eric Sandeen @ 2011-02-12  1:41 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Ted Ts'o, linux-ext4, linux-kernel

On 2/11/11 6:33 PM, Linus Torvalds wrote:
> On Fri, Feb 11, 2011 at 5:40 AM, Ted Ts'o <tytso@mit.edu> wrote:
>>
>> Please pull from:
>>
>>  git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git for_linus
>>
>> to get regression and bug fixes for 2.6.38.
>>
>> Eric Sandeen (3):
>>      ext4: serialize unaligned asynchronous DIO
> 
> This is a completely disgusting patch, and it causes warnings like this:

>  fs/ext4/file.c: In function ‘ext4_aiodio_wait’:
>  fs/ext4/file.c:60:44: warning: cast from pointer to integer of different size
> 
> because that disgusting patch does things like
> 
>   #define ext4_aio_mutex(v)  (&ext4__aio_mutex[((unsigned)v) % EXT4_WQ_HASH_SZ])

Well crap, the patch I sent Ted did not cause warnings.
OTOH, I eyeballed his changes to my patch and said OK.  Didn't test-build it though.
Sorry about that.

Will see what's going on here...

-Eric

> which is just terminally broken.
> 
> It's terminally broken for multiple reasons, too. It's not just "oh, a
> warning". It's a case of "oh, THAT CODE IS UTTER CRAP". The warning
> was just the lucky reason I noticed the totally unacceptable code.
> 
> Dammit, don't send sh*t to me this late in the release cycle. This
> clearly went through _zero_ quality control.
> 
>                    Linus
> 
> PS. If people don't understand why that code is utter crap, let me
> give you a hint: macro argument expansion vs operator precedence.
> 
> PPS. And btw, the warning is unacceptable too. Cast the thing to
> "unsigned long" (or uintptr_t, but quite frankly, in the kernel I'd
> suggest "unsigned long" rather than the more obscure standard types)
> after you've fixed the macro argument problem.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [GIT PULL]
  2011-02-11 13:40 [GIT PULL] Ted Ts'o
@ 2011-02-12  0:33 ` Linus Torvalds
  2011-02-12  1:41   ` Eric Sandeen
  2011-02-12 13:28   ` Ted Ts'o
  0 siblings, 2 replies; 39+ messages in thread
From: Linus Torvalds @ 2011-02-12  0:33 UTC (permalink / raw)
  To: Ted Ts'o, Linus Torvalds, linux-ext4, linux-kernel

On Fri, Feb 11, 2011 at 5:40 AM, Ted Ts'o <tytso@mit.edu> wrote:
>
> Please pull from:
>
>  git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git for_linus
>
> to get regression and bug fixes for 2.6.38.
>
> Eric Sandeen (3):
>      ext4: serialize unaligned asynchronous DIO

This is a completely disgusting patch, and it causes warnings like this:

 fs/ext4/file.c: In function ‘ext4_aiodio_wait’:
 fs/ext4/file.c:60:44: warning: cast from pointer to integer of different size

because that disgusting patch does things like

  #define ext4_aio_mutex(v)  (&ext4__aio_mutex[((unsigned)v) % EXT4_WQ_HASH_SZ])

which is just terminally broken.

It's terminally broken for multiple reasons, too. It's not just "oh, a
warning". It's a case of "oh, THAT CODE IS UTTER CRAP". The warning
was just the lucky reason I noticed the totally unacceptable code.

Dammit, don't send sh*t to me this late in the release cycle. This
clearly went through _zero_ quality control.

                   Linus

PS. If people don't understand why that code is utter crap, let me
give you a hint: macro argument expansion vs operator precedence.

PPS. And btw, the warning is unacceptable too. Cast the thing to
"unsigned long" (or uintptr_t, but quite frankly, in the kernel I'd
suggest "unsigned long" rather than the more obscure standard types)
after you've fixed the macro argument problem.

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [GIT PULL]
@ 2011-02-11 13:40 Ted Ts'o
  2011-02-12  0:33 ` Linus Torvalds
  0 siblings, 1 reply; 39+ messages in thread
From: Ted Ts'o @ 2011-02-11 13:40 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-ext4, linux-kernel

Hi Linus,

Please pull from:

  git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git for_linus

to get regression and bug fixes for 2.6.38.

Thanks,

	       	  	     	      	  - Ted

Curt Wohlgemuth (1):
      ext4: Fix data corruption with multi-block writepages support

Dan Carpenter (1):
      ext4: off by one check in ext4_groupinfo_create_slab()

Eric Sandeen (3):
      ext4: fix panic on module unload when stopping lazyinit thread
      ext4: make grpinfo slab cache names static
      ext4: serialize unaligned asynchronous DIO

Lukas Czerner (1):
      ext4: unregister features interface on module unload

Theodore Ts'o (2):
      ext4: fix up ext4 error handling
      jbd2: call __jbd2_log_start_commit with j_state_lock write locked

 fs/ext4/ext4.h        |    8 ++++
 fs/ext4/extents.c     |   10 +++--
 fs/ext4/file.c        |   60 +++++++++++++++++++++++++++++-
 fs/ext4/mballoc.c     |  100 +++++++++++++++++++++++++++++-------------------
 fs/ext4/page-io.c     |   36 +++++++++--------
 fs/ext4/super.c       |   66 ++++++++++++++++++++++----------
 fs/jbd2/journal.c     |    9 +++-
 fs/jbd2/transaction.c |   21 +++++++---
 8 files changed, 219 insertions(+), 91 deletions(-)

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [GIT PULL]
  2010-09-10 12:52 Nicolas Ferre
@ 2010-09-10 13:16 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-09-10 13:16 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Linus Torvalds, Linux Kernel list,
	'linux-arm-kernel@lists.infradead.org',
	Andrew Victor

On 14:52 Fri 10 Sep     , Nicolas Ferre wrote:
> Hi Linus,
> 
> Can you please pull ARM/AT91 little fixes from:
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

Best Regards,
J.

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [GIT PULL]
@ 2010-09-10 12:52 Nicolas Ferre
  2010-09-10 13:16 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 39+ messages in thread
From: Nicolas Ferre @ 2010-09-10 12:52 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Linux Kernel list, 'linux-arm-kernel@lists.infradead.org',
	Andrew Victor

Hi Linus,

Can you please pull ARM/AT91 little fixes from:

  git://github.com/at91linux/linux-2.6-at91.git at91-fixes-for-linus

and receive the following changes:

Fabian Godehardt (1):
      AT91: SAM9G45 - add a separate clock entry for every single TC block

Nicolas Ferre (5):
      AT91: change dma resource index
      AT91: clock: peripheral clocks can have other parent than mck
      AT91: dm9000 initialization update
      AT91: at91sam9261ek board: remove warnings related to use of SPI or SD/MMC
      AT91: at91sam9261ek: remove C99 comments but keep information

 arch/arm/mach-at91/at91sam9g45.c         |   15 +++++++++++--
 arch/arm/mach-at91/at91sam9g45_devices.c |    6 ++--
 arch/arm/mach-at91/board-sam9261ek.c     |   31 ++++++++++++++++++-----------
 arch/arm/mach-at91/clock.c               |    3 +-
 4 files changed, 36 insertions(+), 19 deletions(-)

Thanks,
-- 
Nicolas Ferre


^ permalink raw reply	[flat|nested] 39+ messages in thread

* [GIT PULL]
@ 2010-03-03  3:09 Frederic Weisbecker
  0 siblings, 0 replies; 39+ messages in thread
From: Frederic Weisbecker @ 2010-03-03  3:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Frederic Weisbecker, Thomas Gleixner, H . Peter Anvin,
	Peter Zijlstra, Paul Mackerras, Steven Rostedt, 2 . 6 . 33 . x,
	Arnaldo Carvalho de Melo

Ingo,

Please pull the perf/urgent branch that can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
	perf/urgent

Thanks,
	Frederic
---

Frederic Weisbecker (1):
      x86/stacktrace: Don't dereference bad frame pointers


 arch/x86/kernel/dumpstack_64.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

---
commit 29044ad1509ecc229f1d5a31aeed7a8dc61a71c4
Author: Frederic Weisbecker <fweisbec@gmail.com>
Date:   Wed Mar 3 02:25:22 2010 +0100

    x86/stacktrace: Don't dereference bad frame pointers
    
    Callers of a stacktrace might pass bad frame pointers. Those
    are usually checked for safety in stack walking helpers before
    any dereferencing, but this is not the case when we need to go
    through one more frame pointer that backlinks the irq stack to
    the previous one, as we don't have any reliable address boudaries
    to compare this frame pointer against.
    
    This raises crashes when we record callchains for ftrace events
    with perf because we don't use the right helpers to capture
    registers there. We get wrong frame pointers as we call
    task_pt_regs() even on kernel threads, which is a wrong thing
    as it gives us the initial state of any kernel threads freshly
    created. This is even not what we want for user tasks. What we want
    is a hot snapshot of registers when the ftrace event triggers, not
    the state before a task entered the kernel.
    
    This requires more thoughts to do it correctly though.
    So first put a guardian to ensure the given frame pointer
    can be dereferenced to avoid crashes. We'll think about how to fix
    the callers in a subsequent patch.
    
    Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Ingo Molnar <mingo@elte.hu>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Paul Mackerras <paulus@samba.org>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: 2.6.33.x <stable@kernel.org>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>

diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index 0ad9597..a6c906c 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -125,9 +125,15 @@ fixup_bp_irq_link(unsigned long bp, unsigned long *stack,
 {
 #ifdef CONFIG_FRAME_POINTER
 	struct stack_frame *frame = (struct stack_frame *)bp;
+	unsigned long next;
 
-	if (!in_irq_stack(stack, irq_stack, irq_stack_end))
-		return (unsigned long)frame->next_frame;
+	if (!in_irq_stack(stack, irq_stack, irq_stack_end)) {
+		if (!probe_kernel_address(&frame->next_frame, next))
+			return next;
+		else
+			WARN_ONCE(1, "Perf: bad frame pointer = %p in "
+				  "callchain\n", &frame->next_frame);
+	}
 #endif
 	return bp;
 }

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [GIT PULL]
@ 2007-10-23  9:43 Haavard Skinnemoen
  0 siblings, 0 replies; 39+ messages in thread
From: Haavard Skinnemoen @ 2007-10-23  9:43 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Linux Kernel, kernel

Linus,

Please pull from

  ssh://master.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32-2.6.git for-linus

to receive the following updates. This is mostly about connecting a few
loose ends that came in through other trees, that is make sure that the
new drivers can actually be used on avr32.

Alejandro Martinez Ruiz (1):
      [AVR32] ARRAY_SIZE() cleanup

Haavard Skinnemoen (3):
      [AVR32] Fix a couple of sparse warnings
      [AVR32] Implement more at32_add_device_foo() functions
      [AVR32] Implement at32_add_device_cf()

Hans-Christian Egtvedt (1):
      [AVR32] Wire up AT73C213 sound driver on ATSTK1000 board

Kristoffer Nyborg Gregertsen (1):
      [AVR32] Platform code for pata_at32

 arch/avr32/boards/atstk1000/atstk1002.c |   58 +++++
 arch/avr32/mach-at32ap/at32ap7000.c     |  344 +++++++++++++++++++++++++++++++
 arch/avr32/mach-at32ap/extint.c         |    2 +-
 arch/avr32/mach-at32ap/pm.h             |    4 +-
 arch/avr32/mach-at32ap/time-tc.c        |    2 +-
 include/asm-avr32/arch-at32ap/board.h   |   23 ++
 6 files changed, 429 insertions(+), 4 deletions(-)

diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index 6b9e466..5be0d13 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -16,6 +16,7 @@
 #include <linux/string.h>
 #include <linux/types.h>
 #include <linux/spi/spi.h>
+#include <linux/spi/at73c213.h>
 
 #include <video/atmel_lcdc.h>
 
@@ -49,7 +50,26 @@ static struct eth_platform_data __initdata eth_data[2] = {
 };
 
 #ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
+#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
+static struct at73c213_board_info at73c213_data = {
+	.ssc_id		= 0,
+	.shortname	= "AVR32 STK1000 external DAC",
+};
+#endif
+#endif
+
+#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
 static struct spi_board_info spi0_board_info[] __initdata = {
+#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
+	{
+		/* AT73C213 */
+		.modalias	= "at73c213",
+		.max_speed_hz	= 200000,
+		.chip_select	= 0,
+		.mode		= SPI_MODE_1,
+		.platform_data	= &at73c213_data,
+	},
+#endif
 	{
 		/* QVGA display */
 		.modalias	= "ltv350qv",
@@ -180,6 +200,38 @@ static void setup_j2_leds(void)
 }
 #endif
 
+#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
+#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
+static void __init at73c213_set_clk(struct at73c213_board_info *info)
+{
+	struct clk *gclk;
+	struct clk *pll;
+
+	gclk = clk_get(NULL, "gclk0");
+	if (IS_ERR(gclk))
+		goto err_gclk;
+	pll = clk_get(NULL, "pll0");
+	if (IS_ERR(pll))
+		goto err_pll;
+
+	if (clk_set_parent(gclk, pll)) {
+		pr_debug("STK1000: failed to set pll0 as parent for DAC clock\n");
+		goto err_set_clk;
+	}
+
+	at32_select_periph(GPIO_PIN_PA(30), GPIO_PERIPH_A, 0);
+	info->dac_clk = gclk;
+
+err_set_clk:
+	clk_put(pll);
+err_pll:
+	clk_put(gclk);
+err_gclk:
+	return;
+}
+#endif
+#endif
+
 void __init setup_board(void)
 {
 #ifdef	CONFIG_BOARD_ATSTK1002_SW2_CUSTOM
@@ -248,6 +300,12 @@ static int __init atstk1002_init(void)
 
 	setup_j2_leds();
 
+#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
+#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
+	at73c213_set_clk(&at73c213_data);
+#endif
+#endif
+
 	return 0;
 }
 postcore_initcall(atstk1002_init);
diff --git a/arch/avr32/mach-at32ap/at32ap7000.c b/arch/avr32/mach-at32ap/at32ap7000.c
index f6d154c..a9d9ec0 100644
--- a/arch/avr32/mach-at32ap/at32ap7000.c
+++ b/arch/avr32/mach-at32ap/at32ap7000.c
@@ -556,6 +556,17 @@ static struct clk pico_clk = {
 	.users		= 1,
 };
 
+static struct resource dmaca0_resource[] = {
+	{
+		.start	= 0xff200000,
+		.end	= 0xff20ffff,
+		.flags	= IORESOURCE_MEM,
+	},
+	IRQ(2),
+};
+DEFINE_DEV(dmaca, 0);
+DEV_CLK(hclk, dmaca0, hsb, 10);
+
 /* --------------------------------------------------------------------
  * HMATRIX
  * -------------------------------------------------------------------- */
@@ -655,6 +666,7 @@ void __init at32_add_system_devices(void)
 	platform_device_register(&at32_eic0_device);
 	platform_device_register(&smc0_device);
 	platform_device_register(&pdc_device);
+	platform_device_register(&dmaca0_device);
 
 	platform_device_register(&at32_systc0_device);
 
@@ -960,6 +972,96 @@ at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n)
 }
 
 /* --------------------------------------------------------------------
+ *  TWI
+ * -------------------------------------------------------------------- */
+static struct resource atmel_twi0_resource[] __initdata = {
+	PBMEM(0xffe00800),
+	IRQ(5),
+};
+static struct clk atmel_twi0_pclk = {
+	.name		= "twi_pclk",
+	.parent		= &pba_clk,
+	.mode		= pba_clk_mode,
+	.get_rate	= pba_clk_get_rate,
+	.index		= 2,
+};
+
+struct platform_device *__init at32_add_device_twi(unsigned int id)
+{
+	struct platform_device *pdev;
+
+	if (id != 0)
+		return NULL;
+
+	pdev = platform_device_alloc("atmel_twi", id);
+	if (!pdev)
+		return NULL;
+
+	if (platform_device_add_resources(pdev, atmel_twi0_resource,
+				ARRAY_SIZE(atmel_twi0_resource)))
+		goto err_add_resources;
+
+	select_peripheral(PA(6),  PERIPH_A, 0);	/* SDA	*/
+	select_peripheral(PA(7),  PERIPH_A, 0);	/* SDL	*/
+
+	atmel_twi0_pclk.dev = &pdev->dev;
+
+	platform_device_add(pdev);
+	return pdev;
+
+err_add_resources:
+	platform_device_put(pdev);
+	return NULL;
+}
+
+/* --------------------------------------------------------------------
+ * MMC
+ * -------------------------------------------------------------------- */
+static struct resource atmel_mci0_resource[] __initdata = {
+	PBMEM(0xfff02400),
+	IRQ(28),
+};
+static struct clk atmel_mci0_pclk = {
+	.name		= "mci_clk",
+	.parent		= &pbb_clk,
+	.mode		= pbb_clk_mode,
+	.get_rate	= pbb_clk_get_rate,
+	.index		= 9,
+};
+
+struct platform_device *__init at32_add_device_mci(unsigned int id)
+{
+	struct platform_device *pdev;
+
+	if (id != 0)
+		return NULL;
+
+	pdev = platform_device_alloc("atmel_mci", id);
+	if (!pdev)
+		return NULL;
+
+	if (platform_device_add_resources(pdev, atmel_mci0_resource,
+				ARRAY_SIZE(atmel_mci0_resource)))
+		goto err_add_resources;
+
+	select_peripheral(PA(10), PERIPH_A, 0);	/* CLK	 */
+	select_peripheral(PA(11), PERIPH_A, 0);	/* CMD	 */
+	select_peripheral(PA(12), PERIPH_A, 0);	/* DATA0 */
+	select_peripheral(PA(13), PERIPH_A, 0);	/* DATA1 */
+	select_peripheral(PA(14), PERIPH_A, 0);	/* DATA2 */
+	select_peripheral(PA(15), PERIPH_A, 0);	/* DATA3 */
+
+	atmel_mci0_pclk.dev = &pdev->dev;
+
+	platform_device_add(pdev);
+	return pdev;
+
+err_add_resources:
+	platform_device_put(pdev);
+	return NULL;
+}
+
+/* --------------------------------------------------------------------
  *  LCDC
  * -------------------------------------------------------------------- */
 static struct atmel_lcdfb_info atmel_lcdfb0_data;
@@ -1228,6 +1330,241 @@ out_free_pdev:
 }
 
 /* --------------------------------------------------------------------
+ * IDE / CompactFlash
+ * -------------------------------------------------------------------- */
+static struct resource at32_smc_cs4_resource[] __initdata = {
+	{
+		.start	= 0x04000000,
+		.end	= 0x07ffffff,
+		.flags	= IORESOURCE_MEM,
+	},
+	IRQ(~0UL), /* Magic IRQ will be overridden */
+};
+static struct resource at32_smc_cs5_resource[] __initdata = {
+	{
+		.start	= 0x20000000,
+		.end	= 0x23ffffff,
+		.flags	= IORESOURCE_MEM,
+	},
+	IRQ(~0UL), /* Magic IRQ will be overridden */
+};
+
+static int __init at32_init_ide_or_cf(struct platform_device *pdev,
+		unsigned int cs, unsigned int extint)
+{
+	static unsigned int extint_pin_map[4] __initdata = {
+		GPIO_PIN_PB(25),
+		GPIO_PIN_PB(26),
+		GPIO_PIN_PB(27),
+		GPIO_PIN_PB(28),
+	};
+	static bool common_pins_initialized __initdata = false;
+	unsigned int extint_pin;
+	int ret;
+
+	if (extint >= ARRAY_SIZE(extint_pin_map))
+		return -EINVAL;
+	extint_pin = extint_pin_map[extint];
+
+	switch (cs) {
+	case 4:
+		ret = platform_device_add_resources(pdev,
+				at32_smc_cs4_resource,
+				ARRAY_SIZE(at32_smc_cs4_resource));
+		if (ret)
+			return ret;
+
+		select_peripheral(PE(21), PERIPH_A, 0); /* NCS4   -> OE_N  */
+		set_ebi_sfr_bits(HMATRIX_BIT(CS4A));
+		break;
+	case 5:
+		ret = platform_device_add_resources(pdev,
+				at32_smc_cs5_resource,
+				ARRAY_SIZE(at32_smc_cs5_resource));
+		if (ret)
+			return ret;
+
+		select_peripheral(PE(22), PERIPH_A, 0); /* NCS5   -> OE_N  */
+		set_ebi_sfr_bits(HMATRIX_BIT(CS5A));
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	if (!common_pins_initialized) {
+		select_peripheral(PE(19), PERIPH_A, 0);	/* CFCE1  -> CS0_N */
+		select_peripheral(PE(20), PERIPH_A, 0);	/* CFCE2  -> CS1_N */
+		select_peripheral(PE(23), PERIPH_A, 0); /* CFRNW  -> DIR   */
+		select_peripheral(PE(24), PERIPH_A, 0); /* NWAIT  <- IORDY */
+		common_pins_initialized = true;
+	}
+
+	at32_select_periph(extint_pin, GPIO_PERIPH_A, AT32_GPIOF_DEGLITCH);
+
+	pdev->resource[1].start = EIM_IRQ_BASE + extint;
+	pdev->resource[1].end = pdev->resource[1].start;
+
+	return 0;
+}
+
+struct platform_device *__init
+at32_add_device_ide(unsigned int id, unsigned int extint,
+		    struct ide_platform_data *data)
+{
+	struct platform_device *pdev;
+
+	pdev = platform_device_alloc("at32_ide", id);
+	if (!pdev)
+		goto fail;
+
+	if (platform_device_add_data(pdev, data,
+				sizeof(struct ide_platform_data)))
+		goto fail;
+
+	if (at32_init_ide_or_cf(pdev, data->cs, extint))
+		goto fail;
+
+	platform_device_add(pdev);
+	return pdev;
+
+fail:
+	platform_device_put(pdev);
+	return NULL;
+}
+
+struct platform_device *__init
+at32_add_device_cf(unsigned int id, unsigned int extint,
+		    struct cf_platform_data *data)
+{
+	struct platform_device *pdev;
+
+	pdev = platform_device_alloc("at32_cf", id);
+	if (!pdev)
+		goto fail;
+
+	if (platform_device_add_data(pdev, data,
+				sizeof(struct cf_platform_data)))
+		goto fail;
+
+	if (at32_init_ide_or_cf(pdev, data->cs, extint))
+		goto fail;
+
+	if (data->detect_pin != GPIO_PIN_NONE)
+		at32_select_gpio(data->detect_pin, AT32_GPIOF_DEGLITCH);
+	if (data->reset_pin != GPIO_PIN_NONE)
+		at32_select_gpio(data->reset_pin, 0);
+	if (data->vcc_pin != GPIO_PIN_NONE)
+		at32_select_gpio(data->vcc_pin, 0);
+	/* READY is used as extint, so we can't select it as gpio */
+
+	platform_device_add(pdev);
+	return pdev;
+
+fail:
+	platform_device_put(pdev);
+	return NULL;
+}
+
+/* --------------------------------------------------------------------
+ * AC97C
+ * -------------------------------------------------------------------- */
+static struct resource atmel_ac97c0_resource[] __initdata = {
+	PBMEM(0xfff02800),
+	IRQ(29),
+};
+static struct clk atmel_ac97c0_pclk = {
+	.name		= "pclk",
+	.parent		= &pbb_clk,
+	.mode		= pbb_clk_mode,
+	.get_rate	= pbb_clk_get_rate,
+	.index		= 10,
+};
+
+struct platform_device *__init at32_add_device_ac97c(unsigned int id)
+{
+	struct platform_device *pdev;
+
+	if (id != 0)
+		return NULL;
+
+	pdev = platform_device_alloc("atmel_ac97c", id);
+	if (!pdev)
+		return NULL;
+
+	if (platform_device_add_resources(pdev, atmel_ac97c0_resource,
+				ARRAY_SIZE(atmel_ac97c0_resource)))
+		goto err_add_resources;
+
+	select_peripheral(PB(20), PERIPH_B, 0);	/* SYNC	*/
+	select_peripheral(PB(21), PERIPH_B, 0);	/* SDO	*/
+	select_peripheral(PB(22), PERIPH_B, 0);	/* SDI	*/
+	select_peripheral(PB(23), PERIPH_B, 0);	/* SCLK	*/
+
+	atmel_ac97c0_pclk.dev = &pdev->dev;
+
+	platform_device_add(pdev);
+	return pdev;
+
+err_add_resources:
+	platform_device_put(pdev);
+	return NULL;
+}
+
+/* --------------------------------------------------------------------
+ * ABDAC
+ * -------------------------------------------------------------------- */
+static struct resource abdac0_resource[] __initdata = {
+	PBMEM(0xfff02000),
+	IRQ(27),
+};
+static struct clk abdac0_pclk = {
+	.name		= "pclk",
+	.parent		= &pbb_clk,
+	.mode		= pbb_clk_mode,
+	.get_rate	= pbb_clk_get_rate,
+	.index		= 8,
+};
+static struct clk abdac0_sample_clk = {
+	.name		= "sample_clk",
+	.mode		= genclk_mode,
+	.get_rate	= genclk_get_rate,
+	.set_rate	= genclk_set_rate,
+	.set_parent	= genclk_set_parent,
+	.index		= 6,
+};
+
+struct platform_device *__init at32_add_device_abdac(unsigned int id)
+{
+	struct platform_device *pdev;
+
+	if (id != 0)
+		return NULL;
+
+	pdev = platform_device_alloc("abdac", id);
+	if (!pdev)
+		return NULL;
+
+	if (platform_device_add_resources(pdev, abdac0_resource,
+				ARRAY_SIZE(abdac0_resource)))
+		goto err_add_resources;
+
+	select_peripheral(PB(20), PERIPH_A, 0);	/* DATA1	*/
+	select_peripheral(PB(21), PERIPH_A, 0);	/* DATA0	*/
+	select_peripheral(PB(22), PERIPH_A, 0);	/* DATAN1	*/
+	select_peripheral(PB(23), PERIPH_A, 0);	/* DATAN0	*/
+
+	abdac0_pclk.dev = &pdev->dev;
+	abdac0_sample_clk.dev = &pdev->dev;
+
+	platform_device_add(pdev);
+	return pdev;
+
+err_add_resources:
+	platform_device_put(pdev);
+	return NULL;
+}
+
+/* --------------------------------------------------------------------
  *  GCLK
  * -------------------------------------------------------------------- */
 static struct clk gclk0 = {
@@ -1290,6 +1627,7 @@ struct clk *at32_clock_list[] = {
 	&smc0_mck,
 	&pdc_hclk,
 	&pdc_pclk,
+	&dmaca0_hclk,
 	&pico_clk,
 	&pio0_mck,
 	&pio1_mck,
@@ -1307,6 +1645,8 @@ struct clk *at32_clock_list[] = {
 	&macb1_pclk,
 	&atmel_spi0_spi_clk,
 	&atmel_spi1_spi_clk,
+	&atmel_twi0_pclk,
+	&atmel_mci0_pclk,
 	&atmel_lcdfb0_hck1,
 	&atmel_lcdfb0_pixclk,
 	&ssc0_pclk,
@@ -1314,6 +1654,9 @@ struct clk *at32_clock_list[] = {
 	&ssc2_pclk,
 	&usba0_hclk,
 	&usba0_pclk,
+	&atmel_ac97c0_pclk,
+	&abdac0_pclk,
+	&abdac0_sample_clk,
 	&gclk0,
 	&gclk1,
 	&gclk2,
@@ -1355,6 +1698,7 @@ void __init at32_clock_init(void)
 	genclk_init_parent(&gclk3);
 	genclk_init_parent(&gclk4);
 	genclk_init_parent(&atmel_lcdfb0_pixclk);
+	genclk_init_parent(&abdac0_sample_clk);
 
 	/*
 	 * Turn on all clocks that have at least one user already, and
diff --git a/arch/avr32/mach-at32ap/extint.c b/arch/avr32/mach-at32ap/extint.c
index 8acd010..f5bfd4c 100644
--- a/arch/avr32/mach-at32ap/extint.c
+++ b/arch/avr32/mach-at32ap/extint.c
@@ -142,7 +142,7 @@ static int eic_set_irq_type(unsigned int irq, unsigned int flow_type)
 	return ret;
 }
 
-struct irq_chip eic_chip = {
+static struct irq_chip eic_chip = {
 	.name		= "eic",
 	.ack		= eic_ack_irq,
 	.mask		= eic_mask_irq,
diff --git a/arch/avr32/mach-at32ap/pm.h b/arch/avr32/mach-at32ap/pm.h
index 47efd0d..694d521 100644
--- a/arch/avr32/mach-at32ap/pm.h
+++ b/arch/avr32/mach-at32ap/pm.h
@@ -113,8 +113,8 @@
 
 /* Register access macros */
 #define pm_readl(reg)							\
-	__raw_readl((void __iomem *)AT32_PM_BASE + PM_##reg)
+	__raw_readl((void __iomem __force *)AT32_PM_BASE + PM_##reg)
 #define pm_writel(reg,value)						\
-	__raw_writel((value), (void __iomem *)AT32_PM_BASE + PM_##reg)
+	__raw_writel((value), (void __iomem __force *)AT32_PM_BASE + PM_##reg)
 
 #endif /* __ARCH_AVR32_MACH_AT32AP_PM_H__ */
diff --git a/arch/avr32/mach-at32ap/time-tc.c b/arch/avr32/mach-at32ap/time-tc.c
index e3070bd..1026586 100644
--- a/arch/avr32/mach-at32ap/time-tc.c
+++ b/arch/avr32/mach-at32ap/time-tc.c
@@ -79,7 +79,7 @@ static int avr32_timer_calc_div_and_set_jiffies(struct clk *pclk)
 {
 	unsigned int cycles_max = (clocksource_avr32.mask + 1) / 2;
 	unsigned int divs[] = { 4, 8, 16, 32 };
-	int divs_size = sizeof(divs) / sizeof(*divs);
+	int divs_size = ARRAY_SIZE(divs);
 	int i = 0;
 	unsigned long count_hz;
 	unsigned long shift;
diff --git a/include/asm-avr32/arch-at32ap/board.h b/include/asm-avr32/arch-at32ap/board.h
index 7dbd603..d6993a6 100644
--- a/include/asm-avr32/arch-at32ap/board.h
+++ b/include/asm-avr32/arch-at32ap/board.h
@@ -44,6 +44,13 @@ struct usba_platform_data {
 struct platform_device *
 at32_add_device_usba(unsigned int id, struct usba_platform_data *data);
 
+struct ide_platform_data {
+	u8      cs;
+};
+struct platform_device *
+at32_add_device_ide(unsigned int id, unsigned int extint,
+		    struct ide_platform_data *data);
+
 /* depending on what's hooked up, not all SSC pins will be used */
 #define	ATMEL_SSC_TK		0x01
 #define	ATMEL_SSC_TF		0x02
@@ -58,4 +65,20 @@ at32_add_device_usba(unsigned int id, struct usba_platform_data *data);
 struct platform_device *
 at32_add_device_ssc(unsigned int id, unsigned int flags);
 
+struct platform_device *at32_add_device_twi(unsigned int id);
+struct platform_device *at32_add_device_mci(unsigned int id);
+struct platform_device *at32_add_device_ac97c(unsigned int id);
+struct platform_device *at32_add_device_abdac(unsigned int id);
+
+struct cf_platform_data {
+	int	detect_pin;
+	int	reset_pin;
+	int	vcc_pin;
+	int	ready_pin;
+	u8	cs;
+};
+struct platform_device *
+at32_add_device_cf(unsigned int id, unsigned int extint,
+		struct cf_platform_data *data);
+
 #endif /* __ASM_ARCH_BOARD_H */

^ permalink raw reply related	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2022-08-09 17:30 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-08 13:38 [GIT PULL] Frederic Weisbecker
2018-05-08 13:38 ` [PATCH 01/11] ia64: Convert local_softirq_pending() to per-cpu ops Frederic Weisbecker
2018-05-14 12:47   ` [tip:irq/core] softirq/ia64: " tip-bot for Frederic Weisbecker
2018-05-08 13:38 ` [PATCH 02/11] sparc: Convert local_softirq_pending() to use per-cpu op Frederic Weisbecker
2018-05-14 12:47   ` [tip:irq/core] softirq/sparc: " tip-bot for Frederic Weisbecker
2018-05-08 13:38 ` [PATCH 03/11] sh: Use nmi_count() on /proc/interrupts print out Frederic Weisbecker
2018-05-14 12:48   ` [tip:irq/core] softirq/sh: " tip-bot for Frederic Weisbecker
2018-05-08 13:38 ` [PATCH 04/11] softirq: Turn default irq_cpustat_t to standard per-cpu Frederic Weisbecker
2018-05-14 12:48   ` [tip:irq/core] softirq/core: " tip-bot for Frederic Weisbecker
2018-05-08 13:38 ` [PATCH 05/11] softirq: Consolidate default local_softirq_pending() implementations Frederic Weisbecker
2018-05-14 12:49   ` [tip:irq/core] softirq/core: " tip-bot for Frederic Weisbecker
2018-05-08 13:38 ` [PATCH 06/11] ia64: Switch to generic local_softirq_pending() implementation Frederic Weisbecker
2018-05-14 12:49   ` [tip:irq/core] softirq/ia64: " tip-bot for Frederic Weisbecker
2018-05-08 13:38 ` [PATCH 07/11] parisc: " Frederic Weisbecker
2018-05-14 12:50   ` [tip:irq/core] softirq/parisc: " tip-bot for Frederic Weisbecker
2018-05-08 13:38 ` [PATCH 08/11] powerpc: " Frederic Weisbecker
2018-05-14 12:50   ` [tip:irq/core] softirq/powerpc: " tip-bot for Frederic Weisbecker
2018-05-08 13:38 ` [PATCH 09/11] sparc: " Frederic Weisbecker
2018-05-14 12:51   ` [tip:irq/core] softirq/sparc: " tip-bot for Frederic Weisbecker
2018-05-08 13:38 ` [PATCH 10/11] x86: " Frederic Weisbecker
2018-05-14 12:51   ` [tip:irq/core] softirq/x86: " tip-bot for Frederic Weisbecker
2018-05-08 13:38 ` [PATCH 11/11] softirq/s390: Move default mutators of overwritten softirq mask to s390 Frederic Weisbecker
2018-05-14 12:52   ` [tip:irq/core] " tip-bot for Frederic Weisbecker
2018-05-08 13:46 ` [GIT PULL] softirq: Consolidate and optimize softirq mask v4 Frederic Weisbecker
  -- strict thread matches above, loose matches on Subject: below --
2022-08-09 13:27 [GIT PULL] David Howells
2022-08-09 17:29 ` pr-tracker-bot
2022-06-03 19:20 Eric W. Biederman
2022-06-03 23:25 ` pr-tracker-bot
2021-12-23 19:55 Eric W. Biederman
2016-04-12 18:34 David Howells
2012-03-13  4:56 [git pull] Jesse Barnes
2011-02-11 13:40 [GIT PULL] Ted Ts'o
2011-02-12  0:33 ` Linus Torvalds
2011-02-12  1:41   ` Eric Sandeen
2011-02-12 13:28   ` Ted Ts'o
2010-09-10 12:52 Nicolas Ferre
2010-09-10 13:16 ` Jean-Christophe PLAGNIOL-VILLARD
2010-03-03  3:09 Frederic Weisbecker
2007-10-23  9:43 Haavard Skinnemoen

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).