linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] powerpc/32: nohz full support
@ 2023-01-21  9:58 Nicholas Piggin
  2023-01-21  9:58 ` [PATCH v2 1/3] powerpc: Consolidate 32-bit and 64-bit interrupt_enter_prepare Nicholas Piggin
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Nicholas Piggin @ 2023-01-21  9:58 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin

I'd like to try get this series merged. If Christophe isn't comfortable 
with patch 2/3 yet then maybe we could at least get the first one in
which shares more code and makes it tidier.

Since v1 I just split the first patch out so it's not introducing a
significant functional change.

Thanks,
Nick

Nicholas Piggin (3):
  powerpc: Consolidate 32-bit and 64-bit interrupt_enter_prepare
  powerpc/32: implement HAVE_CONTEXT_TRACKING_USER support
  powerpc/32: select HAVE_VIRT_CPU_ACCOUNTING_GEN

 arch/powerpc/Kconfig                 |  3 ++-
 arch/powerpc/include/asm/interrupt.h | 35 +++++++---------------------
 2 files changed, 10 insertions(+), 28 deletions(-)

-- 
2.37.2


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

* [PATCH v2 1/3] powerpc: Consolidate 32-bit and 64-bit interrupt_enter_prepare
  2023-01-21  9:58 [PATCH v2 0/3] powerpc/32: nohz full support Nicholas Piggin
@ 2023-01-21  9:58 ` Nicholas Piggin
  2023-01-21  9:58 ` [PATCH v2 2/3] powerpc/32: implement HAVE_CONTEXT_TRACKING_USER support Nicholas Piggin
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Nicholas Piggin @ 2023-01-21  9:58 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin

There are two separeate implementations for 32-bit and 64-bit which
mostly do the same thing. Consolidating on one implementation ends
up being smaller and simpler, there is just irq soft-mask reconcile
that is specific to 64-bit.

There should be no real functional change with this patch, but it
does make the context tracking calls necessary for 32-bit to support
context tracking.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/include/asm/interrupt.h | 35 +++++++---------------------
 1 file changed, 8 insertions(+), 27 deletions(-)

diff --git a/arch/powerpc/include/asm/interrupt.h b/arch/powerpc/include/asm/interrupt.h
index 6d8492b6e2b8..a4196ab1d016 100644
--- a/arch/powerpc/include/asm/interrupt.h
+++ b/arch/powerpc/include/asm/interrupt.h
@@ -74,17 +74,18 @@
 #include <asm/kprobes.h>
 #include <asm/runlatch.h>
 
-#ifdef CONFIG_PPC64
+#ifdef CONFIG_PPC_IRQ_SOFT_MASK_DEBUG
 /*
  * WARN/BUG is handled with a program interrupt so minimise checks here to
  * avoid recursion and maximise the chance of getting the first oops handled.
  */
 #define INT_SOFT_MASK_BUG_ON(regs, cond)				\
 do {									\
-	if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG) &&		\
-	    (user_mode(regs) || (TRAP(regs) != INTERRUPT_PROGRAM)))	\
+	if ((user_mode(regs) || (TRAP(regs) != INTERRUPT_PROGRAM)))	\
 		BUG_ON(cond);						\
 } while (0)
+#else
+#define INT_SOFT_MASK_BUG_ON(regs, cond)
 #endif
 
 #ifdef CONFIG_PPC_BOOK3S_64
@@ -151,28 +152,8 @@ static inline void booke_restore_dbcr0(void)
 
 static inline void interrupt_enter_prepare(struct pt_regs *regs)
 {
-#ifdef CONFIG_PPC32
-	if (!arch_irq_disabled_regs(regs))
-		trace_hardirqs_off();
-
-	if (user_mode(regs))
-		kuap_lock();
-	else
-		kuap_save_and_lock(regs);
-
-	if (user_mode(regs))
-		account_cpu_user_entry();
-#endif
-
 #ifdef CONFIG_PPC64
-	bool trace_enable = false;
-
-	if (IS_ENABLED(CONFIG_TRACE_IRQFLAGS)) {
-		if (irq_soft_mask_set_return(IRQS_ALL_DISABLED) == IRQS_ENABLED)
-			trace_enable = true;
-	} else {
-		irq_soft_mask_set(IRQS_ALL_DISABLED);
-	}
+	irq_soft_mask_set(IRQS_ALL_DISABLED);
 
 	/*
 	 * If the interrupt was taken with HARD_DIS clear, then enable MSR[EE].
@@ -188,9 +169,10 @@ static inline void interrupt_enter_prepare(struct pt_regs *regs)
 	} else {
 		__hard_RI_enable();
 	}
+	/* Enable MSR[RI] early, to support kernel SLB and hash faults */
+#endif
 
-	/* Do this when RI=1 because it can cause SLB faults */
-	if (trace_enable)
+	if (!arch_irq_disabled_regs(regs))
 		trace_hardirqs_off();
 
 	if (user_mode(regs)) {
@@ -215,7 +197,6 @@ static inline void interrupt_enter_prepare(struct pt_regs *regs)
 	}
 	INT_SOFT_MASK_BUG_ON(regs, !arch_irq_disabled_regs(regs) &&
 				   !(regs->msr & MSR_EE));
-#endif
 
 	booke_restore_dbcr0();
 }
-- 
2.37.2


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

* [PATCH v2 2/3] powerpc/32: implement HAVE_CONTEXT_TRACKING_USER support
  2023-01-21  9:58 [PATCH v2 0/3] powerpc/32: nohz full support Nicholas Piggin
  2023-01-21  9:58 ` [PATCH v2 1/3] powerpc: Consolidate 32-bit and 64-bit interrupt_enter_prepare Nicholas Piggin
@ 2023-01-21  9:58 ` Nicholas Piggin
  2023-01-21  9:58 ` [PATCH v2 3/3] powerpc/32: select HAVE_VIRT_CPU_ACCOUNTING_GEN Nicholas Piggin
  2023-02-15 12:40 ` [PATCH v2 0/3] powerpc/32: nohz full support Michael Ellerman
  3 siblings, 0 replies; 5+ messages in thread
From: Nicholas Piggin @ 2023-01-21  9:58 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin

Context tracking involves tracking user, kernel, guest switches. 32-bit
shares interrupt and syscall entry and exit code (and context tracking
calls) with 64-bit, and KVM can not be selected if CONTEXT_TRACKING_USER
is enabled, so context tracking can be enabled for 32-bit.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index b8c4ac56bddc..7683788af8cb 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -207,7 +207,7 @@ config PPC
 	select HAVE_ARCH_SECCOMP_FILTER
 	select HAVE_ARCH_TRACEHOOK
 	select HAVE_ASM_MODVERSIONS
-	select HAVE_CONTEXT_TRACKING_USER		if PPC64
+	select HAVE_CONTEXT_TRACKING_USER
 	select HAVE_C_RECORDMCOUNT
 	select HAVE_DEBUG_KMEMLEAK
 	select HAVE_DEBUG_STACKOVERFLOW
-- 
2.37.2


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

* [PATCH v2 3/3] powerpc/32: select HAVE_VIRT_CPU_ACCOUNTING_GEN
  2023-01-21  9:58 [PATCH v2 0/3] powerpc/32: nohz full support Nicholas Piggin
  2023-01-21  9:58 ` [PATCH v2 1/3] powerpc: Consolidate 32-bit and 64-bit interrupt_enter_prepare Nicholas Piggin
  2023-01-21  9:58 ` [PATCH v2 2/3] powerpc/32: implement HAVE_CONTEXT_TRACKING_USER support Nicholas Piggin
@ 2023-01-21  9:58 ` Nicholas Piggin
  2023-02-15 12:40 ` [PATCH v2 0/3] powerpc/32: nohz full support Michael Ellerman
  3 siblings, 0 replies; 5+ messages in thread
From: Nicholas Piggin @ 2023-01-21  9:58 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin

cputime_t is no longer a type, so VIRT_CPU_ACCOUNTING_GEN does not
have any affect on the type for 32-bit architectures, so there is
no reason it can't be supported.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 7683788af8cb..51ec10e951f7 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -257,6 +257,7 @@ config PPC
 	select HAVE_STATIC_CALL			if PPC32
 	select HAVE_SYSCALL_TRACEPOINTS
 	select HAVE_VIRT_CPU_ACCOUNTING
+	select HAVE_VIRT_CPU_ACCOUNTING_GEN
 	select HUGETLB_PAGE_SIZE_VARIABLE	if PPC_BOOK3S_64 && HUGETLB_PAGE
 	select IOMMU_HELPER			if PPC64
 	select IRQ_DOMAIN
-- 
2.37.2


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

* Re: [PATCH v2 0/3] powerpc/32: nohz full support
  2023-01-21  9:58 [PATCH v2 0/3] powerpc/32: nohz full support Nicholas Piggin
                   ` (2 preceding siblings ...)
  2023-01-21  9:58 ` [PATCH v2 3/3] powerpc/32: select HAVE_VIRT_CPU_ACCOUNTING_GEN Nicholas Piggin
@ 2023-02-15 12:40 ` Michael Ellerman
  3 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2023-02-15 12:40 UTC (permalink / raw)
  To: linuxppc-dev, Nicholas Piggin

On Sat, 21 Jan 2023 19:58:02 +1000, Nicholas Piggin wrote:
> I'd like to try get this series merged. If Christophe isn't comfortable
> with patch 2/3 yet then maybe we could at least get the first one in
> which shares more code and makes it tidier.
> 
> Since v1 I just split the first patch out so it's not introducing a
> significant functional change.
> 
> [...]

Applied to powerpc/next.

[1/3] powerpc: Consolidate 32-bit and 64-bit interrupt_enter_prepare
      https://git.kernel.org/powerpc/c/fb3b72a3f483f81a33a9693ed03dc62158a6f77e
[2/3] powerpc/32: implement HAVE_CONTEXT_TRACKING_USER support
      https://git.kernel.org/powerpc/c/5c4b710a8157ec271fac4806562ee1aa1b44a53d
[3/3] powerpc/32: select HAVE_VIRT_CPU_ACCOUNTING_GEN
      https://git.kernel.org/powerpc/c/01f135506e2ed0403512c2467bd50746bdbd576d

cheers

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

end of thread, other threads:[~2023-02-15 12:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-21  9:58 [PATCH v2 0/3] powerpc/32: nohz full support Nicholas Piggin
2023-01-21  9:58 ` [PATCH v2 1/3] powerpc: Consolidate 32-bit and 64-bit interrupt_enter_prepare Nicholas Piggin
2023-01-21  9:58 ` [PATCH v2 2/3] powerpc/32: implement HAVE_CONTEXT_TRACKING_USER support Nicholas Piggin
2023-01-21  9:58 ` [PATCH v2 3/3] powerpc/32: select HAVE_VIRT_CPU_ACCOUNTING_GEN Nicholas Piggin
2023-02-15 12:40 ` [PATCH v2 0/3] powerpc/32: nohz full support Michael Ellerman

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