Message ID | 1469458342-26233-9-git-send-email-maddy@linux.vnet.ibm.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
On Mon, 25 Jul 2016 20:22:21 +0530 Madhavan Srinivasan <maddy@linux.vnet.ibm.com> wrote: > Code to replay the Performance Monitoring Interrupts(PMI). > In the masked_interrupt handler, for PMIs we reset the MSR[EE] > and return. This is due the fact that PMIs are level triggered. > In the __check_irq_replay(), we enabled the MSR[EE] which will > fire the interrupt for us. > > Patch also adds a new arch_local_irq_disable_var() variant. New > variant takes an input value to write to the paca->soft_enabled. > This will be used in following patch to implement the tri-state > value for soft-enabled. Same comment also applies about patches being standalone transformations that work before and after. Some of these can be squashed together I think. > Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> > --- > arch/powerpc/include/asm/hw_irq.h | 14 ++++++++++++++ > arch/powerpc/kernel/irq.c | 9 ++++++++- > 2 files changed, 22 insertions(+), 1 deletion(-) > > diff --git a/arch/powerpc/include/asm/hw_irq.h > b/arch/powerpc/include/asm/hw_irq.h index cc69dde6eb84..863179654452 > 100644 --- a/arch/powerpc/include/asm/hw_irq.h > +++ b/arch/powerpc/include/asm/hw_irq.h > @@ -81,6 +81,20 @@ static inline unsigned long > arch_local_irq_disable(void) return flags; > } > > +static inline unsigned long arch_local_irq_disable_var(int value) > +{ > + unsigned long flags, zero; > + > + asm volatile( > + "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; > +} arch_ function suggests it is arch implementation of a generic kernel function or something. I think our soft interrupt levels are just used in powerpc specific code. The name could also be a little more descriptive. I would have our internal function be something like soft_irq_set_level(), and then the arch disable just sets to the appropriate level as it does today. The PMU disable level could be implemented in powerpc specific header with local_irq_and_pmu_disable() or something like that. Thanks, Nick
On Tuesday 26 July 2016 11:20 AM, Nicholas Piggin wrote: > On Mon, 25 Jul 2016 20:22:21 +0530 > Madhavan Srinivasan <maddy@linux.vnet.ibm.com> wrote: > >> Code to replay the Performance Monitoring Interrupts(PMI). >> In the masked_interrupt handler, for PMIs we reset the MSR[EE] >> and return. This is due the fact that PMIs are level triggered. >> In the __check_irq_replay(), we enabled the MSR[EE] which will >> fire the interrupt for us. >> >> Patch also adds a new arch_local_irq_disable_var() variant. New >> variant takes an input value to write to the paca->soft_enabled. >> This will be used in following patch to implement the tri-state >> value for soft-enabled. > Same comment also applies about patches being standalone > transformations that work before and after. Some of these > can be squashed together I think. Sure. > > >> Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> >> --- >> arch/powerpc/include/asm/hw_irq.h | 14 ++++++++++++++ >> arch/powerpc/kernel/irq.c | 9 ++++++++- >> 2 files changed, 22 insertions(+), 1 deletion(-) >> >> diff --git a/arch/powerpc/include/asm/hw_irq.h >> b/arch/powerpc/include/asm/hw_irq.h index cc69dde6eb84..863179654452 >> 100644 --- a/arch/powerpc/include/asm/hw_irq.h >> +++ b/arch/powerpc/include/asm/hw_irq.h >> @@ -81,6 +81,20 @@ static inline unsigned long >> arch_local_irq_disable(void) return flags; >> } >> >> +static inline unsigned long arch_local_irq_disable_var(int value) >> +{ >> + unsigned long flags, zero; >> + >> + asm volatile( >> + "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; >> +} > arch_ function suggests it is arch implementation of a generic > kernel function or something. I think our soft interrupt levels > are just used in powerpc specific code. > > The name could also be a little more descriptive. > > I would have our internal function be something like > > soft_irq_set_level(), and then the arch disable just sets to > the appropriate level as it does today. > > The PMU disable level could be implemented in powerpc specific > header with local_irq_and_pmu_disable() or something like that. Yes. will do. > > Thanks, > Nick >
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h index cc69dde6eb84..863179654452 100644 --- a/arch/powerpc/include/asm/hw_irq.h +++ b/arch/powerpc/include/asm/hw_irq.h @@ -81,6 +81,20 @@ static inline unsigned long arch_local_irq_disable(void) return flags; } +static inline unsigned long arch_local_irq_disable_var(int value) +{ + unsigned long flags, zero; + + asm volatile( + "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) diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 597c20d1814c..81fe0da1f86d 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c @@ -158,9 +158,16 @@ 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, just enabling the MSR[EE] will do + * trick, since the PMI are "level" triggered. + */ + local_paca->irq_happened &= ~PACA_IRQ_PMI; + /* Finally check if an external interrupt happened */ local_paca->irq_happened &= ~PACA_IRQ_EE; - if (happened & PACA_IRQ_EE) + if ((happened & PACA_IRQ_EE) || (happened & PACA_IRQ_PMI)) return 0x500; #ifdef CONFIG_PPC_BOOK3E
Code to replay the Performance Monitoring Interrupts(PMI). In the masked_interrupt handler, for PMIs we reset the MSR[EE] and return. This is due the fact that PMIs are level triggered. In the __check_irq_replay(), we enabled the MSR[EE] which will fire the interrupt for us. Patch also adds a new arch_local_irq_disable_var() variant. New variant takes an input value to write to the paca->soft_enabled. This will be used in following patch to implement the tri-state value for soft-enabled. Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> --- arch/powerpc/include/asm/hw_irq.h | 14 ++++++++++++++ arch/powerpc/kernel/irq.c | 9 ++++++++- 2 files changed, 22 insertions(+), 1 deletion(-)