Re: [PATCH] dw_dmac: fix typo in Kconfig

2013-03-21 Thread Heiko Carstens
On Thu, Mar 21, 2013 at 01:38:55PM +0200, Andy Shevchenko wrote:
> The commit c30f46bc (drivers/Kconfig: add several missing GENERIC_HARDIRQS
> dependencies) introduced a warning on make defconfig stage.  This patch fixes 
> a
> typo.
> 
> Signed-off-by: Andy Shevchenko 
> ---
>  drivers/dma/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
> index f641f57..23606b4 100644
> --- a/drivers/dma/Kconfig
> +++ b/drivers/dma/Kconfig
> @@ -83,7 +83,7 @@ config INTEL_IOP_ADMA
> 
>  config DW_DMAC
>   tristate "Synopsys DesignWare AHB DMA support"
> - depends on GENERIQ_HARDIRQS
> + depends on GENERIC_HARDIRQS
>   select DMA_ENGINE
>   default y if CPU_AT32AP7000
>   help

Oh, sorry. Will fix this up in the original patch. Thank you!

--
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 07/15] drivers/hid: add missing GENERIC_HARDIRQ dependency

2013-02-06 Thread Heiko Carstens
HID Sensors framework support (CONFIG_HID_SENSOR_HUB) unconditionally
selects MFD_CORE which however depends on GENERIC_HARDIRQS.
So add this dependency to HID_SENSOR_HUB as well.

Cc: Jiri Kosina 
Signed-off-by: Heiko Carstens 
---
 drivers/hid/Kconfig |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 61d2453..9613c81 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -725,7 +725,7 @@ config HID_ZYDACRON
 
 config HID_SENSOR_HUB
tristate "HID Sensors framework support"
-   depends on USB_HID
+   depends on USB_HID && GENERIC_HARDIRQS
select MFD_CORE
default n
-- help---
-- 
1.7.10.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/


[PATCH 11/15] drivers/spi: add missing GENERIC_HARDIRQS dependencies

2013-02-06 Thread Heiko Carstens
The Altera SPI Controller driver and PXA2xx SSP SPI master driver
have calls to devm_request_irq() and request_irq() and therefore
should have a dependency to GENERIC_HARDIRQS.
Otherwise this causes link errors on platforms without
GENERIC_HARDIRQS support.

Cc: Grant Likely 
Signed-off-by: Heiko Carstens 
---
 drivers/spi/Kconfig |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 5c8fda6..5b76212 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -55,6 +55,7 @@ comment "SPI Master Controller Drivers"
 
 config SPI_ALTERA
tristate "Altera SPI Controller"
+   depends on GENERIC_HARDIRQS
select SPI_BITBANG
help
  This is the driver for the Altera SPI Controller.
@@ -299,7 +300,7 @@ config SPI_PPC4xx
 
 config SPI_PXA2XX
tristate "PXA2xx SSP SPI master"
-   depends on ARCH_PXA || PCI
+   depends on (ARCH_PXA || PCI) && GENERIC_HARDIRQS
select PXA_SSP if ARCH_PXA
help
  This enables using a PXA2xx or Sodaville SSP port as a SPI master
-- 
1.7.10.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/


[PATCH 13/15] drivers/usb: add missing GENERIC_HARDIRQS dependencies

2013-02-06 Thread Heiko Carstens
Add a couple of missing GENERIC_HARDIRQS dependencies to fix link
errors like below on s390:

ERROR: "devm_request_threaded_irq" [drivers/usb/gadget/mv_udc.ko] undefined!

Cc: Greg Kroah-Hartman 
Signed-off-by: Heiko Carstens 
---
 drivers/usb/dwc3/Kconfig  |2 +-
 drivers/usb/gadget/Kconfig|3 ++-
 drivers/usb/host/Kconfig  |2 +-
 drivers/usb/musb/Kconfig  |1 +
 drivers/usb/renesas_usbhs/Kconfig |2 +-
 5 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index 77e3f40..68e9a2c 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -1,6 +1,6 @@
 config USB_DWC3
tristate "DesignWare USB3 DRD Core Support"
-   depends on (USB || USB_GADGET)
+   depends on (USB || USB_GADGET) && GENERIC_HARDIRQS
select USB_OTG_UTILS
select USB_XHCI_PLATFORM if USB_SUPPORT && USB_XHCI_HCD
help
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 5e4f879..d3d95de 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -319,6 +319,7 @@ config USB_S3C_HSUDC
 
 config USB_MV_UDC
tristate "Marvell USB2.0 Device Controller"
+   depends on GENERIC_HARDIRQS
help
  Marvell Socs (including PXA and MMP series) include a high speed
  USB2.0 OTG controller, which can be configured as high speed or
@@ -440,7 +441,7 @@ config USB_GOKU
 
 config USB_EG20T
tristate "Intel EG20T PCH/LAPIS Semiconductor IOH(ML7213/ML7831) UDC"
-   depends on PCI
+   depends on PCI && GENERIC_HARDIRQS
help
  This is a USB device driver for EG20T PCH.
  EG20T PCH is the platform controller hub that is used in Intel's
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 3a21c5d..c59a112 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -246,7 +246,7 @@ config USB_EHCI_ATH79
 
 config USB_OXU210HP_HCD
tristate "OXU210HP HCD support"
-   depends on USB
+   depends on USB && GENERIC_HARDIRQS
---help---
  The OXU210HP is an USB host/OTG/device controller. Enable this
  option if your board has this chip. If unsure, say N.
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index de6e5ce..45b19e2 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -46,6 +46,7 @@ config USB_MUSB_DA8XX
 
 config USB_MUSB_TUSB6010
tristate "TUSB6010"
+   depends on GENERIC_HARDIRQS
 
 config USB_MUSB_OMAP2PLUS
tristate "OMAP2430 and onwards"
diff --git a/drivers/usb/renesas_usbhs/Kconfig 
b/drivers/usb/renesas_usbhs/Kconfig
index 6f4afa4..29feb00 100644
--- a/drivers/usb/renesas_usbhs/Kconfig
+++ b/drivers/usb/renesas_usbhs/Kconfig
@@ -4,7 +4,7 @@
 
 config USB_RENESAS_USBHS
tristate 'Renesas USBHS controller'
-   depends on USB && USB_GADGET
+   depends on USB && USB_GADGET && GENERIC_HARDIRQS
default n
help
  Renesas USBHS is a discrete USB host and peripheral controller chip
-- 
1.7.10.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/


[PATCH 15/15] drivers/serial: add GENERIC_HARDIRQS dependency

2013-02-06 Thread Heiko Carstens
Since SERIAL_CORE needs GENERIC_HARDIRQS (see below) and most serial drivers
select it, just add a GENERIC_HARDIRQS dependency to all serial drivers.

Fixes the compile error below:

drivers/tty/serial/serial_core.c: In function ‘uart_set_info’:
drivers/tty/serial/serial_core.c:725:2: error: implicit declaration of function 
‘irq_canonicalize’

Cc: Greg Kroah-Hartman 
Cc: Jiri Slaby 
Signed-off-by: Heiko Carstens 
---
 drivers/tty/serial/Kconfig |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index e9ff3f6..cf9210d 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -5,7 +5,7 @@
 if TTY
 
 menu "Serial drivers"
-   depends on HAS_IOMEM
+   depends on HAS_IOMEM && GENERIC_HARDIRQS
 
 source "drivers/tty/serial/8250/Kconfig"
 
-- 
1.7.10.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/


[PATCH 08/15] drivers/misc/cb710: add missing GENERIC_HARDIRQS dependency

2013-02-06 Thread Heiko Carstens
CB710_CORE (drivers/misc/cb710/core.c) calls devm_request_irq() and
therefore needs a GENERIC_HARDIRQS dependency to prevent a link
error on s390.

Cc: Arnd Bergmann 
Cc: Greg Kroah-Hartman 
Signed-off-by: Heiko Carstens 
---
 drivers/misc/cb710/Kconfig |2 +-
 drivers/mmc/host/Kconfig   |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/cb710/Kconfig b/drivers/misc/cb710/Kconfig
index 22429b8..5acb9c5 100644
--- a/drivers/misc/cb710/Kconfig
+++ b/drivers/misc/cb710/Kconfig
@@ -1,6 +1,6 @@
 config CB710_CORE
tristate "ENE CB710/720 Flash memory card reader support"
-   depends on PCI
+   depends on PCI && GENERIC_HARDIRQS
help
  This option enables support for PCI ENE CB710/720 Flash memory card
  reader found in some laptops (ie. some versions of HP Compaq nx9500).
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index aebe265..d88219e 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -475,7 +475,7 @@ config MMC_SDHI
 
 config MMC_CB710
tristate "ENE CB710 MMC/SD Interface support"
-   depends on PCI
+   depends on PCI && GENERIC_HARDIRQS
select CB710_CORE
help
  This option enables support for MMC/SD part of ENE CB710/720 Flash
-- 
1.7.10.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/


[PATCH 14/15] drivers/power,goldfisch battery: add missing GENERIC_HARDIRQS dependency

2013-02-06 Thread Heiko Carstens
Fix this link error on s390:

ERROR: "devm_request_threaded_irq" [drivers/power/goldfish_battery.ko] 
undefined!

Cc: Anton Vorontsov 
Cc: David Woodhouse 
Signed-off-by: Heiko Carstens 
---
 drivers/power/Kconfig |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index 1e47197..9e00c38 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -348,6 +348,7 @@ config AB8500_BM
 
 config BATTERY_GOLDFISH
tristate "Goldfish battery driver"
+   depends on GENERIC_HARDIRQS
help
  Say Y to enable support for the battery and AC power in the
  Goldfish emulator.
-- 
1.7.10.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/


[PATCH 10/15] drivers/net,AT91RM9200: add missing GENERIC_HARDIRQS dependency

2013-02-06 Thread Heiko Carstens
The AT91RM9200 driver call devm_request_irq() and therefore should
depend on GENERIC_HARDIRQS to prevent link/compile errors on plaforms
without GENERIC_HARDIRQS.

Cc: "David S. Miller" 
Signed-off-by: Heiko Carstens 
---
 drivers/net/ethernet/cadence/Kconfig |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/cadence/Kconfig 
b/drivers/net/ethernet/cadence/Kconfig
index ceb0de0..1194446 100644
--- a/drivers/net/ethernet/cadence/Kconfig
+++ b/drivers/net/ethernet/cadence/Kconfig
@@ -22,6 +22,7 @@ if NET_CADENCE
 
 config ARM_AT91_ETHER
tristate "AT91RM9200 Ethernet support"
+   depends on GENERIC_HARDIRQS
select NET_CORE
select MACB
---help---
-- 
1.7.10.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/


[PATCH 12/15] sound: add missing HAS_IOPORT and GENERIC_HARDIRQS dependencies

2013-02-06 Thread Heiko Carstens
Fix these two compile errors on s390 which does not have HAS_IOPORT
nor GENERIC_HARDIRQS:

sound/pci/lx6464es/lx6464es.c: In function ‘snd_lx6464es_free’:
sound/pci/lx6464es/lx6464es.c:565:2: error: implicit declaration of function 
‘ioport_unmap’

sound/soc/codecs/wm8903.c: In function ‘wm8903_set_pdata_irq_trigger’:
sound/soc/codecs/wm8903.c:1954:9: error: implicit declaration of function 
‘irq_get_irq_data’

Cc: Jaroslav Kysela 
Cc: Takashi Iwai 
Signed-off-by: Heiko Carstens 
---
 sound/pci/Kconfig|1 +
 sound/soc/codecs/Kconfig |2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
index 947cfb4..fe6fa93 100644
--- a/sound/pci/Kconfig
+++ b/sound/pci/Kconfig
@@ -678,6 +678,7 @@ config SND_LOLA
 
 config SND_LX6464ES
tristate "Digigram LX6464ES"
+   depends on HAS_IOPORT
select SND_PCM
help
  Say Y here to include support for Digigram LX6464ES boards.
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 298822c..65e3c6a 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -98,7 +98,7 @@ config SND_SOC_ALL_CODECS
select SND_SOC_WM8782
select SND_SOC_WM8804 if SND_SOC_I2C_AND_SPI
select SND_SOC_WM8900 if I2C
-   select SND_SOC_WM8903 if I2C
+   select SND_SOC_WM8903 if I2C && GENERIC_HARDIRQS
select SND_SOC_WM8904 if I2C
select SND_SOC_WM8940 if I2C
select SND_SOC_WM8955 if I2C
-- 
1.7.10.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/


[PATCH 06/15] drivers/gpio: add missing GENERIC_HARDIRQ dependency

2013-02-06 Thread Heiko Carstens
The VIA VX855/VX875 GPIO and RDC R-321x GPIO support drivers select
MFD_CORE which itself depends on GENERIC_HARDIRQ support.
So add this dependency to these two drivers as well to prevent
selection of MFD_CORE.

Cc: Grant Likely 
Cc: Samuel Ortiz 
Signed-off-by: Heiko Carstens 
---
 drivers/gpio/Kconfig |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 8eafc4b..93aaadf 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -280,7 +280,7 @@ config GPIO_ICH
 
 config GPIO_VX855
tristate "VIA VX855/VX875 GPIO"
-   depends on PCI
+   depends on PCI && GENERIC_HARDIRQS
select MFD_CORE
select MFD_VX855
help
@@ -610,7 +610,7 @@ config GPIO_TIMBERDALE
 
 config GPIO_RDC321X
tristate "RDC R-321x GPIO support"
-   depends on PCI
+   depends on PCI && GENERIC_HARDIRQS
select MFD_CORE
select MFD_RDC321X
help
-- 
1.7.10.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/


[PATCH 03/15] drivers/mfd: add missing GENERIC_HARDIRQS dependecies

2013-02-06 Thread Heiko Carstens
A lot of mfd drivers select MFD_CORE which however depends on
GENERIC_HARDIRQS support.
So add the missing dependency to all drivers to get rid of
this link error:

ERROR: "irq_create_mapping" [drivers/mfd/mfd-core.ko] undefined!

Cc: Samuel Ortiz 
Signed-off-by: Heiko Carstens 
---
 drivers/mfd/Kconfig |   72 +++
 1 file changed, 38 insertions(+), 34 deletions(-)

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index ff553ba..671f5b1 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -65,7 +65,7 @@ config MFD_SM501_GPIO
 
 config MFD_RTSX_PCI
tristate "Support for Realtek PCI-E card reader"
-   depends on PCI
+   depends on PCI && GENERIC_HARDIRQS
select MFD_CORE
help
  This supports for Realtek PCI-Express card reader including rts5209,
@@ -95,7 +95,7 @@ config MFD_DM355EVM_MSP
 
 config MFD_TI_SSP
tristate "TI Sequencer Serial Port support"
-   depends on ARCH_DAVINCI_TNETV107X
+   depends on ARCH_DAVINCI_TNETV107X && GENERIC_HARDIRQS
select MFD_CORE
---help---
  Say Y here if you want support for the Sequencer Serial Port
@@ -109,6 +109,7 @@ config MFD_TI_AM335X_TSCADC
select MFD_CORE
select REGMAP
select REGMAP_MMIO
+   depends on GENERIC_HARDIRQS
help
  If you say yes here you get support for Texas Instruments series
  of Touch Screen /ADC chips.
@@ -126,6 +127,7 @@ config HTC_EGPIO
 config HTC_PASIC3
tristate "HTC PASIC3 LED/DS1WM chip support"
select MFD_CORE
+   depends on GENERIC_HARDIRQS
help
  This core driver provides register access for the LED/DS1WM
  chips labeled "AIC2" and "AIC3", found on HTC Blueangel and
@@ -157,6 +159,7 @@ config MFD_LM3533
depends on I2C
select MFD_CORE
select REGMAP_I2C
+   depends on GENERIC_HARDIRQS
help
  Say yes here to enable support for National Semiconductor / TI
  LM3533 Lighting Power chips.
@@ -171,6 +174,7 @@ config TPS6105X
select REGULATOR
select MFD_CORE
select REGULATOR_FIXED_VOLTAGE
+   depends on GENERIC_HARDIRQS
help
  This option enables a driver for the TP61050/TPS61052
  high-power "white LED driver". This boost converter is
@@ -193,7 +197,7 @@ config TPS65010
 config TPS6507X
tristate "TPS6507x Power Management / Touch Screen chips"
select MFD_CORE
-   depends on I2C
+   depends on I2C && GENERIC_HARDIRQS
help
  If you say yes here you get support for the TPS6507x series of
  Power Management / Touch Screen chips.  These include voltage
@@ -204,7 +208,7 @@ config TPS6507X
 
 config MFD_TPS65217
tristate "TPS65217 Power Management / White LED chips"
-   depends on I2C
+   depends on I2C && GENERIC_HARDIRQS
select MFD_CORE
select REGMAP_I2C
help
@@ -234,7 +238,7 @@ config MFD_TPS6586X
 
 config MFD_TPS65910
bool "TPS65910 Power Management chip"
-   depends on I2C=y && GPIOLIB
+   depends on I2C=y && GPIOLIB && GENERIC_HARDIRQS
select MFD_CORE
select REGMAP_I2C
select REGMAP_IRQ
@@ -251,7 +255,7 @@ config MFD_TPS65912_I2C
bool "TPS65912 Power Management chip with I2C"
select MFD_CORE
select MFD_TPS65912
-   depends on I2C=y && GPIOLIB
+   depends on I2C=y && GPIOLIB && GENERIC_HARDIRQS
help
  If you say yes here you get support for the TPS65912 series of
  PM chips with I2C interface.
@@ -260,7 +264,7 @@ config MFD_TPS65912_SPI
bool "TPS65912 Power Management chip with SPI"
select MFD_CORE
select MFD_TPS65912
-   depends on SPI_MASTER && GPIOLIB
+   depends on SPI_MASTER && GPIOLIB && GENERIC_HARDIRQS
help
  If you say yes here you get support for the TPS65912 series of
  PM chips with SPI interface.
@@ -330,13 +334,13 @@ config TWL4030_POWER
 
 config MFD_TWL4030_AUDIO
bool
-   depends on TWL4030_CORE
+   depends on TWL4030_CORE && GENERIC_HARDIRQS
select MFD_CORE
default n
 
 config TWL6040_CORE
bool "Support for TWL6040 audio codec"
-   depends on I2C=y
+   depends on I2C=y && GENERIC_HARDIRQS
select MFD_CORE
select REGMAP_I2C
select REGMAP_IRQ
@@ -405,7 +409,7 @@ config MFD_TMIO
 
 config MFD_T7L66XB
bool "Support Toshiba T7L66XB"
-   depends on ARM && HAVE_CLK
+   depends on ARM && HAVE_CLK && GENERIC_HARDIRQS
select MFD_CORE
select MFD_TMIO
help
@@ -413,7 +417,7 @@ config MFD_

[PATCH 09/15] drivers/media: add missing GENERIC_HARDIRQS dependencies

2013-02-06 Thread Heiko Carstens
The SuperH VEU mem2mem video processing driver (VIDEO_SH_VEU)
calls devm_request_threaded_irq() and therefore should depend
on GENERIC_HARDIRQS.
Texas Instruments WL1273 I2C FM Radio (RADIO_WL1273) selects
MFD_CORE, which itself depends on GENERIC_HARDIRQS.
So add the dependency to the TI driver as well.

Cc: Mauro Carvalho Chehab 
Signed-off-by: Heiko Carstens 
---
 drivers/media/platform/Kconfig |2 +-
 drivers/media/radio/Kconfig|2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 05d7b63..a0639e7 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -204,7 +204,7 @@ config VIDEO_SAMSUNG_EXYNOS_GSC
 
 config VIDEO_SH_VEU
tristate "SuperH VEU mem2mem video processing driver"
-   depends on VIDEO_DEV && VIDEO_V4L2
+   depends on VIDEO_DEV && VIDEO_V4L2 && GENERIC_HARDIRQS
select VIDEOBUF2_DMA_CONTIG
select V4L2_MEM2MEM_DEV
help
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
index ead9928..24e64a0 100644
--- a/drivers/media/radio/Kconfig
+++ b/drivers/media/radio/Kconfig
@@ -192,7 +192,7 @@ config RADIO_TIMBERDALE
 
 config RADIO_WL1273
tristate "Texas Instruments WL1273 I2C FM Radio"
-   depends on I2C && VIDEO_V4L2
+   depends on I2C && VIDEO_V4L2 && GENERIC_HARDIRQS
select MFD_CORE
select MFD_WL1273_CORE
select FW_LOADER
-- 
1.7.10.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/


[PATCH 00/15] Add various missing GENERIC_HARDIRQS dependencies

2013-02-06 Thread Heiko Carstens
Hi all,

this patch set just adds various missing GENERIC_HARDIRQS to a couple of
Kconfig files in order to make an s390 allmodconfig/alldefconfig compile
again.
This is necessary since during the last merge window s390 got CONFIG_PCI
and with that also CONFIG_HAS_DMA and CONFIG_HAS_IOMEM. These new config
options enable lots and lots of new drivers for s390, which however does
not support GENERIC_HARDIRQS.
Therefore a couple of drivers do not compile. To fix this, just add the
missing dependency (instead of sprinkling a !S390 dependency across the
whole tree).

The patches below are all against linux-next as of today.

If the you as the maintainers would take the patches that would be great.
Or please let me know if any patch should go in via the s390 tree.

Thanks!

Heiko Carstens (15):
  drivers/input: add couple of missing GENERIC_HARDIRQS dependencies
  drivers/i2c: remove !S390 dependency, add missing GENERIC_HARDIRQS 
dependencies
  drivers/mfd: add missing GENERIC_HARDIRQS dependecies
  drivers/block/mtip32xx: add missing GENERIC_HARDIRQS dependency
  drivers/dma/dw_dmac: add missing GENERIC_HARDIRQS dependency
  drivers/gpio: add missing GENERIC_HARDIRQ dependency
  drivers/hid: add missing GENERIC_HARDIRQ dependency
  drivers/misc/cb710: add missing GENERIC_HARDIRQS dependency
  drivers/media: add missing GENERIC_HARDIRQS dependencies
  drivers/net,AT91RM9200: add missing GENERIC_HARDIRQS dependency
  drivers/spi: add missing GENERIC_HARDIRQS dependencies
  sound: add missing HAS_IOPORT and GENERIC_HARDIRQS dependencies
  drivers/usb: add missing GENERIC_HARDIRQS dependencies
  drivers/power,goldfisch battery: add missing GENERIC_HARDIRQS dependency
  drivers/serial: add GENERIC_HARDIRQS dependency

 drivers/block/mtip32xx/Kconfig   |2 +-
 drivers/dma/Kconfig  |1 +
 drivers/gpio/Kconfig |4 +-
 drivers/hid/Kconfig  |2 +-
 drivers/i2c/Kconfig  |2 +-
 drivers/i2c/busses/Kconfig   |6 ++-
 drivers/input/Kconfig|2 +-
 drivers/input/keyboard/Kconfig   |4 +-
 drivers/input/serio/Kconfig  |1 +
 drivers/input/touchscreen/Kconfig|2 +-
 drivers/media/platform/Kconfig   |2 +-
 drivers/media/radio/Kconfig  |2 +-
 drivers/mfd/Kconfig  |   72 ++
 drivers/misc/cb710/Kconfig   |2 +-
 drivers/mmc/host/Kconfig |2 +-
 drivers/net/ethernet/cadence/Kconfig |1 +
 drivers/power/Kconfig|1 +
 drivers/spi/Kconfig  |3 +-
 drivers/tty/serial/Kconfig   |2 +-
 drivers/usb/dwc3/Kconfig |2 +-
 drivers/usb/gadget/Kconfig   |3 +-
 drivers/usb/host/Kconfig |2 +-
 drivers/usb/musb/Kconfig |1 +
 drivers/usb/renesas_usbhs/Kconfig|2 +-
 sound/pci/Kconfig|1 +
 sound/soc/codecs/Kconfig |2 +-
 26 files changed, 70 insertions(+), 56 deletions(-)

-- 
1.7.10.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/


[PATCH 05/15] drivers/dma/dw_dmac: add missing GENERIC_HARDIRQS dependency

2013-02-06 Thread Heiko Carstens
Synopsys DesignWare AHB DMA drivers calls devm_request_irq() and
therefore depends on GENERIC_HARDIRQS.
Add the missing dependency.

Cc: Vinod Koul 
Signed-off-by: Heiko Carstens 
---
 drivers/dma/Kconfig |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 3600234..26d3127 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -83,6 +83,7 @@ config INTEL_IOP_ADMA
 
 config DW_DMAC
tristate "Synopsys DesignWare AHB DMA support"
+   depends on GENERIC_HARDIRQS
select DMA_ENGINE
default y if CPU_AT32AP7000
help
-- 
1.7.10.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/


[PATCH 01/15] drivers/input: add couple of missing GENERIC_HARDIRQS dependencies

2013-02-06 Thread Heiko Carstens
When removing the !S390 dependency from drivers/input/Kconfig a couple
of drivers don't compile because they have a dependency on GENERIC_HARDIRQS.
So add the missing dependencies.
Fixes e.g. this one:

drivers/input/keyboard/lm8323.c: In function ‘lm8323_suspend’:
drivers/input/keyboard/lm8323.c:801:2: error: implicit declaration of function 
‘irq_set_irq_wake’
[-Werror=implicit-function-declaration]

Cc: Dmitry Torokhov 
Signed-off-by: Heiko Carstens 
---
 drivers/input/Kconfig |2 +-
 drivers/input/keyboard/Kconfig|4 ++--
 drivers/input/serio/Kconfig   |1 +
 drivers/input/touchscreen/Kconfig |2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig
index 55f7e57..38b523a 100644
--- a/drivers/input/Kconfig
+++ b/drivers/input/Kconfig
@@ -3,7 +3,7 @@
 #
 
 menu "Input device support"
-   depends on !S390 && !UML
+   depends on !UML
 
 config INPUT
tristate "Generic input layer (needed for keyboard, mouse, ...)" if 
EXPERT
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 502ed23..6a65da2 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -226,7 +226,7 @@ config KEYBOARD_TCA6416
 
 config KEYBOARD_TCA8418
tristate "TCA8418 Keypad Support"
-   depends on I2C
+   depends on I2C && GENERIC_HARDIRQS
select INPUT_MATRIXKMAP
help
  This driver implements basic keypad functionality
@@ -305,7 +305,7 @@ config KEYBOARD_HP7XX
 
 config KEYBOARD_LM8323
tristate "LM8323 keypad chip"
-   depends on I2C
+   depends on I2C && GENERIC_HARDIRQS
depends on LEDS_CLASS
help
  If you say yes here you get support for the National Semiconductor
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
index 81ee755..d2138bf 100644
--- a/drivers/input/serio/Kconfig
+++ b/drivers/input/serio/Kconfig
@@ -237,6 +237,7 @@ config SERIO_PS2MULT
 
 config SERIO_ARC_PS2
tristate "ARC PS/2 support"
+   depends on GENERIC_HARDIRQS
help
  Say Y here if you have an ARC FPGA platform with a PS/2
  controller in it.
diff --git a/drivers/input/touchscreen/Kconfig 
b/drivers/input/touchscreen/Kconfig
index 3d6f548..59877b7 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -368,7 +368,7 @@ config TOUCHSCREEN_MCS5000
 
 config TOUCHSCREEN_MMS114
tristate "MELFAS MMS114 touchscreen"
-   depends on I2C
+   depends on I2C && GENERIC_HARDIRQS
help
  Say Y here if you have the MELFAS MMS114 touchscreen controller
  chip in your system.
-- 
1.7.10.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/


[PATCH 04/15] drivers/block/mtip32xx: add missing GENERIC_HARDIRQS dependency

2013-02-06 Thread Heiko Carstens
The MTIP32XX driver calls devm_request_irq() and therefore needs a
GENERIC_HARDIRQS dependency to prevent building it on s390.

Cc: Jens Axboe 
Signed-off-by: Heiko Carstens 
---
 drivers/block/mtip32xx/Kconfig |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/mtip32xx/Kconfig b/drivers/block/mtip32xx/Kconfig
index 0ba837f..1fca1f99 100644
--- a/drivers/block/mtip32xx/Kconfig
+++ b/drivers/block/mtip32xx/Kconfig
@@ -4,6 +4,6 @@
 
 config BLK_DEV_PCIESSD_MTIP32XX
tristate "Block Device Driver for Micron PCIe SSDs"
-   depends on PCI
+   depends on PCI && GENERIC_HARDIRQS
help
   This enables the block driver for Micron PCIe SSDs.
-- 
1.7.10.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/


[PATCH 02/15] drivers/i2c: remove !S390 dependency, add missing GENERIC_HARDIRQS dependencies

2013-02-06 Thread Heiko Carstens
Remove !S390 dependency from i2c Kconfig, since s390 now supports PCI, HAS_IOMEM
and HAS_DMA, however we need to add a couple of GENERIC_HARDIRQS dependecies to
fix compile and link errors like these:

ERROR: "devm_request_threaded_irq" [drivers/i2c/i2c-smbus.ko] undefined!
ERROR: "devm_request_threaded_irq" [drivers/i2c/busses/i2c-ocores.ko] undefined!

Cc: Wolfram Sang 
Cc: Jean Delvare 
Signed-off-by: Heiko Carstens 
---
 drivers/i2c/Kconfig|2 +-
 drivers/i2c/busses/Kconfig |6 --
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
index 46cde09..e380c6e 100644
--- a/drivers/i2c/Kconfig
+++ b/drivers/i2c/Kconfig
@@ -4,7 +4,6 @@
 
 menuconfig I2C
tristate "I2C support"
-   depends on !S390
select RT_MUTEXES
---help---
  I2C (pronounce: I-squared-C) is a slow serial bus protocol used in
@@ -76,6 +75,7 @@ config I2C_HELPER_AUTO
 
 config I2C_SMBUS
tristate "SMBus-specific protocols" if !I2C_HELPER_AUTO
+   depends on GENERIC_HARDIRQS
help
  Say Y here if you want support for SMBus extensions to the I2C
  specification. At the moment, the only supported extension is
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 8bb810e..fd30505 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -112,7 +112,7 @@ config I2C_I801
 
 config I2C_ISCH
tristate "Intel SCH SMBus 1.0"
-   depends on PCI
+   depends on PCI && GENERIC_HARDIRQS
select LPC_SCH
help
  Say Y here if you want to use SMBus controller on the Intel SCH
@@ -519,6 +519,7 @@ config I2C_NUC900
 
 config I2C_OCORES
tristate "OpenCores I2C Controller"
+   depends on GENERIC_HARDIRQS
help
  If you say yes to this option, support will be included for the
  OpenCores I2C controller. For details see
@@ -753,7 +754,7 @@ config I2C_DIOLAN_U2C
 
 config I2C_PARPORT
tristate "Parallel port adapter"
-   depends on PARPORT
+   depends on PARPORT && GENERIC_HARDIRQS
select I2C_ALGOBIT
select I2C_SMBUS
help
@@ -778,6 +779,7 @@ config I2C_PARPORT
 
 config I2C_PARPORT_LIGHT
tristate "Parallel port adapter (light)"
+   depends on GENERIC_HARDIRQS
select I2C_ALGOBIT
select I2C_SMBUS
help
-- 
1.7.10.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 12/15] sound: add missing HAS_IOPORT and GENERIC_HARDIRQS dependencies

2013-02-06 Thread Heiko Carstens
On Wed, Feb 06, 2013 at 06:26:02PM +0100, Takashi Iwai wrote:
> At Thu, 07 Feb 2013 02:13:19 +0100,
> Arnd Bergmann wrote:
> > On Wednesday 06 February 2013 18:05:14 Takashi Iwai wrote:
> > > At Wed,  6 Feb 2013 17:24:00 +0100,
> > > Heiko Carstens wrote:
> > > #if defined(CONFIG_HAS_IOPORT) && defined(CONFIG_GENERIC_IOMAP)
> > > extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
> > > extern void ioport_unmap(void __iomem *p);
> > > #else
> > > static inline void __iomem *ioport_map(unsigned long port, unsigned int 
> > > nr)
> > > {
> > >   return (void __iomem *) port;
> > > }
> > > 
> > > static inline void ioport_unmap(void __iomem *p)
> > > {
> > > }
> > > #endif /* CONFIG_HAS_IOPORT */
> > 
> > No, it is intentional that the CONFIG_HAS_IOPORT symbol refers to
> > the fact that you can use the ioport_map function, in order to
> > disallow building drivers that depend on this function when it
> > is unavailable. I actually want to change this, but in the opposite
> > way of what you are proposing:
> > 
> > I think CONFIG_HAS_IOPORT should refer to the fact that the
> > inb/outb family of functions are usuable and be unset when
> > they are not provided, and I would introduce a new
> > CONFIG_HAS_IOPORT_MAP symbol for those (few) platforms that
> > have a working inb/outb but no ioport_map.
> 
> Yet another Kconfig, but sounds reasonable :)

Right... I just wanted to make s390 compile with the Kconfig methods we use
since nearly a decade and not change the world ;)

> > > > sound/soc/codecs/wm8903.c: In function ‘wm8903_set_pdata_irq_trigger’:
> > > > sound/soc/codecs/wm8903.c:1954:9: error: implicit declaration of 
> > > > function ‘irq_get_irq_data’
> > > 
> > > Ditto, how about defining
> > > 
> > > #ifndef CONFIG_GENERIC_HARDIRQS
> > > #define irq_get_irq_data(x)  NULL
> > > #endif
> > > 
> > > somewhere appropriately?
> > > 
> > 
> > Why not just make CONFIG_GENERIC_HARDIRQS mandatory for all
> > platforms. It is use almost everywhere now.
> 
> I wonder it, too...

I haven't looked into it, but I doubt if that is possible without large
effort, if at all. s390 doesn't have any irq chips, nor something like
edge or level triggered irqs.
Instead we have floating interrupts. Does that fit into the concept of
GENERIC_HARDIRQS at all?
If so, we can give it a try, sure. But that won't happen any time soon.

Or are you simply proposing we should have both, our own irq handling plus
GENERIC_HARDIRQS with dummy functions?

--
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: linux-next: manual merge of the signal tree with the s390 tree

2013-02-07 Thread Heiko Carstens
On Thu, Feb 07, 2013 at 04:22:05PM +1100, Stephen Rothwell wrote:
> Hi Al,
> 
> Today's linux-next merge of the signal tree got a conflict in
> arch/s390/Kconfig between commit ad2c429560fc ("s390/Kconfig: sort list
> of arch selected config options") from the s390 tree and commits
> e181ee4cd7e5 ("s390: switch to generic old sigsuspend") and 7eddd99c289a
> ("s390: switch to generic old sigaction()") from the signal tree.
> 
> I fixed it up (see below) and can carry the fix as necessary (no action
> is required).

Thanks Stephen. I hope in the long term sorting the config options pays
off, since seeing merge conflicts like this is exactly what I wanted
to avoid.. :)

--
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 12/15] sound: add missing HAS_IOPORT and GENERIC_HARDIRQS dependencies

2013-02-07 Thread Heiko Carstens
On Wed, Feb 06, 2013 at 09:56:55PM +, Arnd Bergmann wrote:
> On Wednesday 06 February 2013, Heiko Carstens wrote:
> > On Wed, Feb 06, 2013 at 06:26:02PM +0100, Takashi Iwai wrote:
> > > At Thu, 07 Feb 2013 02:13:19 +0100,
> > > Arnd Bergmann wrote:
> > > > Why not just make CONFIG_GENERIC_HARDIRQS mandatory for all
> > > > platforms. It is use almost everywhere now.
> > > 
> > > I wonder it, too...
> > 
> > I haven't looked into it, but I doubt if that is possible without large
> > effort, if at all. s390 doesn't have any irq chips, nor something like
> > edge or level triggered irqs.
> > Instead we have floating interrupts. Does that fit into the concept of
> > GENERIC_HARDIRQS at all?
> > If so, we can give it a try, sure. But that won't happen any time soon.
> > 
> > Or are you simply proposing we should have both, our own irq handling plus
> > GENERIC_HARDIRQS with dummy functions?
> 
> I think you should use GENERIC_HARDIRQ just for PCI, and rename the s390
> interrupt handling to something that does not conflict. I understand
> that the concepts are quite different, but with PCI support, you actually
> do get all the weird interrupt hardware.
> More importantly, some features provided by GENERIC_HARDIRQ are replacing
> the traditional interfaces now, e.g. devm_request_irq() is actually
> recommended over request_irq() for normal drivers these days, as it
> simplifies the error handling.

That sounds reasonable. And a quick grep seems to indicate that s390
is the last architecture with !GENERIC_HARDIRQS.
However having two completely different IRQ subsystems within one
architecture will bring up some interesting questions like e.g.
how should /proc/interrupts look like? Or /proc/stat:intr ?

Jan considered turning GENERIC_HARDIRQS on for PCI support, but didn't.
I don't know why he didn't and since he left, we can't ask him anymore.

So for the time being I'd appreciate it if we can simply add the
additional GENERIC_HARDIRQS dependencies where needed, since I consider
a working allmodconfig quite important.
Later on we should indeed try to switch to GENERIC_HARDIRQS and then
git rid of that config option completely. However I leave that to
Sebastian and Gerald who now take care of our PCI code ;)

Thanks,
Heiko

--
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] atm/iphase: rename fregt_t -> ffreg_t

2013-02-08 Thread Heiko Carstens
We have conflicting type qualifiers for "freg_t" in s390's ptrace.h and the
iphase atm device driver, which causes the compile error below.
Unfortunately the s390 typedef can't be renamed, since it's a user visible api,
nor can I change the include order in s390 code to avoid the conflict.

So simply rename the iphase typedef to a new name. Fixes this compile error:

In file included from drivers/atm/iphase.c:66:0:
drivers/atm/iphase.h:639:25: error: conflicting type qualifiers for 'freg_t'
In file included from next/arch/s390/include/asm/ptrace.h:9:0,
 from next/arch/s390/include/asm/lowcore.h:12,
 from next/arch/s390/include/asm/thread_info.h:30,
 from include/linux/thread_info.h:54,
 from include/linux/preempt.h:9,
 from include/linux/spinlock.h:50,
 from include/linux/seqlock.h:29,
 from include/linux/time.h:5,
 from include/linux/stat.h:18,
 from include/linux/module.h:10,
 from drivers/atm/iphase.c:43:
next/arch/s390/include/uapi/asm/ptrace.h:197:3: note: previous declaration of 
'freg_t' was here

Signed-off-by: Heiko Carstens 
---
 drivers/atm/iphase.h | 146 +--
 1 file changed, 73 insertions(+), 73 deletions(-)

diff --git a/drivers/atm/iphase.h b/drivers/atm/iphase.h
index 6a0955e..53ecac5 100644
--- a/drivers/atm/iphase.h
+++ b/drivers/atm/iphase.h
@@ -636,82 +636,82 @@ struct rx_buf_desc {
 #define SEG_BASE IPHASE5575_FRAG_CONTROL_REG_BASE  
 #define REASS_BASE IPHASE5575_REASS_CONTROL_REG_BASE  
 
-typedef volatile u_int  freg_t;
+typedef volatile u_int ffreg_t;
 typedef u_int   rreg_t;
 
 typedef struct _ffredn_t {
-freg_t  idlehead_high;  /* Idle cell header (high)  */
-freg_t  idlehead_low;   /* Idle cell header (low)   */
-freg_t  maxrate;/* Maximum rate */
-freg_t  stparms;/* Traffic Management Parameters*/
-freg_t  abrubr_abr; /* ABRUBR Priority Byte 1, TCR Byte 0   */
-freg_t  rm_type;/*  */
-u_int   filler5[0x17 - 0x06];
-freg_t  cmd_reg;/* Command register */
-u_int   filler18[0x20 - 0x18];
-freg_t  cbr_base;   /* CBR Pointer Base */
-freg_t  vbr_base;   /* VBR Pointer Base */
-freg_t  abr_base;   /* ABR Pointer Base */
-freg_t  ubr_base;   /* UBR Pointer Base */
-u_int   filler24;
-freg_t  vbrwq_base; /* VBR Wait Queue Base  */
-freg_t  abrwq_base; /* ABR Wait Queue Base  */
-freg_t  ubrwq_base; /* UBR Wait Queue Base  */
-freg_t  vct_base;   /* Main VC Table Base   */
-freg_t  vcte_base;  /* Extended Main VC Table Base  */
-u_int   filler2a[0x2C - 0x2A];
-freg_t  cbr_tab_beg;/* CBR Table Begin  */
-freg_t  cbr_tab_end;/* CBR Table End*/
-freg_t  cbr_pointer;/* CBR Pointer  */
-u_int   filler2f[0x30 - 0x2F];
-freg_t  prq_st_adr; /* Packet Ready Queue Start Address */
-freg_t  prq_ed_adr; /* Packet Ready Queue End Address   */
-freg_t  prq_rd_ptr; /* Packet Ready Queue read pointer  */
-freg_t  prq_wr_ptr; /* Packet Ready Queue write pointer */
-freg_t  tcq_st_adr; /* Transmit Complete Queue Start Address*/
-freg_t  tcq_ed_adr; /* Transmit Complete Queue End Address  */
-freg_t  tcq_rd_ptr; /* Transmit Complete Queue read pointer */
-freg_t  tcq_wr_ptr; /* Transmit Complete Queue write pointer*/
-u_int   filler38[0x40 - 0x38];
-freg_t  queue_base; /* Base address for PRQ and TCQ */
-freg_t  desc_base;  /* Base address of descriptor table */
-u_int   filler42[0x45 - 0x42];
-freg_t  mode_reg_0; /* Mode register 0  */
-freg_t  mode_reg_1; /* Mode register 1  */
-freg_t  intr_status_reg;/* Interrupt Status register*/
-freg_t  mask_reg;   /* Mask Register*/
-freg_t  cell_ctr_high1; /* Total cell transfer count (high) */
-freg_t  cell_ctr_lo1;   /* Total cell transfer count (low)  */
-freg_t  state_reg;  /* Status register  */
-u_int   filler4c[0x58 - 0x4c];
-freg_t  curr_desc_num;  /* Contains the current descriptor num  */
-freg_t  next_desc;  /* Next descriptor

Re: [PATCH] s390: Add missing PAGE_SHARED as an alias for PAGE_RW

2013-02-11 Thread Heiko Carstens
On Sat, Feb 09, 2013 at 06:54:45PM +0100, Geert Uytterhoeven wrote:
> s390 allmodconfig:
> 
> drivers/gpu/drm/udl/udl_fb.c:237:52: error: 'PAGE_SHARED' undeclared (first 
> use in this function)
> drivers/media/pci/zoran/zoran_driver.c:2955:14: error: 'PAGE_SHARED' 
> undeclared (first use in this function)
> drivers/media/usb/cpia2/cpia2_core.c:2405:66: error: 'PAGE_SHARED' undeclared 
> (first use in this function)
> drivers/video/udlfb.c:337:52: error: 'PAGE_SHARED' undeclared (first use in 
> this function)
> drivers/video/smscufx.c:795:52: error: 'PAGE_SHARED' undeclared (first use in 
> this function)
> drivers/video/vfb.c:431:52: error: 'PAGE_SHARED' undeclared (first use in 
> this function)
> 
> According to an email from Martin a few years ago, the equivalent define
> for s390 is PAGE_RW, so make PAGE_SHARED an alias for PAGE_RW.
> 
> Signed-off-by: Geert Uytterhoeven 
> ---
>  arch/s390/include/asm/pgtable.h |1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
> index 098adbb..0ca3e62 100644
> --- a/arch/s390/include/asm/pgtable.h
> +++ b/arch/s390/include/asm/pgtable.h
> @@ -386,6 +386,7 @@ extern unsigned long MODULES_END;
> 
>  #define PAGE_KERNEL  PAGE_RW
>  #define PAGE_COPYPAGE_RO
> +#define PAGE_SHARED  PAGE_RW

Thanks Geert. A similar patch however is already in linux-next, together
with a whole bunch of other patches which try to make s390's allmodconfig
compile again after PCI, HAS_DMA and HAS_IOMEM got enabled by our new PCI
code.

--
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] s390: Add missing PAGE_SHARED as an alias for PAGE_RW

2013-02-12 Thread Heiko Carstens
On Tue, Feb 12, 2013 at 10:20:22AM +0100, Geert Uytterhoeven wrote:
> Hi Heiko,
> 
> On Mon, Feb 11, 2013 at 10:11 AM, Heiko Carstens
>  wrote:
> > Thanks Geert. A similar patch however is already in linux-next, together
> > with a whole bunch of other patches which try to make s390's allmodconfig
> > compile again after PCI, HAS_DMA and HAS_IOMEM got enabled by our new PCI
> > code.
> 
> Cool!
> 
> Will you select HAVE_GENERIC_HARDIRQS soon, too?

I discussed that just with Martin, and looking at the code it doesn't look
like we want to have GENERIC_HARDIRQS.
If we would select that option it looks like we need to special case the
common generic hardirqs code quite a lot, which is something we certainly
do not want.
However that's our result after looking 5 minutes into the code ;)
So, if at all, it's not going to happen soon.

--
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 4/9] dasd: Implement block timeout handling

2013-01-29 Thread Heiko Carstens
On Tue, Jan 29, 2013 at 08:11:56AM +0100, Hannes Reinecke wrote:
> This patch implements generic block layer timeout handling
> callbacks for DASDs. When the timeout expires the respective
> cqr is aborted.
> 
> With this timeout handler time-critical request abort
> is guaranteed as the abort does not depend on the internal
> state of the various DASD driver queues.
> 
> Signed-off-by: Hannes Reinecke 
> Acked-by: Stefan Weinhuber 

[...]

> +enum blk_eh_timer_return dasd_times_out(struct request *req)
> +{
> + struct dasd_ccw_req *cqr = req->completion_data;
> + struct dasd_block *block = req->q->queuedata;
> + struct dasd_device *device;
> + int rc = 0;
> +
> + if (!cqr)
> + return BLK_EH_NOT_HANDLED;
> +
> + device = cqr->startdev ? cqr->startdev : block->base;
> + DBF_DEV_EVENT(DBF_WARNING, device,
> +   " dasd_times_out cqr %p status %x",
> +   cqr, cqr->status);
> +
> + spin_lock(&block->queue_lock);
> + spin_lock(get_ccwdev_lock(device->cdev));

^^^

> + cqr->retries = -1;
> + cqr->intrc = -ETIMEDOUT;
> + if (cqr->status >= DASD_CQR_QUEUED) {
> + spin_unlock(get_ccwdev_lock(device->cdev));
> + rc = dasd_cancel_req(cqr);
> + } else if (cqr->status == DASD_CQR_FILLED ||
> +cqr->status == DASD_CQR_NEED_ERP) {
> + cqr->status = DASD_CQR_TERMINATED;
> + spin_unlock(get_ccwdev_lock(device->cdev));
> + } else if (cqr->status == DASD_CQR_IN_ERP) {
> + struct dasd_ccw_req *searchcqr, *nextcqr, *tmpcqr;
> +
> + list_for_each_entry_safe(searchcqr, nextcqr,
> +  &block->ccw_queue, blocklist) {
> + tmpcqr = searchcqr;
> + while (tmpcqr->refers)
> + tmpcqr = tmpcqr->refers;
> + if (tmpcqr != cqr)
> + continue;
> + /* searchcqr is an ERP request for cqr */
> + searchcqr->retries = -1;
> + searchcqr->intrc = -ETIMEDOUT;
> + if (searchcqr->status >= DASD_CQR_QUEUED) {
> + spin_lock(get_ccwdev_lock(device->cdev));

^^^
This looks like a potential dead lock.

--
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 8/9] dasd: Add 'timeout' attribute

2013-01-29 Thread Heiko Carstens
On Tue, Jan 29, 2013 at 08:12:00AM +0100, Hannes Reinecke wrote:
> This patch adds a 'timeout' attibute to the DASD driver.
> When set to non-zero, the blk_timeout function will
> be enabled with the timeout specified in the attribute.
> Setting 'timeout' to '0' will disable block timeouts.
> 
> Signed-off-by: Hannes Reinecke 

[...]

> +static ssize_t
> +dasd_timeout_store(struct device *dev, struct device_attribute *attr,
> +const char *buf, size_t count)
> +{
> + struct dasd_device *device;
> + struct request_queue *q;
> + unsigned long val, flags;
> +
> + device = dasd_device_from_cdev(to_ccwdev(dev));
> + if (IS_ERR(device))
> + return -ENODEV;
> +
> + if ((strict_strtoul(buf, 10, &val) != 0) ||
> + val > ULONG_MAX / HZ) {

Probably this should be UINT_MAX instead of ULONG_MAX, otherwise it
might overflow since blk_queue_rq_timeout(...) expects only an
unsigned int.


> + dasd_put_device(device);
> + return -EINVAL;
> + }
> + q = device->block->request_queue;
> + if (!q) {
> + dasd_put_device(device);
> + return -ENODEV;
> + }
> + spin_lock_irqsave(&device->block->request_queue_lock, flags);
> + if (!val)
> + blk_queue_rq_timed_out(q, NULL);
> + else
> + blk_queue_rq_timed_out(q, dasd_times_out);
> +
> + device->blk_timeout = val;
> +
> + blk_queue_rq_timeout(q, device->blk_timeout * HZ);
> + spin_unlock_irqrestore(&device->block->request_queue_lock, flags);
> +
> + dasd_put_device(device);
> + return count;
> +}

--
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] s390/dis: Fix invalid array size

2013-02-24 Thread Heiko Carstens
On Mon, Feb 25, 2013 at 03:45:45AM +0530, Syam Sidhardhan wrote:
> We are using sizeof operator for an array given as function argument,
> which is incorrect.
> 
> Signed-off-by: Syam Sidhardhan 
> ---
>  arch/s390/kernel/dis.c |4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c
> index c50665f..3ad5e95 100644
> --- a/arch/s390/kernel/dis.c
> +++ b/arch/s390/kernel/dis.c
> @@ -1711,10 +1711,10 @@ int insn_to_mnemonic(unsigned char *instruction, char 
> buf[8])
>   if (!insn)
>   return -ENOENT;
>   if (insn->name[0] == '\0')
> - snprintf(buf, sizeof(buf), "%s",
> + snprintf(buf, 8, "%s",
>long_insn_name[(int) insn->name[1]]);

Thanks, applied.

--
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: bug in generic strncpy_from_user

2013-02-26 Thread Heiko Carstens
On Mon, Feb 25, 2013 at 09:24:31PM -0800, Linus Torvalds wrote:
> On Mon, Feb 25, 2013 at 8:54 PM, Heiko Carstens
>  wrote:
> > FWIW, I think the generic strncpy_from_user() implemention has the same
> > bug as the s390 variant:
> >
> > Following example:
> >
> > If there is a NUL terminated string "a\0" starting at e.g. 0xfffe this
> > will cause an (invalid) page fault for the subsequent page at 0x1
> > in case of CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS for e.g. this invocation:
> >
> > strncpy_from_user(kname, 0xfffe, 4096);
> >
> > If the user space page that contained the string was the last within a
> > VMA this may cause a -EFAULT return value for the __get_user() invocation
> > in strncpy_from_user() and byte-at-a-time processing will happen.
> >
> > This is true and works fine unless the next VMA is the stack.
> >
> > With "ulimit -s unlimited" it will just grow downwards to where the page
> > fault happened instead that -EFAULT will be returned.
> 
> This should _never_ be the case.

I was wrong. -EFAULT will be returned, however the vma will grow nevertheless.
Which in turn will cause trouble.

> Our stack-down growing handling requires the whole guard page, and
> should never grow down to touch the previous vma.
> 
> If it does, that's a bug in our stack growing, not in
> strncpy_from_user(). Which could definitely be the case, of course.
> But we should fix it there, not change the strncpy.

After all expand_stack() simply expands the stack to the requested address,
since the guard page is considered to be not included it will just grow
exactly down to the previous mapping.
Only in handle_mm_fault() afterwards there is a check if the access happened
within the guard page which then will make the access fault.
However the stack vma has already grown and user space is broken afterwards.

Here an example: this is before the kernel accesses memory right behind the
ld.so.cache mapping:

[root@p2345007 ~]# cat /proc/2285/maps
0040-00401000 r-xp  5e:01 148858 
/root/a.out
00401000-00402000 rw-p  5e:01 148858 
/root/a.out
4000-4001c000 r-xp  5e:01 260585 
/lib/ld-2.14.1.so
4001c000-4001e000 rw-p 0001b000 5e:01 260585 
/lib/ld-2.14.1.so
4001e000-4002 r-xp  00:00 0  [vdso]
4002-40023000 rw-p  00:00 0
40023000-4002c000 r--p  5e:01 39 
/etc/ld.so.cache
7ffdf000-8000 rw-p  00:00 0  [stack]

Then an "open" system call to the file  "/lib/libc.so.6" happens. The string is
null terminated and completely fits into the 0x4002b000 user space page. However
when copying from user space with strncpy_from_user() the kernel also reads from
the 0x4002c000 page.
This generates a fault and grows the stack vma downwards to 0x4002c000:

[root@p2345007 ~]# cat /proc/2285/maps
0040-00401000 r-xp  5e:01 148858 
/root/a.out
00401000-00402000 rw-p  5e:01 148858 
/root/a.out
4000-4001c000 r-xp  5e:01 260585 
/lib/ld-2.14.1.so
4001c000-4001e000 rw-p 0001b000 5e:01 260585 
/lib/ld-2.14.1.so
4001e000-4002 r-xp  00:00 0  [vdso]
4002-40023000 rw-p  00:00 0
40023000-4002c000 r--p  5e:01 39 
/etc/ld.so.cache
4002d000-8000 rw-p  00:00 0  [stack]

/proc/maps explicitly excludes the guard page, so the vma of the stack indeed
starts at 0x4002c000. Only every access to the guard page will still fault.

--
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: bug in generic strncpy_from_user

2013-02-27 Thread Heiko Carstens
On Tue, Feb 26, 2013 at 04:30:50PM -0800, Linus Torvalds wrote:
> On Tue, Feb 26, 2013 at 3:43 PM, Linus Torvalds
>  wrote:
> >
> > So I'll need to extend on that logic a bit more.
> 
> Ok, here's the fleshed-out patch. Also fixed to use "expand_stack()",
> which is what the page fault handling actually uses. And it has the
> GROWSUP case as well as a comment about this all.
> 
> So it all looks good. But it's still totally and entirely untested.

Tested with 64 bit kernel with 64 bit and 31 bit mode user space as well as
with 31 bit kernel and 31 bit user space. Each with legacy and flexible
mmap layout.
The bug is fixed and everything else still seems to work. Thanks!

Tested-By: Heiko Carstens 

--
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] arch: s390: mm: Removed useless label

2013-03-14 Thread Heiko Carstens
On Wed, Mar 13, 2013 at 09:46:08PM +0200, Alexandru Gheorghiu wrote:
> Rewrote conditional statement and eliminated the out_kthread label.
> 
> Signed-off-by: Alexandru Gheorghiu 
> ---
>  arch/s390/mm/cmm.c |8 +++-
>  1 file changed, 3 insertions(+), 5 deletions(-)

Applied, 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] arch: s390: hypfs: Use PTR_RET function

2013-03-14 Thread Heiko Carstens
On Wed, Mar 13, 2013 at 09:12:38PM +0200, Alexandru Gheorghiu wrote:
> Used PTR_RET function instead of IS_ERR and PTR_ERR.
> Patch found using coccinelle.
> 
> Signed-off-by: Alexandru Gheorghiu 
> ---
>  arch/s390/hypfs/hypfs_dbfs.c |4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 

Applied, 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] arch: s390: net: Replaced kmalloc and memset with kzalloc

2013-03-14 Thread Heiko Carstens
On Wed, Mar 13, 2013 at 08:59:17PM +0200, Alexandru Gheorghiu wrote:
> Used kzalloc instead of kmalloc followed by memset with 0.
> Patch found using coccinelle.
> 
> Signed-off-by: Alexandru Gheorghiu 
> ---
>  arch/s390/net/bpf_jit_comp.c |3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
> index 0972e91..e645528 100644
> --- a/arch/s390/net/bpf_jit_comp.c
> +++ b/arch/s390/net/bpf_jit_comp.c
> @@ -747,10 +747,9 @@ void bpf_jit_compile(struct sk_filter *fp)
> 
>   if (!bpf_jit_enable)
>   return;
> - addrs = kmalloc(fp->len * sizeof(*addrs), GFP_KERNEL);
> + addrs = kzalloc(fp->len * sizeof(*addrs), GFP_KERNEL);
>   if (addrs == NULL)
>   return;
> - memset(addrs, 0, fp->len * sizeof(*addrs));

We have already a different patch from Stelian Nirlu for the same stuff.

--
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 2/2] checksyscalls: ignore kcmp system call

2012-09-13 Thread Heiko Carstens
On Fri, Sep 07, 2012 at 04:02:34PM +0400, Cyrill Gorcunov wrote:
> On Fri, Sep 07, 2012 at 01:31:31PM +0200, Heiko Carstens wrote:
> > Now that the checksyscalls script works again it will warn about the missing
> > "kcmp" system call on all architectures but x86.
> > Since according to git commit d97b46a6 "syscalls, x86: add __NR_kcmp 
> > syscall"
> > only x86 is currently supported don't emit any warning for this system call.
[...]
> > diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
> > index fd8fa9a..c7cda79 100755
> > --- a/scripts/checksyscalls.sh
> > +++ b/scripts/checksyscalls.sh
> > @@ -194,6 +194,9 @@ cat << EOF
> >  #define __IGNORE_getpmsg
> >  #define __IGNORE_putpmsg
> >  #define __IGNORE_vserver
> > +
> > +/* kcmp is currently x86 only */
> > +#define __IGNORE_kcmp

Ok, I wired the system call up on s390 and the test case passed.
Below is the patch that is needed to actually reach the system call from
other architectures than x86.
Andrew, can you pick this one up as well?

The code that wires the system call up on s390 will go upstream via the
s390 tree. Thanks to kcmp being a cond_syscall there is no compile
time dependency.

>From 1ff800597ea8f678a179387e3cf2ae663531e2fe Mon Sep 17 00:00:00 2001
From: Heiko Carstens 
Date: Thu, 13 Sep 2012 09:37:38 +0200
Subject: [PATCH] syscalls: make kcmp syscall available for all architectures

Remove the x86 dependency, since the system call is not
architecture dependend.

Also add a ptrace.h include, so it compiles at least also on s390.

Cc: Cyrill Gorcunov 
Signed-off-by: Heiko Carstens 
---
 kernel/Makefile | 4 +---
 kernel/kcmp.c   | 1 +
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/Makefile b/kernel/Makefile
index c0cc67a..eb4138b 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -25,9 +25,7 @@ endif
 obj-y += sched/
 obj-y += power/
 
-ifeq ($(CONFIG_CHECKPOINT_RESTORE),y)
-obj-$(CONFIG_X86) += kcmp.o
-endif
+obj-$(CONFIG_CHECKPOINT_RESTORE) += kcmp.o
 obj-$(CONFIG_FREEZER) += freezer.o
 obj-$(CONFIG_PROFILING) += profile.o
 obj-$(CONFIG_STACKTRACE) += stacktrace.o
diff --git a/kernel/kcmp.c b/kernel/kcmp.c
index 30b7b22..e30ac0f 100644
--- a/kernel/kcmp.c
+++ b/kernel/kcmp.c
@@ -4,6 +4,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-- 
1.7.11.6

--
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/


crypto/async_tx/* doesn't build on s390

2008-01-31 Thread Heiko Carstens
I get the following:

crypto/built-in.o: In function `do_async_xor':
async_xor.c:49: undefined reference to `dma_map_page'
async_xor.c:56: undefined reference to `dma_map_page'

This is mainly because s390 doesn't support DMA at all,
but these files get selected via MD_RAID456 anyway.

Any idea how to fix this?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] latencytop: Change Kconfig dependency.

2008-02-01 Thread Heiko Carstens
From: Heiko Carstens <[EMAIL PROTECTED]>

Change latencytop Kconfig entry so it doesn't list the archictectures
that support it. Instead introduce HAVE_LATENCY_SUPPORT which any
architecture can set. Should reduce patch conflicts.

Cc: Arjan van de Ven <[EMAIL PROTECTED]>
Cc: Ingo Molnar <[EMAIL PROTECTED]>
Cc: Martin Schwidefsky <[EMAIL PROTECTED]>
Cc: Holger Wolf <[EMAIL PROTECTED]>
Signed-off-by: Heiko Carstens <[EMAIL PROTECTED]>
---

If ok, should this go in via the x86 tree?

 arch/x86/Kconfig  |3 +++
 lib/Kconfig.debug |2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

Index: linux-2.6/arch/x86/Kconfig
===
--- linux-2.6.orig/arch/x86/Kconfig
+++ linux-2.6/arch/x86/Kconfig
@@ -44,6 +44,9 @@ config LOCKDEP_SUPPORT
 config STACKTRACE_SUPPORT
def_bool y
 
+config HAVE_LATENCYTOP_SUPPORT
+   def_bool y
+
 config SEMAPHORE_SLEEPERS
def_bool y
 
Index: linux-2.6/lib/Kconfig.debug
===
--- linux-2.6.orig/lib/Kconfig.debug
+++ linux-2.6/lib/Kconfig.debug
@@ -581,7 +581,7 @@ config LATENCYTOP
select STACKTRACE
select SCHEDSTATS
select SCHED_DEBUG
-   depends on X86 || X86_64
+   depends on HAVE_LATENCYTOP_SUPPORT
help
  Enable this option if you want to use the LatencyTOP tool
  to find out which userspace is blocking on what kernel operations.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] latencytop s390 support.

2008-02-01 Thread Heiko Carstens
Subject: [PATCH] latencytop s390 support.

From: Heiko Carstens <[EMAIL PROTECTED]>

Cc: Holger Wolf <[EMAIL PROTECTED]>
Cc: Martin Schwidefsky <[EMAIL PROTECTED]>
Signed-off-by: Heiko Carstens <[EMAIL PROTECTED]>
---

Will go in via the s390 git tree if acceptable.

 arch/s390/Kconfig |3 +++
 arch/s390/kernel/stacktrace.c |   31 +++
 2 files changed, 26 insertions(+), 8 deletions(-)

Index: linux-2.6/arch/s390/Kconfig
===
--- linux-2.6.orig/arch/s390/Kconfig
+++ linux-2.6/arch/s390/Kconfig
@@ -20,6 +20,9 @@ config LOCKDEP_SUPPORT
 config STACKTRACE_SUPPORT
def_bool y
 
+config HAVE_LATENCYTOP_SUPPORT
+   def_bool y
+
 config RWSEM_GENERIC_SPINLOCK
bool
 
Index: linux-2.6/arch/s390/kernel/stacktrace.c
===
--- linux-2.6.orig/arch/s390/kernel/stacktrace.c
+++ linux-2.6/arch/s390/kernel/stacktrace.c
@@ -14,7 +14,8 @@
 static unsigned long save_context_stack(struct stack_trace *trace,
unsigned long sp,
unsigned long low,
-   unsigned long high)
+   unsigned long high,
+   int savesched)
 {
struct stack_frame *sf;
struct pt_regs *regs;
@@ -47,10 +48,12 @@ static unsigned long save_context_stack(
return sp;
regs = (struct pt_regs *)sp;
addr = regs->psw.addr & PSW_ADDR_INSN;
-   if (!trace->skip)
-   trace->entries[trace->nr_entries++] = addr;
-   else
-   trace->skip--;
+   if (savesched || !in_sched_functions(addr)) {
+   if (!trace->skip)
+   trace->entries[trace->nr_entries++] = addr;
+   else
+   trace->skip--;
+   }
if (trace->nr_entries >= trace->max_entries)
return sp;
low = sp;
@@ -66,15 +69,27 @@ void save_stack_trace(struct stack_trace
orig_sp = sp & PSW_ADDR_INSN;
new_sp = save_context_stack(trace, orig_sp,
S390_lowcore.panic_stack - PAGE_SIZE,
-   S390_lowcore.panic_stack);
+   S390_lowcore.panic_stack, 1);
if (new_sp != orig_sp)
return;
new_sp = save_context_stack(trace, new_sp,
S390_lowcore.async_stack - ASYNC_SIZE,
-   S390_lowcore.async_stack);
+   S390_lowcore.async_stack, 1);
if (new_sp != orig_sp)
return;
save_context_stack(trace, new_sp,
   S390_lowcore.thread_info,
-  S390_lowcore.thread_info + THREAD_SIZE);
+  S390_lowcore.thread_info + THREAD_SIZE, 1);
+}
+
+void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
+{
+   unsigned long sp, low, high;
+
+   sp = tsk->thread.ksp & PSW_ADDR_INSN;
+   low = (unsigned long) task_stack_page(tsk);
+   high = (unsigned long) task_pt_regs(tsk);
+   save_context_stack(trace, sp, low, high, 0);
+   if (trace->nr_entries < trace->max_entries)
+   trace->entries[trace->nr_entries++] = ULONG_MAX;
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] latencytop: Change Kconfig dependency.

2008-02-01 Thread Heiko Carstens
> > +config HAVE_LATENCYTOP_SUPPORT
> > +   def_bool y
> > +
> No.
> Please do:
>  config X86
> + select HAVE_LATENCYTOP_SUPPORT
> 
> Yes - this is a valid use of select.
> 
> See Documentation/kbuild/kconfig-language.txt

Ok, I wasn't aware of that. For now I'll leave it as is
as Ingo requested.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] kprobes: Introduce kprobe_handle_fault()

2008-02-03 Thread Heiko Carstens
On Sat, Feb 02, 2008 at 07:00:23PM -0800, Harvey Harrison wrote:
> Use a central kprobe_handle_fault() inline in kprobes.h to remove
> all of the arch-dependant, practically identical implementations in
> avr32, ia64, powerpc, s390, sparc64, and x86.
> 
> avr32 was the only arch without the preempt_disable/enable pair
> in its notify_page_fault implementation.
> 
> This uncovered a possible bug in the s390 version as that purely
> copied the x86 version unconditionally passing 14 as the trapnr
> rather than the error_code parameter.  s390 is changed to pass
> error_code in this patch.
> 
> Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>

for the s390 bits:

Acked-by: Heiko Carstens <[EMAIL PROTECTED]>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: crypto/async_tx/* doesn't build on s390

2008-02-03 Thread Heiko Carstens
On Fri, Feb 01, 2008 at 02:31:28PM -0700, Dan Williams wrote:
> On Feb 1, 2008 4:37 AM, Cornelia Huck <[EMAIL PROTECTED]> wrote:
> > On Thu, 31 Jan 2008 12:49:00 -0700,
> > "Williams, Dan J" <[EMAIL PROTECTED]> wrote:
> >
> > > I am mistaken, the 'depends on ARCH...' precludes HAS_DMA.  Perhaps the 
> > > compiler is emitting a call to async_tx_find_channel when it needs to be 
> > > inline?  On x86 do_async_xor is successfully compiled away when 
> > > CONFIG_DMA_ENGINE=n.
> >
> > Just checked why it compiled for me on one box but not on the other and
> > found that deactivating CONFIG_SECTION_MISMATCH makes it go away. Hmm...
> >
> 
> Here is what I have come up with as a fix.

The fix works for me. Thanks! However your mailer replaced tabs with spaces
and added an extra line break.

> ---
> async_tx: prevent do_async_xor from compiling on !HAS_DMA archs
> 
> With the addition of -fno-inline in CONFIG_DEBUG_SECTION_MISMATCH
> do_async_xor is no longer compiled away on !HAS_DMA archs like s390.
> Other async_tx calls to the dma-api are already open coded inline.
> 
> Signed-off-by: Dan Williams <[EMAIL PROTECTED]>
> ---
> 
>  crypto/async_tx/async_xor.c |8 
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> 
> diff --git a/crypto/async_tx/async_xor.c b/crypto/async_tx/async_xor.c
> index 2575f67..393f07d 100644
> --- a/crypto/async_tx/async_xor.c
> +++ b/crypto/async_tx/async_xor.c
> @@ -41,6 +41,14 @@ do_async_xor(struct dma_async_tx_descriptor *tx,
> struct dma_device *device,
> enum dma_data_direction dir;
> int i;
> 
> +   /* if this function is not inlined we need to prevent
> +* the rest of the routine from compiling on !HAS_DMA
> +* archs
> +*/
> +   #ifndef CONFIG_DMA_ENGINE
> +   return;
> +   #endif
> +
> pr_debug("%s: len: %zu\n", __FUNCTION__, len);
> 
> dir = (flags & ASYNC_TX_ASSUME_COHERENT) ?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Fix ext4 bitops

2008-02-03 Thread Heiko Carstens
On Fri, Feb 01, 2008 at 10:04:04PM +0100, Bastian Blank wrote:
> On Fri, Feb 01, 2008 at 12:22:57PM -0800, Andrew Morton wrote:
> > On Fri, 1 Feb 2008 21:02:08 +0100
> > Bastian Blank <[EMAIL PROTECTED]> wrote:
> > 
> > > Fix ext4 bitops.
> > 
> > This is incomplete.  Please tell us what was "fixed".
> > 
> > If it was a build error then please quote the compile error output in the
> > changelog, as well as the usual description of what the problem is, and how
> > it was fixed.
> 
> | fs/ext4/mballoc.c: In function 'ext4_mb_generate_buddy':
> | fs/ext4/mballoc.c:954: error: implicit declaration of function 
> 'generic_find_next_le_bit'
> 
> The s390 specific bitops uses parts of the generic implementation.
> Include the correct header.

That doesn't work:

fs/built-in.o: In function `ext4_mb_release_inode_pa':
mballoc.c:(.text+0x95a8a): undefined reference to `generic_find_next_le_bit'
fs/built-in.o: In function `ext4_mb_init_cache':
mballoc.c:(.text+0x967ea): undefined reference to `generic_find_next_le_bit'

This still needs generic_find_next_le_bit which comes
from lib/find_next_bit.c. That one doesn't get built on s390 since we
don't set GENERIC_FIND_NEXT_BIT.
Currently we have the lengthly patch below queued.

Subject: [PATCH] Implement ext2_find_next_bit.

From: Heiko Carstens <[EMAIL PROTECTED]>

Fixes this compile error:

fs/ext4/mballoc.c:
    In function 'ext4_mb_generate_buddy':
fs/ext4/mballoc.c:954:
error: implicit declaration of function 'generic_find_next_le_bit'

Signed-off-by: Heiko Carstens <[EMAIL PROTECTED]>
Signed-off-by: Martin Schwidefsky <[EMAIL PROTECTED]>
---

 include/asm-s390/bitops.h |  130 +-
 1 file changed, 128 insertions(+), 2 deletions(-)

diff -urpN linux-2.6/include/asm-s390/bitops.h 
linux-2.6-patched/include/asm-s390/bitops.h
--- linux-2.6/include/asm-s390/bitops.h 2008-02-01 12:29:03.0 +0100
+++ linux-2.6-patched/include/asm-s390/bitops.h 2008-02-01 12:31:39.0 
+0100
@@ -772,8 +772,6 @@ static inline int sched_find_first_bit(u
test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
 #define ext2_test_bit(nr, addr)  \
test_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
-#define ext2_find_next_bit(addr, size, off) \
-   generic_find_next_le_bit((unsigned long *)(addr), (size), (off))
 
 #ifndef __s390x__
 
@@ -820,6 +818,48 @@ ext2_find_first_zero_bit(void *vaddr, un
 return (res < size) ? res : size;
 }
 
+static inline int __ext2_find_first_bit(void *vaddr, unsigned int size)
+{
+   typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype;
+   unsigned long cmp, count;
+   unsigned int res;
+
+   if (!size)
+   return 0;
+   asm volatile(
+   "   lhi %1,0\n"
+   "   lr  %2,%3\n"
+   "   lhi %0,0\n"
+   "   ahi %2,31\n"
+   "   srl %2,5\n"
+   "0: cl  %1,0(%0,%4)\n"
+   "   jne 1f\n"
+   "   ahi %0,4\n"
+   "   brct%2,0b\n"
+   "   lr  %0,%3\n"
+   "   j   4f\n"
+   "1: l   %2,0(%0,%4)\n"
+   "   sll %0,3\n"
+   "   ahi %0,24\n"
+   "   lhi %1,0xff\n"
+   "   tmh %2,0x\n"
+   "   jnz 2f\n"
+   "   ahi %0,-16\n"
+   "   srl %2,16\n"
+   "2: tml %2,0xff00\n"
+   "   jnz 3f\n"
+   "   ahi %0,-8\n"
+   "   srl %2,8\n"
+   "3: nr  %2,%1\n"
+   "   ic  %2,0(%2,%5)\n"
+   "   alr %0,%2\n"
+   "4:"
+   : "=&a" (res), "=&d" (cmp), "=&a" (count)
+   : "a" (size), "a" (vaddr), "a" (&_sb_findmap),
+ "m" (*(addrtype *) vaddr) : "cc");
+   return (res < size) ? res : size;
+}
+
 #else /* __s390x__ */
 
 static inline unsigned long
@@ -867,6 +907,51 @@ ext2_find_first_zero_bit(void *vaddr, un
 return (res < size) ? res : size;
 }
 
+static inline unsigned long __ext2_find_first_bit(void *vaddr,
+ unsigned long size)
+{
+   typede

Re: [PATCH] Fix ext4 bitops

2008-02-04 Thread Heiko Carstens
> > > > | fs/ext4/mballoc.c: In function 'ext4_mb_generate_buddy':
> > > > | fs/ext4/mballoc.c:954: error: implicit declaration of function 
> > > > 'generic_find_next_le_bit'
> > > > 
> > > > The s390 specific bitops uses parts of the generic implementation.
> > > > Include the correct header.
> > > 
> > > That doesn't work:
> > > 
> > > fs/built-in.o: In function `ext4_mb_release_inode_pa':
> > > mballoc.c:(.text+0x95a8a): undefined reference to 
> > > `generic_find_next_le_bit'
> > > fs/built-in.o: In function `ext4_mb_init_cache':
> > > mballoc.c:(.text+0x967ea): undefined reference to 
> > > `generic_find_next_le_bit'
> > > 
> > > This still needs generic_find_next_le_bit which comes
> > > from lib/find_next_bit.c. That one doesn't get built on s390 since we
> > > don't set GENERIC_FIND_NEXT_BIT.
> > > Currently we have the lengthly patch below queued.
> > 
> > Similar issue on m68k. As Bastian also saw it on powerpc, I'm getting the
> > impression the ext4 people don't (compile) test on big endian machines?
> > 
> > Gr{oetje,eeting}s,
> > 
> 
> I have sent this patches to linux-arch expecting a review from
> different arch people. It is true that the patches are tested only on
> powerpc, x86-64, x86. That's the primary reason of me sending the
> patches to linux-arch.

Is there anything special I need to do so the ext4 code actually uses
ext2_find_next_bit() ? Haven't looked at the ext4 code, but I'd like to
test if the s390 implementation is ok.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Build regressions/improvements in v3.7-rc2

2012-10-22 Thread Heiko Carstens
On Mon, Oct 22, 2012 at 09:50:26PM +0200, Geert Uytterhoeven wrote:
> On Mon, Oct 22, 2012 at 9:47 PM, Geert Uytterhoeven
>  wrote:
> > JFYI, when comparing v3.7-rc2 to v3.7-rc1[3], the summaries are:
> >   - build errors: +4/-44
> 
>   + arch/s390/include/asm/kvm_para.h: error: redefinition of
> 'kvm_arch_para_features':  => 147:28, 147:99
>   + arch/s390/include/asm/kvm_para.h: error: redefinition of
> 'kvm_check_and_clear_guest_paused':  => 152:91, 152:20
> 
> s390-allmodconfig/s390-allyesconfig/s390-defconfig

Thanks Geert. We have already a build fix for this from David Howells
which is waiting to be merged upstream.

--
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: + futex-runtime-enable-pi-and-robust-functionality.patch added to -mm tree

2008-02-16 Thread Heiko Carstens
> From: Thomas Gleixner <[EMAIL PROTECTED]>
> 
> Not all architectures implement futex_atomic_cmpxchg_inatomic().  The default
> implementation returns -ENOSYS, which is currently not handled inside of the
> futex guts.
> 
> Futex PI calls and robust list exits with a held futex result in an endless
> loop in the futex code on architectures which have no support.
> 
> Fixing up every place where futex_atomic_cmpxchg_inatomic() is called would
> add a fair amount of extra if/else constructs to the already complex code.  It
> is also not possible to disable the robust feature before user space tries to
> register robust lists.
> 
> Compile time disabling is not a good idea either, as there are already
> architectures with runtime detection of futex_atomic_cmpxchg_inatomic support.
> 
> Detect the functionality at runtime instead by calling
> cmpxchg_futex_value_locked() with a NULL pointer from the futex initialization
> code.  This is guaranteed to fail, but the call of
> futex_atomic_cmpxchg_inatomic() happens with pagefaults disabled.
> 
> On architectures, which use the asm-generic implementation or have a runtime
> CPU feature detection, a -ENOSYS return value disables the PI/robust features.
> 
> On architectures with a working implementation the call returns -EFAULT and
> the PI/robust features are enabled.
> 
> The relevant syscalls return -ENOSYS and the robust list exit code is blocked,
> when the detection fails.
> 
> Fixes http://lkml.org/lkml/2008/2/11/149
> Originally reported by: Lennart Buytenhek

[...]

>  static int __init init(void)
>  {
> + u32 curval;
>   int i;
> 
> + /*
> +  * This will fail and we want it. Some arch implementations do
> +  * runtime detection of the futex_atomic_cmpxchg_inatomic()
> +  * functionality. We want to know that before we call in any
> +  * of the complex code paths. Also we want to prevent
> +  * registration of robust lists in that case. NULL is
> +  * guaranteed to fault and we get -EFAULT on functional
> +  * implementation, the non functional ones will return
> +  * -ENOSYS.
> +  */
> + curval = cmpxchg_futex_value_locked(NULL, 0, 0);
> + if (curval == -EFAULT)
> + futex_cmpxchg_enabled = 1;
> +

Why should that fail? You're accessing a kernel space address here and no
user space address.
Indeed it does fail with an Oops on s390 since we enable low address
protection in the kernel so we get an exception if something within the
kernel writes to the first 512 bytes of the kernel address space.
Otherwise it would have silently passed the test...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: + futex-runtime-enable-pi-and-robust-functionality.patch added to -mm tree

2008-02-16 Thread Heiko Carstens
On Sat, Feb 16, 2008 at 02:48:17PM +0100, Thomas Gleixner wrote:
> On Sat, 16 Feb 2008, Heiko Carstens wrote:
> 
> > > Well, NULL pointer dereferencing is supposed to fail, isn't it ?
> >
> > I wasn't sure that this is true for all architectures, but...
> 
> It's an requirement for futex support.

To be more precise: dereferencing alone won't cause an exception for
NULL pointers on s390. Only writes will do so.
That is very architecture specific since we cannot unmap page 0,
it contains per-cpu data -- like exception pointers and all such stuff
that the cpu needs.
Just in case there is any code that relies on the fact that also reads
via a NULL pointer are supposed to failed.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: + futex-runtime-enable-pi-and-robust-functionality.patch added to -mm tree

2008-02-16 Thread Heiko Carstens
On Sat, Feb 16, 2008 at 02:05:13PM +0100, Thomas Gleixner wrote:
> On Sat, 16 Feb 2008, Heiko Carstens wrote:
> > > + /*
> > > +  * This will fail and we want it. Some arch implementations do
> > > +  * runtime detection of the futex_atomic_cmpxchg_inatomic()
> > > +  * functionality. We want to know that before we call in any
> > > +  * of the complex code paths. Also we want to prevent
> > > +  * registration of robust lists in that case. NULL is
> > > +  * guaranteed to fault and we get -EFAULT on functional
> > > +  * implementation, the non functional ones will return
> > > +  * -ENOSYS.
> > > +  */
> > > + curval = cmpxchg_futex_value_locked(NULL, 0, 0);
> > > + if (curval == -EFAULT)
> > > + futex_cmpxchg_enabled = 1;
> > > +
> > 
> > Why should that fail? You're accessing a kernel space address here and no
> > user space address.
> 
> Well, NULL pointer dereferencing is supposed to fail, isn't it ?

I wasn't sure that this is true for all architectures, but...

> > Indeed it does fail with an Oops on s390 since we enable low address
> > protection in the kernel so we get an exception if something within the
> > kernel writes to the first 512 bytes of the kernel address space.
> > Otherwise it would have silently passed the test...
> 
> NULL pointer dereferencing faults on all architectures, at least it
> should, but we explicitely disable pagefaults and recover via the
> extable fixup, which is in S390 as well. That returns -EFAULT and
> signals that there is a working implementation, while those which have
> no support return -ENOSYS, which keeps the robust/pi stuff disabled.

...one of our exception table entries has an off-by-one bug.
Never mind, I'll go and fix our own stuff instead ;)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH v5 12/19] memory-hotplug: introduce new function arch_remove_memory()

2012-07-30 Thread Heiko Carstens
On Fri, Jul 27, 2012 at 06:32:15PM +0800, Wen Congyang wrote:
> We don't call __add_pages() directly in the function add_memory()
> because some other architecture related things need to be done
> before or after calling __add_pages(). So we should introduce
> a new function arch_remove_memory() to revert the things
> done in arch_add_memory().
> 
> Note: the function for s390 is not implemented(I don't know how to
> implement it for s390).

There is no hardware or firmware interface which could trigger a
hot memory remove on s390. So there is nothing that needs to be
implemented.

--
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] samples/seccomp: fix endianness bug in LO_ARG define

2012-07-31 Thread Heiko Carstens
From: Heiko Carstens 

The LO_ARG define needs to consider endianness also for 32 bit builds.

The "bpf_fancy" test case didn't work on s390 in 32 bit and compat mode
because the LO_ARG define resulted in a BPF program which read the upper
halve of the 64 bit system call arguments instead of the lower halves.

Signed-off-by: Heiko Carstens 
---
 samples/seccomp/bpf-helper.h | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/samples/seccomp/bpf-helper.h b/samples/seccomp/bpf-helper.h
index 643279d..38ee70f 100644
--- a/samples/seccomp/bpf-helper.h
+++ b/samples/seccomp/bpf-helper.h
@@ -59,6 +59,16 @@ void seccomp_bpf_print(struct sock_filter *filter, size_t 
count);
 #define FIND_LABEL(labels, label) seccomp_bpf_label((labels), #label)
 
 #define EXPAND(...) __VA_ARGS__
+
+/* Ensure that we load the logically correct offset. */
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define LO_ARG(idx) offsetof(struct seccomp_data, args[(idx)])
+#elif __BYTE_ORDER == __BIG_ENDIAN
+#define LO_ARG(idx) offsetof(struct seccomp_data, args[(idx)]) + sizeof(__u32)
+#else
+#error "Unknown endianness"
+#endif
+
 /* Map all width-sensitive operations */
 #if __BITS_PER_LONG == 32
 
@@ -70,21 +80,16 @@ void seccomp_bpf_print(struct sock_filter *filter, size_t 
count);
 #define JLE(x, jt) JLE32(x, EXPAND(jt))
 #define JA(x, jt) JA32(x, EXPAND(jt))
 #define ARG(i) ARG_32(i)
-#define LO_ARG(idx) offsetof(struct seccomp_data, args[(idx)])
 
 #elif __BITS_PER_LONG == 64
 
 /* Ensure that we load the logically correct offset. */
 #if __BYTE_ORDER == __LITTLE_ENDIAN
 #define ENDIAN(_lo, _hi) _lo, _hi
-#define LO_ARG(idx) offsetof(struct seccomp_data, args[(idx)])
 #define HI_ARG(idx) offsetof(struct seccomp_data, args[(idx)]) + sizeof(__u32)
 #elif __BYTE_ORDER == __BIG_ENDIAN
 #define ENDIAN(_lo, _hi) _hi, _lo
-#define LO_ARG(idx) offsetof(struct seccomp_data, args[(idx)]) + sizeof(__u32)
 #define HI_ARG(idx) offsetof(struct seccomp_data, args[(idx)])
-#else
-#error "Unknown endianness"
 #endif
 
 union arg64 {
-- 
1.7.11.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: [guv v2 18/31] s390: Replace __get_cpu_var uses

2013-08-27 Thread Heiko Carstens
On Mon, Aug 26, 2013 at 08:44:40PM +, Christoph Lameter wrote:
> __get_cpu_var() is used for multiple purposes in the kernel source. One of 
> them is
> address calculation via the form &__get_cpu_var(x). This calculates the 
> address for
> the instance of the percpu variable of the current processor based on an 
> offset.


> 4. Retrieve the content of a percpu struct
> 
>   DEFINE_PER_CPU(struct mystruct, y);
>   struct mystruct x = __get_cpu_var(y);
> 
>Converts to
> 
>   memcpy(this_cpu_ptr(&y), x, sizeof(x));

That's wrong (destination and source should be exchanged).
However your patch looks good.

Acked-by: Heiko Carstens 

--
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: [GIT PULL] Btrfs

2013-09-14 Thread Heiko Carstens
On Fri, Sep 13, 2013 at 04:58:36PM +0100, Russell King wrote:
> On Fri, Sep 13, 2013 at 11:38:15AM -0400, Josh Boyer wrote:
> > On Fri, Sep 13, 2013 at 11:06 AM, Josh Boyer  wrote:
> > > On Fri, Sep 13, 2013 at 8:15 AM, Russell King  
> > > wrote:
> > >> On Fri, Sep 13, 2013 at 07:53:21AM -0400, Josh Boyer wrote:
> > >>> I'm not an ARM expert, so I don't know if ARM should use the
> > >>> asm-generic implementations, or just use __get_user/__put_user in all
> > >>> cases.  I've CC'd rmk.
> > >>
> > >> Why do we have uaccess-unaligned.h ?  Normally, these kinds of things
> > >> are spawned by architectures which have problems with unaligned accesses,
> > >> ARM being one of them, but afaik we've never need this.
> > >>
> > >> With the kernel-side trapping of unaligned accesses on older hardware,
> > >> we've always dealt with the normal accessor faulting.
> > >>
> > >> From what I can tell in the git history, these unaligned put_user and
> > >> get_user have existed all the way back to the dawn of git use.
> > >>
> > >> Can someone enlighten me why we have them?
> > 
> > I somehow fail at email and dropped Russell from CC on accident.  Sigh.
> 
> You're not the first to do that recently.  I'm beginning to think it's
> something someone has written into email clients to make them do in order
> to piss me off.  I mean, it's _hard_ to do - you have to manually edit the
> recipients list to just drop one person.

You configured your mail client to generate a "Mail-Followup-To:" header
field which actively asks other mail clients to remove you from replies.
So you only get what you ask for... ;)

I think the mutt "metoo" variable will change that, but I don't know
for sure.

--
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] Fixed typo on word accounting in kprobes.c in mutliple architectures

2013-09-20 Thread Heiko Carstens
On Thu, Sep 19, 2013 at 02:33:58AM +0530, Anoop Thomas Mathew wrote:
> Signed-off-by: Anoop Thomas Mathew 
> ---
>  arch/arc/kernel/kprobes.c |2 +-
>  arch/ia64/kernel/kprobes.c|2 +-
>  arch/powerpc/kernel/kprobes.c |2 +-
>  arch/s390/kernel/kprobes.c|2 +-
>  arch/sparc/kernel/kprobes.c   |2 +-
>  5 files changed, 5 insertions(+), 5 deletions(-)

Please send trivial typo fixes to Jiri Kosina .
See "TRIVIAL PATCHES" in MAINTAINERS. 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: [GIT PULL] KVM changes for 3.12

2013-09-04 Thread Heiko Carstens
On Wed, Sep 04, 2013 at 06:08:08PM -0700, Linus Torvalds wrote:
> On Tue, Sep 3, 2013 at 5:10 AM, Gleb Natapov  wrote:
> >
> > This pull request adds tlb_gather_mmu() caller in S390 code, but 2b047252
> > in your tree added another parameter to the function, so the patch bellow
> > have to be applied during merge to resolve the conflicts. The patch was
> > used in linux-next for awhile.
> 
> Hmm. Fine. Except:
> 
> > /* Reallocate the page tables with pgstes */
> > mm->context.has_pgste = 1;
> > -   tlb_gather_mmu(&tlb, mm, 0);
> > +   tlb_gather_mmu(&tlb, mm, 0, TASK_SIZE);
> > page_table_realloc(&tlb, mm, 0, TASK_SIZE);
> > tlb_finish_mmu(&tlb, 0, -1);
> > up_write(&mm->mmap_sem);
> 
> Realistically, the begin/end arguments to tlb_gather_mmu() and
> tlb_finish_mmu() should match. In fact, I considered getting rid of
> the ones to tlb_finish_mmu() because they are kind of pointless these
> days (but didn't, because I wanted to keep the patches minimal).
> 
> And in your case they don't. Which implies a certain amount of confusion.

Actually they do match in our internal version of the merge conflict. It
was just a copy-paste error from me when sending the merge resolution patch.
Since the fix contained two changes lines within the same hunk it was
hard to get right.. oh well.. :)

Thanks for fixing it!

--
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] lockref: remove cpu_relax() again

2013-09-05 Thread Heiko Carstens
d472d9d9 "lockref: Relax in cmpxchg loop" added a cpu_relax() call to the
CMPXCHG_LOOP() macro. However to me it seems to be wrong since it is very
likely that the next round will succeed (or the loop will be left).
Even worse: cpu_relax() is very expensive on s390, since it means yield
"my virtual cpu to the hypervisor". So we are talking of several 1000 cycles.

In fact some measurements show the bad impact of the cpu_relax() call on
s390 using Linus' test case that "stats()" like mad:

Without converting s390 to lockref:
Total loops: 81236173

After converting s390 to lockref:
Total loops: 31896802

After converting s390 to lockref but with removed cpu_relax() call:
Total loops: 86242190

So the cpu_relax() call completely contradicts the intention of
CONFIG_CMPXCHG_LOCKREF at least on s390.

*If* however the cpu_relax() makes sense on other platforms maybe we could
add something like we have already with "arch_mutex_cpu_relax()":

include/linux/mutex.h:
 #ifndef CONFIG_HAVE_ARCH_MUTEX_CPU_RELAX
 #define arch_mutex_cpu_relax()  cpu_relax()
 #endif

arch/s390/include/asm/mutex.h:
 #define arch_mutex_cpu_relax()  barrier()

Signed-off-by: Heiko Carstens 
---
 lib/lockref.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lib/lockref.c b/lib/lockref.c
index 9d76f40..7819c2d 100644
--- a/lib/lockref.c
+++ b/lib/lockref.c
@@ -19,7 +19,6 @@
if (likely(old.lock_count == prev.lock_count)) {
\
SUCCESS;
\
}   
\
-   cpu_relax();
\
}   
\
 } while (0)
 
-- 
1.8.3.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] lockref: remove cpu_relax() again

2013-09-05 Thread Heiko Carstens
On Thu, Sep 05, 2013 at 03:18:14PM +0200, Heiko Carstens wrote:
> d472d9d9 "lockref: Relax in cmpxchg loop" added a cpu_relax() call to the
> CMPXCHG_LOOP() macro. However to me it seems to be wrong since it is very
> likely that the next round will succeed (or the loop will be left).
> Even worse: cpu_relax() is very expensive on s390, since it means yield
> "my virtual cpu to the hypervisor". So we are talking of several 1000 cycles.
> 
> In fact some measurements show the bad impact of the cpu_relax() call on
> s390 using Linus' test case that "stats()" like mad:
> 
> Without converting s390 to lockref:
> Total loops: 81236173
> 
> After converting s390 to lockref:
> Total loops: 31896802
> 
> After converting s390 to lockref but with removed cpu_relax() call:
> Total loops: 86242190

All of those should have been "converting s390 to ARCH_USE_CMPXCHG_LOCKREF"
instead of "to lockref" of course .. ;)

--
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] staging: Disable lustre file system for MIPS, SH, and XTENSA

2013-09-08 Thread Heiko Carstens
On Sun, Sep 08, 2013 at 07:31:18PM -0700, Guenter Roeck wrote:
> On 09/08/2013 07:31 PM, Greg Kroah-Hartman wrote:
> >On Sun, Sep 08, 2013 at 07:24:19PM -0700, Guenter Roeck wrote:
> >>On 09/08/2013 06:59 PM, Greg Kroah-Hartman wrote:
> >>>On Sun, Sep 08, 2013 at 06:03:00PM -0700, Guenter Roeck wrote:
> mips allmodconfig fails with
> 
> ERROR: "copy_from_user_page" 
> [drivers/staging/lustre/lustre/libcfs/libcfs.ko]
> undefined!
> 
> which is due to LUSTRE using copy_from_user_page which is not exported by 
> any
> architecture.
> >>>
> >>>Any, or just these arches?
> >>>
> >>Other architectures implement it as define as far as I can see.
> >
> >Then why would it be a problem?
> >
> It isn't a problem for those other architectures. Mostly it is mapped to 
> functions like memcpy().
> 
> Guenter
> 
> Unfortunately, LUSTRE can only be built as module, so there is no
> easy fix.
> >>>
> >>>Can't we just export the functions for those arches?  Surely lutre
> >>>isn't the first/only driver that needs this?
> >>>
> >>That would be another option.
> >>
> >>Actually, turns out Geert submitted a patch to do this for mips already, 
> >>and Ralf applied it:
> >>
> >>https://lkml.org/lkml/2013/9/5/111
> >>
> >>So please forget this patch. If sh/xtensa actually need it, we can do the 
> >>same there.
> >
> >Sounds good to me, consider it forgotten :)
> >
> >greg k-h

The proper "fix" seems to be to get rid of this new usage of 
copy_from_user_page() in lustre.
The code in question is nothing but a copy of __access_remote_vm()
from mm/memory.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/


[GIT PULL] more s390 updates for 3.12 merge window

2013-09-11 Thread Heiko Carstens
Hi Linus,

please pull from

  git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git for-linus

to receive a couple of s390 updates for 3.12.

This includes one bpf/jit bug fix where the jit compiler could sometimes
write generated code out of bounds of the allocated memory area.
The rest of the patches are only cleanups and minor improvements.

Thanks,
Heiko

---

Heiko Carstens (13):
  s390/bpf,jit: fix address randomization
  s390: update defconfig
  s390/dumpstack: convert print_symbol to %pSR
  s390/irq: use hlists for external interrupt handler array
  s390/irq: rework irq subclass handling
  s390: keep Kconfig sorted
  s390/mm: add __releases()/__acquires() annotations to gmap_alloc_table()
  s390/compat signal: add couple of __force annotations
  s390: make various functions static, add declarations to header files
  s390/ftrace: avoid pointer arithmetics with function pointers
  s390/ap_bus: use and-mask instead of a cast
  s390/compat,uid16: use current_cred()
  s390/irq: reduce size of external interrupt handler hash array

Hendrik Brueckner (1):
  s390/perf: Remove print_hex_dump_bytes() debug output

 arch/s390/Kconfig|  6 +--
 arch/s390/defconfig  | 39 --
 arch/s390/include/asm/irq.h  | 12 --
 arch/s390/kernel/compat_linux.c  |  9 +++--
 arch/s390/kernel/compat_signal.c | 10 ++---
 arch/s390/kernel/dumpstack.c | 20 +-
 arch/s390/kernel/entry.h | 18 +++--
 arch/s390/kernel/ftrace.c|  5 ++-
 arch/s390/kernel/irq.c   | 85 +++-
 arch/s390/kernel/machine_kexec.c |  2 +-
 arch/s390/kernel/perf_cpum_cf.c  |  4 +-
 arch/s390/kernel/perf_event.c|  5 +--
 arch/s390/kernel/runtime_instr.c |  4 +-
 arch/s390/kernel/smp.c   |  2 +-
 arch/s390/kernel/suspend.c   |  1 +
 arch/s390/mm/fault.c |  2 +-
 arch/s390/mm/maccess.c   |  1 +
 arch/s390/mm/pgtable.c   |  6 ++-
 arch/s390/net/bpf_jit_comp.c |  2 +-
 arch/s390/oprofile/hwsampler.c   |  6 +--
 drivers/s390/block/dasd_diag.c   |  4 +-
 drivers/s390/char/fs3270.c   |  6 +--
 drivers/s390/char/sclp.c |  6 +--
 drivers/s390/char/tty3270.c  |  6 +--
 drivers/s390/crypto/ap_bus.c |  2 +-
 drivers/s390/kvm/kvm_virtio.c|  2 +-
 26 files changed, 130 insertions(+), 135 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/


[PATCH] powerpc: fix __get_user_pages_fast() irq handling

2013-10-08 Thread Heiko Carstens
>From 1454d5ca6209926a52c2fdea9ba41a41a33e4046 Mon Sep 17 00:00:00 2001
From: Heiko Carstens 
Date: Tue, 8 Oct 2013 09:46:00 +0200
Subject: [PATCH] powerpc: fix __get_user_pages_fast() irq handling

__get_user_pages_fast() may be called with interrupts disabled (see e.g.
get_futex_key() in kernel/futex.c) and therefore should use local_irq_save()
and local_irq_restore() instead of local_irq_disable()/enable().

Signed-off-by: Heiko Carstens 
---

Please note that this patch is completely untested; not even compile
tested. I just realized that there seems to be a bug when looking at
the powerpc code ;)

 arch/powerpc/mm/gup.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/mm/gup.c b/arch/powerpc/mm/gup.c
index 6936547..c5f734e 100644
--- a/arch/powerpc/mm/gup.c
+++ b/arch/powerpc/mm/gup.c
@@ -123,6 +123,7 @@ int __get_user_pages_fast(unsigned long start, int 
nr_pages, int write,
struct mm_struct *mm = current->mm;
unsigned long addr, len, end;
unsigned long next;
+   unsigned long flags;
pgd_t *pgdp;
int nr = 0;
 
@@ -156,7 +157,7 @@ int __get_user_pages_fast(unsigned long start, int 
nr_pages, int write,
 * So long as we atomically load page table pointers versus teardown,
 * we can follow the address down to the the page and take a ref on it.
 */
-   local_irq_disable();
+   local_irq_save(flags);
 
pgdp = pgd_offset(mm, addr);
do {
@@ -179,7 +180,7 @@ int __get_user_pages_fast(unsigned long start, int 
nr_pages, int write,
break;
} while (pgdp++, addr = next, addr != end);
 
-   local_irq_enable();
+   local_irq_restore(flags);
 
return nr;
 }
-- 
1.8.3.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/


[PATCH 2/2] s390/mmap: randomize mmap base for bottom up direction

2013-10-09 Thread Heiko Carstens
Implement mmap base randomization for the bottom up direction, so ASLR works
for both mmap layouts on s390.
See also df54d6fa54 "x86 get_unmapped_area(): use proper mmap base for
bottom-up direction".

Signed-off-by: Heiko Carstens 
---
 arch/s390/mm/mmap.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c
index 4002329..7110c0f 100644
--- a/arch/s390/mm/mmap.c
+++ b/arch/s390/mm/mmap.c
@@ -64,6 +64,11 @@ static unsigned long mmap_rnd(void)
return (get_random_int() & 0x7ffUL) << PAGE_SHIFT;
 }
 
+static unsigned long mmap_base_legacy(void)
+{
+   return TASK_UNMAPPED_BASE + mmap_rnd();
+}
+
 static inline unsigned long mmap_base(void)
 {
unsigned long gap = rlimit(RLIMIT_STACK);
@@ -89,7 +94,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
 * bit is set, or if the expected stack growth is unlimited:
 */
if (mmap_is_legacy()) {
-   mm->mmap_base = TASK_UNMAPPED_BASE;
+   mm->mmap_base = mmap_base_legacy();
mm->get_unmapped_area = arch_get_unmapped_area;
} else {
mm->mmap_base = mmap_base();
@@ -172,7 +177,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
 * bit is set, or if the expected stack growth is unlimited:
 */
if (mmap_is_legacy()) {
-   mm->mmap_base = TASK_UNMAPPED_BASE;
+   mm->mmap_base = mmap_base_legacy();
mm->get_unmapped_area = s390_get_unmapped_area;
} else {
mm->mmap_base = mmap_base();
-- 
1.8.3.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/


[PATCH 1/2] mmap: arch_get_unmapped_area(): use proper mmap base for bottom up direction

2013-10-09 Thread Heiko Carstens
This is more or less the generic variant of 41aacc1eea "x86 get_unmapped_area:
Access mmap_legacy_base through mm_struct member".

So effectively architectures which use an own arch_pick_mmap_layout()
implementation but call the generic arch_get_unmapped_area() now can also
randomize their mmap_base.

All architectures which have an own arch_pick_mmap_layout() and call
the generic arch_get_unmapped_area() (arm64, s390, tile) currently set
mmap_base to TASK_UNMAPPED_BASE. This is also true for the generic
arch_pick_mmap_layout() function. So this change is a no-op currently.

Signed-off-by: Heiko Carstens 
---
 mm/mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 9d54851..fa206ab 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1872,7 +1872,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long 
addr,
 
info.flags = 0;
info.length = len;
-   info.low_limit = TASK_UNMAPPED_BASE;
+   info.low_limit = mm->mmap_base;
info.high_limit = TASK_SIZE;
info.align_mask = 0;
return vm_unmapped_area(&info);
-- 
1.8.3.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 1/3] s390: include: asm: atomic.h: use 'unsigned int' instead of 'unsigned long' for atomic_*_mask()

2013-10-10 Thread Heiko Carstens
On Thu, Oct 10, 2013 at 10:31:22AM +0800, Chen Gang wrote:
> The type of 'v->counter' is always 'int', and related inline assembly
> code also process 'int', so use 'unsigned int' instead of 'unsigned
> long' for the 'mask'.
> 
> 
> Signed-off-by: Chen Gang 
> ---
>  arch/s390/include/asm/atomic.h |4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/s390/include/asm/atomic.h b/arch/s390/include/asm/atomic.h
> index a62ed2d..12c5ec1 100644
> --- a/arch/s390/include/asm/atomic.h
> +++ b/arch/s390/include/asm/atomic.h
> @@ -113,12 +113,12 @@ static inline void atomic_add(int i, atomic_t *v)
>  #define atomic_dec_return(_v)atomic_sub_return(1, _v)
>  #define atomic_dec_and_test(_v)  (atomic_sub_return(1, _v) == 0)
> 
> -static inline void atomic_clear_mask(unsigned long mask, atomic_t *v)
> +static inline void atomic_clear_mask(unsigned int mask, atomic_t *v)
>  {

Applied. 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/


[GIT PULL] s390 updates for 3.12-rc1

2013-09-03 Thread Heiko Carstens
Hi Linus,

please pull from

  git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git for-linus

to receive the first batch of s390 updates for 3.12.

The most interesting change is that Martin converted s390 to generic hardirqs.
Which means that all current architectures have been converted and that
CONFIG_GENERIC_HARDIRQS can be removed.
Martin prepared a patch for that already (see genirq branch), but the best
time to merge that is probably at the end of the merge window / begin of -rc1.

Another patch converts s390 to software referenced bits instead of relying
on the reference bit in the storage key. Therefore s390 doesn't use storage
keys anymore, except for kvm.

Besides that we have improvements, cleanups and fixes in PCI, DASD and all
over the place.

Thanks,
Heiko

---

Heiko Carstens (6):
  s390: replace remaining strict_strtoul() with kstrtoul()
  s390/mm: remove dead pfmf inline assembly
  s390/sclp: reword cpu capability change message
  s390/bitops: fix inline assembly constraints
  s390/switch_to: fix save_access_regs() / restore_access_regs()
  s390/kprobes: add support for compare and branch instructions

Jingoo Han (1):
  s390: replace strict_strtoul() with kstrtoul()

Martin Schwidefsky (13):
  s390/airq: introduce adapter interrupt vector helper
  s390/pci: cleanup function names
  s390/pci: use adapter interrupt vector helpers
  s390: convert interrupt handling to use generic hardirq
  s390/mm: cleanup page table definitions
  s390/pgtable: skip pgste updates on full flush
  s390/pgtable: add pgste_get helper
  s390/time: clock comparator revalidation
  s390/mm: introduce ptep_flush_lazy helper
  s390/time: return with irqs disabled from psw_idle
  s390/pgtable: fix mprotect for single-threaded KVM guests
  s390/tx: allow program interruption filtering in user space
  s390/mm: implement software referenced bits

Sebastian Ott (9):
  s390/pci/hotplug: convert to be builtin only
  s390/pci: use claim_resource
  s390/pci: add recover sysfs knob
  s390/hibernate: add early resume function
  s390/pci: split lpf
  s390/pci: try harder to modify a function
  s390/pci: update function handle after resume from hibernate
  s390/cio: fix unlocked access of global bitmap
  s390/pci: use virtual memory for iommu bitmap

Stefan Weinhuber (3):
  s390/dasd: cleanup timeout and transport error messages
  s390/dasd: enable raw_track_access reads without direct I/O
  s390/dasd: fix statistics for recovered requests

 arch/s390/Kconfig   |  11 +
 arch/s390/include/asm/airq.h|  67 
 arch/s390/include/asm/bitops.h  |  12 +-
 arch/s390/include/asm/cio.h |   1 +
 arch/s390/include/asm/hardirq.h |   5 +
 arch/s390/include/asm/hugetlb.h | 135 ++--
 arch/s390/include/asm/hw_irq.h  |  17 +-
 arch/s390/include/asm/irq.h |  35 +-
 arch/s390/include/asm/mmu_context.h |   3 +-
 arch/s390/include/asm/page.h|  19 --
 arch/s390/include/asm/pci.h |  54 ++-
 arch/s390/include/asm/pci_insn.h|  12 +-
 arch/s390/include/asm/pci_io.h  |  10 +-
 arch/s390/include/asm/pgtable.h | 637 +++-
 arch/s390/include/asm/serial.h  |   6 +
 arch/s390/include/asm/switch_to.h   |   9 +-
 arch/s390/include/asm/tlb.h |   3 +-
 arch/s390/include/asm/tlbflush.h|   6 +-
 arch/s390/kernel/entry.S|  16 +-
 arch/s390/kernel/entry64.S  |  11 +-
 arch/s390/kernel/irq.c  | 160 -
 arch/s390/kernel/kprobes.c  |  21 +-
 arch/s390/kernel/nmi.c  |   5 +-
 arch/s390/kernel/process.c  |   1 +
 arch/s390/kernel/ptrace.c   |   8 +-
 arch/s390/kernel/suspend.c  |  11 +
 arch/s390/kernel/swsusp_asm64.S |   7 +-
 arch/s390/kernel/time.c |   1 -
 arch/s390/kernel/vdso.c |   6 +-
 arch/s390/lib/delay.c   |   2 -
 arch/s390/lib/uaccess_pt.c  |  16 +-
 arch/s390/mm/dump_pagetables.c  |  18 +-
 arch/s390/mm/gup.c  |   6 +-
 arch/s390/mm/hugetlbpage.c  | 124 ++-
 arch/s390/mm/pageattr.c |   2 +-
 arch/s390/mm/pgtable.c  |  83 +++--
 arch/s390/mm/vmem.c |  15 +-
 arch/s390/pci/Makefile  |   2 +-
 arch/s390/pci/pci.c | 575 +---
 arch/s390/pci/pci_clp.c | 146 ++---
 arch/s390/pci/pci_dma.c |  16 +-
 arch/s390/pci/pci_event.c   |   2 +-
 arch/s390/pci/pci_insn.c|  18 +-
 arch/s390/pci/pci_msi.c | 142 
 arch/s390/pci/pci_sysfs.c   |  27 ++
 drivers/pci/hotplug/Kconfig |   2 +-
 drivers/pci/hotplug/s390_pci_hpc.c  |  63 +---
 drivers/s390/block/dasd_devmap.c|   8 +-
 drivers/s390/block/dasd_eckd.c  |  54 ++-
 drivers/s390/block/dasd_erp.c   

[PATCH 1/3] mutex,spinlock: rename arch_mutex_cpu_relax() to cpu_relax_simple()

2013-09-27 Thread Heiko Carstens
s390 needs a special version of cpu_relax() for the new lockref code.
The new variant should be a no-op but also have memory barrier semantics,
since that is what the default cpu_relax() variant implements.

Actually s390 had the same problem already in the past where we implemented
arch_mutex_cpu_relax() for nearly the same reason within the common mutex
code.
So before we end up adding a special arch_lockref_cpu_relax() variant which
would only differ in the name from arch_mutex_cpu_relax(), rename the
current arch_mutex_cpu_relax() variant to a more general cpu_relax_simple(),
which can be used also in the lockref code.

Signed-off-by: Heiko Carstens 
---
 arch/Kconfig  | 2 +-
 arch/s390/Kconfig | 2 +-
 arch/s390/include/asm/mutex.h | 2 --
 arch/s390/include/asm/processor.h | 2 ++
 include/linux/mutex.h | 4 
 include/linux/spinlock_up.h   | 4 
 kernel/mutex.c| 8 
 7 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 1feb169..74069bd 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -286,7 +286,7 @@ config HAVE_PERF_USER_STACK_DUMP
 config HAVE_ARCH_JUMP_LABEL
bool
 
-config HAVE_ARCH_MUTEX_CPU_RELAX
+config HAVE_CPU_RELAX_SIMPLE
bool
 
 config HAVE_RCU_TABLE_FREE
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index dcc6ac2..9789282 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -102,13 +102,13 @@ config S390
select GENERIC_TIME_VSYSCALL_OLD
select HAVE_ALIGNED_STRUCT_PAGE if SLUB
select HAVE_ARCH_JUMP_LABEL if !MARCH_G5
-   select HAVE_ARCH_MUTEX_CPU_RELAX
select HAVE_ARCH_SECCOMP_FILTER
select HAVE_ARCH_TRACEHOOK
select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT
select HAVE_BPF_JIT if 64BIT && PACK_STACK
select HAVE_CMPXCHG_DOUBLE
select HAVE_CMPXCHG_LOCAL
+   select HAVE_CPU_RELAX_SIMPLE
select HAVE_C_RECORDMCOUNT
select HAVE_DEBUG_KMEMLEAK
select HAVE_DYNAMIC_FTRACE
diff --git a/arch/s390/include/asm/mutex.h b/arch/s390/include/asm/mutex.h
index 688271f..458c1f7 100644
--- a/arch/s390/include/asm/mutex.h
+++ b/arch/s390/include/asm/mutex.h
@@ -7,5 +7,3 @@
  */
 
 #include 
-
-#define arch_mutex_cpu_relax() barrier()
diff --git a/arch/s390/include/asm/processor.h 
b/arch/s390/include/asm/processor.h
index 0eb3750..338a488 100644
--- a/arch/s390/include/asm/processor.h
+++ b/arch/s390/include/asm/processor.h
@@ -198,6 +198,8 @@ static inline void cpu_relax(void)
barrier();
 }
 
+#define cpu_relax_simple() barrier()
+
 static inline void psw_set_key(unsigned int key)
 {
asm volatile("spka 0(%0)" : : "d" (key));
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index ccd4260..084f799 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -175,8 +175,4 @@ extern void mutex_unlock(struct mutex *lock);
 
 extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);
 
-#ifndef CONFIG_HAVE_ARCH_MUTEX_CPU_RELAX
-#define arch_mutex_cpu_relax() cpu_relax()
-#endif
-
 #endif
diff --git a/include/linux/spinlock_up.h b/include/linux/spinlock_up.h
index 8b3ac0d..7e1cc42 100644
--- a/include/linux/spinlock_up.h
+++ b/include/linux/spinlock_up.h
@@ -7,6 +7,10 @@
 
 #include  /* for cpu_relax() */
 
+#ifndef CONFIG_HAVE_CPU_RELAX_SIMPLE
+#define cpu_relax_simple() cpu_relax()
+#endif
+
 /*
  * include/linux/spinlock_up.h - UP-debug version of spinlocks.
  *
diff --git a/kernel/mutex.c b/kernel/mutex.c
index 6d647ae..e0ce0da2 100644
--- a/kernel/mutex.c
+++ b/kernel/mutex.c
@@ -139,7 +139,7 @@ void mspin_lock(struct mspin_node **lock, struct mspin_node 
*node)
smp_wmb();
/* Wait until the lock holder passes the lock down */
while (!ACCESS_ONCE(node->locked))
-   arch_mutex_cpu_relax();
+   cpu_relax_simple();
 }
 
 static void mspin_unlock(struct mspin_node **lock, struct mspin_node *node)
@@ -154,7 +154,7 @@ static void mspin_unlock(struct mspin_node **lock, struct 
mspin_node *node)
return;
/* Wait until the next pointer is set */
while (!(next = ACCESS_ONCE(node->next)))
-   arch_mutex_cpu_relax();
+   cpu_relax_simple();
}
ACCESS_ONCE(next->locked) = 1;
smp_wmb();
@@ -192,7 +192,7 @@ int mutex_spin_on_owner(struct mutex *lock, struct 
task_struct *owner)
if (need_resched())
break;
 
-   arch_mutex_cpu_relax();
+   cpu_relax_simple();
}
rcu_read_unlock();
 
@@ -509,7 +509,7 @@ __mutex_lock_common(struct mutex *lock, long state, 
unsigned int subclass,
 * memory barriers as we'll eventually observe the right
 * values at the cost of a few extra spins.
  

[PATCH 0/3] changes to enable lockless lockref on s390

2013-09-27 Thread Heiko Carstens
Hi all,

enabling the new lockless lockref variant on s390 would have been trivial
until Tony Luck added a cpu_relax() call into the CMPXCHG_LOOP(), with
d472d9d9 "lockref: Relax in cmpxchg loop".

As already mentioned cpu_relax() is very expensive on s390 since it yields()
the current virtual cpu. So we are talking of several thousand cycles.
Considering this enabling the lockless lockref variant would contradict the
intention of the new semantics. And also some quick measurements show
performance regressions of 50% and more.

Simply removing the cpu_relax() call again seems also not very desireable
since Waiman Long reported that for some workloads the call improved
performance by 5%.

So let's go for a special cpu_relax() variant which can be overridden by
architectures. We have already an arch_mutex_cpu_relax() variant for the
very same purpose, but especially for mutexes.
Since I wouldn't like to add yet another cpu_relax() variant, e.g.
"arch_lockref_cpu_relax()", rename the already present variant to
cpu_relax_simple(), which can be used for both, mutexes and lockrefs.

Not sure if it would make sense to add a new "linux/processor.h"
include file which includes "asm/processor.h", since there doesn't seem to
be a common file where it is guaranteed that cpu_relax() is available.

I simply added the cpu_relax_simple() define to "linux/spinlock_up.h"
since that one explicitly includes "asm/processor.h" because of cpu_relax().

Heiko Carstens (3):
  mutex,spinlock: rename arch_mutex_cpu_relax() to cpu_relax_simple()
  lockref: use cpu_relax_simple()
  s390: enable ARCH_USE_CMPXCHG_LOCKREF

 arch/Kconfig  | 2 +-
 arch/s390/Kconfig | 3 ++-
 arch/s390/include/asm/mutex.h | 2 --
 arch/s390/include/asm/processor.h | 2 ++
 arch/s390/include/asm/spinlock.h  | 5 +
 include/linux/mutex.h | 4 
 include/linux/spinlock_up.h   | 4 
 kernel/mutex.c| 8 
 lib/lockref.c | 2 +-
 9 files changed, 19 insertions(+), 13 deletions(-)

-- 
1.8.3.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/


[PATCH 2/3] lockref: use cpu_relax_simple()

2013-09-27 Thread Heiko Carstens
Make use of cpu_relax_simple() so architectures can override the default
cpu_relax() semantics.
This is especially useful for s390, where cpu_relax() means that the we
yield() the current (virtual) cpu and therefore is very expensive.

Signed-off-by: Heiko Carstens 
---
 lib/lockref.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/lockref.c b/lib/lockref.c
index 677d036..1a00c33 100644
--- a/lib/lockref.c
+++ b/lib/lockref.c
@@ -19,7 +19,7 @@
if (likely(old.lock_count == prev.lock_count)) {
\
SUCCESS;
\
}   
\
-   cpu_relax();
\
+   cpu_relax_simple(); 
\
}   
\
 } while (0)
 
-- 
1.8.3.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/


[PATCH 3/3] s390: enable ARCH_USE_CMPXCHG_LOCKREF

2013-09-27 Thread Heiko Carstens
Enable ARCH_USE_CMPXCHG_LOCKREF for 64 bit since it shows performance
improvements with Linus' simple stat() test case of up to 50% on a
30 cpu system.

Signed-off-by: Heiko Carstens 
---
 arch/s390/Kconfig| 1 +
 arch/s390/include/asm/spinlock.h | 5 +
 2 files changed, 6 insertions(+)

diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 9789282..6651695 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -93,6 +93,7 @@ config S390
select ARCH_INLINE_WRITE_UNLOCK_IRQ
select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE
select ARCH_SAVE_PAGE_KEYS if HIBERNATION
+   select ARCH_USE_CMPXCHG_LOCKREF
select ARCH_WANT_IPC_PARSE_VERSION
select BUILDTIME_EXTABLE_SORT
select CLONE_BACKWARDS2
diff --git a/arch/s390/include/asm/spinlock.h b/arch/s390/include/asm/spinlock.h
index 701fe8c..83e5d216 100644
--- a/arch/s390/include/asm/spinlock.h
+++ b/arch/s390/include/asm/spinlock.h
@@ -44,6 +44,11 @@ extern void arch_spin_lock_wait_flags(arch_spinlock_t *, 
unsigned long flags);
 extern int arch_spin_trylock_retry(arch_spinlock_t *);
 extern void arch_spin_relax(arch_spinlock_t *lock);
 
+static inline int arch_spin_value_unlocked(arch_spinlock_t lock)
+{
+   return lock.owner_cpu == 0;
+}
+
 static inline void arch_spin_lock(arch_spinlock_t *lp)
 {
int old;
-- 
1.8.3.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/


[PATCH v2 1/3] mutex: replace CONFIG_HAVE_ARCH_MUTEX_CPU_RELAX with simple ifdef

2013-09-28 Thread Heiko Carstens
Linus suggested to replace

 #ifndef CONFIG_HAVE_ARCH_MUTEX_CPU_RELAX
 #define arch_mutex_cpu_relax() cpu_relax()
 #endif

with just a simple

  #ifndef arch_mutex_cpu_relax
  # define arch_mutex_cpu_relax() cpu_relax()
  #endif

to get rid of CONFIG_HAVE_CPU_RELAX_SIMPLE. So architectures can
simply define arch_mutex_cpu_relax if they want an architecture
specific function instead of having to add a select statement in
their Kconfig in addition.

Suggested-by: Linus Torvalds 
Signed-off-by: Heiko Carstens 
---
 arch/Kconfig  | 3 ---
 arch/s390/Kconfig | 1 -
 arch/s390/include/asm/mutex.h | 2 --
 arch/s390/include/asm/processor.h | 2 ++
 include/linux/mutex.h | 6 +++---
 5 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 1feb169..af2cc6e 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -286,9 +286,6 @@ config HAVE_PERF_USER_STACK_DUMP
 config HAVE_ARCH_JUMP_LABEL
bool
 
-config HAVE_ARCH_MUTEX_CPU_RELAX
-   bool
-
 config HAVE_RCU_TABLE_FREE
bool
 
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index dcc6ac2..d3fa840 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -102,7 +102,6 @@ config S390
select GENERIC_TIME_VSYSCALL_OLD
select HAVE_ALIGNED_STRUCT_PAGE if SLUB
select HAVE_ARCH_JUMP_LABEL if !MARCH_G5
-   select HAVE_ARCH_MUTEX_CPU_RELAX
select HAVE_ARCH_SECCOMP_FILTER
select HAVE_ARCH_TRACEHOOK
select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT
diff --git a/arch/s390/include/asm/mutex.h b/arch/s390/include/asm/mutex.h
index 688271f..458c1f7 100644
--- a/arch/s390/include/asm/mutex.h
+++ b/arch/s390/include/asm/mutex.h
@@ -7,5 +7,3 @@
  */
 
 #include 
-
-#define arch_mutex_cpu_relax() barrier()
diff --git a/arch/s390/include/asm/processor.h 
b/arch/s390/include/asm/processor.h
index 0eb3750..ca7821f 100644
--- a/arch/s390/include/asm/processor.h
+++ b/arch/s390/include/asm/processor.h
@@ -198,6 +198,8 @@ static inline void cpu_relax(void)
barrier();
 }
 
+#define arch_mutex_cpu_relax()  barrier()
+
 static inline void psw_set_key(unsigned int key)
 {
asm volatile("spka 0(%0)" : : "d" (key));
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index ccd4260..bab49da 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -15,8 +15,8 @@
 #include 
 #include 
 #include 
-
 #include 
+#include 
 
 /*
  * Simple, straightforward mutexes with strict semantics:
@@ -175,8 +175,8 @@ extern void mutex_unlock(struct mutex *lock);
 
 extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);
 
-#ifndef CONFIG_HAVE_ARCH_MUTEX_CPU_RELAX
-#define arch_mutex_cpu_relax() cpu_relax()
+#ifndef arch_mutex_cpu_relax
+# define arch_mutex_cpu_relax() cpu_relax()
 #endif
 
 #endif
-- 
1.8.3.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/


[PATCH v2 0/3] changes to enable lockless lockref on s390

2013-09-28 Thread Heiko Carstens
Hi Linus,

I just updated the patch set to include your suggested changes.

You can also pull the three patches from

  git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git lockref

Original part of description that still matters:

enabling the new lockless lockref variant on s390 would have been trivial
until Tony Luck added a cpu_relax() call into the CMPXCHG_LOOP(), with
d472d9d9 "lockref: Relax in cmpxchg loop".

As already mentioned cpu_relax() is very expensive on s390 since it yields()
the current virtual cpu. So we are talking of several thousand cycles.
Considering this enabling the lockless lockref variant would contradict the
intention of the new semantics. And also some quick measurements show
performance regressions of 50% and more.

Simply removing the cpu_relax() call again seems also not very desireable
since Waiman Long reported that for some workloads the call improved
performance by 5%.

Heiko Carstens (3):
  mutex: replace CONFIG_HAVE_ARCH_MUTEX_CPU_RELAX with simple ifdef
  lockref: use arch_mutex_cpu_relax() in CMPXCHG_LOOP()
  s390: enable ARCH_USE_CMPXCHG_LOCKREF

 arch/Kconfig  |  3 ---
 arch/s390/Kconfig |  2 +-
 arch/s390/include/asm/mutex.h |  2 --
 arch/s390/include/asm/processor.h |  2 ++
 arch/s390/include/asm/spinlock.h  |  5 +
 include/linux/mutex.h |  6 +++---
 lib/lockref.c | 10 +-
 7 files changed, 20 insertions(+), 10 deletions(-)

-- 
1.8.3.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/


[PATCH v2 2/3] lockref: use arch_mutex_cpu_relax() in CMPXCHG_LOOP()

2013-09-28 Thread Heiko Carstens
Make use of arch_mutex_cpu_relax() so architectures can override the
default cpu_relax() semantics.
This is especially useful for s390, where cpu_relax() means that we
yield() the current (virtual) cpu and therefore is very expensive,
and would contradict the whole purpose of the lockless cmpxchg loop.

Signed-off-by: Heiko Carstens 
---
 lib/lockref.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/lockref.c b/lib/lockref.c
index e294ae4..6f9d434 100644
--- a/lib/lockref.c
+++ b/lib/lockref.c
@@ -12,6 +12,14 @@
 #endif
 
 /*
+ * Allow architectures to override the default cpu_relax() within CMPXCHG_LOOP.
+ * This is useful for architectures with an expensive cpu_relax().
+ */
+#ifndef arch_mutex_cpu_relax
+# define arch_mutex_cpu_relax() cpu_relax()
+#endif
+
+/*
  * Note that the "cmpxchg()" reloads the "old" value for the
  * failure case.
  */
@@ -28,7 +36,7 @@
if (likely(old.lock_count == prev.lock_count)) {
\
SUCCESS;
\
}   
\
-   cpu_relax();
\
+   arch_mutex_cpu_relax(); 
\
}   
\
 } while (0)
 
-- 
1.8.3.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/


[PATCH v2 3/3] s390: enable ARCH_USE_CMPXCHG_LOCKREF

2013-09-28 Thread Heiko Carstens
Enable ARCH_USE_CMPXCHG_LOCKREF since it shows performance improvements
with Linus' simple stat() test case of up to 50% on a 30 cpu system.

Signed-off-by: Heiko Carstens 
---
 arch/s390/Kconfig| 1 +
 arch/s390/include/asm/spinlock.h | 5 +
 2 files changed, 6 insertions(+)

diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index d3fa840..7143793 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -93,6 +93,7 @@ config S390
select ARCH_INLINE_WRITE_UNLOCK_IRQ
select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE
select ARCH_SAVE_PAGE_KEYS if HIBERNATION
+   select ARCH_USE_CMPXCHG_LOCKREF
select ARCH_WANT_IPC_PARSE_VERSION
select BUILDTIME_EXTABLE_SORT
select CLONE_BACKWARDS2
diff --git a/arch/s390/include/asm/spinlock.h b/arch/s390/include/asm/spinlock.h
index 701fe8c..83e5d216 100644
--- a/arch/s390/include/asm/spinlock.h
+++ b/arch/s390/include/asm/spinlock.h
@@ -44,6 +44,11 @@ extern void arch_spin_lock_wait_flags(arch_spinlock_t *, 
unsigned long flags);
 extern int arch_spin_trylock_retry(arch_spinlock_t *);
 extern void arch_spin_relax(arch_spinlock_t *lock);
 
+static inline int arch_spin_value_unlocked(arch_spinlock_t lock)
+{
+   return lock.owner_cpu == 0;
+}
+
 static inline void arch_spin_lock(arch_spinlock_t *lp)
 {
int old;
-- 
1.8.3.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/


[PATCH 2/2] checksyscalls: ignore kcmp system call

2012-09-07 Thread Heiko Carstens
Now that the checksyscalls script works again it will warn about the missing
"kcmp" system call on all architectures but x86.
Since according to git commit d97b46a6 "syscalls, x86: add __NR_kcmp syscall"
only x86 is currently supported don't emit any warning for this system call.

Cc: Cyrill Gorcunov 
Cc: Michal Marek 
Cc: H. Peter Anvin 
Signed-off-by: Heiko Carstens 
---
 scripts/checksyscalls.sh |3 +++
 1 file changed, 3 insertions(+)

diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
index fd8fa9a..c7cda79 100755
--- a/scripts/checksyscalls.sh
+++ b/scripts/checksyscalls.sh
@@ -194,6 +194,9 @@ cat << EOF
 #define __IGNORE_getpmsg
 #define __IGNORE_putpmsg
 #define __IGNORE_vserver
+
+/* kcmp is currently x86 only */
+#define __IGNORE_kcmp
 EOF
 }
 
-- 
1.7.10.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/


[PATCH 1/2] checksyscalls: fix "here document" handling

2012-09-07 Thread Heiko Carstens
"echo" doesn't read from stdin, therefore the checksyscalls script didn't warn
about not implemented system calls anymore since 29dc54c6 "checksyscalls: Use
arch/x86/syscalls/syscall_32.tbl as source".

Use "cat" instead of "echo" which handles this correctly.

Cc: Michal Marek 
Cc: H. Peter Anvin 
Signed-off-by: Heiko Carstens 
---
 scripts/checksyscalls.sh |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
index d24810f..fd8fa9a 100755
--- a/scripts/checksyscalls.sh
+++ b/scripts/checksyscalls.sh
@@ -200,7 +200,7 @@ EOF
 syscall_list() {
 grep '^[0-9]' "$1" | sort -n | (
while read nr abi name entry ; do
-   echo <http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] samples/seccomp: fix 31 bit build on s390

2012-09-08 Thread Heiko Carstens
>From cea999ef4e68e23c70e64baf054768bdebe15e1b Mon Sep 17 00:00:00 2001
From: Heiko Carstens 
Date: Sat, 8 Sep 2012 10:23:42 +0200
Subject: [PATCH] samples/seccomp: fix 31 bit build on s390

On s390 the flag to force 31 builds is -m31 instead of -m32 unlike
on all (?) other architectures.

Fixes this compile error:

  HOSTCC  samples/seccomp/bpf-direct.o
cc1: error: unrecognized command line option "-m32"
make[2]: *** [samples/seccomp/bpf-direct.o] Error 1

Signed-off-by: Heiko Carstens 
---

Patch is on top of linux-next of today.

 samples/seccomp/Makefile | 24 
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/samples/seccomp/Makefile b/samples/seccomp/Makefile
index 16aa2d4..bbbd276 100644
--- a/samples/seccomp/Makefile
+++ b/samples/seccomp/Makefile
@@ -18,14 +18,22 @@ HOSTCFLAGS_bpf-direct.o += -idirafter $(objtree)/include
 bpf-direct-objs := bpf-direct.o
 
 # Try to match the kernel target.
-ifeq ($(CONFIG_64BIT),)
-HOSTCFLAGS_bpf-direct.o += -m32
-HOSTCFLAGS_dropper.o += -m32
-HOSTCFLAGS_bpf-helper.o += -m32
-HOSTCFLAGS_bpf-fancy.o += -m32
-HOSTLOADLIBES_bpf-direct += -m32
-HOSTLOADLIBES_bpf-fancy += -m32
-HOSTLOADLIBES_dropper += -m32
+ifndef CONFIG_64BIT
+
+# s390 has -m31 flag to build 31 bit binaries
+ifndef CONFIG_S390
+MFLAG = -m32
+else
+MFLAG = -m31
+endif
+
+HOSTCFLAGS_bpf-direct.o += $(MFLAG)
+HOSTCFLAGS_dropper.o += $(MFLAG)
+HOSTCFLAGS_bpf-helper.o += $(MFLAG)
+HOSTCFLAGS_bpf-fancy.o += $(MFLAG)
+HOSTLOADLIBES_bpf-direct += $(MFLAG)
+HOSTLOADLIBES_bpf-fancy += $(MFLAG)
+HOSTLOADLIBES_dropper += $(MFLAG)
 endif
 
 # Tell kbuild to always build the programs
-- 
1.7.11.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: [ 15/20] s390/mm: have 16 byte aligned struct pages

2012-12-07 Thread Heiko Carstens
On Thu, Dec 06, 2012 at 04:54:30PM -0800, Greg Kroah-Hartman wrote:
> 3.4-stable review patch.  If anyone has any objections, please let me know.
> 
> --
> 
> From: Heiko Carstens 
> 
> commit 4bffbb3455372a26816e364fb4448810f7014452 upstream.
> 
> Select HAVE_ALIGNED_STRUCT_PAGE on s390, so that the slub allocator can make
> use of compare and swap double for lockless updates. This increases the size

The s390 implementation of compare and swap and double was merged for 3.7:
b1d6b40c "s390/cmpxchg,percpu: implement cmpxchg_double()".
It is not part of 3.4. So putting this into stable makes not much sense.

> of struct page to 64 bytes (instead of 56 bytes), however the performance gain
> justifies the increased size:
> 
> - now excactly four struct pages fit into a single cache line; the
>   case that accessing a struct page causes two cache line loads
>   does not exist anymore.
> - calculating the offset of a struct page within the memmap array
>   is only a simple shift instead of a more expensive multiplication.

This is obviously still true, but I've made no measurements if we still
see any (significant) performance gain if the slub allocator doesn't make
use of compare and swap double or if it's just a waste of memory.

So I'd prefer to not have this patch in stable.

> A "hackbench 200 process 200" run on a 32 cpu system did show an 8% runtime
> improvement.
> 
> Signed-off-by: Heiko Carstens 
> Signed-off-by: Martin Schwidefsky 
> Signed-off-by: CAI Qian 
> Signed-off-by: Greg Kroah-Hartman 
> 
> ---
>  arch/s390/Kconfig |1 +
>  1 file changed, 1 insertion(+)
> 
> --- a/arch/s390/Kconfig
> +++ b/arch/s390/Kconfig
> @@ -93,6 +93,7 @@ config S390
>   select ARCH_SAVE_PAGE_KEYS if HIBERNATION
>   select HAVE_MEMBLOCK
>   select HAVE_MEMBLOCK_NODE_MAP
> + select HAVE_ALIGNED_STRUCT_PAGE if SLUB
>   select ARCH_DISCARD_MEMBLOCK
>   select ARCH_INLINE_SPIN_TRYLOCK
>   select ARCH_INLINE_SPIN_TRYLOCK_BH

--
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: [ 20/27] s390/mm: have 16 byte aligned struct pages

2012-12-07 Thread Heiko Carstens
On Thu, Dec 06, 2012 at 04:59:04PM -0800, Greg Kroah-Hartman wrote:
> 3.6-stable review patch.  If anyone has any objections, please let me know.
> 
> --
> 
> From: Heiko Carstens 
> 
> commit 4bffbb3455372a26816e364fb4448810f7014452 upstream.
> 
> Select HAVE_ALIGNED_STRUCT_PAGE on s390, so that the slub allocator can make
> use of compare and swap double for lockless updates. This increases the size
> of struct page to 64 bytes (instead of 56 bytes), however the performance gain
> justifies the increased size:
> 
> - now excactly four struct pages fit into a single cache line; the
>   case that accessing a struct page causes two cache line loads
>   does not exist anymore.
> - calculating the offset of a struct page within the memmap array
>   is only a simple shift instead of a more expensive multiplication.
> 
> A "hackbench 200 process 200" run on a 32 cpu system did show an 8% runtime
> improvement.
> 
> Signed-off-by: Heiko Carstens 
> Signed-off-by: Martin Schwidefsky 
> Signed-off-by: CAI Qian 
> Signed-off-by: Greg Kroah-Hartman 

Same as for 3.4: compare and swap double is not available for 3.6 on s390.

--
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 037/104] arch/s390: remove depends on CONFIG_EXPERIMENTAL

2012-11-06 Thread Heiko Carstens
On Mon, Nov 05, 2012 at 03:03:54PM -0800, Kees Cook wrote:
> The CONFIG_EXPERIMENTAL config item has not carried much meaning for a
> while now and is almost always enabled by default. As agreed during the
> Linux kernel summit, remove it from any "depends on" lines in Kconfigs.
> 
> CC: Martin Schwidefsky 
> CC: Heiko Carstens 
> Signed-off-by: Kees Cook 
> ---
>  arch/s390/Kconfig |4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
> index 5dba755..3c8a70e 100644
> --- a/arch/s390/Kconfig
> +++ b/arch/s390/Kconfig
> @@ -659,8 +659,8 @@ source "arch/s390/kvm/Kconfig"
> 
>  config S390_GUEST
>   def_bool y
> - prompt "s390 support for virtio devices (EXPERIMENTAL)"
> - depends on 64BIT && EXPERIMENTAL
> + prompt "s390 support for virtio devices"
> +     depends on 64BIT
>   select VIRTUALIZATION
>   select VIRTIO
>   select VIRTIO_CONSOLE

Acked-by: Heiko Carstens 

--
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] f2fs: add missing pretech.h include

2012-12-27 Thread Heiko Carstens
>From aa027f06dfb5b2fd27d6f92391d8340df671e82b Mon Sep 17 00:00:00 2001
From: Heiko Carstens 
Date: Thu, 27 Dec 2012 15:22:27 +0100
Subject: [PATCH] f2fs: add missing pretech.h include

Fix these compile errors on s390:

fs/f2fs/data.c: In function 'read_end_io':
fs/f2fs/data.c:311:4: error: implicit declaration of function 'prefetchw' 
[-Werror=implicit-function-declaration]
fs/f2fs/segment.c: In function 'f2fs_end_io_write':
fs/f2fs/segment.c:628:4: error: implicit declaration of function 'prefetchw' 
[-Werror=implicit-function-declaration]

Signed-off-by: Heiko Carstens 
---
 fs/f2fs/data.c| 1 +
 fs/f2fs/segment.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 655aeab..f5d2c62 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 1b26e4e..cc28975 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "f2fs.h"
-- 
1.7.12.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] f2fs: add missing pretech.h include

2012-12-27 Thread Heiko Carstens
On Thu, Dec 27, 2012 at 03:30:32PM +0100, Heiko Carstens wrote:
> From aa027f06dfb5b2fd27d6f92391d8340df671e82b Mon Sep 17 00:00:00 2001
> From: Heiko Carstens 
> Date: Thu, 27 Dec 2012 15:22:27 +0100
> Subject: [PATCH] f2fs: add missing pretech.h include

That should have been "prefetch.h", obviously...
At least the patch is correct.

--
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: [BUG][s390x] mm: system crashed

2013-04-18 Thread Heiko Carstens
On Thu, Apr 18, 2013 at 02:27:45AM -0400, Zhouping Liu wrote:
> Hello Heiko,
> > If you have some time, could you please repeat your test with the kernel
> > command line option " user_mode=home "?
> 
> I tested the system with the kernel parameter, but the issue still appeared,
> I just to say it takes longer time to reproduce the issue than the before.
> 
> > 
> > As far as I can tell there was only one s390 patch merged that was
> > mmap related: 486c0a0bc80d370471b21662bf03f04fbb37cdc6 "s390/mm: Fix crst
> > upgrade of mmap with MAP_FIXED".
> 
> also I tested the revert commit, unluckily, the same issue as the before.

Ok, thanks for verifying! I'll look into it; hopefully I can reproduce it
here as well.

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 3/9] s390: Replace weird use of PTR_RET.

2013-06-16 Thread Heiko Carstens
On Sun, Jun 16, 2013 at 02:12:42PM +0930, Rusty Russell wrote:
> Saves repeating "(void __force *)__uptr" but it's less clear.  Using
> the output of PTR_RET() to determine the error rather than just
> testing IS_ERR() is odd.

Ok, if it's confusing I won't mind if it gets changed. I intended to
keep the code as short as possible, but.. ;)

> For example, I *assume* __gptr_to_uptr() never returns NULL?  Because
> the __ret would be 0 for the old code.  The new version is clearer, IMHO:
> it would try to get_user() on that address.

__gptr_to_uptr() could return 0 and it's not an error case. In that case
it should indeed try a to get_user() on that address.

> If you hate this variant, I can just s/PTR_RET/PTR_ERR_OR_ZERO/ instead.

Your patch is fine.

> Cc: Heiko Carstens 
> Cc: Christian Borntraeger 
> Cc: Martin Schwidefsky 
> Signed-off-by: Rusty Russell 
> ---
>  arch/s390/kvm/gaccess.h | 12 ++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)

Acked-by: Heiko Carstens 

--
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: [GIT PULL] s390 patches for the 3.10-rc6

2013-06-18 Thread Heiko Carstens
On Tue, Jun 18, 2013 at 12:08:51PM +0200, Geert Uytterhoeven wrote:
> On Thu, Jun 13, 2013 at 4:47 PM, Martin Schwidefsky
> allnoconfig:
> 
> arch/s390/kernel/irq.c:315:6: error: expected identifier or '(' before 
> '__asm__'
> http://kisskb.ellerman.id.au/kisskb/buildresult/8987667/
> 
> The function is expanded to:
> 
> void __asm__ __volatile__("": : :"memory")
> {
> 
> }
> 
> include/linux/hardirq.h: # define synchronize_irq(irq)   barrier()
> include/linux/compiler-gcc.h: #define barrier() __asm__
> __volatile__("": : :"memory")
> 
> Turning synchronize_irq() into a static inline function doesn't help as then
> it becomes a redefinition.

We received a patch from Ben which fixes this:

>From 7bf4da5763f30823b4eeb4c82f8499ffe2f475ab Mon Sep 17 00:00:00 2001
From: Ben Hutchings 
Date: Fri, 14 Jun 2013 01:18:44 +0100
Subject: [PATCH] s390/irq: Only define synchronize_irq() on SMP

In uniprocessor configurations, synchronize_irq() is defined in
 as a macro, and this function definition fails to
compile.

Reported-by: kbuild test robot 
Signed-off-by: Ben Hutchings 
Cc: sta...@vger.kernel.org # 3.9
Signed-off-by: Heiko Carstens 
Signed-off-by: Martin Schwidefsky 
---
 arch/s390/kernel/irq.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index 408e866..dd3c199 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -312,6 +312,7 @@ void measurement_alert_subclass_unregister(void)
 }
 EXPORT_SYMBOL(measurement_alert_subclass_unregister);
 
+#ifdef CONFIG_SMP
 void synchronize_irq(unsigned int irq)
 {
/*
@@ -320,6 +321,7 @@ void synchronize_irq(unsigned int irq)
 */
 }
 EXPORT_SYMBOL_GPL(synchronize_irq);
+#endif
 
 #ifndef CONFIG_PCI
 
-- 
1.8.2.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] arch: s390: kernel: reset 'c->hotpluggable' when failure occurs

2013-06-24 Thread Heiko Carstens
On Tue, Jun 25, 2013 at 09:46:45AM +0800, Chen Gang wrote:
> When smp_add_present_cpu() fails, it has reset all things excluding
> 'c->hotpluggable', so need reset it as original state completely.
> 
> Signed-off-by: Chen Gang 
> ---
>  arch/s390/kernel/smp.c |1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
> index 15a016c..c4c6f42 100644
> --- a/arch/s390/kernel/smp.c
> +++ b/arch/s390/kernel/smp.c
> @@ -1016,6 +1016,7 @@ out_cpu:
>   unregister_cpu(c);
>  #endif
>  out:
> + c->hotpluggable = 0;
>   return rc;

No, that doesn't make sense. All cpus on s390 are always hotplugable.
It really doesn't matter if the value of this field is 0 or 1 after
an error.

--
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] arch: s390: kernel: reset 'c->hotpluggable' when failure occurs

2013-06-25 Thread Heiko Carstens
On Tue, Jun 25, 2013 at 03:24:09PM +0800, Chen Gang wrote:
> On 06/25/2013 02:48 PM, Heiko Carstens wrote:
> > On Tue, Jun 25, 2013 at 09:46:45AM +0800, Chen Gang wrote:
> >> > When smp_add_present_cpu() fails, it has reset all things excluding
> >> > 'c->hotpluggable', so need reset it as original state completely.
> >> > 
> >> > +c->hotpluggable = 0;
> >> >  return rc;
> > No, that doesn't make sense. All cpus on s390 are always hotplugable.
> > It really doesn't matter if the value of this field is 0 or 1 after
> > an error.
> > 
> 
> If so, is it better to set 'c->hotpluggable' for all cpus on s390 during
> initializing ?

No, just leave the code as it is.

--
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] arch: asm-generic: for atomic_set_mask() 1st param, use 'unsigned int' instead of 'unsigned long'

2013-06-10 Thread Heiko Carstens
On Sun, Jun 09, 2013 at 02:31:42PM +0800, Chen Gang wrote:
> 
> atomic_set_mask() and atomic_clear_mask() are the pairs, so the related
> parameters' type need match with each other.
> 
> The type of 'addr->counter' is 'int', so use 'unsigned int' instead
> of 'unsigned long', and let atomic_set_mask() match atomic_clear_mask().
> 
> 
> For arch sub-system, currently, have 3 types of definition for them:
> 1st for 'int', 2nd for 'long', 3rd is conflict to use 'int' and 'long'.
> 
> At least, better to fix 3rd (conflict using 'int' and 'long').
> 
> Signed-off-by: Chen Gang 
> ---
>  arch/blackfin/include/asm/atomic.h |4 ++--
>  arch/m32r/include/asm/atomic.h |8 
>  arch/s390/include/asm/atomic.h |4 ++--
>  include/asm-generic/atomic.h   |2 +-
>  4 files changed, 9 insertions(+), 9 deletions(-)

For the s390 part:

Acked-by: Heiko Carstens 

--
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] s390/ap: Cocci spatch "ptr_ret.spatch"

2013-06-10 Thread Heiko Carstens
On Sat, Jun 01, 2013 at 11:51:13AM +0200, Thomas Meyer wrote:
> 
> Signed-off-by: Thomas Meyer 
> ---
> 
> diff -u -p a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
> --- a/drivers/s390/crypto/ap_bus.c
> +++ b/drivers/s390/crypto/ap_bus.c
> @@ -1795,7 +1795,7 @@ static int ap_poll_thread_start(void)
>   mutex_lock(&ap_poll_thread_mutex);
>   if (!ap_poll_kthread) {
>   ap_poll_kthread = kthread_run(ap_poll_thread, NULL, "appoll");
> - rc = IS_ERR(ap_poll_kthread) ? PTR_ERR(ap_poll_kthread) : 0;
> + rc = PTR_RET(ap_poll_kthread);
>   if (rc)
>   ap_poll_kthread = NULL;
>   }
> @@ -1904,7 +1904,7 @@ int __init ap_module_init(void)
>  
>   /* Create /sys/devices/ap. */
>   ap_root_device = root_device_register("ap");
> - rc = IS_ERR(ap_root_device) ? PTR_ERR(ap_root_device) : 0;
> + rc = PTR_RET(ap_root_device);
>   if (rc)
>   goto out_bus;

Applied all you s390 related patches. 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 v2] arch: s390: kernel: scan all present cpu forcely.

2013-06-27 Thread Heiko Carstens
On Thu, Jun 27, 2013 at 10:43:02AM +0800, Chen Gang wrote:
> The architectures which may support 'hotpluggable', can scan all cpus
> during subsys_initcall().  the upper caller will skip the return value.
> 
> It also can initialize hotpluggable flag of all cpus in time, no matter
> whether any cpus fail or not.
> 
> Signed-off-by: Chen Gang 
> ---
>  arch/s390/kernel/smp.c |5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
> index d386c4e..75a118f 100644
> --- a/arch/s390/kernel/smp.c
> +++ b/arch/s390/kernel/smp.c
> @@ -1064,8 +1064,9 @@ static int __init s390_smp_init(void)
>  #endif
>   for_each_present_cpu(cpu) {
>   rc = smp_add_present_cpu(cpu);
> - if (rc)
> - return rc;
> + if (unlikely(rc))
> + printk(KERN_WARNING "%s: add cpu %d failed (%d)\n",
> +__func__, cpu, rc);

I have no idea how the patch description is supposed to correlate with
your patch.
However your patch doesn't make sense anyway.
We have initcall_debug for .. initcall debugging, which your patch would
break in addition, since this function would now return 0 instead of the
return code.

--
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 05/34] idle: Implement generic idle function

2013-03-23 Thread Heiko Carstens
On Thu, Mar 21, 2013 at 09:53:00PM -, Thomas Gleixner wrote:
> All idle functions in arch/* are more or less the same, plus minus a
> few bugs and extra instrumentation, tickless support and other
> optional items.
> 
> Implement a generic idle function which resembles the functionality
> found in arch/. Provide weak arch_cpu_idle_* functions which can be
> overridden by the architecture code if needed.
> 
> Signed-off-by: Thomas Gleixner 

[...]

> +static void cpu_idle_loop(void)
> +{
> + while (1) {
> + tick_nohz_idle_enter();
> +
> + while (!need_resched()) {
> + check_pgt_cache();
> + rmb();
> +
> + if (cpu_is_offline(smp_processor_id()))
> + arch_cpu_idle_dead();
> +
> + local_irq_disable();
> + arch_cpu_idle_enter();
> +
> + if (cpu_idle_force_poll) {
> + cpu_idle_poll();
> + } else {
> + current_clr_polling();
> + if (!need_resched()) {
> + stop_critical_timings();
> + rcu_idle_enter();
> + arch_cpu_idle();
> + WARN_ON_ONCE(!irqs_disabled());

This should be WARN_ON_ONCE(irqs_disabled()), no?

> + rcu_idle_exit();
> + start_critical_timings();
> + } else {
> + local_irq_enable();
> + }
> + current_set_polling();
> + }
> + arch_cpu_idle_exit();
> + }
> + tick_nohz_idle_exit();

I was wondering why the scheduler doesn't complain when being called with
irqs disabled. In fact tick_nohz_idle_exit() enables irqs unconditionally
iff CONFIG_NO_HZ is set.

> + schedule_preempt_disabled();
> + }
> +}
> +
> +void cpu_startup_entry(enum cpuhp_state state)
> +{
> + current_set_polling();
> + arch_cpu_idle_prepare();
> + cpu_idle_loop();
> +}
> +#endif

--
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 27/34] s390: Use generic idle loop

2013-03-23 Thread Heiko Carstens
On Thu, Mar 21, 2013 at 09:53:18PM -, Thomas Gleixner wrote:
> Signed-off-by: Thomas Gleixner 
> Cc: Heiko Carstens 
> ---
>  arch/s390/kernel/process.c |   25 +++--
>  arch/s390/kernel/smp.c |3 +--
>  2 files changed, 8 insertions(+), 20 deletions(-)

Please merge the patch below into your patch to fix some issues.

Signed-off-by: Heiko Carstens 
---
 arch/s390/Kconfig  |  1 +
 arch/s390/kernel/process.c | 13 +
 arch/s390/kernel/vtime.c   |  5 -
 3 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index eb8fb62..749513d 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -97,6 +97,7 @@ config S390
select CLONE_BACKWARDS2
select GENERIC_CLOCKEVENTS
select GENERIC_CPU_DEVICES if !SMP
+   select GENERIC_IDLE_LOOP
select GENERIC_KERNEL_THREAD
select GENERIC_SMP_IDLE_THREAD
select GENERIC_TIME_VSYSCALL_OLD
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 546afed..2bc3edd 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -61,16 +61,8 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
return sf->gprs[8];
 }
 
-/*
- * The idle function on a S390...
- */
 void arch_cpu_idle(void)
 {
-   if (test_thread_flag(TIF_MCCK_PENDING)) {
-   local_irq_enable();
-   return;
-   }
-
local_mcck_disable();
if (test_thread_flag(TIF_MCCK_PENDING)) {
local_mcck_enable();
@@ -87,6 +79,11 @@ void arch_cpu_idle_exit(void)
s390_handle_mcck();
 }
 
+void arch_cpu_idle_dead(void)
+{
+   cpu_die();
+}
+
 extern void __kprobes kernel_thread_starter(void);
 
 /*
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
index a0042ac..3fb0935 100644
--- a/arch/s390/kernel/vtime.c
+++ b/arch/s390/kernel/vtime.c
@@ -158,8 +158,6 @@ void __kprobes vtime_stop_cpu(void)
unsigned long psw_mask;
 
trace_hardirqs_on();
-   /* Don't trace preempt off for idle. */
-   stop_critical_timings();
 
/* Wait for external, I/O or machine check interrupt. */
psw_mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_DAT |
@@ -169,9 +167,6 @@ void __kprobes vtime_stop_cpu(void)
/* Call the assembler magic in entry.S */
psw_idle(idle, psw_mask);
 
-   /* Reenable preemption tracer. */
-   start_critical_timings();
-
/* Account time spent with enabled wait psw loaded as idle time. */
idle->sequence++;
smp_wmb();
-- 
1.7.12.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 27/34] s390: Use generic idle loop

2013-03-23 Thread Heiko Carstens
On Thu, Mar 21, 2013 at 09:53:18PM -, Thomas Gleixner wrote:
> Signed-off-by: Thomas Gleixner 
> Cc: Heiko Carstens 
> ---
>  arch/s390/kernel/process.c |   25 +++--
>  arch/s390/kernel/smp.c |3 +--
>  2 files changed, 8 insertions(+), 20 deletions(-)

FWIW, the patch below is also needed to fix a compile error.
I'll take care it gets upstream independently of your work.

>From 10c8cd5139f9a18cd6e955793ae7ad0877b5dd86 Mon Sep 17 00:00:00 2001
From: Heiko Carstens 
Date: Sat, 23 Mar 2013 10:29:01 +0100
Subject: [PATCH 2/2] s390/mm: provide emtpy check_pgt_cache() function

All architectures need to provide a check_pgt_cache() function. The s390 one
got lost somewhere.
So reintroduce it to prevent future compile errors e.g. if Thomas Gleixner's
idle loop rework patches get merged.

Signed-off-by: Heiko Carstens 
---
 arch/s390/include/asm/pgtable.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 4a29308..a11c773 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -1533,6 +1533,8 @@ extern int s390_enable_sie(void);
  */
 #define pgtable_cache_init()   do { } while (0)
 
+static inline void check_pgt_cache(void) { }
+
 #include 
 
 #endif /* _S390_PAGE_H */
-- 
1.7.12.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/


[PATCH 3/3] s390/kprobes: add support for pc-relative long displacement instructions

2013-08-21 Thread Heiko Carstens
With the general-instruction extension facility (z10) a couple of
instructions with a pc-relative long displacement were introduced.
The kprobes support for these instructions however was never implemented.

In result, if anybody ever put a probe on any of these instructions the
result would have been random behaviour after the instruction got executed
within the insn slot.

So lets add the missing handling for these instructions. Since all of the
new instructions have 32 bit signed displacement the easiest solution is
to allocate an insn slot that is within the same 2GB area like the original
instruction and patch the displacement field.

Signed-off-by: Heiko Carstens 
---
 arch/s390/Kconfig   |1 +
 arch/s390/include/asm/kprobes.h |4 +-
 arch/s390/kernel/kprobes.c  |  124 ---
 3 files changed, 121 insertions(+), 8 deletions(-)

diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 8a4cae7..ce389a9 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -96,6 +96,7 @@ config S390
select ARCH_WANT_IPC_PARSE_VERSION
select BUILDTIME_EXTABLE_SORT
select CLONE_BACKWARDS2
+   select DMAPROBES if KPROBES
select GENERIC_CLOCKEVENTS
select GENERIC_CPU_DEVICES if !SMP
select GENERIC_SMP_IDLE_THREAD
diff --git a/arch/s390/include/asm/kprobes.h b/arch/s390/include/asm/kprobes.h
index dcf6948..4176dfe 100644
--- a/arch/s390/include/asm/kprobes.h
+++ b/arch/s390/include/asm/kprobes.h
@@ -31,6 +31,8 @@
 #include 
 #include 
 
+#define __ARCH_WANT_KPROBES_INSN_SLOT
+
 struct pt_regs;
 struct kprobe;
 
@@ -57,7 +59,7 @@ typedef u16 kprobe_opcode_t;
 /* Architecture specific copy of original instruction */
 struct arch_specific_insn {
/* copy of original instruction */
-   kprobe_opcode_t insn[MAX_INSN_SIZE];
+   kprobe_opcode_t *insn;
 };
 
 struct prev_kprobe {
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 3388b2b..bc1071c 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -100,9 +100,8 @@ static int __kprobes get_fixup_type(kprobe_opcode_t *insn)
fixup |= FIXUP_RETURN_REGISTER;
break;
case 0xc0:
-   if ((insn[0] & 0x0f) == 0x00 || /* larl  */
-   (insn[0] & 0x0f) == 0x05)   /* brasl */
-   fixup |= FIXUP_RETURN_REGISTER;
+   if ((insn[0] & 0x0f) == 0x05)   /* brasl */
+   fixup |= FIXUP_RETURN_REGISTER;
break;
case 0xeb:
if ((insn[2] & 0xff) == 0x44 || /* bxhg  */
@@ -117,18 +116,128 @@ static int __kprobes get_fixup_type(kprobe_opcode_t 
*insn)
return fixup;
 }
 
+static int __kprobes is_insn_relative_long(kprobe_opcode_t *insn)
+{
+   /* Check if we have a RIL-b or RIL-c format instruction which
+* we need to modify in order to avoid instruction emulation. */
+   switch (insn[0] >> 8) {
+   case 0xc0:
+   if ((insn[0] & 0x0f) == 0x00) /* larl */
+   return true;
+   break;
+   case 0xc4:
+   switch (insn[0] & 0x0f) {
+   case 0x02: /* llhrl  */
+   case 0x04: /* lghrl  */
+   case 0x05: /* lhrl   */
+   case 0x06: /* llghrl */
+   case 0x07: /* sthrl  */
+   case 0x08: /* lgrl   */
+   case 0x0b: /* stgrl  */
+   case 0x0c: /* lgfrl  */
+   case 0x0d: /* lrl*/
+   case 0x0e: /* llgfrl */
+   case 0x0f: /* strl   */
+   return true;
+   }
+   break;
+   case 0xc6:
+   switch (insn[0] & 0x0f) {
+   case 0x00: /* exrl   */
+   case 0x02: /* pfdrl  */
+   case 0x04: /* cghrl  */
+   case 0x05: /* chrl   */
+   case 0x06: /* clghrl */
+   case 0x07: /* clhrl  */
+   case 0x08: /* cgrl   */
+   case 0x0a: /* clgrl  */
+   case 0x0c: /* cgfrl  */
+   case 0x0d: /* crl*/
+   case 0x0e: /* clgfrl */
+   case 0x0f: /* clrl   */
+   return true;
+   }
+   break;
+   }
+   return false;
+}
+
+static void __kprobes copy_instruction(struct kprobe *p)
+{
+   s64 disp, new_disp;
+   u64 addr, new_addr;
+
+   memcpy(p->ainsn.insn, p->addr, ((p->opcode >> 14) + 3) & -2);
+   if (!is_insn_relative_long(p->ainsn.insn))
+   return;
+   /*
+* For pc-relative instructions in RIL-b or RIL-c format patch the
+* RI2 displacement field. We have already made sure that the insn
+* slot for the patched instruction is within the same 2GB area
+* as the original instruction (either kernel image or module area).
+

[PATCH 1/3] kprobes: unify insn caches

2013-08-21 Thread Heiko Carstens
The two insn caches (insn, and optinsn) each have an own mutex and
alloc/free functions (get_[opt]insn_slot() / free_[opt]insn_slot()).

Since I need yet another insn cache which satifies dma allocations,
unify and simplify the current implementation:

- Move the per insn cache mutex into struct kprobe_insn_cache.
- Move the alloc/free functions to kprobe.h so they are simply
  wrappers for the generic __get_insn_slot/__free_insn_slot.
  The implementation is done with a DEFINE_INSN_CACHE_OPS() macro
  which provides the alloc/free functions for each cache if needed.

Signed-off-by: Heiko Carstens 
---
 include/linux/kprobes.h |   26 +++---
 kernel/kprobes.c|   70 +++
 2 files changed, 44 insertions(+), 52 deletions(-)

diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index ca1d27a..ffd9171 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -264,10 +264,28 @@ extern void arch_arm_kprobe(struct kprobe *p);
 extern void arch_disarm_kprobe(struct kprobe *p);
 extern int arch_init_kprobes(void);
 extern void show_registers(struct pt_regs *regs);
-extern kprobe_opcode_t *get_insn_slot(void);
-extern void free_insn_slot(kprobe_opcode_t *slot, int dirty);
 extern void kprobes_inc_nmissed_count(struct kprobe *p);
 
+struct kprobe_insn_cache;
+extern kprobe_opcode_t *__get_insn_slot(struct kprobe_insn_cache *c);
+extern void __free_insn_slot(struct kprobe_insn_cache *c,
+kprobe_opcode_t *slot, int dirty);
+
+#define DEFINE_INSN_CACHE_OPS(__name)  \
+extern struct kprobe_insn_cache kprobe_##__name##_slots;   \
+   \
+static inline kprobe_opcode_t *get_##__name##_slot(void)   \
+{  \
+   return __get_insn_slot(&kprobe_##__name##_slots);   \
+}  \
+   \
+static inline void free_##__name##_slot(kprobe_opcode_t *slot, int dirty)\
+{  \
+   __free_insn_slot(&kprobe_##__name##_slots, slot, dirty);\
+}  \
+
+DEFINE_INSN_CACHE_OPS(insn);
+
 #ifdef CONFIG_OPTPROBES
 /*
  * Internal structure for direct jump optimized probe
@@ -287,13 +305,13 @@ extern void arch_optimize_kprobes(struct list_head 
*oplist);
 extern void arch_unoptimize_kprobes(struct list_head *oplist,
struct list_head *done_list);
 extern void arch_unoptimize_kprobe(struct optimized_kprobe *op);
-extern kprobe_opcode_t *get_optinsn_slot(void);
-extern void free_optinsn_slot(kprobe_opcode_t *slot, int dirty);
 extern int arch_within_optimized_kprobe(struct optimized_kprobe *op,
unsigned long addr);
 
 extern void opt_pre_handler(struct kprobe *p, struct pt_regs *regs);
 
+DEFINE_INSN_CACHE_OPS(optinsn);
+
 #ifdef CONFIG_SYSCTL
 extern int sysctl_kprobes_optimization;
 extern int proc_kprobes_optimization_handler(struct ctl_table *table,
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 6e33498..30659b3 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -122,6 +122,7 @@ struct kprobe_insn_page {
 (sizeof(char) * (slots)))
 
 struct kprobe_insn_cache {
+   struct mutex mutex;
struct list_head pages; /* list of kprobe_insn_page */
size_t insn_size;   /* size of instruction slot */
int nr_garbage;
@@ -138,8 +139,8 @@ enum kprobe_slot_state {
SLOT_USED = 2,
 };
 
-static DEFINE_MUTEX(kprobe_insn_mutex);/* Protects kprobe_insn_slots */
-static struct kprobe_insn_cache kprobe_insn_slots = {
+struct kprobe_insn_cache kprobe_insn_slots = {
+   .mutex = __MUTEX_INITIALIZER(kprobe_insn_slots.mutex),
.pages = LIST_HEAD_INIT(kprobe_insn_slots.pages),
.insn_size = MAX_INSN_SIZE,
.nr_garbage = 0,
@@ -150,10 +151,12 @@ static int __kprobes collect_garbage_slots(struct 
kprobe_insn_cache *c);
  * __get_insn_slot() - Find a slot on an executable page for an instruction.
  * We allocate an executable page if there's no room on existing ones.
  */
-static kprobe_opcode_t __kprobes *__get_insn_slot(struct kprobe_insn_cache *c)
+kprobe_opcode_t __kprobes *__get_insn_slot(struct kprobe_insn_cache *c)
 {
struct kprobe_insn_page *kip;
+   kprobe_opcode_t *slot = NULL;
 
+   mutex_lock(&c->mutex);
  retry:
list_for_each_entry(kip, &c->pages, list) {
if (kip->nused < slots_per_page(c)) {
@@ -162,7 +165,8 @@ static kprobe_opcode_t __kprobes *__get_insn_slot(struct 
kprobe_insn_cache *c)
if

[PATCH 0/3] kprobes: add new dma insn slot cache for s390

2013-08-21 Thread Heiko Carstens
The current kpropes insn caches allocate memory areas for insn slots with
module_alloc(). The assumption is that the kernel image and module area
are both within the same +/- 2GB memory area.
This however is not true for s390 where the kernel image resides within
the first 2GB (DMA memory area), but the module area is far away in the
vmalloc area, usually somewhere close below the 4TB area.

For new pc relative instructions s390 needs insn slots that are within
+/- 2GB of each area. That way we can patch displacements of pc-relative
instructions within the insn slots just like x86 and powerpc.

The module area works already with the normal insn slot allocator, however
there is currently no way to get insn slots that are within the first 2GB
on s390 (aka DMA area).

Therefore this patch set introduces a third insn slot cache besides the
normal insn and optinsn slot caches: the dmainsn slot cache. Slots can be
allocated and freed with get_dmainsn_slot() and free_dmainsn_slot().

Patch 1 unifies the current insn and optinsn caches implementation so we
don't end up with a lot of code duplication when adding a third cache.

Patch 2 simply adds the new dmainsn slot cache.

Patch 3 is the s390 usage of the new cache.

Looking at the last couple of sign-off chains I'm not sure how kprobes
patches should go upstream.. Andrew, Ingo, or simply via the s390 tree?

Heiko Carstens (3):
  kprobes: unify insn caches
  kprobes: provide new dmainsn cache
  s390/kprobes: add support for pc-relative long displacement instructions

 arch/Kconfig|7 +++
 arch/s390/Kconfig   |1 +
 arch/s390/include/asm/kprobes.h |4 +-
 arch/s390/kernel/kprobes.c  |  124 ---
 include/linux/kprobes.h |   31 --
 kernel/kprobes.c|   98 +++
 6 files changed, 203 insertions(+), 62 deletions(-)

-- 
1.7.10.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/


[PATCH 2/3] kprobes: provide new dmainsn cache

2013-08-21 Thread Heiko Carstens
The current kpropes insn caches allocate memory areas for insn slots with
module_alloc(). The assumption is that the kernel image and module area
are both within the same +/- 2GB memory area.
This however is not true for s390 where the kernel image resides within
the first 2GB (DMA memory area), but the module area is far away in the
vmalloc area, usually somewhere close below the 4TB area.

For new pc relative instructions s390 needs insn slots that are within
+/- 2GB of each area. That way we can patch displacements of pc-relative
instructions within the insn slots just like x86 and powerpc.

The module area works already with the normal insn slot allocator, however
there is currently no way to get insn slots that are within the first 2GB
on s390 (aka DMA area).

Therefore this patch introduces the dmainsn slot cache. Slots can be
allocated and freed with get_dmainsn_slot() and free_dmainsn_slot().

Signed-off-by: Heiko Carstens 
---
 arch/Kconfig|7 +++
 include/linux/kprobes.h |5 +
 kernel/kprobes.c|   28 ++--
 3 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 1feb169..7010d68 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -76,6 +76,13 @@ config OPTPROBES
depends on KPROBES && HAVE_OPTPROBES
depends on !PREEMPT
 
+config DMAPROBES
+   bool
+   help
+ Architectures may want to put kprobes instruction slots into
+ the dma memory region. E.g. s390 has the kernel image in the
+ dma memory region but the module area far away.
+
 config KPROBES_ON_FTRACE
def_bool y
depends on KPROBES && HAVE_KPROBES_ON_FTRACE
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index ffd9171..a5290f6 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -320,6 +320,11 @@ extern int proc_kprobes_optimization_handler(struct 
ctl_table *table,
 #endif
 
 #endif /* CONFIG_OPTPROBES */
+
+#ifdef CONFIG_DMAPROBES
+DEFINE_INSN_CACHE_OPS(dmainsn);
+#endif
+
 #ifdef CONFIG_KPROBES_ON_FTRACE
 extern void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
  struct ftrace_ops *ops, struct pt_regs *regs);
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 30659b3..3b8b073 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -114,6 +114,7 @@ struct kprobe_insn_page {
kprobe_opcode_t *insns; /* Page of instruction slots */
int nused;
int ngarbage;
+   bool dma_alloc;
char slot_used[];
 };
 
@@ -126,6 +127,7 @@ struct kprobe_insn_cache {
struct list_head pages; /* list of kprobe_insn_page */
size_t insn_size;   /* size of instruction slot */
int nr_garbage;
+   bool dma_alloc;
 };
 
 static int slots_per_page(struct kprobe_insn_cache *c)
@@ -144,6 +146,7 @@ struct kprobe_insn_cache kprobe_insn_slots = {
.pages = LIST_HEAD_INIT(kprobe_insn_slots.pages),
.insn_size = MAX_INSN_SIZE,
.nr_garbage = 0,
+   .dma_alloc = false,
 };
 static int __kprobes collect_garbage_slots(struct kprobe_insn_cache *c);
 
@@ -189,7 +192,10 @@ kprobe_opcode_t __kprobes *__get_insn_slot(struct 
kprobe_insn_cache *c)
 * kernel image and loaded module images reside. This is required
 * so x86_64 can correctly handle the %rip-relative fixups.
 */
-   kip->insns = module_alloc(PAGE_SIZE);
+   if (c->dma_alloc)
+   kip->insns = (void *)__get_free_page(GFP_KERNEL | GFP_DMA);
+   else
+   kip->insns = module_alloc(PAGE_SIZE);
if (!kip->insns) {
kfree(kip);
goto out;
@@ -199,6 +205,7 @@ kprobe_opcode_t __kprobes *__get_insn_slot(struct 
kprobe_insn_cache *c)
kip->slot_used[0] = SLOT_USED;
kip->nused = 1;
kip->ngarbage = 0;
+   kip->dma_alloc = c->dma_alloc;
list_add(&kip->list, &c->pages);
slot = kip->insns;
 out:
@@ -220,7 +227,10 @@ static int __kprobes collect_one_slot(struct 
kprobe_insn_page *kip, int idx)
 */
if (!list_is_singular(&kip->list)) {
list_del(&kip->list);
-   module_free(NULL, kip->insns);
+   if (kip->dma_alloc)
+   free_page((unsigned long)kip->insns);
+   else
+   module_free(NULL, kip->insns);
kfree(kip);
}
return 1;
@@ -284,6 +294,20 @@ struct kprobe_insn_cache kprobe_optinsn_slots = {
.pages = LIST_HEAD_INIT(kprobe_optinsn_slots.pages),
/* .insn_size is initialized later */
.nr_garbage = 0,
+   .dma_alloc = false,
+};
+#endif
+#ifdef CONFIG_DMAPROBES
+/*
+ * Special buffer for architectures which require insn slots
+

Re: [PATCH 0/3] kprobes: add new dma insn slot cache for s390

2013-08-21 Thread Heiko Carstens
Hi Masami,

> (2013/08/21 21:01), Heiko Carstens wrote:
> > The current kpropes insn caches allocate memory areas for insn slots with
> > module_alloc(). The assumption is that the kernel image and module area
> > are both within the same +/- 2GB memory area.
> > This however is not true for s390 where the kernel image resides within
> > the first 2GB (DMA memory area), but the module area is far away in the
> > vmalloc area, usually somewhere close below the 4TB area.
> > 
> > For new pc relative instructions s390 needs insn slots that are within
> > +/- 2GB of each area. That way we can patch displacements of pc-relative
> > instructions within the insn slots just like x86 and powerpc.
> > 
> > The module area works already with the normal insn slot allocator, however
> > there is currently no way to get insn slots that are within the first 2GB
> > on s390 (aka DMA area).
> 
> The reason why we allocate instruction buffers from module area is
> to execute a piece of code on the buffer, which should be executable.
> I'm not good for s390, is that allows kernel to execute the code
> on such DMA buffer?

Yes, the kernel image itself resides in DMA capable memory and it is all
executable.

> > Therefore this patch set introduces a third insn slot cache besides the
> > normal insn and optinsn slot caches: the dmainsn slot cache. Slots can be
> > allocated and freed with get_dmainsn_slot() and free_dmainsn_slot().
> 
> OK, but it seems that your patch introduced unneeded complexity. Perhaps,
> you just have to introduce 2 weak functions to allocate/release such
> executable and jump-able buffers, like below,
> 
> void * __weak arch_allocate_executable_page(void)
> {
>   return module_alloc(PAGE_SIZE);
> }
> 
> void __weak arch_free_executable_page(void *page)
> {
>   module_free(NULL, page);
> }
> 
> Thus, all you need to do is implementing dmaalloc() version of above
> functions on s390. No kconfig, no ifdefs are needed. :)

Hm, I don't see how that can work, or maybe I just don't get your idea ;)
Or maybe my intention was not clear? So let me try again:

If the to be probed instruction resides within the first 2GB of memory
(aka DMA memory, aka kernel image) the insn slot must be within the first
2GB as well, otherwise I can't patch pc-relative instructions.

On the other hand if the to be probed instruction resides in a module
(aka part of the vmalloc area), the insn slot must reside within the same
2GB area as well.

Therefore I need to different insn slot caches, where the slots are either
allocated with __get_free_page(GFP_KERNEL | GFP_DMA) (for the kernel image)
or module_alloc(PAGE_SIZE) for modules.

I can't have a single cache which satifies both areas.

--
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: Re: [PATCH 0/3] kprobes: add new dma insn slot cache for s390

2013-08-23 Thread Heiko Carstens
On Fri, Aug 23, 2013 at 01:31:23PM +0900, Masami Hiramatsu wrote:
> (2013/08/22 14:52), Heiko Carstens wrote:
> > Therefore I need to different insn slot caches, where the slots are either
> > allocated with __get_free_page(GFP_KERNEL | GFP_DMA) (for the kernel image)
> > or module_alloc(PAGE_SIZE) for modules.
> > 
> > I can't have a single cache which satifies both areas.
> 
> Oh, I see.
> Indeed, that enough reason to add a new cache... By the way, is there
> any way to implement it without new kconfig like DMAPROBE and dma flag?
> AFAICS, since such flag is strongly depends on the s390 arch, I don't
> like to put it in kernel/kprobes.c.
> 
> Perhaps, we can make insn slot more generic, e.g. create new slot type
> with passing page allocator.

Something like below?
(only compile tested and on top of the previous patches).

I'm not sure, since that would expose struct kprobe_insn_cache.

 arch/Kconfig   |  7 ---
 arch/s390/Kconfig  |  1 -
 arch/s390/kernel/kprobes.c | 20 ++
 include/linux/kprobes.h| 14 -
 kernel/kprobes.c   | 51 --
 5 files changed, 47 insertions(+), 46 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 7010d68..1feb169 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -76,13 +76,6 @@ config OPTPROBES
depends on KPROBES && HAVE_OPTPROBES
depends on !PREEMPT
 
-config DMAPROBES
-   bool
-   help
- Architectures may want to put kprobes instruction slots into
- the dma memory region. E.g. s390 has the kernel image in the
- dma memory region but the module area far away.
-
 config KPROBES_ON_FTRACE
def_bool y
depends on KPROBES && HAVE_KPROBES_ON_FTRACE
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index ce389a9..8a4cae7 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -96,7 +96,6 @@ config S390
select ARCH_WANT_IPC_PARSE_VERSION
select BUILDTIME_EXTABLE_SORT
select CLONE_BACKWARDS2
-   select DMAPROBES if KPROBES
select GENERIC_CLOCKEVENTS
select GENERIC_CPU_DEVICES if !SMP
select GENERIC_SMP_IDLE_THREAD
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index bc1071c..cb7ac9e 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -37,6 +37,26 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
 
 struct kretprobe_blackpoint kretprobe_blacklist[] = { };
 
+DEFINE_INSN_CACHE_OPS(dmainsn);
+
+static void *alloc_dmainsn_page(void)
+{
+   return (void *)__get_free_page(GFP_KERNEL | GFP_DMA);
+}
+
+static void free_dmainsn_page(void *page)
+{
+   free_page((unsigned long)page);
+}
+
+struct kprobe_insn_cache kprobe_dmainsn_slots = {
+   .mutex = __MUTEX_INITIALIZER(kprobe_dmainsn_slots.mutex),
+   .alloc = alloc_dmainsn_page,
+   .free = free_dmainsn_page,
+   .pages = LIST_HEAD_INIT(kprobe_dmainsn_slots.pages),
+   .insn_size = MAX_INSN_SIZE,
+};
+
 static int __kprobes is_prohibited_opcode(kprobe_opcode_t *insn)
 {
switch (insn[0] >> 8) {
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index a5290f6..4e96827 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -266,7 +266,15 @@ extern int arch_init_kprobes(void);
 extern void show_registers(struct pt_regs *regs);
 extern void kprobes_inc_nmissed_count(struct kprobe *p);
 
-struct kprobe_insn_cache;
+struct kprobe_insn_cache {
+   struct mutex mutex;
+   void *(*alloc)(void);   /* allocate insn page */
+   void (*free)(void *);   /* free insn page */
+   struct list_head pages; /* list of kprobe_insn_page */
+   size_t insn_size;   /* size of instruction slot */
+   int nr_garbage;
+};
+
 extern kprobe_opcode_t *__get_insn_slot(struct kprobe_insn_cache *c);
 extern void __free_insn_slot(struct kprobe_insn_cache *c,
 kprobe_opcode_t *slot, int dirty);
@@ -321,10 +329,6 @@ extern int proc_kprobes_optimization_handler(struct 
ctl_table *table,
 
 #endif /* CONFIG_OPTPROBES */
 
-#ifdef CONFIG_DMAPROBES
-DEFINE_INSN_CACHE_OPS(dmainsn);
-#endif
-
 #ifdef CONFIG_KPROBES_ON_FTRACE
 extern void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
  struct ftrace_ops *ops, struct pt_regs *regs);
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 3b8b073..a0d367a 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -112,9 +112,9 @@ static struct kprobe_blackpoint kprobe_blacklist[] = {
 struct kprobe_insn_page {
struct list_head list;
kprobe_opcode_t *insns; /* Page of instruction slots */
+   struct kprobe_insn_cache *cache;
int nused;
int ngarbage;
-   bool dma_alloc;
char slot_used[];
 };
 
@@ -122,14 +122,6 @@ struct kprobe_insn_page {
 

[Patch v2 1/3] kprobes: unify insn caches

2013-08-23 Thread Heiko Carstens
The two insn caches (insn, and optinsn) each have an own mutex and
alloc/free functions (get_[opt]insn_slot() / free_[opt]insn_slot()).

Since there is the need for yet another insn cache which satifies
dma allocations on s390, unify and simplify the current implementation:

- Move the per insn cache mutex into struct kprobe_insn_cache.
- Move the alloc/free functions to kprobe.h so they are simply
  wrappers for the generic __get_insn_slot/__free_insn_slot functions.
  The implementation is done with a DEFINE_INSN_CACHE_OPS() macro
  which provides the alloc/free functions for each cache if needed.
- move the struct kprobe_insn_cache to kprobe.h which allows to generate
  architecture specific insn slot caches outside of the core kprobes
  code.

Signed-off-by: Heiko Carstens 
---
 include/linux/kprobes.h |   32 +---
 kernel/kprobes.c|   75 +--
 2 files changed, 49 insertions(+), 58 deletions(-)

diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index ca1d27a..077f653 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -264,10 +264,34 @@ extern void arch_arm_kprobe(struct kprobe *p);
 extern void arch_disarm_kprobe(struct kprobe *p);
 extern int arch_init_kprobes(void);
 extern void show_registers(struct pt_regs *regs);
-extern kprobe_opcode_t *get_insn_slot(void);
-extern void free_insn_slot(kprobe_opcode_t *slot, int dirty);
 extern void kprobes_inc_nmissed_count(struct kprobe *p);
 
+struct kprobe_insn_cache {
+   struct mutex mutex;
+   struct list_head pages; /* list of kprobe_insn_page */
+   size_t insn_size;   /* size of instruction slot */
+   int nr_garbage;
+};
+
+extern kprobe_opcode_t *__get_insn_slot(struct kprobe_insn_cache *c);
+extern void __free_insn_slot(struct kprobe_insn_cache *c,
+kprobe_opcode_t *slot, int dirty);
+
+#define DEFINE_INSN_CACHE_OPS(__name)  \
+extern struct kprobe_insn_cache kprobe_##__name##_slots;   \
+   \
+static inline kprobe_opcode_t *get_##__name##_slot(void)   \
+{  \
+   return __get_insn_slot(&kprobe_##__name##_slots);   \
+}  \
+   \
+static inline void free_##__name##_slot(kprobe_opcode_t *slot, int dirty)\
+{  \
+   __free_insn_slot(&kprobe_##__name##_slots, slot, dirty);\
+}  \
+
+DEFINE_INSN_CACHE_OPS(insn);
+
 #ifdef CONFIG_OPTPROBES
 /*
  * Internal structure for direct jump optimized probe
@@ -287,13 +311,13 @@ extern void arch_optimize_kprobes(struct list_head 
*oplist);
 extern void arch_unoptimize_kprobes(struct list_head *oplist,
struct list_head *done_list);
 extern void arch_unoptimize_kprobe(struct optimized_kprobe *op);
-extern kprobe_opcode_t *get_optinsn_slot(void);
-extern void free_optinsn_slot(kprobe_opcode_t *slot, int dirty);
 extern int arch_within_optimized_kprobe(struct optimized_kprobe *op,
unsigned long addr);
 
 extern void opt_pre_handler(struct kprobe *p, struct pt_regs *regs);
 
+DEFINE_INSN_CACHE_OPS(optinsn);
+
 #ifdef CONFIG_SYSCTL
 extern int sysctl_kprobes_optimization;
 extern int proc_kprobes_optimization_handler(struct ctl_table *table,
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 6e33498..9e4912d 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -121,12 +121,6 @@ struct kprobe_insn_page {
(offsetof(struct kprobe_insn_page, slot_used) + \
 (sizeof(char) * (slots)))
 
-struct kprobe_insn_cache {
-   struct list_head pages; /* list of kprobe_insn_page */
-   size_t insn_size;   /* size of instruction slot */
-   int nr_garbage;
-};
-
 static int slots_per_page(struct kprobe_insn_cache *c)
 {
return PAGE_SIZE/(c->insn_size * sizeof(kprobe_opcode_t));
@@ -138,8 +132,8 @@ enum kprobe_slot_state {
SLOT_USED = 2,
 };
 
-static DEFINE_MUTEX(kprobe_insn_mutex);/* Protects kprobe_insn_slots */
-static struct kprobe_insn_cache kprobe_insn_slots = {
+struct kprobe_insn_cache kprobe_insn_slots = {
+   .mutex = __MUTEX_INITIALIZER(kprobe_insn_slots.mutex),
.pages = LIST_HEAD_INIT(kprobe_insn_slots.pages),
.insn_size = MAX_INSN_SIZE,
.nr_garbage = 0,
@@ -150,10 +144,12 @@ static int __kprobes collect_garbage_slots(struct 
kprobe_insn_cache *c);
  * __get_insn_slot() - Find a slot on an executable page for an instruction.
  * We allocate an executable page if there's no room on existing ones.
  */
-static kprobe_op

[Patch v2 3/3] s390/kprobes: add support for pc-relative long displacement instructions

2013-08-23 Thread Heiko Carstens
With the general-instruction extension facility (z10) a couple of
instructions with a pc-relative long displacement were introduced.
The kprobes support for these instructions however was never implemented.

In result, if anybody ever put a probe on any of these instructions the
result would have been random behaviour after the instruction got executed
within the insn slot.

So lets add the missing handling for these instructions. Since all of the
new instructions have 32 bit signed displacement the easiest solution is
to allocate an insn slot that is within the same 2GB area like the original
instruction and patch the displacement field.

Signed-off-by: Heiko Carstens 
---
 arch/s390/include/asm/kprobes.h |4 +-
 arch/s390/kernel/kprobes.c  |  144 +--
 2 files changed, 140 insertions(+), 8 deletions(-)

diff --git a/arch/s390/include/asm/kprobes.h b/arch/s390/include/asm/kprobes.h
index dcf6948..4176dfe 100644
--- a/arch/s390/include/asm/kprobes.h
+++ b/arch/s390/include/asm/kprobes.h
@@ -31,6 +31,8 @@
 #include 
 #include 
 
+#define __ARCH_WANT_KPROBES_INSN_SLOT
+
 struct pt_regs;
 struct kprobe;
 
@@ -57,7 +59,7 @@ typedef u16 kprobe_opcode_t;
 /* Architecture specific copy of original instruction */
 struct arch_specific_insn {
/* copy of original instruction */
-   kprobe_opcode_t insn[MAX_INSN_SIZE];
+   kprobe_opcode_t *insn;
 };
 
 struct prev_kprobe {
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 3388b2b..cb7ac9e 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -37,6 +37,26 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
 
 struct kretprobe_blackpoint kretprobe_blacklist[] = { };
 
+DEFINE_INSN_CACHE_OPS(dmainsn);
+
+static void *alloc_dmainsn_page(void)
+{
+   return (void *)__get_free_page(GFP_KERNEL | GFP_DMA);
+}
+
+static void free_dmainsn_page(void *page)
+{
+   free_page((unsigned long)page);
+}
+
+struct kprobe_insn_cache kprobe_dmainsn_slots = {
+   .mutex = __MUTEX_INITIALIZER(kprobe_dmainsn_slots.mutex),
+   .alloc = alloc_dmainsn_page,
+   .free = free_dmainsn_page,
+   .pages = LIST_HEAD_INIT(kprobe_dmainsn_slots.pages),
+   .insn_size = MAX_INSN_SIZE,
+};
+
 static int __kprobes is_prohibited_opcode(kprobe_opcode_t *insn)
 {
switch (insn[0] >> 8) {
@@ -100,9 +120,8 @@ static int __kprobes get_fixup_type(kprobe_opcode_t *insn)
fixup |= FIXUP_RETURN_REGISTER;
break;
case 0xc0:
-   if ((insn[0] & 0x0f) == 0x00 || /* larl  */
-   (insn[0] & 0x0f) == 0x05)   /* brasl */
-   fixup |= FIXUP_RETURN_REGISTER;
+   if ((insn[0] & 0x0f) == 0x05)   /* brasl */
+   fixup |= FIXUP_RETURN_REGISTER;
break;
case 0xeb:
if ((insn[2] & 0xff) == 0x44 || /* bxhg  */
@@ -117,18 +136,128 @@ static int __kprobes get_fixup_type(kprobe_opcode_t 
*insn)
return fixup;
 }
 
+static int __kprobes is_insn_relative_long(kprobe_opcode_t *insn)
+{
+   /* Check if we have a RIL-b or RIL-c format instruction which
+* we need to modify in order to avoid instruction emulation. */
+   switch (insn[0] >> 8) {
+   case 0xc0:
+   if ((insn[0] & 0x0f) == 0x00) /* larl */
+   return true;
+   break;
+   case 0xc4:
+   switch (insn[0] & 0x0f) {
+   case 0x02: /* llhrl  */
+   case 0x04: /* lghrl  */
+   case 0x05: /* lhrl   */
+   case 0x06: /* llghrl */
+   case 0x07: /* sthrl  */
+   case 0x08: /* lgrl   */
+   case 0x0b: /* stgrl  */
+   case 0x0c: /* lgfrl  */
+   case 0x0d: /* lrl*/
+   case 0x0e: /* llgfrl */
+   case 0x0f: /* strl   */
+   return true;
+   }
+   break;
+   case 0xc6:
+   switch (insn[0] & 0x0f) {
+   case 0x00: /* exrl   */
+   case 0x02: /* pfdrl  */
+   case 0x04: /* cghrl  */
+   case 0x05: /* chrl   */
+   case 0x06: /* clghrl */
+   case 0x07: /* clhrl  */
+   case 0x08: /* cgrl   */
+   case 0x0a: /* clgrl  */
+   case 0x0c: /* cgfrl  */
+   case 0x0d: /* crl*/
+   case 0x0e: /* clgfrl */
+   case 0x0f: /* clrl   */
+   return true;
+   }
+   break;
+   }
+   return false;
+}
+
+static void __kprobes copy_instruction(struct kprobe *p)
+{
+   s64 disp, new_disp;
+   u64 addr, new_addr;
+
+   memcpy(p->ainsn.insn, p->addr, ((p->opcode >> 14) + 3) & -2);
+   if (!is_insn_relative_long(p->ainsn.insn))
+   return;
+   /*
+ 

[PATCH v2 0/3] kprobes: add new dma insn slot cache for s390

2013-08-23 Thread Heiko Carstens
The current kpropes insn caches allocate memory areas for insn slots with
module_alloc().  The assumption is that the kernel image and module area
are both within the same +/- 2GB memory area.

This however is not true for s390 where the kernel image resides within
the first 2GB (DMA memory area), but the module area is far away in the
vmalloc area, usually somewhere close below the 4TB area.

For new pc relative instructions s390 needs insn slots that are within +/-
2GB of each area.  That way we can patch displacements of pc-relative
instructions within the insn slots just like x86 and powerpc.

The module area works already with the normal insn slot allocator, however
there is currently no way to get insn slots that are within the first 2GB
on s390 (aka DMA area).

Therefore this patch set modifies the kprobes insn slot cache code in order
to allow to specify a custom allocator for the insn slot cache pages.
In addition architecure can now have private insn slot caches withhout the
need to modify common code.

Patch 1 unifies and simplifies the current insn and optinsn caches
implementation. This is a preparation which allows to add more
insn caches in a simple way.

Patch 2 adds the possibility to specify a custom allocator.

Patch 3 makes s390 use the new insn slot mechanisms and adds support for
pc-relative instructions with long displacements.

v1->v2: add possibility to specifiy a custom allocator and move the new
dmainsn cache into s390 code and leave common code alone.

Heiko Carstens (3):
  kprobes: unify insn caches
  kprobes: allow to specify custum allocator for insn caches
  s390/kprobes: add support for pc-relative long displacement instructions

 arch/s390/include/asm/kprobes.h |4 +-
 arch/s390/kernel/kprobes.c  |  144 +--
 include/linux/kprobes.h |   34 +++--
 kernel/kprobes.c|   95 +++---
 4 files changed, 209 insertions(+), 68 deletions(-)

-- 
1.7.10.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/


[Patch v2 2/3] kprobes: allow to specify custum allocator for insn caches

2013-08-23 Thread Heiko Carstens
The current two insn slot caches both use module_alloc/module_free
to allocate and free insn slot cache pages.
For s390 this is not sufficient since there is the need to allocate
insn slots that are either within the vmalloc module area or within
dma memory.
Therefore add a mechanism which allows to specify an own allocator
for an own insn slot cache.

Signed-off-by: Heiko Carstens 
---
 include/linux/kprobes.h |2 ++
 kernel/kprobes.c|   20 ++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 077f653..925eaf2 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -268,6 +268,8 @@ extern void kprobes_inc_nmissed_count(struct kprobe *p);
 
 struct kprobe_insn_cache {
struct mutex mutex;
+   void *(*alloc)(void);   /* allocate insn page */
+   void (*free)(void *);   /* free insn page */
struct list_head pages; /* list of kprobe_insn_page */
size_t insn_size;   /* size of instruction slot */
int nr_garbage;
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 9e4912d..a0d367a 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -112,6 +112,7 @@ static struct kprobe_blackpoint kprobe_blacklist[] = {
 struct kprobe_insn_page {
struct list_head list;
kprobe_opcode_t *insns; /* Page of instruction slots */
+   struct kprobe_insn_cache *cache;
int nused;
int ngarbage;
char slot_used[];
@@ -132,8 +133,20 @@ enum kprobe_slot_state {
SLOT_USED = 2,
 };
 
+static void *alloc_insn_page(void)
+{
+   return module_alloc(PAGE_SIZE);
+}
+
+static void free_insn_page(void *page)
+{
+   module_free(NULL, page);
+}
+
 struct kprobe_insn_cache kprobe_insn_slots = {
.mutex = __MUTEX_INITIALIZER(kprobe_insn_slots.mutex),
+   .alloc = alloc_insn_page,
+   .free = free_insn_page,
.pages = LIST_HEAD_INIT(kprobe_insn_slots.pages),
.insn_size = MAX_INSN_SIZE,
.nr_garbage = 0,
@@ -182,7 +195,7 @@ kprobe_opcode_t __kprobes *__get_insn_slot(struct 
kprobe_insn_cache *c)
 * kernel image and loaded module images reside. This is required
 * so x86_64 can correctly handle the %rip-relative fixups.
 */
-   kip->insns = module_alloc(PAGE_SIZE);
+   kip->insns = c->alloc();
if (!kip->insns) {
kfree(kip);
goto out;
@@ -192,6 +205,7 @@ kprobe_opcode_t __kprobes *__get_insn_slot(struct 
kprobe_insn_cache *c)
kip->slot_used[0] = SLOT_USED;
kip->nused = 1;
kip->ngarbage = 0;
+   kip->cache = c;
list_add(&kip->list, &c->pages);
slot = kip->insns;
 out:
@@ -213,7 +227,7 @@ static int __kprobes collect_one_slot(struct 
kprobe_insn_page *kip, int idx)
 */
if (!list_is_singular(&kip->list)) {
list_del(&kip->list);
-   module_free(NULL, kip->insns);
+   kip->cache->free(kip->insns);
kfree(kip);
}
return 1;
@@ -274,6 +288,8 @@ out:
 /* For optimized_kprobe buffer */
 struct kprobe_insn_cache kprobe_optinsn_slots = {
.mutex = __MUTEX_INITIALIZER(kprobe_optinsn_slots.mutex),
+   .alloc = alloc_insn_page,
+   .free = free_insn_page,
.pages = LIST_HEAD_INIT(kprobe_optinsn_slots.pages),
/* .insn_size is initialized later */
.nr_garbage = 0,
-- 
1.7.10.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] drivers: mfd: mfd-core: disable irq_domain related code when 'HAVE_GENERIC_HARDIRQS' disabled.

2013-07-23 Thread Heiko Carstens
On Wed, Jul 24, 2013 at 11:33:04AM +0800, Chen Gang wrote:
> 'irq_domain' depends on hard irqs, so for the architectures which have
> no hard irqs, but still need mfd (e.g. s390), need disable the related
> code, or can not pass compiling.
> 
> The related commit:
> 
>   "c94bb23 mfd: Make MFD core code Device Tree and IRQ domain aware"
> 
> The related error: (with allmodconfig under s390)
> 
>   ERROR: "irq_create_mapping" [drivers/mfd/mfd-core.ko] undefined!
> 
> 
> Signed-off-by: Chen Gang 

s390 will have GENERIC_HARDIRQS soon (very likely next merge window),
so lets not add more GENERIC_HARDIRQS ifdefs in the code.

--
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: [s390x] build error: undefined reference to `sie_exit'

2013-07-25 Thread Heiko Carstens
On Wed, Jul 24, 2013 at 10:09:13PM -0400, Zhouping Liu wrote:
> Hello All,
> 
> I met the below error on b3a3a9c441 with s390x arch:
> arch/s390/built-in.o: In function `sys_call_table_emu':
> (.rodata+0x2b98): undefined reference to `sie_exit'
> arch/s390/built-in.o: In function `sys_call_table_emu':
> (.rodata+0x2ba0): undefined reference to `sie_exit'
> make: *** [vmlinux] Error 1

Thanks for reporting, I just committed the patch below to our
local branch:

>From c073dc1f474094b5610739e752d83bcb547b1d7d Mon Sep 17 00:00:00 2001
From: Heiko Carstens 
Date: Thu, 25 Jul 2013 11:16:48 +0200
Subject: [PATCH] s390/perf: fix compile error (undefined reference sie_exit)

The perf_event code references sie_exit even if KVM is not available.
So add proper ifdefs to fix this one:

arch/s390/built-in.o: In function `sys_call_table_emu':
(.rodata+0x2b98): undefined reference to `sie_exit'
arch/s390/built-in.o: In function `sys_call_table_emu':
(.rodata+0x2ba0): undefined reference to `sie_exit'
make: *** [vmlinux] Error 1

Reported-by: Zhouping Liu 
Signed-off-by: Heiko Carstens 
---
 arch/s390/kernel/perf_event.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/s390/kernel/perf_event.c b/arch/s390/kernel/perf_event.c
index a6fc037..500aa10 100644
--- a/arch/s390/kernel/perf_event.c
+++ b/arch/s390/kernel/perf_event.c
@@ -52,12 +52,13 @@ static struct kvm_s390_sie_block *sie_block(struct pt_regs 
*regs)
 
 static bool is_in_guest(struct pt_regs *regs)
 {
-   unsigned long ip = instruction_pointer(regs);
-
if (user_mode(regs))
return false;
-
-   return ip == (unsigned long) &sie_exit;
+#if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE)
+   return instruction_pointer(regs) == (unsigned long) &sie_exit;
+#else
+   return false;
+#endif
 }
 
 static unsigned long guest_is_user_mode(struct pt_regs *regs)
-- 
1.8.2.3

--
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] compat: restore timerfd_settime and timerfd_gettime compat

2013-03-02 Thread Heiko Carstens
>From 16f8402d45de11a1699ca584a6605806fe60bfc5 Mon Sep 17 00:00:00 2001
From: Heiko Carstens 
Date: Sat, 2 Mar 2013 12:26:30 +0100
Subject: [PATCH] compat: restore timerfd settime and gettime compat syscalls

Both compat syscalls got lost with 9d94b9e2 "switch timerfd compat syscalls
to COMPAT_SYSCALL_DEFINE" because of a typo:
COMPAT instead of CONFIG_COMPAT.

Signed-off-by: Heiko Carstens 
---
 fs/timerfd.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/timerfd.c b/fs/timerfd.c
index 0e606b1..32b644f 100644
--- a/fs/timerfd.c
+++ b/fs/timerfd.c
@@ -383,10 +383,10 @@ SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct 
itimerspec __user *, otmr)
return copy_to_user(otmr, &kotmr, sizeof(kotmr)) ? -EFAULT: 0;
 }
 
-#ifdef COMPAT
+#ifdef CONFIG_COMPAT
 COMPAT_SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags,
-   const struct itimerspec __user *, utmr,
-   struct itimerspec __user *, otmr)
+   const struct compat_itimerspec __user *, utmr,
+   struct compat_itimerspec __user *, otmr)
 {
struct itimerspec new, old;
int ret;
@@ -402,12 +402,12 @@ COMPAT_SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, 
flags,
 }
 
 COMPAT_SYSCALL_DEFINE2(timerfd_gettime, int, ufd,
-   struct itimerspec __user *, otmr)
+   struct compat_itimerspec __user *, otmr)
 {
struct itimerspec kotmr;
int ret = do_timerfd_gettime(ufd, &kotmr);
if (ret)
return ret;
-   return put_compat_itimerspec(otmr, &t) ? -EFAULT: 0;
+   return put_compat_itimerspec(otmr, &kotmr) ? -EFAULT: 0;
 }
 #endif
-- 
1.7.12.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: Build regressions/improvements in v3.10-rc1 (s390)

2013-05-13 Thread Heiko Carstens
On Sun, May 12, 2013 at 10:50:45PM +0200, Geert Uytterhoeven wrote:
> On Sun, 12 May 2013, Geert Uytterhoeven wrote:
> > However, the full list of errors isn't that unmanageable, so I'm following
> > up with a digested list...
> 
> drivers/net/ethernet/sfc/efx.c:646:3: error: call to 
> '__compiletime_assert_648' declared with attribute error: BUILD_BUG_ON 
> failed: sizeof(struct efx_rx_page_state) + EFX_PAGE_IP_ALIGN + 
> EFX_RX_USR_BUF_SIZE > PAGE_SIZE / 2: 2 errors in 2 logs
>   v3.10-rc1/s390x/s390-allyesconfig v3.10-rc1/s390x/s390-allmodconfig

that seems to a BUILD_BUG_ON that only triggers on s390, because we have
L1_CACHE_BYTES defined with 256 bytes... which seems to be more than any
other architecture has.
There was a different network driver that had a similar BUILD_BUG_ON, but
it got removed.

Right, it was the igb driver:
http://comments.gmane.org/gmane.linux.network/261378

--
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/


  1   2   3   4   5   6   7   8   9   10   >