[v7, 5/5] mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0
The eSDHC of T4240-R1.0-R2.0 has incorrect vender version and spec version. Acturally the right version numbers should be VVN=0x13 and SVN = 0x1. This patch adds the GUTS driver support for eSDHC driver to get SVR(System version register). And fix host version to avoid that incorrect version numbers break down the ADMA data transfer. Signed-off-by: Yangbo LuAcked-by: Ulf Hansson --- Changes for v2: - Got SVR through iomap instead of dts Changes for v3: - Managed GUTS through syscon instead of iomap in eSDHC driver Changes for v4: - Got SVR by GUTS driver instead of SYSCON Changes for v5: - Changed to get SVR through API fsl_guts_get_svr() - Combined patch 4, patch 5 and patch 6 into one Changes for v6: - Added 'Acked-by: Ulf Hansson' Changes for v7: - None --- drivers/mmc/host/Kconfig | 1 + drivers/mmc/host/sdhci-of-esdhc.c | 23 +++ 2 files changed, 24 insertions(+) diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index 04feea8..5743b05 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -142,6 +142,7 @@ config MMC_SDHCI_OF_ESDHC depends on MMC_SDHCI_PLTFM depends on PPC || ARCH_MXC || ARCH_LAYERSCAPE select MMC_SDHCI_IO_ACCESSORS + select FSL_GUTS help This selects the Freescale eSDHC controller support. diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c index 3f34d35..68cc020 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include #include "sdhci-pltfm.h" #include "sdhci-esdhc.h" @@ -28,6 +30,8 @@ struct sdhci_esdhc { u8 vendor_ver; u8 spec_ver; + u32 soc_ver; + u8 soc_rev; }; /** @@ -73,6 +77,8 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host, static u16 esdhc_readw_fixup(struct sdhci_host *host, int spec_reg, u32 value) { + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host); u16 ret; int shift = (spec_reg & 0x2) * 8; @@ -80,6 +86,13 @@ static u16 esdhc_readw_fixup(struct sdhci_host *host, ret = value & 0x; else ret = (value >> shift) & 0x; + + /* Workaround for T4240-R1.0-R2.0 eSDHC which has incorrect +* vendor version and spec version information. +*/ + if ((spec_reg == SDHCI_HOST_VERSION) && + (esdhc->soc_ver == SVR_T4240) && (esdhc->soc_rev <= 0x20)) + ret = (VENDOR_V_23 << SDHCI_VENDOR_VER_SHIFT) | SDHCI_SPEC_200; return ret; } @@ -567,10 +580,20 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host) struct sdhci_pltfm_host *pltfm_host; struct sdhci_esdhc *esdhc; u16 host_ver; + u32 svr; pltfm_host = sdhci_priv(host); esdhc = sdhci_pltfm_priv(pltfm_host); + fsl_guts_init(); + svr = fsl_guts_get_svr(); + if (svr) { + esdhc->soc_ver = SVR_SOC_VER(svr); + esdhc->soc_rev = SVR_REV(svr); + } else { + dev_err(>dev, "Failed to get SVR value!\n"); + } + host_ver = sdhci_readw(host, SDHCI_HOST_VERSION); esdhc->vendor_ver = (host_ver & SDHCI_VENDOR_VER_MASK) >> SDHCI_VENDOR_VER_SHIFT; -- 2.1.0.27.g96db324 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[v7, 2/5] soc: fsl: add GUTS driver for QorIQ platforms
The global utilities block controls power management, I/O device enabling, power-onreset(POR) configuration monitoring, alternate function selection for multiplexed signals,and clock control. This patch adds GUTS driver to manage and access global utilities block. Signed-off-by: Yangbo Lu--- Changes for v2: - None Changes for v3: - None Changes for v4: - Added this patch Changes for v5: - Modified copyright info - Changed MODULE_LICENSE to GPL - Changed EXPORT_SYMBOL_GPL to EXPORT_SYMBOL - Made FSL_GUTS user-invisible - Added a complete compatible list for GUTS - Stored guts info in file-scope variable - Added mfspr() getting SVR - Redefined GUTS APIs - Called fsl_guts_init rather than using platform driver - Removed useless parentheses - Removed useless 'extern' key words Changes for v6: - Made guts thread safe in fsl_guts_init Changes for v7: - Removed 'ifdef' for function declaration in guts.h --- drivers/soc/Kconfig | 2 +- drivers/soc/fsl/Kconfig | 8 drivers/soc/fsl/Makefile | 1 + drivers/soc/fsl/guts.c | 119 +++ include/linux/fsl/guts.h | 98 +++--- 5 files changed, 179 insertions(+), 49 deletions(-) create mode 100644 drivers/soc/fsl/Kconfig create mode 100644 drivers/soc/fsl/guts.c diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig index cb58ef0..7106463 100644 --- a/drivers/soc/Kconfig +++ b/drivers/soc/Kconfig @@ -2,7 +2,7 @@ menu "SOC (System On Chip) specific Drivers" source "drivers/soc/bcm/Kconfig" source "drivers/soc/brcmstb/Kconfig" -source "drivers/soc/fsl/qe/Kconfig" +source "drivers/soc/fsl/Kconfig" source "drivers/soc/mediatek/Kconfig" source "drivers/soc/qcom/Kconfig" source "drivers/soc/rockchip/Kconfig" diff --git a/drivers/soc/fsl/Kconfig b/drivers/soc/fsl/Kconfig new file mode 100644 index 000..b313759 --- /dev/null +++ b/drivers/soc/fsl/Kconfig @@ -0,0 +1,8 @@ +# +# Freescale SOC drivers +# + +source "drivers/soc/fsl/qe/Kconfig" + +config FSL_GUTS + bool diff --git a/drivers/soc/fsl/Makefile b/drivers/soc/fsl/Makefile index 203307f..02afb7f 100644 --- a/drivers/soc/fsl/Makefile +++ b/drivers/soc/fsl/Makefile @@ -4,3 +4,4 @@ obj-$(CONFIG_QUICC_ENGINE) += qe/ obj-$(CONFIG_CPM) += qe/ +obj-$(CONFIG_FSL_GUTS) += guts.o diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c new file mode 100644 index 000..fa155e6 --- /dev/null +++ b/drivers/soc/fsl/guts.c @@ -0,0 +1,119 @@ +/* + * Freescale QorIQ Platforms GUTS Driver + * + * Copyright (C) 2016 Freescale Semiconductor, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include + +struct guts { + struct ccsr_guts __iomem *regs; + bool little_endian; +}; + +static struct guts *guts; +static DEFINE_MUTEX(guts_lock); + +u32 fsl_guts_get_svr(void) +{ + u32 svr = 0; + + if (!guts || !guts->regs) { +#ifdef CONFIG_PPC + svr = mfspr(SPRN_SVR); +#endif + return svr; + } + + if (guts->little_endian) + svr = ioread32(>regs->svr); + else + svr = ioread32be(>regs->svr); + + return svr; +} +EXPORT_SYMBOL(fsl_guts_get_svr); + +/* + * Table for matching compatible strings, for device tree + * guts node, for Freescale QorIQ SOCs. + */ +static const struct of_device_id guts_of_match[] = { + /* For T4 & B4 Series SOCs */ + { .compatible = "fsl,qoriq-device-config-1.0", }, + /* For P Series SOCs */ + { .compatible = "fsl,qoriq-device-config-2.0", }, + { .compatible = "fsl,p1010-guts", }, + { .compatible = "fsl,p1020-guts", }, + { .compatible = "fsl,p1021-guts", }, + { .compatible = "fsl,p1022-guts", }, + { .compatible = "fsl,p1023-guts", }, + { .compatible = "fsl,p2020-guts", }, + /* For BSC Series SOCs */ + { .compatible = "fsl,bsc9131-guts", }, + { .compatible = "fsl,bsc9132-guts", }, + /* For MPC85xx Series SOCs */ + { .compatible = "fsl,mpc8536-guts", }, + { .compatible = "fsl,mpc8544-guts", }, + { .compatible = "fsl,mpc8548-guts", }, + { .compatible = "fsl,mpc8568-guts", }, + { .compatible = "fsl,mpc8569-guts", }, + { .compatible = "fsl,mpc8572-guts", }, + /* For Layerscape Series SOCs */ + { .compatible = "fsl,ls1021a-dcfg", }, + { .compatible = "fsl,ls1043a-dcfg", }, + { .compatible = "fsl,ls2080a-dcfg", }, + {} +}; + +int fsl_guts_init(void) +{ + struct device_node *np; +
[v7, 1/5] ARM64: dts: ls2080a: add device configuration node
Add the dts node for device configuration unit that provides general purpose configuration and status for the device. Signed-off-by: Yangbo Lu--- Changes for v2: - None Changes for v3: - None Changes for v4: - None Changes for v5: - Added this patch Changes for v6: - None Changes for v7: - None --- arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi index 9d746c6..8724cf1 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi @@ -191,6 +191,12 @@ clocks = <>; }; + dcfg: dcfg@1e0 { + compatible = "fsl,ls2080a-dcfg", "syscon"; + reg = <0x0 0x1e0 0x0 0x1>; + little-endian; + }; + serial0: serial@21c0500 { compatible = "fsl,ns16550", "ns16550a"; reg = <0x0 0x21c0500 0x0 0x100>; -- 2.1.0.27.g96db324 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[v7, 0/5] Fix eSDHC host version register bug
This patchset is used to fix a host version register bug in the T4240-R1.0-R2.0 eSDHC controller. To get the SoC version and revision, it's needed to add the GUTS driver to access the global utilities registers. So, the first three patches are to add the GUTS driver. The following two patches are to enable GUTS driver support to get SVR in eSDHC driver and fix host version for T4240. Yangbo Lu (5): ARM64: dts: ls2080a: add device configuration node soc: fsl: add GUTS driver for QorIQ platforms dt: move guts devicetree doc out of powerpc directory powerpc/fsl: move mpc85xx.h to include/linux/fsl mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0 .../bindings/{powerpc => soc}/fsl/guts.txt | 3 + arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi | 6 ++ arch/powerpc/kernel/cpu_setup_fsl_booke.S | 2 +- drivers/clk/clk-qoriq.c| 3 +- drivers/i2c/busses/i2c-mpc.c | 2 +- drivers/iommu/fsl_pamu.c | 3 +- drivers/mmc/host/Kconfig | 1 + drivers/mmc/host/sdhci-of-esdhc.c | 23 drivers/net/ethernet/freescale/gianfar.c | 2 +- drivers/soc/Kconfig| 2 +- drivers/soc/fsl/Kconfig| 8 ++ drivers/soc/fsl/Makefile | 1 + drivers/soc/fsl/guts.c | 119 + include/linux/fsl/guts.h | 98 - .../asm/mpc85xx.h => include/linux/fsl/svr.h | 4 +- 15 files changed, 219 insertions(+), 58 deletions(-) rename Documentation/devicetree/bindings/{powerpc => soc}/fsl/guts.txt (91%) create mode 100644 drivers/soc/fsl/Kconfig create mode 100644 drivers/soc/fsl/guts.c rename arch/powerpc/include/asm/mpc85xx.h => include/linux/fsl/svr.h (97%) -- 2.1.0.27.g96db324 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] ftrace: filter: Match dot symbols when searching functions on ppc64.
In the ppc64 big endian ABI, function symbols point to function descriptors. The symbols which point to the function entry points have a dot in front of the function name. Consequently, when the ftrace filter mechanism searches for the symbol corresponding to an entry point address, it gets the dot symbol. As a result, ftrace filter users have to be aware of this ABI detail on ppc64 and prepend a dot to the function name when setting the filter. The perf probe command insulates the user from this by ignoring the dot in front of the symbol name when matching function names to symbols, but the sysfs interface does not. This patch makes the ftrace filter mechanism do the same when searching symbols. Fixes the following failure in ftracetest's kprobe_ftrace.tc: .../kprobe_ftrace.tc: line 9: echo: write error: Invalid argument That failure is on this line of kprobe_ftrace.tc: echo _do_fork > set_ftrace_filter This is because there's no _do_fork entry in the functions list: # cat available_filter_functions | grep _do_fork ._do_fork This change introduces no regressions on the perf and ftracetest testsuite results. Cc: Steven RostedtCc: Ingo Molnar Cc: Michael Ellerman Signed-off-by: Thiago Jung Bauermann --- arch/powerpc/include/asm/ftrace.h | 9 + kernel/trace/ftrace.c | 13 + 2 files changed, 22 insertions(+) diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm/ftrace.h index 50ca7585abe2..68f1858796c6 100644 --- a/arch/powerpc/include/asm/ftrace.h +++ b/arch/powerpc/include/asm/ftrace.h @@ -58,6 +58,15 @@ struct dyn_arch_ftrace { struct module *mod; }; #endif /* CONFIG_DYNAMIC_FTRACE */ + +#if CONFIG_PPC64 && (!defined(_CALL_ELF) || _CALL_ELF != 2) +#define ARCH_HAS_FTRACE_MATCH_ADJUST +static inline void arch_ftrace_match_adjust(char **str, char *search) +{ + if ((*str)[0] == '.' && search[0] != '.') + (*str)++; +} +#endif /* CONFIG_PPC64 && (!defined(_CALL_ELF) || _CALL_ELF != 2) */ #endif /* __ASSEMBLY__ */ #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index b1870fbd2b67..e806c2a3b7a8 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -3444,11 +3444,24 @@ struct ftrace_glob { int type; }; +#ifndef ARCH_HAS_FTRACE_MATCH_ADJUST +/* + * If symbols in an architecture don't correspond exactly to the user-visible + * name of what they represent, it is possible to define this function to + * perform the necessary adjustments. +*/ +static inline void arch_ftrace_match_adjust(char **str, char *search) +{ +} +#endif + static int ftrace_match(char *str, struct ftrace_glob *g) { int matched = 0; int slen; + arch_ftrace_match_adjust(, g->search); + switch (g->type) { case MATCH_FULL: if (strcmp(str, g->search) == 0) -- 1.9.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[v7, 4/5] powerpc/fsl: move mpc85xx.h to include/linux/fsl
Move mpc85xx.h to include/linux/fsl and rename it to svr.h as a common header file. It has been used for mpc85xx and it will be used for ARM-based SoC as well. Signed-off-by: Yangbo LuAcked-by: Wolfram Sang --- Changes for v2: - None Changes for v3: - None Changes for v4: - None Changes for v5: - Changed to Move mpc85xx.h to include/linux/fsl/ - Adjusted '#include ' position in file Changes for v6: - None Changes for v7: - Added 'Acked-by: Wolfram Sang' for I2C part - Also applied to arch/powerpc/kernel/cpu_setup_fsl_booke.S --- arch/powerpc/kernel/cpu_setup_fsl_booke.S | 2 +- drivers/clk/clk-qoriq.c | 3 +-- drivers/i2c/busses/i2c-mpc.c | 2 +- drivers/iommu/fsl_pamu.c | 3 +-- drivers/net/ethernet/freescale/gianfar.c | 2 +- arch/powerpc/include/asm/mpc85xx.h => include/linux/fsl/svr.h | 4 ++-- 6 files changed, 7 insertions(+), 9 deletions(-) rename arch/powerpc/include/asm/mpc85xx.h => include/linux/fsl/svr.h (97%) diff --git a/arch/powerpc/kernel/cpu_setup_fsl_booke.S b/arch/powerpc/kernel/cpu_setup_fsl_booke.S index 462aed9..2b0284e 100644 --- a/arch/powerpc/kernel/cpu_setup_fsl_booke.S +++ b/arch/powerpc/kernel/cpu_setup_fsl_booke.S @@ -13,13 +13,13 @@ * */ +#include #include #include #include #include #include #include -#include _GLOBAL(__e500_icache_setup) mfspr r0, SPRN_L1CSR1 diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c index 7bc1c45..fc7f722 100644 --- a/drivers/clk/clk-qoriq.c +++ b/drivers/clk/clk-qoriq.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -1148,8 +1149,6 @@ bad_args: } #ifdef CONFIG_PPC -#include - static const u32 a4510_svrs[] __initconst = { (SVR_P2040 << 8) | 0x10,/* P2040 1.0 */ (SVR_P2040 << 8) | 0x11,/* P2040 1.1 */ diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index 48ecffe..600704c 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c @@ -27,9 +27,9 @@ #include #include #include +#include #include -#include #include #define DRV_NAME "mpc-i2c" diff --git a/drivers/iommu/fsl_pamu.c b/drivers/iommu/fsl_pamu.c index a34355f..af8fb27 100644 --- a/drivers/iommu/fsl_pamu.c +++ b/drivers/iommu/fsl_pamu.c @@ -21,11 +21,10 @@ #include "fsl_pamu.h" #include +#include #include #include -#include - /* define indexes for each operation mapping scenario */ #define OMI_QMAN0x00 #define OMI_FMAN0x01 diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index d2f917a..2224b10 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -86,11 +86,11 @@ #include #include #include +#include #include #ifdef CONFIG_PPC #include -#include #endif #include #include diff --git a/arch/powerpc/include/asm/mpc85xx.h b/include/linux/fsl/svr.h similarity index 97% rename from arch/powerpc/include/asm/mpc85xx.h rename to include/linux/fsl/svr.h index 213f3a8..8d13836 100644 --- a/arch/powerpc/include/asm/mpc85xx.h +++ b/include/linux/fsl/svr.h @@ -9,8 +9,8 @@ * (at your option) any later version. */ -#ifndef __ASM_PPC_MPC85XX_H -#define __ASM_PPC_MPC85XX_H +#ifndef FSL_SVR_H +#define FSL_SVR_H #define SVR_REV(svr) ((svr) & 0xFF) /* SOC design resision */ #define SVR_MAJ(svr) (((svr) >> 4) & 0xF) /* Major revision field*/ -- 2.1.0.27.g96db324 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[v7, 3/5] dt: move guts devicetree doc out of powerpc directory
Move guts devicetree doc to Documentation/devicetree/bindings/soc/fsl/ since it's used by not only PowerPC but also ARM. And add a specification for 'little-endian' property. Signed-off-by: Yangbo Lu--- Changes for v2: - None Changes for v3: - None Changes for v4: - Added this patch Changes for v5: - Modified the description for little-endian property Changes for v6: - None Changes for v7: - None --- Documentation/devicetree/bindings/{powerpc => soc}/fsl/guts.txt | 3 +++ 1 file changed, 3 insertions(+) rename Documentation/devicetree/bindings/{powerpc => soc}/fsl/guts.txt (91%) diff --git a/Documentation/devicetree/bindings/powerpc/fsl/guts.txt b/Documentation/devicetree/bindings/soc/fsl/guts.txt similarity index 91% rename from Documentation/devicetree/bindings/powerpc/fsl/guts.txt rename to Documentation/devicetree/bindings/soc/fsl/guts.txt index b71b203..07adca9 100644 --- a/Documentation/devicetree/bindings/powerpc/fsl/guts.txt +++ b/Documentation/devicetree/bindings/soc/fsl/guts.txt @@ -25,6 +25,9 @@ Recommended properties: - fsl,liodn-bits : Indicates the number of defined bits in the LIODN registers, for those SOCs that have a PAMU device. + - little-endian : Indicates that the global utilities block is little + endian. The default is big endian. + Examples: global-utilities@e {/* global utilities block */ compatible = "fsl,mpc8548-guts"; -- 2.1.0.27.g96db324 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc: ppc4xx: drop unused variable
On Thu, 2016-03-31 at 14:57 +0200, Linus Walleij wrote: > On Thu, Mar 31, 2016 at 12:09 PM, Michael Ellerman> wrote: > > > If you feel like cross building powerpc in future it should be as simple as: > > > > $ dnf install gcc-powerpc64-linux-gnu || apt-get install > > gcc-powerpc-linux-gnu > > $ make ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu- ... > > Ah hm yeah I guess everyone "should", it's just that these days I > mainly rely on Fenguang's kautobuild to do this job for me and > get back with the result from a plethora of arches. Sure. That makes sense for all the silly little architectures. But for powerpc you should really cross compile. .. :P > Sometimes a buggy bit slips through the cracks though, sorry > about that. No stress. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 6/6] powerpc/livepatch: Add live patching support on ppc64le
On 24/03/16 22:04, Michael Ellerman wrote: > Add the kconfig logic & assembly support for handling live patched > functions. This depends on DYNAMIC_FTRACE_WITH_REGS, which in turn > depends on the new -mprofile-kernel ftrace ABI, which is only supported > currently on ppc64le. > > Live patching is handled by a special ftrace handler. This means it runs > from ftrace_caller(). The live patch handler modifies the NIP so as to > redirect the return from ftrace_caller() to the new patched function. > > However there is one particularly tricky case we need to handle. > > If a function A calls another function B, and it is known at link time > that they share the same TOC, then A will not save or restore its TOC, > and will call the local entry point of B. > > When we live patch B, we replace it with a new function C, which may > not have the same TOC as A. At live patch time it's too late to modify A > to do the TOC save/restore, so the live patching code must interpose > itself between A and C, and do the TOC save/restore that A omitted. > > An additionaly complication is that the livepatch code can not create a > stack frame in order to save the TOC. That is because if C takes > 8 > arguments, or is varargs, A will have written the arguments for C in > A's stack frame. > > To solve this, we introduce a "livepatch stack" which grows upward from > the base of the regular stack, and is used to store the TOC & LR when > calling a live patched function. > > When the patched function returns, we retrieve the real LR & TOC from > the livepatch stack, restore them, and pop the livepatch "stack frame". > > Signed-off-by: Michael Ellerman> Reviewed-by: Balbir Singh ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 5/6] powerpc/livepatch: Add livepatch stack to struct thread_info
On 24/03/16 22:04, Michael Ellerman wrote: > In order to support live patching we need to maintain an alternate > stack of TOC & LR values. We use the base of the stack for this, and > store the "live patch stack pointer" in struct thread_info. > > Unlike the other fields of thread_info, we can not statically initialise > that value, so it must be done at run time. > > This patch just adds the code to support that, it is not enabled until > the next patch which actually adds live patch support. > > Signed-off-by: Michael Ellerman> --- > arch/powerpc/include/asm/livepatch.h | 8 > arch/powerpc/include/asm/thread_info.h | 4 +++- > arch/powerpc/kernel/irq.c | 3 +++ > arch/powerpc/kernel/process.c | 6 +- > arch/powerpc/kernel/setup_64.c | 17 ++--- > 5 files changed, 29 insertions(+), 9 deletions(-) > > Acked-by: Balbir Singh ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 3/4] samples/bpf: Simplify building BPF samples
On 3/31/16 11:51 AM, Naveen N. Rao wrote: On 2016/03/31 10:49AM, Alexei Starovoitov wrote: On 3/31/16 4:25 AM, Naveen N. Rao wrote: Make BPF samples build depend on CONFIG_SAMPLE_BPF. We still don't add a Kconfig option since that will add a dependency on llvm for allyesconfig builds which may not be desirable. Those who need to build the BPF samples can now just do: make CONFIG_SAMPLE_BPF=y or: export CONFIG_SAMPLE_BPF=y make I don't like this 'simplification'. make samples/bpf/ is much easier to type than capital letters. This started out as a patch to have the BPF samples built with a Kconfig option. As stated in the commit description, I realised that it won't work for allyesconfig builds. However, the reason I retained this patch is since it gets us one step closer to building the samples as part of the kernel build. The 'simplification' is since I can now have the export in my .bashrc and the kernel build will now build the BPF samples too without requiring an additional 'make samples/bpf/' step. I agree this is subjective, so I am ok if this isn't taken in. If you can change it that 'make samples/bpf/' still works then it would be fine. As it is it breaks our testing setup. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/4] samples/bpf: Fix build breakage with map_perf_test_user.c
On 3/31/16 11:46 AM, Naveen N. Rao wrote: It's failing this way on powerpc? Odd. This fails for me on x86_64 too -- RHEL 7.1. indeed. fails on centos 7.1, whereas centos 6.7 is fine. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 3/4] samples/bpf: Simplify building BPF samples
On 3/31/16 4:25 AM, Naveen N. Rao wrote: Make BPF samples build depend on CONFIG_SAMPLE_BPF. We still don't add a Kconfig option since that will add a dependency on llvm for allyesconfig builds which may not be desirable. Those who need to build the BPF samples can now just do: make CONFIG_SAMPLE_BPF=y or: export CONFIG_SAMPLE_BPF=y make I don't like this 'simplification'. make samples/bpf/ is much easier to type than capital letters. diff --git a/samples/Makefile b/samples/Makefile index 48001d7..3c77fc8 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -2,4 +2,4 @@ obj-$(CONFIG_SAMPLES) += kobject/ kprobes/ trace_events/ livepatch/ \ hw_breakpoint/ kfifo/ kdb/ hidraw/ rpmsg/ seccomp/ \ - configfs/ + configfs/ bpf/ diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 88bc5a0..bc5b675 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -2,23 +2,23 @@ obj- := dummy.o # List of programs to build -hostprogs-y := test_verifier test_maps -hostprogs-y += sock_example -hostprogs-y += fds_example -hostprogs-y += sockex1 -hostprogs-y += sockex2 -hostprogs-y += sockex3 -hostprogs-y += tracex1 -hostprogs-y += tracex2 -hostprogs-y += tracex3 -hostprogs-y += tracex4 -hostprogs-y += tracex5 -hostprogs-y += tracex6 -hostprogs-y += trace_output -hostprogs-y += lathist -hostprogs-y += offwaketime -hostprogs-y += spintest -hostprogs-y += map_perf_test +hostprogs-$(CONFIG_SAMPLE_BPF) := test_verifier test_maps +hostprogs-$(CONFIG_SAMPLE_BPF) += sock_example +hostprogs-$(CONFIG_SAMPLE_BPF) += fds_example +hostprogs-$(CONFIG_SAMPLE_BPF) += sockex1 +hostprogs-$(CONFIG_SAMPLE_BPF) += sockex2 +hostprogs-$(CONFIG_SAMPLE_BPF) += sockex3 +hostprogs-$(CONFIG_SAMPLE_BPF) += tracex1 +hostprogs-$(CONFIG_SAMPLE_BPF) += tracex2 +hostprogs-$(CONFIG_SAMPLE_BPF) += tracex3 +hostprogs-$(CONFIG_SAMPLE_BPF) += tracex4 +hostprogs-$(CONFIG_SAMPLE_BPF) += tracex5 +hostprogs-$(CONFIG_SAMPLE_BPF) += tracex6 +hostprogs-$(CONFIG_SAMPLE_BPF) += trace_output +hostprogs-$(CONFIG_SAMPLE_BPF) += lathist +hostprogs-$(CONFIG_SAMPLE_BPF) += offwaketime +hostprogs-$(CONFIG_SAMPLE_BPF) += spintest +hostprogs-$(CONFIG_SAMPLE_BPF) += map_perf_test test_verifier-objs := test_verifier.o libbpf.o test_maps-objs := test_maps.o libbpf.o @@ -39,8 +39,8 @@ offwaketime-objs := bpf_load.o libbpf.o offwaketime_user.o spintest-objs := bpf_load.o libbpf.o spintest_user.o map_perf_test-objs := bpf_load.o libbpf.o map_perf_test_user.o -# Tell kbuild to always build the programs -always := $(hostprogs-y) +ifdef CONFIG_SAMPLE_BPF +always := $(hostprogs-$(CONFIG_SAMPLE_BPF)) always += sockex1_kern.o always += sockex2_kern.o always += sockex3_kern.o @@ -56,6 +56,7 @@ always += lathist_kern.o always += offwaketime_kern.o always += spintest_kern.o always += map_perf_test_kern.o +endif HOSTCFLAGS += -I$(objtree)/usr/include ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 2/4] samples/bpf: Use llc in PATH, rather than a hardcoded value
On 3/31/16 4:25 AM, Naveen N. Rao wrote: While at it, fix some typos in the comment. Cc: Alexei StarovoitovCc: David S. Miller Cc: Ananth N Mavinakayanahalli Cc: Michael Ellerman Signed-off-by: Naveen N. Rao --- samples/bpf/Makefile | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 502c9fc..88bc5a0 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -76,16 +76,13 @@ HOSTLOADLIBES_offwaketime += -lelf HOSTLOADLIBES_spintest += -lelf HOSTLOADLIBES_map_perf_test += -lelf -lrt -# point this to your LLVM backend with bpf support -LLC=$(srctree)/tools/bpf/llvm/bld/Debug+Asserts/bin/llc - -# asm/sysreg.h inline assmbly used by it is incompatible with llvm. -# But, ehere is not easy way to fix it, so just exclude it since it is +# asm/sysreg.h - inline assembly used by it is incompatible with llvm. +# But, there is no easy way to fix it, so just exclude it since it is # useless for BPF samples. $(obj)/%.o: $(src)/%.c clang $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) \ -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \ - -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=obj -o $@ + -O2 -emit-llvm -c $< -o -| llc -march=bpf -filetype=obj -o $@ clang $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) \ -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \ - -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=asm -o $@.s + -O2 -emit-llvm -c $< -o -| llc -march=bpf -filetype=asm -o $@.s that was a workaround when clang/llvm didn't have bpf support. Now clang 3.7 and 3.8 have bpf built-in, so make sense to remove manual calls to llc completely. Just use 'clang -target bpf -O2 -D... -c $< -o $@' ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/4] samples/bpf: Fix build breakage with map_perf_test_user.c
On 3/31/16 4:25 AM, Naveen N. Rao wrote: Building BPF samples is failing with the below error: samples/bpf/map_perf_test_user.c: In function ‘main’: samples/bpf/map_perf_test_user.c:134:9: error: variable ‘r’ has initializer but incomplete type struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY}; ^ Fix this by including the necessary header file. Cc: Alexei StarovoitovCc: David S. Miller Cc: Ananth N Mavinakayanahalli Cc: Michael Ellerman Signed-off-by: Naveen N. Rao --- samples/bpf/map_perf_test_user.c | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/bpf/map_perf_test_user.c b/samples/bpf/map_perf_test_user.c index 95af56e..3147377 100644 --- a/samples/bpf/map_perf_test_user.c +++ b/samples/bpf/map_perf_test_user.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "libbpf.h" #include "bpf_load.h" It's failing this way on powerpc? Odd. Such hidden header dependency was always puzzling to me. Anyway: Acked-by: Alexei Starovoitov I'm assuming you want this set to go via 'net' tree, so please resubmit with [PATCH net 1/4] subjects and cc netdev. Reviewing your other patches... ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 4/4] samples/bpf: Enable powerpc support
On 3/31/16 4:25 AM, Naveen N. Rao wrote: Add the necessary definitions for building bpf samples on ppc. Since ppc doesn't store function return address on the stack, modify how PT_REGS_RET() and PT_REGS_FP() work. Also, introduce PT_REGS_IP() to access the instruction pointer. I have fixed this to work with x86_64 and arm64, but not s390. Cc: Alexei StarovoitovCc: David S. Miller Cc: Ananth N Mavinakayanahalli Cc: Michael Ellerman Signed-off-by: Naveen N. Rao --- ... + +#ifdef __powerpc__ +#define BPF_KPROBE_READ_RET_IP(ip, ctx){ (ip) = (ctx)->link; } +#define BPF_KRETPROBE_READ_RET_IP(ip, ctx) BPF_KPROBE_READ_RET_IP(ip, ctx) +#else +#define BPF_KPROBE_READ_RET_IP(ip, ctx) \ + bpf_probe_read(&(ip), sizeof(ip), (void *)PT_REGS_RET(ctx)) +#define BPF_KRETPROBE_READ_RET_IP(ip, ctx) \ + bpf_probe_read(&(ip), sizeof(ip), \ + (void *)(PT_REGS_FP(ctx) + sizeof(ip))) makes sense, but please use ({ }) gcc extension instead of {} and open call to make sure that macro body is scoped. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] Remove kretprobe_trampoline_holder.
Am Donnerstag, 31 März 2016, 13:53:11 schrieb Naveen N. Rao: > You should indent the above output -- in this specific case, the start > marker interferes with git am. > > Apart from that, I have tested this patch and kretprobe works fine. A > minor nit I had is that we end up with a non-dot function in .text > without a corresponding function descriptor for kretprobe_trampoline. > But, since this is a trampoline, I think that is good. So, for this > patch: > Reviewed-by: Naveen N. RaoThanks for the tips and the review. I fixed the issue you mentioned and sent a new patch with your Reviewed-by. Also thanks for fixing the vmlinux-kallsyms issue in ppc64le. I didn’t comment on the patches because I’m not very familiar with the code in question. -- []'s Thiago Jung Bauermann IBM Linux Technology Center ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc/kprobes: Remove kretprobe_trampoline_holder.
Fixes the following testsuite failure: $ sudo ./perf test -v kallsyms 1: vmlinux symtab matches kallsyms : --- start --- test child forked, pid 12489 Using /proc/kcore for kernel object code Looking at the vmlinux_path (8 entries long) Using /boot/vmlinux for symbols 0xc003d300: diff name v: .kretprobe_trampoline_holder k: kretprobe_trampoline Maps only in vmlinux: c086ca38-c0879b6c 87ca38 [kernel].text.unlikely c0879b6c-c0bf 889b6c [kernel].meminit.text c0bf-c0c53264 c0 [kernel].init.text c0c53264-d425 c63264 [kernel].exit.text d425-d445 0 [libcrc32c] d445-d462 0 [xfs] d462-d468 0 [autofs4] d468-d46e 0 [x_tables] d46e-d478 0 [ip_tables] d478-d47e 0 [rng_core] d47e- 0 [pseries_rng] Maps in vmlinux with a different name in kallsyms: Maps only in kallsyms: d000-f000 1001 [kernel.kallsyms] f000- 3001 [kernel.kallsyms] test child finished with -1 end vmlinux symtab matches kallsyms: FAILED! The problem is that the kretprobe_trampoline symbol looks like this: $ eu-readelf -s /boot/vmlinux G kretprobe_trampoline 2431: c1302368 24 NOTYPE LOCAL DEFAULT 37 kretprobe_trampoline_holder 2432: c003d300 8 FUNCLOCAL DEFAULT1 .kretprobe_trampoline_holder 97543: c003d300 0 NOTYPE GLOBAL DEFAULT1 kretprobe_trampoline Its type is NOTYPE, and its size is 0, and this is a problem because symbol-elf.c:dso__load_sym skips function symbols that are not STT_FUNC or STT_GNU_IFUNC (this is determined by elf_sym__is_function). Even if the type is changed to STT_FUNC, when dso__load_sym calls symbols__fixup_duplicate, the kretprobe_trampoline symbol is dropped in favour of .kretprobe_trampoline_holder because the latter has non-zero size (as determined by choose_best_symbol). With this patch, all vmlinux symbols match /proc/kallsyms and the testcase passes. Commit c1c355ce14c0 ("x86/kprobes: Get rid of kretprobe_trampoline_holder()") gets rid of kretprobe_trampoline_holder altogether on x86. This commit does the same on powerpc. This change introduces no regressions on the perf and ftracetest testsuite results. Cc: Ananth N MavinakayanahalliCc: Michael Ellerman Reviewed-by: Naveen N. Rao Signed-off-by: Thiago Jung Bauermann --- arch/powerpc/kernel/kprobes.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index 7c053f281406..417c0eadd094 100644 --- a/arch/powerpc/kernel/kprobes.c +++ b/arch/powerpc/kernel/kprobes.c @@ -278,12 +278,11 @@ no_kprobe: * - When the probed function returns, this probe * causes the handlers to fire */ -static void __used kretprobe_trampoline_holder(void) -{ - asm volatile(".global kretprobe_trampoline\n" - "kretprobe_trampoline:\n" - "nop\n"); -} +asm(".global kretprobe_trampoline\n" + ".type kretprobe_trampoline, @function\n" + "kretprobe_trampoline:\n" + "nop\n" + ".size kretprobe_trampoline, .-kretprobe_trampoline\n"); /* * Called when the probe at kretprobe trampoline is hit -- 1.9.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 3/4] samples/bpf: Simplify building BPF samples
On 2016/03/31 10:49AM, Alexei Starovoitov wrote: > On 3/31/16 4:25 AM, Naveen N. Rao wrote: > >Make BPF samples build depend on CONFIG_SAMPLE_BPF. We still don't add a > >Kconfig option since that will add a dependency on llvm for allyesconfig > >builds which may not be desirable. > > > >Those who need to build the BPF samples can now just do: > > > >make CONFIG_SAMPLE_BPF=y > > > >or: > > > >export CONFIG_SAMPLE_BPF=y > >make > > I don't like this 'simplification'. > make samples/bpf/ > is much easier to type than capital letters. This started out as a patch to have the BPF samples built with a Kconfig option. As stated in the commit description, I realised that it won't work for allyesconfig builds. However, the reason I retained this patch is since it gets us one step closer to building the samples as part of the kernel build. The 'simplification' is since I can now have the export in my .bashrc and the kernel build will now build the BPF samples too without requiring an additional 'make samples/bpf/' step. I agree this is subjective, so I am ok if this isn't taken in. - Naveen ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/4] samples/bpf: Fix build breakage with map_perf_test_user.c
On 2016/03/31 10:43AM, Alexei Starovoitov wrote: > On 3/31/16 4:25 AM, Naveen N. Rao wrote: > >Building BPF samples is failing with the below error: > > > >samples/bpf/map_perf_test_user.c: In function ‘main’: > >samples/bpf/map_perf_test_user.c:134:9: error: variable ‘r’ has > >initializer but incomplete type > > struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY}; > > ^ > >Fix this by including the necessary header file. > > > >Cc: Alexei Starovoitov> >Cc: David S. Miller > >Cc: Ananth N Mavinakayanahalli > >Cc: Michael Ellerman > >Signed-off-by: Naveen N. Rao > >--- > > samples/bpf/map_perf_test_user.c | 1 + > > 1 file changed, 1 insertion(+) > > > >diff --git a/samples/bpf/map_perf_test_user.c > >b/samples/bpf/map_perf_test_user.c > >index 95af56e..3147377 100644 > >--- a/samples/bpf/map_perf_test_user.c > >+++ b/samples/bpf/map_perf_test_user.c > >@@ -17,6 +17,7 @@ > > #include > > #include > > #include > >+#include > > #include "libbpf.h" > > #include "bpf_load.h" > > It's failing this way on powerpc? Odd. This fails for me on x86_64 too -- RHEL 7.1. > Such hidden header dependency was always puzzling to me. Anyway: > Acked-by: Alexei Starovoitov > > I'm assuming you want this set to go via 'net' tree, so please resubmit > with [PATCH net 1/4] subjects and cc netdev. Sure. > > Reviewing your other patches... Thanks for your review! - Naveen ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 2/4] samples/bpf: Use llc in PATH, rather than a hardcoded value
On 03/31/2016 07:46 PM, Alexei Starovoitov wrote: On 3/31/16 4:25 AM, Naveen N. Rao wrote: While at it, fix some typos in the comment. Cc: Alexei StarovoitovCc: David S. Miller Cc: Ananth N Mavinakayanahalli Cc: Michael Ellerman Signed-off-by: Naveen N. Rao --- samples/bpf/Makefile | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 502c9fc..88bc5a0 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -76,16 +76,13 @@ HOSTLOADLIBES_offwaketime += -lelf HOSTLOADLIBES_spintest += -lelf HOSTLOADLIBES_map_perf_test += -lelf -lrt -# point this to your LLVM backend with bpf support -LLC=$(srctree)/tools/bpf/llvm/bld/Debug+Asserts/bin/llc - -# asm/sysreg.h inline assmbly used by it is incompatible with llvm. -# But, ehere is not easy way to fix it, so just exclude it since it is +# asm/sysreg.h - inline assembly used by it is incompatible with llvm. +# But, there is no easy way to fix it, so just exclude it since it is # useless for BPF samples. $(obj)/%.o: $(src)/%.c clang $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) \ -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \ --O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=obj -o $@ +-O2 -emit-llvm -c $< -o -| llc -march=bpf -filetype=obj -o $@ clang $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) \ -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \ --O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=asm -o $@.s +-O2 -emit-llvm -c $< -o -| llc -march=bpf -filetype=asm -o $@.s that was a workaround when clang/llvm didn't have bpf support. Now clang 3.7 and 3.8 have bpf built-in, so make sense to remove manual calls to llc completely. Just use 'clang -target bpf -O2 -D... -c $< -o $@' +1, the clang part in that Makefile should also more correctly be called with '-target bpf' as it turns out (despite llc with '-march=bpf' ...). Better to use clang directly as suggested by Alexei. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc: ppc4xx: drop unused variable
On Thu, Mar 31, 2016 at 12:09 PM, Michael Ellermanwrote: > If you feel like cross building powerpc in future it should be as simple as: > > $ dnf install gcc-powerpc64-linux-gnu || apt-get install > gcc-powerpc-linux-gnu > $ make ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu- ... Ah hm yeah I guess everyone "should", it's just that these days I mainly rely on Fenguang's kautobuild to do this job for me and get back with the result from a plethora of arches. Sometimes a buggy bit slips through the cracks though, sorry about that. Yours, Linus Walleij ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v4 5/5] printk/nmi: flush NMI messages on the system panic
On Thu 2016-03-31 00:33:54, kbuild test robot wrote: > Hi Petr, > > [auto build test ERROR on v4.6-rc1] > [cannot apply to tip/x86/core next-20160330] > [if your patch is applied to the wrong git tree, please drop us a note to > help improving the system] > > url: > https://github.com/0day-ci/linux/commits/Petr-Mladek/Cleaning-printk-stuff-in-NMI-context/20160330-235818 > config: i386-randconfig-s1-201613 (attached as .config) > reproduce: > # save the attached .config to linux build tree > make ARCH=i386 > > All errors (new ones prefixed by >>): > >kernel/printk/nmi.c: In function 'printk_nmi_flush_on_panic': > >> kernel/printk/nmi.c:218:4: error: implicit declaration of function > >> 'debug_locks_off' [-Werror=implicit-function-declaration] >debug_locks_off(); >^ >cc1: some warnings being treated as errors Fixed by adding #include into kernel/printk/nmi.c Please, find the updated patch below. From 52cc5fee3909e8955bd78a8c63b9a610dc5c11fe Mon Sep 17 00:00:00 2001 From: Petr MladekDate: Thu, 24 Mar 2016 15:10:21 +0100 Subject: [PATCH] printk/nmi: flush NMI messages on the system panic In NMI context, printk() messages are stored into per-CPU buffers to avoid a possible deadlock. They are normally flushed to the main ring buffer via an IRQ work. But the work is never called when the system calls panic() in the very same NMI handler. This patch tries to flush NMI buffers before the crash dump is generated. In this case it does not risk a double release and bails out when the logbuf_lock is already taken. The aim is to get the messages into the main ring buffer when possible. It makes them better accessible in the vmcore. Then the patch tries to flush the buffers second time when other CPUs are down. It might be more aggressive and reset logbuf_lock. The aim is to get the messages available for the consequent kmsg_dump() and console_flush_on_panic() calls. The patch causes vprintk_emit() to be called even in NMI context again. But we do not want to call consoles in this case. They might use internal locks and we could not prevent a deadlock easily. We only want to have the messages in the main ring buffer for crash dump and kmsg_dump(). The consoles are explicitly called later by console_flush_on_panic(). Signed-off-by: Petr Mladek --- include/linux/printk.h | 4 kernel/kexec_core.c | 1 + kernel/panic.c | 6 +- kernel/printk/internal.h | 2 ++ kernel/printk/nmi.c | 36 kernel/printk/printk.c | 14 +++--- 6 files changed, 59 insertions(+), 4 deletions(-) diff --git a/include/linux/printk.h b/include/linux/printk.h index 51dd6b824fe2..2da06c2a63c3 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h @@ -123,15 +123,19 @@ void early_printk(const char *s, ...) { } #endif #ifdef CONFIG_PRINTK_NMI +#define deferred_console_in_nmi() in_nmi() extern void printk_nmi_init(void); extern void printk_nmi_enter(void); extern void printk_nmi_exit(void); extern void printk_nmi_flush(void); +extern void printk_nmi_flush_on_panic(void); #else +#define deferred_console_in_nmi() 0 static inline void printk_nmi_init(void) { } static inline void printk_nmi_enter(void) { } static inline void printk_nmi_exit(void) { } static inline void printk_nmi_flush(void) { } +static inline void printk_nmi_flush_on_panic(void) { } #endif /* PRINTK_NMI */ #ifdef CONFIG_PRINTK diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c index 8d34308ea449..1dc3fe8495e0 100644 --- a/kernel/kexec_core.c +++ b/kernel/kexec_core.c @@ -893,6 +893,7 @@ void crash_kexec(struct pt_regs *regs) old_cpu = atomic_cmpxchg(_cpu, PANIC_CPU_INVALID, this_cpu); if (old_cpu == PANIC_CPU_INVALID) { /* This is the 1st CPU which comes here, so go ahead. */ + printk_nmi_flush_on_panic(); __crash_kexec(regs); /* diff --git a/kernel/panic.c b/kernel/panic.c index 535c96510a44..8aa74497cc5a 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -160,8 +160,10 @@ void panic(const char *fmt, ...) * * Bypass the panic_cpu check and call __crash_kexec directly. */ - if (!crash_kexec_post_notifiers) + if (!crash_kexec_post_notifiers) { + printk_nmi_flush_on_panic(); __crash_kexec(NULL); + } /* * Note smp_send_stop is the usual smp shutdown function, which @@ -176,6 +178,8 @@ void panic(const char *fmt, ...) */ atomic_notifier_call_chain(_notifier_list, 0, buf); + /* Call flush even twice. It tries harder with a single online CPU */ + printk_nmi_flush_on_panic(); kmsg_dump(KMSG_DUMP_PANIC); /* diff --git a/kernel/printk/internal.h b/kernel/printk/internal.h index 341bedccc065..7fd2838fa417 100644 --- a/kernel/printk/internal.h +++
[PATCH 1/4] samples/bpf: Fix build breakage with map_perf_test_user.c
Building BPF samples is failing with the below error: samples/bpf/map_perf_test_user.c: In function ‘main’: samples/bpf/map_perf_test_user.c:134:9: error: variable ‘r’ has initializer but incomplete type struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY}; ^ samples/bpf/map_perf_test_user.c:134:21: error: ‘RLIM_INFINITY’ undeclared (first use in this function) struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY}; ^ samples/bpf/map_perf_test_user.c:134:21: note: each undeclared identifier is reported only once for each function it appears in samples/bpf/map_perf_test_user.c:134:9: warning: excess elements in struct initializer [enabled by default] struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY}; ^ samples/bpf/map_perf_test_user.c:134:9: warning: (near initialization for ‘r’) [enabled by default] samples/bpf/map_perf_test_user.c:134:9: warning: excess elements in struct initializer [enabled by default] samples/bpf/map_perf_test_user.c:134:9: warning: (near initialization for ‘r’) [enabled by default] samples/bpf/map_perf_test_user.c:134:16: error: storage size of ‘r’ isn’t known struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY}; ^ samples/bpf/map_perf_test_user.c:139:2: warning: implicit declaration of function ‘setrlimit’ [-Wimplicit-function-declaration] setrlimit(RLIMIT_MEMLOCK, ); ^ samples/bpf/map_perf_test_user.c:139:12: error: ‘RLIMIT_MEMLOCK’ undeclared (first use in this function) setrlimit(RLIMIT_MEMLOCK, ); ^ samples/bpf/map_perf_test_user.c:134:16: warning: unused variable ‘r’ [-Wunused-variable] struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY}; ^ make[2]: *** [samples/bpf/map_perf_test_user.o] Error 1 Fix this by including the necessary header file. Cc: Alexei StarovoitovCc: David S. Miller Cc: Ananth N Mavinakayanahalli Cc: Michael Ellerman Signed-off-by: Naveen N. Rao --- samples/bpf/map_perf_test_user.c | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/bpf/map_perf_test_user.c b/samples/bpf/map_perf_test_user.c index 95af56e..3147377 100644 --- a/samples/bpf/map_perf_test_user.c +++ b/samples/bpf/map_perf_test_user.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "libbpf.h" #include "bpf_load.h" -- 2.7.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 4/4] samples/bpf: Enable powerpc support
Add the necessary definitions for building bpf samples on ppc. Since ppc doesn't store function return address on the stack, modify how PT_REGS_RET() and PT_REGS_FP() work. Also, introduce PT_REGS_IP() to access the instruction pointer. I have fixed this to work with x86_64 and arm64, but not s390. Cc: Alexei StarovoitovCc: David S. Miller Cc: Ananth N Mavinakayanahalli Cc: Michael Ellerman Signed-off-by: Naveen N. Rao --- samples/bpf/bpf_helpers.h | 26 ++ samples/bpf/spintest_kern.c | 2 +- samples/bpf/tracex2_kern.c | 4 ++-- samples/bpf/tracex4_kern.c | 2 +- 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/samples/bpf/bpf_helpers.h b/samples/bpf/bpf_helpers.h index 9363500..343423c 100644 --- a/samples/bpf/bpf_helpers.h +++ b/samples/bpf/bpf_helpers.h @@ -82,6 +82,7 @@ static int (*bpf_l4_csum_replace)(void *ctx, int off, int from, int to, int flag #define PT_REGS_FP(x) ((x)->bp) #define PT_REGS_RC(x) ((x)->ax) #define PT_REGS_SP(x) ((x)->sp) +#define PT_REGS_IP(x) ((x)->ip) #elif defined(__s390x__) @@ -94,6 +95,7 @@ static int (*bpf_l4_csum_replace)(void *ctx, int off, int from, int to, int flag #define PT_REGS_FP(x) ((x)->gprs[11]) /* Works only with CONFIG_FRAME_POINTER */ #define PT_REGS_RC(x) ((x)->gprs[2]) #define PT_REGS_SP(x) ((x)->gprs[15]) +#define PT_REGS_IP(x) ((x)->ip) #elif defined(__aarch64__) @@ -106,6 +108,30 @@ static int (*bpf_l4_csum_replace)(void *ctx, int off, int from, int to, int flag #define PT_REGS_FP(x) ((x)->regs[29]) /* Works only with CONFIG_FRAME_POINTER */ #define PT_REGS_RC(x) ((x)->regs[0]) #define PT_REGS_SP(x) ((x)->sp) +#define PT_REGS_IP(x) ((x)->pc) + +#elif defined(__powerpc__) + +#define PT_REGS_PARM1(x) ((x)->gpr[3]) +#define PT_REGS_PARM2(x) ((x)->gpr[4]) +#define PT_REGS_PARM3(x) ((x)->gpr[5]) +#define PT_REGS_PARM4(x) ((x)->gpr[6]) +#define PT_REGS_PARM5(x) ((x)->gpr[7]) +#define PT_REGS_RC(x) ((x)->gpr[3]) +#define PT_REGS_SP(x) ((x)->sp) +#define PT_REGS_IP(x) ((x)->nip) #endif + +#ifdef __powerpc__ +#define BPF_KPROBE_READ_RET_IP(ip, ctx){ (ip) = (ctx)->link; } +#define BPF_KRETPROBE_READ_RET_IP(ip, ctx) BPF_KPROBE_READ_RET_IP(ip, ctx) +#else +#define BPF_KPROBE_READ_RET_IP(ip, ctx) \ + bpf_probe_read(&(ip), sizeof(ip), (void *)PT_REGS_RET(ctx)) +#define BPF_KRETPROBE_READ_RET_IP(ip, ctx) \ + bpf_probe_read(&(ip), sizeof(ip), \ + (void *)(PT_REGS_FP(ctx) + sizeof(ip))) +#endif + #endif diff --git a/samples/bpf/spintest_kern.c b/samples/bpf/spintest_kern.c index 4b27619..ce0167d 100644 --- a/samples/bpf/spintest_kern.c +++ b/samples/bpf/spintest_kern.c @@ -34,7 +34,7 @@ struct bpf_map_def SEC("maps") stackmap = { #define PROG(foo) \ int foo(struct pt_regs *ctx) \ { \ - long v = ctx->ip, *val; \ + long v = PT_REGS_IP(ctx), *val; \ \ val = bpf_map_lookup_elem(_map, ); \ bpf_map_update_elem(_map, , , BPF_ANY); \ diff --git a/samples/bpf/tracex2_kern.c b/samples/bpf/tracex2_kern.c index 09c1adc..6d6eefd 100644 --- a/samples/bpf/tracex2_kern.c +++ b/samples/bpf/tracex2_kern.c @@ -27,10 +27,10 @@ int bpf_prog2(struct pt_regs *ctx) long init_val = 1; long *value; - /* x64/s390x specific: read ip of kfree_skb caller. + /* read ip of kfree_skb caller. * non-portable version of __builtin_return_address(0) */ - bpf_probe_read(, sizeof(loc), (void *)PT_REGS_RET(ctx)); + BPF_KPROBE_READ_RET_IP(loc, ctx); value = bpf_map_lookup_elem(_map, ); if (value) diff --git a/samples/bpf/tracex4_kern.c b/samples/bpf/tracex4_kern.c index ac46714..6dd8e38 100644 --- a/samples/bpf/tracex4_kern.c +++ b/samples/bpf/tracex4_kern.c @@ -40,7 +40,7 @@ int bpf_prog2(struct pt_regs *ctx) long ip = 0; /* get ip address of kmem_cache_alloc_node() caller */ - bpf_probe_read(, sizeof(ip), (void *)(PT_REGS_FP(ctx) + sizeof(ip))); + BPF_KRETPROBE_READ_RET_IP(ip, ctx); struct pair v = { .val = bpf_ktime_get_ns(), -- 2.7.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 3/4] samples/bpf: Simplify building BPF samples
Make BPF samples build depend on CONFIG_SAMPLE_BPF. We still don't add a Kconfig option since that will add a dependency on llvm for allyesconfig builds which may not be desirable. Those who need to build the BPF samples can now just do: make CONFIG_SAMPLE_BPF=y or: export CONFIG_SAMPLE_BPF=y make Cc: Alexei StarovoitovCc: David S. Miller Cc: Ananth N Mavinakayanahalli Cc: Michael Ellerman Signed-off-by: Naveen N. Rao --- samples/Makefile | 2 +- samples/bpf/Makefile | 39 --- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/samples/Makefile b/samples/Makefile index 48001d7..3c77fc8 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -2,4 +2,4 @@ obj-$(CONFIG_SAMPLES) += kobject/ kprobes/ trace_events/ livepatch/ \ hw_breakpoint/ kfifo/ kdb/ hidraw/ rpmsg/ seccomp/ \ - configfs/ + configfs/ bpf/ diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 88bc5a0..bc5b675 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -2,23 +2,23 @@ obj- := dummy.o # List of programs to build -hostprogs-y := test_verifier test_maps -hostprogs-y += sock_example -hostprogs-y += fds_example -hostprogs-y += sockex1 -hostprogs-y += sockex2 -hostprogs-y += sockex3 -hostprogs-y += tracex1 -hostprogs-y += tracex2 -hostprogs-y += tracex3 -hostprogs-y += tracex4 -hostprogs-y += tracex5 -hostprogs-y += tracex6 -hostprogs-y += trace_output -hostprogs-y += lathist -hostprogs-y += offwaketime -hostprogs-y += spintest -hostprogs-y += map_perf_test +hostprogs-$(CONFIG_SAMPLE_BPF) := test_verifier test_maps +hostprogs-$(CONFIG_SAMPLE_BPF) += sock_example +hostprogs-$(CONFIG_SAMPLE_BPF) += fds_example +hostprogs-$(CONFIG_SAMPLE_BPF) += sockex1 +hostprogs-$(CONFIG_SAMPLE_BPF) += sockex2 +hostprogs-$(CONFIG_SAMPLE_BPF) += sockex3 +hostprogs-$(CONFIG_SAMPLE_BPF) += tracex1 +hostprogs-$(CONFIG_SAMPLE_BPF) += tracex2 +hostprogs-$(CONFIG_SAMPLE_BPF) += tracex3 +hostprogs-$(CONFIG_SAMPLE_BPF) += tracex4 +hostprogs-$(CONFIG_SAMPLE_BPF) += tracex5 +hostprogs-$(CONFIG_SAMPLE_BPF) += tracex6 +hostprogs-$(CONFIG_SAMPLE_BPF) += trace_output +hostprogs-$(CONFIG_SAMPLE_BPF) += lathist +hostprogs-$(CONFIG_SAMPLE_BPF) += offwaketime +hostprogs-$(CONFIG_SAMPLE_BPF) += spintest +hostprogs-$(CONFIG_SAMPLE_BPF) += map_perf_test test_verifier-objs := test_verifier.o libbpf.o test_maps-objs := test_maps.o libbpf.o @@ -39,8 +39,8 @@ offwaketime-objs := bpf_load.o libbpf.o offwaketime_user.o spintest-objs := bpf_load.o libbpf.o spintest_user.o map_perf_test-objs := bpf_load.o libbpf.o map_perf_test_user.o -# Tell kbuild to always build the programs -always := $(hostprogs-y) +ifdef CONFIG_SAMPLE_BPF +always := $(hostprogs-$(CONFIG_SAMPLE_BPF)) always += sockex1_kern.o always += sockex2_kern.o always += sockex3_kern.o @@ -56,6 +56,7 @@ always += lathist_kern.o always += offwaketime_kern.o always += spintest_kern.o always += map_perf_test_kern.o +endif HOSTCFLAGS += -I$(objtree)/usr/include -- 2.7.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 2/4] samples/bpf: Use llc in PATH, rather than a hardcoded value
While at it, fix some typos in the comment. Cc: Alexei StarovoitovCc: David S. Miller Cc: Ananth N Mavinakayanahalli Cc: Michael Ellerman Signed-off-by: Naveen N. Rao --- samples/bpf/Makefile | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 502c9fc..88bc5a0 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -76,16 +76,13 @@ HOSTLOADLIBES_offwaketime += -lelf HOSTLOADLIBES_spintest += -lelf HOSTLOADLIBES_map_perf_test += -lelf -lrt -# point this to your LLVM backend with bpf support -LLC=$(srctree)/tools/bpf/llvm/bld/Debug+Asserts/bin/llc - -# asm/sysreg.h inline assmbly used by it is incompatible with llvm. -# But, ehere is not easy way to fix it, so just exclude it since it is +# asm/sysreg.h - inline assembly used by it is incompatible with llvm. +# But, there is no easy way to fix it, so just exclude it since it is # useless for BPF samples. $(obj)/%.o: $(src)/%.c clang $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) \ -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \ - -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=obj -o $@ + -O2 -emit-llvm -c $< -o -| llc -march=bpf -filetype=obj -o $@ clang $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) \ -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \ - -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=asm -o $@.s + -O2 -emit-llvm -c $< -o -| llc -march=bpf -filetype=asm -o $@.s -- 2.7.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 2/4] exit_thread: remove empty bodies
Define HAVE_EXIT_THREAD for archs which want to do something in exit_thread. For others, let's define exit_thread as an empty inline. This is a cleanup before we change the prototype of exit_thread to accept a task parameter. Signed-off-by: Jiri SlabyCc: Richard Henderson Cc: Ivan Kokshaysky Cc: Matt Turner Cc: Vineet Gupta Cc: Russell King Cc: Catalin Marinas Cc: Will Deacon Cc: Haavard Skinnemoen Cc: Hans-Christian Egtvedt Cc: Steven Miao Cc: Mark Salter Cc: Aurelien Jacquiot Cc: Mikael Starvik Cc: Jesper Nilsson Cc: Yoshinori Sato Cc: Richard Kuo Cc: Geert Uytterhoeven Cc: James Hogan Cc: Michal Simek Cc: Ralf Baechle Cc: David Howells Cc: Koichi Yasutake Cc: Ley Foon Tan Cc: Jonas Bonn Cc: "James E.J. Bottomley" Cc: Helge Deller Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Martin Schwidefsky Cc: Heiko Carstens Cc: Chen Liqin Cc: Lennox Wu Cc: Rich Felker Cc: "David S. Miller" Cc: Chris Metcalf Cc: Jeff Dike Cc: Richard Weinberger Cc: Guan Xuetao Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: x...@kernel.org Cc: Tony Luck Cc: Fenghua Yu Cc: Chris Zankel Cc: Max Filippov Cc: Peter Zijlstra Cc: linux-ker...@vger.kernel.org Cc: linux-al...@vger.kernel.org Cc: linux-snps-...@lists.infradead.org Cc: linux-arm-ker...@lists.infradead.org Cc: adi-buildroot-de...@lists.sourceforge.net Cc: linux-c6x-...@linux-c6x.org Cc: linux-cris-ker...@axis.com Cc: linux-i...@vger.kernel.org Cc: uclinux-h8-de...@lists.sourceforge.jp Cc: linux-hexa...@vger.kernel.org Cc: linux-m...@lists.linux-m68k.org Cc: linux-me...@vger.kernel.org Cc: linux-m...@linux-mips.org Cc: linux-am33-l...@redhat.com Cc: nios2-...@lists.rocketboards.org Cc: linux-par...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-s...@vger.kernel.org Cc: linux...@vger.kernel.org Cc: sparcli...@vger.kernel.org Cc: user-mode-linux-de...@lists.sourceforge.net Cc: user-mode-linux-u...@lists.sourceforge.net Cc: linux-xte...@linux-xtensa.org --- arch/Kconfig| 5 + arch/alpha/kernel/process.c | 8 arch/arc/kernel/process.c | 7 --- arch/arm/Kconfig| 1 + arch/arm64/kernel/process.c | 7 --- arch/avr32/Kconfig | 1 + arch/blackfin/include/asm/processor.h | 7 --- arch/c6x/kernel/process.c | 4 arch/cris/Kconfig | 1 + arch/cris/arch-v10/kernel/process.c | 9 - arch/frv/include/asm/processor.h| 7 --- arch/h8300/include/asm/processor.h | 7 --- arch/hexagon/kernel/process.c | 7 --- arch/ia64/Kconfig | 1 + arch/m32r/kernel/process.c | 9 - arch/m68k/include/asm/processor.h | 7 --- arch/metag/Kconfig | 1 + arch/metag/include/asm/processor.h | 2 -- arch/microblaze/include/asm/processor.h | 10 -- arch/mips/include/asm/processor.h | 4 arch/mn10300/Kconfig| 1 + arch/nios2/include/asm/processor.h | 5 - arch/openrisc/include/asm/processor.h | 9 - arch/parisc/kernel/process.c| 7 --- arch/powerpc/kernel/process.c | 4 arch/s390/Kconfig | 1 + arch/score/kernel/process.c | 2 -- arch/sh/Kconfig | 1 + arch/sh/kernel/process_32.c | 7 --- arch/sparc/Kconfig | 1 + arch/tile/Kconfig | 1 + arch/um/kernel/process.c| 4 arch/unicore32/kernel/process.c | 7 --- arch/x86/Kconfig| 1 + arch/xtensa/Kconfig | 1 + include/linux/sched.h | 7 +++ 36 files changed, 24 insertions(+), 140 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index
Re: [PATCH] powerpc: ppc4xx: drop unused variable
On Thu, 2016-03-31 at 09:14 +0200, Linus Walleij wrote: > commit 0d36fe65f58391712e11a6621075f373216e5f00 > "powerpc: ppc4xx: use gpiochip data pointer" > made the mm_gc local variable in ppc4xx_gpio_set() > redundant, and when GCC treats warnings as errors this > happens: > > arch/powerpc/sysdev/ppc4xx_gpio.c: In function 'ppc4xx_gpio_set': > arch/powerpc/sysdev/ppc4xx_gpio.c:93:26: error: > unused variable 'mm_gc' [-Werror=unused-variable] > struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); > ^ >cc1: all warnings being treated as errors > > Reported-by: kbuild test robot> Cc: Anatolij Gustschin > Cc: Benjamin Herrenschmidt > Cc: Paul Mackerras > Cc: Michael Ellerman > Cc: linuxppc-dev@lists.ozlabs.org > Signed-off-by: Linus Walleij > --- > I've applied this to the GPIO tree where the offending > commit is now merged. Thanks. If you feel like cross building powerpc in future it should be as simple as: $ dnf install gcc-powerpc64-linux-gnu || apt-get install gcc-powerpc-linux-gnu $ make ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu- ... :) cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v3 2/2] cxl: Configure the PSL for two CAPI ports on POWER8NVL
The POWER8NVL chip has two CAPI ports. Configure the PSL to route data to the port corresponding to the CAPP unit. Signed-off-by: Philippe Bergheaud--- V2: - Complete rewrite after Mikey's review V3: Fixes suggested by Michael: - s/capp_unit_id(/get_capp_unit_id(/ - Fix block commenting style - Remove extra space - Use of_property_read_u32 - Add blank line after return - Fix logic for phb_index > 1 on POWERNVL - s/cappunitid/capp_unit_id/ - Add error message for -ENODEV drivers/misc/cxl/pci.c | 41 - 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c index 2844e97..94fd3f7 100644 --- a/drivers/misc/cxl/pci.c +++ b/drivers/misc/cxl/pci.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "cxl.h" #include @@ -321,12 +322,43 @@ static void dump_afu_descriptor(struct cxl_afu *afu) #undef show_reg } +#define CAPP_UNIT0_ID 0xBA +#define CAPP_UNIT1_ID 0XBE + +static u64 get_capp_unit_id(struct device_node *np) +{ + u32 phb_index; + + /* +* For chips other than POWER8NVL, we only have CAPP 0, +* irrespective of which PHB is used. +*/ + if (!pvr_version_is(PVR_POWER8NVL)) + return CAPP_UNIT0_ID; + + /* +* For POWER8NVL, assume CAPP 0 is attached to PHB0 and +* CAPP 1 is attached to PHB1. +*/ + if (of_property_read_u32(np, "ibm,phb-index", _index)) + return 0; + + if (phb_index == 0) + return CAPP_UNIT0_ID; + + if (phb_index == 1) + return CAPP_UNIT1_ID; + + return 0; +} + static int init_implementation_adapter_regs(struct cxl *adapter, struct pci_dev *dev) { struct device_node *np; const __be32 *prop; u64 psl_dsnctl; u64 chipid; + u64 capp_unit_id; if (!(np = pnv_pci_get_phb_node(dev))) return -ENODEV; @@ -336,10 +368,17 @@ static int init_implementation_adapter_regs(struct cxl *adapter, struct pci_dev if (!np) return -ENODEV; chipid = be32_to_cpup(prop); + capp_unit_id = get_capp_unit_id(np); of_node_put(np); + if (!capp_unit_id) { + pr_err("cxl: invalid capp unit id\n"); + return -ENODEV; + } /* Tell PSL where to route data to */ - psl_dsnctl = 0x02E89200ULL | (chipid << (63-5)); + psl_dsnctl = 0x9200ULL | (chipid << (63-5)); + psl_dsnctl |= (capp_unit_id << (63-13)); + cxl_p1_write(adapter, CXL_PSL_DSNDCTL, psl_dsnctl); cxl_p1_write(adapter, CXL_PSL_RESLCKTO, 0x2000200ULL); /* snoop write mask */ -- 2.1.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v3 1/2] powerpc: Define PVR value for POWER8NVL processor
Signed-off-by: Philippe Bergheaud--- V2: - New patch, added to patch set V3: - no change arch/powerpc/include/asm/reg.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index f5f4c66..cf09c6e 100644 --- a/arch/powerpc/include/asm/reg.h +++ b/arch/powerpc/include/asm/reg.h @@ -1182,6 +1182,7 @@ #define PVR_970GX 0x0045 #define PVR_POWER7p0x004A #define PVR_POWER8E0x004B +#define PVR_POWER8NVL 0x004C #define PVR_POWER8 0x004D #define PVR_BE 0x0070 #define PVR_PA6T 0x0090 -- 2.1.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [RFC PATCH 2/2] tools/perf: Change how probe offsets are handled
On 2016/03/30 10:13PM, Naveen N Rao wrote: > While trying to address the kallsyms perf test failure on ppc64le, > Ananth noticed that we were not necessarily probing at the expected > address when an offset to the function was specified. > > So far, we used to treat probe point offsets as being offset from the > LEP. However, userspace applications (objdump/readelf) always show > disassembly and offsets from the function GEP. This is confusing to the > user. Fix this by changing how we modify probe address with perf. > > If only the function name is provided, we assume the user needs the LEP. > Otherwise, if an offset is specified, we assume that the user knows the > exact address to probe based on function disassembly, and so we just > place the probe from the GEP offset. > > Tested lightly. Needs more testing. > > Cc: Thiago Jung Bauermann> Cc: Arnaldo Carvalho de Melo > Cc: Masami Hiramatsu > Cc: Michael Ellerman > Reported-by: Ananth N Mavinakayanahalli > Signed-off-by: Naveen N. Rao > --- > tools/perf/arch/powerpc/util/sym-handling.c | 21 ++--- > 1 file changed, 14 insertions(+), 7 deletions(-) > > diff --git a/tools/perf/arch/powerpc/util/sym-handling.c > b/tools/perf/arch/powerpc/util/sym-handling.c > index 3e98a61..36f6eb0 100644 > --- a/tools/perf/arch/powerpc/util/sym-handling.c > +++ b/tools/perf/arch/powerpc/util/sym-handling.c > @@ -65,16 +65,23 @@ void arch__fix_tev_from_maps(struct perf_probe_event *pev, >struct probe_trace_event *tev, struct map *map, >struct symbol *sym) > { > + int lep_offset = PPC64_LOCAL_ENTRY_OFFSET(sym->elf_st_other); > + > /* >* ppc64 ABIv2 local entry point is currently always 2 instructions > - * (8 bytes) after the global entry point. > + * (8 bytes) after the global entry point. When probing at a function > + * entry point, we normally always want the LEP since that catches calls > + * to the function through both the GEP and the LEP. However, if the > user > + * specifies an offset, we fall back to using the GEP since all > userspace > + * applications (objdump/readelf) show function disassembly with offsets > + * from the GEP. >*/ > - if (!pev->uprobes && map->dso->symtab_type == > DSO_BINARY_TYPE__KALLSYMS) { > - tev->point.address += PPC64LE_LEP_OFFSET; > + if (pev->point.offset) This needs to be: if (pev->point.offset || pev->point.retprobe) return; kretprobes fails otherwise. - Naveen > + return; > + > + if (!pev->uprobes && map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS) > tev->point.offset += PPC64LE_LEP_OFFSET; > - } else if (PPC64_LOCAL_ENTRY_OFFSET(sym->elf_st_other)) { > - tev->point.address += > PPC64_LOCAL_ENTRY_OFFSET(sym->elf_st_other); > - tev->point.offset += > PPC64_LOCAL_ENTRY_OFFSET(sym->elf_st_other); > - } > + else if (lep_offset) > + tev->point.offset += lep_offset; > } > #endif > -- > 2.7.4 > > ___ > Linuxppc-dev mailing list > Linuxppc-dev@lists.ozlabs.org > https://lists.ozlabs.org/listinfo/linuxppc-dev ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] Remove kretprobe_trampoline_holder.
On 2016/03/28 05:06PM, Thiago Jung Bauermann wrote: > Fixes the following testsuite failure: > > $ sudo ./perf test -v kallsyms > 1: vmlinux symtab matches kallsyms : > --- start --- > test child forked, pid 12489 > Using /proc/kcore for kernel object code > Looking at the vmlinux_path (8 entries long) > Using /boot/vmlinux for symbols > 0xc003d300: diff name v: .kretprobe_trampoline_holder k: > kretprobe_trampoline > Maps only in vmlinux: > c086ca38-c0879b6c 87ca38 [kernel].text.unlikely > c0879b6c-c0bf 889b6c [kernel].meminit.text > c0bf-c0c53264 c0 [kernel].init.text > c0c53264-d425 c63264 [kernel].exit.text > d425-d445 0 [libcrc32c] > d445-d462 0 [xfs] > d462-d468 0 [autofs4] > d468-d46e 0 [x_tables] > d46e-d478 0 [ip_tables] > d478-d47e 0 [rng_core] > d47e- 0 [pseries_rng] > Maps in vmlinux with a different name in kallsyms: > Maps only in kallsyms: > d000-f000 1001 [kernel.kallsyms] > f000- 3001 [kernel.kallsyms] > test child finished with -1 > end > vmlinux symtab matches kallsyms: FAILED! You should indent the above output -- in this specific case, the start marker interferes with git am. Apart from that, I have tested this patch and kretprobe works fine. A minor nit I had is that we end up with a non-dot function in .text without a corresponding function descriptor for kretprobe_trampoline. But, since this is a trampoline, I think that is good. So, for this patch: Reviewed-by: Naveen N. Rao- Naveen ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc: ppc4xx: drop unused variable
commit 0d36fe65f58391712e11a6621075f373216e5f00 "powerpc: ppc4xx: use gpiochip data pointer" made the mm_gc local variable in ppc4xx_gpio_set() redundant, and when GCC treats warnings as errors this happens: arch/powerpc/sysdev/ppc4xx_gpio.c: In function 'ppc4xx_gpio_set': arch/powerpc/sysdev/ppc4xx_gpio.c:93:26: error: unused variable 'mm_gc' [-Werror=unused-variable] struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); ^ cc1: all warnings being treated as errors Reported-by: kbuild test robotCc: Anatolij Gustschin Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Linus Walleij --- I've applied this to the GPIO tree where the offending commit is now merged. --- arch/powerpc/sysdev/ppc4xx_gpio.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/powerpc/sysdev/ppc4xx_gpio.c b/arch/powerpc/sysdev/ppc4xx_gpio.c index 4ab83cd04785..5382d04dd872 100644 --- a/arch/powerpc/sysdev/ppc4xx_gpio.c +++ b/arch/powerpc/sysdev/ppc4xx_gpio.c @@ -90,7 +90,6 @@ __ppc4xx_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) static void ppc4xx_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) { - struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); struct ppc4xx_gpio_chip *chip = gpiochip_get_data(gc); unsigned long flags; -- 2.4.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [GIT PULL 0/2] perf/urgent fixes
* Arnaldo Carvalho de Melowrote: > Hi Ingo, > > Please consider pulling, > > - Arnaldo > > The following changes since commit f6343be96ebbae38a07e0878810f5bbc0c38cade: > > Merge tag 'perf-urgent-for-mingo-20160329' of > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent > (2016-03-30 12:31:03 +0200) > > are available in the git repository at: > > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git > tags/perf-urgent-for-mingo-20160330 > > for you to fetch changes up to 9f56c092b99b40ce3cf4c6d0134ff7e513c9f1a6: > > perf jit: genelf makes assumptions about endian (2016-03-30 18:12:06 -0300) > > > perf/urgent fixes: > > - Fix determination of a callchain node's childlessness in > the top/report TUI, which was preventing navigating some > callchains, --stdio unnaffected (Andres Freund) > > - Fix jitdump's genelf assumption that PowerPC is big endian > only (Anton Blanchard) > > Signed-off-by: Arnaldo Carvalho de Melo > > > Andres Freund (1): > perf hists: Fix determination of a callchain node's childlessness > > Anton Blanchard (1): > perf jit: genelf makes assumptions about endian > > tools/perf/ui/browsers/hists.c | 2 +- > tools/perf/util/genelf.h | 24 ++-- > 2 files changed, 11 insertions(+), 15 deletions(-) Pulled, thanks a lot Arnaldo! Ingo ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev