Message ID | 1401692223-28337-2-git-send-email-mikey@neuling.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Hi, > This patch enables POWER8 doorbell IPIs on powernv. > > Since doorbells can only IPI within a core, we test to see when we > can use doorbells and if not we fall back to XICS. This also enables > hypervisor doorbells to wakeup us up from nap/sleep via the LPCR > PECEDH bit. > > Based on tests by Anton, the best case IPI latency between two > threads dropped from 894ns to 512ns. > > Signed-off-by: Michael Neuling <mikey@neuling.org> Thanks Mikey! Tested-by: Anton Blanchard <anton@samba.org> Anton
On Mon, 2014-06-02 at 16:57 +1000, Michael Neuling wrote: > This patch enables POWER8 doorbell IPIs on powernv. > > Since doorbells can only IPI within a core, we test to see when we can use > doorbells and if not we fall back to XICS. This also enables hypervisor > doorbells to wakeup us up from nap/sleep via the LPCR PECEDH bit. > > Based on tests by Anton, the best case IPI latency between two threads dropped > from 894ns to 512ns. > > Signed-off-by: Michael Neuling <mikey@neuling.org> > --- > arch/powerpc/kernel/cpu_setup_power.S | 2 ++ > arch/powerpc/platforms/powernv/smp.c | 6 ++++++ > arch/powerpc/sysdev/xics/icp-native.c | 9 ++++++++- > 3 files changed, 16 insertions(+), 1 deletion(-) > > diff --git a/arch/powerpc/kernel/cpu_setup_power.S b/arch/powerpc/kernel/cpu_setup_power.S > index 1557e7c..4673353 100644 > --- a/arch/powerpc/kernel/cpu_setup_power.S > +++ b/arch/powerpc/kernel/cpu_setup_power.S > @@ -56,6 +56,7 @@ _GLOBAL(__setup_cpu_power8) > li r0,0 > mtspr SPRN_LPID,r0 > mfspr r3,SPRN_LPCR > + ori r3, r3, LPCR_PECEDH > bl __init_LPCR > bl __init_HFSCR > bl __init_tlb_power8 > @@ -74,6 +75,7 @@ _GLOBAL(__restore_cpu_power8) > li r0,0 > mtspr SPRN_LPID,r0 > mfspr r3,SPRN_LPCR > + ori r3, r3, LPCR_PECEDH > bl __init_LPCR > bl __init_HFSCR > bl __init_tlb_power8 > diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c > index 0062a43..5fcfcf4 100644 > --- a/arch/powerpc/platforms/powernv/smp.c > +++ b/arch/powerpc/platforms/powernv/smp.c > @@ -32,6 +32,7 @@ > #include <asm/opal.h> > #include <asm/runlatch.h> > #include <asm/code-patching.h> > +#include <asm/dbell.h> > > #include "powernv.h" > > @@ -46,6 +47,11 @@ static void pnv_smp_setup_cpu(int cpu) > { > if (cpu != boot_cpuid) > xics_setup_cpu(); > + > +#ifdef CONFIG_PPC_DOORBELL > + if (cpu_has_feature(CPU_FTR_DBELL)) > + doorbell_setup_this_cpu(); > +#endif > } Where does CONFIG_PPC_DOORBELL get set? It looks like the only place you can be getting it is from CONFIG_PPC_PSERIES. If you build a POWERNV only kernel it will get disabled, which I don't think is what we want. I think we should select it for POWERNV as well as PSERIES. That would mean it's always enabled for any build of the files you touch, so you shouldn't need the #ifdefs. cheers
On Wed, 2014-06-04 at 18:03 +1000, Michael Ellerman wrote: > On Mon, 2014-06-02 at 16:57 +1000, Michael Neuling wrote: > > This patch enables POWER8 doorbell IPIs on powernv. > > > > Since doorbells can only IPI within a core, we test to see when we can use > > doorbells and if not we fall back to XICS. This also enables hypervisor > > doorbells to wakeup us up from nap/sleep via the LPCR PECEDH bit. > > > > Based on tests by Anton, the best case IPI latency between two threads dropped > > from 894ns to 512ns. > > > > Signed-off-by: Michael Neuling <mikey@neuling.org> > > --- > > arch/powerpc/kernel/cpu_setup_power.S | 2 ++ > > arch/powerpc/platforms/powernv/smp.c | 6 ++++++ > > arch/powerpc/sysdev/xics/icp-native.c | 9 ++++++++- > > 3 files changed, 16 insertions(+), 1 deletion(-) > > > > diff --git a/arch/powerpc/kernel/cpu_setup_power.S b/arch/powerpc/kernel/cpu_setup_power.S > > index 1557e7c..4673353 100644 > > --- a/arch/powerpc/kernel/cpu_setup_power.S > > +++ b/arch/powerpc/kernel/cpu_setup_power.S > > @@ -56,6 +56,7 @@ _GLOBAL(__setup_cpu_power8) > > li r0,0 > > mtspr SPRN_LPID,r0 > > mfspr r3,SPRN_LPCR > > + ori r3, r3, LPCR_PECEDH > > bl __init_LPCR > > bl __init_HFSCR > > bl __init_tlb_power8 > > @@ -74,6 +75,7 @@ _GLOBAL(__restore_cpu_power8) > > li r0,0 > > mtspr SPRN_LPID,r0 > > mfspr r3,SPRN_LPCR > > + ori r3, r3, LPCR_PECEDH > > bl __init_LPCR > > bl __init_HFSCR > > bl __init_tlb_power8 > > diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c > > index 0062a43..5fcfcf4 100644 > > --- a/arch/powerpc/platforms/powernv/smp.c > > +++ b/arch/powerpc/platforms/powernv/smp.c > > @@ -32,6 +32,7 @@ > > #include <asm/opal.h> > > #include <asm/runlatch.h> > > #include <asm/code-patching.h> > > +#include <asm/dbell.h> > > > > #include "powernv.h" > > > > @@ -46,6 +47,11 @@ static void pnv_smp_setup_cpu(int cpu) > > { > > if (cpu != boot_cpuid) > > xics_setup_cpu(); > > + > > +#ifdef CONFIG_PPC_DOORBELL > > + if (cpu_has_feature(CPU_FTR_DBELL)) > > + doorbell_setup_this_cpu(); > > +#endif > > } > > Where does CONFIG_PPC_DOORBELL get set? No where. > It looks like the only place you can be getting it is from CONFIG_PPC_PSERIES. > If you build a POWERNV only kernel it will get disabled, which I don't think is > what we want. > > I think we should select it for POWERNV as well as PSERIES. That would mean > it's always enabled for any build of the files you touch, so you shouldn't need > the #ifdefs. Ok, I'll add and resend. Mikey
diff --git a/arch/powerpc/kernel/cpu_setup_power.S b/arch/powerpc/kernel/cpu_setup_power.S index 1557e7c..4673353 100644 --- a/arch/powerpc/kernel/cpu_setup_power.S +++ b/arch/powerpc/kernel/cpu_setup_power.S @@ -56,6 +56,7 @@ _GLOBAL(__setup_cpu_power8) li r0,0 mtspr SPRN_LPID,r0 mfspr r3,SPRN_LPCR + ori r3, r3, LPCR_PECEDH bl __init_LPCR bl __init_HFSCR bl __init_tlb_power8 @@ -74,6 +75,7 @@ _GLOBAL(__restore_cpu_power8) li r0,0 mtspr SPRN_LPID,r0 mfspr r3,SPRN_LPCR + ori r3, r3, LPCR_PECEDH bl __init_LPCR bl __init_HFSCR bl __init_tlb_power8 diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c index 0062a43..5fcfcf4 100644 --- a/arch/powerpc/platforms/powernv/smp.c +++ b/arch/powerpc/platforms/powernv/smp.c @@ -32,6 +32,7 @@ #include <asm/opal.h> #include <asm/runlatch.h> #include <asm/code-patching.h> +#include <asm/dbell.h> #include "powernv.h" @@ -46,6 +47,11 @@ static void pnv_smp_setup_cpu(int cpu) { if (cpu != boot_cpuid) xics_setup_cpu(); + +#ifdef CONFIG_PPC_DOORBELL + if (cpu_has_feature(CPU_FTR_DBELL)) + doorbell_setup_this_cpu(); +#endif } int pnv_smp_kick_cpu(int nr) diff --git a/arch/powerpc/sysdev/xics/icp-native.c b/arch/powerpc/sysdev/xics/icp-native.c index 9dee470..de8d948 100644 --- a/arch/powerpc/sysdev/xics/icp-native.c +++ b/arch/powerpc/sysdev/xics/icp-native.c @@ -26,6 +26,7 @@ #include <asm/errno.h> #include <asm/xics.h> #include <asm/kvm_ppc.h> +#include <asm/dbell.h> struct icp_ipl { union { @@ -145,7 +146,13 @@ static unsigned int icp_native_get_irq(void) static void icp_native_cause_ipi(int cpu, unsigned long data) { kvmppc_set_host_ipi(cpu, 1); - icp_native_set_qirr(cpu, IPI_PRIORITY); +#ifdef CONFIG_PPC_DOORBELL + if (cpu_has_feature(CPU_FTR_DBELL) && + (cpumask_test_cpu(cpu, cpu_sibling_mask(smp_processor_id())))) + doorbell_cause_ipi(cpu, data); + else +#endif + icp_native_set_qirr(cpu, IPI_PRIORITY); } void xics_wake_cpu(int cpu)
This patch enables POWER8 doorbell IPIs on powernv. Since doorbells can only IPI within a core, we test to see when we can use doorbells and if not we fall back to XICS. This also enables hypervisor doorbells to wakeup us up from nap/sleep via the LPCR PECEDH bit. Based on tests by Anton, the best case IPI latency between two threads dropped from 894ns to 512ns. Signed-off-by: Michael Neuling <mikey@neuling.org> --- arch/powerpc/kernel/cpu_setup_power.S | 2 ++ arch/powerpc/platforms/powernv/smp.c | 6 ++++++ arch/powerpc/sysdev/xics/icp-native.c | 9 ++++++++- 3 files changed, 16 insertions(+), 1 deletion(-)