Skip to content

Commit 56acfdd

Browse files
npigginmpe
authored andcommitted
powerpc/64: entry cpu time accounting in C
There is no need for this to be in asm, use the new interrupt entry wrapper. Signed-off-by: Nicholas Piggin <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 2994e1b commit 56acfdd

File tree

4 files changed

+6
-30
lines changed

4 files changed

+6
-30
lines changed

arch/powerpc/include/asm/interrupt.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include <linux/context_tracking.h>
66
#include <linux/hardirq.h>
7+
#include <asm/cputime.h>
78
#include <asm/ftrace.h>
89

910
struct interrupt_state {
@@ -25,6 +26,9 @@ static inline void interrupt_enter_prepare(struct pt_regs *regs, struct interrup
2526
if (user_mode(regs)) {
2627
CT_WARN_ON(ct_state() != CONTEXT_USER);
2728
user_exit_irqoff();
29+
30+
account_cpu_user_entry();
31+
account_stolen_time();
2832
} else {
2933
/*
3034
* CT_WARN_ON comes here via program_check_exception,
@@ -37,6 +41,8 @@ static inline void interrupt_enter_prepare(struct pt_regs *regs, struct interrup
3741

3842
#ifdef CONFIG_PPC_BOOK3E_64
3943
state->ctx_state = exception_enter();
44+
if (user_mode(regs))
45+
account_cpu_user_entry();
4046
#endif
4147
}
4248

arch/powerpc/include/asm/ppc_asm.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
2626
#define ACCOUNT_CPU_USER_ENTRY(ptr, ra, rb)
2727
#define ACCOUNT_CPU_USER_EXIT(ptr, ra, rb)
28-
#define ACCOUNT_STOLEN_TIME
2928
#else
3029
#define ACCOUNT_CPU_USER_ENTRY(ptr, ra, rb) \
3130
MFTB(ra); /* get timebase */ \
@@ -44,29 +43,6 @@
4443
PPC_LL ra, ACCOUNT_SYSTEM_TIME(ptr); \
4544
add ra,ra,rb; /* add on to system time */ \
4645
PPC_STL ra, ACCOUNT_SYSTEM_TIME(ptr)
47-
48-
#ifdef CONFIG_PPC_SPLPAR
49-
#define ACCOUNT_STOLEN_TIME \
50-
BEGIN_FW_FTR_SECTION; \
51-
beq 33f; \
52-
/* from user - see if there are any DTL entries to process */ \
53-
ld r10,PACALPPACAPTR(r13); /* get ptr to VPA */ \
54-
ld r11,PACA_DTL_RIDX(r13); /* get log read index */ \
55-
addi r10,r10,LPPACA_DTLIDX; \
56-
LDX_BE r10,0,r10; /* get log write index */ \
57-
cmpd cr1,r11,r10; \
58-
beq+ cr1,33f; \
59-
bl accumulate_stolen_time; \
60-
ld r12,_MSR(r1); \
61-
andi. r10,r12,MSR_PR; /* Restore cr0 (coming from user) */ \
62-
33: \
63-
END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR)
64-
65-
#else /* CONFIG_PPC_SPLPAR */
66-
#define ACCOUNT_STOLEN_TIME
67-
68-
#endif /* CONFIG_PPC_SPLPAR */
69-
7046
#endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
7147

7248
/*

arch/powerpc/kernel/exceptions-64e.S

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,6 @@ exc_##n##_common: \
398398
std r10,_NIP(r1); /* save SRR0 to stackframe */ \
399399
std r11,_MSR(r1); /* save SRR1 to stackframe */ \
400400
beq 2f; /* if from kernel mode */ \
401-
ACCOUNT_CPU_USER_ENTRY(r13,r10,r11);/* accounting (uses cr0+eq) */ \
402401
2: ld r3,excf+EX_R10(r13); /* get back r10 */ \
403402
ld r4,excf+EX_R11(r13); /* get back r11 */ \
404403
mfspr r5,scratch; /* get back r13 */ \

arch/powerpc/kernel/exceptions-64s.S

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,6 @@ DEFINE_FIXED_SYMBOL(\name\()_common_real)
577577
kuap_save_amr_and_lock r9, r10, cr1, cr0
578578
.endif
579579
beq 101f /* if from kernel mode */
580-
ACCOUNT_CPU_USER_ENTRY(r13, r9, r10)
581580
BEGIN_FTR_SECTION
582581
ld r9,IAREA+EX_PPR(r13) /* Read PPR from paca */
583582
std r9,_PPR(r1)
@@ -645,10 +644,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
645644
ld r11,exception_marker@toc(r2)
646645
std r10,RESULT(r1) /* clear regs->result */
647646
std r11,STACK_FRAME_OVERHEAD-16(r1) /* mark the frame */
648-
649-
.if ISTACK
650-
ACCOUNT_STOLEN_TIME
651-
.endif
652647
.endm
653648

654649
/*

0 commit comments

Comments
 (0)