powerpc: "paca->soft_enabled" based local atomic operation implementation
Subsystems (2)
v3 cover powerpc: "paca->soft_enabled" based local atomic operation implementation
Local atomic operations are fast and highly reentrant per CPU counters. Used for percpu variable updates. Local atomic operations only guarantee variable modification atomicity wrt the CPU which owns the data and these needs to be executed in a preemption safe way.
Here is the design of the patchset. Since local_* operations
are only need to be atomic to interrupts (IIUC), we have two options. Either replay the "op" if interrupted or replay the interrupt after the "op". Initial patchset posted was based on implementing local_* operation based on CR5 which replay's the "op". Patchset had issues in case of rewinding the address pointor from an array. This make the slow patch really slow. Since CR5 based implementation proposed using __ex_table to find the rewind address, this rasied concerns about size of __ex_table and vmlinux.
https://lists.ozlabs.org/pipermail/linuxppc-dev/2014-December/123115.html
But this patchset uses Benjamin Herrenschmidt suggestion of using arch_local_irq_disable() to soft_disable interrupts (including PMIs). After finishing the "op", arch_local_irq_restore() called and correspondingly interrupts are replayed if any occured.
Current paca->soft_enabled logic is reserved and MASKABLE_EXCEPTION_* macros are extended to support this feature.
patch re-write the current local_* functions to use arch_local_irq_disbale. Base flow for each function is
{
soft_irq_set_mask()
load
..
store
arch_local_irq_restore()}
Reason for the approach is that, currently l[w/d]arx/st[w/d]cx. instruction pair is used for local_* operations, which are heavy on cycle count and they dont support a local variant. So to see whether the new implementation helps, used a modified version of Rusty's benchmark code on local_t.
https://lkml.org/lkml/2008/12/16/450
Modifications to Rusty's benchmark code:
- Executed only local_t test
Here are the values with the patch.
Time in ns per iteration
Local_t Without Patch With Patch
_inc 28 8 _add 28 8 _read 3 3 _add_return 28 7
Currently only asm/local.h has been rewrite, and also the entire change is tested only in PPC64 (pseries guest) and PPC64 LE host.
First four are the clean up patches which lays the foundation
to make things easier. Fifth patch in the patchset reverse the
current soft_enabled logic and commit message details the reason and
need for this change. Sixth and seventh patch refactor's the __EXPECTION_PROLOG_1 code to support addition of a new parameter to MASKABLE_* macros. New parameter will give the possible mask for the interrupt. Rest of the patches are
to add support for maskable PMI and implementation of local_t using arch_local_irq_*().
Since the patchset is experimental, changes made are focused on pseries and powernv platforms only. Would really like to know comments for this approach before extending to other powerpc platforms.
Changelog RFC v2:
1)Renamed IRQ_DISABLE_LEVEL_* to IRQ_DISABLE_MASK_* and made logic changes
to treat soft_enabled as a mask and not a flag or level.
2)Added a new Kconfig variable to support a WARN_ON 3)Refactored patchset for eaiser review.
4)Made changes to commit messages.
5)Made changes for BOOK3E version
Changelog RFC v1:
1)Commit messages are improved.
2)Renamed the arch_local_irq_disable_var to soft_irq_set_level as suggested 3)Renamed the LAZY_INTERRUPT* macro to IRQ_DISABLE_LEVEL_* as suggested 4)Extended the MASKABLE_EXCEPTION* macros to support additional parameter. 5)Each MASKABLE_EXCEPTION_* macro will carry a "mask_level" 6)Logic to decide on jump to maskable_handler in SOFTEN_TEST is now based on
"mask_level"
7)__EXCEPTION_PROLOG_1 is factored out to support "mask_level" parameter.
This reduced the code changes needed for supporting "mask_level" parameters.
Madhavan Srinivasan (12):
powerpc: Add #defs for paca->soft_enabled flags
powerpc: Cleanup to use IRQ_DISABLE_MASK_* macros for
paca->soft_enabled update
powerpc: move set_soft_enabled()
powerpc: Use set_soft_enabled api to update paca->soft_enabled
powerpc: reverse the soft_enable logic
powerpc: Avoid using EXCEPTION_PROLOG_1 macro in MASKABLE_*
powerpc: Add new _EXCEPTION_PROLOG_1 macro
powerpc: Introduce new mask bit for soft_enabled
powerpc: Add "bitmask" paramater to MASKABLE_* macros
powerpc: Add support to mask perf interrupts
powerpc: Support to replay PMIs
powerpc: rewrite local_t using soft_irq
arch/powerpc/Kconfig | 4 ++ arch/powerpc/include/asm/exception-64s.h | 103 +++++++++++++++++++++---------- arch/powerpc/include/asm/hw_irq.h | 46 +++++++++++--- arch/powerpc/include/asm/irqflags.h | 8 +-- arch/powerpc/include/asm/kvm_ppc.h | 2 +- arch/powerpc/include/asm/local.h | 91 ++++++++++++++++++--------- arch/powerpc/kernel/entry_64.S | 24 ++++--- arch/powerpc/kernel/exceptions-64e.S | 8 +-- arch/powerpc/kernel/exceptions-64s.S | 42 ++++++++----- arch/powerpc/kernel/head_64.S | 5 +- arch/powerpc/kernel/idle_book3e.S | 2 +- arch/powerpc/kernel/idle_power4.S | 3 +- arch/powerpc/kernel/irq.c | 27 ++++---- arch/powerpc/kernel/process.c | 3 +- arch/powerpc/kernel/setup_64.c | 5 +- arch/powerpc/kernel/time.c | 4 +- arch/powerpc/mm/hugetlbpage.c | 2 +- arch/powerpc/perf/core-book3s.c | 2 +- 18 files changed, 256 insertions(+), 125 deletions(-)
Signature · 1 line
2.7.4
RFC PATCH v3 2/12 powerpc: Cleanup to use IRQ_DISABLE_MASK_* macros for paca->soft_enabled update
Replace the hardcoded values used when updatingpaca->soft_enabled with IRQ_DISABLE_MASK_* #def.
No logic change.
--- arch/powerpc/include/asm/exception-64s.h | 2 +- arch/powerpc/include/asm/hw_irq.h | 15 ++++++++------- arch/powerpc/include/asm/irqflags.h | 6 +++--- arch/powerpc/include/asm/kvm_ppc.h | 2 +- arch/powerpc/kernel/entry_64.S | 16 ++++++++-------- arch/powerpc/kernel/exceptions-64e.S | 6 +++--- arch/powerpc/kernel/head_64.S | 5 +++-- arch/powerpc/kernel/idle_book3e.S | 2 +- arch/powerpc/kernel/idle_power4.S | 3 ++- arch/powerpc/kernel/irq.c | 9 +++++---- arch/powerpc/kernel/process.c | 3 ++- arch/powerpc/kernel/setup_64.c | 3 +++ arch/powerpc/kernel/time.c | 2 +- arch/powerpc/mm/hugetlbpage.c | 2 +- arch/powerpc/perf/core-book3s.c | 2 +- 15 files changed, 43 insertions(+), 35 deletions(-)
arch/powerpc/include/asm/exception-64s.h +1 -1
@@ -408,7 +408,7 @@ label##_relon_hv: \#define __SOFTEN_TEST (h, vec) \ lbz r10,PACASOFTIRQEN(r13); \ - cmpwi r10,0; \ + cmpwi r10,IRQ_DISABLE_MASK_LINUX; \ li r10,SOFTEN_VALUE_##vec; \ beq masked_##h##interrupt#define _SOFTEN_TEST (h, vec) __SOFTEN_TEST(h, vec)
arch/powerpc/include/asm/hw_irq.h +8 -7
@@ -64,9 +64,10 @@ static inline unsigned long arch_local_irq_disable(void)unsigned long flags, zero; asmvolatile ( -"li %1,0; lbz %0,%2(13); stb %1,%2(13)" +"li %1,%3; lbz %0,%2(13); stb %1,%2(13)" :"=r" (flags),"=&r" (zero) - :"i" (offsetof(struct paca_struct , soft_enabled)) + :"i" (offsetof(struct paca_struct , soft_enabled)),\ +"i" (IRQ_DISABLE_MASK_LINUX ) :"memory" );return flags;
@@ -76,7 +77,7 @@ extern void arch_local_irq_restore(unsigned long);static inline void arch_local_irq_enable (void ) { -arch_local_irq_restore (1 ); +arch_local_irq_restore (IRQ_DISABLE_MASK_NONE ); }static inline unsigned long arch_local_irq_save (void )
@@ -86,7 +87,7 @@ static inline unsigned long arch_local_irq_save(void)static inline bool arch_irqs_disabled_flags (unsigned long flags) { -return flags ==0 ; +return flags ==IRQ_DISABLE_MASK_LINUX ; }static inline bool arch_irqs_disabled (void )
@@ -106,9 +107,9 @@ static inline bool arch_irqs_disabled(void)u8 _was_enabled; \__hard_irq_disable (); \ _was_enabled = local_paca->soft_enabled; \ - local_paca->soft_enabled =0 ; \ + local_paca->soft_enabled =IRQ_DISABLE_MASK_LINUX ;\ local_paca->irq_happened |=PACA_IRQ_HARD_DIS ; \ -if (_was_enabled) \ +if (_was_enabled ==IRQ_DISABLE_MASK_NONE ) \trace_hardirqs_off (); \ }while (0 )
@@ -131,7 +132,7 @@ static inline void may_hard_irq_enable(void)static inline bool arch_irq_disabled_regs (struct pt_regs *regs) { -return !regs->softe; +return (regs->softe ==IRQ_DISABLE_MASK_LINUX ); }extern bool prep_irq_for_idle (void );
arch/powerpc/include/asm/irqflags.h +3 -3
@@ -48,8 +48,8 @@#define RECONCILE_IRQ_STATE (__rA, __rB) \ lbz __rA,PACASOFTIRQEN(r13); \ lbz __rB,PACAIRQHAPPENED(r13); \ - cmpwi cr0,__rA,0; \ - li __rA,0; \ + cmpwi cr0,__rA,IRQ_DISABLE_MASK_LINUX;\ + li __rA,IRQ_DISABLE_MASK_LINUX; \ ori __rB,__rB,PACA_IRQ_HARD_DIS; \ stb __rB,PACAIRQHAPPENED(r13); \ beq 44f; \
@@ -63,7 +63,7 @@#define RECONCILE_IRQ_STATE (__rA, __rB) \ lbz __rA,PACAIRQHAPPENED(r13); \ - li __rB,0; \ + li __rB,IRQ_DISABLE_MASK_LINUX; \ ori __rA,__rA,PACA_IRQ_HARD_DIS; \ stb __rB,PACASOFTIRQEN(r13); \ stb __rA,PACAIRQHAPPENED(r13)
arch/powerpc/include/asm/kvm_ppc.h +1 -1
@@ -707,7 +707,7 @@ static inline void kvmppc_fix_ee_before_entry(void)/* Only need to enable IRQs by hard enabling them after this */ local_paca->irq_happened =0 ; - local_paca->soft_enabled =1 ; + local_paca->soft_enabled =IRQ_DISABLE_MASK_NONE ;#endif }
arch/powerpc/kernel/entry_64.S +8 -8
@@ -131,7 +131,7 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR) */ #if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_BUG) lbz r10,PACASOFTIRQEN(r13) - xori r10,r10,1 + xori r10,r10,IRQ_DISABLE_MASK_NONE 1: tdnei r10,0 EMIT_BUG_ENTRY 1b,__FILE__,__LINE__,BUGFLAG_WARNING #endif
@@ -147,7 +147,7 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR) /* We do need to set SOFTE in the stack frame or the return * from interrupt will be painful */ - li r10,1 + li r10,IRQ_DISABLE_MASK_NONE std r10,SOFTE(r1) CURRENT_THREAD_INFO(r11, r1)
@@ -725,7 +725,7 @@ resume_kernel: lwz r8,TI_PREEMPT(r9) cmpwi cr1,r8,0 ld r0,SOFTE(r1) - cmpdi r0,0 + cmpdi r0,IRQ_DISABLE_MASK_LINUX crandc eq,cr1*4+eq,eq bne restore
@@ -765,11 +765,11 @@ restore: */ ld r5,SOFTE(r1) lbz r6,PACASOFTIRQEN(r13) - cmpwi cr0,r5,0 + cmpwi cr0,r5,IRQ_DISABLE_MASK_LINUX beq restore_irq_off /* We are enabling, were we already enabled ? Yes, just return */ - cmpwi cr0,r6,1 + cmpwi cr0,r6,IRQ_DISABLE_MASK_NONE beq cr0,do_restore /*
@@ -788,7 +788,7 @@ restore: */ restore_no_replay: TRACE_ENABLE_INTS - li r0,1 + li r0,IRQ_DISABLE_MASK_NONE stb r0,PACASOFTIRQEN(r13); /*
@@ -894,7 +894,7 @@ restore_irq_off: beq 1f rlwinm r7,r7,0,~PACA_IRQ_HARD_DIS stb r7,PACAIRQHAPPENED(r13) -1: li r0,0 +1: li r0,IRQ_DISABLE_MASK_LINUX stb r0,PACASOFTIRQEN(r13); TRACE_DISABLE_INTS b do_restore
@@ -1012,7 +1012,7 @@ _GLOBAL(enter_rtas) * check it with the asm equivalent of WARN_ON */ lbz r0,PACASOFTIRQEN(r13) -1: tdnei r0,0 +1: tdnei r0,IRQ_DISABLE_MASK_LINUX EMIT_BUG_ENTRY 1b,__FILE__,__LINE__,BUGFLAG_WARNING #endif
arch/powerpc/kernel/exceptions-64e.S +3 -3
@@ -210,9 +210,9 @@ END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV) ld r5,SOFTE(r1) /* Interrupts had better not already be enabled... */ - twnei r6,0 + twnei r6,IRQ_DISABLE_MASK_LINUX - cmpwi cr0,r5,0 + cmpwi cr0,r5,IRQ_DISABLE_MASK_LINUX beq 1f TRACE_ENABLE_INTS
@@ -352,7 +352,7 @@ ret_from_mc_except: #define PROLOG_ADDITION_MASKABLE_GEN(n) \ lbz r10,PACASOFTIRQEN(r13); /* are irqs soft-disabled ? */ \ - cmpwi cr0,r10,0; /* yes -> go out of line */ \ + cmpwi cr0,r10,IRQ_DISABLE_MASK_LINUX;/* yes -> go out of line */ \ beq masked_interrupt_book3e_##n #define PROLOG_ADDITION_2REGS_GEN(n) \
arch/powerpc/kernel/head_64.S +3 -2
@@ -732,7 +732,7 @@ _GLOBAL(pmac_secondary_start) /* Mark interrupts soft and hard disabled (they might be enabled * in the PACA when doing hotplug) */ - li r0,0 + li r0,IRQ_DISABLE_MASK_LINUX stb r0,PACASOFTIRQEN(r13) li r0,PACA_IRQ_HARD_DIS stb r0,PACAIRQHAPPENED(r13)
@@ -789,6 +789,7 @@ __secondary_start: /* Mark interrupts soft and hard disabled (they might be enabled * in the PACA when doing hotplug) */ + li r7,IRQ_DISABLE_MASK_LINUX stb r7,PACASOFTIRQEN(r13) li r0,PACA_IRQ_HARD_DIS stb r0,PACAIRQHAPPENED(r13)
@@ -954,7 +955,7 @@ start_here_common: /* Mark interrupts soft and hard disabled (they might be enabled * in the PACA when doing hotplug) */ - li r0,0 + li r0,IRQ_DISABLE_MASK_LINUX stb r0,PACASOFTIRQEN(r13) li r0,PACA_IRQ_HARD_DIS stb r0,PACAIRQHAPPENED(r13)
arch/powerpc/kernel/idle_book3e.S +1 -1
@@ -46,7 +46,7 @@ _GLOBAL(\name) bl trace_hardirqs_on addi r1,r1,128 #endif - li r0,1 + li r0,IRQ_DISABLE_MASK_NONE stb r0,PACASOFTIRQEN(r13) /* Interrupts will make use return to LR, so get something we want
arch/powerpc/kernel/idle_power4.S +2 -1
@@ -15,6 +15,7 @@ #include <asm/ppc_asm.h> #include <asm/asm-offsets.h> #include <asm/irqflags.h> +#include <asm/hw_irq.h> #undef DEBUG
@@ -53,7 +54,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_CAN_NAP) mfmsr r7 #endif /* CONFIG_TRACE_IRQFLAGS */ - li r0,1 + li r0,IRQ_DISABLE_MASK_NONE stb r0,PACASOFTIRQEN(r13) /* we'll hard-enable shortly */ BEGIN_FTR_SECTION DSSALL
arch/powerpc/kernel/irq.c +5 -4
@@ -67,6 +67,7 @@#include <asm/smp.h> #include <asm/debug.h> #include <asm/livepatch.h> +#include <asm/hw_irq.h> #ifdef CONFIG_PPC64 #include <asm/paca.h>
@@ -208,7 +209,7 @@ notrace void arch_local_irq_restore(unsigned long en)/* Write the new soft-enabled value */ set_soft_enabled (en); -if (!en) +if (en ==IRQ_DISABLE_MASK_LINUX )return ;/* * From this point onward, we can take interrupts, preempt,
@@ -253,7 +254,7 @@ notrace void arch_local_irq_restore(unsigned long en) }#endif /* CONFIG_TRACE_IRQFLAGS */ -set_soft_enabled (0 ); +set_soft_enabled (IRQ_DISABLE_MASK_LINUX );/* * Check if anything needs to be re-emitted. We haven't
@@ -263,7 +264,7 @@ notrace void arch_local_irq_restore(unsigned long en) replay =__check_irq_replay ();/* We can soft-enable now */ -set_soft_enabled (1 ); +set_soft_enabled (IRQ_DISABLE_MASK_NONE );/* * And replay if we have to. This will return with interrupts
@@ -337,7 +338,7 @@ bool prep_irq_for_idle(void)* of entering the low power state. */ local_paca->irq_happened &= ~PACA_IRQ_HARD_DIS ; - local_paca->soft_enabled =1 ; + local_paca->soft_enabled =IRQ_DISABLE_MASK_NONE ;/* Tell the caller to enter the low power state */ return true;
arch/powerpc/kernel/process.c +2 -1
@@ -54,6 +54,7 @@#include <asm/debug.h> #ifdef CONFIG_PPC64 #include <asm/firmware.h> +#include <asm/hw_irq.h> #endif #include <asm/code-patching.h> #include <asm/exec.h>
@@ -1441,7 +1442,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, childregs->gpr[14 ] =ppc_function_entry ((void *)usp);#ifdef CONFIG_PPC64 clear_tsk_thread_flag (p,TIF_32BIT ); - childregs->softe =1 ; + childregs->softe =IRQ_DISABLE_MASK_NONE ;#endif childregs->gpr[15 ] = kthread_arg; p->thread.regs =NULL ;/* no user register state */
arch/powerpc/kernel/setup_64.c +3 -0
@@ -67,6 +67,7 @@#include <asm/livepatch.h> #include <asm/opal.h> #include <asm/cputhreads.h> +#include <asm/hw_irq.h> #ifdef DEBUG #define DBG(fmt...) udbg_printf(fmt)
@@ -195,6 +196,8 @@ static void __init fixup_boot_paca(void)get_paca ()->cpu_start =1 ;/* Allow percpu accesses to work until we setup percpu data */ get_paca ()->data_offset =0 ; +/* Mark interrupts disabled in PACA */ +get_paca ()->soft_enabled =IRQ_DISABLE_MASK_LINUX ; }static void __init configure_exceptions (void )
arch/powerpc/kernel/time.c +1 -1
@@ -268,7 +268,7 @@ void accumulate_stolen_time(void)* needs to reflect that so various debug stuff doesn't * complain */ - local_paca->soft_enabled =0 ; + local_paca->soft_enabled =IRQ_DISABLE_MASK_LINUX ; sst =scan_dispatch_log (acct->starttime_user); ust =scan_dispatch_log (acct->starttime);
arch/powerpc/mm/hugetlbpage.c +1 -1
@@ -914,7 +914,7 @@ void flush_dcache_icache_hugepage(struct page *page)* So long as we atomically load page table pointers we are safe against teardown, * we can follow the address down to the the page and take a ref on it. * This function need to be called with interrupts disabled. We use this variant -* when we have MSR[EE] = 0 but the paca->soft_enabled = 1 +* when we have MSR[EE] = 0 but the paca->soft_enabled = IRQ_DISABLE_MASK_NONE */ pte_t *__find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea,
arch/powerpc/perf/core-book3s.c +1 -1
@@ -313,7 +313,7 @@ static inline void perf_read_regs(struct pt_regs *regs)*/ static inline int perf_intr_is_nmi (struct pt_regs *regs) { -return !regs->softe; +return (regs->softe ==IRQ_DISABLE_MASK_LINUX ); }/*
Signature · 1 line
2.7.4
RFC PATCH v3 1/12 powerpc: Add #defs for paca->soft_enabled flags
In reply to Madhavan SrinivasanTwo #defs IRQ_DISABLE_LEVEL_NONE and IRQ_DISABLE_LEVEL_LINUX are added to be used when updating paca->soft_enabled.
--- arch/powerpc/include/asm/hw_irq.h | 6 ++++++ 1 file changed, 6 insertions(+)
arch/powerpc/include/asm/hw_irq.h +6 -0
@@ -27,6 +27,12 @@#define PACA_IRQ_EE_EDGE 0x10/* BookE only */ #define PACA_IRQ_HMI 0x20 +/* +* flags for paca->soft_enabled +*/ +#define IRQ_DISABLE_MASK_NONE 1 +#define IRQ_DISABLE_MASK_LINUX 0 +#endif /* CONFIG_PPC64 */ #ifndef __ASSEMBLY__
Signature · 1 line
2.7.4
RFC PATCH v3 6/12 powerpc: Avoid using EXCEPTION_PROLOG_1 macro in MASKABLE_*
In reply to Madhavan SrinivasanCurrently we use both EXCEPTION_PROLOG_1 amd __EXCEPTION_PROLOG_1 in the MASKABLE_* macros. As a cleanup, this patch makes MASKABLE_* to use only __EXCEPTION_PROLOG_1. There is not logic change.
--- arch/powerpc/include/asm/exception-64s.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/exception-64s.h +2 -2
@@ -450,7 +450,7 @@ label##_hv: \#define MASKABLE_EXCEPTION_HV_OOL (vec, label) \ .globl label##_hv; \ label##_hv: \ - EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_TEST_HV, vec); \ + __EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_TEST_HV, vec); \ EXCEPTION_PROLOG_PSERIES_1(label##_common, EXC_HV);#define __MASKABLE_RELON_EXCEPTION_PSERIES (vec, label, h, extra) \
@@ -478,7 +478,7 @@ label##_relon_hv: \#define MASKABLE_RELON_EXCEPTION_HV_OOL (vec, label) \ .globl label##_relon_hv; \ label##_relon_hv: \ - EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_NOTEST_HV, vec); \ + __EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_NOTEST_HV, vec); \ EXCEPTION_PROLOG_PSERIES_1(label##_common, EXC_HV);/*
Signature · 1 line
2.7.4
RFC PATCH v3 8/12 powerpc: Introduce new mask bit for soft_enabled
In reply to Madhavan SrinivasanCurrently soft_enabled is used as the flag to determine the interrupt state. Patch extends the soft_enabled to be used as a mask instead of a flag. So, each MASKABLE_* macro will carry additionaly "bitmask" paramater to specify the interrupt maskable level.
--- arch/powerpc/include/asm/exception-64s.h | 4 ++-- arch/powerpc/include/asm/hw_irq.h | 1 + arch/powerpc/include/asm/irqflags.h | 4 ++-- arch/powerpc/kernel/entry_64.S | 4 ++-- arch/powerpc/kernel/exceptions-64e.S | 6 +++--- 5 files changed, 10 insertions(+), 9 deletions(-)
arch/powerpc/include/asm/exception-64s.h +2 -2
@@ -430,9 +430,9 @@ label##_relon_hv: \#define __SOFTEN_TEST (h, vec) \ lbz r10,PACASOFTIRQEN(r13); \ - cmpwi r10,IRQ_DISABLE_MASK_LINUX; \ + andi. r10,r10,IRQ_DISABLE_MASK_LINUX; \ li r10,SOFTEN_VALUE_##vec; \ - beq masked_##h##interrupt + bne masked_##h##interrupt#define _SOFTEN_TEST (h, vec) __SOFTEN_TEST(h, vec)#define SOFTEN_TEST_PR (vec) \
arch/powerpc/include/asm/hw_irq.h +1 -0
@@ -32,6 +32,7 @@*/ #define IRQ_DISABLE_MASK_NONE 0#define IRQ_DISABLE_MASK_LINUX 1 +#define IRQ_DISABLE_MASK_PMU 2#endif /* CONFIG_PPC64 */
arch/powerpc/include/asm/irqflags.h +2 -2
@@ -48,11 +48,11 @@#define RECONCILE_IRQ_STATE (__rA, __rB) \ lbz __rA,PACASOFTIRQEN(r13); \ lbz __rB,PACAIRQHAPPENED(r13); \ - cmpwi cr0,__rA,IRQ_DISABLE_MASK_LINUX;\ + andi. __rA,__rA,IRQ_DISABLE_MASK_LINUX;\ li __rA,IRQ_DISABLE_MASK_LINUX; \ ori __rB,__rB,PACA_IRQ_HARD_DIS; \ stb __rB,PACAIRQHAPPENED(r13); \ - beq 44f; \ + bne 44f; \ stb __rA,PACASOFTIRQEN(r13); \ TRACE_DISABLE_INTS; \ 44:
arch/powerpc/kernel/entry_64.S +2 -2
@@ -764,8 +764,8 @@ restore: */ ld r5,SOFTE(r1) lbz r6,PACASOFTIRQEN(r13) - cmpwi cr0,r5,IRQ_DISABLE_MASK_LINUX - beq restore_irq_off + andi. r5,r5,IRQ_DISABLE_MASK_LINUX + bne restore_irq_off /* We are enabling, were we already enabled ? Yes, just return */ cmpwi cr0,r6,IRQ_DISABLE_MASK_NONE
arch/powerpc/kernel/exceptions-64e.S +3 -3
@@ -212,8 +212,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV) /* Interrupts had better not already be enabled... */ twnei r6,IRQ_DISABLE_MASK_LINUX - cmpwi cr0,r5,IRQ_DISABLE_MASK_LINUX - beq 1f + andi. r5,r5,IRQ_DISABLE_MASK_LINUX + bne 1f TRACE_ENABLE_INTS stb r5,PACASOFTIRQEN(r13)
@@ -352,7 +352,7 @@ ret_from_mc_except: #define PROLOG_ADDITION_MASKABLE_GEN(n) \ lbz r10,PACASOFTIRQEN(r13); /* are irqs soft-disabled ? */ \ - cmpwi cr0,r10,IRQ_DISABLE_MASK_LINUX;/* yes -> go out of line */ \ + andi. r10,r10,IRQ_DISABLE_MASK_LINUX;/* yes -> go out of line */ \ beq masked_interrupt_book3e_##n #define PROLOG_ADDITION_2REGS_GEN(n) \
Signature · 1 line
2.7.4
RFC PATCH v3 9/12 powerpc: Add "bitmask" paramater to MASKABLE_* macros
In reply to Madhavan SrinivasanMake it explicit the interrupt masking supported by a gievn interrupt handler. Patch correspondingly extends the MASKABLE_* macros with an addition's parameter. "bitmask" parameter is passed to SOFTEN_TEST macro to decide on masking the interrupt.
--- arch/powerpc/include/asm/exception-64s.h | 62 ++++++++++++++++---------------- arch/powerpc/kernel/exceptions-64s.S | 36 ++++++++++++------- 2 files changed, 54 insertions(+), 44 deletions(-)
arch/powerpc/include/asm/exception-64s.h +31 -31
@@ -179,9 +179,9 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)* checking of the interrupt maskable level in the SOFTEN_TEST. * Intended to be used in MASKABLE_EXCPETION_* macros. */ -#define __EXCEPTION_PROLOG_1 (area, extra, vec) \ +#define __EXCEPTION_PROLOG_1 (area, extra, vec, bitmask) \ __EXCEPTION_PROLOG_1_PRE(area); \ - extra(vec); \ + extra(vec, bitmask); \ __EXCEPTION_PROLOG_1_POST(area);/*
@@ -428,79 +428,79 @@ label##_relon_hv: \#define SOFTEN_VALUE_0xea0 PACA_IRQ_EE#define SOFTEN_VALUE_0xea2 PACA_IRQ_EE -#define __SOFTEN_TEST (h, vec) \ +#define __SOFTEN_TEST (h, vec, bitmask) \ lbz r10,PACASOFTIRQEN(r13); \ - andi. r10,r10,IRQ_DISABLE_MASK_LINUX; \ + andi. r10,r10,bitmask; \ li r10,SOFTEN_VALUE_##vec; \ bne masked_##h##interrupt -#define _SOFTEN_TEST (h, vec) __SOFTEN_TEST(h, vec) +#define _SOFTEN_TEST (h, vec, bitmask) __SOFTEN_TEST(h, vec, bitmask) -#define SOFTEN_TEST_PR (vec) \ +#define SOFTEN_TEST_PR (vec, bitmask) \ KVMTEST(vec); \ - _SOFTEN_TEST(EXC_STD, vec) + _SOFTEN_TEST(EXC_STD, vec, bitmask) -#define SOFTEN_TEST_HV (vec) \ +#define SOFTEN_TEST_HV (vec, bitmask) \ KVMTEST(vec); \ - _SOFTEN_TEST(EXC_HV, vec) + _SOFTEN_TEST(EXC_HV, vec, bitmask) -#define SOFTEN_NOTEST_PR (vec) _SOFTEN_TEST(EXC_STD, vec) -#define SOFTEN_NOTEST_HV (vec) _SOFTEN_TEST(EXC_HV, vec) +#define SOFTEN_NOTEST_PR (vec, bitmask) _SOFTEN_TEST(EXC_STD, vec, bitmask) +#define SOFTEN_NOTEST_HV (vec, bitmask) _SOFTEN_TEST(EXC_HV, vec, bitmask) -#define __MASKABLE_EXCEPTION_PSERIES (vec, label, h, extra) \ +#define __MASKABLE_EXCEPTION_PSERIES (vec, label, h, extra, bitmask) \ SET_SCRATCH0(r13);/* save r13 */ \EXCEPTION_PROLOG_0 (PACA_EXGEN ); \ -__EXCEPTION_PROLOG_1 (PACA_EXGEN , extra, vec); \ +__EXCEPTION_PROLOG_1 (PACA_EXGEN , extra, vec, bitmask); \ EXCEPTION_PROLOG_PSERIES_1(label##_common, h); -#define _MASKABLE_EXCEPTION_PSERIES (vec, label, h, extra) \ - __MASKABLE_EXCEPTION_PSERIES(vec, label, h, extra) +#define _MASKABLE_EXCEPTION_PSERIES (vec, label, h, extra, bitmask) \ + __MASKABLE_EXCEPTION_PSERIES(vec, label, h, extra, bitmask) -#define MASKABLE_EXCEPTION_PSERIES (loc, vec, label) \ +#define MASKABLE_EXCEPTION_PSERIES (loc, vec, label, bitmask) \ . = loc; \ .globl label##_pSeries; \ label##_pSeries: \ _MASKABLE_EXCEPTION_PSERIES(vec, label, \ - EXC_STD, SOFTEN_TEST_PR) + EXC_STD, SOFTEN_TEST_PR, bitmask) -#define MASKABLE_EXCEPTION_HV (loc, vec, label) \ +#define MASKABLE_EXCEPTION_HV (loc, vec, label, bitmask) \ . = loc; \ .globl label##_hv; \ label##_hv: \ _MASKABLE_EXCEPTION_PSERIES(vec, label, \ - EXC_HV, SOFTEN_TEST_HV) + EXC_HV, SOFTEN_TEST_HV, bitmask) -#define MASKABLE_EXCEPTION_HV_OOL (vec, label) \ +#define MASKABLE_EXCEPTION_HV_OOL (vec, label, bitmask) \ .globl label##_hv; \ label##_hv: \ - __EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_TEST_HV, vec); \ + __EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_TEST_HV, vec, bitmask); \ EXCEPTION_PROLOG_PSERIES_1(label##_common, EXC_HV); -#define __MASKABLE_RELON_EXCEPTION_PSERIES (vec, label, h, extra) \ +#define __MASKABLE_RELON_EXCEPTION_PSERIES (vec, label, h, extra, bitmask)\ SET_SCRATCH0(r13);/* save r13 */ \EXCEPTION_PROLOG_0 (PACA_EXGEN ); \ -__EXCEPTION_PROLOG_1 (PACA_EXGEN , extra, vec); \ +__EXCEPTION_PROLOG_1 (PACA_EXGEN , extra, vec, bitmask); \ EXCEPTION_RELON_PROLOG_PSERIES_1(label##_common, h); -#define _MASKABLE_RELON_EXCEPTION_PSERIES (vec, label, h, extra) \ - __MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, h, extra) +#define _MASKABLE_RELON_EXCEPTION_PSERIES (vec, label, h, extra, bitmask)\ + __MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, h, extra, bitmask) -#define MASKABLE_RELON_EXCEPTION_PSERIES (loc, vec, label) \ +#define MASKABLE_RELON_EXCEPTION_PSERIES (loc, vec, label, bitmask) \ . = loc; \ .globl label##_relon_pSeries; \ label##_relon_pSeries: \ _MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, \ - EXC_STD, SOFTEN_NOTEST_PR) + EXC_STD, SOFTEN_NOTEST_PR, bitmask) -#define MASKABLE_RELON_EXCEPTION_HV (loc, vec, label) \ +#define MASKABLE_RELON_EXCEPTION_HV (loc, vec, label, bitmask) \ . = loc; \ .globl label##_relon_hv; \ label##_relon_hv: \ _MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, \ - EXC_HV, SOFTEN_NOTEST_HV) + EXC_HV, SOFTEN_NOTEST_HV, bitmask) -#define MASKABLE_RELON_EXCEPTION_HV_OOL (vec, label) \ +#define MASKABLE_RELON_EXCEPTION_HV_OOL (vec, label, bitmask) \ .globl label##_relon_hv; \ label##_relon_hv: \ - __EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_NOTEST_HV, vec); \ + __EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_NOTEST_HV, vec, bitmask);\ EXCEPTION_PROLOG_PSERIES_1(label##_common, EXC_HV);/*
arch/powerpc/kernel/exceptions-64s.S +23 -13
@@ -221,11 +221,13 @@ hardware_interrupt_pSeries: hardware_interrupt_hv: BEGIN_FTR_SECTION _MASKABLE_EXCEPTION_PSERIES(0x502, hardware_interrupt, - EXC_HV, SOFTEN_TEST_HV) + EXC_HV, SOFTEN_TEST_HV, + IRQ_DISABLE_MASK_LINUX) KVM_HANDLER(PACA_EXGEN, EXC_HV, 0x502) FTR_SECTION_ELSE _MASKABLE_EXCEPTION_PSERIES(0x500, hardware_interrupt, - EXC_STD, SOFTEN_TEST_PR) + EXC_STD, SOFTEN_TEST_PR, + IRQ_DISABLE_MASK_LINUX) KVM_HANDLER(PACA_EXGEN, EXC_STD, 0x500) ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206)
@@ -241,11 +243,13 @@ hardware_interrupt_hv: . = 0x900 .globl decrementer_pSeries decrementer_pSeries: - _MASKABLE_EXCEPTION_PSERIES(0x900, decrementer, EXC_STD, SOFTEN_TEST_PR) + _MASKABLE_EXCEPTION_PSERIES(0x900, decrementer, EXC_STD, SOFTEN_TEST_PR, + IRQ_DISABLE_MASK_LINUX) STD_EXCEPTION_HV(0x980, 0x982, hdecrementer) - MASKABLE_EXCEPTION_PSERIES(0xa00, 0xa00, doorbell_super) + MASKABLE_EXCEPTION_PSERIES(0xa00, 0xa00, doorbell_super, + IRQ_DISABLE_MASK_LINUX) KVM_HANDLER(PACA_EXGEN, EXC_STD, 0xa00) STD_EXCEPTION_PSERIES(0xb00, trap_0b)
@@ -566,13 +570,13 @@ END_FTR_SECTION_IFSET(CPU_FTR_CFAR) KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe22) STD_EXCEPTION_HV_OOL(0xe42, emulation_assist) KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe42) - MASKABLE_EXCEPTION_HV_OOL(0xe62, hmi_exception) + MASKABLE_EXCEPTION_HV_OOL(0xe62, hmi_exception,IRQ_DISABLE_MASK_LINUX) KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe62) - MASKABLE_EXCEPTION_HV_OOL(0xe82, h_doorbell) + MASKABLE_EXCEPTION_HV_OOL(0xe82, h_doorbell,IRQ_DISABLE_MASK_LINUX) KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe82) - MASKABLE_EXCEPTION_HV_OOL(0xea2, h_virt_irq) + MASKABLE_EXCEPTION_HV_OOL(0xea2, h_virt_irq,IRQ_DISABLE_MASK_LINUX) KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xea2) /* moved from 0xf00 */
@@ -808,16 +812,20 @@ instruction_access_slb_relon_pSeries: hardware_interrupt_relon_pSeries: hardware_interrupt_relon_hv: BEGIN_FTR_SECTION - _MASKABLE_RELON_EXCEPTION_PSERIES(0x502, hardware_interrupt, EXC_HV, SOFTEN_TEST_HV) + _MASKABLE_RELON_EXCEPTION_PSERIES(0x502, hardware_interrupt, + EXC_HV, SOFTEN_TEST_HV, IRQ_DISABLE_MASK_LINUX) FTR_SECTION_ELSE - _MASKABLE_RELON_EXCEPTION_PSERIES(0x500, hardware_interrupt, EXC_STD, SOFTEN_TEST_PR) + _MASKABLE_RELON_EXCEPTION_PSERIES(0x500, hardware_interrupt, + EXC_STD, SOFTEN_TEST_PR, IRQ_DISABLE_MASK_LINUX) ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE) STD_RELON_EXCEPTION_PSERIES(0x4600, 0x600, alignment) STD_RELON_EXCEPTION_PSERIES(0x4700, 0x700, program_check) STD_RELON_EXCEPTION_PSERIES(0x4800, 0x800, fp_unavailable) - MASKABLE_RELON_EXCEPTION_PSERIES(0x4900, 0x900, decrementer) + MASKABLE_RELON_EXCEPTION_PSERIES(0x4900, 0x900, decrementer, + IRQ_DISABLE_MASK_LINUX) STD_RELON_EXCEPTION_HV(0x4980, 0x982, hdecrementer) - MASKABLE_RELON_EXCEPTION_PSERIES(0x4a00, 0xa00, doorbell_super) + MASKABLE_RELON_EXCEPTION_PSERIES(0x4a00, 0xa00, doorbell_super, + IRQ_DISABLE_MASK_LINUX) STD_RELON_EXCEPTION_PSERIES(0x4b00, 0xb00, trap_0b) . = 0x4c00
@@ -1113,8 +1121,10 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX) /* Equivalents to the above handlers for relocation-on interrupt vectors */ STD_RELON_EXCEPTION_HV_OOL(0xe40, emulation_assist) - MASKABLE_RELON_EXCEPTION_HV_OOL(0xe80, h_doorbell) - MASKABLE_RELON_EXCEPTION_HV_OOL(0xea0, h_virt_irq) + MASKABLE_RELON_EXCEPTION_HV_OOL(0xe80, h_doorbell, + IRQ_DISABLE_MASK_LINUX) + MASKABLE_RELON_EXCEPTION_HV_OOL(0xea0, h_virt_irq, + IRQ_DISABLE_MASK_LINUX) STD_RELON_EXCEPTION_PSERIES_OOL(0xf00, performance_monitor) STD_RELON_EXCEPTION_PSERIES_OOL(0xf20, altivec_unavailable)
Signature · 1 line
2.7.4
RFC PATCH v3 10/12 powerpc: Add support to mask perf interrupts
In reply to Madhavan SrinivasanTo support masking of the PMI interrupts, couple of new interrupt handler macros are added MASKABLE_EXCEPTION_PSERIES_OOL and MASKABLE_RELON_EXCEPTION_PSERIES_OOL.
Couple of new irq #defs "PACA_IRQ_PMI" and "SOFTEN_VALUE_0xf0*" added to use in the exception code to check for PMI interrupts.
--- arch/powerpc/include/asm/exception-64s.h | 13 +++++++++++++ arch/powerpc/include/asm/hw_irq.h | 1 + arch/powerpc/kernel/exceptions-64s.S | 4 ++-- 3 files changed, 16 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/exception-64s.h +13 -0
@@ -427,6 +427,7 @@ label##_relon_hv: \#define SOFTEN_VALUE_0xe62 PACA_IRQ_HMI#define SOFTEN_VALUE_0xea0 PACA_IRQ_EE#define SOFTEN_VALUE_0xea2 PACA_IRQ_EE +#define SOFTEN_VALUE_0xf00 PACA_IRQ_PMI#define __SOFTEN_TEST (h, vec, bitmask) \ lbz r10,PACASOFTIRQEN(r13); \
@@ -462,6 +463,12 @@ label##_pSeries: \_MASKABLE_EXCEPTION_PSERIES (vec, label, \ EXC_STD, SOFTEN_TEST_PR, bitmask) +#define MASKABLE_EXCEPTION_PSERIES_OOL (vec, label, bitmask) \ + .globl label##_pSeries; \ +label##_pSeries: \ + __EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_TEST_PR, vec, bitmask); \ + EXCEPTION_PROLOG_PSERIES_1(label##_common, EXC_STD); +#define MASKABLE_EXCEPTION_HV (loc, vec, label, bitmask) \ . = loc; \ .globl label##_hv; \
@@ -490,6 +497,12 @@ label##_relon_pSeries: \_MASKABLE_RELON_EXCEPTION_PSERIES (vec, label, \ EXC_STD, SOFTEN_NOTEST_PR, bitmask) +#define MASKABLE_RELON_EXCEPTION_PSERIES_OOL (vec, label, bitmask) \ + .globl label##_relon_pSeries; \ +label##_relon_pSeries: \ + __EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_NOTEST_PR, vec, bitmask);\ + EXCEPTION_PROLOG_PSERIES_1(label##_common, EXC_STD); +#define MASKABLE_RELON_EXCEPTION_HV (loc, vec, label, bitmask) \ . = loc; \ .globl label##_relon_hv; \
arch/powerpc/include/asm/hw_irq.h +1 -0
@@ -26,6 +26,7 @@#define PACA_IRQ_DEC 0x08/* Or FIT */ #define PACA_IRQ_EE_EDGE 0x10/* BookE only */ #define PACA_IRQ_HMI 0x20 +#define PACA_IRQ_PMI 0x40/* * flags for paca->soft_enabled
arch/powerpc/kernel/exceptions-64s.S +2 -2
@@ -580,7 +580,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_CFAR) KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xea2) /* moved from 0xf00 */ - STD_EXCEPTION_PSERIES_OOL(0xf00, performance_monitor) + MASKABLE_EXCEPTION_PSERIES_OOL(0xf00, performance_monitor, IRQ_DISABLE_MASK_PMU) KVM_HANDLER(PACA_EXGEN, EXC_STD, 0xf00) STD_EXCEPTION_PSERIES_OOL(0xf20, altivec_unavailable) KVM_HANDLER(PACA_EXGEN, EXC_STD, 0xf20)
@@ -1126,7 +1126,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX) MASKABLE_RELON_EXCEPTION_HV_OOL(0xea0, h_virt_irq, IRQ_DISABLE_MASK_LINUX) - STD_RELON_EXCEPTION_PSERIES_OOL(0xf00, performance_monitor) + MASKABLE_RELON_EXCEPTION_PSERIES_OOL(0xf00, performance_monitor, IRQ_DISABLE_MASK_PMU) STD_RELON_EXCEPTION_PSERIES_OOL(0xf20, altivec_unavailable) STD_RELON_EXCEPTION_PSERIES_OOL(0xf40, vsx_unavailable) STD_RELON_EXCEPTION_PSERIES_OOL(0xf60, facility_unavailable)
Signature · 1 line
2.7.4
RFC PATCH v3 11/12 powerpc: Support to replay PMIs
In reply to Madhavan SrinivasanCode to replay the Performance Monitoring Interrupts(PMI). In the masked_interrupt handler, for PMIs we reset the MSR[EE] and return. In the __check_irq_replay(), replay the PMI interrupt by calling performance_monitor_common handler.
Patch also adds a new soft_irq_set_mask() to update paca->soft_enabled. New Kconfig is added "CONFIG_IRQ_DEBUG_SUPPORT" to add a warn_on to alert the usage of soft_irq_set_mask() for disabling lower bitmask interrupts.
Have also moved the code under the CONFIG_TRACE_IRQFLAGS in arch_local_irq_restore() to new Kconfig as suggested.
--- arch/powerpc/Kconfig | 4 ++++ arch/powerpc/include/asm/hw_irq.h | 17 +++++++++++++++++ arch/powerpc/kernel/entry_64.S | 5 +++++ arch/powerpc/kernel/exceptions-64s.S | 2 ++ arch/powerpc/kernel/irq.c | 12 ++++++++++-- 5 files changed, 38 insertions(+), 2 deletions(-)
arch/powerpc/Kconfig +4 -0
@@ -51,6 +51,10 @@ config TRACE_IRQFLAGS_SUPPORT bool default y +config IRQ_DEBUG_SUPPORT + bool + default n + config LOCKDEP_SUPPORT bool default y
arch/powerpc/include/asm/hw_irq.h +17 -0
@@ -81,6 +81,23 @@ static inline unsigned long arch_local_irq_disable(void)return flags; } +static inline unsigned long soft_irq_set_mask (int value) +{ +unsigned long flags, zero; + +#ifdef CONFIG_IRQ_DEBUG_SUPPORT +WARN_ON (value <=IRQ_DISABLE_MASK_LINUX ); +#endif + asmvolatile ( +"li %1,%3; lbz %0,%2(13); stb %1,%2(13)" + :"=r" (flags),"=&r" (zero) + :"i" (offsetof(struct paca_struct , soft_enabled)),\ +"i" (value) + :"memory" ); + +return flags; +} +extern void arch_local_irq_restore (unsigned long );static inline void arch_local_irq_enable (void )
arch/powerpc/kernel/entry_64.S +5 -0
@@ -933,6 +933,11 @@ restore_check_irq_replay: addi r3,r1,STACK_FRAME_OVERHEAD; bl do_IRQ b ret_from_except +1: cmpwi cr0,r3,0xf00 + bne 1f + addi r3,r1,STACK_FRAME_OVERHEAD; + bl performance_monitor_exception + b ret_from_except 1: cmpwi cr0,r3,0xe60 bne 1f addi r3,r1,STACK_FRAME_OVERHEAD;
arch/powerpc/kernel/exceptions-64s.S +2 -0
@@ -655,6 +655,8 @@ _GLOBAL(__replay_interrupt) beq decrementer_common cmpwi r3,0x500 beq hardware_interrupt_common + cmpwi r3,0xf00 + beq performance_monitor_common BEGIN_FTR_SECTION cmpwi r3,0xe80 beq h_doorbell_common
arch/powerpc/kernel/irq.c +10 -2
@@ -159,6 +159,14 @@ notrace unsigned int __check_irq_replay(void)if ((happened &PACA_IRQ_DEC ) ||decrementer_check_overflow ())return 0x900 ; +/* +* In masked_handler() for PMI, we disable MSR[EE] and return. +* When replaying it here +*/ + local_paca->irq_happened &= ~PACA_IRQ_PMI ; +if (happened &PACA_IRQ_PMI ) +return 0xf00 ; +/* Finally check if an external interrupt happened */ local_paca->irq_happened &= ~PACA_IRQ_EE ;if (happened &PACA_IRQ_EE )
@@ -235,7 +243,7 @@ notrace void arch_local_irq_restore(unsigned long en)*/ if (unlikely (irq_happened !=PACA_IRQ_HARD_DIS ))__hard_irq_disable (); -#ifdef CONFIG_TRACE_IRQFLAGS +#ifdef CONFIG_IRQ_DEBUG_SUPPORT else {/* * We should already be hard disabled here. We had bugs
@@ -246,7 +254,7 @@ notrace void arch_local_irq_restore(unsigned long en)if (WARN_ON (mfmsr () &MSR_EE )) __hard_irq_disable(); } -#endif /* CONFIG_TRACE_IRQFLAGS */ +#endif /* CONFIG_IRQ_DEBUG_SUPPORT */ set_soft_enabled (IRQ_DISABLE_MASK_LINUX );
Signature · 1 line
2.7.4
RFC PATCH v3 12/12 powerpc: rewrite local_t using soft_irq
In reply to Madhavan SrinivasanLocal atomic operations are fast and highly reentrant per CPU counters. Used for percpu variable updates. Local atomic operations only guarantee variable modification atomicity wrt the CPU which owns the data and these needs to be executed in a preemption safe way.
Here is the design of this patch. Since local_* operations
are only need to be atomic to interrupts (IIUC), we have two options. Either replay the "op" if interrupted or replay the interrupt after the "op". Initial patchset posted was based on implementing local_* operation based on CR5 which replay's the "op". Patchset had issues in case of rewinding the address pointor from an array. This make the slow patch really slow. Since CR5 based implementation proposed using __ex_table to find the rewind addressr, this rasied concerns about size of __ex_table and vmlinux.
https://lists.ozlabs.org/pipermail/linuxppc-dev/2014-December/123115.html
But this patch uses, arch_local_irq_*() to soft_disable
interrupts (including PMIs). After finishing the "op", arch_local_irq_restore() called and correspondingly interrupts are replayed if any occured.
patch re-write the current local_* functions to use arch_local_irq_disbale. Base flow for each function is
{
soft_irq_set_mask()
load
..
store
arch_local_irq_restore()
}Reason for the approach is that, currently l[w/d]arx/st[w/d]cx. instruction pair is used for local_* operations, which are heavy on cycle count and they dont support a local variant. So to see whether the new implementation helps, used a modified version of Rusty's benchmark code on local_t.
https://lkml.org/lkml/2008/12/16/450
Modifications to Rusty's benchmark code:
- Executed only local_t test
Here are the values with the patch.
Time in ns per iteration
Local_t Without Patch With Patch
_inc 28 8 _add 28 8 _read 3 3
_add_return 28 7
Currently only asm/local.h has been rewrite, and also the entire change is tested only in PPC64 (pseries guest) and PPC64 host (LE).
TODO:
- local_cmpxchg and local_xchg needs modification.
--- arch/powerpc/include/asm/local.h | 91 +++++++++++++++++++++++++++------------- 1 file changed, 63 insertions(+), 28 deletions(-)
arch/powerpc/include/asm/local.h +63 -28
@@ -14,24 +14,50 @@ typedef struct#define local_read (l) atomic_long_read(&(l)->a)#define local_set (l,i) atomic_long_set(&(l)->a, (i)) -#define local_add (i,l) atomic_long_add((i),(&(l)->a)) -#define local_sub (i,l) atomic_long_sub((i),(&(l)->a)) -#define local_inc (l) atomic_long_inc(&(l)->a) -#define local_dec (l) atomic_long_dec(&(l)->a) +static __inline__void local_add (long i,local_t *l) +{ +long t; +unsigned long flags; + + flags =soft_irq_set_mask (IRQ_DISABLE_MASK_PMU |IRQ_DISABLE_MASK_LINUX ); + __asm__ __volatile__( +PPC_LL " %0,0(%2)\n\ +add %0,%1,%0\n" +PPC_STL " %0,0(%2)\n" + :"=&r" (t) + :"r" (i),"r" (&(l->a.counter))); +arch_local_irq_restore (flags); +} + +static __inline__void local_sub (long i,local_t *l) +{ +long t; +unsigned long flags; + + flags =soft_irq_set_mask (IRQ_DISABLE_MASK_PMU |IRQ_DISABLE_MASK_LINUX ); + __asm__ __volatile__( +PPC_LL " %0,0(%2)\n\ +subf %0,%1,%0\n" +PPC_STL " %0,0(%2)\n" + :"=&r" (t) + :"r" (i),"r" (&(l->a.counter))); +arch_local_irq_restore (flags); +}static __inline__long local_add_return (long a,local_t *l) {long t; +unsigned long flags; + flags =soft_irq_set_mask (IRQ_DISABLE_MASK_PMU |IRQ_DISABLE_MASK_LINUX ); __asm__ __volatile__( -"1:" PPC_LLARX(%0,0,%2,0) " # local_add_return\n\ +PPC_LL " %0,0(%2)\n\ add %0,%1,%0\n" - PPC405_ERR77(0,%2) - PPC_STLCX "%0,0,%2 \n\ - bne- 1b" +PPC_STL "%0,0(%2)\n" :"=&r" (t) :"r" (a),"r" (&(l->a.counter)) :"cc" ,"memory" ); +arch_local_irq_restore (flags);return t; }
@@ -41,16 +67,18 @@ static __inline__ long local_add_return(long a, local_t *l)static __inline__long local_sub_return (long a,local_t *l) {long t; +unsigned long flags; + + flags =soft_irq_set_mask (IRQ_DISABLE_MASK_PMU |IRQ_DISABLE_MASK_LINUX ); __asm__ __volatile__( -"1:" PPC_LLARX(%0,0,%2,0) " # local_sub_return\n\ +"1:" PPC_LL " %0,0(%2)\n\ subf %0,%1,%0\n" - PPC405_ERR77(0,%2) - PPC_STLCX "%0,0,%2 \n\ - bne- 1b" +PPC_STL "%0,0(%2)\n" :"=&r" (t) :"r" (a),"r" (&(l->a.counter)) :"cc" ,"memory" ); +arch_local_irq_restore (flags);return t; }
@@ -58,16 +86,17 @@ static __inline__ long local_sub_return(long a, local_t *l)static __inline__long local_inc_return (local_t *l) {long t; +unsigned long flags; + flags =soft_irq_set_mask (IRQ_DISABLE_MASK_PMU |IRQ_DISABLE_MASK_LINUX ); __asm__ __volatile__( -"1:" PPC_LLARX(%0,0,%1,0) " # local_inc_return\n\ +"1:" PPC_LL " %0,0(%1)\n\ addic %0,%0,1\n" - PPC405_ERR77(0,%1) - PPC_STLCX "%0,0,%1 \n\ - bne- 1b" +PPC_STL "%0,0(%1)\n" :"=&r" (t) :"r" (&(l->a.counter)) :"cc" ,"xer" ,"memory" ); +arch_local_irq_restore (flags);return t; }
@@ -85,20 +114,24 @@ static __inline__ long local_inc_return(local_t *l)static __inline__long local_dec_return (local_t *l) {long t; +unsigned long flags; + flags =soft_irq_set_mask (IRQ_DISABLE_MASK_PMU |IRQ_DISABLE_MASK_LINUX ); __asm__ __volatile__( -"1:" PPC_LLARX(%0,0,%1,0) " # local_dec_return\n\ +PPC_LL " %0,0(%1)\n\ addic %0,%0,-1\n" - PPC405_ERR77(0,%1) - PPC_STLCX "%0,0,%1\n\ - bne- 1b" +PPC_STL "%0,0(%1)\n" :"=&r" (t) :"r" (&(l->a.counter)) :"cc" ,"xer" ,"memory" ); +arch_local_irq_restore (flags);return t; } +#define local_inc (l) local_inc_return(l) +#define local_dec (l) local_dec_return(l) +#define local_cmpxchg (l, o, n) \ (cmpxchg_local(&((l)->a.counter), (o), (n)))#define local_xchg (l, n) (xchg_local(&((l)->a.counter), (n)))
@@ -115,20 +148,21 @@ static __inline__ long local_dec_return(local_t *l)static __inline__int local_add_unless (local_t *l,long a,long u) {long t; +unsigned long flags; + flags =soft_irq_set_mask (IRQ_DISABLE_MASK_PMU |IRQ_DISABLE_MASK_LINUX ); __asm__ __volatile__ ( -"1:" PPC_LLARX(%0,0,%1,0) " # local_add_unless\n\ +PPC_LL " %0,0(%1)\n\ cmpw 0,%0,%3 \n\ beq- 2f \n\ add %0,%2,%0 \n" - PPC405_ERR77(0,%2) -PPC_STLCX "%0,0,%1 \n\ -bne- 1b \n" +PPC_STL " %0,0(%1) \n" " subf %0,%2,%0 \n\ 2:" :"=&r" (t) :"r" (&(l->a.counter)),"r" (a),"r" (u) :"cc" ,"memory" ); +arch_local_irq_restore (flags);return t != u; }
@@ -145,19 +179,20 @@ static __inline__ int local_add_unless(local_t *l, long a, long u)static __inline__long local_dec_if_positive (local_t *l) {long t; +unsigned long flags; + flags =soft_irq_set_mask (IRQ_DISABLE_MASK_PMU |IRQ_DISABLE_MASK_LINUX ); __asm__ __volatile__( -"1:" PPC_LLARX(%0,0,%1,0) " # local_dec_if_positive\n\ +PPC_LL " %0,0(%1)\n\ cmpwi %0,1\n\ addi %0,%0,-1\n\ blt- 2f\n" - PPC405_ERR77(0,%1) -PPC_STLCX "%0,0,%1\n\ -bne- 1b" +PPC_STL "%0,0(%1)\n" "\n\ 2:" :"=&b" (t) :"r" (&(l->a.counter)) :"cc" ,"memory" ); +arch_local_irq_restore (flags);return t; }
Signature · 1 line
2.7.4
RFC PATCH v3 7/12 powerpc: Add new _EXCEPTION_PROLOG_1 macro
In reply to Madhavan SrinivasanFactor out the EXCPETION_PROLOG_1 macro, so that STD_EXCEPTION_* and MASKABLE_EXCEPTION will have separate version. This is needed to support addition of new parameter "bitmask" for MASKABLE_* macros to specify the interrupt mask.
--- arch/powerpc/include/asm/exception-64s.h | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/exception-64s.h +26 -4
@@ -161,18 +161,40 @@ END_FTR_SECTION_NESTED(ftr,ftr,943) std r10,area+EX_R10(r13); /* save r10 - r12 */ \ OPT_GET_SPR(r10, SPRN_CFAR, CPU_FTR_CFAR) -#define __EXCEPTION_PROLOG_1 (area, extra, vec) \ +#define __EXCEPTION_PROLOG_1_PRE (area) \ OPT_SAVE_REG_TO_PACA(area+EX_PPR, r9, CPU_FTR_HAS_PPR); \ OPT_SAVE_REG_TO_PACA(area+EX_CFAR, r10, CPU_FTR_CFAR); \ SAVE_CTR(r10, area); \ - mfcr r9; \ - extra(vec); \ + mfcr r9; + +#define __EXCEPTION_PROLOG_1_POST (area) \ std r11,area+EX_R11(r13); \ std r12,area+EX_R12(r13); \ GET_SCRATCH0(r10); \ std r10,area+EX_R13(r13) + +/* +* This version of the EXCEPTION_PROLOG_1 will carry +* addition parameter called "bitmask" to support +* checking of the interrupt maskable level in the SOFTEN_TEST. +* Intended to be used in MASKABLE_EXCPETION_* macros. +*/ +#define __EXCEPTION_PROLOG_1 (area, extra, vec) \ + __EXCEPTION_PROLOG_1_PRE(area); \ + extra(vec); \ + __EXCEPTION_PROLOG_1_POST(area); + +/* +* This version of the EXCEPTION_PROLOG_1 is intended +* to be used in STD_EXCEPTION* macros +*/ +#define _EXCEPTION_PROLOG_1 (area, extra, vec) \ + __EXCEPTION_PROLOG_1_PRE(area); \ + extra(vec); \ + __EXCEPTION_PROLOG_1_POST(area); +#define EXCEPTION_PROLOG_1 (area, extra, vec) \ - __EXCEPTION_PROLOG_1(area, extra, vec) + _EXCEPTION_PROLOG_1(area, extra, vec)#define __EXCEPTION_PROLOG_PSERIES_1 (label, h) \ ld r12,PACAKBASE(r13);/* get high part of &label */ \
Signature · 1 line
2.7.4
RFC PATCH v3 3/12 powerpc: move set_soft_enabled()
In reply to Madhavan SrinivasanMove set_soft_enabled() from powerpc/kernel/irq.c to asm/hw_irq.c. this way updation of paca->soft_enabled can be forced wherever possible.
--- arch/powerpc/include/asm/hw_irq.h | 6 ++++++ arch/powerpc/kernel/irq.c | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/include/asm/hw_irq.h +6 -0
@@ -47,6 +47,12 @@ extern void unknown_exception(struct pt_regs *regs);#ifdef CONFIG_PPC64 #include <asm/paca.h> +static inline notrace void set_soft_enabled(unsigned long enable) +{ + __asm__ __volatile__("stb %0,%1(13)" + : :"r" (enable),"i" (offsetof(struct paca_struct , soft_enabled))); +} +static inline unsigned long arch_local_save_flags (void ) {unsigned long flags;
arch/powerpc/kernel/irq.c +0 -6
@@ -107,12 +107,6 @@ static inline notrace unsigned long get_irq_happened(void)return happened; } -static inline notrace void set_soft_enabled(unsigned long enable) -{ - __asm__ __volatile__("stb %0,%1(13)" - : :"r" (enable),"i" (offsetof(struct paca_struct , soft_enabled))); -} - static inline notrace int decrementer_check_overflow(void) {u64 now =get_tb_or_rtc ();
Signature · 1 line
2.7.4
RFC PATCH v3 4/12 powerpc: Use set_soft_enabled api to update paca->soft_enabled
In reply to Madhavan Srinivasan--- arch/powerpc/include/asm/kvm_ppc.h | 2 +- arch/powerpc/kernel/irq.c | 2 +- arch/powerpc/kernel/setup_64.c | 4 ++-- arch/powerpc/kernel/time.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/include/asm/kvm_ppc.h +1 -1
@@ -707,7 +707,7 @@ static inline void kvmppc_fix_ee_before_entry(void)/* Only need to enable IRQs by hard enabling them after this */ local_paca->irq_happened =0 ; - local_paca->soft_enabled =IRQ_DISABLE_MASK_NONE ; +set_soft_enabled (IRQ_DISABLE_MASK_NONE );#endif }
arch/powerpc/kernel/irq.c +1 -1
@@ -332,7 +332,7 @@ bool prep_irq_for_idle(void)* of entering the low power state. */ local_paca->irq_happened &= ~PACA_IRQ_HARD_DIS ; - local_paca->soft_enabled =IRQ_DISABLE_MASK_NONE ; +set_soft_enabled (IRQ_DISABLE_MASK_NONE );/* Tell the caller to enter the low power state */ return true;
arch/powerpc/kernel/setup_64.c +2 -2
@@ -197,7 +197,7 @@ static void __init fixup_boot_paca(void)/* Allow percpu accesses to work until we setup percpu data */ get_paca ()->data_offset =0 ;/* Mark interrupts disabled in PACA */ -get_paca ()->soft_enabled =IRQ_DISABLE_MASK_LINUX ; +set_soft_enabled (IRQ_DISABLE_MASK_LINUX ); }static void __init configure_exceptions (void )
@@ -334,7 +334,7 @@ void __init early_setup(unsigned long dt_ptr)void early_setup_secondary (void ) {/* Mark interrupts disabled in PACA */ -get_paca ()->soft_enabled =0 ; +set_soft_enabled (IRQ_DISABLE_MASK_LINUX );/* Initialize the hash table or TLB handling */ early_init_mmu_secondary ();
arch/powerpc/kernel/time.c +2 -2
@@ -268,7 +268,7 @@ void accumulate_stolen_time(void)* needs to reflect that so various debug stuff doesn't * complain */ - local_paca->soft_enabled =IRQ_DISABLE_MASK_LINUX ; +set_soft_enabled (IRQ_DISABLE_MASK_LINUX ); sst =scan_dispatch_log (acct->starttime_user); ust =scan_dispatch_log (acct->starttime);
@@ -276,7 +276,7 @@ void accumulate_stolen_time(void) acct->user_time -= ust; local_paca->stolen_time += ust + sst; - local_paca->soft_enabled = save_soft_enabled; +set_soft_enabled (save_soft_enabled); }static inline u64 calculate_stolen_time (u64 stop_tb)
Signature · 1 line
2.7.4
RFC PATCH v3 5/12 powerpc: reverse the soft_enable logic
In reply to Madhavan Srinivasan"paca->soft_enabled" is used as a flag to mask some of interrupts. Currently supported flags values and their details:
soft_enabled MSR[EE]
0 0 Disabled (PMI and HMI not masked) 1 1 Enabled
"paca->soft_enabled" is initialized to 1 to make the interripts as enabled. arch_local_irq_disable() will toggle the value when interrupts needs to disbled. At this point, the interrupts are not actually disabled, instead, interrupt vector has code to check for the flag and mask it when it occurs. By "mask it", it update interrupt paca->irq_happened and return. arch_local_irq_restore() is called to re-enable interrupts, which checks and replays interrupts if any occured.
Now, as mentioned, current logic doesnot mask "performance monitoring interrupts" and PMIs are implemented as NMI. But this patchset depends on local_irq_* for a successful local_* update. Meaning, mask all possible interrupts during local_* update and replay them after the update.
So the idea here is to reserve the "paca->soft_enabled" logic. New values and details:
soft_enabled MSR[EE]
1 0 Disabled (PMI and HMI not masked) 0 1 Enabled
Reason for the this change is to create foundation for a third flag value "2" for "soft_enabled" to add support to mask PMIs.
Foundation patch to support checking of new flag value for "paca->soft_enabled". Modify the condition checking for the "soft_enabled".
--- arch/powerpc/include/asm/hw_irq.h | 4 ++-- arch/powerpc/kernel/entry_64.S | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-)
arch/powerpc/include/asm/hw_irq.h +2 -2
@@ -30,8 +30,8 @@/* * flags for paca->soft_enabled */ -#define IRQ_DISABLE_MASK_NONE 1 -#define IRQ_DISABLE_MASK_LINUX 0 +#define IRQ_DISABLE_MASK_NONE 0 +#define IRQ_DISABLE_MASK_LINUX 1#endif /* CONFIG_PPC64 */
arch/powerpc/kernel/entry_64.S +2 -3
@@ -131,8 +131,7 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR) */ #if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_BUG) lbz r10,PACASOFTIRQEN(r13) - xori r10,r10,IRQ_DISABLE_MASK_NONE -1: tdnei r10,0 +1: tdnei r10,IRQ_DISABLE_MASK_NONE EMIT_BUG_ENTRY 1b,__FILE__,__LINE__,BUGFLAG_WARNING #endif
@@ -1012,7 +1011,7 @@ _GLOBAL(enter_rtas) * check it with the asm equivalent of WARN_ON */ lbz r0,PACASOFTIRQEN(r13) -1: tdnei r0,IRQ_DISABLE_MASK_LINUX +1: tdeqi r0,IRQ_DISABLE_MASK_NONE EMIT_BUG_ENTRY 1b,__FILE__,__LINE__,BUGFLAG_WARNING #endif
Signature · 1 line
2.7.4
Nicholas Piggin
reviewerRe: [RFC PATCH v3 08/12] powerpc: Introduce new mask bit for soft_enabled
In reply to Madhavan Srinivasanarch/powerpc/include/asm/hw_irq.h line 37
Quoted 11 lines · On Thu, 25 Aug 2016 11:59:59 +0530 Madhavan Srinivasan…
arch/powerpc/include/asm/hw_irq.h +1
-0@@ -32,6 +32,7 @@*/ #define IRQ_DISABLE_MASK_NONE 0#define IRQ_DISABLE_MASK_LINUX 1 +#define IRQ_DISABLE_MASK_PMU 2#endif /* CONFIG_PPC64 */
This bit belongs in patch 10, I think?
Nicholas Piggin
reviewerRe: [RFC PATCH v3 11/12] powerpc: Support to replay PMIs
In reply to Madhavan SrinivasanQuoted 5 lines · On Thu, 25 Aug 2016 12:00:02 +0530 Madhavan Srinivasan…
Code to replay the Performance Monitoring Interrupts(PMI). In the
masked_interrupthandler, for PMIs we reset the MSR[EE] and return. In the__check_irq_replay(), replay the PMI interrupt by callingperformance_monitor_commonhandler.
Quoted 7 lines
Patch also adds a new
soft_irq_set_mask()to updatepaca->soft_enabled. NewKconfigis added "CONFIG_IRQ_DEBUG_SUPPORT" to add awarn_onto alert the usage ofsoft_irq_set_mask()for disabling lower bitmask interrupts.Have also moved the code under the
CONFIG_TRACE_IRQFLAGSinarch_local_irq_restore()to newKconfigas suggested.
Should you make a single patch out of this and patch 10? It doesn't make sense to mask perf interrupts if we can't replay them.
Perhaps split the CONFIG_IRQ_DEBUG_SUPPORT change into its own patch first and have the PMU masking and replaying as a single patch?
Just a suggestion.
Nicholas Piggin
reviewerQuoted 4 lines · On Thu, 25 Aug 2016 11:59:51 +0530 Madhavan Srinivasan…
Local atomic operations are fast and highly reentrant per CPU counters. Used for percpu variable updates. Local atomic operations only guarantee variable modification atomicity wrt the CPU which owns the data and these needs to be executed in a preemption safe way.
This is looking really nice. I like how you're able to specify the mask nicely in the handler, and test the mask without adding any instructions to fastpaths.
So far, I only have a few trivial nitpicks as you can see. I'll apply the series and give it a more careful look tomorrow.
Thanks,
Nick
Re: [RFC PATCH v3 08/12] powerpc: Introduce new mask bit for soft_enabled
In reply to Nicholas PigginQuoted 13 lines · Nicholas Piggin
Quoted 10 lines · On Thu, 25 Aug 2016 11:59:59 +0530 Madhavan Srinivasan…
arch/powerpc/include/asm/hw_irq.h +1
-0@@ -32,6 +32,7 @@*/ #define IRQ_DISABLE_MASK_NONE 0#define IRQ_DISABLE_MASK_LINUX 1 +#define IRQ_DISABLE_MASK_PMU 2
Quoted 2 lines
arch/powerpc/include/asm/hw_irq.h line 37
Quoted 1 line
arch/powerpc/include/asm/hw_irq.h +0
-0#endif /* CONFIG_PPC64 */ This bit belongs in patch 10, I think?
Yes. I had that in Patch 10, but then since this patch talks abt making the soft_enabled as a mask, having the third value here made sense. But I can move back to patch 10.
Maddy
Quoted 1 line
Re: [RFC PATCH v3 11/12] powerpc: Support to replay PMIs
In reply to Nicholas PigginQuoted 15 lines · Nicholas Piggin
Quoted 5 lines · On Thu, 25 Aug 2016 12:00:02 +0530 Madhavan Srinivasan…
Code to replay the Performance Monitoring Interrupts(PMI). In the
masked_interrupthandler, for PMIs we reset the MSR[EE] and return. In the__check_irq_replay(), replay the PMI interrupt by callingperformance_monitor_commonhandler.Quoted 7 lines
Patch also adds a new
soft_irq_set_mask()to updatepaca->soft_enabled. NewKconfigis added "CONFIG_IRQ_DEBUG_SUPPORT" to add awarn_onto alert the usage ofsoft_irq_set_mask()for disabling lower bitmask interrupts.Have also moved the code under the
CONFIG_TRACE_IRQFLAGSinarch_local_irq_restore()to newKconfigas suggested.
Quoted 7 lines
Should you make a single patch out of this and patch 10? It doesn't make sense to mask perf interrupts if we can't replay them.
Perhaps split the
CONFIG_IRQ_DEBUG_SUPPORTchange into its own patch first and have the PMU masking and replaying as a single patch?
Make senses. Will make the changes.
Maddy
Quoted 3 lines
Just a suggestion.
Quoted 10 lines · Nicholas Piggin
Quoted 4 lines · On Thu, 25 Aug 2016 11:59:51 +0530 Madhavan Srinivasan…
Local atomic operations are fast and highly reentrant per CPU counters. Used for percpu variable updates. Local atomic operations only guarantee variable modification atomicity wrt the CPU which owns the data and these needs to be executed in a preemption safe way.
This is looking really nice. I like how you're able to specify the mask nicely in the handler, and test the mask without adding any instructions to fastpaths.
Thanks.
Quoted 3 lines
So far, I only have a few trivial nitpicks as you can see. I'll apply the series and give it a more careful look tomorrow.
Yes. Please.
Also, just noticed that i broke the Booke build, will fix that and respin it right away. Thanks for the review
Maddy
Quoted 3 lines
Thanks,
Nick