Thread (44 messages) 44 messages, 2 authors, 2021-01-15

Re: [PATCH v5 17/21] powerpc/64: entry cpu time accounting in C

From: Nicholas Piggin <npiggin@gmail.com>
Date: 2021-01-14 04:00:39

Excerpts from Christophe Leroy's message of January 14, 2021 1:05 am:

Le 13/01/2021 à 08:32, Nicholas Piggin a écrit :
quoted
There is no need for this to be in asm, use the new intrrupt entry wrapper.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
  arch/powerpc/include/asm/interrupt.h |  7 +++++++
  arch/powerpc/include/asm/ppc_asm.h   | 24 ------------------------
  arch/powerpc/kernel/exceptions-64e.S |  1 -
  arch/powerpc/kernel/exceptions-64s.S |  5 -----
  4 files changed, 7 insertions(+), 30 deletions(-)
diff --git a/arch/powerpc/include/asm/interrupt.h b/arch/powerpc/include/asm/interrupt.h
index 6eba7c489753..e278dffe7657 100644
--- a/arch/powerpc/include/asm/interrupt.h
+++ b/arch/powerpc/include/asm/interrupt.h
@@ -4,6 +4,7 @@
  
  #include <linux/context_tracking.h>
  #include <linux/hardirq.h>
+#include <asm/cputime.h>
  #include <asm/ftrace.h>
  
  struct interrupt_state {
@@ -25,6 +26,9 @@ static inline void interrupt_enter_prepare(struct pt_regs *regs, struct interrup
  	if (user_mode(regs)) {
  		CT_WARN_ON(ct_state() != CONTEXT_USER);
  		user_exit_irqoff();
+
+		account_cpu_user_entry();
Are interrupts still disabled here ? Otherwise you risk getting IRQ time accounted on user.
Yes. Only the handlers themselves will enable interrupts, with
interrupt_cond_local_irq_enable.
quoted
+		account_stolen_time();
  	} else {
  		/*
  		 * CT_WARN_ON comes here via program_check_exception,
@@ -38,6 +42,9 @@ static inline void interrupt_enter_prepare(struct pt_regs *regs, struct interrup
  #ifdef CONFIG_PPC_BOOK3E_64
  	state->ctx_state = exception_enter();
  #endif
+
+	if (!IS_ENABLED(CONFIG_PPC_BOOK3S_64) && user_mode(regs))
+		account_cpu_user_entry();
Isn't this interrupt_enter_prepare() function called also on PPC32 ?
Have you removed the ACCOUNT_CPU_USER_ENTRY() from entry_32.S ?
Yes and no, I was thinking of 64 only :( I can make that for 64E. 32-bit
could be another patch if you want it.

Thanks,
Nick
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help