Re: [PATCH -tip ] [BUGFIX/URGENT] perf-probe: Do not add offset to uprobe address
Hi Masami, On Wed, 05 Feb 2014 05:18:58 +, Masami Hiramatsu wrote: > Fix perf-probe not to add offset value to uprobe probe > address when post processing. > tevs[i].point.address is the address of symbol+offset, > but current perf-probe adjusts the point.address by > adding the offset. As a result, the probe address becomes > symbol+offset+offset. This may cause unexpected > code corruption. Urgent fix is needed. > > Without this fix > --- > # ./perf probe -x ./perf dso__load_vmlinux+4 > # ./perf probe -l > probe_perf:dso__load_vmlinux (on 0x0006d2b8) > # nm ./perf.orig | grep dso__load_vmlinux\$ > 0046d0a0 T dso__load_vmlinux Shouldn't the original symbol address be 0046d2b0 ? > --- > You can see the given offset is 3 but the actual probed s/3/4/ ? Thanks, Namhyung > address is dso__load_vmlinux+8. > > With this fix > --- > # ./perf probe -x ./perf dso__load_vmlinux+4 > # ./perf probe -l > probe_perf:dso__load_vmlinux (on 0x0006d2b4) > --- > Now the problem is fixed. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 3.12: ethernet controller missing after resuming from suspend to RAM
Hi, On 02/06/2014 12:42 AM, Bastien Traverse wrote: > Hello, > > I'm encountering the exact same problem (same model of machine, same > controller, same OS) and was wondering where this bug was at. I'm still leaving with this issue since my initial posting unfortunately :( I'm wondering why PM support on this machine is so crapish (it initialy oopsed when resuming due to a bug in rtsx driver). Thanks -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] backlight: add PWM dependencies
On Thursday, February 06, 2014 3:50 PM, Jingoo Han wrote: > On Wednesday, February 05, 2014 5:58 PM, Linus Walleij wrote: > > On Wed, Feb 5, 2014 at 6:01 AM, Jingoo Han wrote: > > > On Tuesday, February 04, 2014 9:57 PM, Linus Walleij wrote: > > >> > > >> In some compilations the LM3630A and LP855X backlight drivers > > >> fail like this: > > >> > > >> drivers/built-in.o: In function `lm3630a_pwm_ctrl': > > >> drivers/video/backlight/lm3630a_bl.c:168: undefined reference to > > >> `pwm_config' > > >> drivers/video/backlight/lm3630a_bl.c:172: undefined reference to > > >> `pwm_disable' > > >> drivers/video/backlight/lm3630a_bl.c:170: undefined reference to > > >> `pwm_enable' > > >> drivers/built-in.o: In function `lp855x_pwm_ctrl': > > >> drivers/video/backlight/lp855x_bl.c:249: undefined reference to > > >> `pwm_config' > > >> drivers/video/backlight/lp855x_bl.c:253: undefined reference to > > >> `pwm_disable' > > >> drivers/video/backlight/lp855x_bl.c:251: undefined reference to > > >> `pwm_enable' > > >> > > >> This is because both drivers depend on the PWM framework, so > > >> add this dependency to their Kconfig entries. > > > > > > However, even though, when CONFIG_PWM is not enabled, the problem > > > should not happen. pwm_config(),pwm_disable(), and pwm_enable() > > > are already defined for CONFIG_PWM=n case as below. > > > > So you may think but it does happen :-) > > > > I reproduced this with the defconfig for ARM pxa255-idp and enabling > > all boards for that platform, then enabling all available backlight drivers > > as compiled-in objects (y). > > However, I cannot reproduce it with mainline kernel 3.14-rc1. > > 1. make pxa255-idp_defconfig > 2. Enabling all boards >(System Type -> Intel PXA2xx/PXA3xx Implementations -> ...) > 3. Enabling all available backlight drivers as compiled-in objects (y) > > In this case, the LM3630A and LP855X backlight drivers are compiled > properly as below: > > drivers/video/backlight/lm3630a_bl.o > drivers/video/backlight/lp855x_bl.o > > Would you check it with mainline kernel 3.14-rc1? > If the errors happen, please attach the .config file. (+cc Arnd Bergmann) Oh, sorry. There was my mistake. I tested this with linux-next tree. With linux 3.14-rc1, it makes the problem as below. drivers/built-in.o: In function `lm3630a_pwm_ctrl': drivers/video/backlight/lm3630a_bl.c:168: undefined reference to `pwm_config' drivers/video/backlight/lm3630a_bl.c:172: undefined reference to `pwm_disable' drivers/video/backlight/lm3630a_bl.c:170: undefined reference to `pwm_enable' drivers/built-in.o: In function `lp855x_pwm_ctrl': drivers/video/backlight/lp855x_bl.c:249: undefined reference to `pwm_config' drivers/video/backlight/lp855x_bl.c:253: undefined reference to `pwm_disable' drivers/video/backlight/lp855x_bl.c:251: undefined reference to `pwm_enable' > > > > > > ./include/linux/pwm.h > > > #if IS_ENABLED(CONFIG_PWM) || IS_ENABLED(CONFIG_HAVE_PWM) > > > . > > > #else > > > > Hm PXA that I am using defines CONFIG_HAVE_PWM, but doesn't > > provide the required signatures (pwm_config/pwm_disable/pwm_enable). > > > > One of two things is wrong: > > > > - Either the PXA platform is breaking the CONFIG_HAVE_PWM > > contract by not providing pwm_config/pwm_disable/pwm_enable > > functions. Then HAVE_PWM should be removed from the PXA > > Kconfig selects. > > > > Or: > > > > - There is no such contract that these functions must exist if > > CONFIG_HAVE_PWM is defined, and the > > #if IS_ENABLED(CONFIG_HAVE_PWM) > > should be removed from > > > > Does anyone know which one it is? > > > > PWM subsystem maintainer? :-) Thierry Reding, Would you confirm this? In the case of "CONFIG_HAVE_PWM=y && CONFIG_PWM=n", it makes the problem. The HAVE_PWM symbol is only for legacy platforms that provide the PWM API without using the generic framework. PXA looks to use the generic PWM framework. Then, how about removing "select HAVE_PWM" from PXA as below? --- a/arch/arm/mach-pxa/Kconfig +++ b/arch/arm/mach-pxa/Kconfig @@ -7,7 +7,6 @@ comment "Intel/Marvell Dev Platforms (sorted by hardware release time)" config MACH_PXA3XX_DT bool "Support PXA3xx platforms from device tree" select CPU_PXA300 - select HAVE_PWM select POWER_SUPPLY select PXA3xx select USE_OF @@ -23,12 +22,10 @@ config ARCH_LUBBOCK config MACH_MAINSTONE bool "Intel HCDDBBVA0 Development Platform (aka Mainstone)" - select HAVE_PWM select PXA27x config MACH_ZYLONITE bool - select HAVE_PWM select PXA3xx . Best regards, Jingoo Han -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH V4 5/8] SPEAr13xx: Fixup: Move SPEAr1340 SATA platform code to phy driver
On Thu, Feb 06, 2014 at 02:32:42PM +0800, Kishon Vijay Abraham I wrote: > Hi, > > On Thursday 06 February 2014 10:14 AM, Pratyush Anand wrote: > > ahci driver needs some platform specific functions which are called at > > init, exit, suspend and resume conditions. Till now these functions were > > present in a platform driver with a fixme notes. > > > > Similar functions modifying same set of registers will also be needed in > > case of PCIe phy init/exit. > > > > So move all these SATA platform code to phy-miphy40lp driver. > > > > Signed-off-by: Pratyush Anand > > Tested-by: Mohit Kumar > > Cc: Viresh Kumar > > Cc: Tejun Heo > > Cc: Arnd Bergmann > > Cc: Kishon Vijay Abraham I > > Cc: spear-de...@list.st.com > > Cc: linux-arm-ker...@lists.infradead.org > > Cc: devicet...@vger.kernel.org > > Cc: linux-...@vger.kernel.org > > Cc: linux-kernel@vger.kernel.org > > --- > > .../devicetree/bindings/arm/spear-misc.txt | 4 + > > arch/arm/boot/dts/spear1310-evb.dts| 4 + > > arch/arm/boot/dts/spear1310.dtsi | 39 +++- > > arch/arm/boot/dts/spear1340-evb.dts| 4 + > > arch/arm/boot/dts/spear1340.dtsi | 13 +- > > arch/arm/boot/dts/spear13xx.dtsi | 5 + > > arch/arm/mach-spear/Kconfig| 2 + > > arch/arm/mach-spear/spear1340.c| 127 + > > drivers/phy/phy-miphy40lp.c| 204 > > - > > It would be better if you can split this patch. Keep arch/ in separate patch > and drivers/ in separate patch. Code is actually moving from arch to driver. Therefore I kept it in same patch. > > 9 files changed, 266 insertions(+), 136 deletions(-) > > create mode 100644 Documentation/devicetree/bindings/arm/spear-misc.txt > > > . > . > > . > . > > static const char * const spear1340_dt_board_compat[] = { > > diff --git a/drivers/phy/phy-miphy40lp.c b/drivers/phy/phy-miphy40lp.c > > index d478c14..cc7f45d 100644 > > --- a/drivers/phy/phy-miphy40lp.c > > +++ b/drivers/phy/phy-miphy40lp.c > > @@ -8,6 +8,7 @@ > > * it under the terms of the GNU General Public License version 2 as > > * published by the Free Software Foundation. > > * > > + * 04/02/2014: Adding support of SATA mode for SPEAr1340. > > */ > > > > #include > > @@ -19,6 +20,60 @@ > > #include > > #include > > > > +/* SPEAr1340 Registers */ > > +/* Power Management Registers */ > > +#define SPEAR1340_PCM_CFG 0x100 > > + #define SPEAR1340_PCM_CFG_SATA_POWER_EN 0x800 > > +#define SPEAR1340_PCM_WKUP_CFG 0x104 > > +#define SPEAR1340_SWITCH_CTR 0x108 > > + > > +#define SPEAR1340_PERIP1_SW_RST0x318 > > + #define SPEAR1340_PERIP1_SW_RST_SATA0x1000 > > +#define SPEAR1340_PERIP2_SW_RST0x31C > > +#define SPEAR1340_PERIP3_SW_RST0x320 > > + > > +/* PCIE - SATA configuration registers */ > > +#define SPEAR1340_PCIE_SATA_CFG0x424 > > + /* PCIE CFG MASks */ > > + #define SPEAR1340_PCIE_CFG_DEVICE_PRESENT (1 << 11) > > use BIT() wherever possible. OK. > > + #define SPEAR1340_PCIE_CFG_POWERUP_RESET(1 << 10) > > + #define SPEAR1340_PCIE_CFG_CORE_CLK_EN (1 << 9) > > + #define SPEAR1340_PCIE_CFG_AUX_CLK_EN (1 << 8) > > + #define SPEAR1340_SATA_CFG_TX_CLK_EN(1 << 4) > > + #define SPEAR1340_SATA_CFG_RX_CLK_EN(1 << 3) > > + #define SPEAR1340_SATA_CFG_POWERUP_RESET(1 << 2) > > + #define SPEAR1340_SATA_CFG_PM_CLK_EN(1 << 1) > > + #define SPEAR1340_PCIE_SATA_SEL_PCIE(0) > > + #define SPEAR1340_PCIE_SATA_SEL_SATA(1) > > + #define SPEAR1340_PCIE_SATA_CFG_MASK0xF1F > > + #define SPEAR1340_PCIE_CFG_VAL (SPEAR1340_PCIE_SATA_SEL_PCIE | \ > > + SPEAR1340_PCIE_CFG_AUX_CLK_EN | \ > > + SPEAR1340_PCIE_CFG_CORE_CLK_EN | \ > > + SPEAR1340_PCIE_CFG_POWERUP_RESET | \ > > + SPEAR1340_PCIE_CFG_DEVICE_PRESENT) > > + #define SPEAR1340_SATA_CFG_VAL (SPEAR1340_PCIE_SATA_SEL_SATA | \ > > + SPEAR1340_SATA_CFG_PM_CLK_EN | \ > > + SPEAR1340_SATA_CFG_POWERUP_RESET | \ > > + SPEAR1340_SATA_CFG_RX_CLK_EN | \ > > + SPEAR1340_SATA_CFG_TX_CLK_EN) > > + > > +#define SPEAR1340_PCIE_MIPHY_CFG 0x428 > > + #define SPEAR1340_MIPHY_OSC_BYPASS_EXT (1 << 31) > > + #define SPEAR1340_MIPHY_CLK_REF_DIV2(1 << 27) > > + #define SPEAR1340_MIPHY_CLK_REF_DIV4(2 << 27) > > + #define SPEAR1340_MIPHY_CLK_REF_DIV8(3 << 27) > > + #define SPEAR1340_MIPHY_PLL_RATIO_TOP(x)(x << 0) > > + #define SPEAR1340_PCIE_MIPHY_CFG_MASK 0xF8FF > > + #define SPEAR1340_PCIE_SATA_MIPHY_CFG_SATA \ > > +
[PATCH 1/2] iio:as3935: Add DT binding docs for AS3935 driver
Document compatible string, required and optional DT properties for AS3935 chipset driver. Signed-off-by: Matt Ranostay --- .../devicetree/bindings/iio/proximity/as3935.txt | 28 ++ .../devicetree/bindings/vendor-prefixes.txt| 1 + 2 files changed, 29 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/proximity/as3935.txt diff --git a/Documentation/devicetree/bindings/iio/proximity/as3935.txt b/Documentation/devicetree/bindings/iio/proximity/as3935.txt new file mode 100644 index 000..574d49c --- /dev/null +++ b/Documentation/devicetree/bindings/iio/proximity/as3935.txt @@ -0,0 +1,28 @@ +Austrian Microsystems AS3935 Franklin lightning sensor device driver + +Required properties: + - compatible: must be "ams,as3935" + - reg: SPI chip select number for the device + - spi-cpha: SPI Mode 1. Refer to spi/spi-bus.txt for generic SPI + slave node bindings. + - interrupt-parent : should be the phandle for the interrupt controller + - interrupts : interrupt mapping for GPIO IRQ + + Refer to interrupt-controller/interrupts.txt for generic + interrupt client node bindings. + +Optional properties: + - ams,tune-cap: Calibration tuning capacitor stepping value 0 - 15. + Range of 0 to 120 pF, 8pF steps. This will require using the + calibration data from the manufacturer. + +Example: + +as3935@0 { + compatible = "ams,as3935"; + reg = <0>; + spi-cpha; + interrupt-parent = <&gpio1>; + interrupts = <16 1>; + ams,tune-cap = <10>; +}; diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index 3c31b40..9dd66ca 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt @@ -10,6 +10,7 @@ aeroflexgaisler Aeroflex Gaisler AB ak Asahi Kasei Corp. altr Altera Corp. amcc Applied Micro Circuits Corporation (APM, formally AMCC) +amsAMS AG amstaosAMS-Taos Inc. apmApplied Micro Circuits Corporation (APM) armARM Ltd. -- 1.8.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] iio: Add AS3935 lightning sensor support
AS3935 chipset can detect lightning strikes and reports those back as events and the estimated distance to the storm. Signed-off-by: Matt Ranostay --- .../ABI/testing/sysfs-bus-iio-proximity-as3935 | 18 + drivers/iio/Kconfig| 1 + drivers/iio/Makefile | 1 + drivers/iio/proximity/Kconfig | 19 + drivers/iio/proximity/Makefile | 6 + drivers/iio/proximity/as3935.c | 437 + 6 files changed, 482 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 create mode 100644 drivers/iio/proximity/Kconfig create mode 100644 drivers/iio/proximity/Makefile create mode 100644 drivers/iio/proximity/as3935.c diff --git a/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 b/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 new file mode 100644 index 000..f6d9e6f --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 @@ -0,0 +1,18 @@ +What /sys/bus/iio/devices/iio:deviceX/in_proximity_raw +Date: January 2014 +KernelVersion: 3.15 +Contact: Matt Ranostay +Description: + Get the current distance in kilometers of storm + 1= storm overhead + 1-40 = distance in kilometers + 63 = out of range + +What /sys/bus/iio/devices/iio:deviceX/gain_boost +Date: January 2014 +KernelVersion: 3.15 +Contact: Matt Ranostay +Description: + Show or set the gain boost of the amp, from 0-31 range. + 18 = indoors (default) + 14 = outdoors diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig index 5dd0e12..743485e 100644 --- a/drivers/iio/Kconfig +++ b/drivers/iio/Kconfig @@ -74,6 +74,7 @@ if IIO_TRIGGER source "drivers/iio/trigger/Kconfig" endif #IIO_TRIGGER source "drivers/iio/pressure/Kconfig" +source "drivers/iio/proximity/Kconfig" source "drivers/iio/temperature/Kconfig" endif # IIO diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile index 887d390..698afc2 100644 --- a/drivers/iio/Makefile +++ b/drivers/iio/Makefile @@ -24,5 +24,6 @@ obj-y += light/ obj-y += magnetometer/ obj-y += orientation/ obj-y += pressure/ +obj-y += proximity/ obj-y += temperature/ obj-y += trigger/ diff --git a/drivers/iio/proximity/Kconfig b/drivers/iio/proximity/Kconfig new file mode 100644 index 000..0c8cdf5 --- /dev/null +++ b/drivers/iio/proximity/Kconfig @@ -0,0 +1,19 @@ +# +# Proximity sensors +# + +menu "Lightning sensors" + +config AS3935 + tristate "AS3935 Franklin lightning sensor" + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + depends on SPI + help + Say Y here to build SPI interface support for the Austrian + Microsystems AS3935 lightning detection sensor. + + To compile this driver as a module, choose M here: the + module will be called as3935 + +endmenu diff --git a/drivers/iio/proximity/Makefile b/drivers/iio/proximity/Makefile new file mode 100644 index 000..743adee --- /dev/null +++ b/drivers/iio/proximity/Makefile @@ -0,0 +1,6 @@ +# +# Makefile for IIO proximity sensors +# + +# When adding new entries keep the list in alphabetical order +obj-$(CONFIG_AS3935) += as3935.o diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c new file mode 100644 index 000..109759e --- /dev/null +++ b/drivers/iio/proximity/as3935.c @@ -0,0 +1,437 @@ +/* + * as3935.c - Support for AS3935 Franklin lightning sensor + * + * Copyright (C) 2014 Matt Ranostay + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define AS3935_AFE_GAIN0x00 +#define AS3935_AFE_MASK0x3F +#define AS3935_AFE_GAIN_MAX0x1F +#define AS3935_AFE_PWR_BIT BIT(0) + +#define AS3935_INT 0x03 +#define AS3935_INT_MASK0x07 +#define AS3935_EVENT_INT BIT(3) +#define AS3935_NOISE_INT BIT(1) + +#define AS3935_DATA0x07 +#define AS3935_DATA_MASK 0x3F + +#define AS3935_TUNE_CAP0x08 +#define AS3935_CALIBRATE 0x3D + +#define AS3935_WRITE_DATA BIT(15) +#define AS3935_READ_DATA BIT(14) +#define AS3935_ADDRESS(x)
[PATCH 0/2] AS3935 lightning sensor support
This series adds support for the AMS AS3935 lightning sensor that allows reporting back estimated storm distance and strike events. Matt Ranostay (2): iio:as3935: Add DT binding docs for AS3935 driver iio: Add AS3935 lightning sensor support .../ABI/testing/sysfs-bus-iio-proximity-as3935 | 18 + .../devicetree/bindings/iio/proximity/as3935.txt | 28 ++ .../devicetree/bindings/vendor-prefixes.txt| 1 + drivers/iio/Kconfig| 1 + drivers/iio/Makefile | 1 + drivers/iio/proximity/Kconfig | 19 + drivers/iio/proximity/Makefile | 6 + drivers/iio/proximity/as3935.c | 437 + 8 files changed, 511 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 create mode 100644 Documentation/devicetree/bindings/iio/proximity/as3935.txt create mode 100644 drivers/iio/proximity/Kconfig create mode 100644 drivers/iio/proximity/Makefile create mode 100644 drivers/iio/proximity/as3935.c -- 1.8.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] backlight: add PWM dependencies
On Wednesday, February 05, 2014 5:58 PM, Linus Walleij wrote: > On Wed, Feb 5, 2014 at 6:01 AM, Jingoo Han wrote: > > On Tuesday, February 04, 2014 9:57 PM, Linus Walleij wrote: > >> > >> In some compilations the LM3630A and LP855X backlight drivers > >> fail like this: > >> > >> drivers/built-in.o: In function `lm3630a_pwm_ctrl': > >> drivers/video/backlight/lm3630a_bl.c:168: undefined reference to > >> `pwm_config' > >> drivers/video/backlight/lm3630a_bl.c:172: undefined reference to > >> `pwm_disable' > >> drivers/video/backlight/lm3630a_bl.c:170: undefined reference to > >> `pwm_enable' > >> drivers/built-in.o: In function `lp855x_pwm_ctrl': > >> drivers/video/backlight/lp855x_bl.c:249: undefined reference to > >> `pwm_config' > >> drivers/video/backlight/lp855x_bl.c:253: undefined reference to > >> `pwm_disable' > >> drivers/video/backlight/lp855x_bl.c:251: undefined reference to > >> `pwm_enable' > >> > >> This is because both drivers depend on the PWM framework, so > >> add this dependency to their Kconfig entries. > > > > However, even though, when CONFIG_PWM is not enabled, the problem > > should not happen. pwm_config(),pwm_disable(), and pwm_enable() > > are already defined for CONFIG_PWM=n case as below. > > So you may think but it does happen :-) > > I reproduced this with the defconfig for ARM pxa255-idp and enabling > all boards for that platform, then enabling all available backlight drivers > as compiled-in objects (y). However, I cannot reproduce it with mainline kernel 3.14-rc1. 1. make pxa255-idp_defconfig 2. Enabling all boards (System Type -> Intel PXA2xx/PXA3xx Implementations -> ...) 3. Enabling all available backlight drivers as compiled-in objects (y) In this case, the LM3630A and LP855X backlight drivers are compiled properly as below: drivers/video/backlight/lm3630a_bl.o drivers/video/backlight/lp855x_bl.o Would you check it with mainline kernel 3.14-rc1? If the errors happen, please attach the .config file. Best regards, Jingoo Han > > > ./include/linux/pwm.h > > #if IS_ENABLED(CONFIG_PWM) || IS_ENABLED(CONFIG_HAVE_PWM) > > . > > #else > > Hm PXA that I am using defines CONFIG_HAVE_PWM, but doesn't > provide the required signatures (pwm_config/pwm_disable/pwm_enable). > > One of two things is wrong: > > - Either the PXA platform is breaking the CONFIG_HAVE_PWM > contract by not providing pwm_config/pwm_disable/pwm_enable > functions. Then HAVE_PWM should be removed from the PXA > Kconfig selects. > > Or: > > - There is no such contract that these functions must exist if > CONFIG_HAVE_PWM is defined, and the > #if IS_ENABLED(CONFIG_HAVE_PWM) > should be removed from > > Does anyone know which one it is? > > PWM subsystem maintainer? :-) > > Yours, > Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] regulator: rc5t583: Allow missing init_data for diagnostics
The regulator core supports this to allow the configuration to be inspected at runtime even if no software management is enabled. Signed-off-by: Axel Lin --- drivers/regulator/rc5t583-regulator.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/regulator/rc5t583-regulator.c b/drivers/regulator/rc5t583-regulator.c index b58affb..22d6fd1 100644 --- a/drivers/regulator/rc5t583-regulator.c +++ b/drivers/regulator/rc5t583-regulator.c @@ -119,7 +119,6 @@ static int rc5t583_regulator_probe(struct platform_device *pdev) { struct rc5t583 *rc5t583 = dev_get_drvdata(pdev->dev.parent); struct rc5t583_platform_data *pdata = dev_get_platdata(rc5t583->dev); - struct regulator_init_data *reg_data; struct regulator_config config = { }; struct rc5t583_regulator *reg = NULL; struct rc5t583_regulator *regs; @@ -142,12 +141,6 @@ static int rc5t583_regulator_probe(struct platform_device *pdev) for (id = 0; id < RC5T583_REGULATOR_MAX; ++id) { - reg_data = pdata->reg_init_data[id]; - - /* No need to register if there is no regulator data */ - if (!reg_data) - continue; - reg = ®s[id]; ri = &rc5t583_reg_info[id]; reg->reg_info = ri; @@ -169,7 +162,7 @@ static int rc5t583_regulator_probe(struct platform_device *pdev) skip_ext_pwr_config: config.dev = &pdev->dev; - config.init_data = reg_data; + config.init_data = pdata->reg_init_data[id]; config.driver_data = reg; config.regmap = rc5t583->regmap; -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH V4 4/8] phy: st-miphy-40lp: Add skeleton driver
On Thu, Feb 06, 2014 at 02:23:20PM +0800, Kishon Vijay Abraham I wrote: > Hi, > > On Thursday 06 February 2014 11:44 AM, Pratyush Anand wrote: > > Hi Kishon, > > > > On Thu, Feb 06, 2014 at 02:01:45PM +0800, Kishon Vijay Abraham I wrote: > >> Hi, > >> > >> On Thursday 06 February 2014 10:14 AM, Pratyush Anand wrote: > >>> ST miphy-40lp supports PCIe, SATA and Super Speed USB. This driver adds [...] > >>> + > >>> + phy_provider = devm_of_phy_provider_register(dev, st_miphy40lp_xlate); > >>> + if (IS_ERR(phy_provider)) { > >>> + dev_err(dev, "failed to register phy provider\n"); > >>> + return PTR_ERR(phy_provider); > >>> + } > >> > >> phy_provider_register should be the last step in registering the PHY. Or > >> your > >> PHY call backs can be called before you create the PHY. Btw in your case > >> you > > > > But every one else like phy-exynos-mipi-video or phy-omap-usb2 or any > > other did it same way. First phy_provider_register and then > > phy_create. > > That's a bug which we figured out very late. Will get it fixed in this -rc > cycle. Ok..I ll correct in mine too. :) Rgds Pratyush > > Thanks > Kishon -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] regulator: as3711: Allow missing init_data for diagnostics
The regulator core supports this to allow the configuration to be inspected at runtime even if no software management is enabled. Signed-off-by: Axel Lin --- drivers/regulator/as3711-regulator.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/regulator/as3711-regulator.c b/drivers/regulator/as3711-regulator.c index c77a584..67fd548 100644 --- a/drivers/regulator/as3711-regulator.c +++ b/drivers/regulator/as3711-regulator.c @@ -221,7 +221,6 @@ static int as3711_regulator_probe(struct platform_device *pdev) { struct as3711_regulator_pdata *pdata = dev_get_platdata(&pdev->dev); struct as3711 *as3711 = dev_get_drvdata(pdev->dev.parent); - struct regulator_init_data *reg_data; struct regulator_config config = {.dev = &pdev->dev,}; struct as3711_regulator *reg = NULL; struct as3711_regulator *regs; @@ -252,16 +251,10 @@ static int as3711_regulator_probe(struct platform_device *pdev) } for (id = 0, ri = as3711_reg_info; id < AS3711_REGULATOR_NUM; ++id, ri++) { - reg_data = pdata->init_data[id]; - - /* No need to register if there is no regulator data */ - if (!reg_data) - continue; - reg = ®s[id]; reg->reg_info = ri; - config.init_data = reg_data; + config.init_data = pdata->init_data[id]; config.driver_data = reg; config.regmap = as3711->regmap; config.of_node = of_node[id]; -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] slub: Do not assert not having lock in removing freed partial
On 02/06/2014 07:21 AM, Steven Rostedt wrote: > Vladimir reported the following issue: > > Commit c65c1877bd68 ("slub: use lockdep_assert_held") requires > remove_partial() to be called with n->list_lock held, but free_partial() > called from kmem_cache_close() on cache destruction does not follow this > rule, leading to a warning: > > WARNING: CPU: 0 PID: 2787 at mm/slub.c:1536 > __kmem_cache_shutdown+0x1b2/0x1f0() > Modules linked in: > CPU: 0 PID: 2787 Comm: modprobe Tainted: GW3.14.0-rc1-mm1+ #1 > Hardware name: >0600 88003ae1dde8 816d9583 0600 > 88003ae1de28 8107c107 >880037ab2b00 88007c240d30 ea0001ee5280 ea0001ee52a0 > Call Trace: >[] dump_stack+0x51/0x6e >[] warn_slowpath_common+0x87/0xb0 >[] warn_slowpath_null+0x15/0x20 >[] __kmem_cache_shutdown+0x1b2/0x1f0 >[] kmem_cache_destroy+0x43/0xf0 >[] xfs_destroy_zones+0x103/0x110 [xfs] >[] exit_xfs_fs+0x38/0x4e4 [xfs] >[] SyS_delete_module+0x19a/0x1f0 >[] ? retint_swapgs+0x13/0x1b >[] ? trace_hardirqs_on_caller+0x105/0x1d0 >[] ? trace_hardirqs_on_thunk+0x3a/0x3f >[] system_call_fastpath+0x16/0x1b > > > His solution was to add a spinlock in order to quiet lockdep. Although > there would be no contention to adding the lock, that lock also > requires disabling of interrupts which will have a larger impact on the > system. > > Instead of adding a spinlock to a location where it is not needed for > lockdep, make a __remove_partial() function that does not test if > the list_lock is held, as no one should have it due to it being freed. > > Also added a __add_partial() function that does not do the lock validation > either, as it is not needed for the creation of the cache. > > Suggested-by: David Rientjes > Reported-by: Vladimir Davydov > Signed-off-by: Steven Rostedt > > Index: linux-trace.git/mm/slub.c > === > --- linux-trace.git.orig/mm/slub.c > +++ linux-trace.git/mm/slub.c > @@ -1520,11 +1520,9 @@ static void discard_slab(struct kmem_cac > /* > * Management of partially allocated slabs. > */ > -static inline void add_partial(struct kmem_cache_node *n, > - struct page *page, int tail) > +static inline void > +__add_partial(struct kmem_cache_node *n, struct page *page, int tail) > { > - lockdep_assert_held(&n->list_lock); > - > n->nr_partial++; > if (tail == DEACTIVATE_TO_TAIL) > list_add_tail(&page->lru, &n->partial); > @@ -1532,15 +1530,27 @@ static inline void add_partial(struct km > list_add(&page->lru, &n->partial); > } > > -static inline void remove_partial(struct kmem_cache_node *n, > - struct page *page) > +static inline void add_partial(struct kmem_cache_node *n, > + struct page *page, int tail) > { > lockdep_assert_held(&n->list_lock); > + __add_partial(n, page, tail); > +} > > +static inline void > +__remove_partial(struct kmem_cache_node *n, struct page *page) > +{ > list_del(&page->lru); > n->nr_partial--; > } > > +static inline void remove_partial(struct kmem_cache_node *n, > + struct page *page) > +{ > + lockdep_assert_held(&n->list_lock); > + __remove_partial(n, page); > +} > + > /* > * Remove slab from the partial list, freeze it and > * return the pointer to the freelist. > @@ -2906,12 +2916,10 @@ static void early_kmem_cache_node_alloc( > inc_slabs_node(kmem_cache_node, node, page->objects); > > /* > - * the lock is for lockdep's sake, not for any actual > - * race protection > + * No locks need to be taken here as it has just been > + * initialized and there is no concurrent access. >*/ > - spin_lock(&n->list_lock); > - add_partial(n, page, DEACTIVATE_TO_HEAD); > - spin_unlock(&n->list_lock); > + __add_partial(n, page, DEACTIVATE_TO_HEAD); > } > > static void free_kmem_cache_nodes(struct kmem_cache *s) > @@ -3197,7 +3205,7 @@ static void free_partial(struct kmem_cac > > list_for_each_entry_safe(page, h, &n->partial, lru) { > if (!page->inuse) { > - remove_partial(n, page); > + __remove_partial(n, page); > discard_slab(s, page); > } else { > list_slab_objects(s, page, Looks neat. FWIW, Acked-by: Vladimir Davydov Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 1/6] fat: add i_disksize to represent uninitialized size
2014-02-04, OGAWA Hirofumi : > OGAWA Hirofumi writes: > Don't we need to update ->i_disksize after cont_write_begin()? >>> We don't need to update i_disksize after cont_write_begin. >>> It is taken care by the fat_get_block after the allocation. >>> For all write paths we align the mmu_private and i_disksize from >>> fat_fill_inode and fat_get_block. >> >> fat_fill_inode() just set i_disksize to i_size. So, it is not aligned by >> cluster size or block size. >> >> E.g. ->mmu_private = 500. Then, cont_write_begin() can set ->mmu_private >> to 512 on some case. In this case, fat_get_block() will not be called, >> because no new allocation. >> >> If this is true, it would be possible to have ->mmu_private == 512 and >> ->i_disksize == 500. >> >> I'm missing something? > > BTW, even if above was right, I'm not checking whether updating > ->i_disksize after cont_write_begin() is right fix or not. I understand your concern. these can be mismatched. But, when checking your doubt, I can not find any side effect. I think that there is no issue regardless of alignment of two value, in the cont_write_begin. Could you please share any point I am missing ? If you suggest checking point or test method, I can check more and share the result. Thanks OGAWA. > -- > OGAWA Hirofumi > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mm: __set_page_dirty_nobuffers uses spin_lock_irqseve instead of spin_lock_irq
(2014/02/04 1:49), kosaki.motoh...@gmail.com wrote: From: KOSAKI Motohiro During aio stress test, we observed the following lockdep warning. This mean AIO+numa_balancing is currently deadlockable. The problem is, aio_migratepage disable interrupt, but __set_page_dirty_nobuffers unintentionally enable it again. Generally, all helper function should use spin_lock_irqsave() instead of spin_lock_irq() because they don't know caller at all. [ 599.843948] other info that might help us debug this: [ 599.873748] Possible unsafe locking scenario: [ 599.873748] [ 599.900902]CPU0 [ 599.912701] [ 599.924929] lock(&(&ctx->completion_lock)->rlock); [ 599.950299] [ 599.962576] lock(&(&ctx->completion_lock)->rlock); [ 599.985771] [ 599.985771] *** DEADLOCK *** [ 600.375623] [] dump_stack+0x19/0x1b [ 600.398769] [] print_usage_bug+0x1f7/0x208 [ 600.425092] [] ? print_shortest_lock_dependencies+0x1d0/0x1d0 [ 600.458981] [] mark_lock+0x21d/0x2a0 [ 600.482910] [] mark_held_locks+0xb9/0x140 [ 600.508956] [] ? _raw_spin_unlock_irq+0x2c/0x50 [ 600.536825] [] trace_hardirqs_on_caller+0x105/0x1d0 [ 600.566861] [] trace_hardirqs_on+0xd/0x10 [ 600.593210] [] _raw_spin_unlock_irq+0x2c/0x50 [ 600.620599] [] __set_page_dirty_nobuffers+0x8c/0xf0 [ 600.649992] [] migrate_page_copy+0x434/0x540 [ 600.676635] [] aio_migratepage+0xb1/0x140 [ 600.703126] [] move_to_new_page+0x7d/0x230 [ 600.729022] [] migrate_pages+0x5e5/0x700 [ 600.754705] [] ? buffer_migrate_lock_buffers+0xb0/0xb0 [ 600.785784] [] migrate_misplaced_page+0xbc/0xf0 [ 600.814029] [] do_numa_page+0x102/0x190 [ 600.839182] [] handle_pte_fault+0x241/0x970 [ 600.865875] [] handle_mm_fault+0x265/0x370 [ 600.892071] [] __do_page_fault+0x172/0x5a0 [ 600.918065] [] ? retint_swapgs+0x13/0x1b [ 600.943493] [] do_page_fault+0x1a/0x70 [ 600.968081] [] page_fault+0x28/0x30 Signed-off-by: KOSAKI Motohiro Cc: Larry Woodman Cc: Rik van Riel Cc: Johannes Weiner Cc: sta...@vger.kernel.org --- Tested-by: Yasuaki Ishimatsu Thank you for posting the patch. The same issue occurred on my box. And I confirmed that the issue disappeared by the patch. Thanks, Yasuaki Ishimatsu mm/page-writeback.c |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 2d30e2c..7106cb1 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2173,11 +2173,12 @@ int __set_page_dirty_nobuffers(struct page *page) if (!TestSetPageDirty(page)) { struct address_space *mapping = page_mapping(page); struct address_space *mapping2; + unsigned long flags; if (!mapping) return 1; - spin_lock_irq(&mapping->tree_lock); + spin_lock_irqsave(&mapping->tree_lock, flags); mapping2 = page_mapping(page); if (mapping2) { /* Race with truncate? */ BUG_ON(mapping2 != mapping); @@ -2186,7 +2187,7 @@ int __set_page_dirty_nobuffers(struct page *page) radix_tree_tag_set(&mapping->page_tree, page_index(page), PAGECACHE_TAG_DIRTY); } - spin_unlock_irq(&mapping->tree_lock); + spin_unlock_irqrestore(&mapping->tree_lock, flags); if (mapping->host) { /* !PageAnon && !swapper_space */ __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH V4 5/8] SPEAr13xx: Fixup: Move SPEAr1340 SATA platform code to phy driver
Hi, On Thursday 06 February 2014 10:14 AM, Pratyush Anand wrote: > ahci driver needs some platform specific functions which are called at > init, exit, suspend and resume conditions. Till now these functions were > present in a platform driver with a fixme notes. > > Similar functions modifying same set of registers will also be needed in > case of PCIe phy init/exit. > > So move all these SATA platform code to phy-miphy40lp driver. > > Signed-off-by: Pratyush Anand > Tested-by: Mohit Kumar > Cc: Viresh Kumar > Cc: Tejun Heo > Cc: Arnd Bergmann > Cc: Kishon Vijay Abraham I > Cc: spear-de...@list.st.com > Cc: linux-arm-ker...@lists.infradead.org > Cc: devicet...@vger.kernel.org > Cc: linux-...@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > --- > .../devicetree/bindings/arm/spear-misc.txt | 4 + > arch/arm/boot/dts/spear1310-evb.dts| 4 + > arch/arm/boot/dts/spear1310.dtsi | 39 +++- > arch/arm/boot/dts/spear1340-evb.dts| 4 + > arch/arm/boot/dts/spear1340.dtsi | 13 +- > arch/arm/boot/dts/spear13xx.dtsi | 5 + > arch/arm/mach-spear/Kconfig| 2 + > arch/arm/mach-spear/spear1340.c| 127 + > drivers/phy/phy-miphy40lp.c| 204 > - It would be better if you can split this patch. Keep arch/ in separate patch and drivers/ in separate patch. > 9 files changed, 266 insertions(+), 136 deletions(-) > create mode 100644 Documentation/devicetree/bindings/arm/spear-misc.txt > . . . . > static const char * const spear1340_dt_board_compat[] = { > diff --git a/drivers/phy/phy-miphy40lp.c b/drivers/phy/phy-miphy40lp.c > index d478c14..cc7f45d 100644 > --- a/drivers/phy/phy-miphy40lp.c > +++ b/drivers/phy/phy-miphy40lp.c > @@ -8,6 +8,7 @@ > * it under the terms of the GNU General Public License version 2 as > * published by the Free Software Foundation. > * > + * 04/02/2014: Adding support of SATA mode for SPEAr1340. > */ > > #include > @@ -19,6 +20,60 @@ > #include > #include > > +/* SPEAr1340 Registers */ > +/* Power Management Registers */ > +#define SPEAR1340_PCM_CFG0x100 > + #define SPEAR1340_PCM_CFG_SATA_POWER_EN 0x800 > +#define SPEAR1340_PCM_WKUP_CFG 0x104 > +#define SPEAR1340_SWITCH_CTR 0x108 > + > +#define SPEAR1340_PERIP1_SW_RST 0x318 > + #define SPEAR1340_PERIP1_SW_RST_SATA0x1000 > +#define SPEAR1340_PERIP2_SW_RST 0x31C > +#define SPEAR1340_PERIP3_SW_RST 0x320 > + > +/* PCIE - SATA configuration registers */ > +#define SPEAR1340_PCIE_SATA_CFG 0x424 > + /* PCIE CFG MASks */ > + #define SPEAR1340_PCIE_CFG_DEVICE_PRESENT (1 << 11) use BIT() wherever possible. > + #define SPEAR1340_PCIE_CFG_POWERUP_RESET(1 << 10) > + #define SPEAR1340_PCIE_CFG_CORE_CLK_EN (1 << 9) > + #define SPEAR1340_PCIE_CFG_AUX_CLK_EN (1 << 8) > + #define SPEAR1340_SATA_CFG_TX_CLK_EN(1 << 4) > + #define SPEAR1340_SATA_CFG_RX_CLK_EN(1 << 3) > + #define SPEAR1340_SATA_CFG_POWERUP_RESET(1 << 2) > + #define SPEAR1340_SATA_CFG_PM_CLK_EN(1 << 1) > + #define SPEAR1340_PCIE_SATA_SEL_PCIE(0) > + #define SPEAR1340_PCIE_SATA_SEL_SATA(1) > + #define SPEAR1340_PCIE_SATA_CFG_MASK0xF1F > + #define SPEAR1340_PCIE_CFG_VAL (SPEAR1340_PCIE_SATA_SEL_PCIE | \ > + SPEAR1340_PCIE_CFG_AUX_CLK_EN | \ > + SPEAR1340_PCIE_CFG_CORE_CLK_EN | \ > + SPEAR1340_PCIE_CFG_POWERUP_RESET | \ > + SPEAR1340_PCIE_CFG_DEVICE_PRESENT) > + #define SPEAR1340_SATA_CFG_VAL (SPEAR1340_PCIE_SATA_SEL_SATA | \ > + SPEAR1340_SATA_CFG_PM_CLK_EN | \ > + SPEAR1340_SATA_CFG_POWERUP_RESET | \ > + SPEAR1340_SATA_CFG_RX_CLK_EN | \ > + SPEAR1340_SATA_CFG_TX_CLK_EN) > + > +#define SPEAR1340_PCIE_MIPHY_CFG 0x428 > + #define SPEAR1340_MIPHY_OSC_BYPASS_EXT (1 << 31) > + #define SPEAR1340_MIPHY_CLK_REF_DIV2(1 << 27) > + #define SPEAR1340_MIPHY_CLK_REF_DIV4(2 << 27) > + #define SPEAR1340_MIPHY_CLK_REF_DIV8(3 << 27) > + #define SPEAR1340_MIPHY_PLL_RATIO_TOP(x)(x << 0) > + #define SPEAR1340_PCIE_MIPHY_CFG_MASK 0xF8FF > + #define SPEAR1340_PCIE_SATA_MIPHY_CFG_SATA \ > + (SPEAR1340_MIPHY_OSC_BYPASS_EXT | \ > + SPEAR1340_MIPHY_CLK_REF_DIV2 | \ > + SPEAR1340_MIPHY_PLL_RATIO_TOP(60)) > + #define SPEAR1340_PCIE_SATA_MIPHY_CFG_SATA_25M_CRYSTAL_CLK \ > + (SPEAR1340_MIPHY_PLL_RATIO_TOP(120)) > + #define SPEAR1340_
Re: [PATCH 1/3] perf tools: Put proper period for for samples without PERIOD sample_type
Hi Jiri, On Wed, 5 Feb 2014 15:33:29 +0100, Jiri Olsa wrote: > On Wed, Feb 05, 2014 at 10:27:30AM +0900, Namhyung Kim wrote: >> Hi Jiri, >> >> On Mon, 3 Feb 2014 12:44:41 +0100, Jiri Olsa wrote: >> > We use PERF_SAMPLE_PERIOD sample type only for frequency >> > setup -F (default) option. The -c does not need store period, >> > because it's always the same. >> > >> > In -c case the report code uses '1' as period. Fixing >> > it to perf_event_attr::sample_period. >> >> All 3 patches look good. But I found something strange. When we >> setup/config evsel attrs following code is used: >> >> util/evsel.c::perf_evsel__config() >> >> /* >> * We default some events to a 1 default interval. But keep >> * it a weak assumption overridable by the user. >> */ >> if (!attr->sample_period || (opts->user_freq != UINT_MAX && >> opts->user_interval != ULLONG_MAX)) { >> if (opts->freq) { >> perf_evsel__set_sample_bit(evsel, PERIOD); >> attr->freq = 1; >> attr->sample_freq = opts->freq; >> } else { >> attr->sample_period = opts->default_interval; >> } >> } > > yes, I think thats right.. we should use || instead of && > > It will allow to change period for event types with predefined > attr->sample_period like tracepoints. Right. As I read the code, it works "if (!attr->sample_period)" case only. > > However, I tried with tracepoints and even with this fix > and following command line: > > # perf record -e syscalls:sys_enter_read -c 2 ls > > you'll still get samples with period 1. The reason is in > kernel code: > > static void perf_swevent_event(struct perf_event *event, u64 nr, >struct perf_sample_data *data, >struct pt_regs *regs) > { > ... > if ((event->attr.sample_type & PERF_SAMPLE_PERIOD) && > !event->attr.freq) { > data->period = nr; > return perf_swevent_overflow(event, 1, data, regs); > > bacause above condition is true for tracepoints. > > It looks like a bug, but I'm not sure how handy it'd be > set period other than 1 for tracepoints thought.. ;) Agreed. But at least we should support whatever user wants IMHO.. > > Maybe it's not that big issue in comparison of screwing > up other software events processing. :) Thanks, Namhyung -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH V4 4/8] phy: st-miphy-40lp: Add skeleton driver
Hi, On Thursday 06 February 2014 11:44 AM, Pratyush Anand wrote: > Hi Kishon, > > On Thu, Feb 06, 2014 at 02:01:45PM +0800, Kishon Vijay Abraham I wrote: >> Hi, >> >> On Thursday 06 February 2014 10:14 AM, Pratyush Anand wrote: >>> ST miphy-40lp supports PCIe, SATA and Super Speed USB. This driver adds >>> skeleton support for the same. >>> >>> Currently phy ops are returning -EINVAL. They can be elaborated >>> depending on the SOC being supported in future. >>> >>> Signed-off-by: Pratyush Anand >>> Tested-by: Mohit Kumar >>> Cc: Arnd Bergmann >>> Cc: Kishon Vijay Abraham I >>> Cc: spear-de...@list.st.com >>> Cc: linux-arm-ker...@lists.infradead.org >>> Cc: devicet...@vger.kernel.org >>> Cc: linux-kernel@vger.kernel.org >>> --- >>> .../devicetree/bindings/phy/st-miphy40lp.txt | 12 ++ >>> drivers/phy/Kconfig| 6 + >>> drivers/phy/Makefile | 1 + >>> drivers/phy/phy-miphy40lp.c| 174 >>> + >>> 4 files changed, 193 insertions(+) >>> create mode 100644 Documentation/devicetree/bindings/phy/st-miphy40lp.txt >>> create mode 100644 drivers/phy/phy-miphy40lp.c >>> >>> diff --git a/Documentation/devicetree/bindings/phy/st-miphy40lp.txt >>> b/Documentation/devicetree/bindings/phy/st-miphy40lp.txt >>> new file mode 100644 >>> index 000..d0c7096 >>> --- /dev/null >>> +++ b/Documentation/devicetree/bindings/phy/st-miphy40lp.txt >>> @@ -0,0 +1,12 @@ >>> +Required properties: >>> +- compatible : should be "st,miphy40lp-phy" >>> + Other supported soc specific compatible: >>> + "st,spear1310-miphy" >>> + "st,spear1340-miphy" >>> +- reg : offset and length of the PHY register set. >>> +- misc: phandle for the syscon node to access misc registers >>> +- phy-id: Instance id of the phy. >>> +- #phy-cells : from the generic PHY bindings, must be 1. >>> + - 1st cell: phandle to the phy node. >>> + - 2nd cell: 0 if phy (in 1st cell) is to be used for SATA, 1 for PCIe >>> + and 2 for Super Speed USB. >>> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig >>> index afa2354..2f58993 100644 >>> --- a/drivers/phy/Kconfig >>> +++ b/drivers/phy/Kconfig >>> @@ -64,4 +64,10 @@ config BCM_KONA_USB2_PHY >>> help >>> Enable this to support the Broadcom Kona USB 2.0 PHY. >>> >>> +config PHY_ST_MIPHY40LP >>> + tristate "ST MIPHY 40LP driver" >>> + help >>> + Support for ST MIPHY 40LP which can be used for PCIe, SATA and Super >>> Speed USB. >>> + select GENERIC_PHY >>> + >>> endmenu >>> diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile >>> index b57c253..c061091 100644 >>> --- a/drivers/phy/Makefile >>> +++ b/drivers/phy/Makefile >>> @@ -9,3 +9,4 @@ obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO) += >>> phy-exynos-mipi-video.o >>> obj-$(CONFIG_PHY_MVEBU_SATA) += phy-mvebu-sata.o >>> obj-$(CONFIG_OMAP_USB2)+= phy-omap-usb2.o >>> obj-$(CONFIG_TWL4030_USB) += phy-twl4030-usb.o >>> +obj-$(CONFIG_PHY_ST_MIPHY40LP) += phy-miphy40lp.o >>> diff --git a/drivers/phy/phy-miphy40lp.c b/drivers/phy/phy-miphy40lp.c >>> new file mode 100644 >>> index 000..d478c14 >>> --- /dev/null >>> +++ b/drivers/phy/phy-miphy40lp.c >>> @@ -0,0 +1,174 @@ >>> +/* >>> + * ST MiPHY-40LP PHY driver >>> + * >>> + * Copyright (C) 2014 ST Microelectronics >>> + * Pratyush Anand >>> + * >>> + * This program is free software; you can redistribute it and/or modify >>> + * it under the terms of the GNU General Public License version 2 as >>> + * published by the Free Software Foundation. >>> + * >>> + */ >>> + >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> + >>> +enum phy_mode { >>> + SATA, >>> + PCIE, >>> + SS_USB, >>> +}; >>> + >>> +struct st_miphy40lp_priv { >>> + /* regmap for any soc specific misc registers */ >>> + struct regmap *misc; >>> + /* phy struct pointer */ >>> + struct phy *phy; >>> + /* device node pointer */ >>> + struct device_node *np; >>> + /* phy mode: 0 for SATA 1 for PCIe and 2 for SS-USB */ >>> + enum phy_mode mode; >>> + /* instance id of this phy */ >>> + u32 id; >>> +}; >>> + >>> +static int miphy40lp_init(struct phy *phy) >>> +{ >>> + return -EINVAL; >>> +} >>> + >>> +static int miphy40lp_exit(struct phy *phy) >>> +{ >>> + return -EINVAL; >>> +} >>> + >>> +static int miphy40lp_power_off(struct phy *phy) >>> +{ >>> + return -EINVAL; >>> +} >>> + >>> +static int miphy40lp_power_on(struct phy *phy) >>> +{ >>> + return -EINVAL; >>> +} >>> + >>> +static const struct of_device_id st_miphy40lp_of_match[] = { >>> + { .compatible = "st,miphy40lp-phy" }, >>> + { }, >>> +}; >>> +MODULE_DEVICE_TABLE(of, st_miphy40lp_of_match); >>> + >>> +static struct phy_ops st_miphy40lp_ops = { >>> + .init = miphy40lp_init, >>> + .exit = miphy40lp_exit, >>> + .
Re: 3.13: BUG: unable to handle kernel paging request at 00000000b4343e88
> > Using your config I was able to reproduce the crash and locate the > > cause. Commit d61931d89b, "x86: Add optimized popcnt variants" adds > > option -fcall-saved-rdi to the compile flags of lib/hweight.c when > > compiling for x86_64. Together with options --coverage and -O2, this > > results in a broken constructor being generated by GCC for this object > > file which in turn causes __gcov_init() to overwrite random memory > > locations (a mutex in your case). > > Could you give this patch a try? It is a variation of the approach > proposed in the discussion mentioned earlier and fixes the problem > on my system. It works for me too - the machine booted up with no problem. -- Meelis Roos (mr...@linux.ee) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH V4 4/8] phy: st-miphy-40lp: Add skeleton driver
Hi Kishon, On Thu, Feb 06, 2014 at 02:01:45PM +0800, Kishon Vijay Abraham I wrote: > Hi, > > On Thursday 06 February 2014 10:14 AM, Pratyush Anand wrote: > > ST miphy-40lp supports PCIe, SATA and Super Speed USB. This driver adds > > skeleton support for the same. > > > > Currently phy ops are returning -EINVAL. They can be elaborated > > depending on the SOC being supported in future. > > > > Signed-off-by: Pratyush Anand > > Tested-by: Mohit Kumar > > Cc: Arnd Bergmann > > Cc: Kishon Vijay Abraham I > > Cc: spear-de...@list.st.com > > Cc: linux-arm-ker...@lists.infradead.org > > Cc: devicet...@vger.kernel.org > > Cc: linux-kernel@vger.kernel.org > > --- > > .../devicetree/bindings/phy/st-miphy40lp.txt | 12 ++ > > drivers/phy/Kconfig| 6 + > > drivers/phy/Makefile | 1 + > > drivers/phy/phy-miphy40lp.c| 174 > > + > > 4 files changed, 193 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/phy/st-miphy40lp.txt > > create mode 100644 drivers/phy/phy-miphy40lp.c > > > > diff --git a/Documentation/devicetree/bindings/phy/st-miphy40lp.txt > > b/Documentation/devicetree/bindings/phy/st-miphy40lp.txt > > new file mode 100644 > > index 000..d0c7096 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/phy/st-miphy40lp.txt > > @@ -0,0 +1,12 @@ > > +Required properties: > > +- compatible : should be "st,miphy40lp-phy" > > + Other supported soc specific compatible: > > + "st,spear1310-miphy" > > + "st,spear1340-miphy" > > +- reg : offset and length of the PHY register set. > > +- misc: phandle for the syscon node to access misc registers > > +- phy-id: Instance id of the phy. > > +- #phy-cells : from the generic PHY bindings, must be 1. > > + - 1st cell: phandle to the phy node. > > + - 2nd cell: 0 if phy (in 1st cell) is to be used for SATA, 1 for PCIe > > + and 2 for Super Speed USB. > > diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig > > index afa2354..2f58993 100644 > > --- a/drivers/phy/Kconfig > > +++ b/drivers/phy/Kconfig > > @@ -64,4 +64,10 @@ config BCM_KONA_USB2_PHY > > help > > Enable this to support the Broadcom Kona USB 2.0 PHY. > > > > +config PHY_ST_MIPHY40LP > > + tristate "ST MIPHY 40LP driver" > > + help > > + Support for ST MIPHY 40LP which can be used for PCIe, SATA and Super > > Speed USB. > > + select GENERIC_PHY > > + > > endmenu > > diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile > > index b57c253..c061091 100644 > > --- a/drivers/phy/Makefile > > +++ b/drivers/phy/Makefile > > @@ -9,3 +9,4 @@ obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO) += > > phy-exynos-mipi-video.o > > obj-$(CONFIG_PHY_MVEBU_SATA) += phy-mvebu-sata.o > > obj-$(CONFIG_OMAP_USB2)+= phy-omap-usb2.o > > obj-$(CONFIG_TWL4030_USB) += phy-twl4030-usb.o > > +obj-$(CONFIG_PHY_ST_MIPHY40LP) += phy-miphy40lp.o > > diff --git a/drivers/phy/phy-miphy40lp.c b/drivers/phy/phy-miphy40lp.c > > new file mode 100644 > > index 000..d478c14 > > --- /dev/null > > +++ b/drivers/phy/phy-miphy40lp.c > > @@ -0,0 +1,174 @@ > > +/* > > + * ST MiPHY-40LP PHY driver > > + * > > + * Copyright (C) 2014 ST Microelectronics > > + * Pratyush Anand > > + * > > + * This program is free software; you can redistribute it and/or modify > > + * it under the terms of the GNU General Public License version 2 as > > + * published by the Free Software Foundation. > > + * > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +enum phy_mode { > > + SATA, > > + PCIE, > > + SS_USB, > > +}; > > + > > +struct st_miphy40lp_priv { > > + /* regmap for any soc specific misc registers */ > > + struct regmap *misc; > > + /* phy struct pointer */ > > + struct phy *phy; > > + /* device node pointer */ > > + struct device_node *np; > > + /* phy mode: 0 for SATA 1 for PCIe and 2 for SS-USB */ > > + enum phy_mode mode; > > + /* instance id of this phy */ > > + u32 id; > > +}; > > + > > +static int miphy40lp_init(struct phy *phy) > > +{ > > + return -EINVAL; > > +} > > + > > +static int miphy40lp_exit(struct phy *phy) > > +{ > > + return -EINVAL; > > +} > > + > > +static int miphy40lp_power_off(struct phy *phy) > > +{ > > + return -EINVAL; > > +} > > + > > +static int miphy40lp_power_on(struct phy *phy) > > +{ > > + return -EINVAL; > > +} > > + > > +static const struct of_device_id st_miphy40lp_of_match[] = { > > + { .compatible = "st,miphy40lp-phy" }, > > + { }, > > +}; > > +MODULE_DEVICE_TABLE(of, st_miphy40lp_of_match); > > + > > +static struct phy_ops st_miphy40lp_ops = { > > + .init = miphy40lp_init, > > + .exit = miphy40lp_exit, > > + .power_off = miphy40lp_power_off, > > + .power_on = miphy40lp_power_on
Re: [PATCH v3 1/1] watchdog: Add tegra watchdog
On 02/05/2014 07:38 PM, Andrew Chew wrote: Add a driver for the hardware watchdogs in NVIDIA Tegra SoCs (Tegra30 and later). This driver will configure one watchdog timer that will reset the system in the case of a watchdog timeout. This driver binds to the nvidia,tegra30-timer device node and gets its register base from there. Signed-off-by: Andrew Chew --- Changes from V2: Applied all of Stephen Warren's comments. Modified suspend callback by only stopping the watchdog timer if it was currently active. Added some logging during suspend/resume. Documentation/watchdog/watchdog-parameters.txt | 5 + drivers/watchdog/Kconfig | 11 + drivers/watchdog/Makefile | 1 + drivers/watchdog/tegra_wdt.c | 371 + 4 files changed, 388 insertions(+) create mode 100644 drivers/watchdog/tegra_wdt.c diff --git a/Documentation/watchdog/watchdog-parameters.txt b/Documentation/watchdog/watchdog-parameters.txt index f9492fe..b39f355 100644 --- a/Documentation/watchdog/watchdog-parameters.txt +++ b/Documentation/watchdog/watchdog-parameters.txt @@ -325,6 +325,11 @@ soft_noboot: Softdog action, set to 1 to ignore reboots, 0 to reboot stmp3xxx_wdt: heartbeat: Watchdog heartbeat period in seconds from 1 to 4194304, default 19 - +tegra_wdt: +heartbeat: Watchdog heartbeats in seconds. (default = 120) +nowayout: Watchdog cannot be stopped once started + (default=kernel config parameter) +- ts72xx_wdt: timeout: Watchdog timeout in seconds. (1 <= timeout <= 8, default=8) nowayout: Disable watchdog shutdown on close diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 4c4c566..3aae2da 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -420,6 +420,17 @@ config SIRFSOC_WATCHDOG Support for CSR SiRFprimaII and SiRFatlasVI watchdog. When the watchdog triggers the system will be reset. +config TEGRA_WATCHDOG + tristate "Tegra watchdog" + depends on ARCH_TEGRA || COMPILE_TEST Hope you tested this on a couple of platforms ? + select WATCHDOG_CORE + help + Say Y here to include support for the watchdog timer + embedded in NVIDIA Tegra SoCs. + + To compile this driver as a module, choose M here: the + module will be called tegra_wdt. + # AVR32 Architecture config AT32AP700X_WDT diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 985a66c..1b5f3d5 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -58,6 +58,7 @@ obj-$(CONFIG_BCM2835_WDT) += bcm2835_wdt.o obj-$(CONFIG_MOXART_WDT) += moxart_wdt.o obj-$(CONFIG_SIRFSOC_WATCHDOG) += sirfsoc_wdt.o obj-$(CONFIG_BCM_KONA_WDT) += bcm_kona_wdt.o +obj-$(CONFIG_TEGRA_WATCHDOG) += tegra_wdt.o # AVR32 Architecture obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o diff --git a/drivers/watchdog/tegra_wdt.c b/drivers/watchdog/tegra_wdt.c new file mode 100644 index 000..1314475 --- /dev/null +++ b/drivers/watchdog/tegra_wdt.c @@ -0,0 +1,371 @@ +/* + * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. + * 2014 ? + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#include +#include +#include +#include +#include +#include +#include Not needed - also see below. +#include + +/* minimum and maximum watchdog trigger timeout, in seconds */ +#define MIN_WDT_TIMEOUT1 +#define MAX_WDT_TIMEOUT255 + +/* + * Base of the WDT registers, from the timer base address. There are + * actually 5 watchdogs that can be configured (by pairing with an available + * timer), at bases 0x100 + (WDT ID) * 0x20, where WDT ID is 0 through 4. + * This driver only configures the first watchdog (WDT ID 0). + */ +#define WDT_BASE 0x100 +#define WDT_ID 0 + +/* + * Register base of the timer that's selected for pairing with the watchdog. + * This driver arbitrarily uses timer 5, which is currently unused by + * other drivers (in particular, the Tegra clocksource driver). If this + * needs to change, take care that the new timer is not used by the + * clocksource driver. + */ +#define WDT_TIMER_BASE 0x60 +#define WDT_TIMER_ID 5 + +/* WDT registers */ +#define WDT_CFG0x0 +#define WDT_CFG_PERIOD_SHIFT 4 +#define WDT_CFG_PERIOD_MASK0xff +#define W
Re: f2fs: f2fs unmount hangs if f2fs_init_acl() fails during mkdir syscall
Hi, Thank you for the test and valuable report. This bug was fixed recently by: commit 03dea3129d558bf5293a6e9f12777176619ac876 Author: Jaegeuk Kim Date: Wed Feb 5 11:16:39 2014 +0900 f2fs: fix to truncate dentry pages in the error case You can find that from the tree: git://git.kernel.org/cgit/linux/kernel/git/jaegeuk/f2fs.git/log/?h=dev Thanks, 2014-02-06 (목), 09:43 +0400, Andrey Tsyvarev: > Hello, > > Testing f2fs (of linux-3.13) under fault simulation, we detected > umount() hangs up after > mkdir()-> >f2fs_add_link()-> > init_inode_metadata()-> >f2fs_init_acl()-> > f2fs_get_acl()-> >f2fs_getxattr()-> > read_all_xattrs() fails. > > Also there was a BUG_ON triggered after the fault in > mkdir()-> >f2fs_add_link()-> > init_inode_metadata()-> >remove_inode_page() -> > f2fs_bug_on(inode->i_blocks != 0 && inode->i_blocks != 1); > > In this case there are 2 blocks allocated, which are counted with > inode->i_blocks field: > > static struct page *init_inode_metadata(struct inode *inode, > struct inode *dir, const struct qstr *name) > { > struct page *page; > int err; > > if (is_inode_flag_set(F2FS_I(inode), FI_NEW_INODE)) { > page = new_inode_page(inode, name); <- First block is > allocated for the inode > if (IS_ERR(page)) > return page; > > if (S_ISDIR(inode->i_mode)) { > err = make_empty_dir(inode, dir, page); <- Second block > is allocated for the inode > if (err) > goto error; > } > > err = f2fs_init_acl(inode, dir, page); <- This call returns > error > if (err) > goto error; > ... > } else { > ... > } > > init_dent_inode(name, page); > > /* > * This file should be checkpointed during fsync. > * We lost i_pino from now on. > */ > if (is_inode_flag_set(F2FS_I(inode), FI_INC_LINK)) { > file_lost_pino(inode); > inc_nlink(inode); > } > return page; > > error: > f2fs_put_page(page, 1); > remove_inode_page(inode); <- Expects at most one block > allocated for inode > return ERR_PTR(err); > } > > Found by Linux File System Verification project (linuxtesting.org). > > > Here are some additional details. > > F2fs-related kernel configuration is: > CONFIG_F2FS_FS=m > CONFIG_F2FS_STAT_FS=y > CONFIG_F2FS_FS_XATTR=y > CONFIG_F2FS_FS_POSIX_ACL=y > CONFIG_F2FS_FS_SECURITY=y > CONFIG_F2FS_CHECK_FS=y > > > BUG_ON log: > [ 117.863869] kernel BUG at fs/f2fs/node.c:825! > [ 117.863870] invalid opcode: [#1] SMP > [ 117.863872] Modules linked in: f2fs kedr_fsim_indicator_common(OF) > kedr_fsim_indicator_capable(OF) > kedr_fsim_indicator_kmalloc(OF) kedr_fsim_vmm(OF) kedr_fsim_mem_util(OF) > kedr_fsim_capable(OF) > kedr_fsim_uaccess(OF) kedr_fsim_cmm(OF) kedr_fault_simulation(OF) > kedr(OF) fuse nf_conntrack_netbios_ns > nf_conntrack_broadcast ipt_MASQUERADE ip6t_REJECT xt_conntrack > ebtable_nat ebtable_broute bridge stp llc > ebtable_filter ebtables ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 > nf_nat_ipv6 ip6table_mangle > ip6table_security ip6table_raw ip6table_filter ip6_tables iptable_nat > nf_conntrack_ipv4 nf_defrag_ipv4 > nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_security > iptable_raw microcode i2c_piix4 parport_pc > e1000 i2c_core parport ata_generic pata_acpi [last unloaded: kedr] > [ 117.863894] CPU: 0 PID: 2766 Comm: fs-driver-tests Tainted: > GF O 3.13.0fs #2 > [ 117.863895] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS > VirtualBox 12/01/2006 > [ 117.863896] task: 881b6420 ti: 8800111ac000 task.ti: > 8800111ac000 > [ 117.863897] RIP: 0010:[] [] > remove_inode_page+0xbf/0xd0 [f2fs] > [ 117.863901] RSP: 0018:8800111ade08 EFLAGS: 00010202 > [ 117.863902] RAX: RBX: 8800125a0c30 RCX: > 881b6a78 > [ 117.863903] RDX: 8800 RSI: ea4b9780 RDI: > 8800125a0c30 > [ 117.863903] RBP: 8800111ade50 R08: 0001 R09: > > [ 117.863904] R10: 0006 R11: 000f R12: > ea4b9780 > [ 117.863905] R13: 0004 R14: ea4b9780 R15: > ea4b97c0 > [ 117.863907] FS: 7ff92dc9f740() GS:88003fc0() > knlGS: > [ 117.863908] CS: 0010 DS: ES: CR0: 8005003b > [ 117.863909] CR2: 7f6673415000 CR3: 3c628000 CR4: > 06f0 > [ 117.863913] Stack: > [ 117.863913] 41ff ea4b97c0 8800111ade50 > a01e9ffa > [ 117.863915] ea4b9780 8800 880012e5d000 > 0003 > [ 117.863917] ea4b9740 8800111adec0 a01d0d20 > 880012532948 > [ 117.863919] Call Trace: > [ 117.863922] [] ? f2fs_init_acl+0x10a/0x1
[PATCH 1/1] minix: Add __init macro to init_inodecache
init_inodecache is only called by __init init_minix_fs. Signed-off-by: Fabian Frederick --- fs/minix/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/minix/inode.c b/fs/minix/inode.c index 0332109..d10aeee 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c @@ -86,7 +86,7 @@ static void init_once(void *foo) inode_init_once(&ei->vfs_inode); } -static int init_inodecache(void) +static int __init init_inodecache(void) { minix_inode_cachep = kmem_cache_create("minix_inode_cache", sizeof(struct minix_inode_info), -- 1.8.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH V4 4/8] phy: st-miphy-40lp: Add skeleton driver
Hi, On Thursday 06 February 2014 10:14 AM, Pratyush Anand wrote: > ST miphy-40lp supports PCIe, SATA and Super Speed USB. This driver adds > skeleton support for the same. > > Currently phy ops are returning -EINVAL. They can be elaborated > depending on the SOC being supported in future. > > Signed-off-by: Pratyush Anand > Tested-by: Mohit Kumar > Cc: Arnd Bergmann > Cc: Kishon Vijay Abraham I > Cc: spear-de...@list.st.com > Cc: linux-arm-ker...@lists.infradead.org > Cc: devicet...@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > --- > .../devicetree/bindings/phy/st-miphy40lp.txt | 12 ++ > drivers/phy/Kconfig| 6 + > drivers/phy/Makefile | 1 + > drivers/phy/phy-miphy40lp.c| 174 > + > 4 files changed, 193 insertions(+) > create mode 100644 Documentation/devicetree/bindings/phy/st-miphy40lp.txt > create mode 100644 drivers/phy/phy-miphy40lp.c > > diff --git a/Documentation/devicetree/bindings/phy/st-miphy40lp.txt > b/Documentation/devicetree/bindings/phy/st-miphy40lp.txt > new file mode 100644 > index 000..d0c7096 > --- /dev/null > +++ b/Documentation/devicetree/bindings/phy/st-miphy40lp.txt > @@ -0,0 +1,12 @@ > +Required properties: > +- compatible : should be "st,miphy40lp-phy" > + Other supported soc specific compatible: > + "st,spear1310-miphy" > + "st,spear1340-miphy" > +- reg : offset and length of the PHY register set. > +- misc: phandle for the syscon node to access misc registers > +- phy-id: Instance id of the phy. > +- #phy-cells : from the generic PHY bindings, must be 1. > + - 1st cell: phandle to the phy node. > + - 2nd cell: 0 if phy (in 1st cell) is to be used for SATA, 1 for PCIe > + and 2 for Super Speed USB. > diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig > index afa2354..2f58993 100644 > --- a/drivers/phy/Kconfig > +++ b/drivers/phy/Kconfig > @@ -64,4 +64,10 @@ config BCM_KONA_USB2_PHY > help > Enable this to support the Broadcom Kona USB 2.0 PHY. > > +config PHY_ST_MIPHY40LP > + tristate "ST MIPHY 40LP driver" > + help > + Support for ST MIPHY 40LP which can be used for PCIe, SATA and Super > Speed USB. > + select GENERIC_PHY > + > endmenu > diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile > index b57c253..c061091 100644 > --- a/drivers/phy/Makefile > +++ b/drivers/phy/Makefile > @@ -9,3 +9,4 @@ obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO) += > phy-exynos-mipi-video.o > obj-$(CONFIG_PHY_MVEBU_SATA) += phy-mvebu-sata.o > obj-$(CONFIG_OMAP_USB2) += phy-omap-usb2.o > obj-$(CONFIG_TWL4030_USB)+= phy-twl4030-usb.o > +obj-$(CONFIG_PHY_ST_MIPHY40LP) += phy-miphy40lp.o > diff --git a/drivers/phy/phy-miphy40lp.c b/drivers/phy/phy-miphy40lp.c > new file mode 100644 > index 000..d478c14 > --- /dev/null > +++ b/drivers/phy/phy-miphy40lp.c > @@ -0,0 +1,174 @@ > +/* > + * ST MiPHY-40LP PHY driver > + * > + * Copyright (C) 2014 ST Microelectronics > + * Pratyush Anand > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 as > + * published by the Free Software Foundation. > + * > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +enum phy_mode { > + SATA, > + PCIE, > + SS_USB, > +}; > + > +struct st_miphy40lp_priv { > + /* regmap for any soc specific misc registers */ > + struct regmap *misc; > + /* phy struct pointer */ > + struct phy *phy; > + /* device node pointer */ > + struct device_node *np; > + /* phy mode: 0 for SATA 1 for PCIe and 2 for SS-USB */ > + enum phy_mode mode; > + /* instance id of this phy */ > + u32 id; > +}; > + > +static int miphy40lp_init(struct phy *phy) > +{ > + return -EINVAL; > +} > + > +static int miphy40lp_exit(struct phy *phy) > +{ > + return -EINVAL; > +} > + > +static int miphy40lp_power_off(struct phy *phy) > +{ > + return -EINVAL; > +} > + > +static int miphy40lp_power_on(struct phy *phy) > +{ > + return -EINVAL; > +} > + > +static const struct of_device_id st_miphy40lp_of_match[] = { > + { .compatible = "st,miphy40lp-phy" }, > + { }, > +}; > +MODULE_DEVICE_TABLE(of, st_miphy40lp_of_match); > + > +static struct phy_ops st_miphy40lp_ops = { > + .init = miphy40lp_init, > + .exit = miphy40lp_exit, > + .power_off = miphy40lp_power_off, > + .power_on = miphy40lp_power_on, > + .owner = THIS_MODULE, Would prefer to either align all the fields or align none. Here only owner is aligned. > +}; > + > +#ifdef CONFIG_PM_SLEEP > +static int miphy40lp_suspend(struct device *dev) > +{ > + return -EINVAL; > +} > + > +static int miphy40lp_resume(struct device *dev) > +{
[PATCH V3 2/3] tick/cpuidle: Initialize hrtimer mode of broadcast
From: Thomas Gleixner On some architectures, in certain CPU deep idle states the local timers stop. An external clock device is used to wakeup these CPUs. The kernel support for the wakeup of these CPUs is provided by the tick broadcast framework by using the external clock device as the wakeup source. However not all implementations of architectures provide such an external clock device. This patch includes support in the broadcast framework to handle the wakeup of the CPUs in deep idle states on such systems by queuing a hrtimer on one of the CPUs, which is meant to handle the wakeup of CPUs in deep idle states. This patchset introduces a pseudo clock device which can be registered by the archs as tick_broadcast_device in the absence of a real external clock device. Once registered, the broadcast framework will work as is for these architectures as long as the archs take care of the BROADCAST_ENTER notification failing for one of the CPUs. This CPU is made the stand by CPU to handle wakeup of the CPUs in deep idle and it *must not enter deep idle states*. The CPU with the earliest wakeup is chosen to be this CPU. Hence this way the stand by CPU dynamically moves around and so does the hrtimer which is queued to trigger at the next earliest wakeup time. This is consistent with the case where an external clock device is present. The smp affinity of this clock device is set to the CPU with the earliest wakeup. This patchset handles the hotplug of the stand by CPU as well by moving the hrtimer on to the CPU handling the CPU_DEAD notification. Signed-off-by: Preeti U Murthy [Added Changelog and code to handle reprogramming of hrtimer] --- include/linux/clockchips.h |9 +++ kernel/time/Makefile |2 - kernel/time/tick-broadcast-hrtimer.c | 105 ++ kernel/time/tick-broadcast.c | 45 ++- 4 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 kernel/time/tick-broadcast-hrtimer.c diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h index e0c5a6c..dbe9e14 100644 --- a/include/linux/clockchips.h +++ b/include/linux/clockchips.h @@ -62,6 +62,11 @@ enum clock_event_mode { #define CLOCK_EVT_FEAT_DYNIRQ 0x20 #define CLOCK_EVT_FEAT_PERCPU 0x40 +/* + * Clockevent device is based on a hrtimer for broadcast + */ +#define CLOCK_EVT_FEAT_HRTIMER 0x80 + /** * struct clock_event_device - clock event device descriptor * @event_handler: Assigned by the framework to be called by the low @@ -83,6 +88,7 @@ enum clock_event_mode { * @name: ptr to clock event name * @rating:variable to rate clock event devices * @irq: IRQ number (only for non CPU local devices) + * @bound_on: Bound on CPU * @cpumask: cpumask to indicate for which CPUs this device works * @list: list head for the management code * @owner: module reference @@ -113,6 +119,7 @@ struct clock_event_device { const char *name; int rating; int irq; + int bound_on; const struct cpumask*cpumask; struct list_headlist; struct module *owner; @@ -180,9 +187,11 @@ extern int tick_receive_broadcast(void); #endif #if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT) +extern void tick_setup_hrtimer_broadcast(void); extern int tick_check_broadcast_expired(void); #else static inline int tick_check_broadcast_expired(void) { return 0; } +static void tick_setup_hrtimer_broadcast(void) {}; #endif #ifdef CONFIG_GENERIC_CLOCKEVENTS diff --git a/kernel/time/Makefile b/kernel/time/Makefile index 9250130..06151ef 100644 --- a/kernel/time/Makefile +++ b/kernel/time/Makefile @@ -3,7 +3,7 @@ obj-y += timeconv.o posix-clock.o alarmtimer.o obj-$(CONFIG_GENERIC_CLOCKEVENTS_BUILD)+= clockevents.o obj-$(CONFIG_GENERIC_CLOCKEVENTS) += tick-common.o -obj-$(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST)+= tick-broadcast.o +obj-$(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST)+= tick-broadcast.o tick-broadcast-hrtimer.o obj-$(CONFIG_GENERIC_SCHED_CLOCK) += sched_clock.o obj-$(CONFIG_TICK_ONESHOT) += tick-oneshot.o obj-$(CONFIG_TICK_ONESHOT) += tick-sched.o diff --git a/kernel/time/tick-broadcast-hrtimer.c b/kernel/time/tick-broadcast-hrtimer.c new file mode 100644 index 000..af1e119 --- /dev/null +++ b/kernel/time/tick-broadcast-hrtimer.c @@ -0,0 +1,105 @@ +/* + * linux/kernel/time/tick-broadcast-hrtimer.c + * This file emulates a local clock event device + * via a pseudo clock device. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tick-internal.h" + +static struct hrtimer bctimer; + +st
[PATCH V3 3/3] time/cpuidle:Handle failed call to BROADCAST_ENTER on archs with CPUIDLE_FLAG_TIMER_STOP set
Some archs set the CPUIDLE_FLAG_TIMER_STOP flag for idle states in which the local timers stop. The cpuidle_idle_call() currently handles such idle states by calling into the broadcast framework so as to wakeup CPUs at their next wakeup event. With the hrtimer mode of broadcast, the BROADCAST_ENTER call into the broadcast frameowork can fail for archs that do not have an external clock device to handle wakeups and the CPU in question has to thus be made the stand by CPU. This patch handles such cases by failing the call into cpuidle so that the arch can take some default action. The arch will certainly not enter a similar idle state because a failed cpuidle call will also implicitly indicate that the broadcast framework has not registered this CPU to be woken up. Hence we are safe if we fail the cpuidle call. In the process move the functions that trace idle statistics just before and after the entry and exit into idle states respectively. In other scenarios where the call to cpuidle fails, we end up not tracing idle entry and exit since a decision on an idle state could not be taken. Similarly when the call to broadcast framework fails, we skip tracing idle statistics because we are in no further position to take a decision on an alternative idle state to enter into. Signed-off-by: Preeti U Murthy --- drivers/cpuidle/cpuidle.c | 38 +++--- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index a55e68f..8f42033 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -117,15 +117,19 @@ int cpuidle_idle_call(void) { struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices); struct cpuidle_driver *drv; - int next_state, entered_state; - bool broadcast; + int next_state, entered_state, ret = 0; + bool broadcast = false; - if (off || !initialized) - return -ENODEV; + if (off || !initialized) { + ret = -ENODEV; + goto out; + } /* check if the device is ready */ - if (!dev || !dev->enabled) - return -EBUSY; + if (!dev || !dev->enabled) { + ret = -EBUSY; + goto out; + } drv = cpuidle_get_cpu_driver(dev); @@ -137,15 +141,18 @@ int cpuidle_idle_call(void) if (cpuidle_curr_governor->reflect) cpuidle_curr_governor->reflect(dev, next_state); local_irq_enable(); - return 0; + goto out; } - trace_cpu_idle_rcuidle(next_state, dev->cpu); - broadcast = !!(drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP); - if (broadcast) - clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu); + if (broadcast) { + ret = clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu); + if (ret) + goto out; + } + + trace_cpu_idle_rcuidle(next_state, dev->cpu); if (cpuidle_state_is_coupled(dev, drv, next_state)) entered_state = cpuidle_enter_state_coupled(dev, drv, @@ -153,16 +160,17 @@ int cpuidle_idle_call(void) else entered_state = cpuidle_enter_state(dev, drv, next_state); - if (broadcast) - clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu); - trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu); /* give the governor an opportunity to reflect on the outcome */ if (cpuidle_curr_governor->reflect) cpuidle_curr_governor->reflect(dev, entered_state); - return 0; +out: if (broadcast) + clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu); + + + return ret; } /** -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V3 0/3] time/cpuidle: Support in tick broadcast framework in absence of external clock device
On some architectures, the local timers of CPUs stop in deep idle states. They will need to depend on an external clock device to wake them up. However certain implementations of archs do not have an external clock device. This patchset provides support in the tick broadcast framework for such architectures so as to enable the CPUs to get into deep idle. Presently we are in need of this support on certain implementations of PowerPC. This patchset has thus been tested on the same. V1: https://lkml.org/lkml/2013/12/12/687. V2: https://lkml.org/lkml/2014/1/24/28 Changes in V3: 1. Modified comments and code around programming of the broadcast hrtimer. --- Preeti U Murthy (2): time: Change the return type of clockevents_notify() to integer time/cpuidle:Handle failed call to BROADCAST_ENTER on archs with CPUIDLE_FLAG_TIMER_STOP set Thomas Gleixner (1): tick/cpuidle: Initialize hrtimer mode of broadcast drivers/cpuidle/cpuidle.c| 38 +++- include/linux/clockchips.h | 15 - kernel/time/Makefile |2 - kernel/time/clockevents.c|8 ++- kernel/time/tick-broadcast-hrtimer.c | 105 ++ kernel/time/tick-broadcast.c | 51 - kernel/time/tick-internal.h |6 +- 7 files changed, 197 insertions(+), 28 deletions(-) create mode 100644 kernel/time/tick-broadcast-hrtimer.c -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V3 1/3] time: Change the return type of clockevents_notify() to integer
The broadcast framework can potentially be made use of by archs which do not have an external clock device as well. Then, it is required that one of the CPUs need to handle the broadcasting of wakeup IPIs to the CPUs in deep idle. As a result its local timers should remain functional all the time. For such a CPU, the BROADCAST_ENTER notification has to fail indicating that its clock device cannot be shutdown. To make way for this support, change the return type of tick_broadcast_oneshot_control() and hence clockevents_notify() to indicate such scenarios. Signed-off-by: Preeti U Murthy --- include/linux/clockchips.h |6 +++--- kernel/time/clockevents.c|8 +--- kernel/time/tick-broadcast.c |6 -- kernel/time/tick-internal.h |6 +++--- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h index 493aa02..e0c5a6c 100644 --- a/include/linux/clockchips.h +++ b/include/linux/clockchips.h @@ -186,9 +186,9 @@ static inline int tick_check_broadcast_expired(void) { return 0; } #endif #ifdef CONFIG_GENERIC_CLOCKEVENTS -extern void clockevents_notify(unsigned long reason, void *arg); +extern int clockevents_notify(unsigned long reason, void *arg); #else -static inline void clockevents_notify(unsigned long reason, void *arg) {} +static inline int clockevents_notify(unsigned long reason, void *arg) { return 0; } #endif #else /* CONFIG_GENERIC_CLOCKEVENTS_BUILD */ @@ -196,7 +196,7 @@ static inline void clockevents_notify(unsigned long reason, void *arg) {} static inline void clockevents_suspend(void) {} static inline void clockevents_resume(void) {} -static inline void clockevents_notify(unsigned long reason, void *arg) {} +static inline int clockevents_notify(unsigned long reason, void *arg) { return 0; } static inline int tick_check_broadcast_expired(void) { return 0; } #endif diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index 086ad60..79b8685 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c @@ -524,12 +524,13 @@ void clockevents_resume(void) #ifdef CONFIG_GENERIC_CLOCKEVENTS /** * clockevents_notify - notification about relevant events + * Returns 0 on success, any other value on error */ -void clockevents_notify(unsigned long reason, void *arg) +int clockevents_notify(unsigned long reason, void *arg) { struct clock_event_device *dev, *tmp; unsigned long flags; - int cpu; + int cpu, ret = 0; raw_spin_lock_irqsave(&clockevents_lock, flags); @@ -542,7 +543,7 @@ void clockevents_notify(unsigned long reason, void *arg) case CLOCK_EVT_NOTIFY_BROADCAST_ENTER: case CLOCK_EVT_NOTIFY_BROADCAST_EXIT: - tick_broadcast_oneshot_control(reason); + ret = tick_broadcast_oneshot_control(reason); break; case CLOCK_EVT_NOTIFY_CPU_DYING: @@ -585,6 +586,7 @@ void clockevents_notify(unsigned long reason, void *arg) break; } raw_spin_unlock_irqrestore(&clockevents_lock, flags); + return ret; } EXPORT_SYMBOL_GPL(clockevents_notify); diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 43780ab..ddf2ac2 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -633,14 +633,15 @@ again: /* * Powerstate information: The system enters/leaves a state, where * affected devices might stop + * Returns 0 on success, -EBUSY if the cpu is used to broadcast wakeups. */ -void tick_broadcast_oneshot_control(unsigned long reason) +int tick_broadcast_oneshot_control(unsigned long reason) { struct clock_event_device *bc, *dev; struct tick_device *td; unsigned long flags; ktime_t now; - int cpu; + int cpu, ret = 0; /* * Periodic mode does not care about the enter/exit of power @@ -746,6 +747,7 @@ void tick_broadcast_oneshot_control(unsigned long reason) } out: raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags); + return ret; } /* diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index 8329669..f0dc03c 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h @@ -46,7 +46,7 @@ extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *)); extern void tick_resume_oneshot(void); # ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc); -extern void tick_broadcast_oneshot_control(unsigned long reason); +extern int tick_broadcast_oneshot_control(unsigned long reason); extern void tick_broadcast_switch_to_oneshot(void); extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup); extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc); @@ -58,7 +58,7 @@ static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) { BUG(); } -sta
f2fs: f2fs unmount hangs if f2fs_init_acl() fails during mkdir syscall
Hello, Testing f2fs (of linux-3.13) under fault simulation, we detected umount() hangs up after mkdir()-> f2fs_add_link()-> init_inode_metadata()-> f2fs_init_acl()-> f2fs_get_acl()-> f2fs_getxattr()-> read_all_xattrs() fails. Also there was a BUG_ON triggered after the fault in mkdir()-> f2fs_add_link()-> init_inode_metadata()-> remove_inode_page() -> f2fs_bug_on(inode->i_blocks != 0 && inode->i_blocks != 1); In this case there are 2 blocks allocated, which are counted with inode->i_blocks field: static struct page *init_inode_metadata(struct inode *inode, struct inode *dir, const struct qstr *name) { struct page *page; int err; if (is_inode_flag_set(F2FS_I(inode), FI_NEW_INODE)) { page = new_inode_page(inode, name); <- First block is allocated for the inode if (IS_ERR(page)) return page; if (S_ISDIR(inode->i_mode)) { err = make_empty_dir(inode, dir, page); <- Second block is allocated for the inode if (err) goto error; } err = f2fs_init_acl(inode, dir, page); <- This call returns error if (err) goto error; ... } else { ... } init_dent_inode(name, page); /* * This file should be checkpointed during fsync. * We lost i_pino from now on. */ if (is_inode_flag_set(F2FS_I(inode), FI_INC_LINK)) { file_lost_pino(inode); inc_nlink(inode); } return page; error: f2fs_put_page(page, 1); remove_inode_page(inode); <- Expects at most one block allocated for inode return ERR_PTR(err); } Found by Linux File System Verification project (linuxtesting.org). Here are some additional details. F2fs-related kernel configuration is: CONFIG_F2FS_FS=m CONFIG_F2FS_STAT_FS=y CONFIG_F2FS_FS_XATTR=y CONFIG_F2FS_FS_POSIX_ACL=y CONFIG_F2FS_FS_SECURITY=y CONFIG_F2FS_CHECK_FS=y BUG_ON log: [ 117.863869] kernel BUG at fs/f2fs/node.c:825! [ 117.863870] invalid opcode: [#1] SMP [ 117.863872] Modules linked in: f2fs kedr_fsim_indicator_common(OF) kedr_fsim_indicator_capable(OF) kedr_fsim_indicator_kmalloc(OF) kedr_fsim_vmm(OF) kedr_fsim_mem_util(OF) kedr_fsim_capable(OF) kedr_fsim_uaccess(OF) kedr_fsim_cmm(OF) kedr_fault_simulation(OF) kedr(OF) fuse nf_conntrack_netbios_ns nf_conntrack_broadcast ipt_MASQUERADE ip6t_REJECT xt_conntrack ebtable_nat ebtable_broute bridge stp llc ebtable_filter ebtables ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw ip6table_filter ip6_tables iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_security iptable_raw microcode i2c_piix4 parport_pc e1000 i2c_core parport ata_generic pata_acpi [last unloaded: kedr] [ 117.863894] CPU: 0 PID: 2766 Comm: fs-driver-tests Tainted: GF O 3.13.0fs #2 [ 117.863895] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 [ 117.863896] task: 881b6420 ti: 8800111ac000 task.ti: 8800111ac000 [ 117.863897] RIP: 0010:[] [] remove_inode_page+0xbf/0xd0 [f2fs] [ 117.863901] RSP: 0018:8800111ade08 EFLAGS: 00010202 [ 117.863902] RAX: RBX: 8800125a0c30 RCX: 881b6a78 [ 117.863903] RDX: 8800 RSI: ea4b9780 RDI: 8800125a0c30 [ 117.863903] RBP: 8800111ade50 R08: 0001 R09: [ 117.863904] R10: 0006 R11: 000f R12: ea4b9780 [ 117.863905] R13: 0004 R14: ea4b9780 R15: ea4b97c0 [ 117.863907] FS: 7ff92dc9f740() GS:88003fc0() knlGS: [ 117.863908] CS: 0010 DS: ES: CR0: 8005003b [ 117.863909] CR2: 7f6673415000 CR3: 3c628000 CR4: 06f0 [ 117.863913] Stack: [ 117.863913] 41ff ea4b97c0 8800111ade50 a01e9ffa [ 117.863915] ea4b9780 8800 880012e5d000 0003 [ 117.863917] ea4b9740 8800111adec0 a01d0d20 880012532948 [ 117.863919] Call Trace: [ 117.863922] [] ? f2fs_init_acl+0x10a/0x180 [f2fs] [ 117.863925] [] __f2fs_add_link+0x560/0x7c0 [f2fs] [ 117.863928] [] f2fs_mkdir+0xbb/0x150 [f2fs] [ 117.863929] [] vfs_mkdir+0xb7/0x160 [ 117.863931] [] SyS_mkdir+0x5f/0xc0 [ 117.863933] [] system_call_fastpath+0x16/0x1b [ 117.863934] Code: e6 49 8b 14 24 83 e2 01 74 23 4c 89 e7 89 45 bc e8 f7 f9 f6 e0 4c 89 e7 e8 ff d1 f7 e0 8b 45 bc 48 83 c4 30 5b 41 5c 41 5d 5d c3 <0f> 0b e8 c8 9d 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 [ 117.863953] RIP [] remove_inode_page+0xbf/0xd0 [f2fs] [ 117.863956] RSP There are several ways for simulate faults in kernel function calls, e.g. manual faults insertion, fault injection kernel infrustructure. In my tests I use KEDR frame
[PATCH v2 1/4] mfd: DT bindings for TPS65218 PMIC
Add DT bindings for TPS65218 PMIC. Signed-off-by: Keerthy --- Documentation/devicetree/bindings/mfd/tps65218.txt | 58 .../devicetree/bindings/regulator/tps65218.txt | 22 2 files changed, 80 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/tps65218.txt create mode 100644 Documentation/devicetree/bindings/regulator/tps65218.txt diff --git a/Documentation/devicetree/bindings/mfd/tps65218.txt b/Documentation/devicetree/bindings/mfd/tps65218.txt new file mode 100644 index 000..5845df7 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/tps65218.txt @@ -0,0 +1,58 @@ +The TPS65218 Integrated Power Management Chips. +These chips are connected to an I2C bus. + +Required properties: +- compatible : Must be "ti,tps65218"; +- interrupts : This I2C device has an IRQ line connected to the main SoC +- interrupt-controller : Since the tps65218 supports several interrupts + internally, it is considered as an interrupt controller cascaded to the SoC. +- #interrupt-cells = <2>; +- interrupt-parent : The parent interrupt controller GIC. + +Optional nodes: +- TPS65218 chip has sub modules. Mainly the DCDCs and regulators. + +Example: +/* + * Integrated Power Management Chip + */ +tps65218: tps65218@24 { + reg = <0x24>; + compatible = "ti,tps65218"; + interrupts = ; /* NMIn */ + interrupt-parent = <&gic>; + interrupt-controller; + #interrupt-cells = <2>; + + dcdc1: regulator-dcdc1 { + compatible = "ti,tps65218-dcdc1"; + /* VDD_CORE voltage limits min of OPP50 and max of OPP100 */ + regulator-name = "vdd_core"; + regulator-min-microvolt = <912000>; + regulator-max-microvolt = <1144000>; + regulator-boot-on; + regulator-always-on; + }; + + dcdc2: regulator-dcdc2 { + compatible = "ti,tps65218-dcdc2"; + /* VDD_MPU voltage limits min of OPP50 and max of OPP_NITRO */ + regulator-name = "vdd_mpu"; + regulator-min-microvolt = <912000>; + regulator-max-microvolt = <1378000>; + regulator-boot-on; + regulator-always-on; + }; + + dcdc3: regulator-dcdc3 { + compatible = "ti,tps65218-dcdc3"; + }; + + ldo1: regulator-ldo1 { + compatible = "ti,tps65218-ldo1"; + regulator-min-microvolt = <180>; + regulator-max-microvolt = <180>; + regulator-boot-on; + regulator-always-on; + }; +}; diff --git a/Documentation/devicetree/bindings/regulator/tps65218.txt b/Documentation/devicetree/bindings/regulator/tps65218.txt new file mode 100644 index 000..17d200a --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/tps65218.txt @@ -0,0 +1,22 @@ +TPS65218 family of regulators + +Required properties: +For tps65218 regulators/LDOs +- compatible: + - "ti,tps65218-dcdc1" for DCDC1 + - "ti,tps65218-dcdc2" for DCDC2 + - "ti,tps65218-dcdc3" for DCDC3 + - "ti,tps65218-dcdc4" for DCDC4 + - "ti,tps65218-dcdc5" for DCDC5 + - "ti,tps65218-dcdc6" for DCDC6 + - "ti,tps65218-ldo1" for LDO1 LDO + +Optional properties: +- Any optional property defined in bindings/regulator/regulator.txt + +Example: + xyz: regulator-dcdc1 { + compatible = "ti,tps65218-dcdc1"; + regulator-min-microvolt = <100>; + regulator-max-microvolt = <300>; + }; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 2/4] MFD: TPS65218: Add driver for the TPS65218 PMIC
The TPS65218 chip is a power management IC for Portable Navigation Systems and Tablet Computing devices. It contains the following components: - Regulators. - Over Temperature warning and Shut down. This patch adds support for tps65218 mfd device. At this time only the regulator functionality is made available. Signed-off-by: Keerthy --- drivers/mfd/Kconfig | 15 +++ drivers/mfd/Makefile |1 + drivers/mfd/tps65218.c | 281 + include/linux/mfd/tps65218.h | 284 ++ 4 files changed, 581 insertions(+) create mode 100644 drivers/mfd/tps65218.c create mode 100644 include/linux/mfd/tps65218.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 49bb445..de55e41 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -853,6 +853,21 @@ config MFD_TPS65217 This driver can also be built as a module. If so, the module will be called tps65217. +config MFD_TPS65218 + tristate "TI TPS65218 Power Management chips" + depends on I2C + select MFD_CORE + select REGMAP_I2C + help + If you say yes here you get support for the TPS65218 series of + Power Management chips. + These include voltage regulators, gpio and other features + that are often used in portable devices. Only regulator + component is currently supported. + + This driver can also be built as a module. If so, the module + will be called tps65218. + config MFD_TPS6586X bool "TI TPS6586x Power Management chips" depends on I2C=y diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 5aea5ef..e1f7279 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -62,6 +62,7 @@ obj-$(CONFIG_TPS6105X)+= tps6105x.o obj-$(CONFIG_TPS65010) += tps65010.o obj-$(CONFIG_TPS6507X) += tps6507x.o obj-$(CONFIG_MFD_TPS65217) += tps65217.o +obj-$(CONFIG_MFD_TPS65218) += tps65218.o obj-$(CONFIG_MFD_TPS65910) += tps65910.o tps65912-objs := tps65912-core.o tps65912-irq.o obj-$(CONFIG_MFD_TPS65912) += tps65912.o diff --git a/drivers/mfd/tps65218.c b/drivers/mfd/tps65218.c new file mode 100644 index 000..02679ac --- /dev/null +++ b/drivers/mfd/tps65218.c @@ -0,0 +1,281 @@ +/* + * Driver for TPS65218 Integrated power management chipsets + * + * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether expressed or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License version 2 for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define TPS65218_PASSWORD_REGS_UNLOCK 0x7D + +/** + * tps65218_reg_read: Read a single tps65218 register. + * + * @tps: Device to read from. + * @reg: Register to read. + * @val: Contians the value + */ +int tps65218_reg_read(struct tps65218 *tps, unsigned int reg, + unsigned int *val) +{ + return regmap_read(tps->regmap, reg, val); +} +EXPORT_SYMBOL_GPL(tps65218_reg_read); + +/** + * tps65218_reg_write: Write a single tps65218 register. + * + * @tps65218: Device to write to. + * @reg: Register to write to. + * @val: Value to write. + * @level: Password protected level + */ +int tps65218_reg_write(struct tps65218 *tps, unsigned int reg, + unsigned int val, unsigned int level) +{ + int ret; + unsigned int xor_reg_val; + + switch (level) { + case TPS65218_PROTECT_NONE: + return regmap_write(tps->regmap, reg, val); + case TPS65218_PROTECT_L1: + xor_reg_val = reg ^ TPS65218_PASSWORD_REGS_UNLOCK; + ret = regmap_write(tps->regmap, TPS65218_REG_PASSWORD, + xor_reg_val); + if (ret < 0) + return ret; + + return regmap_write(tps->regmap, reg, val); + default: + return -EINVAL; + } +} +EXPORT_SYMBOL_GPL(tps65218_reg_write); + +/** + * tps65218_update_bits: Modify bits w.r.t mask, val and level. + * + * @tps65218: Device to write to. + * @reg: Register to read-write to. + * @mask: Mask. + * @val: Value to write. + * @level: Password protected level + */ +static int tps65218_update_bits(struct tps65218 *tps, unsigned int reg, + unsigned int mask, unsigned int val, unsigned int level) +{ + int ret; + unsigned int data; + + ret
[PATCH v2 3/4] Regulators: TPS65218: Add Regulator driver for TPS65218 PMIC
This patch adds support for TPS65218 PMIC regulators. The regulators set consists of 6 DCDCs and 1 LDO. The output voltages are configurable and are meant to supply power to the main processor and other components. Signed-off-by: Keerthy --- drivers/regulator/Kconfig |9 + drivers/regulator/Makefile |1 + drivers/regulator/tps65218-regulator.c | 304 3 files changed, 314 insertions(+) create mode 100644 drivers/regulator/tps65218-regulator.c diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 6a79328..b05da880 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -513,6 +513,15 @@ config REGULATOR_TPS65217 voltage regulators. It supports software based voltage control for different voltage domains +config REGULATOR_TPS65218 + tristate "TI TPS65218 Power regulators" + depends on MFD_TPS65218 + help + This driver supports TPS65218 voltage regulator chips. TPS65218 + provides six step-down converters and one general-purpose LDO + voltage regulators. It supports software based voltage control + for different voltage domains + config REGULATOR_TPS6524X tristate "TI TPS6524X Power regulators" depends on SPI diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index 979f9dd..ba801a5 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile @@ -67,6 +67,7 @@ obj-$(CONFIG_REGULATOR_TPS65023) += tps65023-regulator.o obj-$(CONFIG_REGULATOR_TPS6507X) += tps6507x-regulator.o obj-$(CONFIG_REGULATOR_TPS65090) += tps65090-regulator.o obj-$(CONFIG_REGULATOR_TPS65217) += tps65217-regulator.o +obj-$(CONFIG_REGULATOR_TPS65218) += tps65218-regulator.o obj-$(CONFIG_REGULATOR_TPS6524X) += tps6524x-regulator.o obj-$(CONFIG_REGULATOR_TPS6586X) += tps6586x-regulator.o obj-$(CONFIG_REGULATOR_TPS65910) += tps65910-regulator.o diff --git a/drivers/regulator/tps65218-regulator.c b/drivers/regulator/tps65218-regulator.c new file mode 100644 index 000..39fb189 --- /dev/null +++ b/drivers/regulator/tps65218-regulator.c @@ -0,0 +1,304 @@ +/* + * tps65218-regulator.c + * + * Regulator driver for TPS65218 PMIC + * + * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether expressed or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License version 2 for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static unsigned int tps65218_ramp_delay = 4000; + +enum tps65218_regulators { DCDC1, DCDC2, DCDC3, DCDC4, DCDC5, DCDC6, LDO1 }; + +#define TPS65218_REGULATOR(_name, _id, _ops, _n, _vr, _vm, _er, _em, _t, \ + _lr, _nlr) \ + { \ + .name = _name,\ + .id = _id, \ + .ops= &_ops,\ + .n_voltages = _n, \ + .type = REGULATOR_VOLTAGE,\ + .owner = THIS_MODULE, \ + .vsel_reg = _vr, \ + .vsel_mask = _vm, \ + .enable_reg = _er, \ + .enable_mask= _em, \ + .volt_table = _t, \ + .linear_ranges = _lr, \ + .n_linear_ranges= _nlr, \ + } \ + +#define TPS65218_INFO(_id, _nm, _min, _max)\ + { \ + .id = _id, \ + .name = _nm, \ + .min_uV = _min, \ + .max_uV = _max, \ + } + +static const struct regulator_linear_range dcdc1_dcdc2_ranges[] = { + REGULATOR_LINEAR_RANGE(85, 0x0, 0x32, 1), + REGULATOR_LINEAR_RANGE(1375000, 0x33, 0x3f, 25000), +}; + +static const struct regulator_linear_range ldo1_dcdc3_ranges[] = { + REGULATOR_LINEAR_RANGE(90, 0x0, 0x1a, 25000), + REGULATOR_LINEAR_RANGE(160, 0x1b, 0x3f, 5), +}; + +static const struct regulator_linear_range dcdc4_ranges[] = { +
[PATCH 4/4] ARM: dts: AM43x: Add dts nodes of TPS65218 PMIC
Add DT bindings for TPS65218 PMIC. Signed-off-by: Keerthy --- arch/arm/boot/dts/am43x-epos-evm.dts | 40 ++ 1 file changed, 40 insertions(+) diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts index fbf9c4c..fba45c2 100644 --- a/arch/arm/boot/dts/am43x-epos-evm.dts +++ b/arch/arm/boot/dts/am43x-epos-evm.dts @@ -167,6 +167,46 @@ x-size = <1024>; y-size = <768>; }; + tps65218: tps65218@24 { + reg = <0x24>; + compatible = "ti,tps65218"; + interrupts = ; /* NMIn */ + interrupt-parent = <&gic>; + interrupt-controller; + #interrupt-cells = <2>; + + dcdc1: regulator-dcdc1 { + compatible = "ti,tps65218-dcdc1"; + /* VDD_CORE voltage limits min of OPP50 and max of OPP100 */ + regulator-name = "vdd_core"; + regulator-min-microvolt = <912000>; + regulator-max-microvolt = <1144000>; + regulator-boot-on; + regulator-always-on; + }; + + dcdc2: regulator-dcdc2 { + compatible = "ti,tps65218-dcdc2"; + /* VDD_MPU voltage limits min of OPP50 and max of OPP_NITRO */ + regulator-name = "vdd_mpu"; + regulator-min-microvolt = <912000>; + regulator-max-microvolt = <1378000>; + regulator-boot-on; + regulator-always-on; + }; + + dcdc3: regulator-dcdc3 { + compatible = "ti,tps65218-dcdc3"; + }; + + ldo1: regulator-ldo1 { + compatible = "ti,tps65218-ldo1"; + regulator-min-microvolt = <180>; + regulator-max-microvolt = <180>; + regulator-boot-on; + regulator-always-on; + }; + }; }; &gpio0 { -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/4] [PATCH v2 0/4] MFD: TPS65218: Drivers for TPS65218 PMIC.
The TPS65218 chip is a power management IC for Portable Navigation Systems and Tablet Computing devices. It contains the following components: - Regulators. - Over Temperature warning and Shut down. This patch adds support for TPS65218 mfd device. At this time only the regulator functionality is made available. The series is boot tested on am43x-epos-evm board. Changes in v2: * Introduced register cache for interrupt mask register. * regulator_map_voltage_linear_range instead of custom functions. * Fixed couple of more minor comments. Keerthy (4): mfd: DT bindings for TPS65218 PMIC MFD: TPS65218: Add driver for the TPS65218 PMIC Regulators: TPS65218: Add Regulator driver for TPS65218 PMIC ARM: dts: TPS65218: Add dts nodes of TPS65218 PMIC Documentation/devicetree/bindings/mfd/tps65218.txt | 58 .../devicetree/bindings/regulator/tps65218.txt | 22 ++ arch/arm/boot/dts/am43x-epos-evm.dts | 40 +++ drivers/mfd/Kconfig| 15 + drivers/mfd/Makefile |1 + drivers/mfd/tps65218.c | 281 ++ drivers/regulator/Kconfig |9 + drivers/regulator/Makefile |1 + drivers/regulator/tps65218-regulator.c | 304 include/linux/mfd/tps65218.h | 284 ++ 10 files changed, 1015 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/tps65218.txt create mode 100644 Documentation/devicetree/bindings/regulator/tps65218.txt create mode 100644 drivers/mfd/tps65218.c create mode 100644 drivers/regulator/tps65218-regulator.c create mode 100644 include/linux/mfd/tps65218.h -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] x86, tsc: Add missing Baytrail frequency to the table
* Mika Westerberg wrote: > On Wed, Jan 29, 2014 at 01:47:54PM -0800, Bin Gao wrote: > > On Tue, Jan 28, 2014 at 02:04:07PM +0200, Mika Westerberg wrote: > > > Actually it does not work. I had the fallback path still in the patch when > > > I tried. > > > > Let's merge the ptach v2 then(continue on msr calibration retuning 0). > > All supported SoCs now have the correct frequency ID coding > > so continuing on non-PIC SoCs has very very small possibility. > > x86 maintainers, any comments on this patch (v2)? Without the patch some > Baytrail systems fail to boot 3.14-rc1. It should be split in two: first a patch to fix the divide by zero bug, second the Baytrail addition. Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC] de-asmify the x86-64 system call slowpath
* Linus Torvalds wrote: > [...] > > No, I was thinking "try to optimistically map 8 adjacent aligned > pages at a time" - that would be the same cacheline in the page > tables, so it would be fairly cheap if we couple it with a > gang-lookup of the pages in the page cache (or, for anonymous pages, > by just optimistically trying to do an order-3 page allocation, and > if that works, just map the 32kB allocation you got as eight > individual pages). > > I know it's been discussed at some point, and I even have a dim > memory of having seen some really ugly patches. I have a dim memory of having written such group-prefaulting patches myself a decade ago or so - IIRC the main problem was that at that time we never found a common load where it really mattered, and it was easy to spend more time doing all this extra work and not see the prefaulted pages used. But the cost/benefit balance has indeed changed so IMO it's worth a try. Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH -tip v3 00/11] perf-probe: Updates for handling local functions correctly and distro debuginfo
Hi, Here is the 3rd version of the series for handling local functions correctly with perf-probe. This version also includes distro debuginfo-file support (a small enhancement, based on existing feature). In this version, I used ref_reloc_sym based probe point instead of absolute address/"_stext", because kASLR changes the address offset randomly and the debuginfo doesn't know that offset. Recently perftools supports kASLR by introducing ref_reloc_sym (which is usually "_text" or "_stext"). Since we already ensured that the kmap->ref_reloc_sym symbol exists in the kernel, it is safe to reuse it for the reference point of probe points. Note that this series requires a bugfix patch: perf-probe: Do not add offset to uprobe address https://lkml.org/lkml/2014/2/5/7 Issue 1) Current perf-probe can't handle probe-points for kprobes, since it uses symbol-based probe definition. The symbol based definition is easy to read and robust for differnt kernel and modules. However, when user gives a local function name which has several different instances, it may put probes on wrong (or unexpected) address. On the other hand, since uprobe events are based on the actual address, it can avoid this issue. E.g. In the case to probe t_show local functions (which has 4 different instances. # grep " t_show\$" /proc/kallsyms 810d9720 t t_show 810e2e40 t t_show 810ece30 t t_show 810f4ad0 t t_show # ./perf probe -fa "t_show \$vars" Added new events: probe:t_show (on t_show with $vars) probe:t_show_1 (on t_show with $vars) probe:t_show_2 (on t_show with $vars) probe:t_show_3 (on t_show with $vars) You can now use it in all perf tools, such as: perf record -e probe:t_show_3 -aR sleep 1 OK, we have 4 different t_show()s. All functions have different arguments as below; # cat /sys/kernel/debug/tracing/kprobe_events p:probe/t_show t_show m=%di:u64 v=%si:u64 p:probe/t_show_1 t_show m=%di:u64 v=%si:u64 t=%si:u64 p:probe/t_show_2 t_show m=%di:u64 v=%si:u64 fmt=%si:u64 p:probe/t_show_3 t_show m=%di:u64 v=%si:u64 file=%si:u64 However, all of them have been put on the *same* address. # cat /sys/kernel/debug/kprobes/list 810d9720 k t_show+0x0[DISABLED] 810d9720 k t_show+0x0[DISABLED] 810d9720 k t_show+0x0[DISABLED] 810d9720 k t_show+0x0[DISABLED] oops... Issue 2) With the debuginfo, issue 1 can be solved by using _stext-based probe definition instead of local symbol-based. However, without debuginfo, perf-probe can only use symbol-map in the binary (or kallsyms). The map provides symbol find methods, but it returns only the first matched symbol. To put probes on all functions which have given symbol, we need a symbol-list iterator for the map. E.g. (built perf with NO_DWARF=1) In the case to probe t_show and identity__map_ip in perf. # ./perf probe -a t_show Added new event: probe:t_show (on t_show) You can now use it in all perf tools, such as: perf record -e probe:t_show -aR sleep 1 # ./perf probe -x perf -a identity__map_ip no symbols found in /kbuild/ksrc/linux-3/tools/perf/perf, maybe install a debug package? Failed to load map. Error: Failed to add events. (-22) oops. Solutions) To solve the issue 1, this series changes perf probe to use _stext-based probe definition. This means that we also need to fix the --list options to analyze actual probe address from _stext address. (and that has been done in this series). E.g. with this series; # ./perf probe -a "t_show \$vars" Added new events: probe:t_show (on t_show with $vars) probe:t_show_1 (on t_show with $vars) probe:t_show_2 (on t_show with $vars) probe:t_show_3 (on t_show with $vars) You can now use it in all perf tools, such as: perf record -e probe:t_show_3 -aR sleep 1 # cat /sys/kernel/debug/tracing/kprobe_events p:probe/t_show _stext+889880 m=%di:u64 v=%si:u64 p:probe/t_show_1 _stext+928568 m=%di:u64 v=%si:u64 t=%si:u64 p:probe/t_show_2 _stext+969512 m=%di:u64 v=%si:u64 fmt=%si:u64 p:probe/t_show_3 _stext+1001416 m=%di:u64 v=%si:u64 file=%si:u64 # cat /sys/kernel/debug/kprobes/list b50d95e0 k t_show+0x0[DISABLED] b50e2d00 k t_show+0x0[DISABLED] b50f4990 k t_show+0x0[DISABLED] b50eccf0 k t_show+0x0[DISABLED] This time we can see the events are set in different addresses. And for the issue 2, the last patch introduces symbol iterators for map, dso and symbols (since the symbol list is the symbols and it is included in dso, and perf probe accesses dso via map). E.g. with this series (built perf with NO_DWARF=1); # ./perf probe -a t_show Added new events: probe:t_show (on t_show) probe:t_show_1
[PATCH -tip v3 04/11] [CLEANUP] perf-probe: Unify show_available_functions for uprobes/kprobes
Unify show_available_functions for uprobes/kprobes to cleanup and reduce the code. This also improves error messages. Signed-off-by: Masami Hiramatsu --- tools/perf/util/probe-event.c | 72 +++-- 1 file changed, 26 insertions(+), 46 deletions(-) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index f70fd08..ace3ba3 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -2323,66 +2323,46 @@ static int filter_available_functions(struct map *map __maybe_unused, return 1; } -static int __show_available_funcs(struct map *map) -{ - if (map__load(map, filter_available_functions)) { - pr_err("Failed to load map.\n"); - return -EINVAL; - } - if (!dso__sorted_by_name(map->dso, map->type)) - dso__sort_by_name(map->dso, map->type); - - dso__fprintf_symbols_by_name(map->dso, map->type, stdout); - return 0; -} - -static int available_kernel_funcs(const char *module) +int show_available_funcs(const char *target, struct strfilter *_filter, + bool user) { struct map *map; int ret; - ret = init_symbol_maps(false); + ret = init_symbol_maps(user); if (ret < 0) return ret; - map = kernel_get_module_map(module); + /* Get a symbol map */ + if (user) + map = dso__new_map(target); + else + map = kernel_get_module_map(target); if (!map) { - pr_err("Failed to find %s map.\n", (module) ? : "kernel"); + pr_err("Failed to get a map for %s\n", (target) ? : "kernel"); return -EINVAL; } - ret = __show_available_funcs(map); - exit_symbol_maps(); - - return ret; -} - -static int available_user_funcs(const char *target) -{ - struct map *map; - int ret; - ret = init_symbol_maps(true); - if (ret < 0) - return ret; - - map = dso__new_map(target); - ret = __show_available_funcs(map); - dso__delete(map->dso); - map__delete(map); - exit_symbol_maps(); - return ret; -} - -int show_available_funcs(const char *target, struct strfilter *_filter, - bool user) -{ - setup_pager(); + /* Load symbols with given filter */ available_func_filter = _filter; + if (map__load(map, filter_available_functions)) { + pr_err("Failed to load symbols in %s\n", (target) ? : "kernel"); + goto end; + } + if (!dso__sorted_by_name(map->dso, map->type)) + dso__sort_by_name(map->dso, map->type); - if (!user) - return available_kernel_funcs(target); + /* Show all (filtered) symbols */ + setup_pager(); + dso__fprintf_symbols_by_name(map->dso, map->type, stdout); +end: + if (user) { + dso__delete(map->dso); + map__delete(map); + } + exit_symbol_maps(); - return available_user_funcs(target); + return ret; } /* -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Make math_state_restore() save and restore the interrupt flag
> 3.13 plus this patch: boots and fixes the testcase I reported (core dump > on ecrypt). > > Tested-by: Nate Eldredge It's looking good for me so far, too. I'm slower to reproduce, so I'd like a couple more days before signing off on it, but no complaints yet. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH -tip v3 02/11] [CLEANUP] perf-probe: Remove incorrect symbol check for --list
Remove unneeded symbol check for --list option. This code actually checks whether the given symbol exists in the kernel. But this is incorrect for online kernel/module and offline module too. - For online kernel/module, the kprobes itself already ensured the symbol exist in the kernel. - For offline module, this code can't access the offlined modules. Ignore it. Signed-off-by: Masami Hiramatsu --- tools/perf/util/probe-event.c |8 1 file changed, 8 deletions(-) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 9aa7783..a4649e7 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -739,14 +739,6 @@ out: static int kprobe_convert_to_perf_probe(struct probe_trace_point *tp, struct perf_probe_point *pp) { - struct symbol *sym; - - sym = __find_kernel_function_by_name(tp->symbol, NULL); - if (!sym) { - pr_err("Failed to find symbol %s in kernel.\n", tp->symbol); - return -ENOENT; - } - return convert_to_perf_probe_point(tp, pp); } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH -tip v3 06/11] perf-probe: Use ref_reloc_sym based address instead of the symbol name
Since several local symbols can have same name (e.g. t_show), we need to use the relative address from the symbol referred by kmap->ref_reloc_sym instead of the target symbol name itself. Because the kernel address space layout randomize (kASLR) changes the absolute address of kernel symbols, we can't relay on the absolute address. Note that this works only with debuginfo. E.g. without this change; # ./perf probe -a "t_show \$vars" Added new events: probe:t_show (on t_show with $vars) probe:t_show_1 (on t_show with $vars) probe:t_show_2 (on t_show with $vars) probe:t_show_3 (on t_show with $vars) You can now use it in all perf tools, such as: perf record -e probe:t_show_3 -aR sleep 1 OK, we have 4 different t_show()s. All functions have different arguments as below; # cat /sys/kernel/debug/tracing/kprobe_events p:probe/t_show t_show m=%di:u64 v=%si:u64 p:probe/t_show_1 t_show m=%di:u64 v=%si:u64 t=%si:u64 p:probe/t_show_2 t_show m=%di:u64 v=%si:u64 fmt=%si:u64 p:probe/t_show_3 t_show m=%di:u64 v=%si:u64 file=%si:u64 However, all of them have been put on the *same* address. # cat /sys/kernel/debug/kprobes/list 810d9720 k t_show+0x0[DISABLED] 810d9720 k t_show+0x0[DISABLED] 810d9720 k t_show+0x0[DISABLED] 810d9720 k t_show+0x0[DISABLED] With this change; # ./perf probe -a "t_show \$vars" Added new events: probe:t_show (on t_show with $vars) probe:t_show_1 (on t_show with $vars) probe:t_show_2 (on t_show with $vars) probe:t_show_3 (on t_show with $vars) You can now use it in all perf tools, such as: perf record -e probe:t_show_3 -aR sleep 1 # cat /sys/kernel/debug/tracing/kprobe_events p:probe/t_show _stext+889880 m=%di:u64 v=%si:u64 p:probe/t_show_1 _stext+928568 m=%di:u64 v=%si:u64 t=%si:u64 p:probe/t_show_2 _stext+969512 m=%di:u64 v=%si:u64 fmt=%si:u64 p:probe/t_show_3 _stext+1001416 m=%di:u64 v=%si:u64 file=%si:u64 # cat /sys/kernel/debug/kprobes/list b50d95e0 k t_show+0x0[DISABLED] b50e2d00 k t_show+0x0[DISABLED] b50f4990 k t_show+0x0[DISABLED] b50eccf0 k t_show+0x0[DISABLED] This time, each event is put in different address correctly. Note that currently this doesn't support address-based probe on modules (thus the probes on modules are symbol based), since it requires relative address probe syntax for kprobe-tracer, and it isn't implemented yet. One more note, this allows us to put events on correct address, but --list option should be updated to show correct corresponding source code. Changes from v2: - Refer kmap->ref_reloc_sym instead of "_stext". - Refer map->reloc to catch up the kASLR perf fix. Changes from v1: - Use _stext relative address instead of actual absolute address recorded in debuginfo. Signed-off-by: Masami Hiramatsu --- tools/perf/util/probe-event.c | 58 +++-- 1 file changed, 49 insertions(+), 9 deletions(-) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index de9fe90..1ce2cb9 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -383,6 +383,51 @@ static int add_module_to_probe_trace_events(struct probe_trace_event *tevs, return ret; } +static struct ref_reloc_sym *__kernel_get_ref_reloc_sym(void) +{ + /* kmap->ref_reloc_sym should be set if host_machine is initialized */ + struct kmap *kmap; + + kmap = map__kmap(host_machine->vmlinux_maps[MAP__FUNCTION]); + return kmap->ref_reloc_sym; +} + +/* Post processing the probe events */ +static int post_process_probe_trace_events(struct probe_trace_event *tevs, + int ntevs, const char *module, + bool uprobe) +{ + struct ref_reloc_sym *reloc_sym; + char *tmp; + int i; + + if (uprobe) + return add_exec_to_probe_trace_events(tevs, ntevs, module); + + /* Note that currently ref_reloc_sym based probe is not for drivers */ + if (module) + return add_module_to_probe_trace_events(tevs, ntevs, module); + + reloc_sym = __kernel_get_ref_reloc_sym(); + if (!reloc_sym) { + pr_warning("Relocated base symbol is not found!\n"); + return -EINVAL; + } + + for (i = 0; i < ntevs; i++) { + if (tevs[i].point.address) { + tmp = strdup(reloc_sym->name); + if (!tmp) + return -ENOMEM; + free(tevs[i].point.symbol); + tevs[i].point.symbol = tmp; + tevs[i].point.offset = tevs[i].point.address - + reloc_sym->
[PATCH -tip v3 03/11] [CLEANUP] perf-probe: Replace line_list with intlist
Replace line_list (struct line_node) with intlist for reducing similar codes. Signed-off-by: Masami Hiramatsu --- tools/perf/builtin-probe.c | 12 +++--- tools/perf/util/probe-event.c | 22 +-- tools/perf/util/probe-event.h | 12 +- tools/perf/util/probe-finder.c | 81 ++-- tools/perf/util/probe-finder.h |3 + 5 files changed, 35 insertions(+), 95 deletions(-) diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index 7894888..cdcd4eb 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c @@ -268,9 +268,9 @@ static int opt_set_filter(const struct option *opt __maybe_unused, return 0; } -static void init_params(void) +static int init_params(void) { - line_range__init(¶ms.line_range); + return line_range__init(¶ms.line_range); } static void cleanup_params(void) @@ -515,9 +515,11 @@ int cmd_probe(int argc, const char **argv, const char *prefix) { int ret; - init_params(); - ret = __cmd_probe(argc, argv, prefix); - cleanup_params(); + ret = init_params(); + if (!ret) { + ret = __cmd_probe(argc, argv, prefix); + cleanup_params(); + } return ret; } diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index a4649e7..f70fd08 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -561,7 +561,7 @@ static int _show_one_line(FILE *fp, int l, bool skip, bool show_num) static int __show_line_range(struct line_range *lr, const char *module) { int l = 1; - struct line_node *ln; + struct int_node *ln; struct debuginfo *dinfo; FILE *fp; int ret; @@ -614,8 +614,8 @@ static int __show_line_range(struct line_range *lr, const char *module) goto end; } - list_for_each_entry(ln, &lr->line_list, list) { - for (; ln->line > l; l++) { + intlist__for_each(ln, lr->line_list) { + for (; ln->i > l; l++) { ret = show_one_line(fp, l - lr->offset); if (ret < 0) goto end; @@ -775,24 +775,22 @@ int show_available_vars(struct perf_probe_event *pevs __maybe_unused, void line_range__clear(struct line_range *lr) { - struct line_node *ln; - free(lr->function); free(lr->file); free(lr->path); free(lr->comp_dir); - while (!list_empty(&lr->line_list)) { - ln = list_first_entry(&lr->line_list, struct line_node, list); - list_del(&ln->list); - free(ln); - } + intlist__delete(lr->line_list); memset(lr, 0, sizeof(*lr)); } -void line_range__init(struct line_range *lr) +int line_range__init(struct line_range *lr) { memset(lr, 0, sizeof(*lr)); - INIT_LIST_HEAD(&lr->line_list); + lr->line_list = intlist__new(NULL); + if (!lr->line_list) + return -ENOMEM; + else + return 0; } static int parse_line_num(char **ptr, int *val, const char *what) diff --git a/tools/perf/util/probe-event.h b/tools/perf/util/probe-event.h index fcaf727..776c934 100644 --- a/tools/perf/util/probe-event.h +++ b/tools/perf/util/probe-event.h @@ -2,6 +2,7 @@ #define _PROBE_EVENT_H #include +#include "intlist.h" #include "strlist.h" #include "strfilter.h" @@ -76,13 +77,6 @@ struct perf_probe_event { struct perf_probe_arg *args; /* Arguments */ }; - -/* Line number container */ -struct line_node { - struct list_headlist; - int line; -}; - /* Line range */ struct line_range { char*file; /* File name */ @@ -92,7 +86,7 @@ struct line_range { int offset; /* Start line offset */ char*path; /* Real path name */ char*comp_dir; /* Compile directory */ - struct list_headline_list; /* Visible lines */ + struct intlist *line_list; /* Visible lines */ }; /* List of variables */ @@ -124,7 +118,7 @@ extern int parse_line_range_desc(const char *cmd, struct line_range *lr); extern void line_range__clear(struct line_range *lr); /* Initialize line range */ -extern void line_range__init(struct line_range *lr); +extern int line_range__init(struct line_range *lr); /* Internal use: Return kernel/module path */ extern const char *kernel_get_module_path(const char *module); diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 061edb1..e5e589f 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -35,6 +35,7 @@ #include #include "event.h" #include "debug.h" +#include "intlist.h" #include "util.h" #include "symbol.h" #include "probe-finder.h" @@ -42,65 +43,
[PATCH -tip v3 10/11] perf-probe: Allow to add events on the local functions
Allow to add events on the local functions without debuginfo. (With the debuginfo, we can add events even on inlined functions) Currently, probing on local functions requires debuginfo to locate actual address. It is also possible without debuginfo since we have symbol maps. Without this change; # ./perf probe -a t_show Added new event: probe:t_show (on t_show) You can now use it in all perf tools, such as: perf record -e probe:t_show -aR sleep 1 # ./perf probe -x perf -a identity__map_ip no symbols found in /kbuild/ksrc/linux-3/tools/perf/perf, maybe install a debug package? Failed to load map. Error: Failed to add events. (-22) As the above results, perf probe just put one event on the first found symbol for kprobe event. Moreover, for uprobe event, perf probe failed to find local functions. With this change; # ./perf probe -a t_show Added new events: probe:t_show (on t_show) probe:t_show_1 (on t_show) probe:t_show_2 (on t_show) probe:t_show_3 (on t_show) You can now use it in all perf tools, such as: perf record -e probe:t_show_3 -aR sleep 1 # ./perf probe -x perf -a identity__map_ip Added new events: probe_perf:identity__map_ip (on identity__map_ip in /kbuild/ksrc/linux-3/tools/perf/perf) probe_perf:identity__map_ip_1 (on identity__map_ip in /kbuild/ksrc/linux-3/tools/perf/perf) probe_perf:identity__map_ip_2 (on identity__map_ip in /kbuild/ksrc/linux-3/tools/perf/perf) probe_perf:identity__map_ip_3 (on identity__map_ip in /kbuild/ksrc/linux-3/tools/perf/perf) You can now use it in all perf tools, such as: perf record -e probe_perf:identity__map_ip_3 -aR sleep 1 Now we succeed to put events on every given local functions for both kprobes and uprobes. :) Note that this also introduces some symbol rbtree iteration macros; symbols__for_each, dso__for_each_symbol, and map__for_each_symbol. These are for walking through the symbol list in a map. Changes from v2: - Fix add_exec_to_probe_trace_events() not to convert address to tp->symbol any more. - Fix to set kernel probes based on ref_reloc_sym. Signed-off-by: Masami Hiramatsu --- tools/perf/util/dso.h | 10 + tools/perf/util/map.h | 10 + tools/perf/util/probe-event.c | 378 +++-- tools/perf/util/symbol.h | 11 + 4 files changed, 204 insertions(+), 205 deletions(-) diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h index cd7d6f0..ab06f1c 100644 --- a/tools/perf/util/dso.h +++ b/tools/perf/util/dso.h @@ -102,6 +102,16 @@ struct dso { char name[0]; }; +/* dso__for_each_symbol - iterate over the symbols of given type + * + * @dso: the 'struct dso *' in which symbols itereated + * @pos: the 'struct symbol *' to use as a loop cursor + * @n: the 'struct rb_node *' to use as a temporary storage + * @type: the 'enum map_type' type of symbols + */ +#define dso__for_each_symbol(dso, pos, n, type)\ + symbols__for_each_entry(&(dso)->symbols[(type)], pos, n) + static inline void dso__set_loaded(struct dso *dso, enum map_type type) { dso->loaded |= (1 << type); diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h index 257e513..f00f058 100644 --- a/tools/perf/util/map.h +++ b/tools/perf/util/map.h @@ -90,6 +90,16 @@ u64 map__objdump_2mem(struct map *map, u64 ip); struct symbol; +/* map__for_each_symbol - iterate over the symbols in the given map + * + * @map: the 'struct map *' in which symbols itereated + * @pos: the 'struct symbol *' to use as a loop cursor + * @n: the 'struct rb_node *' to use as a temporary storage + * Note: caller must ensure map->dso is not NULL (map is loaded). + */ +#define map__for_each_symbol(map, pos, n) \ + dso__for_each_symbol(map->dso, pos, n, map->type) + typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym); void map__init(struct map *map, enum map_type type, diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 3c35b7a..42bec67 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -70,8 +70,6 @@ static int e_snprintf(char *str, size_t size, const char *format, ...) } static char *synthesize_perf_probe_point(struct perf_probe_point *pp); -static int convert_name_to_addr(struct perf_probe_event *pev, - const char *exec); static void clear_probe_trace_event(struct probe_trace_event *tev); static struct machine *host_machine; @@ -249,6 +247,14 @@ out: return ret; } +static void clear_probe_trace_events(struct probe_trace_event *tevs, int ntevs) +{ + int i; + + for (i = 0; i < ntevs; i++) + clear_probe_trace_event(tevs + i); +} + #ifdef HAVE_DWARF_SUPPORT /* Open new debuginfo of given module */ static struct debuginfo *open_debuginfo(const char *module) @@ -353,8 +359,7 @
[PATCH -tip v3 07/11] perf-probe: Find given address from offline dwarf
Find the given address from offline dwarfs instead of online kernel dwarfs. On the KASLR enabled kernel, the kernel text section is loaded with random offset, and the debuginfo__new_online_kernel can't handle it. So let's move to the offline dwarf loader instead of using the online dwarf loader. As a result, since we don't need debuginfo__new_online_kernel any more, this also removes the functions related that. Without this change; # ./perf probe -l probe:t_show (on _stext+901288 with m v) probe:t_show_1 (on _stext+939624 with m v t) probe:t_show_2 (on _stext+980296 with m v fmt) probe:t_show_3 (on _stext+1014392 with m v file) With this change; # ./perf probe -l probe:t_show (on t_show@linux-3/kernel/trace/ftrace.c with m v) probe:t_show_1 (on t_show@linux-3/kernel/trace/trace.c with m v t) probe:t_show_2 (on t_show@kernel/trace/trace_printk.c with m v fmt) probe:t_show_3 (on t_show@kernel/trace/trace_events.c with m v file) Changes from v2: - Instead of retrying, directly opens offline dwarf. - Remove debuginfo__new_online_kernel and related functions. - Refer map->reloc to get the correct address of a symbol. - Add a special case for handling ref_reloc_sym based address. Signed-off-by: Masami Hiramatsu --- tools/perf/util/probe-event.c | 40 --- tools/perf/util/probe-finder.c | 86 tools/perf/util/probe-finder.h |1 3 files changed, 26 insertions(+), 101 deletions(-) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 1ce2cb9..8e34c8d 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -248,6 +248,18 @@ static struct debuginfo *open_debuginfo(const char *module) return debuginfo__new(path); } +static struct ref_reloc_sym *__kernel_get_ref_reloc_sym(void) +{ + /* kmap->ref_reloc_sym should be set if host_machine is initialized */ + struct kmap *kmap; + + if (map__load(host_machine->vmlinux_maps[MAP__FUNCTION], NULL) < 0) + return NULL; + + kmap = map__kmap(host_machine->vmlinux_maps[MAP__FUNCTION]); + return kmap->ref_reloc_sym; +} + /* * Convert trace point to probe point with debuginfo * Currently only handles kprobes. @@ -256,18 +268,27 @@ static int kprobe_convert_to_perf_probe(struct probe_trace_point *tp, struct perf_probe_point *pp) { struct symbol *sym; + struct ref_reloc_sym *reloc_sym; struct map *map; - u64 addr; + u64 addr = 0; int ret = -ENOENT; struct debuginfo *dinfo; - sym = __find_kernel_function_by_name(tp->symbol, &map); - if (sym) { - addr = map->unmap_ip(map, sym->start + tp->offset); + /* ref_reloc_sym is just a label. Need a special fix*/ + reloc_sym = __kernel_get_ref_reloc_sym(); + if (reloc_sym && strcmp(tp->symbol, reloc_sym->name) == 0) + addr = reloc_sym->unrelocated_addr + tp->offset; + else { + sym = __find_kernel_function_by_name(tp->symbol, &map); + if (sym) + addr = map->unmap_ip(map, sym->start + tp->offset) - + map->reloc; + } + if (addr) { pr_debug("try to find %s+%ld@%" PRIx64 "\n", tp->symbol, tp->offset, addr); - dinfo = debuginfo__new_online_kernel(addr); + dinfo = open_debuginfo(tp->module); if (dinfo) { ret = debuginfo__find_probe_point(dinfo, (unsigned long)addr, pp); @@ -383,15 +404,6 @@ static int add_module_to_probe_trace_events(struct probe_trace_event *tevs, return ret; } -static struct ref_reloc_sym *__kernel_get_ref_reloc_sym(void) -{ - /* kmap->ref_reloc_sym should be set if host_machine is initialized */ - struct kmap *kmap; - - kmap = map__kmap(host_machine->vmlinux_maps[MAP__FUNCTION]); - return kmap->ref_reloc_sym; -} - /* Post processing the probe events */ static int post_process_probe_trace_events(struct probe_trace_event *tevs, int ntevs, const char *module, diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index e5e589f..4f6e277 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -89,79 +89,6 @@ error: return -ENOENT; } -#if _ELFUTILS_PREREQ(0, 148) -/* This method is buggy if elfutils is older than 0.148 */ -static int __linux_kernel_find_elf(Dwfl_Module *mod, - void **userdata, - const char *module_name, - Dwarf_Addr base, - char **file_name, Elf **elfp) -{ - int fd; -
[PATCH -tip v3 05/11] perf-probe: Show in what binaries/modules probes are set
Show the name of binary file or modules in which the probes are set with --list option. Without this change; # ./perf probe -m drm drm_av_sync_delay # ./perf probe -x perf dso__load_vmlinux # ./perf probe -l probe:drm_av_sync_delay (on drm_av_sync_delay) probe_perf:dso__load_vmlinux (on 0x0006d110) With this change; # ./perf probe -l probe:drm_av_sync_delay (on drm_av_sync_delay in drm) probe_perf:dso__load_vmlinux (on 0x0006d110 in /kbuild/ksrc/linux-3/tools/perf/perf) Signed-off-by: Masami Hiramatsu --- tools/perf/util/probe-event.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index ace3ba3..de9fe90 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -1728,7 +1728,8 @@ static struct strlist *get_probe_trace_command_rawlist(int fd) } /* Show an event */ -static int show_perf_probe_event(struct perf_probe_event *pev) +static int show_perf_probe_event(struct perf_probe_event *pev, +const char *module) { int i, ret; char buf[128]; @@ -1744,6 +1745,8 @@ static int show_perf_probe_event(struct perf_probe_event *pev) return ret; printf(" %-20s (on %s", buf, place); + if (module) + printf(" in %s", module); if (pev->nargs > 0) { printf(" with"); @@ -1781,7 +1784,8 @@ static int __show_perf_probe_events(int fd, bool is_kprobe) ret = convert_to_perf_probe_event(&tev, &pev, is_kprobe); if (ret >= 0) - ret = show_perf_probe_event(&pev); + ret = show_perf_probe_event(&pev, + tev.point.module); } clear_perf_probe_event(&pev); clear_probe_trace_event(&tev); @@ -1980,7 +1984,7 @@ static int __add_probe_trace_events(struct perf_probe_event *pev, group = pev->group; pev->event = tev->event; pev->group = tev->group; - show_perf_probe_event(pev); + show_perf_probe_event(pev, tev->point.module); /* Trick here - restore current event/group */ pev->event = (char *)event; pev->group = (char *)group; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH -tip v3 08/11] perf-probe: Show appropriate symbol for ref_reloc_sym based kprobes
Show appropriate symbol for ref_reloc_sym based kprobes instead of refpoint+offset when perf-probe -l runs without debuginfo. Without this change: # ./perf probe -l probe:t_show (on _stext+889880 with m v) probe:t_show_1 (on _stext+928568 with m v t) probe:t_show_2 (on _stext+969512 with m v fmt) probe:t_show_3 (on _stext+1001416 with m v file) With this change: # ./perf probe -l probe:t_show (on t_show with m v) probe:t_show_1 (on t_show with m v t) probe:t_show_2 (on t_show with m v fmt) probe:t_show_3 (on t_show with m v file) Changes from v2: - Check ref_reloc_sym to find correct unrelocated address. Signed-off-by: Masami Hiramatsu --- tools/perf/util/probe-event.c | 83 +++-- 1 file changed, 55 insertions(+), 28 deletions(-) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 8e34c8d..f86820c 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -121,6 +121,42 @@ static struct symbol *__find_kernel_function_by_name(const char *name, NULL); } +static struct symbol *__find_kernel_function(u64 addr, struct map **mapp) +{ + return machine__find_kernel_function(host_machine, addr, mapp, NULL); +} + +static struct ref_reloc_sym *kernel_get_ref_reloc_sym(void) +{ + /* kmap->ref_reloc_sym should be set if host_machine is initialized */ + struct kmap *kmap; + + if (map__load(host_machine->vmlinux_maps[MAP__FUNCTION], NULL) < 0) + return NULL; + + kmap = map__kmap(host_machine->vmlinux_maps[MAP__FUNCTION]); + return kmap->ref_reloc_sym; +} + +static u64 kernel_get_symbol_address_by_name(const char *name, bool reloc) +{ + struct ref_reloc_sym *reloc_sym; + struct symbol *sym; + struct map *map; + + /* ref_reloc_sym is just a label. Need a special fix*/ + reloc_sym = kernel_get_ref_reloc_sym(); + if (reloc_sym && strcmp(name, reloc_sym->name) == 0) + return (reloc) ? reloc_sym->addr : reloc_sym->unrelocated_addr; + else { + sym = __find_kernel_function_by_name(name, &map); + if (sym) + return map->unmap_ip(map, sym->start) - + (reloc) ? 0 : map->reloc; + } + return 0; +} + static struct map *kernel_get_module_map(const char *module) { struct rb_node *nd; @@ -216,12 +252,26 @@ out: static int convert_to_perf_probe_point(struct probe_trace_point *tp, struct perf_probe_point *pp) { - pp->function = strdup(tp->symbol); + struct symbol *sym; + struct map *map; + u64 addr = kernel_get_symbol_address_by_name(tp->symbol, true); + + if (addr) { + addr += tp->offset; + sym = __find_kernel_function(addr, &map); + if (!sym) + goto failed; + pp->function = strdup(sym->name); + pp->offset = addr - map->unmap_ip(map, sym->start); + } else { +failed: + pp->function = strdup(tp->symbol); + pp->offset = tp->offset; + } if (pp->function == NULL) return -ENOMEM; - pp->offset = tp->offset; pp->retprobe = tp->retprobe; return 0; @@ -248,18 +298,6 @@ static struct debuginfo *open_debuginfo(const char *module) return debuginfo__new(path); } -static struct ref_reloc_sym *__kernel_get_ref_reloc_sym(void) -{ - /* kmap->ref_reloc_sym should be set if host_machine is initialized */ - struct kmap *kmap; - - if (map__load(host_machine->vmlinux_maps[MAP__FUNCTION], NULL) < 0) - return NULL; - - kmap = map__kmap(host_machine->vmlinux_maps[MAP__FUNCTION]); - return kmap->ref_reloc_sym; -} - /* * Convert trace point to probe point with debuginfo * Currently only handles kprobes. @@ -267,24 +305,13 @@ static struct ref_reloc_sym *__kernel_get_ref_reloc_sym(void) static int kprobe_convert_to_perf_probe(struct probe_trace_point *tp, struct perf_probe_point *pp) { - struct symbol *sym; - struct ref_reloc_sym *reloc_sym; - struct map *map; u64 addr = 0; int ret = -ENOENT; struct debuginfo *dinfo; - /* ref_reloc_sym is just a label. Need a special fix*/ - reloc_sym = __kernel_get_ref_reloc_sym(); - if (reloc_sym && strcmp(tp->symbol, reloc_sym->name) == 0) - addr = reloc_sym->unrelocated_addr + tp->offset; - else { - sym = __find_kernel_function_by_name(tp->symbol, &map); - if (sym) - addr = map->unmap_ip(map, sym->start + tp->offset) - - map->reloc; - } + addr = kernel_get_symbol_ad
[PATCH -tip v3 09/11] perf-probe: Show source-level or symbol-level info for uprobes
Show source-level or symbol-level information for uprobe events. Without this change; # ./perf probe -l probe_perf:dso__load_vmlinux (on 0x0006d110 in /kbuild/ksrc/linux-3/tools/perf/perf) With this change; # ./perf probe -l probe_perf:dso__load_vmlinux (on dso__load_vmlinux@util/symbol.c in /kbuild/ksrc/linux-3/tools/perf/perf) Changes from v2: - Update according to previous patches. Changes from v1: - Rewrite the code based on new series. Signed-off-by: Masami Hiramatsu --- tools/perf/util/probe-event.c | 227 ++--- 1 file changed, 144 insertions(+), 83 deletions(-) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index f86820c..3c35b7a 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -249,34 +249,6 @@ out: return ret; } -static int convert_to_perf_probe_point(struct probe_trace_point *tp, - struct perf_probe_point *pp) -{ - struct symbol *sym; - struct map *map; - u64 addr = kernel_get_symbol_address_by_name(tp->symbol, true); - - if (addr) { - addr += tp->offset; - sym = __find_kernel_function(addr, &map); - if (!sym) - goto failed; - pp->function = strdup(sym->name); - pp->offset = addr - map->unmap_ip(map, sym->start); - } else { -failed: - pp->function = strdup(tp->symbol); - pp->offset = tp->offset; - } - - if (pp->function == NULL) - return -ENOMEM; - - pp->retprobe = tp->retprobe; - - return 0; -} - #ifdef HAVE_DWARF_SUPPORT /* Open new debuginfo of given module */ static struct debuginfo *open_debuginfo(const char *module) @@ -298,44 +270,6 @@ static struct debuginfo *open_debuginfo(const char *module) return debuginfo__new(path); } -/* - * Convert trace point to probe point with debuginfo - * Currently only handles kprobes. - */ -static int kprobe_convert_to_perf_probe(struct probe_trace_point *tp, - struct perf_probe_point *pp) -{ - u64 addr = 0; - int ret = -ENOENT; - struct debuginfo *dinfo; - - addr = kernel_get_symbol_address_by_name(tp->symbol, false); - if (addr) { - addr += tp->offset; - pr_debug("try to find %s+%ld@%" PRIx64 "\n", tp->symbol, -tp->offset, addr); - - dinfo = open_debuginfo(tp->module); - if (dinfo) { - ret = debuginfo__find_probe_point(dinfo, -(unsigned long)addr, pp); - debuginfo__delete(dinfo); - } else { - pr_debug("Failed to open debuginfo at 0x%" PRIx64 "\n", -addr); - ret = -ENOENT; - } - } - if (ret <= 0) { - pr_debug("Failed to find corresponding probes from " -"debuginfo. Use kprobe event information.\n"); - return convert_to_perf_probe_point(tp, pp); - } - pp->retprobe = tp->retprobe; - - return 0; -} - static int get_text_start_address(const char *exec, unsigned long *address) { Elf *elf; @@ -364,6 +298,57 @@ out: return ret; } +/* + * Convert trace point to probe point with debuginfo + */ +static int find_perf_probe_point_from_dwarf(struct probe_trace_point *tp, + struct perf_probe_point *pp, + bool is_kprobe) +{ + struct debuginfo *dinfo = NULL; + unsigned long stext = 0; + u64 addr = tp->address; + int ret = -ENOENT; + + /* convert the address to dwarf address */ + if (!is_kprobe) { + if (!addr) { + ret = -EINVAL; + goto error; + } + ret = get_text_start_address(tp->module, &stext); + if (ret < 0) + goto error; + addr += stext; + } else { + addr = kernel_get_symbol_address_by_name(tp->symbol, false); + if (addr == 0) + goto error; + addr += tp->offset; + } + + pr_debug("try to find information at %" PRIx64 " in %s\n", addr, +tp->module ? : "kernel"); + + dinfo = open_debuginfo(tp->module); + if (dinfo) { + ret = debuginfo__find_probe_point(dinfo, +(unsigned long)addr, pp); + debuginfo__delete(dinfo); + } else { + pr_debug("Failed to open debuginfo at 0x%" PRIx64 "\n", addr); + ret = -ENOENT; + } + + if (ret > 0) { + pp->retprobe = tp->retprobe; +
[PATCH -tip v3 11/11] perf probe: Support distro-style debuginfo for uprobe
Support distro-style debuginfo supported by dso for setting uprobes. Note that this tries to find a debuginfo file based on the real path of the target binary. If the debuginfo is not correctly installed on the system, this can not find it. Signed-off-by: Masami Hiramatsu --- tools/perf/util/probe-event.c |9 +++-- tools/perf/util/probe-finder.c | 41 ++-- tools/perf/util/probe-finder.h |1 + 3 files changed, 43 insertions(+), 8 deletions(-) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 42bec67..0d1542f 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -256,17 +256,14 @@ static void clear_probe_trace_events(struct probe_trace_event *tevs, int ntevs) } #ifdef HAVE_DWARF_SUPPORT + /* Open new debuginfo of given module */ static struct debuginfo *open_debuginfo(const char *module) { - const char *path; + const char *path = module; - /* A file path -- this is an offline module */ - if (module && strchr(module, '/')) - path = module; - else { + if (!module || !strchr(module, '/')) { path = kernel_get_module_path(module); - if (!path) { pr_err("Failed to find path of %s module.\n", module ?: "kernel"); diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 4f6e277..df02386 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -34,6 +34,7 @@ #include #include "event.h" +#include "dso.h" #include "debug.h" #include "intlist.h" #include "util.h" @@ -89,7 +90,7 @@ error: return -ENOENT; } -struct debuginfo *debuginfo__new(const char *path) +static struct debuginfo *__debuginfo__new(const char *path) { struct debuginfo *dbg = zalloc(sizeof(*dbg)); if (!dbg) @@ -97,10 +98,46 @@ struct debuginfo *debuginfo__new(const char *path) if (debuginfo__init_offline_dwarf(dbg, path) < 0) zfree(&dbg); - + if (dbg) + pr_debug("Open Debuginfo file: %s\n", path); return dbg; } +enum dso_binary_type distro_dwarf_types[] = { + DSO_BINARY_TYPE__FEDORA_DEBUGINFO, + DSO_BINARY_TYPE__UBUNTU_DEBUGINFO, + DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO, + DSO_BINARY_TYPE__BUILDID_DEBUGINFO, + DSO_BINARY_TYPE__NOT_FOUND, +}; + +struct debuginfo *debuginfo__new(const char *path) +{ + enum dso_binary_type *type; + char buf[PATH_MAX], nil = '\0'; + struct dso *dso; + struct debuginfo *dinfo = NULL; + + /* Try to open distro debuginfo files */ + dso = dso__new(path); + if (!dso) + goto out; + + for (type = distro_dwarf_types; +!dinfo && *type != DSO_BINARY_TYPE__NOT_FOUND; +type++) { + if (dso__read_binary_type_filename(dso, *type, &nil, + buf, PATH_MAX) < 0) + continue; + dinfo = __debuginfo__new(buf); + } + dso__delete(dso); + +out: + /* if failed to open all distro debuginfo, open given binary */ + return dinfo ? : __debuginfo__new(path); +} + void debuginfo__delete(struct debuginfo *dbg) { if (dbg) { diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h index 3fc5973..92590b2 100644 --- a/tools/perf/util/probe-finder.h +++ b/tools/perf/util/probe-finder.h @@ -30,6 +30,7 @@ struct debuginfo { Dwarf_Addr bias; }; +/* This also tries to open distro debuginfo */ extern struct debuginfo *debuginfo__new(const char *path); extern void debuginfo__delete(struct debuginfo *dbg); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH -tip v3 01/11] [BUGFIX] perf-probe: Fix to do exit call for symbol maps
Some perf-probe commands do symbol_init() but doesn't do exit call. This fixes that to call symbol_exit() and releases machine if needed. This also merges init_vmlinux() and init_user_exec() because both of them are doing similar things. (init_user_exec() just skips init vmlinux related symbol maps) Changes from v2: - Not to set symbol_conf.try_vmlinux_path in init_symbol_maps() (Thanks to Namhyung Kim!) Signed-off-by: Masami Hiramatsu --- tools/perf/util/probe-event.c | 104 ++--- 1 file changed, 56 insertions(+), 48 deletions(-) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index d8b048c..9aa7783 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -73,31 +73,31 @@ static char *synthesize_perf_probe_point(struct perf_probe_point *pp); static int convert_name_to_addr(struct perf_probe_event *pev, const char *exec); static void clear_probe_trace_event(struct probe_trace_event *tev); -static struct machine machine; +static struct machine *host_machine; /* Initialize symbol maps and path of vmlinux/modules */ -static int init_vmlinux(void) +static int init_symbol_maps(bool user_only) { int ret; symbol_conf.sort_by_name = true; - if (symbol_conf.vmlinux_name == NULL) - symbol_conf.try_vmlinux_path = true; - else - pr_debug("Use vmlinux: %s\n", symbol_conf.vmlinux_name); ret = symbol__init(); if (ret < 0) { pr_debug("Failed to init symbol map.\n"); goto out; } - ret = machine__init(&machine, "", HOST_KERNEL_ID); - if (ret < 0) - goto out; + if (host_machine || user_only) /* already initialized */ + return 0; - if (machine__create_kernel_maps(&machine) < 0) { - pr_debug("machine__create_kernel_maps() failed.\n"); - goto out; + if (symbol_conf.vmlinux_name) + pr_debug("Use vmlinux: %s\n", symbol_conf.vmlinux_name); + + host_machine = machine__new_host(); + if (!host_machine) { + pr_debug("machine__new_host() failed.\n"); + symbol__exit(); + ret = -1; } out: if (ret < 0) @@ -105,21 +105,30 @@ out: return ret; } +static void exit_symbol_maps(void) +{ + if (host_machine) { + machine__delete(host_machine); + host_machine = NULL; + } + symbol__exit(); +} + static struct symbol *__find_kernel_function_by_name(const char *name, struct map **mapp) { - return machine__find_kernel_function_by_name(&machine, name, mapp, + return machine__find_kernel_function_by_name(host_machine, name, mapp, NULL); } static struct map *kernel_get_module_map(const char *module) { struct rb_node *nd; - struct map_groups *grp = &machine.kmaps; + struct map_groups *grp = &host_machine->kmaps; /* A file path -- this is an offline module */ if (module && strchr(module, '/')) - return machine__new_module(&machine, 0, module); + return machine__new_module(host_machine, 0, module); if (!module) module = "kernel"; @@ -141,7 +150,7 @@ static struct dso *kernel_get_module_dso(const char *module) const char *vmlinux_name; if (module) { - list_for_each_entry(dso, &machine.kernel_dsos, node) { + list_for_each_entry(dso, &host_machine->kernel_dsos, node) { if (strncmp(dso->short_name + 1, module, dso->short_name_len - 2) == 0) goto found; @@ -150,7 +159,7 @@ static struct dso *kernel_get_module_dso(const char *module) return NULL; } - map = machine.vmlinux_maps[MAP__FUNCTION]; + map = host_machine->vmlinux_maps[MAP__FUNCTION]; dso = map->dso; vmlinux_name = symbol_conf.vmlinux_name; @@ -173,20 +182,6 @@ const char *kernel_get_module_path(const char *module) return (dso) ? dso->long_name : NULL; } -static int init_user_exec(void) -{ - int ret = 0; - - symbol_conf.try_vmlinux_path = false; - symbol_conf.sort_by_name = true; - ret = symbol__init(); - - if (ret < 0) - pr_debug("Failed to init symbol map.\n"); - - return ret; -} - static int convert_exec_to_group(const char *exec, char **result) { char *ptr1, *ptr2, *exec_copy; @@ -563,7 +558,7 @@ static int _show_one_line(FILE *fp, int l, bool skip, bool show_num) * Show line-range always requires debuginfo to find source file and * line number. */ -int show_line_range(struct line_range *lr, const char *module) +static int __show_line_range(struct
Re: [PATCH] Make math_state_restore() save and restore the interrupt flag
On Sun, 2 Feb 2014, Suresh Siddha wrote: Here is the second patch, which should fix the issue reported in this thread. Maarten, Nate, George, please give this patch a try as is and see if it helps address the issue you ran into. And please ack/review with your test results. 3.13 plus this patch: boots and fixes the testcase I reported (core dump on ecrypt). Tested-by: Nate Eldredge diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c index 4e5f770..670bba1 100644 --- a/arch/x86/kernel/i387.c +++ b/arch/x86/kernel/i387.c @@ -87,10 +87,19 @@ EXPORT_SYMBOL(__kernel_fpu_begin); void __kernel_fpu_end(void) { - if (use_eager_fpu()) - math_state_restore(); - else + if (use_eager_fpu()) { + /* +* For eager fpu, most the time, tsk_used_math() is true. +* Restore the user math as we are done with the kernel usage. +* At few instances during thread exit, signal handling etc, +* tsk_used_math() is false. Those few places will take proper +* actions, so we don't need to restore the math here. +*/ + if (likely(tsk_used_math(current))) + math_state_restore(); + } else { stts(); + } } EXPORT_SYMBOL(__kernel_fpu_end); -- Nate Eldredge n...@thatsmathematics.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARM: davinci: fix typo
From: "Lad, Prabhakar" this patch fixes a typo in mach/hardware.h, by replacing "ths" to "this". Signed-off-by: Lad, Prabhakar --- arch/arm/mach-davinci/include/mach/hardware.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-davinci/include/mach/hardware.h b/arch/arm/mach-davinci/include/mach/hardware.h index 16bb422..8a5d843 100644 --- a/arch/arm/mach-davinci/include/mach/hardware.h +++ b/arch/arm/mach-davinci/include/mach/hardware.h @@ -12,7 +12,7 @@ #define __ASM_ARCH_HARDWARE_H /* - * Before you add anything to ths file: + * Before you add anything to this file: * * This header is for defines common to ALL DaVinci family chips. * Anything that is chip specific should go in .h, -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[git pull] drm fixes
Hi Linus, a few regression fixes already, one for my own stupidity, and mgag200 typo fix, vmwgfx fixes and ttm regression fixes, and a radeon register checker update for older cards to handle geom shaders. Dave. The following changes since commit 38dbfb59d1175ef458d006556061adeaa8751b72: Linus 3.14-rc1 (2014-02-02 16:42:13 -0800) are available in the git repository at: git://people.freedesktop.org/~airlied/linux drm-fixes for you to fetch changes up to 7c4c62a04a2a80e3feb5d6c97aca1e413b11c790: drm/radeon: allow geom rings to be setup on r600/r700 (v2) (2014-02-06 12:13:52 +1000) Dave Airlie (5): drm/mgag200: fix typo causing bw limits to be ignored on some chips drm/mgag200,ast,cirrus: fix regression with drm_can_sleep conversion Merge tag 'ttm-fixes-3.14-2014-02-05' of git://people.freedesktop.org/~thomash/linux into drm-next Merge tag 'vmwgfx-fixes-3.14-2014-02-05' of git://people.freedesktop.org/~thomash/linux into drm-next drm/radeon: allow geom rings to be setup on r600/r700 (v2) Dave Jones (1): vmwgfx: Fix unitialized stack read in vmw_setup_otable_base Thomas Hellstrom (9): drm/vmwgfx: Don't commit staged bindings if execbuf fails drm/vmwgfx: Fix regression caused by "drm/ttm: make ttm reservation calls behave like reservation calls" drm/vmwgfx: Fix SET_SHADER_CONST emulation on guest-backed devices drm/vmwgfx: Fix legacy surface reference size copyback drm/vmwgfx: Emulate legacy shaders on guest-backed devices v2 drm/vmwgfx: Detect old user-space drivers and set up legacy emulation v2 drm/vmwgfx: Reemit context bindings when necessary v2 drm/ttm: Fix TTM object open regression drm/ttm: Don't clear page metadata of imported sg pages drivers/gpu/drm/ast/ast_fb.c | 2 +- drivers/gpu/drm/cirrus/cirrus_fbdev.c| 2 +- drivers/gpu/drm/mgag200/mgag200_fb.c | 2 +- drivers/gpu/drm/mgag200/mgag200_mode.c | 4 +- drivers/gpu/drm/radeon/r600_cs.c | 18 +- drivers/gpu/drm/radeon/radeon_drv.c | 3 +- drivers/gpu/drm/radeon/reg_srcs/r600 | 1 + drivers/gpu/drm/ttm/ttm_object.c | 2 +- drivers/gpu/drm/ttm/ttm_tt.c | 3 + drivers/gpu/drm/vmwgfx/svga3d_reg.h | 24 ++ drivers/gpu/drm/vmwgfx/vmwgfx_context.c | 144 -- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 7 + drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 35 ++- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 330 +++--- drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c| 93 -- drivers/gpu/drm/vmwgfx/vmwgfx_mob.c | 1 + drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 11 +- drivers/gpu/drm/vmwgfx/vmwgfx_shader.c | 467 +++ drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 6 +- 19 files changed, 1016 insertions(+), 139 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCHv2 1/2] zram: introduce compressing backend abstraction
Hello Sergey, Sorry for late response. On Thu, Jan 30, 2014 at 10:28:07PM +0300, Sergey Senozhatsky wrote: > ZRAM performs direct LZO compression algorithm calls, making it the one > and only option. Introduce struct zram_comp in order to support multiple > compression algorithms. struct zram_comp defines the following set of > compressing backend operations: > .create > .destroy > .compress > .decompress > .workmem_get > .workmem_put > > Schematically zram write() usually contains the following steps: > 0) preparation (decompression of partioal IO, etc.) > 1) lock buffer_lock mutex (protects meta compress buffers) > 2) compress (using meta compress buffers) > 3) alloc and map zs_pool object > 4) copy compressed data (from meta compress buffers) to new object object allocated by 3) > 5) free previous pool page, assign a new one > 6) unlock buffer_lock mutex > > As we can see, compressing buffers must remain untouched from 1) to 4), > because, otherwise, concurrent write() will overwrite data. At the same > time, zram_meta must be aware of a) specific compression algorithm > memory requirements and b) necessary locking to protect compression > buffers. Besides, zram holds buffer_lock almost through the whole write() > function, making parallel compression impossible. To remove requirement > a) new struct zcomp_workmem (workmem is a common term used by lzo, lz4 > and zlib) contains buffers required by compression algorithm, while new > struct zcomp_wm_policy implements workmem handling and locking by means > of get() and put() semantics and removes requirement b) from zram meta. > In general, workmem_get() turns caller into exclusive user of workmem > and workem_put() makes a particular workmem available. > > Each compressing backend may use a default workmem policy or provide > custom implementation. Default workmem policy (struct zcomp_wm_policy) > has a list of idle workmem buffers (at least 1 workmem), spinlock to > protect idle list and wait queue, making it possible to have parallel > compressions. Each time zram issues a workmem_get() call, the following > set of operations performed: I'm still really not sure why backend should know workmem policy. I think it's matter of upper layer, not backend. Yeb, surely, you have a reason but it's very hard for me to know it by this patchset so I'd like to divide the patchset. (You don't need to explain it in here and I expect it would be clear if you separate it like I suggested below). Pz, see below. > - spin lock buffer_lock > - if idle list is not empty, remove workmem from idle list, spin > unlock and return workmem pointer > - if idle list is empty, current adds itself to wait queue. it will be > awaken by workmem_put() caller. > > workmem_put(): > - spin lock buffer_lock > - add workmem to idle list > - spin unlock, wake up sleeper (if any) Good. > > zram_comp file contains array of supported compressing backends, which > can be altered according to user selection. > > Usage examples. To initialize compressing backend: > comp = zcomp_create(NAME) /* NAME e.g. lzo, lz4 */ > > which performs NAME lookup in array of supported compressing backends > and initialises compressing backend if requested algorithm is supported. > Compressing: > wm = comp->workmem_get(comp) > comp->compress(...) > [..] /* copy compressed data */ > comp->workmem_put(comp, wm) > > Free compessing backend and all ot its workmem buffers: > zcomp_destroy(comp) > > The patch implements LZO and LZ4 backends. At this point zcomp_wm_policy > keeps only one workmem in the idle list, support for multi workmem buffers > will be introduced later. > > Signed-off-by: Sergey Senozhatsky > --- > drivers/block/zram/zcomp_lz4.c | 49 ++ > drivers/block/zram/zcomp_lz4.h | 18 Please don't include lz4 in this patch. It should be separated and description of the patch surely should include the number to prove lz4 is better than lzo in *what* workload so it should make everybody easy to convince. And let's separate this patchset following as 1. abstract compressor with zram_comp. 2. Support configurable compressor 3. support zcomp multi buffers 4. support lz4 Please don't add workmem policy in patch 1 because we still use only a buffer until 3 so patch 1, 2 would be very simple. Patch 3 might introduce wm policy. Then, it would be very clear why we need it for zomp_multi so that it would make review easy. If 1,2,3 have no problem and apparenlty lz4 has a benefit, patch 4 will be merged easily but If lz4 were rejected by some reason, we could support another compression easily since patch 1,2,3 is merged. Thanks. -- Kind regards, Minchan Kim -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.
Re: [Xen-devel] [PATCH v2 0/4] xen-blk: bug fixes
On Tue, Feb 04, 2014 at 11:15:01AM -0400, Konrad Rzeszutek Wilk wrote: > On Tue, Feb 04, 2014 at 11:26:11AM +0100, Roger Pau Monne wrote: > > This series contain blkback bug fixes for memory leaks (patches 1 and > > 2) and a race (patch 3). Patch 4 removes blkif_request_segment_aligned > > since its memory layout is exactly the same as blkif_request_segment > > and should introduce no functional change. > > > > All patches should be backported to stable branches, although the last > > one is not a functional change it will still be nice to have it for > > code correctness. > > Matt and Matt, could you guys kindly take a look as well? Thank you! Matt R. did some testing today and set up additional tests to run overnight. He'll follow up after the overnight tests complete. --msw -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3.12 117/133] alpha: fix broken network checksum
On Tue, Feb 04, 2014 at 01:08:38PM -0800, Greg Kroah-Hartman wrote: > 3.12-stable review patch. If anyone has any objections, please let me know. > > -- > > From: Mikulas Patocka > > commit 0ef38d70d4118b2ce1a538d14357be5ff9dc2bbd upstream. > > The patch 3ddc5b46a8e90f3c9251338b60191d0a804b0d92 breaks networking on > alpha (there is a follow-up fix 5cfe8f1ba5eebe6f4b6e5858cdb1a5be4f3272a6, > but networking is still broken even with the second patch). I wonder whether that follow-up (partial) fix mentioned (5cfe8f1ba5eebe6f4b6e5858cdb1a5be4f3272a6) should be pulled into 3.12 stable too? Cheers Michael. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V4 0/8]PCI:Add SPEAr13xx PCie support
First three patches are improvement and fixes for SPEAr13xx support. Patches 4-6 add miphy40lp skelten driver and support for spear1310/40 miphy wrapper. Patch 7 add support for SPEAr13xx PCIe. These pathes are tested with linux-3.14-rc1 with following patch on the top of it: Author: Balaji T K Date: Mon Jan 20 16:41:27 2014 +0200 ata: ahci_platform: Manage SATA PHY Tested with SPEAr1310 evaluation board: - INTEL PRO 100/100 EP card - USB xhci gen2 card - Above cards connected through LeCROY PTC switch Modifications for SATA are tested with SPEAr1340-evb board Changes since v3: - Phy driver renamed to phy-miphy40lp - ahci phy hook patch used as suggested by Arnd - Incorporated other minor comments from v3 Changes since v2: - Incorporated comments to move SPEAr13xx PCIe and SATA phy specific routines to the phy framework - Modify ahci driver to include phy hooks - phy-core driver modifications for subsys_initcall() Changes since v1: - Few patches of the series are already accepted and applied to mainline e.g. pcie designware driver improvements,fixes for IO translation bug, PCIe dw driver maintainer. So dropped these from v2. - Incorporated comment to move the common/reset PCIe code to the seperate driver - PCIe and SATA share common PHY configuration registers, so move SATA platform code to the system config driver Fourth patch is improves pcie designware driver and fixes the IO translation bug. IO translation bug fix leads to the working of PCIe EP devices connected to RC through switch. PCIe driver support for SPEAr1310/40 platform board is added. These patches are tested with SPEAr1310 evaluation board: - INTEL PRO 100/100 EP card - USB xhci gen2 card - Above cards connected through LeCROY PTC switch Cc: linux-arm-ker...@lists.infradead.org Cc: devicet...@vger.kernel.org Cc: linux-...@vger.kernel.org Cc: linux-...@vger.kernel.org Cc: spear-de...@list.st.com Cc: linux-kernel@vger.kernel.org Mohit Kumar (2): SPEAr13xx: defconfig: Update MAINTAINERS: Add ST SPEAr13xx PCIe driver maintainer Pratyush Anand (6): clk: SPEAr13xx: Fix pcie clock name SPEAr13xx: Fix static mapping table phy: st-miphy-40lp: Add skeleton driver SPEAr13xx: Fixup: Move SPEAr1340 SATA platform code to phy driver phy: st-miphy-40lp: Add SPEAr1310 and SPEAr1340 PCIe phy support pcie: SPEAr13xx: Add designware pcie support .../devicetree/bindings/arm/spear-misc.txt | 4 + .../devicetree/bindings/pci/spear13xx-pcie.txt | 7 + .../devicetree/bindings/phy/st-miphy40lp.txt | 12 + MAINTAINERS| 6 + arch/arm/boot/dts/spear1310-evb.dts| 4 + arch/arm/boot/dts/spear1310.dtsi | 96 +++- arch/arm/boot/dts/spear1340-evb.dts| 4 + arch/arm/boot/dts/spear1340.dtsi | 32 +- arch/arm/boot/dts/spear13xx.dtsi | 10 +- arch/arm/configs/spear13xx_defconfig | 15 + arch/arm/mach-spear/Kconfig| 3 + arch/arm/mach-spear/include/mach/spear.h | 4 +- arch/arm/mach-spear/spear1340.c| 127 + arch/arm/mach-spear/spear13xx.c| 2 +- drivers/clk/spear/spear1310_clock.c| 6 +- drivers/clk/spear/spear1340_clock.c| 2 +- drivers/pci/host/Kconfig | 5 + drivers/pci/host/Makefile | 1 + drivers/pci/host/pcie-spear13xx.c | 414 drivers/phy/Kconfig| 6 + drivers/phy/Makefile | 1 + drivers/phy/phy-miphy40lp.c| 544 + 22 files changed, 1166 insertions(+), 139 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/spear-misc.txt create mode 100644 Documentation/devicetree/bindings/pci/spear13xx-pcie.txt create mode 100644 Documentation/devicetree/bindings/phy/st-miphy40lp.txt create mode 100644 drivers/pci/host/pcie-spear13xx.c create mode 100644 drivers/phy/phy-miphy40lp.c -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V4 4/8] phy: st-miphy-40lp: Add skeleton driver
ST miphy-40lp supports PCIe, SATA and Super Speed USB. This driver adds skeleton support for the same. Currently phy ops are returning -EINVAL. They can be elaborated depending on the SOC being supported in future. Signed-off-by: Pratyush Anand Tested-by: Mohit Kumar Cc: Arnd Bergmann Cc: Kishon Vijay Abraham I Cc: spear-de...@list.st.com Cc: linux-arm-ker...@lists.infradead.org Cc: devicet...@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- .../devicetree/bindings/phy/st-miphy40lp.txt | 12 ++ drivers/phy/Kconfig| 6 + drivers/phy/Makefile | 1 + drivers/phy/phy-miphy40lp.c| 174 + 4 files changed, 193 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/st-miphy40lp.txt create mode 100644 drivers/phy/phy-miphy40lp.c diff --git a/Documentation/devicetree/bindings/phy/st-miphy40lp.txt b/Documentation/devicetree/bindings/phy/st-miphy40lp.txt new file mode 100644 index 000..d0c7096 --- /dev/null +++ b/Documentation/devicetree/bindings/phy/st-miphy40lp.txt @@ -0,0 +1,12 @@ +Required properties: +- compatible : should be "st,miphy40lp-phy" + Other supported soc specific compatible: + "st,spear1310-miphy" + "st,spear1340-miphy" +- reg : offset and length of the PHY register set. +- misc: phandle for the syscon node to access misc registers +- phy-id: Instance id of the phy. +- #phy-cells : from the generic PHY bindings, must be 1. + - 1st cell: phandle to the phy node. + - 2nd cell: 0 if phy (in 1st cell) is to be used for SATA, 1 for PCIe + and 2 for Super Speed USB. diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index afa2354..2f58993 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -64,4 +64,10 @@ config BCM_KONA_USB2_PHY help Enable this to support the Broadcom Kona USB 2.0 PHY. +config PHY_ST_MIPHY40LP + tristate "ST MIPHY 40LP driver" + help + Support for ST MIPHY 40LP which can be used for PCIe, SATA and Super Speed USB. + select GENERIC_PHY + endmenu diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index b57c253..c061091 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -9,3 +9,4 @@ obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO) += phy-exynos-mipi-video.o obj-$(CONFIG_PHY_MVEBU_SATA) += phy-mvebu-sata.o obj-$(CONFIG_OMAP_USB2)+= phy-omap-usb2.o obj-$(CONFIG_TWL4030_USB) += phy-twl4030-usb.o +obj-$(CONFIG_PHY_ST_MIPHY40LP) += phy-miphy40lp.o diff --git a/drivers/phy/phy-miphy40lp.c b/drivers/phy/phy-miphy40lp.c new file mode 100644 index 000..d478c14 --- /dev/null +++ b/drivers/phy/phy-miphy40lp.c @@ -0,0 +1,174 @@ +/* + * ST MiPHY-40LP PHY driver + * + * Copyright (C) 2014 ST Microelectronics + * Pratyush Anand + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +enum phy_mode { + SATA, + PCIE, + SS_USB, +}; + +struct st_miphy40lp_priv { + /* regmap for any soc specific misc registers */ + struct regmap *misc; + /* phy struct pointer */ + struct phy *phy; + /* device node pointer */ + struct device_node *np; + /* phy mode: 0 for SATA 1 for PCIe and 2 for SS-USB */ + enum phy_mode mode; + /* instance id of this phy */ + u32 id; +}; + +static int miphy40lp_init(struct phy *phy) +{ + return -EINVAL; +} + +static int miphy40lp_exit(struct phy *phy) +{ + return -EINVAL; +} + +static int miphy40lp_power_off(struct phy *phy) +{ + return -EINVAL; +} + +static int miphy40lp_power_on(struct phy *phy) +{ + return -EINVAL; +} + +static const struct of_device_id st_miphy40lp_of_match[] = { + { .compatible = "st,miphy40lp-phy" }, + { }, +}; +MODULE_DEVICE_TABLE(of, st_miphy40lp_of_match); + +static struct phy_ops st_miphy40lp_ops = { + .init = miphy40lp_init, + .exit = miphy40lp_exit, + .power_off = miphy40lp_power_off, + .power_on = miphy40lp_power_on, + .owner = THIS_MODULE, +}; + +#ifdef CONFIG_PM_SLEEP +static int miphy40lp_suspend(struct device *dev) +{ + return -EINVAL; +} + +static int miphy40lp_resume(struct device *dev) +{ + return -EINVAL; +} +#endif + +static SIMPLE_DEV_PM_OPS(miphy40lp_pm_ops, miphy40lp_suspend, + miphy40lp_resume); + +static struct phy *st_miphy40lp_xlate(struct device *dev, + struct of_phandle_args *args) +{ + struct st_miphy40lp_priv *phypriv = dev_get_drvdata(dev); + + if (args->args_count < 1) { + dev
[PATCH V4 6/8] phy: st-miphy-40lp: Add SPEAr1310 and SPEAr1340 PCIe phy support
SPEAr1310 and SPEAr1340 uses miphy40lp phy for PCIe. This driver adds support for the same. Signed-off-by: Pratyush Anand Tested-by: Mohit Kumar Cc: Arnd Bergmann Cc: Kishon Vijay Abraham I Cc: spear-de...@list.st.com Cc: linux-arm-ker...@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/phy/phy-miphy40lp.c | 178 1 file changed, 178 insertions(+) diff --git a/drivers/phy/phy-miphy40lp.c b/drivers/phy/phy-miphy40lp.c index cc7f45d..61e94be 100644 --- a/drivers/phy/phy-miphy40lp.c +++ b/drivers/phy/phy-miphy40lp.c @@ -9,6 +9,7 @@ * published by the Free Software Foundation. * * 04/02/2014: Adding support of SATA mode for SPEAr1340. + * 04/02/2014: Adding support of PCIe mode for SPEAr1340 and SPEAr1310 */ #include @@ -73,6 +74,80 @@ #define SPEAR1340_PCIE_SATA_MIPHY_CFG_PCIE \ (SPEAR1340_MIPHY_OSC_BYPASS_EXT | \ SPEAR1340_MIPHY_PLL_RATIO_TOP(25)) +/* SPEAr1310 Registers */ +#define SPEAR1310_PCIE_SATA_CFG0x3A4 + #define SPEAR1310_PCIE_SATA2_SEL_PCIE (0 << 31) + #define SPEAR1310_PCIE_SATA1_SEL_PCIE (0 << 30) + #define SPEAR1310_PCIE_SATA0_SEL_PCIE (0 << 29) + #define SPEAR1310_PCIE_SATA2_SEL_SATA (1 << 31) + #define SPEAR1310_PCIE_SATA1_SEL_SATA (1 << 30) + #define SPEAR1310_PCIE_SATA0_SEL_SATA (1 << 29) + #define SPEAR1310_SATA2_CFG_TX_CLK_EN (1 << 27) + #define SPEAR1310_SATA2_CFG_RX_CLK_EN (1 << 26) + #define SPEAR1310_SATA2_CFG_POWERUP_RESET (1 << 25) + #define SPEAR1310_SATA2_CFG_PM_CLK_EN (1 << 24) + #define SPEAR1310_SATA1_CFG_TX_CLK_EN (1 << 23) + #define SPEAR1310_SATA1_CFG_RX_CLK_EN (1 << 22) + #define SPEAR1310_SATA1_CFG_POWERUP_RESET (1 << 21) + #define SPEAR1310_SATA1_CFG_PM_CLK_EN (1 << 20) + #define SPEAR1310_SATA0_CFG_TX_CLK_EN (1 << 19) + #define SPEAR1310_SATA0_CFG_RX_CLK_EN (1 << 18) + #define SPEAR1310_SATA0_CFG_POWERUP_RESET (1 << 17) + #define SPEAR1310_SATA0_CFG_PM_CLK_EN (1 << 16) + #define SPEAR1310_PCIE2_CFG_DEVICE_PRESENT (1 << 11) + #define SPEAR1310_PCIE2_CFG_POWERUP_RESET (1 << 10) + #define SPEAR1310_PCIE2_CFG_CORE_CLK_EN (1 << 9) + #define SPEAR1310_PCIE2_CFG_AUX_CLK_EN (1 << 8) + #define SPEAR1310_PCIE1_CFG_DEVICE_PRESENT (1 << 7) + #define SPEAR1310_PCIE1_CFG_POWERUP_RESET (1 << 6) + #define SPEAR1310_PCIE1_CFG_CORE_CLK_EN (1 << 5) + #define SPEAR1310_PCIE1_CFG_AUX_CLK_EN (1 << 4) + #define SPEAR1310_PCIE0_CFG_DEVICE_PRESENT (1 << 3) + #define SPEAR1310_PCIE0_CFG_POWERUP_RESET (1 << 2) + #define SPEAR1310_PCIE0_CFG_CORE_CLK_EN (1 << 1) + #define SPEAR1310_PCIE0_CFG_AUX_CLK_EN (1 << 0) + + #define SPEAR1310_PCIE_CFG_MASK(x) ((0xF << (x * 4)) | (1 << (x + 29))) + #define SPEAR1310_SATA_CFG_MASK(x) ((0xF << (x * 4 + 16)) | \ + (1 << (x + 29))) + #define SPEAR1310_PCIE_CFG_VAL(x) \ + (SPEAR1310_PCIE_SATA##x##_SEL_PCIE | \ + SPEAR1310_PCIE##x##_CFG_AUX_CLK_EN | \ + SPEAR1310_PCIE##x##_CFG_CORE_CLK_EN | \ + SPEAR1310_PCIE##x##_CFG_POWERUP_RESET | \ + SPEAR1310_PCIE##x##_CFG_DEVICE_PRESENT) + #define SPEAR1310_SATA_CFG_VAL(x) \ + (SPEAR1310_PCIE_SATA##x##_SEL_SATA | \ + SPEAR1310_SATA##x##_CFG_PM_CLK_EN | \ + SPEAR1310_SATA##x##_CFG_POWERUP_RESET | \ + SPEAR1310_SATA##x##_CFG_RX_CLK_EN | \ + SPEAR1310_SATA##x##_CFG_TX_CLK_EN) + +#define SPEAR1310_PCIE_MIPHY_CFG_1 0x3A8 + #define SPEAR1310_MIPHY_DUAL_OSC_BYPASS_EXT (1 << 31) + #define SPEAR1310_MIPHY_DUAL_CLK_REF_DIV2 (1 << 28) + #define SPEAR1310_MIPHY_DUAL_PLL_RATIO_TOP(x) (x << 16) + #define SPEAR1310_MIPHY_SINGLE_OSC_BYPASS_EXT (1 << 15) + #define SPEAR1310_MIPHY_SINGLE_CLK_REF_DIV2 (1 << 12) + #define SPEAR1310_MIPHY_SINGLE_PLL_RATIO_TOP(x) (x << 0) + #define SPEAR1310_PCIE_SATA_MIPHY_CFG_SATA_MASK (0x) + #define SPEAR1310_PCIE_SATA_MIPHY_CFG_PCIE_MASK (0x << 16) + #define SPEAR1310_PCIE_SATA_MIPHY_CFG_SATA \ + (SPEAR1310_MIPHY_DUAL_OSC_BYPASS_EXT | \ + SPEAR1310_MIPHY_DUAL_CLK_REF_DIV2 | \ + SPEAR1310_MIPHY_DUAL_PLL_RATIO_TOP(60) | \ + SPEAR1310_MIPHY_SINGLE_OSC_BYPASS_EXT | \ + SPEAR1310_MIPHY_SINGLE_CLK_REF_DIV2 | \ + SPEAR1310_MIPHY_SINGLE_PLL_RATIO_TOP(60)) +
[PATCH V4 5/8] SPEAr13xx: Fixup: Move SPEAr1340 SATA platform code to phy driver
ahci driver needs some platform specific functions which are called at init, exit, suspend and resume conditions. Till now these functions were present in a platform driver with a fixme notes. Similar functions modifying same set of registers will also be needed in case of PCIe phy init/exit. So move all these SATA platform code to phy-miphy40lp driver. Signed-off-by: Pratyush Anand Tested-by: Mohit Kumar Cc: Viresh Kumar Cc: Tejun Heo Cc: Arnd Bergmann Cc: Kishon Vijay Abraham I Cc: spear-de...@list.st.com Cc: linux-arm-ker...@lists.infradead.org Cc: devicet...@vger.kernel.org Cc: linux-...@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- .../devicetree/bindings/arm/spear-misc.txt | 4 + arch/arm/boot/dts/spear1310-evb.dts| 4 + arch/arm/boot/dts/spear1310.dtsi | 39 +++- arch/arm/boot/dts/spear1340-evb.dts| 4 + arch/arm/boot/dts/spear1340.dtsi | 13 +- arch/arm/boot/dts/spear13xx.dtsi | 5 + arch/arm/mach-spear/Kconfig| 2 + arch/arm/mach-spear/spear1340.c| 127 + drivers/phy/phy-miphy40lp.c| 204 - 9 files changed, 266 insertions(+), 136 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/spear-misc.txt diff --git a/Documentation/devicetree/bindings/arm/spear-misc.txt b/Documentation/devicetree/bindings/arm/spear-misc.txt new file mode 100644 index 000..aacd36a --- /dev/null +++ b/Documentation/devicetree/bindings/arm/spear-misc.txt @@ -0,0 +1,4 @@ +* SPEAr Misc configuration +** misc node required properties: +- compatible Should be "st,spear1340-misc", "syscon". +- reg: Address range of misc space diff --git a/arch/arm/boot/dts/spear1310-evb.dts b/arch/arm/boot/dts/spear1310-evb.dts index b56a801..d42c84b 100644 --- a/arch/arm/boot/dts/spear1310-evb.dts +++ b/arch/arm/boot/dts/spear1310-evb.dts @@ -106,6 +106,10 @@ status = "okay"; }; + miphy@eb80 { + status = "okay"; + }; + cf@b280 { status = "okay"; }; diff --git a/arch/arm/boot/dts/spear1310.dtsi b/arch/arm/boot/dts/spear1310.dtsi index 122ae94..64e7dd5 100644 --- a/arch/arm/boot/dts/spear1310.dtsi +++ b/arch/arm/boot/dts/spear1310.dtsi @@ -29,24 +29,57 @@ #gpio-cells = <2>; }; - ahci@b100 { + miphy0: miphy@eb80 { + compatible = "st,miphy", "st,spear1310-miphy"; + reg = <0xeb80 0x4000>; + misc = <&misc>; + phy-id = <0>; + #phy-cells = <1>; + status = "disabled"; + }; + + miphy1: miphy@eb804000 { + compatible = "st,miphy", "st,spear1310-miphy"; + reg = <0xeb804000 0x4000>; + misc = <&misc>; + phy-id = <1>; + #phy-cells = <1>; + status = "disabled"; + }; + + miphy2: miphy@eb808000 { + compatible = "st,miphy", "st,spear1310-miphy"; + reg = <0xeb808000 0x4000>; + misc = <&misc>; + phy-id = <2>; + #phy-cells = <1>; + status = "disabled"; + }; + + ahci0: ahci@b100 { compatible = "snps,spear-ahci"; reg = <0xb100 0x1>; interrupts = <0 68 0x4>; + phys = <&miphy0 0>; + phy-names = "sata-phy"; status = "disabled"; }; - ahci@b180 { + ahci1: ahci@b180 { compatible = "snps,spear-ahci"; reg = <0xb180 0x1>; interrupts = <0 69 0x4>; + phys = <&miphy1 0>; + phy-names = "sata-phy"; status = "disabled"; }; - ahci@b400 { + ahci2: ahci@b400 { compatible = "snps,spear-ahci"; reg = <0xb400 0x1>; interrupts = <0 70 0x4>; + phys = <&miphy2 0>; + phy-names = "sata-phy"; status = "disabled"; }; diff --git a/arch/arm/boot/dts/spear1340-evb.dts b/arch/arm/boot/dts/spear1340-evb.dts index d6c30ae..b23e05e 100644 --- a/arch/arm/boot/dts/spear1340-evb.dts +++ b/arch/arm/boot/dts/spear1340-evb.dts @@ -122,6 +122,10 @@ status = "okay";
Re: [PATCH] ieee80211: Print human-readable disassoc/deauth reason codes
On Wed, 2014-02-05 at 19:44 -0600, Calvin Owens wrote: > Create a function to return a descriptive string for each reason code, > and print that instead of the numeric value in the kernel log. These > codes are easily found on popular search engines, but one is generally > not able to access the internet when dealing with wireless connectivity > issues. Hello Calvin. Some suggestions below... > diff --git a/net/mac80211/main.c b/net/mac80211/main.c [] > @@ -743,6 +743,72 @@ static int ieee80211_init_cipher_suites(struct > ieee80211_local *local) > return 0; > } > > +static const char *reason_code_strings[49] = { static const char * const reason_etc... > + "(RESERVED)", > + "UNSPECIFIED", etc..., but perhaps this thing below is fragile. > +const char *ieee80211_get_reason_code_string(u16 reason_code) > +{ > + if (reason_code <= 24) > + return reason_code_strings[reason_code]; > + else if (reason_code >= 32 && reason_code <= 39) > + return reason_code_strings[reason_code - 7]; > + else if (reason_code == 45) > + return reason_code_strings[33]; > + else if (reason_code >= 52 && reason_code <= 66) > + return reason_code_strings[reason_code - 18]; > + else > + return "(INVALID)"; > +} Perhaps use a more common kernel style struct ieee80211_reason_descriptions { u16 code; const char *desc; } and enumerate the reason codes with #defines and use a macro to populate the descriptions #define IEEE80211_REASON_RESERVED 0 #define IEEE80211_REASON_UNSPECIFIED1 etc. #define POPULATE_IEEE_REASON(code) \ {.code = IEEE80211_REASON_##code, .desc = #code} static const struct ieee80211_reason_descriptions reasons[] = { POPULATE_IEEE_REASON(RESERVED), POPULATE_IEEE_REASON(UNSPECIFIED), [etc...] }; So this function becomes something like: const char *ieee80211_get_reason_code_string(u16 reason_code) { int i; for (i = 0; i < ARRAY_SIZE(reasons); i++) { if (reasons[i].code == reason_code) return reasons[i].desc; } return "UNKNOWN"; } This seems a lot less fragile. > diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c [] > @@ -2231,8 +2231,8 @@ static void ieee80211_rx_mgmt_deauth(struct > ieee80211_sub_if_data *sdata, > > reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); > > - sdata_info(sdata, "deauthenticated from %pM (Reason: %u)\n", > -bssid, reason_code); > + sdata_info(sdata, "deauthenticated from %pM (reason: %s)\n", > +bssid, ieee80211_get_reason_code_string(reason_code)); Perhaps "%u:%s", reason_code, ieee80211_get_reason_code_string(reason_code)) might be better here and the other places. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC] de-asmify the x86-64 system call slowpath
On Wed, Feb 5, 2014 at 6:32 PM, Linus Torvalds wrote: > > No, I was thinking "try to optimistically map 8 adjacent aligned pages > at a time" - that would be the same cacheline in the page tables, so > it would be fairly cheap if we couple it with a gang-lookup of the > pages in the page cache Doing the gang-lookup is hard, since it's all abstracted away, but the attached patch kind of tries to do what I described. This patch probably doesn't work, but something *like* this might be worth playing with. Except I suspect the page-backed faults are actually the minority, judging by how high clear_page_c_e is in the profile it's probably mostly anonymous memory. I have no idea why I started with the (more complex) case of file-backed prefaulting. Oh well. Linus mm/memory.c | 42 +- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/mm/memory.c b/mm/memory.c index be6a0c0d4ae0..d52ec6a344dc 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3487,15 +3487,55 @@ uncharge_out: return ret; } +#define no_fault_around(x) (x & (VM_FAULT_ERROR | VM_FAULT_MAJOR | VM_FAULT_RETRY)) +#define FAULT_AROUND_SHIFT (3) + +static void fault_around(struct mm_struct *mm, struct vm_area_struct *vma, + unsigned long address, pmd_t *pmd) +{ + int nr = 1 << FAULT_AROUND_SHIFT; + + address &= PAGE_MASK << FAULT_AROUND_SHIFT; + if (address < vma->vm_start) + return; + + do { + pte_t *pte; + pte_t entry; + pgoff_t pgoff; + + pte = pte_offset_map(pmd, address); + entry = *pte; + + pte_unmap(pte); + if (!pte_none(entry)) + continue; + pgoff = (address - vma->vm_start) >> PAGE_SHIFT; + pgoff += vma->vm_pgoff; + if (no_fault_around(__do_fault(mm, vma, address, pmd, pgoff, 0, entry))) + break; + } while (address += PAGE_SIZE, address < vma->vm_end && --nr > 0); +} + static int do_linear_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pte_t *page_table, pmd_t *pmd, unsigned int flags, pte_t orig_pte) { + int ret; pgoff_t pgoff = (((address & PAGE_MASK) - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; pte_unmap(page_table); - return __do_fault(mm, vma, address, pmd, pgoff, flags, orig_pte); + ret = __do_fault(mm, vma, address, pmd, pgoff, flags, orig_pte); + + /* +* If the page we were looking for succeeded with no retries, +* see if we can fault around it too.. +*/ + if (!no_fault_around(ret) && (flags & FAULT_FLAG_ALLOW_RETRY)) + fault_around(mm, vma, address, pmd); + + return ret; } /*
Re: [REVIEW PATCH] scsi: Add 'retry_timeout' to avoid infinite command retry
(2014/02/06 1:55), James Bottomley wrote: On Wed, 2014-02-05 at 14:47 +0900, Eiichi Tsukata wrote: Currently, scsi error handling in scsi_decide_disposition() tries to unconditionally requeue scsi command when device keeps some error state. This is because retryable errors are thought to be temporary and the scsi device will soon recover from those errors. Normally, such retry policy is appropriate because the device will soon recover from temporary error state. This description isn't very descriptive. I presume you're talking about the ADD_TO_MLQUEUE return from scsi_decide_disposition()? Thanks for reviewing, James. I was talking about ADD_TO_MLQUEUE and NEEDS_RETRY. I'll fix the description. But there is no guarantee that device is able to recover from error state immediately. Some hardware error may prevent device from recovering. Therefore hardware error can results in infinite command retry loop. If you're talking about ADD_TO_MLQUEUE, I don't believe this is correct: there's a test in scsi_softirq_done() that makes sure the maximum lifetime is retries*timeout and fails the command after that. I see, threre's already timeout in scsi_softirq_done() so my patch is not correct as you say. What I really want to do is to prevent command from retrying indefinitely in scsi_io_completion() with action == ACTION_RETRY || action == ACTION_DELAYED_RETRY. In v2 patch, I'll change the location of retry timeout check from scsi_softirq_done() to scsi_io_completion(). Eiichi (2014/02/06 1:55), James Bottomley wrote: On Wed, 2014-02-05 at 14:47 +0900, Eiichi Tsukata wrote: Currently, scsi error handling in scsi_decide_disposition() tries to unconditionally requeue scsi command when device keeps some error state. This is because retryable errors are thought to be temporary and the scsi device will soon recover from those errors. Normally, such retry policy is appropriate because the device will soon recover from temporary error state. This description isn't very descriptive. I presume you're talking about the ADD_TO_MLQUEUE return from scsi_decide_disposition()? But there is no guarantee that device is able to recover from error state immediately. Some hardware error may prevent device from recovering. Therefore hardware error can results in infinite command retry loop. If you're talking about ADD_TO_MLQUEUE, I don't believe this is correct: there's a test in scsi_softirq_done() that makes sure the maximum lifetime is retries*timeout and fails the command after that. James This patchs adds 'retry_timeout' sysfs attribute which limits the retry time of each scsi command. Once scsi command retry time is longer than this timeout, the command is treated as failure. 'retry_timeout' is set to '0' by default which means no timeout set. Signed-off-by: Eiichi Tsukata Cc: "James E.J. Bottomley" Cc: linux-s...@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/scsi/scsi_lib.c| 22 +- drivers/scsi/scsi_scan.c | 1 + drivers/scsi/scsi_sysfs.c | 32 include/scsi/scsi.h| 1 + include/scsi/scsi_device.h | 1 + 5 files changed, 56 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 7bd7f0d..a9db69e 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1492,6 +1492,23 @@ static void scsi_kill_request(struct request *req, struct request_queue *q) blk_complete_request(req); } +/* + * Check if scsi command excessed retry timeout + */ +static int scsi_retry_timed_out(struct scsi_cmnd *cmd) +{ + unsigned int retry_timeout; + + retry_timeout = cmd->device->retry_timeout; + if (retry_timeout && + time_before(cmd->jiffies_at_alloc + retry_timeout, jiffies)) { + scmd_printk(KERN_INFO, cmd, "retry timeout\n"); + return 1; + } + + return 0; +} + static void scsi_softirq_done(struct request *rq) { struct scsi_cmnd *cmd = rq->special; @@ -1512,7 +1529,10 @@ static void scsi_softirq_done(struct request *rq) wait_for/HZ); disposition = SUCCESS; } - + + if (scsi_retry_timed_out(cmd)) + disposition = FAILED; + scsi_log_completion(cmd, disposition); switch (disposition) { diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 307a811..4ab044a 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -925,6 +925,7 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result, sdev->no_dif = 1; sdev->eh_timeout = SCSI_DEFAULT_EH_TIMEOUT; + sdev->retry_timeout = SCSI_DEFAULT_RETRY_TIMEOUT; if (*bflags & BLIST_SKIP_VPD_PAGES) sdev->skip_vpd_pages = 1; diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 8ff62c2..eaa2118 100644 --- a/drivers/scsi/scsi_sysfs
Re: [PATCH v2] slub: Do not assert not having lock in removing freed partial
On Wed, 5 Feb 2014, Steven Rostedt wrote: > Vladimir reported the following issue: > > Commit c65c1877bd68 ("slub: use lockdep_assert_held") requires > remove_partial() to be called with n->list_lock held, but free_partial() > called from kmem_cache_close() on cache destruction does not follow this > rule, leading to a warning: > > WARNING: CPU: 0 PID: 2787 at mm/slub.c:1536 > __kmem_cache_shutdown+0x1b2/0x1f0() > Modules linked in: > CPU: 0 PID: 2787 Comm: modprobe Tainted: GW3.14.0-rc1-mm1+ #1 > Hardware name: >0600 88003ae1dde8 816d9583 0600 > 88003ae1de28 8107c107 >880037ab2b00 88007c240d30 ea0001ee5280 ea0001ee52a0 > Call Trace: >[] dump_stack+0x51/0x6e >[] warn_slowpath_common+0x87/0xb0 >[] warn_slowpath_null+0x15/0x20 >[] __kmem_cache_shutdown+0x1b2/0x1f0 >[] kmem_cache_destroy+0x43/0xf0 >[] xfs_destroy_zones+0x103/0x110 [xfs] >[] exit_xfs_fs+0x38/0x4e4 [xfs] >[] SyS_delete_module+0x19a/0x1f0 >[] ? retint_swapgs+0x13/0x1b >[] ? trace_hardirqs_on_caller+0x105/0x1d0 >[] ? trace_hardirqs_on_thunk+0x3a/0x3f >[] system_call_fastpath+0x16/0x1b > > > His solution was to add a spinlock in order to quiet lockdep. Although > there would be no contention to adding the lock, that lock also > requires disabling of interrupts which will have a larger impact on the > system. > > Instead of adding a spinlock to a location where it is not needed for > lockdep, make a __remove_partial() function that does not test if > the list_lock is held, as no one should have it due to it being freed. > > Also added a __add_partial() function that does not do the lock validation > either, as it is not needed for the creation of the cache. > > Suggested-by: David Rientjes > Reported-by: Vladimir Davydov > Signed-off-by: Steven Rostedt Acked-by: David Rientjes Thanks Steven! -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH net] r8152: fix the submission of the interrupt transfer
The submission of the interrupt transfer should be done after setting the bit of WORK_ENABLE, otherwise the callback function would have the opportunity to be returned directly. Clear the bit of WORK_ENABLE before killing the interrupt transfer. Signed-off-by: Hayes Wang --- drivers/net/usb/r8152.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index e8fac73..d89dbe3 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -2273,22 +2273,21 @@ static int rtl8152_open(struct net_device *netdev) struct r8152 *tp = netdev_priv(netdev); int res = 0; + rtl8152_set_speed(tp, AUTONEG_ENABLE, + tp->mii.supports_gmii ? SPEED_1000 : SPEED_100, + DUPLEX_FULL); + tp->speed = 0; + netif_carrier_off(netdev); + netif_start_queue(netdev); + set_bit(WORK_ENABLE, &tp->flags); res = usb_submit_urb(tp->intr_urb, GFP_KERNEL); if (res) { if (res == -ENODEV) netif_device_detach(tp->netdev); netif_warn(tp, ifup, netdev, "intr_urb submit failed: %d\n", res); - return res; } - rtl8152_set_speed(tp, AUTONEG_ENABLE, - tp->mii.supports_gmii ? SPEED_1000 : SPEED_100, - DUPLEX_FULL); - tp->speed = 0; - netif_carrier_off(netdev); - netif_start_queue(netdev); - set_bit(WORK_ENABLE, &tp->flags); return res; } @@ -2298,8 +2297,8 @@ static int rtl8152_close(struct net_device *netdev) struct r8152 *tp = netdev_priv(netdev); int res = 0; - usb_kill_urb(tp->intr_urb); clear_bit(WORK_ENABLE, &tp->flags); + usb_kill_urb(tp->intr_urb); cancel_delayed_work_sync(&tp->schedule); netif_stop_queue(netdev); tasklet_disable(&tp->tl); -- 1.8.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
mmotm 2014-02-05 list_lru_add lockdep splat
== [ INFO: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected ] 3.14.0-rc1-mm1 #1 Not tainted -- kswapd0/48 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire: (&(&lru->node[i].lock)->rlock){+.+.-.}, at: [] list_lru_add+0x80/0xf4 s already holding: (&(&mapping->tree_lock)->rlock){..-.-.}, at: [] __remove_mapping+0x3b/0x12d which would create a new lock dependency: (&(&mapping->tree_lock)->rlock){..-.-.} -> (&(&lru->node[i].lock)->rlock){+.+.-.} pendency connects a SOFTIRQ-irq-safe lock: (&(&mapping->tree_lock)->rlock){..-.-.} e SOFTIRQ-irq-safe at: [] __lock_acquire+0x589/0x954 [] lock_acquire+0x61/0x78 [] _raw_spin_lock_irqsave+0x3f/0x51 [] test_clear_page_writeback+0x96/0x2a5 [] end_page_writeback+0x17/0x41 [] end_buffer_async_write+0x12a/0x1aa [] end_bio_bh_io_sync+0x31/0x3c [] bio_endio+0x50/0x6e [] blk_update_request+0x16c/0x2fe [] blk_update_bidi_request+0x17/0x65 [] blk_end_bidi_request+0x1a/0x56 [] blk_end_request+0xb/0xd [] scsi_io_completion+0x16f/0x474 [] scsi_finish_command+0xb6/0xbf [] scsi_softirq_done+0xe9/0xf0 [] blk_done_softirq+0x79/0x8b [] __do_softirq+0xf7/0x213 [] irq_exit+0x3d/0x92 [] do_IRQ+0xb3/0xcc [] ret_from_intr+0x0/0x13 [] __might_sleep+0x71/0x198 [] console_conditional_schedule+0x20/0x27 [] fbcon_redraw.isra.20+0xee/0x15c [] fbcon_scroll+0x61c/0xba3 [] scrup+0xc5/0xe0 [] lf+0x29/0x61 [] do_con_trol+0x162/0x129d [] do_con_write+0x767/0x7f4 [] con_write+0xe/0x20 [] do_output_char+0x8b/0x1a6 [] n_tty_write+0x2ab/0x3c8 [] tty_write+0x1a9/0x241 [] redirected_tty_write+0x88/0x91 [] do_loop_readv_writev+0x43/0x72 [] do_readv_writev+0xf7/0x1be [] vfs_writev+0x32/0x46 [] SyS_writev+0x44/0x78 [] system_call_fastpath+0x16/0x1b q-unsafe lock: (&(&lru->node[i].lock)->rlock){+.+.-.} e SOFTIRQ-irq-unsafe at: ... [] __lock_acquire+0x600/0x954 [] lock_acquire+0x61/0x78 [] _raw_spin_lock+0x34/0x41 [] list_lru_add+0x80/0xf4 [] dput+0xb8/0x107 [] path_put+0x11/0x1c [] path_openat+0x4eb/0x58c [] do_filp_open+0x35/0x7a [] open_exec+0x36/0xd7 [] do_execve_common.isra.33+0x280/0x6b4 [] do_execve+0x13/0x15 [] try_to_run_init_process+0x24/0x49 [] kernel_init+0xb9/0xff [] ret_from_fork+0x7c/0xb0 might help us debug this: Possible interrupt unsafe locking scenario: CPU0CPU1 lock(&(&lru->node[i].lock)->rlock); local_irq_disable(); lock(&(&mapping->tree_lock)->rlock); lock(&(&lru->node[i].lock)->rlock); lock(&(&mapping->tree_lock)->rlock); ** 1 lock held by kswapd0/48: #0: (&(&mapping->tree_lock)->rlock){..-.-.}, at: [] __remove_mapping+0x3b/0x12d s between SOFTIRQ-irq-safe lock and the holding lock: -> (&(&mapping->tree_lock)->rlock){..-.-.} ops: 139535 { IN-SOFTIRQ-W at: [] __lock_acquire+0x589/0x954 [] lock_acquire+0x61/0x78 [] _raw_spin_lock_irqsave+0x3f/0x51 [] test_clear_page_writeback+0x96/0x2a5 [] end_page_writeback+0x17/0x41 [] end_buffer_async_write+0x12a/0x1aa [] end_bio_bh_io_sync+0x31/0x3c [] bio_endio+0x50/0x6e [] blk_update_request+0x16c/0x2fe [] blk_update_bidi_request+0x17/0x65 [] blk_end_bidi_request+0x1a/0x56 [] blk_end_request+0xb/0xd [] scsi_io_completion+0x16f/0x474 [] scsi_finish_command+0xb6/0xbf [] scsi_softirq_done+0xe9/0xf0 [] blk_done_softirq+0x79/0x8b [] __do_softirq+0xf7/0x213 [] irq_exit+0x3d/0x92 [] do_IRQ+0xb3/0xcc [] ret_from_intr+0x0/0x13 [] __might_sleep+0x71/0x198 [] console_conditional_schedule+0x20/0x27 [] fbcon_redraw.isra.20+0xee/0x15c [] fbcon_scroll+0x61c/0xba3 [] scrup+0xc5/0xe0 [] lf+0x29/0x61 [] do_con_trol+0x162/0x129d [] do_con_write+0x767/0x7f4 [] con_write+0xe/0x20 [] do_output_char+0x8b/0x1a6 [] n_tty_write+0x2ab/0x3c8 [] tty_write+0x1a9/0x241 [] redirected_tty_write+0x88/0x91 [] do_loop_readv_writev+0x43/0x72 [] do_readv_writev+0xf7/0x1be [] vfs_writev+0x32/0x46 [] SyS_writev+0x44/0x78 [] system_call_fastpath+0x16/0x1b IN-RECLAIM_FS-W at: [] __lock_acquire+0x62f/0x954 [] lock_ac
Re: [PATCH v2 3/5] char: ti-usim: Add driver for USIM module on AM43xx
On 2/4/2014 6:49 PM, Roger Quadros wrote: > Hi Satish, > > On 01/20/2014 06:33 AM, Satish Patel wrote: >> TI-USIM driver is a platform driver that provides a character >> driver interface to user applications. >> >> It allows user applications to call IOCTL's to >> perform smart card operations. >> >> Driver currently supports >> - ATR >> - T=0 & T=1 protocol >> - clock stop mode >> - smart card clock configuration >> - Tx/Rx application data units (APDU) to smart card >> - Interface to PHY using DT & phy interface >> >> Validation is done with ACOS3 smart cards >> >> Signed-off-by: Satish Patel >> --- >> .../devicetree/bindings/ti-usim/ti-usim.txt| 31 + >> drivers/char/Kconfig |7 + >> drivers/char/Makefile |1 + >> drivers/char/ti-usim-hw.h | 863 + >> drivers/char/ti-usim.c | 1859 >> > > ti-usim.c is a very large driver that does everything but looks like limited > to TI hardware. > How about splitting it into generic stuff and hw specific glue logic so that > most of the generic stuff > could be used by different hardware types. > Two things over here - First interface between user application and smartcard controller driver. There is already an open source f/w in user space called "pcsc" exists for this. - Second communication between smartcard controller and smartcard phy. I have introduce lite interface called sc_phy which covers generic stuff between controller and phy. >> include/linux/ti-usim.h| 98 + >> 6 files changed, 2859 insertions(+), 0 deletions(-) >> create mode 100644 Documentation/devicetree/bindings/ti-usim/ti-usim.txt >> create mode 100644 drivers/char/ti-usim-hw.h >> create mode 100644 drivers/char/ti-usim.c >> create mode 100644 include/linux/ti-usim.h >> > > cheers, > -roger > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
linux-next: Tree for Feb 6
Hi all, This tree fails (more than usual) the powerpc allyesconfig build. Changes since 20140205: The powerpc tree still had its build failure. The fscache tree gained a build failure so I used the version from next-20140205. Non-merge commits (relative to Linus' tree): 1225 998 files changed, 37126 insertions(+), 13611 deletions(-) I have created today's linux-next tree at git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git (patches at http://www.kernel.org/pub/linux/kernel/next/ ). If you are tracking the linux-next tree using git, you should not use "git pull" to do so as that will try to merge the new linux-next release with the old one. You should use "git fetch" as mentioned in the FAQ on the wiki (see below). You can see which trees have been included by looking in the Next/Trees file in the source. There are also quilt-import.log and merge.log files in the Next directory. Between each merge, the tree was built with a ppc64_defconfig for powerpc and an allmodconfig for x86_64 and a multi_v7_defconfig for arm. After the final fixups (if any), it is also built with powerpc allnoconfig (32 and 64 bit), ppc44x_defconfig and allyesconfig (minus CONFIG_PROFILE_ALL_BRANCHES - this fails its final link) and i386, sparc, sparc64 and arm defconfig. These builds also have CONFIG_ENABLE_WARN_DEPRECATED, CONFIG_ENABLE_MUST_CHECK and CONFIG_DEBUG_INFO disabled when necessary. Below is a summary of the state of the merge. I am currently merging 208 trees (counting Linus' and 28 trees of patches pending for Linus' tree). Stats about the size of the tree over time can be seen at http://neuling.org/linux-next-size.html . Status of my local build tests will be at http://kisskb.ellerman.id.au/linux-next . If maintainers want to give advice about cross compilers/configs that work, we are always open to add more builds. Thanks to Randy Dunlap for doing many randconfig builds. And to Paul Gortmaker for triage and bug fixes. There is a wiki covering stuff to do with linux-next at http://linux.f-seidel.de/linux-next/pmwiki/ . Thanks to Frank Seidel. -- Cheers, Stephen Rothwells...@canb.auug.org.au $ git checkout master $ git reset --hard stable Merging origin/master (f8f202348208 x86: Disable CONFIG_X86_DECODER_SELFTEST in allmod/allyesconfigs) Merging fixes/master (b0031f227e47 Merge tag 's2mps11-build' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator) Merging kbuild-current/rc-fixes (19514fc665ff arm, kbuild: make "make install" not depend on vmlinux) Merging arc-current/for-curr (7e22e91102c6 Linux 3.13-rc8) Merging arm-current/fixes (d326b65c57d6 ARM: fix building with gcc 4.6.4) Merging m68k-current/for-linus (56931d73697c m68k/mac: Make SCC reset work more reliably) Merging metag-fixes/fixes (3b2f64d00c46 Linux 3.11-rc2) Merging powerpc-merge/merge (b3084f4db3ae powerpc/thp: Fix crash on mremap) Merging sparc/master (9b0cd304f26b Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux) Merging net/master (bce3ea81d5b2 xen-netfront: handle backend CLOSED without CLOSING) Merging ipsec/master (965cdea82569 dccp: catch failed request_module call in dccp_probe init) Merging sound-current/for-linus (276ab336b4c6 ALSA: hda - Improve loopback path lookups for AD1983) Merging pci-current/for-linus (38dbfb59d117 Linus 3.14-rc1) Merging wireless/master (4cfe9a8d5829 ath9k: Fix TX power calculation) Merging driver-core.current/driver-core-linus (da9846ae1518 kernfs: make kernfs_deactivate() honor KERNFS_LOCKDEP flag) Merging tty.current/tty-linus (38dbfb59d117 Linus 3.14-rc1) Merging usb.current/usb-linus (7f196caffbf2 usb: core: Fix potential memory leak adding dyn USBdevice IDs) Merging staging.current/staging-linus (5a819ed6d4bb staging: imx-drm: Fix build error) Merging char-misc.current/char-misc-linus (38dbfb59d117 Linus 3.14-rc1) Merging input-current/for-linus (55df811f2066 Merge branch 'next' into for-linus) Merging md-current/for-linus (d47648fcf061 raid5: avoid finding "discard" stripe) Merging crypto-current/master (ee97dc7db4cb crypto: s390 - fix des and des3_ede ctr concurrency issue) Merging ide/master (9b0cd304f26b Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux) Merging dwmw2/master (5950f0803ca9 pcmcia: remove RPX board stuff) Merging devicetree-current/devicetree/merge (6f041e99fc7b of: Fix NULL dereference in unflatten_and_copy()) Merging rr-fixes/fixes (7122c3e9154b scripts/link-vmlinux.sh: only filter kernel symbols for arm) Merging mfd-fixes/master (73beb63d290f mfd: rtsx_pcr: Disable interrupts before cancelling delayed works) Merging vfio-fixes/for-linus (239a87020b26 Merge branch 'for-joerg/arm-smmu/fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/will/linux into for-linus) Mer
Logging/buffering mechanism comparison? (ring buffer, relay, etc.)
Just wondering if anyone had some pointers on a comparison between the various logging/buffering mechanisms out there (ring buffer, relay, lttng buffering, etc.)? Googling was inconclusive. Anything that has benchmarks/pros/cons would be great. Thanks, -- Karim Yaghmour CEO - Opersys inc. / www.opersys.com http://twitter.com/karimyaghmour -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 1/1] watchdog: Add tegra watchdog
Add a driver for the hardware watchdogs in NVIDIA Tegra SoCs (Tegra30 and later). This driver will configure one watchdog timer that will reset the system in the case of a watchdog timeout. This driver binds to the nvidia,tegra30-timer device node and gets its register base from there. Signed-off-by: Andrew Chew --- Changes from V2: Applied all of Stephen Warren's comments. Modified suspend callback by only stopping the watchdog timer if it was currently active. Added some logging during suspend/resume. Documentation/watchdog/watchdog-parameters.txt | 5 + drivers/watchdog/Kconfig | 11 + drivers/watchdog/Makefile | 1 + drivers/watchdog/tegra_wdt.c | 371 + 4 files changed, 388 insertions(+) create mode 100644 drivers/watchdog/tegra_wdt.c diff --git a/Documentation/watchdog/watchdog-parameters.txt b/Documentation/watchdog/watchdog-parameters.txt index f9492fe..b39f355 100644 --- a/Documentation/watchdog/watchdog-parameters.txt +++ b/Documentation/watchdog/watchdog-parameters.txt @@ -325,6 +325,11 @@ soft_noboot: Softdog action, set to 1 to ignore reboots, 0 to reboot stmp3xxx_wdt: heartbeat: Watchdog heartbeat period in seconds from 1 to 4194304, default 19 - +tegra_wdt: +heartbeat: Watchdog heartbeats in seconds. (default = 120) +nowayout: Watchdog cannot be stopped once started + (default=kernel config parameter) +- ts72xx_wdt: timeout: Watchdog timeout in seconds. (1 <= timeout <= 8, default=8) nowayout: Disable watchdog shutdown on close diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 4c4c566..3aae2da 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -420,6 +420,17 @@ config SIRFSOC_WATCHDOG Support for CSR SiRFprimaII and SiRFatlasVI watchdog. When the watchdog triggers the system will be reset. +config TEGRA_WATCHDOG + tristate "Tegra watchdog" + depends on ARCH_TEGRA || COMPILE_TEST + select WATCHDOG_CORE + help + Say Y here to include support for the watchdog timer + embedded in NVIDIA Tegra SoCs. + + To compile this driver as a module, choose M here: the + module will be called tegra_wdt. + # AVR32 Architecture config AT32AP700X_WDT diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 985a66c..1b5f3d5 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -58,6 +58,7 @@ obj-$(CONFIG_BCM2835_WDT) += bcm2835_wdt.o obj-$(CONFIG_MOXART_WDT) += moxart_wdt.o obj-$(CONFIG_SIRFSOC_WATCHDOG) += sirfsoc_wdt.o obj-$(CONFIG_BCM_KONA_WDT) += bcm_kona_wdt.o +obj-$(CONFIG_TEGRA_WATCHDOG) += tegra_wdt.o # AVR32 Architecture obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o diff --git a/drivers/watchdog/tegra_wdt.c b/drivers/watchdog/tegra_wdt.c new file mode 100644 index 000..1314475 --- /dev/null +++ b/drivers/watchdog/tegra_wdt.c @@ -0,0 +1,371 @@ +/* + * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +/* minimum and maximum watchdog trigger timeout, in seconds */ +#define MIN_WDT_TIMEOUT1 +#define MAX_WDT_TIMEOUT255 + +/* + * Base of the WDT registers, from the timer base address. There are + * actually 5 watchdogs that can be configured (by pairing with an available + * timer), at bases 0x100 + (WDT ID) * 0x20, where WDT ID is 0 through 4. + * This driver only configures the first watchdog (WDT ID 0). + */ +#define WDT_BASE 0x100 +#define WDT_ID 0 + +/* + * Register base of the timer that's selected for pairing with the watchdog. + * This driver arbitrarily uses timer 5, which is currently unused by + * other drivers (in particular, the Tegra clocksource driver). If this + * needs to change, take care that the new timer is not used by the + * clocksource driver. + */ +#define WDT_TIMER_BASE 0x60 +#define WDT_TIMER_ID 5 + +/* WDT registers */ +#define WDT_CFG0x0 +#define WDT_CFG_PERIOD_SHIFT 4 +#define WDT_CFG_PERIOD_MASK0xff +#define WDT_CFG_INT_EN (1 << 12) +#define WDT_CFG_PMC2CAR_RST_EN (1 << 15) +#define WDT_STS0x4 +#define WDT_ST
[PATCH v2] slub: Do not assert not having lock in removing freed partial
Vladimir reported the following issue: Commit c65c1877bd68 ("slub: use lockdep_assert_held") requires remove_partial() to be called with n->list_lock held, but free_partial() called from kmem_cache_close() on cache destruction does not follow this rule, leading to a warning: WARNING: CPU: 0 PID: 2787 at mm/slub.c:1536 __kmem_cache_shutdown+0x1b2/0x1f0() Modules linked in: CPU: 0 PID: 2787 Comm: modprobe Tainted: GW3.14.0-rc1-mm1+ #1 Hardware name: 0600 88003ae1dde8 816d9583 0600 88003ae1de28 8107c107 880037ab2b00 88007c240d30 ea0001ee5280 ea0001ee52a0 Call Trace: [] dump_stack+0x51/0x6e [] warn_slowpath_common+0x87/0xb0 [] warn_slowpath_null+0x15/0x20 [] __kmem_cache_shutdown+0x1b2/0x1f0 [] kmem_cache_destroy+0x43/0xf0 [] xfs_destroy_zones+0x103/0x110 [xfs] [] exit_xfs_fs+0x38/0x4e4 [xfs] [] SyS_delete_module+0x19a/0x1f0 [] ? retint_swapgs+0x13/0x1b [] ? trace_hardirqs_on_caller+0x105/0x1d0 [] ? trace_hardirqs_on_thunk+0x3a/0x3f [] system_call_fastpath+0x16/0x1b His solution was to add a spinlock in order to quiet lockdep. Although there would be no contention to adding the lock, that lock also requires disabling of interrupts which will have a larger impact on the system. Instead of adding a spinlock to a location where it is not needed for lockdep, make a __remove_partial() function that does not test if the list_lock is held, as no one should have it due to it being freed. Also added a __add_partial() function that does not do the lock validation either, as it is not needed for the creation of the cache. Suggested-by: David Rientjes Reported-by: Vladimir Davydov Signed-off-by: Steven Rostedt Index: linux-trace.git/mm/slub.c === --- linux-trace.git.orig/mm/slub.c +++ linux-trace.git/mm/slub.c @@ -1520,11 +1520,9 @@ static void discard_slab(struct kmem_cac /* * Management of partially allocated slabs. */ -static inline void add_partial(struct kmem_cache_node *n, - struct page *page, int tail) +static inline void +__add_partial(struct kmem_cache_node *n, struct page *page, int tail) { - lockdep_assert_held(&n->list_lock); - n->nr_partial++; if (tail == DEACTIVATE_TO_TAIL) list_add_tail(&page->lru, &n->partial); @@ -1532,15 +1530,27 @@ static inline void add_partial(struct km list_add(&page->lru, &n->partial); } -static inline void remove_partial(struct kmem_cache_node *n, - struct page *page) +static inline void add_partial(struct kmem_cache_node *n, + struct page *page, int tail) { lockdep_assert_held(&n->list_lock); + __add_partial(n, page, tail); +} +static inline void +__remove_partial(struct kmem_cache_node *n, struct page *page) +{ list_del(&page->lru); n->nr_partial--; } +static inline void remove_partial(struct kmem_cache_node *n, + struct page *page) +{ + lockdep_assert_held(&n->list_lock); + __remove_partial(n, page); +} + /* * Remove slab from the partial list, freeze it and * return the pointer to the freelist. @@ -2906,12 +2916,10 @@ static void early_kmem_cache_node_alloc( inc_slabs_node(kmem_cache_node, node, page->objects); /* -* the lock is for lockdep's sake, not for any actual -* race protection +* No locks need to be taken here as it has just been +* initialized and there is no concurrent access. */ - spin_lock(&n->list_lock); - add_partial(n, page, DEACTIVATE_TO_HEAD); - spin_unlock(&n->list_lock); + __add_partial(n, page, DEACTIVATE_TO_HEAD); } static void free_kmem_cache_nodes(struct kmem_cache *s) @@ -3197,7 +3205,7 @@ static void free_partial(struct kmem_cac list_for_each_entry_safe(page, h, &n->partial, lru) { if (!page->inuse) { - remove_partial(n, page); + __remove_partial(n, page); discard_slab(s, page); } else { list_slab_objects(s, page, -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 1/2] qspinlock: Introducing a 4-byte queue spinlock implementation
On 02/03/2014 06:40 AM, Peter Zijlstra wrote: On Fri, Jan 31, 2014 at 02:24:33PM -0500, Waiman Long wrote: Light contention is the only case where the qspinlock may not perform as good as the ticket spinlock. I know this is the most common case. However, I would argue that the slowdown, if any, will not be really noticeable. This is what I will try to find out. Please also explain why things are slower/faster. Thomas tried to get you to do so a few months back, but you kept deflecting. It is not easy to have a test case to test light contention. I am trying to create custom test case to get that data. -Longman -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v11 0/4] Introducing a queue read/write lock implementation
On 02/02/2014 04:03 AM, Ingo Molnar wrote: * Waiman Long wrote: How about making the selection of MCS or ticket queuing either user configurable or depending on the setting of NR_CPUS, NUMA, etc? No! There are lots of disadvantages to adding such CONFIG_NUMA Kconfig variants for locking primitives: - an doubling of the test matrix - an doubling of the review matrix and a halving of effective review capacity: we've just about go the capacity to review and validate patches like this. Splitting out a 'only NUMA cares' variant is a non-starter really. - but most importantly, there's absolutely no reason to not be fast on 128 CPU systems in the low contended case either! Sacrificing the low contended case with 'on 128 CPU systems it is the contended path that matters' is an idiotic argument. Essentially the only area were we allow Kconfig dependencies are unyielding physical forces: such as lots of CPUs needing a wider CPU mask. As Peter said it, the right solution is to fix the contended case. If that also happens to speed up or better organize the uncondended code then that's good, but it should not make it worse. Thanks, Ingo You are right. I am trying to measure the performance impact of MCS queuing has on a lightly contended system. I need to write some custom test code to get that information. With that information, I may be able to tune it to perform more or less on par with ticket lock. As for the additional cache line access of the MCS lock, I don't think it is really an issued as the MCS node is allocated on local stack which is likely to be in the cache anyway. I will report back when I have more data. -Longman -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 0/2] qspinlock: Introducing a 4-byte queue spinlock
On 02/03/2014 03:51 AM, Raghavendra K T wrote: On 01/31/2014 12:19 AM, Raghavendra K T wrote: On 01/30/2014 09:08 PM, Waiman Long wrote: On 01/30/2014 03:55 AM, Raghavendra K T wrote: On 01/28/2014 11:49 PM, Waiman Long wrote: [...] from kernel/bounds.c:9: include/linux/log2.h: In function ‘__ilog2_u32’: include/linux/log2.h:34:2: error: implicit declaration of function ‘fls’ [-Werror=implicit-function-declaration] include/linux/log2.h: In function ‘__ilog2_u64’: include/linux/log2.h:42:2: error: implicit declaration of function ‘fls64’ [-Werror=implicit-function-declaration] include/linux/log2.h: In function ‘__roundup_pow_of_two’: . . [trimmed] The code will need to be compiled in either the latest linux tree as the patches have dependency on some new memory barrier that are in 3.14. Alternatively, you can compile with the latest tip tree. If you have already done that, please send me your config file so that I can reproduce the compilation error in my build environment. I did compile on latest linux tree which had barrier.txt. May be I 'll recheck if I am missing something obvious. Here is .config attached An Update: The reason for failure was that I was compiling for guest. and CONFIG_PARAVIRT was enabled. Thank for the information. I will update my patch to correct that problem. -Longman -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC] de-asmify the x86-64 system call slowpath
On Wed, Feb 5, 2014 at 4:55 PM, Kirill A. Shutemov wrote: > > One thing that could help is THP for file-backed pages. And there's > prototype with basic infrasturure and support for ramfs and > shmem/tmpfs (by Ning Qu). Work in progress. THP isn't really realistic for any general-purpose loads. 2MB pages are just too big of a granularity. On a machine with just a few gigs (ie anything but big servers), you count the number of large pages in a few thousands. That makes fragmentation a big issue. Also, ELF sections aren't actually 2MB-aligned, nor do you really want to throw away 9 bits of virtual address space randomization. Plus common binaries aren't even big enough. Look at "bash", which is a pig - it's still less than a megabyte as just the binary, with the code segment being 900kB or so for me. For something like "perl", it's even smaller, with a number of shared object files that get loaded dynamically etc. IOW, THP is completely useless for any kind of scripting. It can be good for individual large binaries that have long lifetimes (DB processes, HPC, stuff like that), but no, it is *not* the answer to complex loads. And almost certainly never will be. It's possible that some special case (glibc for example) could be reasonably hacked to use a THP code segment, but that sounds unlikely. And the virtual address randomization really gets hurt. No, I was thinking "try to optimistically map 8 adjacent aligned pages at a time" - that would be the same cacheline in the page tables, so it would be fairly cheap if we couple it with a gang-lookup of the pages in the page cache (or, for anonymous pages, by just optimistically trying to do an order-3 page allocation, and if that works, just map the 32kB allocation you got as eight individual pages). I know it's been discussed at some point, and I even have a dim memory of having seen some really ugly patches. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 5/5] ARM: tegra: cpuidle: use firmware call for power down
On 02/06/2014 01:28 AM, Stephen Warren wrote: On 01/23/2014 12:39 AM, Alexandre Courbot wrote: On Thu, Jan 23, 2014 at 5:45 AM, Stephen Warren wrote: On 01/21/2014 03:10 AM, Alexandre Courbot wrote: Invoke the do_idle() firmware call before suspending a CPU so that the underlying firmware (if any) can take necessary action. diff --git a/arch/arm/mach-tegra/cpuidle-tegra114.c b/arch/arm/mach-tegra/cpuidle-tegra114.c @@ -45,6 +46,8 @@ static int tegra114_idle_power_down(struct cpuidle_device *dev, clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu); + call_firmware_op(do_idle); + cpu_suspend(0, tegra30_sleep_cpu_secondary_finish); clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu); Don't you need to have the kernel also *not* do something when entering idle; doesn't the FW op replace some of the register writes that the kernel would otherwise be doing? It seems like the operation is actually to inform the firmware that we are going to suspend the CPU. Downstream kernel also uses it that way. But you are right in that we should expect do_idle() to actually perform the suspend operation. Maybe a prepare_idle() operation should be added to the firmware interface for this purpose? That sounds like a reasonable change. Is it easy to plumb in? I think so. Will post a v2 of this soon. Thanks, Alex. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 11/18] extcon: max14577: Add max14577 prefix to muic_irqs
On 02/05/2014 11:04 PM, Lee Jones wrote: >>> Following patch has conflict on extcon-next branch(Linus 3.14-rc1) >>> when apply patchset by using git am. >>> >>> [PATCH 11/18] extcon: max14577: Add max14577 prefix to muic_irqs >>> [PATCH 12/18] extcon: max14577: Choose muic_irqs according to device type >>> [PATCH 14/18] extcon: max14577: Add support for max77836 >>> >>> The base commit of this patchset isn't mainline. You need to rebase this >>> patchset >>> on extcon-next branch and please resend this patchset. > > > >> This patch patch (along with other) depends on previous rename patches >> from this patchset: >> [PATCH 07/18] mfd: max14577: Rename and add MAX14577 symbols to prepare >> for max77836 >> http://article.gmane.org/gmane.linux.kernel/1636674 >> >> I can resolve the conflict but then they will return on applying patch >> 7/18. >> >> I think this patch may wait for a little until the rename-like patches >> will be accepted. >> >> Can you ACK other patches touch extcon? >> - [PATCH 07/18] mfd: max14577: Rename and add MAX14577 symbols... >> - [PATCH 08/18] mfd: max14577: Rename state container to maxim_core >> - [PATCH 09/18] mfd: max14577: Add "muic" suffix to regmap and irq_chip > > If you can obtain Acks for all of the patches, I can apply the entire > patch-set to an immutable branch and issue a pull-request for the > other maintainers to pull from. > Hi Lee, OK, I agree your opionion. I'd like you to apply this patchset dependent on extcon subsytem on your tree. I acked on following patchset and tested all of this patchset series. Acked-by: Chanwoo Choi [PATCH 06/18] extcon: max14577: Change extcon name instead of static name according to device type - I will delete this patch([PATCH 06/18]) on extcon-next branch. [PATCH 07/18] mfd: max14577: Rename and add MAX14577 symbols... [PATCH 08/18] mfd: max14577: Rename state container to maxim_core [PATCH 09/18] mfd: max14577: Add "muic" suffix to regmap and irq_chip [PATCH 11/18] extcon: max14577: Add max14577 prefix to muic_irqs [PATCH 12/18] extcon: max14577: Choose muic_irqs according to device type [PATCH 14/18] extcon: max14577: Add support for max77836 Thanks, Chanwoo Choi -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] serial/uart: Add tunable RX interrupt trigger I/F of FIFO buffers
Add tunable RX interrupt trigger I/F of FIFO buffers. Serial devices are used as not only message communication devices but control or sending communication devices. For the latter uses, normally small data will be exchanged, so user applications want to receive data unit as soon as possible for real-time tendency. If we have a sensor which sends a 1 byte data each time and must control a device based on the sensor feedback, the RX interrupt should be triggered for each data. According to HW specification of serial UART devices, RX interrupt trigger can be changed, but the trigger is hard-coded. For example, RX interrupt trigger in 16550A can be set to 1, 4, 8, or 14 bytes for HW, but current driver sets the trigger to only 8bytes. This patch makes a 16550A device change RX interrupt trigger from userland. unsigned char rx_trig_byte = 1; fd = open(TTY_PASS, O_RDWR | O_NONBLOCK); ioctl(fd, TIOCSFIFOTRIG, &rx_trig_byte); read(fd, buf, size); - 16550A (1, 4, 8, or 14 bytes) Signed-off-by: Yoshihiro YUNOMAE Cc: Greg Kroah-Hartman --- drivers/tty/serial/8250/8250_core.c | 63 +++ include/uapi/asm-generic/ioctls.h |2 + 2 files changed, 65 insertions(+) diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index 61ecd70..f51637a 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -2699,6 +2699,68 @@ serial8250_verify_port(struct uart_port *port, struct serial_struct *ser) return 0; } +static int convert_val2rxtrig(struct uart_8250_port *up, unsigned char val) +{ + switch (up->port.type) { + case PORT_16550A: + if (val == 1) + return UART_FCR_R_TRIG_00; + else if (val == 4) + return UART_FCR_R_TRIG_01; + else if (val == 8) + return UART_FCR_R_TRIG_10; + else if (val == 14) + return UART_FCR_R_TRIG_11; + break; + default: + pr_info("Not support RX-trigger setting for this serial %u\n", + up->port.type); + } + return -EINVAL; +} + +static int set_fifo_rx_trigger(struct uart_8250_port *up, + unsigned char __user *uval) +{ + unsigned char fcr, val; + int rx_trig; + + if (copy_from_user(&val, uval, sizeof(unsigned char))) + return -EFAULT; + + rx_trig = convert_val2rxtrig(up, val); + if (rx_trig < 0) + return rx_trig; + + fcr = uart_config[up->port.type].fcr; + serial8250_clear_fifos(up); + fcr &= ~UART_FCR_TRIGGER_MASK; + fcr |= (unsigned char)rx_trig; + serial_out(up, UART_FCR, fcr); + return 0; +} + +static int +serial8250_ioctl(struct uart_port *port, unsigned int cmd, unsigned long arg) +{ + struct uart_8250_port *up = + container_of(port, struct uart_8250_port, port); + void __user *uarg = (void __user *)arg; + int ret; + + if (!(up->capabilities & UART_CAP_FIFO) || port->fifosize <= 1) + return -EINVAL; + + switch (cmd) { + case TIOCSFIFORTRIG: + ret = set_fifo_rx_trigger(up, uarg); + break; + default: + ret = -ENOIOCTLCMD; + } + return ret; +} + static const char * serial8250_type(struct uart_port *port) { @@ -2728,6 +2790,7 @@ static struct uart_ops serial8250_pops = { .request_port = serial8250_request_port, .config_port= serial8250_config_port, .verify_port= serial8250_verify_port, + .ioctl = serial8250_ioctl, #ifdef CONFIG_CONSOLE_POLL .poll_get_char = serial8250_get_poll_char, .poll_put_char = serial8250_put_poll_char, diff --git a/include/uapi/asm-generic/ioctls.h b/include/uapi/asm-generic/ioctls.h index 143dacb..d2e56a4 100644 --- a/include/uapi/asm-generic/ioctls.h +++ b/include/uapi/asm-generic/ioctls.h @@ -78,6 +78,8 @@ #define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */ #define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */ +#define TIOCSFIFORTRIG 0x5441 + #define FIONCLEX 0x5450 #define FIOCLEX0x5451 #define FIOASYNC 0x5452 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 06/14] perf, core: always switch pmu specific data during context switch
On 02/06/2014 02:35 AM, Stephane Eranian wrote: > On Wed, Feb 5, 2014 at 6:55 PM, Peter Zijlstra wrote: >> On Wed, Feb 05, 2014 at 06:19:27PM +0100, Stephane Eranian wrote: >>> On Fri, Jan 3, 2014 at 6:48 AM, Yan, Zheng wrote: If two tasks were both forked from the same parent task, Events in their perf task contexts can be the same. Perf core optimizes context switch oout in this case. Previous patch inroduces pmu specific data. The data is task specific, so we should switch the data even when context switch is optimized out. >>> Reviwed-by: Stephane Eranian >> >> You should look again.. that xchg() is an atomic op and a total waste of >> time since the assignment back onto ctx->task_ctx_data is non-atomic. >> >> Complete fail there. >> > I admit, it was not clear to me why the xchg(). Sorry. I forget why I used xhcg(), maybe save a few lines of code. Regards Yan, Zheng > Signed-off-by: Yan, Zheng --- kernel/events/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/events/core.c b/kernel/events/core.c index b6650ab..d6d8dea 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -2319,6 +2319,8 @@ static void perf_event_context_sched_out(struct task_struct *task, int ctxn, next->perf_event_ctxp[ctxn] = ctx; ctx->task = next; next_ctx->task = task; + ctx->task_ctx_data = xchg(&next_ctx->task_ctx_data, + ctx->task_ctx_data); do_switch = 0; perf_event_sync_stat(ctx, next_ctx); -- 1.8.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 09/18] mfd: max14577: Add "muic" suffix to regmap and irq_chip
On 01/28/2014 09:18 PM, Krzysztof Kozlowski wrote: > This patch continues the preparation for adding support for max77836 > device to existing max14577 driver. > > Add "muic" suffix to regmap and irq_data fields in maxim_core state > container to prepare for max77836 support. > This is only a rename-like patch, new code is not added. > > Signed-off-by: Krzysztof Kozlowski > Cc: Kyungmin Park > Cc: Marek Szyprowski > --- > drivers/extcon/extcon-max14577.c | 17 + > drivers/mfd/max14577.c | 22 +++--- > drivers/power/max14577_charger.c |8 > drivers/regulator/max14577.c |2 +- > include/linux/mfd/max14577-private.h |4 ++-- > 5 files changed, 27 insertions(+), 26 deletions(-) > For extcon: Acked-by: Chanwoo Choi For mfd/regulator/charger/extcon of max14577 Tested-by: Chanwoo Choi Thanks, Chanwoo Choi -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 08/18] mfd: max14577: Rename state container to maxim_core
On 01/28/2014 09:18 PM, Krzysztof Kozlowski wrote: > This patch continues the preparation for adding support for max77836 > device to existing max14577 driver. > > The patch renames the struct "max14577" state container to "maxim_core". > This is only a rename-like patch, new code is not added. > > Signed-off-by: Krzysztof Kozlowski > Cc: Kyungmin Park > Cc: Marek Szyprowski > --- > drivers/extcon/extcon-max14577.c | 22 +-- > drivers/mfd/max14577.c | 68 > +- > drivers/power/max14577_charger.c | 16 > drivers/regulator/max14577.c |6 +-- > include/linux/mfd/max14577-private.h |5 ++- > 5 files changed, 60 insertions(+), 57 deletions(-) > For extcon: Acked-by: Chanwoo Choi For mfd/regulator/charger/extcon of max14577 Tested-by: Chanwoo Choi Thanks, Chanwoo Choi -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 04/14] perf, x86: Basic Haswell LBR call stack support
On 02/05/2014 11:40 PM, Stephane Eranian wrote: > On Fri, Jan 3, 2014 at 6:48 AM, Yan, Zheng wrote: >> When the call stack feature is enabled, the LBR stack will capture >> unfiltered call data normally, but as return instructions are executed, >> the last captured branch record is flushed from the on-chip registers >> in a last-in first-out (LIFO) manner. Thus, branch information relative >> to leaf functions will not be captured, while preserving the call stack >> information of the main line execution path. >> > This is a generic description of the LBR call stack feature. It does not > describe what the patch actually does which is implement the basic > internal infrastructure for CALL_STACK mode using LBR callstack. > >> Signed-off-by: Yan, Zheng >> --- >> arch/x86/kernel/cpu/perf_event.h | 7 ++- >> arch/x86/kernel/cpu/perf_event_intel.c | 2 +- >> arch/x86/kernel/cpu/perf_event_intel_lbr.c | 98 >> +++--- >> 3 files changed, 82 insertions(+), 25 deletions(-) >> >> diff --git a/arch/x86/kernel/cpu/perf_event.h >> b/arch/x86/kernel/cpu/perf_event.h >> index 80b8e83..3ef4b79 100644 >> --- a/arch/x86/kernel/cpu/perf_event.h >> +++ b/arch/x86/kernel/cpu/perf_event.h >> @@ -460,7 +460,10 @@ struct x86_pmu { >> }; >> >> enum { >> - PERF_SAMPLE_BRANCH_SELECT_MAP_SIZE = PERF_SAMPLE_BRANCH_MAX_SHIFT, >> + PERF_SAMPLE_BRANCH_CALL_STACK_SHIFT = PERF_SAMPLE_BRANCH_MAX_SHIFT, >> + PERF_SAMPLE_BRANCH_SELECT_MAP_SIZE, >> + >> + PERF_SAMPLE_BRANCH_CALL_STACK = 1U << >> PERF_SAMPLE_BRANCH_CALL_STACK_SHIFT, >> }; >> >> #define x86_add_quirk(func_) \ >> @@ -697,6 +700,8 @@ void intel_pmu_lbr_init_atom(void); >> >> void intel_pmu_lbr_init_snb(void); >> >> +void intel_pmu_lbr_init_hsw(void); >> + >> int intel_pmu_setup_lbr_filter(struct perf_event *event); >> >> int p4_pmu_init(void); >> diff --git a/arch/x86/kernel/cpu/perf_event_intel.c >> b/arch/x86/kernel/cpu/perf_event_intel.c >> index 4325bae..84a1c09 100644 >> --- a/arch/x86/kernel/cpu/perf_event_intel.c >> +++ b/arch/x86/kernel/cpu/perf_event_intel.c >> @@ -2494,7 +2494,7 @@ __init int intel_pmu_init(void) >> memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, >> sizeof(hw_cache_event_ids)); >> memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs, >> sizeof(hw_cache_extra_regs)); >> >> - intel_pmu_lbr_init_snb(); >> + intel_pmu_lbr_init_hsw(); >> >> x86_pmu.event_constraints = intel_hsw_event_constraints; >> x86_pmu.pebs_constraints = intel_hsw_pebs_event_constraints; >> diff --git a/arch/x86/kernel/cpu/perf_event_intel_lbr.c >> b/arch/x86/kernel/cpu/perf_event_intel_lbr.c >> index 7ff2a99..bdd8758 100644 >> --- a/arch/x86/kernel/cpu/perf_event_intel_lbr.c >> +++ b/arch/x86/kernel/cpu/perf_event_intel_lbr.c >> @@ -39,6 +39,7 @@ static enum { >> #define LBR_IND_JMP_BIT6 /* do not capture indirect jumps */ >> #define LBR_REL_JMP_BIT7 /* do not capture relative jumps */ >> #define LBR_FAR_BIT8 /* do not capture far branches */ >> +#define LBR_CALL_STACK_BIT 9 /* enable call stack */ >> >> #define LBR_KERNEL (1 << LBR_KERNEL_BIT) >> #define LBR_USER (1 << LBR_USER_BIT) >> @@ -49,6 +50,7 @@ static enum { >> #define LBR_REL_JMP(1 << LBR_REL_JMP_BIT) >> #define LBR_IND_JMP(1 << LBR_IND_JMP_BIT) >> #define LBR_FAR(1 << LBR_FAR_BIT) >> +#define LBR_CALL_STACK (1 << LBR_CALL_STACK_BIT) >> >> #define LBR_PLM (LBR_KERNEL | LBR_USER) >> >> @@ -74,24 +76,25 @@ static enum { >> * x86control flow changes include branches, interrupts, traps, faults >> */ >> enum { >> - X86_BR_NONE = 0, /* unknown */ >> - >> - X86_BR_USER = 1 << 0, /* branch target is user */ >> - X86_BR_KERNEL = 1 << 1, /* branch target is kernel */ >> - >> - X86_BR_CALL = 1 << 2, /* call */ >> - X86_BR_RET = 1 << 3, /* return */ >> - X86_BR_SYSCALL = 1 << 4, /* syscall */ >> - X86_BR_SYSRET = 1 << 5, /* syscall return */ >> - X86_BR_INT = 1 << 6, /* sw interrupt */ >> - X86_BR_IRET = 1 << 7, /* return from interrupt */ >> - X86_BR_JCC = 1 << 8, /* conditional */ >> - X86_BR_JMP = 1 << 9, /* jump */ >> - X86_BR_IRQ = 1 << 10,/* hw interrupt or trap or fault */ >> - X86_BR_IND_CALL = 1 << 11,/* indirect calls */ >> - X86_BR_ABORT= 1 << 12,/* transaction abort */ >> - X86_BR_IN_TX= 1 << 13,/* in transaction */ >> - X86_BR_NO_TX= 1 << 14,/* not in transaction */ >> + X86_BR_NONE = 0, /* unknown */ >> + >> + X86_BR_USER = 1 << 0, /* branch target is user */ >> + X86_BR_KERNEL = 1 << 1, /* branch target is kernel */ >> + >> + X86_BR_CALL = 1 << 2, /* call */ >> + X86_BR_RET
Re: [PATCH 07/18] mfd: max14577: Rename and add MAX14577 symbols to prepare for max77836
On 01/28/2014 09:18 PM, Krzysztof Kozlowski wrote: > This patch prepares for adding support for max77836 device to existing > max14577 driver: > 1. Renames most of symbols and defines prefixed with MAX14577 to MAXIM. > 2. Adds prefixes (MAXIM or MAX14577) to defines without any MAX* prefix. > > This is only a rename-like patch, new code is not added. > > Signed-off-by: Krzysztof Kozlowski > Cc: Kyungmin Park > Cc: Marek Szyprowski > --- > drivers/extcon/extcon-max14577.c | 105 - > drivers/mfd/max14577.c | 51 ++--- > drivers/power/max14577_charger.c | 81 +++ > drivers/regulator/max14577.c | 44 ++-- > include/linux/mfd/max14577-private.h | 399 > -- > include/linux/mfd/max14577.h |2 +- > 6 files changed, 333 insertions(+), 349 deletions(-) > For extcon: Acked-by: Chanwoo Choi Thanks, Chanwoo Choi -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ieee80211: Print human-readable disassoc/deauth reason codes
Create a function to return a descriptive string for each reason code, and print that instead of the numeric value in the kernel log. These codes are easily found on popular search engines, but one is generally not able to access the internet when dealing with wireless connectivity issues. On x86_64, this patch only enlarges the kernel binary by 489 bytes. Signed-off-by: Calvin Owens --- include/net/mac80211.h | 11 + net/mac80211/main.c| 66 ++ net/mac80211/mlme.c| 12 - 3 files changed, 83 insertions(+), 6 deletions(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index f4ab2fb..5983b25 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -2973,6 +2973,17 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, const struct ieee80211_ops *ops); /** + * ieee80211_get_reason_code_string - Get human readable reason code + * + * This function returns a string describing the @reason_code. + * + * @reason_code: Reason code we want a human readable string for + * + * Return: Human readable reason string, or "(INVALID)" + */ +const char *ieee80211_get_reason_code_string(u16 reason_code); + +/** * ieee80211_register_hw - Register hardware device * * You must call this function before any other functions in diff --git a/net/mac80211/main.c b/net/mac80211/main.c index d767cfb..a1eb3ab 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -743,6 +743,72 @@ static int ieee80211_init_cipher_suites(struct ieee80211_local *local) return 0; } +static const char *reason_code_strings[49] = { + "(RESERVED)", + "UNSPECIFIED", + "PREV_AUTH_NOT_VALID", + "DEAUTH_LEAVING", + "DISASSOC_DUE_TO_INACTIVITY", + "DISASSOC_AP_BUSY", + "CLASS2_FRAME_FROM_NONAUTH_STA", + "CLASS3_FRAME_FROM_NONASSOC_STA", + "DISASSOC_STA_HAS_LEFT", + "STA_REQ_ASSOC_WITHOUT_AUTH", + "DISASSOC_BAD_POWER", + "DISASSOC_BAD_SUPP_CHAN", + "(RESERVED)", + "INVALID_IE", + "MIC_FAILURE", + "4WAY_HANDSHAKE_TIMEOUT", + "GROUP_KEY_HANDSHAKE_TIMEOUT", + "IE_DIFFERENT", + "INVALID_GROUP_CIPHER", + "INVALID_PAIRWISE_CIPHER", + "INVALID_AKMP", + "UNSUPP_RSN_VERSION", + "INVALID_RSN_IE_CAP", + "IEEE8021X_FAILED", + "CIPHER_SUITE_REJECTED", /* 24 */ + "DISASSOC_UNSPECIFIED_QOS", /* 32 (25) */ + "DISASSOC_QAP_NO_BANDWIDTH", + "DISASSOC_LOW_ACK", + "DISASSOC_QAP_EXCEED_TXOP", + "QSTA_LEAVE_QBSS", + "QSTA_NOT_USE", + "QSTA_REQUIRE_SETUP", + "QSTA_TIMEOUT", + "QSTA_CIPHER_NOT_SUPP", /* 45 (33) */ + "MESH_PEER_CANCELED", /* 52 (34) */ + "MESH_MAX_PEERS", + "MESH_CONFIG", + "MESH_CLOSE", + "MESH_MAX_RETRIES", + "MESH_CONFIRM_TIMEOUT", + "MESH_INVALID_GTK", + "MESH_INCONSISTENT_PARAM", + "MESH_INVALID_SECURITY", + "MESH_PATH_ERROR", + "MESH_PATH_NOFORWARD", + "MESH_PATH_DEST_UNREACHABLE", + "MAC_EXISTS_IN_MBSS", + "MESH_CHAN_REGULATORY", + "MESH_CHAN" /* 66 (48) */ +}; + +const char *ieee80211_get_reason_code_string(u16 reason_code) +{ + if (reason_code <= 24) + return reason_code_strings[reason_code]; + else if (reason_code >= 32 && reason_code <= 39) + return reason_code_strings[reason_code - 7]; + else if (reason_code == 45) + return reason_code_strings[33]; + else if (reason_code >= 52 && reason_code <= 66) + return reason_code_strings[reason_code - 18]; + else + return "(INVALID)"; +} + int ieee80211_register_hw(struct ieee80211_hw *hw) { struct ieee80211_local *local = hw_to_local(hw); diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index fc1d824..74e4585 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -2231,8 +2231,8 @@ static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata, reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); - sdata_info(sdata, "deauthenticated from %pM (Reason: %u)\n", - bssid, reason_code); + sdata_info(sdata, "deauthenticated from %pM (reason: %s)\n", + bssid, ieee80211_get_reason_code_string(reason_code)); ieee80211_set_disassoc(sdata, 0, 0, false, NULL); @@ -4301,8 +4301,8 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, bool report_frame = false; sdata_info(sdata, - "deauthenticating from %pM by local choice (reason=%d)\n", - req->bssid, req->reason_code); + "deauthenticating from %pM by local choice (reason: %s)\n", + req->bssid, ieee80211_get_reason_code_string(req->reason_code)); if (ifmgd->auth_data) { drv_mgd_prepare_tx(sdata->
[PATCH] thermal: add generic IIO channel thermal sensor driver
This driver is a generic method for using IIO ADC channels as thermal sensors. Signed-off-by: Courtney Cavin --- .../devicetree/bindings/thermal/iio-thermal.txt| 46 + drivers/thermal/Kconfig| 13 ++ drivers/thermal/Makefile | 1 + drivers/thermal/iio_thermal.c | 207 + 4 files changed, 267 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/iio-thermal.txt create mode 100644 drivers/thermal/iio_thermal.c diff --git a/Documentation/devicetree/bindings/thermal/iio-thermal.txt b/Documentation/devicetree/bindings/thermal/iio-thermal.txt new file mode 100644 index 000..3be11b6 --- /dev/null +++ b/Documentation/devicetree/bindings/thermal/iio-thermal.txt @@ -0,0 +1,46 @@ +Generic IIO channel thermal sensor bindings + +compatible: + Usage: required + Type: string + Desc: compatible string, must be "iio-thermal" + +conversion-method: + Usage: required + Type: string + Desc: How to convert IIO voltage values to temperature, one of: + "interpolation" - interpolate between values in lookup table + "scalar" - use values as multiplier and divisor + +conversion-values: + Usage: required + Type: u32 array, 2-tuples + Desc: lookup table for conversion, for conversion-method: + "interpolation" - 2-tuples of < uV mK >; micro-volts to + milli-kelvin; table must ascend + "scalar" - single scalar 2-tuple as < M D >; where: + mK = uV * M / D + +io-channels: + Usage: required + Type: prop-encoded-array + Desc: See bindings/iio/iio-bindings.txt; must be a voltage channel + +Example: + +vadc: some_vadc { + compatible = "..."; + #io-channel-cells = <1>; +}; + +iio-thermal { + compatible = "iio-thermal"; + io-channels = <&vadc 0>; + conversion-method = "interpolation"; + conversion-values = < + 3 398200 +385000 318200 + 1738000 233200 + >; +}; + diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index 35c0664..f83a8e8 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -114,6 +114,19 @@ config THERMAL_EMULATION because userland can easily disable the thermal policy by simply flooding this sysfs node with low temperature values. +config IIO_THERMAL + tristate "Temperature sensor driver for generic IIO channels" + depends on IIO + depends on THERMAL_OF + help + Support for generic IIO channels, such as ADCs. This driver allows + you to expose an IIO voltage channel as a thermal sensor. This is + implemented as a thermal sensor, not a thermal zone, and thus + requires DT defined thermal infrastructure in order to be useful. + + If you aren't sure that you need this support, or haven't configured + a thermal infrastructure in device tree, you should say 'N' here. + config IMX_THERMAL tristate "Temperature sensor driver for Freescale i.MX SoCs" depends on CPU_THERMAL diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile index 54e4ec9..0ee2c92 100644 --- a/drivers/thermal/Makefile +++ b/drivers/thermal/Makefile @@ -25,6 +25,7 @@ obj-y += samsung/ obj-$(CONFIG_DOVE_THERMAL) += dove_thermal.o obj-$(CONFIG_DB8500_THERMAL) += db8500_thermal.o obj-$(CONFIG_ARMADA_THERMAL) += armada_thermal.o +obj-$(CONFIG_IIO_THERMAL) += iio_thermal.o obj-$(CONFIG_IMX_THERMAL) += imx_thermal.o obj-$(CONFIG_DB8500_CPUFREQ_COOLING) += db8500_cpufreq_cooling.o obj-$(CONFIG_INTEL_POWERCLAMP) += intel_powerclamp.o diff --git a/drivers/thermal/iio_thermal.c b/drivers/thermal/iio_thermal.c new file mode 100644 index 000..df21dbc --- /dev/null +++ b/drivers/thermal/iio_thermal.c @@ -0,0 +1,207 @@ +/* + * An IIO channel based thermal sensor driver + * + * Copyright (C) 2014 Sony Mobile Communications, AB + * + * 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; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include + +#define MILLIKELVIN_0C 273150 + +struct iio_thermal_conv { + s32 *values; + int ntuple; + long (*convert)(const struct iio_thermal_conv *, int val); +}; + +struct iio_thermal { + struct thermal_zone_device *tz; + struct iio_channel *chan; + struct iio_thermal_conv conv; +}; + +s
Re: [PATCH 02/14] perf, core: introduce pmu context switch callback
On 02/06/2014 12:01 AM, Stephane Eranian wrote: > On Fri, Jan 3, 2014 at 6:47 AM, Yan, Zheng wrote: >> The callback is invoked when process is scheduled in or out. It >> provides mechanism for later patches to save/store the LBR stack. >> It can also replace the flush branch stack callback. >> > I think you need to say this callback may be invoked on context switches > with per-thread events attached. As far I understand, the callback cannot > be invoked for system-wide events. It's also invoked when there is only system-wide event. (the flush branch stack case) Regards Yan, Zheng > >> To avoid unnecessary overhead, the callback is enabled dynamically >> >> Signed-off-by: Yan, Zheng >> --- >> arch/x86/kernel/cpu/perf_event.c | 7 + >> arch/x86/kernel/cpu/perf_event.h | 4 +++ >> include/linux/perf_event.h | 8 ++ >> kernel/events/core.c | 60 >> +++- >> 4 files changed, 78 insertions(+), 1 deletion(-) >> >> diff --git a/arch/x86/kernel/cpu/perf_event.c >> b/arch/x86/kernel/cpu/perf_event.c >> index 8e13293..6703d17 100644 >> --- a/arch/x86/kernel/cpu/perf_event.c >> +++ b/arch/x86/kernel/cpu/perf_event.c >> @@ -1846,6 +1846,12 @@ static const struct attribute_group >> *x86_pmu_attr_groups[] = { >> NULL, >> }; >> >> +static void x86_pmu_sched_task(struct perf_event_context *ctx, bool >> sched_in) >> +{ >> + if (x86_pmu.sched_task) >> + x86_pmu.sched_task(ctx, sched_in); >> +} >> + >> static void x86_pmu_flush_branch_stack(void) >> { >> if (x86_pmu.flush_branch_stack) >> @@ -1879,6 +1885,7 @@ static struct pmu pmu = { >> >> .event_idx = x86_pmu_event_idx, >> .flush_branch_stack = x86_pmu_flush_branch_stack, >> + .sched_task = x86_pmu_sched_task, >> }; >> >> void arch_perf_update_userpage(struct perf_event_mmap_page *userpg, u64 now) >> diff --git a/arch/x86/kernel/cpu/perf_event.h >> b/arch/x86/kernel/cpu/perf_event.h >> index 745f6fb..3fdb751 100644 >> --- a/arch/x86/kernel/cpu/perf_event.h >> +++ b/arch/x86/kernel/cpu/perf_event.h >> @@ -417,6 +417,8 @@ struct x86_pmu { >> >> void(*check_microcode)(void); >> void(*flush_branch_stack)(void); >> + void(*sched_task)(struct perf_event_context *ctx, >> + bool sched_in); >> >> /* >> * Intel Arch Perfmon v2+ >> @@ -675,6 +677,8 @@ void intel_pmu_pebs_disable_all(void); >> >> void intel_ds_init(void); >> >> +void intel_pmu_lbr_sched_task(struct perf_event_context *ctx, bool >> sched_in); >> + > There is no mention of this function anywhere else. Should not be here. > >> void intel_pmu_lbr_reset(void); >> >> void intel_pmu_lbr_enable(struct perf_event *event); >> diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h >> index 8f4a70f..6a3e603 100644 >> --- a/include/linux/perf_event.h >> +++ b/include/linux/perf_event.h >> @@ -251,6 +251,12 @@ struct pmu { >> * flush branch stack on context-switches (needed in cpu-wide mode) >> */ >> void (*flush_branch_stack) (void); >> + >> + /* >> +* PMU callback for context-switches. optional >> +*/ >> + void (*sched_task) (struct perf_event_context *ctx, >> +bool sched_in); >> }; >> >> /** >> @@ -546,6 +552,8 @@ extern void perf_event_delayed_put(struct task_struct >> *task); >> extern void perf_event_print_debug(void); >> extern void perf_pmu_disable(struct pmu *pmu); >> extern void perf_pmu_enable(struct pmu *pmu); >> +extern void perf_sched_cb_disable(struct pmu *pmu); >> +extern void perf_sched_cb_enable(struct pmu *pmu); >> extern int perf_event_task_disable(void); >> extern int perf_event_task_enable(void); >> extern int perf_event_refresh(struct perf_event *event, int refresh); >> diff --git a/kernel/events/core.c b/kernel/events/core.c >> index 89d34f9..d110a23 100644 >> --- a/kernel/events/core.c >> +++ b/kernel/events/core.c >> @@ -141,6 +141,7 @@ enum event_type_t { >> struct static_key_deferred perf_sched_events __read_mostly; >> static DEFINE_PER_CPU(atomic_t, perf_cgroup_events); >> static DEFINE_PER_CPU(atomic_t, perf_branch_stack_events); >> +static DEFINE_PER_CPU(int, perf_sched_cb_usages); >> >> static atomic_t nr_mmap_events __read_mostly; >> static atomic_t nr_comm_events __read_mostly; >> @@ -150,6 +151,7 @@ static atomic_t nr_freq_events __read_mostly; >> static LIST_HEAD(pmus); >> static DEFINE_MUTEX(pmus_lock); >> static struct srcu_struct pmus_srcu; >> +static struct idr pmu_idr; >> >> /* >> * perf event paranoia level: >> @@ -2327,6 +2329,57 @@ unlock: >> } >> } >> >> +void perf_sched_cb_disable(struct pmu *pmu) >> +{ >> + __get_cpu_var(perf_sched_cb_usages)--; >> +} >> + >> +void perf_sched_cb_enable(struct pmu *pmu) >> +{ >> + __get_cpu_var(perf_sched_cb
[PATCH-next] powerpc: delete old PrPMC 280/2800 support
This processor/memory module was mostly used on ATCA blades and before that, on cPCI blades. It wasn't really user friendly, with custom non u-boot bootloaders (powerboot/motload) and no real way to recover corrupted boot flash (which was a common problem). As such, it had its day back before the big ppc --> powerpc move to device trees, and that was largely through commercial BSPs that started to dry up around 2007. Systems using one were largely in a "deploy and sustain" mode, so interest in upgrading to new kernels in the field was nil. Also, requiring 50A, 48V power supplies and a 2'x2'x2' ATCA chassis largely rules out any hobbyist/enthusiast interest. The point of all this, is that we might as well delete the in kernel files relating to this platform. No point in continuing to build it via walking the defconfigs or via linux-next testing. Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: linuxppc-...@lists.ozlabs.org Signed-off-by: Paul Gortmaker --- [The above description is not idle speculation based on 2nd hand info -- I personally suffered with these platforms, and when faced with a chance to take some for free vs. letting them go to e-waste, I happily chose the latter option. So lets get this out early in the 3.15 cycle so any objections have a full window to appear. ] arch/powerpc/boot/Makefile | 5 +- arch/powerpc/configs/prpmc2800_defconfig | 108 - arch/powerpc/platforms/embedded6xx/Kconfig | 8 -- arch/powerpc/platforms/embedded6xx/Makefile| 1 - arch/powerpc/platforms/embedded6xx/prpmc2800.c | 156 - 5 files changed, 2 insertions(+), 276 deletions(-) delete mode 100644 arch/powerpc/configs/prpmc2800_defconfig delete mode 100644 arch/powerpc/platforms/embedded6xx/prpmc2800.c diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index 90e9d9548660..a1f8c7f1ec60 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile @@ -54,7 +54,7 @@ zlib := inffast.c inflate.c inftrees.c zlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h zliblinuxheader := zlib.h zconf.h zutil.h -$(addprefix $(obj)/,$(zlib) cuboot-c2k.o gunzip_util.o main.o prpmc2800.o): \ +$(addprefix $(obj)/,$(zlib) cuboot-c2k.o gunzip_util.o main.o): \ $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c @@ -95,7 +95,7 @@ src-plat-$(CONFIG_FSL_SOC_BOOKE) += cuboot-85xx.c cuboot-85xx-cpm2.c src-plat-$(CONFIG_EMBEDDED6xx) += cuboot-pq2.c cuboot-mpc7448hpc2.c \ cuboot-c2k.c gamecube-head.S \ gamecube.c wii-head.S wii.c holly.c \ - prpmc2800.c fixed-head.S mvme5100.c + fixed-head.S mvme5100.c src-plat-$(CONFIG_AMIGAONE) += cuboot-amigaone.c src-plat-$(CONFIG_PPC_PS3) += ps3-head.S ps3-hvcall.S ps3.c src-plat-$(CONFIG_EPAPR_BOOT) += epapr.c epapr-wrapper.c @@ -204,7 +204,6 @@ image-$(CONFIG_PPC_CHRP)+= zImage.chrp image-$(CONFIG_PPC_EFIKA) += zImage.chrp image-$(CONFIG_PPC_PMAC) += zImage.pmac image-$(CONFIG_PPC_HOLLY) += dtbImage.holly -image-$(CONFIG_PPC_PRPMC2800) += dtbImage.prpmc2800 image-$(CONFIG_DEFAULT_UIMAGE) += uImage image-$(CONFIG_EPAPR_BOOT) += zImage.epapr diff --git a/arch/powerpc/configs/prpmc2800_defconfig b/arch/powerpc/configs/prpmc2800_defconfig deleted file mode 100644 index cd80fb615d34.. --- a/arch/powerpc/configs/prpmc2800_defconfig +++ /dev/null @@ -1,108 +0,0 @@ -CONFIG_ALTIVEC=y -CONFIG_EXPERIMENTAL=y -CONFIG_SYSVIPC=y -CONFIG_POSIX_MQUEUE=y -CONFIG_LOG_BUF_SHIFT=14 -CONFIG_BLK_DEV_INITRD=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -# CONFIG_BLK_DEV_BSG is not set -# CONFIG_IOSCHED_DEADLINE is not set -# CONFIG_IOSCHED_CFQ is not set -# CONFIG_PPC_CHRP is not set -# CONFIG_PPC_PMAC is not set -CONFIG_EMBEDDED6xx=y -CONFIG_PPC_PRPMC2800=y -CONFIG_HIGHMEM=y -CONFIG_NO_HZ=y -CONFIG_HIGH_RES_TIMERS=y -CONFIG_BINFMT_MISC=y -CONFIG_SPARSE_IRQ=y -# CONFIG_SECCOMP is not set -CONFIG_NET=y -CONFIG_PACKET=y -CONFIG_UNIX=y -CONFIG_XFRM_USER=y -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -CONFIG_IP_PNP_BOOTP=y -CONFIG_SYN_COOKIES=y -# CONFIG_IPV6 is not set -CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" -CONFIG_MTD=y -CONFIG_MTD_CONCAT=y -CONFIG_MTD_PARTITIONS=y -CONFIG_MTD_CHAR=y -CONFIG_MTD_BLOCK=y -CONFIG_MTD_CFI=y -CONFIG_MTD_JEDECPROBE=y -CONFIG_MTD_CFI_INTELEXT=y -CONFIG_MTD_PHYSMAP_OF=y -CONFIG_PROC_DEVICETREE=y -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_SIZE=131072 -CONFIG_IDE=y -CONFIG_BLK_DEV_GENERIC=y -CONFIG_BLK_DEV_PDC202XX_NEW=y -CONFIG_BLK_DEV_SD=y -CONFIG_ATA=y -CONFIG_SATA_MV=y -CONFIG_MACINTOSH_DRIVERS=y -CONFIG_NETDEVICES=y -CONFIG_NET_ETHERNET
Re: [PATCH] slub: Do not assert not having lock in removing freed partial
On Wed, 5 Feb 2014, Steven Rostedt wrote: > > We'll want to do something similiar for the add_partial() called from > > early_kmem_cache_node_alloc(), right? It had the added n->list_lock for > > the same reason and is done during early init where nobody else can be > > referencing a kmem_cache_node. > > > > It would probably be better to define these in terms of "partial slabs > > that cannot have anyone else accessing it" rather than "freed slabs". > > Perhaps then we just use the __remove_partial() and __add_partial() > that does not do the checks. That's common practice to use a "__" to > denote that it's special and usually doesn't require locking. > Sounds appropriate. Andrew released a mmotm today so I'm assuming it will be in linux-next tomorrow with my {add,remove}_full() patch but it shouldn't matter if you're going to be playing with {add,remove}_partial(). -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 42/51] hwmon, coretemp: Fix CPU hotplug callback registration
On Wed, Feb 05, 2014 at 04:44:12PM -0800, Guenter Roeck wrote: > On Thu, Feb 06, 2014 at 03:42:06AM +0530, Srivatsa S. Bhat wrote: > > Subsystems that want to register CPU hotplug callbacks, as well as perform > > initialization for the CPUs that are already online, often do it as shown > > below: > > > > get_online_cpus(); > > > > for_each_online_cpu(cpu) > > init_cpu(cpu); > > > > register_cpu_notifier(&foobar_cpu_notifier); > > > > put_online_cpus(); > > > > This is wrong, since it is prone to ABBA deadlocks involving the > > cpu_add_remove_lock and the cpu_hotplug.lock (when running concurrently > > with CPU hotplug operations). > > > > Instead, the correct and race-free way of performing the callback > > registration is: > > > > cpu_maps_update_begin(); > > > > for_each_online_cpu(cpu) > > init_cpu(cpu); > > > > /* Note the use of the double underscored version of the API */ > > __register_cpu_notifier(&foobar_cpu_notifier); > > > > cpu_maps_update_done(); > > > > > > Fix the hwmon coretemp code by using this latter form of callback > > registration. > > > > Cc: Fenghua Yu > > Cc: Jean Delvare > > Cc: Guenter Roeck > > Cc: lm-sens...@lm-sensors.org > > Signed-off-by: Srivatsa S. Bhat > > Applied. > That obviously doesn't build ;-). Replace with Acked-by: Guenter Roeck Guenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 43/51] hwmon, via-cputemp: Fix CPU hotplug callback registration
On Wed, Feb 05, 2014 at 04:44:31PM -0800, Guenter Roeck wrote: > On Thu, Feb 06, 2014 at 03:42:19AM +0530, Srivatsa S. Bhat wrote: > > Subsystems that want to register CPU hotplug callbacks, as well as perform > > initialization for the CPUs that are already online, often do it as shown > > below: > > > > get_online_cpus(); > > > > for_each_online_cpu(cpu) > > init_cpu(cpu); > > > > register_cpu_notifier(&foobar_cpu_notifier); > > > > put_online_cpus(); > > > > This is wrong, since it is prone to ABBA deadlocks involving the > > cpu_add_remove_lock and the cpu_hotplug.lock (when running concurrently > > with CPU hotplug operations). > > > > Instead, the correct and race-free way of performing the callback > > registration is: > > > > cpu_maps_update_begin(); > > > > for_each_online_cpu(cpu) > > init_cpu(cpu); > > > > /* Note the use of the double underscored version of the API */ > > __register_cpu_notifier(&foobar_cpu_notifier); > > > > cpu_maps_update_done(); > > > > > > Fix the hwmon via-cputemp code by using this latter form of callback > > registration. > > > > Cc: Jean Delvare > > Cc: Guenter Roeck > > Cc: lm-sens...@lm-sensors.org > > Signed-off-by: Srivatsa S. Bhat > > Applied. > Same here ... Acked-by: Guenter Roeck -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 44/51] xen, balloon: Fix CPU hotplug callback registration
- srivatsa.b...@linux.vnet.ibm.com wrote: > Subsystems that want to register CPU hotplug callbacks, as well as > perform > initialization for the CPUs that are already online, often do it as > shown > below: > > get_online_cpus(); > > for_each_online_cpu(cpu) > init_cpu(cpu); > > register_cpu_notifier(&foobar_cpu_notifier); > > put_online_cpus(); > > This is wrong, since it is prone to ABBA deadlocks involving the > cpu_add_remove_lock and the cpu_hotplug.lock (when running > concurrently > with CPU hotplug operations). > > Interestingly, the balloon code in xen can actually prevent double > initialization and hence can use the following simplified form of > callback > registration: > > register_cpu_notifier(&foobar_cpu_notifier); > > get_online_cpus(); > > for_each_online_cpu(cpu) > init_cpu(cpu); > > put_online_cpus(); > > A hotplug operation that occurs between registering the notifier and > calling > get_online_cpus(), won't disrupt anything, because the code takes care > to > perform the memory allocations only once. > > So reorganize the balloon code in xen this way to fix the deadlock > with > callback registration. > > Cc: Konrad Rzeszutek Wilk > Cc: Boris Ostrovsky > Cc: David Vrabel > Cc: xen-de...@lists.xenproject.org > Signed-off-by: Srivatsa S. Bhat > --- > > drivers/xen/balloon.c | 35 +++ > 1 file changed, 23 insertions(+), 12 deletions(-) > > diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c > index 37d06ea..afe1a3f 100644 > --- a/drivers/xen/balloon.c > +++ b/drivers/xen/balloon.c > @@ -592,19 +592,29 @@ static void __init balloon_add_region(unsigned > long start_pfn, > } > } > > +static int alloc_balloon_scratch_page(int cpu) > +{ > + if (per_cpu(balloon_scratch_page, cpu) != NULL) > + return 0; > + > + per_cpu(balloon_scratch_page, cpu) = alloc_page(GFP_KERNEL); > + if (per_cpu(balloon_scratch_page, cpu) == NULL) { > + pr_warn("Failed to allocate balloon_scratch_page for cpu %d\n", > cpu); > + return -ENOMEM; > + } > + > + return 0; > +} > + > + > static int balloon_cpu_notify(struct notifier_block *self, > unsigned long action, void *hcpu) > { > int cpu = (long)hcpu; > switch (action) { > case CPU_UP_PREPARE: > - if (per_cpu(balloon_scratch_page, cpu) != NULL) > - break; > - per_cpu(balloon_scratch_page, cpu) = alloc_page(GFP_KERNEL); > - if (per_cpu(balloon_scratch_page, cpu) == NULL) { > - pr_warn("Failed to allocate balloon_scratch_page for > cpu %d\n", > cpu); > + if (alloc_balloon_scratch_page(cpu)) > return NOTIFY_BAD; > - } > break; > default: > break; > @@ -624,15 +634,16 @@ static int __init balloon_init(void) > return -ENODEV; > > if (!xen_feature(XENFEAT_auto_translated_physmap)) { > - for_each_online_cpu(cpu) > - { > - per_cpu(balloon_scratch_page, cpu) = > alloc_page(GFP_KERNEL); > - if (per_cpu(balloon_scratch_page, cpu) == NULL) { > - pr_warn("Failed to allocate > balloon_scratch_page for cpu %d\n", > cpu); > + register_cpu_notifier(&balloon_cpu_notifier); > + > + get_online_cpus(); > + for_each_online_cpu(cpu) { > + if (alloc_balloon_scratch_page(cpu)) { > + put_online_cpus(); > return -ENOMEM; Not that original code was doing a particularly thorough job of cleaning up on allocation failure but if it couldn't get memory it would not register the notifier. So perhaps you should unregister it before returning here. I am also not sure how we were susceptible to the deadlock here since we didn't call get_online_cpus(). (We probably should have but then commit description should say it). -boris > } > } > - register_cpu_notifier(&balloon_cpu_notifier); > + put_online_cpus(); > } > > pr_info("Initialising balloon driver\n"); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch v2] mm, compaction: avoid isolating pinned pages
On Thu, 6 Feb 2014, Joonsoo Kim wrote: > On Wed, Feb 05, 2014 at 12:56:40PM -0800, Hugh Dickins wrote: > > On Tue, 4 Feb 2014, David Rientjes wrote: > > > > > Page migration will fail for memory that is pinned in memory with, for > > > example, get_user_pages(). In this case, it is unnecessary to take > > > zone->lru_lock or isolating the page and passing it to page migration > > > which will ultimately fail. > > > > > > This is a racy check, the page can still change from under us, but in > > > that case we'll just fail later when attempting to move the page. > > > > > > This avoids very expensive memory compaction when faulting transparent > > > hugepages after pinning a lot of memory with a Mellanox driver. > > > > > > On a 128GB machine and pinning ~120GB of memory, before this patch we > > > see the enormous disparity in the number of page migration failures > > > because of the pinning (from /proc/vmstat): > > > > > > compact_pages_moved 8450 > > > compact_pagemigrate_failed 15614415 > > > > > > 0.05% of pages isolated are successfully migrated and explicitly > > > triggering memory compaction takes 102 seconds. After the patch: > > > > > > compact_pages_moved 9197 > > > compact_pagemigrate_failed 7 > > > > > > 99.9% of pages isolated are now successfully migrated in this > > > configuration and memory compaction takes less than one second. > > > > > > Signed-off-by: David Rientjes > > > --- > > > v2: address page count issue per Joonsoo > > > > > > mm/compaction.c | 9 + > > > 1 file changed, 9 insertions(+) > > > > > > diff --git a/mm/compaction.c b/mm/compaction.c > > > --- a/mm/compaction.c > > > +++ b/mm/compaction.c > > > @@ -578,6 +578,15 @@ isolate_migratepages_range(struct zone *zone, struct > > > compact_control *cc, > > > continue; > > > } > > > > > > + /* > > > + * Migration will fail if an anonymous page is pinned in memory, > > > + * so avoid taking lru_lock and isolating it unnecessarily in an > > > + * admittedly racy check. > > > + */ > > > + if (!page_mapping(page) && > > > + page_count(page) > page_mapcount(page)) > > > + continue; > > > + > > > /* Check if it is ok to still hold the lock */ > > > locked = compact_checklock_irqsave(&zone->lru_lock, &flags, > > > > Much better, maybe good enough as an internal patch to fix a particular > > problem you're seeing; but not yet good enough to go upstream. > > > > Anonymous pages are not the only pages which might be pinned, > > and your test doesn't mention PageAnon, so does not match your comment. > > > > I've remembered is_page_cache_freeable() in mm/vmscan.c, which gives > > more assurance that a page_count - page_has_private test is appropriate, > > whatever the filesystem and migrate method to be used. > > > > So I think the test you're looking for is > > > > pincount = page_count(page) - page_mapcount(page); > > if (page_mapping(page)) > > pincount -= 1 + page_has_private(page); > > if (pincount > 0) > > continue; > > > > but please cross-check and test that out, it's easy to be off-by-one etc. > > Hello, Hugh. > > I don't think that this is right. > One of migratepage function, aio_migratepage(), pass extra count 1 to > migrate_page_move_mapping(). So it can be migrated when pincount == 1 in > above test. > > I think that we should not be aggressive here. This is just for prediction > so that it is better not to skip apropriate pages at most. Just for anon case > that we are sure easily is the right solution for me. Interesting, thank you for the pointer. That's a pity! I hope that later on we can modify fs/aio.c to set PagePrivate on ring pages, revert the extra argument to migrate_page_move_mapping(), and then let it appear the same as the other filesystems (but lacking a writepage, reclaim won't try to free the pages). But that's "later on" and may prove impossible in the implementation. I agree it's beyond the scope of David's patch, and so only anonymous should be dealt with in this way at present. And since page_mapping() is non-NULL on PageAnon PageSwapCache pages, those will fall through David's test and go on to try migration: which is the correct default. Although we could add code to handle pinned swapcache, it would be rather an ugly excrescence, until the case gets handled naturally when proper page_mapping() support is added later. Okay, to David's current patch Acked-by: Hugh Dickins though I'd like to hear whether Mel is happy with it. Hugh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RFC PATCH v2 tip 5/7] use BPF in tracing filters
Such filters can be written in C and allow safe read-only access to any kernel data structure. Like systemtap but with safety guaranteed by kernel. The user can do: cat bpf_program > /sys/kernel/debug/tracing/.../filter if tracing event is either static or dynamic via kprobe_events. The program can be anything as long as bpf_check() can verify its safety. For example, the user can create kprobe_event on dst_discard() and use logically following code inside BPF filter: skb = (struct sk_buff *)ctx->arg1; dev = bpf_load_pointer(&skb->dev); to access 'struct net_device' Since its prototype is 'int dst_discard(struct sk_buff *skb);' bpf_load_pointer() will try to fetch 'dev' field of 'sk_buff' structure and will suppress page-fault if pointer is incorrect. Signed-off-by: Alexei Starovoitov --- include/linux/ftrace_event.h |5 + include/trace/bpf_trace.h | 41 include/trace/ftrace.h | 17 kernel/trace/Kconfig |1 + kernel/trace/Makefile |1 + kernel/trace/bpf_trace_callbacks.c | 193 kernel/trace/trace.c |7 ++ kernel/trace/trace.h | 11 +- kernel/trace/trace_events.c|9 +- kernel/trace/trace_events_filter.c | 61 +++- kernel/trace/trace_kprobe.c| 15 ++- 11 files changed, 356 insertions(+), 5 deletions(-) create mode 100644 include/trace/bpf_trace.h create mode 100644 kernel/trace/bpf_trace_callbacks.c diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 4e4cc28..616ae01 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h @@ -204,6 +204,7 @@ enum { TRACE_EVENT_FL_IGNORE_ENABLE_BIT, TRACE_EVENT_FL_WAS_ENABLED_BIT, TRACE_EVENT_FL_USE_CALL_FILTER_BIT, + TRACE_EVENT_FL_BPF_BIT, }; /* @@ -224,6 +225,7 @@ enum { TRACE_EVENT_FL_IGNORE_ENABLE= (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT), TRACE_EVENT_FL_WAS_ENABLED = (1 << TRACE_EVENT_FL_WAS_ENABLED_BIT), TRACE_EVENT_FL_USE_CALL_FILTER = (1 << TRACE_EVENT_FL_USE_CALL_FILTER_BIT), + TRACE_EVENT_FL_BPF = (1 << TRACE_EVENT_FL_BPF_BIT), }; struct ftrace_event_call { @@ -487,6 +489,9 @@ event_trigger_unlock_commit_regs(struct ftrace_event_file *file, event_triggers_post_call(file, tt); } +struct bpf_context; +void filter_call_bpf(struct event_filter *filter, struct bpf_context *ctx); + enum { FILTER_OTHER = 0, FILTER_STATIC_STRING, diff --git a/include/trace/bpf_trace.h b/include/trace/bpf_trace.h new file mode 100644 index 000..3402384 --- /dev/null +++ b/include/trace/bpf_trace.h @@ -0,0 +1,41 @@ +/* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + */ +#ifndef _LINUX_KERNEL_BPF_TRACE_H +#define _LINUX_KERNEL_BPF_TRACE_H + +struct pt_regs; + +struct bpf_context { + long arg1; + long arg2; + long arg3; + long arg4; + long arg5; + struct pt_regs *regs; +}; + +static inline void init_bpf_context(struct bpf_context *ctx, long arg1, + long arg2, long arg3, long arg4, long arg5) +{ + ctx->arg1 = arg1; + ctx->arg2 = arg2; + ctx->arg3 = arg3; + ctx->arg4 = arg4; + ctx->arg5 = arg5; +} +void *bpf_load_pointer(void *unsafe_ptr); +long bpf_memcmp(void *unsafe_ptr, void *safe_ptr, long size); +void bpf_dump_stack(struct bpf_context *ctx); +void bpf_trace_printk(char *fmt, long fmt_size, + long arg1, long arg2, long arg3); +void *bpf_table_lookup(struct bpf_context *ctx, long table_id, const void *key); +long bpf_table_update(struct bpf_context *ctx, long table_id, const void *key, + const void *leaf); + +extern struct bpf_callbacks bpf_trace_cb; + +#endif /* _LINUX_KERNEL_BPF_TRACE_H */ diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index 1a8b28d..2348afd 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h @@ -17,6 +17,8 @@ */ #include +#include +#include /* * DECLARE_EVENT_CLASS can be used to add a generic function @@ -556,6 +558,21 @@ ftrace_raw_event_##call(void *__data, proto) \ if (ftrace_trigger_soft_disabled(ftrace_file)) \ return; \ \ + if (unlikely(ftrace_file->flags & FTRACE_EVENT_FL_FILTERED) && \ + unlikely(ftrace_file->event_call->flags & TRACE_EVENT_FL_BPF)) { \ + struct bpf_context _ctx;\ + struct pt_regs _regs; \
Re: [PATCH 45/51] md, raid5: Fix CPU hotplug callback registration
On Thu, 06 Feb 2014 03:42:45 +0530 "Srivatsa S. Bhat" wrote: > From: Oleg Nesterov > > Subsystems that want to register CPU hotplug callbacks, as well as perform > initialization for the CPUs that are already online, often do it as shown > below: > > get_online_cpus(); > > for_each_online_cpu(cpu) > init_cpu(cpu); > > register_cpu_notifier(&foobar_cpu_notifier); > > put_online_cpus(); > > This is wrong, since it is prone to ABBA deadlocks involving the > cpu_add_remove_lock and the cpu_hotplug.lock (when running concurrently > with CPU hotplug operations). > > Interestingly, the raid5 code can actually prevent double initialization and > hence can use the following simplified form of callback registration: > > register_cpu_notifier(&foobar_cpu_notifier); > > get_online_cpus(); > > for_each_online_cpu(cpu) > init_cpu(cpu); > > put_online_cpus(); > > A hotplug operation that occurs between registering the notifier and calling > get_online_cpus(), won't disrupt anything, because the code takes care to > perform the memory allocations only once. > > So reorganize the code in raid5 this way to fix the deadlock with callback > registration. > > Cc: Neil Brown > Cc: linux-r...@vger.kernel.org > Cc: sta...@vger.kernel.org > [Srivatsa: Fixed the unregister_cpu_notifier() deadlock, added the > free_scratch_buffer() helper to condense code further and wrote the > changelog.] > Signed-off-by: Srivatsa S. Bhat > --- > > drivers/md/raid5.c | 90 > +--- > 1 file changed, 44 insertions(+), 46 deletions(-) > > diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c > index f1feade..16f5c21 100644 > --- a/drivers/md/raid5.c > +++ b/drivers/md/raid5.c > @@ -5514,23 +5514,43 @@ raid5_size(struct mddev *mddev, sector_t sectors, int > raid_disks) > return sectors * (raid_disks - conf->max_degraded); > } > > +static void free_scratch_buffer(struct r5conf *conf, struct raid5_percpu > *percpu) > +{ > + safe_put_page(percpu->spare_page); > + kfree(percpu->scribble); > + percpu->spare_page = NULL; > + percpu->scribble = NULL; > +} > + > +static int alloc_scratch_buffer(struct r5conf *conf, struct raid5_percpu > *percpu) > +{ > + if (conf->level == 6 && !percpu->spare_page) > + percpu->spare_page = alloc_page(GFP_KERNEL); > + if (!percpu->scribble) > + percpu->scribble = kmalloc(conf->scribble_len, GFP_KERNEL); > + > + if (!percpu->scribble || (conf->level == 6 && !percpu->spare_page)) { > + free_scratch_buffer(conf, percpu); > + return -ENOMEM; > + } > + > + return 0; > +} > + > static void raid5_free_percpu(struct r5conf *conf) > { > - struct raid5_percpu *percpu; > unsigned long cpu; > > if (!conf->percpu) > return; > > - get_online_cpus(); > - for_each_possible_cpu(cpu) { > - percpu = per_cpu_ptr(conf->percpu, cpu); > - safe_put_page(percpu->spare_page); > - kfree(percpu->scribble); > - } > #ifdef CONFIG_HOTPLUG_CPU > unregister_cpu_notifier(&conf->cpu_notify); > #endif > + > + get_online_cpus(); > + for_each_possible_cpu(cpu) > + free_scratch_buffer(conf, per_cpu_ptr(conf->percpu, cpu)); > put_online_cpus(); > > free_percpu(conf->percpu); > @@ -5557,15 +5577,7 @@ static int raid456_cpu_notify(struct notifier_block > *nfb, unsigned long action, > switch (action) { > case CPU_UP_PREPARE: > case CPU_UP_PREPARE_FROZEN: > - if (conf->level == 6 && !percpu->spare_page) > - percpu->spare_page = alloc_page(GFP_KERNEL); > - if (!percpu->scribble) > - percpu->scribble = kmalloc(conf->scribble_len, > GFP_KERNEL); > - > - if (!percpu->scribble || > - (conf->level == 6 && !percpu->spare_page)) { > - safe_put_page(percpu->spare_page); > - kfree(percpu->scribble); > + if (alloc_scratch_buffer(conf, percpu)) { > pr_err("%s: failed memory allocation for cpu%ld\n", > __func__, cpu); > return notifier_from_errno(-ENOMEM); > @@ -5573,10 +5585,7 @@ static int raid456_cpu_notify(struct notifier_block > *nfb, unsigned long action, > break; > case CPU_DEAD: > case CPU_DEAD_FROZEN: > - safe_put_page(percpu->spare_page); > - kfree(percpu->scribble); > - percpu->spare_page = NULL; > - percpu->scribble = NULL; > + free_scratch_buffer(conf, per_cpu_ptr(conf->percpu, cpu)); > break; > default: > break; > @@ -5588,40 +5597,29 @@ static int raid456_cpu_notify(struct notifier_block > *nfb, unsigned long action, > static int raid5_alloc_percpu(str
[RFC PATCH v2 tip 1/7] Extended BPF core framework
Extended BPF (or 64-bit BPF) is an instruction set to create safe dynamically loadable filters that can call fixed set of kernel functions and take generic bpf_context as an input. BPF filter is a glue between kernel functions and bpf_context. Different kernel subsystems can define their own set of available functions and alter BPF machinery for specific use case. include/linux/bpf.h - instruction set definition kernel/bpf_jit/bpf_check.c - code safety checker/static analyzer kernel/bpf_jit/bpf_run.c - emulator for archs without BPF64_JIT Extended BPF instruction set is designed for efficient mapping to native instructions on 64-bit CPUs Signed-off-by: Alexei Starovoitov --- include/linux/bpf.h| 149 +++ include/linux/bpf_jit.h| 134 ++ kernel/Makefile|1 + kernel/bpf_jit/Makefile|3 + kernel/bpf_jit/bpf_check.c | 1054 kernel/bpf_jit/bpf_run.c | 511 + lib/Kconfig.debug | 15 + 7 files changed, 1867 insertions(+) create mode 100644 include/linux/bpf.h create mode 100644 include/linux/bpf_jit.h create mode 100644 kernel/bpf_jit/Makefile create mode 100644 kernel/bpf_jit/bpf_check.c create mode 100644 kernel/bpf_jit/bpf_run.c diff --git a/include/linux/bpf.h b/include/linux/bpf.h new file mode 100644 index 000..a4e18e9 --- /dev/null +++ b/include/linux/bpf.h @@ -0,0 +1,149 @@ +/* 64-bit BPF is Copyright (c) 2011-2014, PLUMgrid, http://plumgrid.com */ + +#ifndef __LINUX_BPF_H__ +#define __LINUX_BPF_H__ + +#include + +struct bpf_insn { + __u8code;/* opcode */ + __u8a_reg:4; /* dest register*/ + __u8x_reg:4; /* source register */ + __s16 off; /* signed offset */ + __s32 imm; /* signed immediate constant */ +}; + +struct bpf_table { + __u32 type; + __u32 key_size; + __u32 elem_size; + __u32 max_entries; + __u32 param1; /* meaning is table-dependent */ +}; + +enum bpf_table_type { + BPF_TABLE_HASH = 1, + BPF_TABLE_LPM +}; + +/* maximum number of insns and tables in a BPF program */ +#define MAX_BPF_INSNS 4096 +#define MAX_BPF_TABLES 64 +#define MAX_BPF_STRTAB_SIZE 1024 + +/* pointer to bpf_context is the first and only argument to BPF program + * its definition is use-case specific */ +struct bpf_context; + +/* bpf_add|sub|...: a += x + * bpf_mov: a = x + * bpf_bswap: bswap a */ +#define BPF_INSN_ALU(op, a, x) \ + (struct bpf_insn){BPF_ALU|BPF_OP(op)|BPF_X, a, x, 0, 0} + +/* bpf_add|sub|...: a += imm + * bpf_mov: a = imm */ +#define BPF_INSN_ALU_IMM(op, a, imm) \ + (struct bpf_insn){BPF_ALU|BPF_OP(op)|BPF_K, a, 0, 0, imm} + +/* a = *(uint *) (x + off) */ +#define BPF_INSN_LD(size, a, x, off) \ + (struct bpf_insn){BPF_LDX|BPF_SIZE(size)|BPF_REL, a, x, off, 0} + +/* *(uint *) (a + off) = x */ +#define BPF_INSN_ST(size, a, off, x) \ + (struct bpf_insn){BPF_STX|BPF_SIZE(size)|BPF_REL, a, x, off, 0} + +/* *(uint *) (a + off) = imm */ +#define BPF_INSN_ST_IMM(size, a, off, imm) \ + (struct bpf_insn){BPF_ST|BPF_SIZE(size)|BPF_REL, a, 0, off, imm} + +/* lock *(uint *) (a + off) += x */ +#define BPF_INSN_XADD(size, a, off, x) \ + (struct bpf_insn){BPF_STX|BPF_SIZE(size)|BPF_XADD, a, x, off, 0} + +/* if (a 'op' x) pc += off else fall through */ +#define BPF_INSN_JUMP(op, a, x, off) \ + (struct bpf_insn){BPF_JMP|BPF_OP(op)|BPF_X, a, x, off, 0} + +/* if (a 'op' imm) pc += off else fall through */ +#define BPF_INSN_JUMP_IMM(op, a, imm, off) \ + (struct bpf_insn){BPF_JMP|BPF_OP(op)|BPF_K, a, 0, off, imm} + +#define BPF_INSN_RET() \ + (struct bpf_insn){BPF_RET|BPF_K, 0, 0, 0, 0} + +#define BPF_INSN_CALL(fn_code) \ + (struct bpf_insn){BPF_JMP|BPF_CALL, 0, 0, 0, fn_code} + +/* Instruction classes */ +#define BPF_CLASS(code) ((code) & 0x07) +#define BPF_LD 0x00 +#define BPF_LDX 0x01 +#define BPF_ST 0x02 +#define BPF_STX 0x03 +#define BPF_ALU 0x04 +#define BPF_JMP 0x05 +#define BPF_RET 0x06 + +/* ld/ldx fields */ +#define BPF_SIZE(code) ((code) & 0x18) +#define BPF_W 0x00 +#define BPF_H 0x08 +#define BPF_B 0x10 +#define BPF_DW 0x18 +#define BPF_MODE(code) ((code) & 0xe0) +#define BPF_IMM 0x00 +#define BPF_ABS 0x20 +#define BPF_IND 0x40 +#define BPF_MEM 0x60 +#define BPF_LEN 0x80 +#define BPF_MSH 0xa0 +#define BPF_REL 0xc0 +#define BPF_XADD0xe0 /* exclusive add */ + +/* alu/jmp fields */ +#define BPF_OP(code)((code) & 0xf0) +#define BPF_ADD 0x00 +#define BPF_SUB 0x10 +#define BPF_MUL 0x20 +#define BPF_DIV 0x30 +#define
[RFC PATCH v2 tip 2/7] Extended BPF JIT for x86-64
Just-In-Time compiler that maps 64-bit BPF instructions to x86-64 instructions. Most BPF instructions have one to one mapping. Every BPF register maps to one x86-64 register: R0 -> rax R1 -> rdi R2 -> rsi R3 -> rdx R4 -> rcx R5 -> r8 R6 -> rbx R7 -> r13 R8 -> r14 R9 -> r15 FP -> rbp BPF calling convention is defined as: R0 - return value from in-kernel function R1-R5 - arguments from BPF program to in-kernel function R6-R9 - callee saved registers that in-kernel function will preserve R10 - read-only frame pointer to access stack so BPF calling convention maps directly to x86-64 calling convention. Allowing zero-overhead calls between BPF filter and safe kernel functions Signed-off-by: Alexei Starovoitov --- arch/x86/Kconfig |1 + arch/x86/net/Makefile |1 + arch/x86/net/bpf64_jit_comp.c | 625 + arch/x86/net/bpf_jit_comp.c | 23 +- arch/x86/net/bpf_jit_comp.h | 35 +++ 5 files changed, 665 insertions(+), 20 deletions(-) create mode 100644 arch/x86/net/bpf64_jit_comp.c create mode 100644 arch/x86/net/bpf_jit_comp.h diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index fe55897..ff97d4b 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -94,6 +94,7 @@ config X86 select GENERIC_CLOCKEVENTS_MIN_ADJUST select IRQ_FORCED_THREADING select HAVE_BPF_JIT if X86_64 + select HAVE_BPF64_JIT if X86_64 select HAVE_ARCH_TRANSPARENT_HUGEPAGE select CLKEVT_I8253 select ARCH_HAVE_NMI_SAFE_CMPXCHG diff --git a/arch/x86/net/Makefile b/arch/x86/net/Makefile index 90568c3..c3bb7d5 100644 --- a/arch/x86/net/Makefile +++ b/arch/x86/net/Makefile @@ -2,3 +2,4 @@ # Arch-specific network modules # obj-$(CONFIG_BPF_JIT) += bpf_jit.o bpf_jit_comp.o +obj-$(CONFIG_BPF64_JIT) += bpf64_jit_comp.o diff --git a/arch/x86/net/bpf64_jit_comp.c b/arch/x86/net/bpf64_jit_comp.c new file mode 100644 index 000..5f7c331 --- /dev/null +++ b/arch/x86/net/bpf64_jit_comp.c @@ -0,0 +1,625 @@ +/* + * Copyright (c) 2011-2013 PLUMgrid, http://plumgrid.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + */ +#include +#include +#include +#include +#include +#include "bpf_jit_comp.h" + +static inline u8 *emit_code(u8 *ptr, u32 bytes, unsigned int len) +{ + if (len == 1) + *ptr = bytes; + else if (len == 2) + *(u16 *)ptr = bytes; + else + *(u32 *)ptr = bytes; + return ptr + len; +} + +#define EMIT(bytes, len) (prog = emit_code(prog, (bytes), (len))) + +#define EMIT1(b1) EMIT(b1, 1) +#define EMIT2(b1, b2) EMIT((b1) + ((b2) << 8), 2) +#define EMIT3(b1, b2, b3) EMIT((b1) + ((b2) << 8) + ((b3) << 16), 3) +#define EMIT4(b1, b2, b3, b4) EMIT((b1) + ((b2) << 8) + ((b3) << 16) + \ +((b4) << 24), 4) +/* imm32 is sign extended by cpu */ +#define EMIT1_off32(b1, off) \ + do {EMIT1(b1); EMIT(off, 4); } while (0) +#define EMIT2_off32(b1, b2, off) \ + do {EMIT2(b1, b2); EMIT(off, 4); } while (0) +#define EMIT3_off32(b1, b2, b3, off) \ + do {EMIT3(b1, b2, b3); EMIT(off, 4); } while (0) +#define EMIT4_off32(b1, b2, b3, b4, off) \ + do {EMIT4(b1, b2, b3, b4); EMIT(off, 4); } while (0) + +/* mov A, X */ +#define EMIT_mov(A, X) \ + EMIT3(add_2mod(0x48, A, X), 0x89, add_2reg(0xC0, A, X)) + +#define X86_JAE 0x73 +#define X86_JE 0x74 +#define X86_JNE 0x75 +#define X86_JA 0x77 +#define X86_JGE 0x7D +#define X86_JG 0x7F + +static inline bool is_imm8(__s32 value) +{ + return value <= 127 && value >= -128; +} + +static inline bool is_simm32(__s64 value) +{ + return value == (__s64)(__s32)value; +} + +static int bpf_size_to_x86_bytes(int bpf_size) +{ + if (bpf_size == BPF_W) + return 4; + else if (bpf_size == BPF_H) + return 2; + else if (bpf_size == BPF_B) + return 1; + else if (bpf_size == BPF_DW) + return 4; /* imm32 */ + else + return 0; +} + +#define AUX_REG 32 + +/* avoid x86-64 R12 which if used as base address in memory access + * always needs an extra byte for index */ +static const int reg2hex[] = { + [R0] = 0, /* rax */ + [R1] = 7, /* rdi */ + [R2] = 6, /* rsi */ + [R3] = 2, /* rdx */ + [R4] = 1, /* rcx */ + [R5] = 0, /* r8 */ + [R6] = 3, /* rbx callee saved */ + [R7] = 5, /* r13 callee saved */ + [R8] = 6, /* r14 callee saved */ + [R9] = 7, /* r15 callee saved */ + [__fp__] = 5, /* rbp read
[RFC PATCH v2 tip 4/7] Revert "x86/ptrace: Remove unused regs_get_argument_nth API"
This reverts commit aa5add93e92019018e905146f8c3d3f8e3c08300. Signed-off-by: Alexei Starovoitov --- arch/x86/include/asm/ptrace.h |3 +++ arch/x86/kernel/ptrace.c | 24 2 files changed, 27 insertions(+) diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h index 14fd6fd..e026176 100644 --- a/arch/x86/include/asm/ptrace.h +++ b/arch/x86/include/asm/ptrace.h @@ -222,6 +222,9 @@ static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, return 0; } +/* Get Nth argument at function call */ +unsigned long regs_get_argument_nth(struct pt_regs *regs, unsigned int n); + #define arch_has_single_step() (1) #ifdef CONFIG_X86_DEBUGCTLMSR #define arch_has_block_step() (1) diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index 7461f50..ac1c705 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c @@ -141,6 +141,30 @@ static const int arg_offs_table[] = { #endif }; +/** + * regs_get_argument_nth() - get Nth argument at function call + * @regs: pt_regs which contains registers at function entry. + * @n: argument number. + * + * regs_get_argument_nth() returns @n th argument of a function call. + * Since usually the kernel stack will be changed right after function entry, + * you must use this at function entry. If the @n th entry is NOT in the + * kernel stack or pt_regs, this returns 0. + */ +unsigned long regs_get_argument_nth(struct pt_regs *regs, unsigned int n) +{ + if (n < ARRAY_SIZE(arg_offs_table)) + return *(unsigned long *)((char *)regs + arg_offs_table[n]); + else { + /* +* The typical case: arg n is on the stack. +* (Note: stack[0] = return address, so skip it) +*/ + n -= ARRAY_SIZE(arg_offs_table); + return regs_get_kernel_stack_nth(regs, 1 + n); + } +} + /* * does not yet catch signals sent when the child dies. * in exit.c or in signal.c. -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RFC PATCH v2 tip 3/7] Extended BPF (64-bit BPF) design document
Signed-off-by: Alexei Starovoitov --- Documentation/bpf_jit.txt | 204 + 1 file changed, 204 insertions(+) create mode 100644 Documentation/bpf_jit.txt diff --git a/Documentation/bpf_jit.txt b/Documentation/bpf_jit.txt new file mode 100644 index 000..9c70f42 --- /dev/null +++ b/Documentation/bpf_jit.txt @@ -0,0 +1,204 @@ +Subject: extended BPF or 64-bit BPF + +Q: What is BPF? +A: Safe dynamically loadable 32-bit program that can access skb->data via +sk_load_byte/half/word calls or seccomp_data. Can be attached to sockets, +to netfilter xtables, seccomp. In case of sockets/xtables input is skb. +In case of seccomp input is struct seccomp_data. + +Q: What is extended BPF? +A: Safe dynamically loadable 64-bit program that can call fixed set +of kernel functions and takes generic bpf_context as an input. +BPF program is a glue between kernel functions and bpf_context. +Different kernel subsystems can define their own set of available functions +and alter BPF machinery for specific use case. + +Example 1: +when function set is {bpf_load_byte/half/word} and bpf_context=skb +the extended BPF is equivalent to original BPF (w/o negative offset extensions), +since any such extended BPF program will only be able to load data from skb +and interpret it. + +Example 2: +when function set is {empty} and bpf_context=seccomp_data, +the extended BPF is equivalent to original seccomp BPF with simpler programs +and can immediately take advantage of extended BPF-JIT. +(original BPF-JIT doesn't work for seccomp) + +Example 3: +when function set is {bpf_load_xxx + bpf_table_lookup} and bpf_context=skb +the extended BPF can be used to implement network analytics in tcpdump. +Like counting all tcp flows through the dev or filtering for specific +set of IP addresses. + +Example 4: +when function set is {load_xxx + table_lookup + trace_printk} and +bpf_context=pt_regs, the extended BPF is used to implement systemtap-like +tracing filters + +Extended Instruction Set was designed with these goals: +- write programs in restricted C and compile into BPF with GCC/LLVM +- just-in-time map to modern 64-bit CPU with minimal performance overhead + over two steps: C -> BPF -> native code +- guarantee termination and safety of BPF program in kernel + with simple algorithm + +Writing filters in tcpdump syntax or in systemtap language is difficult. +Same filter done in C is easier to understand. +GCC/LLVM-bpf backend is optional. +Extended BPF can be coded with macroses from bpf.h just like original BPF. + +Minimal performance overhead is achieved by having one to one mapping +between BPF insns and native insns, and one to one mapping between BPF +registers and native registers on 64-bit CPUs + +Extended BPF allows jump forward and backward for two reasons: +to reduce branch mispredict penalty compiler moves cold basic blocks out of +fall-through path and to reduce code duplication that would be unavoidable +if only jump forward was available. +To guarantee termination simple non-recursive depth-first-search verifies +that there are no back-edges (no loops in the program), program is a DAG +with root at the first insn, all branches end at the last RET insn and +all instructions are reachable. +(Original BPF actually allows unreachable insns, but that's a bug) + +Original BPF has two registers (A and X) and hidden frame pointer. +Extended BPF has ten registers and read-only frame pointer. +Since 64-bit CPUs are passing arguments to the functions via registers +the number of args from BPF program to in-kernel function is restricted to 5 +and one register is used to accept return value from in-kernel function. +x86_64 passes first 6 arguments in registers. +aarch64/sparcv9/mips64 have 7-8 registers for arguments. +x86_64 has 6 callee saved registers. +aarch64/sparcv9/mips64 have 11 or more callee saved registers. + +Therefore extended BPF calling convention is defined as: +R0 - return value from in-kernel function +R1-R5 - arguments from BPF program to in-kernel function +R6-R9 - callee saved registers that in-kernel function will preserve +R10 - read-only frame pointer to access stack + +so that all BPF registers map one to one to HW registers on x86_64,aarch64,etc +and BPF calling convention maps directly to ABIs used by kernel on 64-bit +architectures. + +R0-R5 are scratch registers and BPF program needs spill/fill them if necessary +across calls. +Note that there is only one BPF program == one BPF function and it cannot call +other BPF functions. It can only call predefined in-kernel functions. + +All BPF registers are 64-bit without subregs, which makes JITed x86 code +less optimal, but matches sparc/mips architectures. +Adding 32-bit subregs was considered, since JIT can map them to x86 and aarch64 +nicely, but read-modify-write overhead for sparc/mips is not worth the gains. + +Original BPF and extended BPF are two operand instructions, which helps +to do one-to-one mapping between BPF
[RFC PATCH v2 tip 7/7] tracing filter examples in BPF
filter_check/ - userspace correctness checker of BPF filter examples/ - BPF filter examples in C will be compiled by LLVM into .bpf $cd examples $make - compile .c into .bpf $make check - check correctness of *.bpf $make try - to apply netif_rcv.bpf as a tracing filter Signed-off-by: Alexei Starovoitov --- tools/bpf/examples/Makefile | 71 + tools/bpf/examples/README.txt | 59 ++ tools/bpf/examples/dropmon.c| 40 ++ tools/bpf/examples/netif_rcv.c | 34 tools/bpf/filter_check/Makefile | 32 tools/bpf/filter_check/README.txt |3 + tools/bpf/filter_check/trace_filter_check.c | 115 +++ 7 files changed, 354 insertions(+) create mode 100644 tools/bpf/examples/Makefile create mode 100644 tools/bpf/examples/README.txt create mode 100644 tools/bpf/examples/dropmon.c create mode 100644 tools/bpf/examples/netif_rcv.c create mode 100644 tools/bpf/filter_check/Makefile create mode 100644 tools/bpf/filter_check/README.txt create mode 100644 tools/bpf/filter_check/trace_filter_check.c diff --git a/tools/bpf/examples/Makefile b/tools/bpf/examples/Makefile new file mode 100644 index 000..1da6fd5 --- /dev/null +++ b/tools/bpf/examples/Makefile @@ -0,0 +1,71 @@ +KOBJ := $(PWD)/../../.. + +VERSION_FILE := $(KOBJ)/include/generated/uapi/linux/version.h + +ifeq (,$(wildcard $(VERSION_FILE))) + $(error Linux kernel source not configured - missing version.h) +endif + +BLD=$(PWD) +LLC=$(BLD)/../llvm/bld/Debug+Asserts/bin/llc +CHK=$(BLD)/../filter_check/trace_filter_check + +EXTRA_CFLAGS= + +ifeq ($(NESTED),1) +# to get NOSTDINC_FLAGS and LINUXINCLUDE from kernel build +# have to trick top Makefile +# pretend that we're building a module +KBUILD_EXTMOD=$(PWD) +# and include main kernel Makefile +include Makefile + +# cannot have other targets (like all, clean) here +# since they will conflict +%.bpf: %.c + clang $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) \ + -D__KERNEL__ -Wno-unused-value -Wno-pointer-sign \ + -O2 -emit-llvm -c $< -o -| $(LLC) -o $@ + +else + +SRCS := $(notdir $(wildcard *.c)) +BPFS = $(patsubst %.c,$(BLD)/%.bpf,$(SRCS)) + +all: $(LLC) +# invoke make recursively with current Makefile, but +# for specific .bpf targets + $(MAKE) -C $(KOBJ) -f $(BLD)/Makefile NESTED=1 $(BPFS) + +$(LLC): + $(MAKE) -C ../llvm/bld -j4 + +$(CHK): + $(MAKE) -C ../filter_check + +check: $(CHK) + @$(foreach bpf,$(patsubst %.c,%.bpf,$(SRCS)),echo Checking $(bpf) ...;$(CHK) $(bpf);) + +try: + @echo --- BPF filter for static tracepoint net:netif_receive_skb --- + @echo | sudo tee /sys/kernel/debug/tracing/trace > /dev/null + @cat netif_rcv.bpf | sudo tee /sys/kernel/debug/tracing/events/net/netif_receive_skb/filter > /dev/null + @echo 1 | sudo tee /sys/kernel/debug/tracing/events/net/netif_receive_skb/enable > /dev/null + ping -c1 localhost | grep req + sudo cat /sys/kernel/debug/tracing/trace + @echo 0 | sudo tee /sys/kernel/debug/tracing/events/net/netif_receive_skb/enable > /dev/null + @echo 0 | sudo tee /sys/kernel/debug/tracing/events/net/netif_receive_skb/filter > /dev/null + @echo | sudo tee /sys/kernel/debug/tracing/trace + @echo --- BPF filter for dynamic kprobe __netif_receive_skb --- + @echo "p:my __netif_receive_skb" | sudo tee /sys/kernel/debug/tracing/kprobe_events > /dev/null + @cat netif_rcv.bpf | sudo tee /sys/kernel/debug/tracing/events/kprobes/my/filter > /dev/null + @echo 1 | sudo tee /sys/kernel/debug/tracing/events/kprobes/my/enable > /dev/null + ping -c1 localhost | grep req + sudo cat /sys/kernel/debug/tracing/trace + @echo 0 | sudo tee /sys/kernel/debug/tracing/events/kprobes/my/filter > /dev/null + @echo 0 | sudo tee /sys/kernel/debug/tracing/events/kprobes/my/enable > /dev/null + @echo | sudo tee /sys/kernel/debug/tracing/kprobe_events > /dev/null + +clean: + rm -f *.bpf +endif diff --git a/tools/bpf/examples/README.txt b/tools/bpf/examples/README.txt new file mode 100644 index 000..0768ae1 --- /dev/null +++ b/tools/bpf/examples/README.txt @@ -0,0 +1,59 @@ +Tracing filter examples + +netif_rcv: tracing filter example that prints events for loobpack device only + +$ cat netif_rcv.bpf > /sys/kernel/debug/tracing/events/net/netif_receive_skb/filter +$ echo 1 > /sys/kernel/debug/tracing/events/net/netif_receive_skb/enable +$ ping -c1 localhost +$ cat /sys/kernel/debug/tracing/trace +ping-5913 [003] ..s2 3779.285726: __netif_receive_skb_core: skb 880808e3a300 dev 88080bbf8000 +ping-5913 [003] ..s2 3779.285744: __netif_receive_skb_core: skb 880808e3a900 dev 88080bbf8000 + +Alternatively do: + +$make - compile .c into .bpf + +$make check - check correctness of *.bpf + +$make try - to apply netif_rcv.bpf as a trac
[RFC PATCH v2 tip 0/7] 64-bit BPF insn set and tracing filters
Hi All, this patch set addresses main sticking points of the previous discussion: http://thread.gmane.org/gmane.linux.kernel/1605783 Main difference: . all components are now in one place tools/bpf/llvm - standalone LLVM backend for extended BPF instruction set . regs.si, regs.di accessors are replaced with arg1, arg2 . compiler enforces presence of 'license' string in source C code kernel enforces GPL compatibility of BPF program Why bother with it? Current 32-bit BPF is safe, but limited. kernel modules are 'all-goes', but not-safe. Extended 64-bit BPF provides safe and restricted kernel modules. Just like the first two, extended BPF can be used for all sorts of things. Initially for tracing/debugging/[ks]tap-like without vmlinux around, then for networking, security, etc To make exising kernel modules safe the x86 disassembler and code analyzer are needed. We've tried to follow that path. Disassembler was straight forward, but x86 analyzer was becoming unbearably complex due to variety of addressing modes, so we started to hack GCC to reduce output x86 insns and facing the headache of redoing disasm/analyzer for arm and other arhcs. Plus there is old 32-bit bpf insn set already. On one side extended BPF is a 64-bit extension to current BPF. On the other side it's a common subset of x86-64/aarch64/... ISAs: a generic 64-bit insn set that can be JITed to native HW one to one. Tested on x86-64 and i386. BPF core was tested on arm-v7. V2 vs V1 details: 0001-Extended-BPF-core-framework: no difference to instruction set new bpf image format to include license string and enforcement during load 0002-Extended-BPF-JIT-for-x86-64: no changes 0003-Extended-BPF-64-bit-BPF-design-document: no changes 0004-Revert-x86-ptrace-Remove-unused-regs_get_argument: restoring Masami's get_Nth_argument accessor to simplify kprobe filters 0005-use-BPF-in-tracing-filters: minor changes to switch from si/di to argN 0006-LLVM-BPF-backend: standalone BPF backend for LLVM requires: apt-get install llvm-3.2-dev clang compiles in 7 seconds, links with the rest of llvm infra compatible with llvm 3.2, 3.3 and just released 3.4 Written in llvm coding style and llvm license, so it can be upstreamed into llvm tree 0007-tracing-filter-examples-in-BPF: tools/bpf/filter_check: userspace pre-checker of BPF filter runs the same bpf_check() code as kernel does tools/bpf/examples/netif_rcv.c: - #define DESC(NAME) __attribute__((section(NAME), used)) void my_filter(struct bpf_context *ctx) { char devname[4] = "lo"; struct net_device *dev; struct sk_buff *skb = 0; /* * for tracepoints arg1 is the 1st arg of TP_ARGS() macro * defined in include/trace/events/.h * for kprobe events arg1 is the 1st arg of probed function */ skb = (struct sk_buff *)ctx->arg1; dev = bpf_load_pointer(&skb->dev); if (bpf_memcmp(dev->name, devname, 2) == 0) { char fmt[] = "skb %p dev %p \n"; bpf_trace_printk(fmt, sizeof(fmt), (long)skb, (long)dev, 0); } } /* filter code license: */ char license[] DESC("license") = "GPL"; - $cd tools/bpf/examples $make compile it using clang+llvm_bpf $make check check safety $make try attach this filter to net:netif_receive_skb and kprobe __netif_receive_skb and try ping dropmon.c is a demo of faster version of net_dropmonitor: - /* attaches to /sys/kernel/debug/tracing/events/skb/kfree_skb */ void dropmon(struct bpf_context *ctx) { void *loc; uint64_t *drop_cnt; /* * skb:kfree_skb is defined as: * TRACE_EVENT(kfree_skb, * TP_PROTO(struct sk_buff *skb, void *location), * so ctx->arg2 is 'location' */ loc = (void *)ctx->arg2; drop_cnt = bpf_table_lookup(ctx, 0, &loc); if (drop_cnt) { __sync_fetch_and_add(drop_cnt, 1); } else { uint64_t init = 0; bpf_table_update(ctx, 0, &loc, &init); } } struct bpf_table t[] DESC("bpftables") = { {BPF_TABLE_HASH, sizeof(void *), sizeof(uint64_t), 4096, 0} }; /* filter code license: */ char l[] DESC("license") = "GPL v2"; - It's not fully functional yet. Minimal work remaining to implement bpf_table_lookup()/bpf_table_update() in kernel and userspace access to filter's table. This example demonstrates that some interesting events don't have to be always fed into userspace, but can be pre-processed in kernel. tools/perf/scripts/python/net_dropmonitor.py would need to read bpf table from kernel (via debugfs or netlink) and print it in a nice format. Same as in V1 BPF filters are called before tracepoints store the TP_STRUCT fields, since performance advantage is significant. TODO: - complete 'dropmonitor': finish bpf hashtable and userspace access to it - add multi-probe support, so that one C program can specify multiple functions for
linux-next: build failure after merge of the fscache tree
Hi David, After merging the fscache tree, today's linux-next build (x86_64 allmodconfig) failed like this: fs/cachefiles/bind.c: In function 'cachefiles_daemon_unbind': fs/cachefiles/bind.c:361:4: error: too few arguments to function 'vfs_unlink' ret = vfs_unlink(cache->root->d_inode, dentry); ^ In file included from fs/cachefiles/bind.c:18:0: include/linux/fs.h:1458:12: note: declared here extern int vfs_unlink(struct inode *, struct dentry *, struct inode **); ^ Caused by commit ab3d73f3ce3d ("Cachefiles: Add features that make sanity checking easier") from the fscache tree interacting with commit b21996e36c8e ("locks: break delegations on unlink") from Linus' tree (which entered Linus' tree before v3.13-rc1). Does this build for you? I have used the fscache tree from next-20140205 for today. -- Cheers, Stephen Rothwells...@canb.auug.org.au pgpnQjYBJnqT4.pgp Description: PGP signature
Re: [PATCH] slub: Do not assert not having lock in removing freed partial
On Wed, 5 Feb 2014 16:46:43 -0800 (PST) David Rientjes wrote: > > +/* > > + * The difference between remove_partial and remove_freed_partial > > + * is that remove_freed_partial happens only on a a freed slab > > Duplicate "a" there. oops. > > > + * that should not have anyone accessing it, and thus does not > > + * require the n->list_lock. > > + */ > > +static inline void remove_freed_partial(struct kmem_cache_node *n, > > + struct page *page) > > +{ > > + __remove_partial(n, page); > > } > > > > /* > > @@ -3195,7 +3212,7 @@ static void free_partial(struct kmem_cac > > > > list_for_each_entry_safe(page, h, &n->partial, lru) { > > if (!page->inuse) { > > - remove_partial(n, page); > > + remove_freed_partial(n, page); > > discard_slab(s, page); > > } else { > > list_slab_objects(s, page, > > We'll want to do something similiar for the add_partial() called from > early_kmem_cache_node_alloc(), right? It had the added n->list_lock for > the same reason and is done during early init where nobody else can be > referencing a kmem_cache_node. > > It would probably be better to define these in terms of "partial slabs > that cannot have anyone else accessing it" rather than "freed slabs". Perhaps then we just use the __remove_partial() and __add_partial() that does not do the checks. That's common practice to use a "__" to denote that it's special and usually doesn't require locking. -- Steve -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/