[PATCH v2 17/20] [SCSI] mpt3sas: Use alloc_ordered_workqueue() API instead of create_singlethread_workqueue() API
Created a thread using alloc_ordered_workqueue() API in order to process the works from firmware Work-queue sequentially instead of create_singlethread_workqueue() API. Changes in v1: No need to check for backport compatibility in the upstream kernel. so removing the else section where driver use create_singlethread_workqueue() API if alloc_ordered_workqueue() API is not defined, This else section is not required since in the latest upstream kernel this alloc_ordered_workqueue() API is always defined. Changes in v2: Patch version change only. Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen Reviewed-by: Joe Lawrence --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 49c412b..a136ec8 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -8024,8 +8024,8 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) /* event thread */ snprintf(ioc->firmware_event_name, sizeof(ioc->firmware_event_name), "fw_event%d", ioc->id); - ioc->firmware_event_thread = create_singlethread_workqueue( - ioc->firmware_event_name); + ioc->firmware_event_thread = alloc_ordered_workqueue( + ioc->firmware_event_name, WQ_MEM_RECLAIM); if (!ioc->firmware_event_thread) { pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__, __func__); -- 2.0.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v1 3/4] touchscreen: colibri-vf50-ts: Add touchscreen support for Colibri VF50
The Colibri Vybrid VF50 module supports 4-wire touchscreens using FETs and ADC inputs. This driver uses the IIO consumer interface and relies on the vf610_adc driver based on the IIO framework. Signed-off-by: Sanchayan Maity --- drivers/input/touchscreen/Kconfig | 12 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/colibri-vf50-ts.c | 466 3 files changed, 479 insertions(+) create mode 100644 drivers/input/touchscreen/colibri-vf50-ts.c diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 80f6386..c243914 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -1027,4 +1027,16 @@ config TOUCHSCREEN_ZFORCE To compile this driver as a module, choose M here: the module will be called zforce_ts. +config TOUCHSCREEN_COLIBRI_VF50 + tristate "Toradex Colibri on board touchscreen driver" + depends on IIO && VF610_ADC + help + Say Y here if you have a Colibri VF50 and plan to use + the on-board provided 4-wire touchscreen driver. + + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called colibri_vf50_ts. + endif diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 44deea7..93746a0 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -84,3 +84,4 @@ obj-$(CONFIG_TOUCHSCREEN_W90X900) += w90p910_ts.o obj-$(CONFIG_TOUCHSCREEN_SX8654) += sx8654.o obj-$(CONFIG_TOUCHSCREEN_TPS6507X) += tps6507x-ts.o obj-$(CONFIG_TOUCHSCREEN_ZFORCE) += zforce_ts.o +obj-$(CONFIG_TOUCHSCREEN_COLIBRI_VF50) += colibri-vf50-ts.o diff --git a/drivers/input/touchscreen/colibri-vf50-ts.c b/drivers/input/touchscreen/colibri-vf50-ts.c new file mode 100644 index 000..4e884f5 --- /dev/null +++ b/drivers/input/touchscreen/colibri-vf50-ts.c @@ -0,0 +1,466 @@ +/* Copyright 2015 Toradex AG + * + * Toradex Colibri VF50 Touchscreen driver + * + * Originally authored by Stefan Agner for 3.0 kernel + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_NAME "colibri-vf50-ts" +#define DRV_VERSION "1.0" + +#define VF_ADC_MAX ((1 << 12) - 1) + +#define COLI_TOUCH_MIN_DELAY_US 1000 +#define COLI_TOUCH_MAX_DELAY_US 2000 + +static int min_pressure = 200; + +struct vf50_touch_device { + struct platform_device *pdev; + struct input_dev*ts_input; + struct workqueue_struct *ts_workqueue; + struct work_struct ts_work; + struct iio_channel *channels; + struct gpio_desc *gpio_xp; + struct gpio_desc *gpio_xm; + struct gpio_desc *gpio_yp; + struct gpio_desc *gpio_ym; + struct gpio_desc *gpio_pen_detect; + struct gpio_desc *gpio_pen_detect_pullup; + int pen_irq; + bool stop_touchscreen; +}; + +/* + * Enables given plates and measures touch parameters using ADC + */ +static int adc_ts_measure(struct iio_channel *channel, + struct gpio_desc *plate_p, struct gpio_desc *plate_m) +{ + int i, value = 0, val = 0; + int ret; + + gpiod_set_value(plate_p, 1); + gpiod_set_value(plate_m, 1); + + /* Use hrtimer sleep since msleep sleeps 10ms+ */ + usleep_range(COLI_TOUCH_MIN_DELAY_US, COLI_TOUCH_MAX_DELAY_US); + + for (i = 0; i < 5; i++) { + ret = iio_read_channel_raw(channel, &val); + if (ret < 0) + return -EINVAL; + + value += val; + } + + value /= 5; + + gpiod_set_value(plate_p, 0); + gpiod_set_value(plate_m, 0); + + return value; +} + +/* + * Enable touch detection using falling edge detection on XM + */ +static void vf50_ts_enable_touch_detection(struct vf50_touch_device *vf50_ts) +{ + /* Enable plate YM (needs to be strong GND, high active) */ + gpiod_set_value(vf50_ts->gpio_ym, 1); + + /* Let the platform mux to GPIO in order to enable Pull-Up on GPIO */ + pinctrl_pm_select_idle_state(&vf50_ts->pdev->dev); +} + +/* + * ADC touch screen sampling worker function + */ +static void vf50_ts_work(struct work_struct *ts_work) +{ + struct vf50_touch_device *vf50_ts = container_of(ts_work, + struct vf50_touch_device, ts_work); + struct device *dev = &vf50_ts->pdev->dev; + int val_x, val_y, val_z1, val_z2, val_p = 0; + bool discard_val_on_start = true; + + while (!vf50_ts->stop_touchscreen) { +
[PATCH v1 1/4] ARM: dts: vfxxx: Add io-channel-cells property for ADC node
This commit adds io-channel-cells property to the ADC node. This property is required in order for an IIO consumer driver to work. Especially required for Colibri VF50, as the touchscreen driver uses ADC channels with the ADC driver based on IIO framework. Signed-off-by: Sanchayan Maity --- arch/arm/boot/dts/vfxxx.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/vfxxx.dtsi b/arch/arm/boot/dts/vfxxx.dtsi index 2c20f3f..f7d8fb6 100644 --- a/arch/arm/boot/dts/vfxxx.dtsi +++ b/arch/arm/boot/dts/vfxxx.dtsi @@ -227,6 +227,7 @@ clocks = <&clks VF610_CLK_ADC0>; clock-names = "adc"; status = "disabled"; + #io-channel-cells = <1>; }; tcon0: tcon@4003d000 { @@ -461,6 +462,7 @@ clocks = <&clks VF610_CLK_ADC1>; clock-names = "adc"; status = "disabled"; + #io-channel-cells = <1>; }; esdhc1: esdhc@400b2000 { -- 2.4.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v1 4/4] input: Add DT binding documentation for Colibri VF50 touchscreen
This adds device tree binding documentation for the Colibri VF50 touchscreen driver. Signed-off-by: Sanchayan Maity --- .../bindings/input/touchscreen/colibri-vf50-ts.txt | 34 ++ 1 file changed, 34 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/touchscreen/colibri-vf50-ts.txt diff --git a/Documentation/devicetree/bindings/input/touchscreen/colibri-vf50-ts.txt b/Documentation/devicetree/bindings/input/touchscreen/colibri-vf50-ts.txt new file mode 100644 index 000..caad52a --- /dev/null +++ b/Documentation/devicetree/bindings/input/touchscreen/colibri-vf50-ts.txt @@ -0,0 +1,34 @@ +* Toradex Colibri VF50 Touchscreen driver + +Required Properties: +- compatible must be toradex,vf50-touchctrl +- io-channels: adc channels being used by the Colibri VF50 module +- xp-gpios: FET gate driver for input of X+ +- xm-gpios: FET gate driver for input of X- +- yp-gpios: FET gate driver for input of Y+ +- ym-gpios: FET gate driver for input of Y- +- pen-detect-gpios: GPIO for pen detect irq +- pen-pullup-gpios: GPIO for pen pullup +- pinctrl-names: "idle", "default", "gpios" +- pinctrl-0: pinctrl node for idle state gpio pinmux +- pinctrl-1: pinctrl node for touch detection state pinmux +- pinctrl-2: pinctrl node for gpios functioning as FET gate drivers + +Example: + + touchctrl: vf50_touchctrl { + compatible = "toradex,vf50-touchctrl"; + io-channels = <&adc1 0>,<&adc0 0>, + <&adc0 1>,<&adc1 2>; + xp-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; + xm-gpios = <&gpio2 29 GPIO_ACTIVE_HIGH>; + yp-gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; + ym-gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>; + pen-detect-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>; + pen-pullup-gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>; + pinctrl-names = "idle","default","gpios"; + pinctrl-0 = <&pinctrl_touchctrl_idle>; + pinctrl-1 = <&pinctrl_touchctrl_default>; + pinctrl-2 = <&pinctrl_touchctrl_gpios>; + status = "disabled"; + }; -- 2.4.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v1 2/4] ARM: dts: vf500-colibri: Add device tree node for touchscreen support
Add device tree node for touchscreen support on Colibri VF50. The touchscreen functionality on VF50 uses the ADC channels of Vybrid and some GPIOs. Also add pinctrl nodes for proper pinmux. Signed-off-by: Sanchayan Maity --- arch/arm/boot/dts/vf500-colibri-eval-v3.dts | 4 +++ arch/arm/boot/dts/vf500-colibri.dtsi| 46 + 2 files changed, 50 insertions(+) diff --git a/arch/arm/boot/dts/vf500-colibri-eval-v3.dts b/arch/arm/boot/dts/vf500-colibri-eval-v3.dts index 7fc782c..c5efb57 100644 --- a/arch/arm/boot/dts/vf500-colibri-eval-v3.dts +++ b/arch/arm/boot/dts/vf500-colibri-eval-v3.dts @@ -15,3 +15,7 @@ model = "Toradex Colibri VF50 on Colibri Evaluation Board"; compatible = "toradex,vf500-colibri_vf50-on-eval", "toradex,vf500-colibri_vf50", "fsl,vf500"; }; + +&touchctrl { + status = "okay"; +}; diff --git a/arch/arm/boot/dts/vf500-colibri.dtsi b/arch/arm/boot/dts/vf500-colibri.dtsi index cee34a3..4807a32 100644 --- a/arch/arm/boot/dts/vf500-colibri.dtsi +++ b/arch/arm/boot/dts/vf500-colibri.dtsi @@ -17,4 +17,50 @@ memory { reg = <0x8000 0x800>; }; + + touchctrl: vf50_touchctrl { + compatible = "toradex,vf50-touchctrl"; + io-channels = <&adc1 0>,<&adc0 0>, + <&adc0 1>,<&adc1 2>; + xp-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; + xm-gpios = <&gpio2 29 GPIO_ACTIVE_HIGH>; + yp-gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; + ym-gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>; + pen-detect-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>; + pen-pullup-gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>; + pinctrl-names = "idle","default","gpios"; + pinctrl-0 = <&pinctrl_touchctrl_idle>; + pinctrl-1 = <&pinctrl_touchctrl_default>; + pinctrl-2 = <&pinctrl_touchctrl_gpios>; + status = "disabled"; + }; +}; + +&iomuxc { + vf610-colibri { + pinctrl_touchctrl_idle: touchctrl_idle { + fsl,pins = < + VF610_PAD_PTA18__GPIO_8 0x206d + VF610_PAD_PTA19__GPIO_9 0x206d + >; + }; + + pinctrl_touchctrl_default: touchctrl_default { + fsl,pins = < + VF610_PAD_PTA18__ADC0_SE0 0x2060 + VF610_PAD_PTA19__ADC0_SE1 0x2060 + VF610_PAD_PTA16__ADC1_SE0 0x2060 + VF610_PAD_PTB2__ADC1_SE20x2060 + >; + }; + + pinctrl_touchctrl_gpios: touchctrl_gpios { + fsl,pins = < + VF610_PAD_PTA23__GPIO_130x22ed + VF610_PAD_PTB23__GPIO_930x22ed + VF610_PAD_PTA22__GPIO_120x22ed + VF610_PAD_PTA11__GPIO_4 0x22ed + >; + }; + }; }; -- 2.4.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 20/20] [SCSI] mpt3sas : Bump mpt3sas driver version to 9.100.00.00
Bump mpt3sas driver version to 9.100.00.00 Changes in v2: Patch version change only. Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen Reviewed-by: Johannes Thumshirn --- drivers/scsi/mpt3sas/mpt3sas_base.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h index 87e9000..f0e462b 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h @@ -71,8 +71,8 @@ #define MPT3SAS_DRIVER_NAME"mpt3sas" #define MPT3SAS_AUTHOR "Avago Technologies " #define MPT3SAS_DESCRIPTION"LSI MPT Fusion SAS 3.0 Device Driver" -#define MPT3SAS_DRIVER_VERSION "06.100.00.00" -#define MPT3SAS_MAJOR_VERSION 6 +#define MPT3SAS_DRIVER_VERSION "09.100.00.00" +#define MPT3SAS_MAJOR_VERSION 9 #define MPT3SAS_MINOR_VERSION 100 #define MPT3SAS_BUILD_VERSION 0 #define MPT3SAS_RELEASE_VERSION00 -- 2.0.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v1 0/4] Add support for touchscreen on Colibri VF50
Hello, The patchset adds support for 4 wire touchscreen on Toradex Colibri VF50 modules. Patches are based on top of shawn's branch. Thanks & Regards, Sanchayan. Sanchayan Maity (4): ARM: dts: vfxxx: Add io-channel-cells property for ADC node ARM: dts: vf500-colibri: Add device tree node for touchscreen support touchscreen: colibri-vf50-ts: Add touchscreen support for Colibri VF50 input: Add DT binding documentation for Colibri VF50 touchscreen .../bindings/input/touchscreen/colibri-vf50-ts.txt | 34 ++ arch/arm/boot/dts/vf500-colibri-eval-v3.dts| 4 + arch/arm/boot/dts/vf500-colibri.dtsi | 46 ++ arch/arm/boot/dts/vfxxx.dtsi | 2 + drivers/input/touchscreen/Kconfig | 12 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/colibri-vf50-ts.c| 466 + 7 files changed, 565 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/touchscreen/colibri-vf50-ts.txt create mode 100644 drivers/input/touchscreen/colibri-vf50-ts.c -- 2.4.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 19/20] [SCSI] mpt3sas: When device is blocked followed by unblock fails, unfreeze the I/Os
Issue: When the disks are getting discovered and assigned device handles by the kernel, a device block followed by an unblock (due to broadcast primitives) issued by the driver is interspersed by the kernel changing the state of the device. Therefore the unblock by the driver results in a no operation within the kernel API. To fix this one, the below patch checks the return of the unblock API and performs a block followed by an unblock to unfreeze the block layer's I/O queue. Sufficient checks and prints are also added in the driver to identify this condition caused by the kernel. Changes in v2: Patch version change only. Signed-off-by: Sreekanth Reddy Reviewed-by: Johannes Thumshirn --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 89 ++-- 1 file changed, 75 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index a136ec8..7e5926c 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -2605,6 +2605,75 @@ _scsih_fw_event_cleanup_queue(struct MPT3SAS_ADAPTER *ioc) } /** + * _scsih_internal_device_block - block the sdev device + * @sdev: per device object + * @sas_device_priv_data : per device driver private data + * + * make sure device is blocked without error, if not + * print an error + */ +static void +_scsih_internal_device_block(struct scsi_device *sdev, + struct MPT3SAS_DEVICE *sas_device_priv_data) +{ + int r = 0; + + sdev_printk(KERN_INFO, sdev, "device_block, handle(0x%04x)\n", + sas_device_priv_data->sas_target->handle); + sas_device_priv_data->block = 1; + + r = scsi_internal_device_block(sdev); + if (r == -EINVAL) + sdev_printk(KERN_WARNING, sdev, + "device_block failed with return(%d) for handle(0x%04x)\n", + sas_device_priv_data->sas_target->handle, r); +} + +/** + * _scsih_internal_device_unblock - unblock the sdev device + * @sdev: per device object + * @sas_device_priv_data : per device driver private data + * make sure device is unblocked without error, if not retry + * by blocking and then unblocking + */ + +static void +_scsih_internal_device_unblock(struct scsi_device *sdev, + struct MPT3SAS_DEVICE *sas_device_priv_data) +{ + int r = 0; + + sdev_printk(KERN_WARNING, sdev, "device_unblock and setting to running, " + "handle(0x%04x)\n", sas_device_priv_data->sas_target->handle); + sas_device_priv_data->block = 0; + r = scsi_internal_device_unblock(sdev, SDEV_RUNNING); + if (r == -EINVAL) { + /* The device has been set to SDEV_RUNNING by SD layer during +* device addition but the request queue is still stopped by +* our earlier block call. We need to perform a block again +* to get the device to SDEV_BLOCK and then to SDEV_RUNNING */ + + sdev_printk(KERN_WARNING, sdev, + "device_unblock failed with return(%d) for handle(0x%04x) " + "performing a block followed by an unblock\n", + sas_device_priv_data->sas_target->handle, r); + sas_device_priv_data->block = 1; + r = scsi_internal_device_block(sdev); + if (r) + sdev_printk(KERN_WARNING, sdev, "retried device_block " + "failed with return(%d) for handle(0x%04x)\n", + sas_device_priv_data->sas_target->handle, r); + + sas_device_priv_data->block = 0; + r = scsi_internal_device_unblock(sdev, SDEV_RUNNING); + if (r) + sdev_printk(KERN_WARNING, sdev, "retried device_unblock" + " failed with return(%d) for handle(0x%04x)\n", + sas_device_priv_data->sas_target->handle, r); + } +} + +/** * _scsih_ublock_io_all_device - unblock every device * @ioc: per adapter object * @@ -2623,11 +2692,10 @@ _scsih_ublock_io_all_device(struct MPT3SAS_ADAPTER *ioc) if (!sas_device_priv_data->block) continue; - sas_device_priv_data->block = 0; dewtprintk(ioc, sdev_printk(KERN_INFO, sdev, "device_running, handle(0x%04x)\n", sas_device_priv_data->sas_target->handle)); - scsi_internal_device_unblock(sdev, SDEV_RUNNING); + _scsih_internal_device_unblock(sdev, sas_device_priv_data); } } @@ -2652,10 +2720,9 @@ _scsih_ublock_io_device(struct MPT3SAS_ADAPTER *ioc, u64 sas_address) if (sas_device_priv_data->sas_target->sas_address != sas_address) continue; - if (sas_device_priv_data->block) { - sas_device_priv_data->block = 0; -
[PATCH v2 18/20] [SCSI] mpt3sas: Call dma_mapping_error() API after mapping an address with dma_map_single() API
Added dma_mapping_error() API after mapping an address with dma_map_single() API. Otherwise when CONFIG_DMA_API_DEBUG is enabled in the kernel, then it complains about mpt3sas driver not calling dma_mapping_error after mapping an address with dma_map_single Changes in v2: Patch version change only. Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen Reviewed-by: Johannes Thumshirn --- drivers/scsi/mpt3sas/mpt3sas_transport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_transport.c b/drivers/scsi/mpt3sas/mpt3sas_transport.c index 7a7aa68..70fd019 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_transport.c +++ b/drivers/scsi/mpt3sas/mpt3sas_transport.c @@ -1964,7 +1964,7 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, } else { dma_addr_out = pci_map_single(ioc->pdev, bio_data(req->bio), blk_rq_bytes(req), PCI_DMA_BIDIRECTIONAL); - if (!dma_addr_out) { + if (pci_dma_mapping_error(ioc->pdev, dma_addr_out)) { pr_info(MPT3SAS_FMT "%s(): DMA Addr out = NULL\n", ioc->name, __func__); rc = -ENOMEM; @@ -1986,7 +1986,7 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, } else { dma_addr_in = pci_map_single(ioc->pdev, bio_data(rsp->bio), blk_rq_bytes(rsp), PCI_DMA_BIDIRECTIONAL); - if (!dma_addr_in) { + if (pci_dma_mapping_error(ioc->pdev, dma_addr_in)) { pr_info(MPT3SAS_FMT "%s(): DMA Addr in = NULL\n", ioc->name, __func__); rc = -ENOMEM; -- 2.0.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 08/20] [SCSI] mpt3sas: Update MPI2 strings to MPI2.5
Update MPI2 strings to MPI2.5. Changes in v2: Patch version change only. Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen Reviewed-by: Johannes Thumshirn --- drivers/scsi/mpt3sas/mpt3sas_base.c | 3 +-- drivers/scsi/mpt3sas/mpt3sas_base.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index bf2d7dc..8730160 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -3924,7 +3924,7 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc, int sleep_flag) mpi_request.WhoInit = MPI2_WHOINIT_HOST_DRIVER; mpi_request.VF_ID = 0; /* TODO */ mpi_request.VP_ID = 0; - mpi_request.MsgVersion = cpu_to_le16(MPI2_VERSION); + mpi_request.MsgVersion = cpu_to_le16(MPI25_VERSION); mpi_request.HeaderVersion = cpu_to_le16(MPI2_HEADER_VERSION); if (_base_is_controller_msix_enabled(ioc)) @@ -4793,7 +4793,6 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc) ioc->build_sg_scmd = &_base_build_sg_scmd_ieee; ioc->build_sg = &_base_build_sg_ieee; ioc->build_zero_len_sge = &_base_build_zero_len_sge_ieee; - ioc->mpi25 = 1; ioc->sge_size_ieee = sizeof(Mpi2IeeeSgeSimple64_t); /* diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h index d635612..c0c774f 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h @@ -826,7 +826,6 @@ struct MPT3SAS_ADAPTER { MPT_BUILD_SG_SCMD build_sg_scmd; MPT_BUILD_SGbuild_sg; MPT_BUILD_ZERO_LEN_SGE build_zero_len_sge; - u8 mpi25; u16 sge_size_ieee; /* function ptr for MPI sg elements only */ -- 2.0.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 03/20] [SCSI] mpt3sas: Don't block the drive when drive addition under the control of SML
During hot-plugging of a disk(having a flaky link), the disk addition stops and any further disk addition or removal doesn't happen on that controller. This is because, when driver receives DELAY_NOT_RESPONDING event for a disk while it is undergoing addition at the SCSI Transport layer, the driver would block the I/O to that disk resulting in a deadlock. i.e the disk addition work couldn't be completed at the SCSI Transport Layer as it can't send any I/Os (such as Inquiry, Report LUNs etc) to the disk as I/Os are blocked to this drive. Also any subsequent device removal (TARGET_NOT_RESPONDING) or link update(RC_PHY_CHANGED) event couldn't be processed as they are in the queue to get processed after disk addition event. Description of Change: Don't block the drive when drive addition is under the control of SML. So that SML won't be blocked of issuing the device dicovery commands (such as Inquiry, Report LUNs etc). Changes in v2: Patch version change only. Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen --- drivers/scsi/mpt3sas/mpt3sas_base.h | 4 +++- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 7 +++ drivers/scsi/mpt3sas/mpt3sas_transport.c | 18 ++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h index a7386ee..01d92db 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h @@ -301,7 +301,8 @@ struct _internal_cmd { * @responding: used in _scsih_sas_device_mark_responding * @fast_path: fast path feature enable bit * @pfa_led_on: flag for PFA LED status - * + * @pend_sas_rphy_add: flag to check if device is in sas_rphy_add() + * addition routine. */ struct _sas_device { struct list_head list; @@ -322,6 +323,7 @@ struct _sas_device { u8 responding; u8 fast_path; u8 pfa_led_on; + u8 pend_sas_rphy_add; }; /** diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 5a97e32..d457dba 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -2644,6 +2644,11 @@ _scsih_block_io_device(struct MPT3SAS_ADAPTER *ioc, u16 handle) { struct MPT3SAS_DEVICE *sas_device_priv_data; struct scsi_device *sdev; + struct _sas_device *sas_device; + + sas_device = _scsih_sas_device_find_by_handle(ioc, handle); + if (!sas_device) + return; shost_for_each_device(sdev, ioc->shost) { sas_device_priv_data = sdev->hostdata; @@ -2653,6 +2658,8 @@ _scsih_block_io_device(struct MPT3SAS_ADAPTER *ioc, u16 handle) continue; if (sas_device_priv_data->block) continue; + if (sas_device->pend_sas_rphy_add) + continue; sas_device_priv_data->block = 1; scsi_internal_device_block(sdev); sdev_printk(KERN_INFO, sdev, diff --git a/drivers/scsi/mpt3sas/mpt3sas_transport.c b/drivers/scsi/mpt3sas/mpt3sas_transport.c index efb98af..7a7aa68 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_transport.c +++ b/drivers/scsi/mpt3sas/mpt3sas_transport.c @@ -649,6 +649,7 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle, unsigned long flags; struct _sas_node *sas_node; struct sas_rphy *rphy; + struct _sas_device *sas_device = NULL; int i; struct sas_port *port; @@ -731,10 +732,27 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle, mpt3sas_port->remote_identify.device_type); rphy->identify = mpt3sas_port->remote_identify; + + if (mpt3sas_port->remote_identify.device_type == SAS_END_DEVICE) { + sas_device = mpt3sas_scsih_sas_device_find_by_sas_address(ioc, + mpt3sas_port->remote_identify.sas_address); + if (!sas_device) { + dfailprintk(ioc, printk(MPT3SAS_FMT + "failure at %s:%d/%s()!\n", + ioc->name, __FILE__, __LINE__, __func__)); + goto out_fail; + } + sas_device->pend_sas_rphy_add = 1; + } + if ((sas_rphy_add(rphy))) { pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__, __func__); } + + if (mpt3sas_port->remote_identify.device_type == SAS_END_DEVICE) + sas_device->pend_sas_rphy_add = 0; + if ((ioc->logging_level & MPT_DEBUG_TRANSPORT)) dev_printk(KERN_INFO, &rphy->dev, "add: handle(0x%04x), sas_addr(0x%016llx)\n", -- 2.0.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More ma
[PATCH v2 09/20] [SCSI] mpt3sas: MPI 2.5 Rev J (2.5.5) specification and 2.00.34 header files
Following is the change set, 1. Added more defines for the BiosOptions field of MPI2_CONFIG_PAGE_BIOS_1. 2. Added MPI2_TOOLBOX_CLEAN_BIT26_PRODUCT_SPECIFIC definition. Changes in v2: Patch version change only. Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen Reviewed-by: Johannes Thumshirn --- drivers/scsi/mpt3sas/mpi/mpi2.h | 5 +++-- drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h | 14 -- drivers/scsi/mpt3sas/mpi/mpi2_tool.h | 4 +++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpi/mpi2.h b/drivers/scsi/mpt3sas/mpi/mpi2.h index d730c5c..c2d127c 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2.h @@ -8,7 +8,7 @@ * scatter/gather formats. * Creation Date: June 21, 2006 * - * mpi2.h Version: 02.00.33 + * mpi2.h Version: 02.00.34 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -90,6 +90,7 @@ * 04-17-13 02.00.31 Bumped MPI2_HEADER_VERSION_UNIT. * 08-19-13 02.00.32 Bumped MPI2_HEADER_VERSION_UNIT. * 12-05-13 02.00.33 Bumped MPI2_HEADER_VERSION_UNIT. + * 01-08-14 02.00.34 Bumped MPI2_HEADER_VERSION_UNIT * -- */ @@ -123,7 +124,7 @@ #define MPI2_VERSION_02_05 (0x0205) /*Unit and Dev versioning for this MPI header set */ -#define MPI2_HEADER_VERSION_UNIT(0x21) +#define MPI2_HEADER_VERSION_UNIT(0x22) #define MPI2_HEADER_VERSION_DEV (0x00) #define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00) #define MPI2_HEADER_VERSION_UNIT_SHIFT (8) diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h b/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h index 62dfbf6..cf2b6bf 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h @@ -6,7 +6,7 @@ * Title: MPI Configuration messages and pages * Creation Date: November 10, 2006 * - * mpi2_cnfg.h Version: 02.00.27 + * mpi2_cnfg.h Version: 02.00.28 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -175,6 +175,8 @@ *MPI2_CONFIG_PAGE_SAS_ENCLOSURE_0. *Added MPI2_SAS_ENCLS0_FLAGS_ENCL_LEVEL_VALID for *MPI2_CONFIG_PAGE_SAS_ENCLOSURE_0. + * 01-08-14 02.00.28 Added more defines for the BiosOptions field of + *MPI2_CONFIG_PAGE_BIOS_1. * -- */ @@ -1334,9 +1336,17 @@ typedef struct _MPI2_CONFIG_PAGE_BIOS_1 { *PTR_MPI2_CONFIG_PAGE_BIOS_1, Mpi2BiosPage1_t, *pMpi2BiosPage1_t; -#define MPI2_BIOSPAGE1_PAGEVERSION (0x05) +#define MPI2_BIOSPAGE1_PAGEVERSION (0x06) /*values for BIOS Page 1 BiosOptions field */ +#define MPI2_BIOSPAGE1_OPTIONS_X86_DISABLE_BIOS(0x0400) + +#define MPI2_BIOSPAGE1_OPTIONS_MASK_REGISTRATION_UEFI_BSD (0x0300) +#define MPI2_BIOSPAGE1_OPTIONS_USE_BIT0_REGISTRATION_UEFI_BSD (0x) +#define MPI2_BIOSPAGE1_OPTIONS_FULL_REGISTRATION_UEFI_BSD (0x0100) +#define MPI2_BIOSPAGE1_OPTIONS_ADAPTER_REGISTRATION_UEFI_BSD (0x0200) +#define MPI2_BIOSPAGE1_OPTIONS_DISABLE_REGISTRATION_UEFI_BSD (0x0300) + #define MPI2_BIOSPAGE1_OPTIONS_MASK_OEM_ID (0x00F0) #define MPI2_BIOSPAGE1_OPTIONS_LSI_OEM_ID (0x) diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_tool.h b/drivers/scsi/mpt3sas/mpi/mpi2_tool.h index 904910d..1629e5b 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_tool.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_tool.h @@ -6,7 +6,7 @@ * Title: MPI diagnostic tool structures and definitions * Creation Date: March 26, 2007 * - * mpi2_tool.h Version: 02.00.11 + * mpi2_tool.h Version: 02.00.12 * * Version History * --- @@ -33,6 +33,7 @@ * 07-26-12 02.00.10 Modified MPI2_TOOLBOX_DIAGNOSTIC_CLI_REQUEST so that * it uses MPI Chain SGE as well as MPI Simple SGE. * 08-19-13 02.00.11 Added MPI2_TOOLBOX_TEXT_DISPLAY_TOOL and related info. + * 01-08-14 02.00.12 Added MPI2_TOOLBOX_CLEAN_BIT26_PRODUCT_SPECIFIC. * -- */ @@ -100,6 +101,7 @@ typedef struct _MPI2_TOOLBOX_CLEAN_REQUEST { #define MPI2_TOOLBOX_CLEAN_OTHER_PERSIST_PAGES (0x2000) #define MPI2_TOOLBOX_CLEAN_FW_CURRENT (0x1000) #define MPI2_TOOLBOX_CLEAN_FW_BACKUP(0x0800) +#define MPI2_TOOLBOX_CLEAN_BIT26_PRODUCT_SPECIFIC (0x0400) #define MPI2_TOOLBOX_CLEAN_MEGARAID (0x0200) #define MPI2_TOOLBOX_CLEAN_INITIALIZATION (0x0100) #define MPI2_TOOLBOX_CLEAN_FLAS
[PATCH v2 07/20] [SCSI] mpt3sas: Bump mpt3sas Driver version to v5.100.00.00
Bump mpt3sas Driver version to v5.100.00.00 Changes in v2: Patch version change only. Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen Reviewed-by: Johannes Thumshirn --- drivers/scsi/mpt3sas/mpt3sas_base.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h index da82a97..d635612 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h @@ -71,8 +71,8 @@ #define MPT3SAS_DRIVER_NAME"mpt3sas" #define MPT3SAS_AUTHOR "Avago Technologies " #define MPT3SAS_DESCRIPTION"LSI MPT Fusion SAS 3.0 Device Driver" -#define MPT3SAS_DRIVER_VERSION "04.100.00.00" -#define MPT3SAS_MAJOR_VERSION 4 +#define MPT3SAS_DRIVER_VERSION "05.100.00.00" +#define MPT3SAS_MAJOR_VERSION 5 #define MPT3SAS_MINOR_VERSION 100 #define MPT3SAS_BUILD_VERSION 0 #define MPT3SAS_RELEASE_VERSION00 -- 2.0.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 02/20] [SCSI] mpt3sas: Get IOC_FACTS information using handshake protocol only after HBA card gets into READY or Operational state.
Driver initialization fails if driver tries to send IOC facts request message when the IOC is in reset or in a fault state. This patch will make sure that 1.Driver to send IOC facts request message only if HBA is in operational or ready state. 2.If IOC is in fault state, a diagnostic reset would be issued. 3.If IOC is in reset state then driver will wait for 10 seconds to exit out of reset state. If the HBA continues to be in reset state, then the HBA wouldn't be claimed by the driver. Changes in v1: If PCI Recovery is on then return with -EFAULT in the function _base_wait_for_iocstate(). Changes in v2: Patch version change only. Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen Reviewed-by: Tomas Henzl --- drivers/scsi/mpt3sas/mpt3sas_base.c | 68 + 1 file changed, 68 insertions(+) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 63a8588..0410cc5 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -3189,6 +3189,9 @@ _base_wait_on_iocstate(struct MPT3SAS_ADAPTER *ioc, u32 ioc_state, int timeout, * Notes: MPI2_HIS_IOC2SYS_DB_STATUS - set to one when IOC writes to doorbell. */ static int +_base_diag_reset(struct MPT3SAS_ADAPTER *ioc, int sleep_flag); + +static int _base_wait_for_doorbell_int(struct MPT3SAS_ADAPTER *ioc, int timeout, int sleep_flag) { @@ -3731,6 +3734,64 @@ _base_get_port_facts(struct MPT3SAS_ADAPTER *ioc, int port, int sleep_flag) } /** + * _base_wait_for_iocstate - Wait until the card is in READY or OPERATIONAL + * @ioc: per adapter object + * @timeout: + * @sleep_flag: CAN_SLEEP or NO_SLEEP + * + * Returns 0 for success, non-zero for failure. + */ +static int +_base_wait_for_iocstate(struct MPT3SAS_ADAPTER *ioc, int timeout, + int sleep_flag) +{ + u32 ioc_state; + int rc; + + dinitprintk(ioc, printk(MPT3SAS_FMT "%s\n", ioc->name, + __func__)); + + if (ioc->pci_error_recovery) { + dfailprintk(ioc, printk(MPT3SAS_FMT + "%s: host in pci error recovery\n", ioc->name, __func__)); + return -EFAULT; + } + + ioc_state = mpt3sas_base_get_iocstate(ioc, 0); + dhsprintk(ioc, printk(MPT3SAS_FMT "%s: ioc_state(0x%08x)\n", + ioc->name, __func__, ioc_state)); + + if (((ioc_state & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_READY) || + (ioc_state & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_OPERATIONAL) + return 0; + + if (ioc_state & MPI2_DOORBELL_USED) { + dhsprintk(ioc, printk(MPT3SAS_FMT + "unexpected doorbell active!\n", ioc->name)); + goto issue_diag_reset; + } + + if ((ioc_state & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_FAULT) { + mpt3sas_base_fault_info(ioc, ioc_state & + MPI2_DOORBELL_DATA_MASK); + goto issue_diag_reset; + } + + ioc_state = _base_wait_on_iocstate(ioc, MPI2_IOC_STATE_READY, + timeout, sleep_flag); + if (ioc_state) { + dfailprintk(ioc, printk(MPT3SAS_FMT + "%s: failed going to ready state (ioc_state=0x%x)\n", + ioc->name, __func__, ioc_state)); + return -EFAULT; + } + + issue_diag_reset: + rc = _base_diag_reset(ioc, sleep_flag); + return rc; +} + +/** * _base_get_ioc_facts - obtain ioc facts reply and save in ioc * @ioc: per adapter object * @sleep_flag: CAN_SLEEP or NO_SLEEP @@ -3748,6 +3809,13 @@ _base_get_ioc_facts(struct MPT3SAS_ADAPTER *ioc, int sleep_flag) dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, __func__)); + r = _base_wait_for_iocstate(ioc, 10, sleep_flag); + if (r) { + dfailprintk(ioc, printk(MPT3SAS_FMT + "%s: failed getting to correct state\n", + ioc->name, __func__)); + return r; + } mpi_reply_sz = sizeof(Mpi2IOCFactsReply_t); mpi_request_sz = sizeof(Mpi2IOCFactsRequest_t); memset(&mpi_request, 0, mpi_request_sz); -- 2.0.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 01/20] [SCSI] mpt3sas: Added Combined Reply Queue feature to extend up-to 96 MSIX vector support
In this patch, increased the number of MSIX vector support for SAS3 C0 HBAs to up-to 96. Following are changes that are done in this patch 1. This feature is enabled only for SAS3 C0 and higher revision cards and also only when reply post free queue count is greater than 8. 2. To support this feature 12 SupplementalReplyPostHostIndex system interfaces are used. MSI-X index numbered from 0 to 7 use the first SupplementalReplyPostHostIndex system interface to update its corresponding ReplyPostHostIndex values, MSI-X index numbered from 8 to 15 will use the second SupplementalReplyPostHostIndex system interface and so on. These 12 SuppementalReplyPostHostIndex system interfaces address are saved in the array replyPostRegisterIndex[]. 3. As each SupplementalReplyPostHostIndex register supports 8 MSI-X vectors. So MSIxIndex field in these register must contain a value between 0 and 7. 4. After processing the reply descriptors from a reply post free queues then update the new reply post host index value in ReplyPostHostIndex field and (msix_index mod 8) value in MSIxIndex field of SupplementalReplyPostHostIndex register. The Address of this SupplementalReplyPostHostIndex register is retrived from (msix_index/8)th entry of replyPostRegisterIndex[] array. Changes in v1: Updated the description of module parameter max_msix_vectors Changes in v2: * Defined some Combined Reply Queue's feature magic values, * Removed unnecessory brackets, * Added comments where ever required. Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen Reviewed-by: Johannes Thumshirn --- drivers/scsi/mpt3sas/mpt3sas_base.c | 93 + drivers/scsi/mpt3sas/mpt3sas_base.h | 14 +- 2 files changed, 98 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 14a781b..63a8588 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -83,10 +83,10 @@ static int msix_disable = -1; module_param(msix_disable, int, 0); MODULE_PARM_DESC(msix_disable, " disable msix routed interrupts (default=0)"); -static int max_msix_vectors = 8; +static int max_msix_vectors = -1; module_param(max_msix_vectors, int, 0); MODULE_PARM_DESC(max_msix_vectors, - " max msix vectors - (default=8)"); + " max msix vectors"); static int mpt3sas_fwfault_debug; MODULE_PARM_DESC(mpt3sas_fwfault_debug, @@ -1009,8 +1009,30 @@ _base_interrupt(int irq, void *bus_id) } wmb(); - writel(reply_q->reply_post_host_index | (msix_index << - MPI2_RPHI_MSIX_INDEX_SHIFT), &ioc->chip->ReplyPostHostIndex); + + /* Update Reply Post Host Index. +* For those HBA's which support combined reply queue feature +* 1. Get the correct Supplemental Reply Post Host Index Register. +*i.e. (msix_index / 8)th entry from Supplemental Reply Post Host +*Index Register address bank i.e replyPostRegisterIndex[], +* 2. Then update this register with new reply host index value +*in ReplyPostIndex field and the MSIxIndex field with +*msix_index value reduced to a value between 0 and 7, +*using a modulo 8 operation. Since each Supplemental Reply Post +*Host Index Register supports 8 MSI-X vectors. +* +* For other HBA's just update the Reply Post Host Index register with +* new reply host index value in ReplyPostIndex Field and msix_index +* value in MSIxIndex field. +*/ + if (ioc->msix96_vector) + writel(reply_q->reply_post_host_index | ((msix_index & 7) << + MPI2_RPHI_MSIX_INDEX_SHIFT), + ioc->replyPostRegisterIndex[msix_index/8]); + else + writel(reply_q->reply_post_host_index | (msix_index << + MPI2_RPHI_MSIX_INDEX_SHIFT), + &ioc->chip->ReplyPostHostIndex); atomic_dec(&reply_q->busy); return IRQ_HANDLED; } @@ -1560,8 +1582,6 @@ _base_check_enable_msix(struct MPT3SAS_ADAPTER *ioc) pci_read_config_word(ioc->pdev, base + 2, &message_control); ioc->msix_vector_count = (message_control & 0x3FF) + 1; - if (ioc->msix_vector_count > 8) - ioc->msix_vector_count = 8; dinitprintk(ioc, pr_info(MPT3SAS_FMT "msix is supported, vector_count(%d)\n", ioc->name, ioc->msix_vector_count)); @@ -1880,6 +1900,36 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) if (r) goto out_fail; + /* Use the Combined reply queue feature only for SAS3 C0 & higher +* revision HBAs and also only when reply queue count is greater than 8 +*/ + if (ioc->msix96_vector && ioc->reply_queue_count > 8) { + /* Determine the Supplemental Reply Post Host Index Registers +* Addresse. Supplemen
[PATCH 00/20] mpt3sas: driver update
This patch set contains all the features and defect fixes from Phase4 to Phase8. Except below patch, all other patches have Reviewed-by signature from either Martin K. Petersen, Johannes Thumshirn, Tomas Henzl and Joe Lawrence. Thanks for reviewing these patches. [PATCH v2 16/20] [SCSI] mpt3sas: Added support for customer specific branding I am posting this patch set once again by promoting all the patches to v2, so that it will be easy to pick up this patch set for next kernel release. Thanks, Sreekanth Sreekanth Reddy (20): [SCSI] mpt3sas: Added Combined Reply Queue feature to extend up-to 96 MSIX vector support [SCSI] mpt3sas: Get IOC_FACTS information using handshake protocol only after HBA card gets into READY or Operational state. [SCSI] mpt3sas: Don't block the drive when drive addition under the control of SML [SCSI] mpt3sas: Remove redundancy code while freeing the controller resources. [SCSI] mpt3sas: MPI 2.5 Rev I (2.5.4) specifications. [SCSI] mpt3sas: Provides the physical location of sas drives [SCSI] mpt3sas: Bump mpt3sas Driver version to v5.100.00.00 [SCSI] mpt3sas: Update MPI2 strings to MPI2.5 [SCSI] mpt3sas: MPI 2.5 Rev J (2.5.5) specification and 2.00.34 header files [SCSI] mpt3sas: Add branding string support for OEM's HBA [SCSI] mpt3sas: Add branding string support for OEM custom HBA [SCSI] mpt3sas: Bump mpt3sas driver version to v6.100.00.00 [SCSI] mpt3sas: MPI 2.5 Rev K (2.5.6) specifications [SCSI] mpt3sas: Complete the SCSI command with DID_RESET status for log_info value 0x0x32010081 [SCSI] mpt3sas: Return host busy error status to SML when DMA mapping of scatter gather list fails for a SCSI command [SCSI] mpt3sas: Added support for customer specific branding [SCSI] mpt3sas: Use alloc_ordered_workqueue() API instead of create_singlethread_workqueue() API [SCSI] mpt3sas: Call dma_mapping_error() API after mapping an address with dma_map_single() API [SCSI] mpt3sas: When device is blocked followed by unblock fails, unfreeze the I/Os [SCSI] mpt3sas : Bump mpt3sas driver version to 9.100.00.00 drivers/scsi/mpt3sas/mpi/mpi2.h | 8 +- drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h | 52 - drivers/scsi/mpt3sas/mpi/mpi2_ioc.h | 4 +- drivers/scsi/mpt3sas/mpi/mpi2_tool.h | 4 +- drivers/scsi/mpt3sas/mpt3sas_base.c | 310 +--- drivers/scsi/mpt3sas/mpt3sas_base.h | 57 - drivers/scsi/mpt3sas/mpt3sas_scsih.c | 343 ++- drivers/scsi/mpt3sas/mpt3sas_transport.c | 22 +- 8 files changed, 694 insertions(+), 106 deletions(-) -- 2.0.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 1/2] USB: ftdi_sio: add CBUS mode for FT232R devices
On Tue, Jun 30, 2015 at 08:46:51AM +0200, Linus Walleij wrote: > On Sun, Jun 21, 2015 at 12:12 AM, Stefan Agner wrote: > > > Add interface to allow CBUS access. The functions set_bitmode and > > read_pins use control transfers only hence should not interfere > > with the serial operation mode. > > > > Signed-off-by: Stefan Agner > > Interesting. Waiting for Johan's review on both patches. See the discussion in the cover letter thread. https://lkml.org/lkml/2015/6/20/205 Johan -- 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: [tip:timers/core] time: Move timeconst.h into include/generated
On Mon, 29 Jun 2015, Stephen Boyd wrote: > On 05/19/2015 06:36 AM, tip-bot for Nicholas Mc Guire wrote: > > Commit-ID: 0a227985d4a993a322ff72ecbaeee2611d624216 > > Gitweb: > > http://git.kernel.org/tip/0a227985d4a993a322ff72ecbaeee2611d624216 > > Author: Nicholas Mc Guire > > AuthorDate: Mon, 18 May 2015 14:19:12 +0200 > > Committer: Thomas Gleixner > > CommitDate: Tue, 19 May 2015 15:13:45 +0200 > > > > time: Move timeconst.h into include/generated > > > > kernel/time/timeconst.h is moved to include/generated/ and generated > > by the top level Kbuild. This allows using timeconst.h in an earlier > > build stage. > > > > Signed-off-by: Nicholas Mc Guire > > Cc: Masahiro Yamada > > Cc: Sam Ravnborg > > Cc: Joe Perches > > Cc: John Stultz > > Cc: Andrew Hunter > > Cc: Paul Turner > > Cc: Michal Marek > > Link: > > http://lkml.kernel.org/r/1431951554-5563-1-git-send-email-hof...@osadl.org > > Signed-off-by: Thomas Gleixner > > --- > > This patch seems to cause kernel/time/time.c to always need to be > recompiled and the vmlinux to be relinked even if nothing has changed. > > make V=2 shows > > CC kernel/time/time.o - due to: include/config/ > > > > diff --git a/Kbuild b/Kbuild > > index 6f0d82a..df99a5f 100644 > > --- a/Kbuild > > +++ b/Kbuild > > @@ -2,8 +2,9 @@ > > # Kbuild for top-level directory of the kernel > > # This file takes care of the following: > > # 1) Generate bounds.h > > -# 2) Generate asm-offsets.h (may need bounds.h) > > -# 3) Check for missing system calls > > +# 2) Generate timeconst.h > > +# 3) Generate asm-offsets.h (may need bounds.h and timeconst.h) > > +# 4) Check for missing system calls > > > > # Default sed regexp - multiline due to syntax constraints > > define sed-y > > @@ -47,7 +48,26 @@ $(obj)/$(bounds-file): kernel/bounds.s FORCE > > $(call filechk,offsets,__LINUX_BOUNDS_H__) > > > > # > > -# 2) Generate asm-offsets.h > > +# 2) Generate timeconst.h > > + > > +timeconst-file := include/generated/timeconst.h > > + > > +#always += $(timeconst-file) > > Is there a reason this is commented out instead of removed? negligence on my side - should have been removed > > > +targets += $(timeconst-file) > > + > > +quiet_cmd_gentimeconst = GEN $@ > > +define cmd_gentimeconst > > [...] > > diff --git a/kernel/time/Makefile b/kernel/time/Makefile > > index 01f0312..ffc4cc3 100644 > > --- a/kernel/time/Makefile > > +++ b/kernel/time/Makefile > > @@ -13,19 +13,4 @@ obj-$(CONFIG_TIMER_STATS)+= > > timer_stats.o > > obj-$(CONFIG_DEBUG_FS) += timekeeping_debug.o > > obj-$(CONFIG_TEST_UDELAY) += test_udelay.o > > > > -$(obj)/time.o: $(obj)/timeconst.h > > - > > -quiet_cmd_hzfile = HZFILE $@ > > - cmd_hzfile = echo "hz=$(CONFIG_HZ)" > $@ > > - > > -targets += hz.bc > > -$(obj)/hz.bc: $(objtree)/include/config/hz.h FORCE > > - $(call if_changed,hzfile) > > - > > -quiet_cmd_bc = BC $@ > > - cmd_bc = bc -q $(filter-out FORCE,$^) > $@ > > - > > -targets += timeconst.h > > -$(obj)/timeconst.h: $(obj)/hz.bc $(src)/timeconst.bc FORCE > > - $(call if_changed,bc) > > - > > +$(obj)/time.o: $(objtree)/include/config/ > > It looks like it has to recompile because of this dependency. Can't we > just remove this line? > yup - thats ok to drop as well - sorry that should have gone out after build testing. thx! hofrat -- 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/6] cgroup: make cftype->private a unsigned long
On 2015/6/26 5:38, Tejun Heo wrote: > It's pretty unusual to have an int as a private data field and it > makes it impossible to carray a pointer value through it. Let's make > it an unsigned long. AFAICS, this shouldn't break anything. > > Signed-off-by: Tejun Heo > Cc: Johannes Weiner > Cc: Li Zefan Acked -- 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 19/51] bdi: make inode_to_bdi() inline
On Fri 22-05-15 17:13:33, Tejun Heo wrote: > Now that bdi definitions are moved to backing-dev-defs.h, > backing-dev.h can include blkdev.h and inline inode_to_bdi() without > worrying about introducing circular include dependency. The function > gets called from hot paths and fairly trivial. > > This patch makes inode_to_bdi() and sb_is_blkdev_sb() that the > function calls inline. blockdev_superblock and noop_backing_dev_info > are EXPORT_GPL'd to allow the inline functions to be used from > modules. > > While at it, make sb_is_blkdev_sb() return bool instead of int. > > v2: Fixed typo in description as suggested by Jan. > > Signed-off-by: Tejun Heo > Reviewed-by: Jens Axboe > Cc: Christoph Hellwig Looks good. Reviewed-by: Jan Kara Honza > --- > fs/block_dev.c | 8 ++-- > fs/fs-writeback.c | 16 > include/linux/backing-dev.h | 18 -- > include/linux/fs.h | 8 +++- > mm/backing-dev.c| 1 + > 5 files changed, 26 insertions(+), 25 deletions(-) > > diff --git a/fs/block_dev.c b/fs/block_dev.c > index e545cbf..f04c873 100644 > --- a/fs/block_dev.c > +++ b/fs/block_dev.c > @@ -547,7 +547,8 @@ static struct file_system_type bd_type = { > .kill_sb= kill_anon_super, > }; > > -static struct super_block *blockdev_superblock __read_mostly; > +struct super_block *blockdev_superblock __read_mostly; > +EXPORT_SYMBOL_GPL(blockdev_superblock); > > void __init bdev_cache_init(void) > { > @@ -688,11 +689,6 @@ static struct block_device *bd_acquire(struct inode > *inode) > return bdev; > } > > -int sb_is_blkdev_sb(struct super_block *sb) > -{ > - return sb == blockdev_superblock; > -} > - > /* Call when you free inode */ > > void bd_forget(struct inode *inode) > diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c > index a69d2e1..34d1cb8 100644 > --- a/fs/fs-writeback.c > +++ b/fs/fs-writeback.c > @@ -78,22 +78,6 @@ int writeback_in_progress(struct backing_dev_info *bdi) > } > EXPORT_SYMBOL(writeback_in_progress); > > -struct backing_dev_info *inode_to_bdi(struct inode *inode) > -{ > - struct super_block *sb; > - > - if (!inode) > - return &noop_backing_dev_info; > - > - sb = inode->i_sb; > -#ifdef CONFIG_BLOCK > - if (sb_is_blkdev_sb(sb)) > - return blk_get_backing_dev_info(I_BDEV(inode)); > -#endif > - return sb->s_bdi; > -} > -EXPORT_SYMBOL_GPL(inode_to_bdi); > - > static inline struct inode *wb_inode(struct list_head *head) > { > return list_entry(head, struct inode, i_wb_list); > diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h > index 5e39f7a..7857820 100644 > --- a/include/linux/backing-dev.h > +++ b/include/linux/backing-dev.h > @@ -11,11 +11,10 @@ > #include > #include > #include > +#include > #include > #include > > -struct backing_dev_info *inode_to_bdi(struct inode *inode); > - > int __must_check bdi_init(struct backing_dev_info *bdi); > void bdi_destroy(struct backing_dev_info *bdi); > > @@ -149,6 +148,21 @@ extern struct backing_dev_info noop_backing_dev_info; > > int writeback_in_progress(struct backing_dev_info *bdi); > > +static inline struct backing_dev_info *inode_to_bdi(struct inode *inode) > +{ > + struct super_block *sb; > + > + if (!inode) > + return &noop_backing_dev_info; > + > + sb = inode->i_sb; > +#ifdef CONFIG_BLOCK > + if (sb_is_blkdev_sb(sb)) > + return blk_get_backing_dev_info(I_BDEV(inode)); > +#endif > + return sb->s_bdi; > +} > + > static inline int bdi_congested(struct backing_dev_info *bdi, int bdi_bits) > { > if (bdi->congested_fn) > diff --git a/include/linux/fs.h b/include/linux/fs.h > index 1ef6390..ce100b87 100644 > --- a/include/linux/fs.h > +++ b/include/linux/fs.h > @@ -2240,7 +2240,13 @@ extern struct super_block *freeze_bdev(struct > block_device *); > extern void emergency_thaw_all(void); > extern int thaw_bdev(struct block_device *bdev, struct super_block *sb); > extern int fsync_bdev(struct block_device *); > -extern int sb_is_blkdev_sb(struct super_block *sb); > + > +extern struct super_block *blockdev_superblock; > + > +static inline bool sb_is_blkdev_sb(struct super_block *sb) > +{ > + return sb == blockdev_superblock; > +} > #else > static inline void bd_forget(struct inode *inode) {} > static inline int sync_blockdev(struct block_device *bdev) { return 0; } > diff --git a/mm/backing-dev.c b/mm/backing-dev.c > index ff85ecb..b0707d1 100644 > --- a/mm/backing-dev.c > +++ b/mm/backing-dev.c > @@ -18,6 +18,7 @@ struct backing_dev_info noop_backing_dev_info = { > .name = "noop", > .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK, > }; > +EXPORT_SYMBOL_GPL(noop_backing_dev_info); > > static struct class *bdi_class; > > -- > 2.4.0 > -- Jan Kara SUSE Labs, CR -- To unsubscribe from this
Re: [PATCH 1/2] USB: ftdi_sio: add CBUS mode for FT232R devices
On Sun, Jun 21, 2015 at 12:12 AM, Stefan Agner wrote: > Add interface to allow CBUS access. The functions set_bitmode and > read_pins use control transfers only hence should not interfere > with the serial operation mode. > > Signed-off-by: Stefan Agner Interesting. Waiting for Johan's review on both patches. Need his or Greg's ACK on patch 1 if I should merge through the GPIO tree. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] perf,tools: get correct cpu id for print_aggr
On Mon, Jun 29, 2015 at 03:55:34PM -0400, kan.li...@intel.com wrote: > From: Kan Liang > > print_aggr fails to print per-core/per-socket statistics after commit > b7f0c203586b ("perf evlist: Propagate cpu maps to evsels in an evlist"), > if events have differnt cpus. Because in print_aggr, aggr_get_id needs > index (not cpu id) to find core/pkg id. > This patch introduced perf_evsel__get_cpumap_index to get the index by > cpu id for a given event. The index can be used to find correct cpu id > for print_aggr. > SNIP > > diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c > index 37e301a..a3ea735 100644 > --- a/tools/perf/builtin-stat.c > +++ b/tools/perf/builtin-stat.c > @@ -708,6 +708,7 @@ static void print_aggr(char *prefix) > nr = 0; > for (cpu = 0; cpu < perf_evsel__nr_cpus(counter); > cpu++) { > cpu2 = perf_evsel__cpus(counter)->map[cpu]; > + cpu2 = perf_evsel__get_cpumap_index(cpu2, > evsel_list->cpus); > s2 = aggr_get_id(evsel_list->cpus, cpu2); > if (s2 != id) > continue; hum, looks like passing the actual cpu number was introduced in: 582ec0829b3d perf stat: Fix per-socket output bug for uncore events also, we already have the index into counter's cpus, why not use those for getting aggregated id (core,socket).. what do I miss? thanks, jirka --- diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 37e301a32f43..47c3c1ffea45 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -694,7 +694,7 @@ static void abs_printout(int id, int nr, struct perf_evsel *evsel, double avg) static void print_aggr(char *prefix) { struct perf_evsel *counter; - int cpu, cpu2, s, s2, id, nr; + int cpu, s, s2, id, nr; double uval; u64 ena, run, val; @@ -707,8 +707,7 @@ static void print_aggr(char *prefix) val = ena = run = 0; nr = 0; for (cpu = 0; cpu < perf_evsel__nr_cpus(counter); cpu++) { - cpu2 = perf_evsel__cpus(counter)->map[cpu]; - s2 = aggr_get_id(evsel_list->cpus, cpu2); + s2 = aggr_get_id(perf_evsel__cpus(counter), cpu); if (s2 != id) continue; val += perf_counts(counter->counts, cpu, 0)->val; -- 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/10] Staging: fbtft: Avoid duplicating code to check gpio.dc value
Avoid duplicating code to verify gpios.dc and call flexfb_verify_gpios_dc instead. Signed-off-by: Fabio Falzoi --- drivers/staging/fbtft/flexfb.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c index cccb0e4..ca14919 100644 --- a/drivers/staging/fbtft/flexfb.c +++ b/drivers/staging/fbtft/flexfb.c @@ -299,15 +299,14 @@ static int flexfb_verify_gpios_dc(struct fbtft_par *par) static int flexfb_verify_gpios_db(struct fbtft_par *par) { - int i; + int i, ret; int num_db = buswidth; fbtft_par_dbg(DEBUG_VERIFY_GPIOS, par, "%s()\n", __func__); + ret = flexfb_verify_gpios_dc(par); + if (ret) + return ret; - if (par->gpio.dc < 0) { - dev_err(par->info->device, "Missing info about 'dc' gpio. Aborting.\n"); - return -EINVAL; - } if (par->gpio.wr < 0) { dev_err(par->info->device, "Missing info about 'wr' gpio. Aborting.\n"); return -EINVAL; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 03/10] Staging: fbtft: Use a struct to describe each LCD controller
Use a struct flexfb_lcd_controller to holds chip properties, instead of relying on a long 'if - else if' chain. This allows to: - use a simple linear search to verify if a certain LCD controller model is supported or not. - add support for a new LCD chip controller simply defining a new flexfb_lcd_controller struct. Signed-off-by: Fabio Falzoi --- drivers/staging/fbtft/fbtft.h | 20 drivers/staging/fbtft/flexfb.c | 212 ++--- 2 files changed, 136 insertions(+), 96 deletions(-) diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h index 7d817eb..c96c06b 100644 --- a/drivers/staging/fbtft/fbtft.h +++ b/drivers/staging/fbtft/fbtft.h @@ -256,6 +256,26 @@ struct fbtft_par { void *extra; }; +/** + * struct flexfb_lcd_controller - Describes the LCD controller properties + * @name: Model name of the chip + * @width: Width of display in pixels + * @height: Height of display in pixels + * @setaddrwin: Which set_addr_win() implementation to use + * @regwidth: LCD Controller Register width in bits + * @init_seq: LCD initialization sequence + * @init_seq_sz: Size of LCD initialization sequence + */ +struct flexfb_lcd_controller { + const char *name; + unsigned int width; + unsigned int height; + unsigned int setaddrwin; + unsigned int regwidth; + int *init_seq; + int init_seq_sz; +}; + #define NUMARGS(...) (sizeof((int[]){__VA_ARGS__})/sizeof(int)) #define write_reg(par, ...) \ diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c index ed867e7..25b394d 100644 --- a/drivers/staging/fbtft/flexfb.c +++ b/drivers/staging/fbtft/flexfb.c @@ -126,6 +126,89 @@ static int ssd1351_init[] = { -1, 0xfd, 0x12, -1, 0xfd, 0xb1, -1, 0xae, -1, 0xb3 -1, 0xab, 0x01, -1, 0xb1, 0x32, -1, 0xb4, 0xa0, 0xb5, 0x55, -1, 0xbb, 0x17, -1, 0xbe, 0x05, -1, 0xc1, 0xc8, 0x80, 0xc8, -1, 0xc7, 0x0f, -1, 0xb6, 0x01, -1, 0xa6, -1, 0xaf, -3 }; +static const struct flexfb_lcd_controller flexfb_chip_table[] = { + { + .name = "st7735r", + .width = 120, + .height = 160, + .init_seq = st7735r_init, + .init_seq_sz = ARRAY_SIZE(st7735r_init), + }, + { + .name = "hx8340bn", + .width = 176, + .height = 220, + .init_seq = hx8340bn_init, + .init_seq_sz = ARRAY_SIZE(hx8340bn_init), + }, + { + .name = "ili9225", + .width = 176, + .height = 220, + .regwidth = 16, + .init_seq = ili9225_init, + .init_seq_sz = ARRAY_SIZE(ili9225_init), + }, + { + .name = "ili9225", + .width = 176, + .height = 220, + .regwidth = 16, + .init_seq = ili9225_init, + .init_seq_sz = ARRAY_SIZE(ili9225_init), + }, + { + .name = "ili9225", + .width = 176, + .height = 220, + .regwidth = 16, + .init_seq = ili9225_init, + .init_seq_sz = ARRAY_SIZE(ili9225_init), + }, + { + .name = "ili9320", + .width = 240, + .height = 320, + .setaddrwin = 1, + .regwidth = 16, + .init_seq = ili9320_init, + .init_seq_sz = ARRAY_SIZE(ili9320_init), + }, + { + .name = "ili9325", + .width = 240, + .height = 320, + .setaddrwin = 1, + .regwidth = 16, + .init_seq = ili9325_init, + .init_seq_sz = ARRAY_SIZE(ili9325_init), + }, + { + .name = "ili9341", + .width = 240, + .height = 320, + .init_seq = ili9341_init, + .init_seq_sz = ARRAY_SIZE(ili9341_init), + }, + { + .name = "ssd1289", + .width = 240, + .height = 320, + .setaddrwin = 2, + .regwidth = 16, + .init_seq = ssd1289_init, + .init_seq_sz = ARRAY_SIZE(ssd1289_init), + }, + { + .name = "ssd1351", + .width = 128, + .height = 128, + .setaddrwin = 3, + .init_seq = ssd1351_init, + .init_seq_sz = ARRAY_SIZE(ssd1351_init), + }, +}; + /* ili9320, ili9325 */ static void flexfb_set_addr_win_1(struct fbtft_par *par, int xs, int ys, int xe, int ye) @@ -248,8 +331,38 @@ static int flexfb_verify_gpios_db(struct fbtft_par *par) return 0; } +static void flexfb_chip_load_param(const struct flexfb_lcd_controller *chip) +{ + if (!width) +
[PATCH 02/10] Staging: fbtft: Remove unnecessary multiple blank lines
This patch removes some unnecessary multiple blank lines to fix the following checkpatch errors: CHECK:LINE_SPACING at lines 29, 67, 131, 287, 299, 312, 326, 351 and 364. Signed-off-by: Fabio Falzoi --- drivers/staging/fbtft/flexfb.c | 11 --- 1 file changed, 11 deletions(-) diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c index 80b6620..ed867e7 100644 --- a/drivers/staging/fbtft/flexfb.c +++ b/drivers/staging/fbtft/flexfb.c @@ -26,7 +26,6 @@ #define DRVNAME"flexfb" - static char *chip; module_param(chip, charp, 0); MODULE_PARM_DESC(chip, "LCD controller"); @@ -64,7 +63,6 @@ static bool latched; module_param(latched, bool, 0); MODULE_PARM_DESC(latched, "Use with latched 16-bit databus"); - static int *initp; static int initp_num; @@ -128,7 +126,6 @@ static int ssd1351_init[] = { -1, 0xfd, 0x12, -1, 0xfd, 0xb1, -1, 0xae, -1, 0xb3 -1, 0xab, 0x01, -1, 0xb1, 0x32, -1, 0xb4, 0xa0, 0xb5, 0x55, -1, 0xbb, 0x17, -1, 0xbe, 0x05, -1, 0xc1, 0xc8, 0x80, 0xc8, -1, 0xc7, 0x0f, -1, 0xb6, 0x01, -1, 0xa6, -1, 0xaf, -3 }; - /* ili9320, ili9325 */ static void flexfb_set_addr_win_1(struct fbtft_par *par, int xs, int ys, int xe, int ye) @@ -284,7 +281,6 @@ static int flexfb_probe_common(struct spi_device *sdev, initp_num = ARRAY_SIZE(st7735r_init); } - } else if (!strcmp(chip, "hx8340bn")) { if (!width) width = 176; @@ -296,7 +292,6 @@ static int flexfb_probe_common(struct spi_device *sdev, initp_num = ARRAY_SIZE(hx8340bn_init); } - } else if (!strcmp(chip, "ili9225")) { if (!width) width = 176; @@ -309,8 +304,6 @@ static int flexfb_probe_common(struct spi_device *sdev, initp_num = ARRAY_SIZE(ili9225_init); } - - } else if (!strcmp(chip, "ili9320")) { if (!width) width = 240; @@ -323,7 +316,6 @@ static int flexfb_probe_common(struct spi_device *sdev, initp_num = ARRAY_SIZE(ili9320_init); } - } else if (!strcmp(chip, "ili9325")) { if (!width) width = 240; @@ -348,7 +340,6 @@ static int flexfb_probe_common(struct spi_device *sdev, initp_num = ARRAY_SIZE(ili9341_init); } - } else if (!strcmp(chip, "ssd1289")) { if (!width) width = 240; @@ -361,8 +352,6 @@ static int flexfb_probe_common(struct spi_device *sdev, initp_num = ARRAY_SIZE(ssd1289_init); } - - } else if (!strcmp(chip, "ssd1351")) { if (!width) width = 128; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 06/10] Staging: fbtft: Use a helper function to set set_addr_win op
Use a helper function to choose which set_addr_win implementation to use, based on the value of the setaddrwin module parameter. Signed-off-by: Fabio Falzoi --- drivers/staging/fbtft/flexfb.c | 47 +- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c index 1b833f9..2a15da1 100644 --- a/drivers/staging/fbtft/flexfb.c +++ b/drivers/staging/fbtft/flexfb.c @@ -470,6 +470,31 @@ static int flexfb_set_platform_bus_func(struct fbtft_par *par, return 0; } +static int flexfb_set_addr_win_func(const struct device *dev, + struct fbtft_par *par) +{ + switch (setaddrwin) { + case 0: + /* use default */ + break; + case 1: + par->fbtftops.set_addr_win = flexfb_set_addr_win_1; + break; + case 2: + par->fbtftops.set_addr_win = flexfb_set_addr_win_2; + break; + case 3: + par->fbtftops.set_addr_win = set_addr_win_3; + break; + default: + dev_err(dev, "argument 'setaddrwin': unknown value %d.\n", + setaddrwin); + return -EINVAL; + } + + return 0; +} + static int flexfb_probe_common(struct spi_device *sdev, struct platform_device *pdev) { @@ -531,25 +556,9 @@ static int flexfb_probe_common(struct spi_device *sdev, if (ret) goto out_release; - /* set_addr_win function */ - switch (setaddrwin) { - case 0: - /* use default */ - break; - case 1: - par->fbtftops.set_addr_win = flexfb_set_addr_win_1; - break; - case 2: - par->fbtftops.set_addr_win = flexfb_set_addr_win_2; - break; - case 3: - par->fbtftops.set_addr_win = set_addr_win_3; - break; - default: - dev_err(dev, "argument 'setaddrwin': unknown value %d.\n", - setaddrwin); - return -EINVAL; - } + ret = flexfb_set_addr_win_func(dev, par); + if (ret) + goto out_release; if (!nobacklight) par->fbtftops.register_backlight = fbtft_register_backlight; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 07/10] Staging: fbtft: Remove useless newline
No newline is needed since checkpatch doesn't complain about line longer than 80 characters for string literals. Signed-off-by: Fabio Falzoi --- drivers/staging/fbtft/flexfb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c index 2a15da1..cccb0e4 100644 --- a/drivers/staging/fbtft/flexfb.c +++ b/drivers/staging/fbtft/flexfb.c @@ -290,8 +290,7 @@ static int flexfb_verify_gpios_dc(struct fbtft_par *par) fbtft_par_dbg(DEBUG_VERIFY_GPIOS, par, "%s()\n", __func__); if (par->gpio.dc < 0) { - dev_err(par->info->device, - "Missing info about 'dc' gpio. Aborting.\n"); + dev_err(par->info->device, "Missing info about 'dc' gpio. Aborting.\n"); return -EINVAL; } -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 10/10] Staging: fbtft: Fix spacing coding style issue
This patch fixes the following checkpatch.pl error: CHECK:SPACING at line 318. Signed-off-by: Fabio Falzoi --- drivers/staging/fbtft/flexfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c index b161050..6cd02b5 100644 --- a/drivers/staging/fbtft/flexfb.c +++ b/drivers/staging/fbtft/flexfb.c @@ -315,7 +315,7 @@ static int flexfb_verify_gpios_db(struct fbtft_par *par) return -EINVAL; } if (latched) - num_db = buswidth/2; + num_db = buswidth / 2; for (i = 0; i < num_db; i++) { if (par->gpio.db[i] < 0) { dev_err(par->info->device, -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 09/10] Staging: fbtft: Fix parenthesis alignment coding style issue
This patch fixes the following checkpatch.pl error: CHECK:PARENTHESIS_ALIGNMENT at line 217. Signed-off-by: Fabio Falzoi --- drivers/staging/fbtft/flexfb.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c index ca14919..b161050 100644 --- a/drivers/staging/fbtft/flexfb.c +++ b/drivers/staging/fbtft/flexfb.c @@ -213,9 +213,8 @@ static const struct flexfb_lcd_controller flexfb_chip_table[] = { static void flexfb_set_addr_win_1(struct fbtft_par *par, int xs, int ys, int xe, int ye) { - fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -"%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", -__func__, xs, ys, xe, ye); + fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", + __func__, xs, ys, xe, ye); switch (par->info->var.rotate) { /* R20h = Horizontal GRAM Start Address */ /* R21h = Vertical GRAM Start Address */ @@ -581,8 +580,8 @@ static int flexfb_remove_common(struct device *dev, struct fb_info *info) return -EINVAL; par = info->par; if (par) - fbtft_par_dbg(DEBUG_DRIVER_INIT_FUNCTIONS, par, - "%s()\n", __func__); + fbtft_par_dbg(DEBUG_DRIVER_INIT_FUNCTIONS, par, "%s()\n", + __func__); fbtft_unregister_framebuffer(info); fbtft_framebuffer_release(info); -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 01/10] Staging: fbtft: Remove paragraph about writing to FSF
Remove paragraph about writing to the Free Software Foundation's mailing address from GPL notice. This patch fixes the following checkpatch error: CHECK:FSF_MAILING_ADDRESS at line 17. Signed-off-by: Fabio Falzoi --- drivers/staging/fbtft/flexfb.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c index 2c4ce07..80b6620 100644 --- a/drivers/staging/fbtft/flexfb.c +++ b/drivers/staging/fbtft/flexfb.c @@ -12,10 +12,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 05/10] Staging: fbtft: Set bus specific ops using separate functions
Use two separate functions for spi and platform bus (flexfb_set_spi_bus_func and flexfb_set_platform_bus_func, respectively) to set the appropriate write operations. This patch corrects the following checkpatch errors: WARNING:LONG_LiINE at lines 446, 450, 466, 476, 489 and 495. CHECK:PARENTHESIS_ALIGNMENT at line 459. Signed-off-by: Fabio Falzoi --- drivers/staging/fbtft/flexfb.c | 154 + 1 file changed, 94 insertions(+), 60 deletions(-) diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c index dae092a..1b833f9 100644 --- a/drivers/staging/fbtft/flexfb.c +++ b/drivers/staging/fbtft/flexfb.c @@ -382,6 +382,94 @@ static int flexfb_set_regwrite_func(const struct device *dev, return 0; } +static int flexfb_emulate_spi_8(struct fbtft_par *par, struct spi_device *sdev) +{ + struct device *dev = &sdev->dev; + int ret; + + dev_warn(dev, "9-bit SPI not available, emulating using 8-bit.\n"); + sdev->bits_per_word = 8; + ret = sdev->master->setup(sdev); + if (ret) + return ret; + + /* allocate buffer with room for dc bits */ + par->extra = devm_kzalloc(par->info->device, + par->txbuf.len + (par->txbuf.len / 8) + 8, + GFP_KERNEL); + if (!par->extra) + return -ENOMEM; + par->fbtftops.write = fbtft_write_spi_emulate_9; + + return 0; +} + +static int flexfb_set_spi_bus_func(struct fbtft_par *par, + struct spi_device *sdev) +{ + struct device *dev = &sdev->dev; + int ret; + + par->fbtftops.write = fbtft_write_spi; + switch (buswidth) { + case 8: + par->fbtftops.write_vmem = fbtft_write_vmem16_bus8; + if (!par->startbyte) + par->fbtftops.verify_gpios = flexfb_verify_gpios_dc; + break; + case 9: + if (regwidth == 16) { + dev_err(dev, "argument 'regwidth': %d is not supported with buswidth=%d and SPI.\n", + regwidth, buswidth); + return -EINVAL; + } + par->fbtftops.write_register = fbtft_write_reg8_bus9; + par->fbtftops.write_vmem = fbtft_write_vmem16_bus9; + sdev->bits_per_word = 9; + ret = sdev->master->setup(sdev); + if (ret) { + ret = flexfb_emulate_spi_8(par, sdev); + if (ret) + return ret; + } + break; + default: + dev_err(dev, "argument 'buswidth': %d is not supported with SPI.\n", + buswidth); + return -EINVAL; + } + + return 0; +} + +static int flexfb_set_platform_bus_func(struct fbtft_par *par, + struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + + par->fbtftops.verify_gpios = flexfb_verify_gpios_db; + switch (buswidth) { + case 8: + par->fbtftops.write = fbtft_write_gpio8_wr; + par->fbtftops.write_vmem = fbtft_write_vmem16_bus8; + break; + case 16: + par->fbtftops.write_register = fbtft_write_reg16_bus16; + if (latched) + par->fbtftops.write = fbtft_write_gpio16_wr_latched; + else + par->fbtftops.write = fbtft_write_gpio16_wr; + par->fbtftops.write_vmem = fbtft_write_vmem16_bus16; + break; + default: + dev_err(dev, "argument 'buswidth': %d is not supported with parallel.\n", + buswidth); + return -EINVAL; + } + + return 0; +} + static int flexfb_probe_common(struct spi_device *sdev, struct platform_device *pdev) { @@ -436,66 +524,12 @@ static int flexfb_probe_common(struct spi_device *sdev, if (ret) goto out_release; - /* bus functions */ - if (sdev) { - par->fbtftops.write = fbtft_write_spi; - switch (buswidth) { - case 8: - par->fbtftops.write_vmem = fbtft_write_vmem16_bus8; - if (!par->startbyte) - par->fbtftops.verify_gpios = flexfb_verify_gpios_dc; - break; - case 9: - if (regwidth == 16) { - dev_err(dev, "argument 'regwidth': %d is not supported with buswidth=%d and SPI.\n", regwidth, buswidth); - return -EINVAL; - } - par->fbtftops.write_register = fbtft_write_reg8_bus9; - par->fbtftops.write_vmem = fbtft_write_vmem16_bus9; -
[PATCH 00/10] Staging: fbtft: flexfb.c file clean up
This patchset aims to refactor the code in flexfb.c, making it more readable and maintanable. Various checkpatch.pl issues are fixed. These patches are created on top of greg-kh's linux-staging tree, staging-testing branch. Fabio Falzoi (10): Staging: fbtft: Remove paragraph about writing to FSF Staging: fbtft: Remove unnecessary multiple blank lines Staging: fbtft: Use a struct to describe each LCD controller Staging: fbtft: Use a helper function to set write_register op Staging: fbtft: Set bus specific ops using separate functions Staging: fbtft: Use a helper function to set set_addr_win op Staging: fbtft: Remove useless newline Staging: fbtft: Avoid duplicating code to check gpio.dc value Staging: fbtft: Fix parenthesis alignment coding style issue Staging: fbtft: Fix spacing coding style issue drivers/staging/fbtft/fbtft.h | 20 ++ drivers/staging/fbtft/flexfb.c | 485 +++-- 2 files changed, 289 insertions(+), 216 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 04/10] Staging: fbtft: Use a helper function to set write_register op
Use a helper function to set the correct write_register function, based on the width of the registers. Signed-off-by: Fabio Falzoi --- drivers/staging/fbtft/flexfb.c | 36 ++-- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c index 25b394d..dae092a 100644 --- a/drivers/staging/fbtft/flexfb.c +++ b/drivers/staging/fbtft/flexfb.c @@ -363,6 +363,25 @@ static int flexfb_chip_init(const struct device *dev) return -EINVAL; } +static int flexfb_set_regwrite_func(const struct device *dev, + struct fbtft_par *par) +{ + switch (regwidth) { + case 8: + par->fbtftops.write_register = fbtft_write_reg8_bus8; + break; + case 16: + par->fbtftops.write_register = fbtft_write_reg16_bus8; + break; + default: + dev_err(dev, "argument 'regwidth': %d is not supported.\n", + regwidth); + return -EINVAL; + } + + return 0; +} + static int flexfb_probe_common(struct spi_device *sdev, struct platform_device *pdev) { @@ -413,20 +432,9 @@ static int flexfb_probe_common(struct spi_device *sdev, par->init_sequence = initp; par->fbtftops.init_display = fbtft_init_display; - /* registerwrite functions */ - switch (regwidth) { - case 8: - par->fbtftops.write_register = fbtft_write_reg8_bus8; - break; - case 16: - par->fbtftops.write_register = fbtft_write_reg16_bus8; - break; - default: - dev_err(dev, - "argument 'regwidth': %d is not supported.\n", - regwidth); - return -EINVAL; - } + ret = flexfb_set_regwrite_func(dev, par); + if (ret) + goto out_release; /* bus functions */ if (sdev) { -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] added tabs instead of spaces
On Tue, Jun 16, 2015 at 10:32 PM, Mario Bambagini wrote: > Tabs have been inserted instead of spaces to indent the code > correctly. Same error fixed four times. > > Signed-off-by: Mario Bambagini Patch applied. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: drm/mgag200: doesn't work in panic context
On Tue, Jun 30, 2015 at 4:53 AM, Rui Wang wrote: > On Monday, June 29, 2015 5:25 PM, Daniel Vetter > wrote: >> As long as the display is up and running we should have a fair stab at >> showing the oops - it's just that no one has seriously bothered with >> the necessary infastructure, automated testing (it won't work >> otherwise) and driver work. > > I think testing can be done by injecting a fatal machine check exception > via einj's debugfs interface. I can reproduce the hard hang every time. > I think It can be a simple script or C program do to the automated testing. > If anyone has any patch I'll be happy to help test it out. Testing shouldn't kill the machine ;-) The idea I had is to just exercise the drm panic code (since we'd need to shunt everything else), and that can be done my calling the relevant functions from a hardirq context. And hardirq context is simples to get with a IPI to the local cpu. This way we don't depend upon the entire panic path to be recoverable, but only upon the drm bits being sane. The other thing that needs testing is pushing all the fbdev callbacks into workers if run from non-process context. But that's something fbdev likes doing anyway (it's just that most drivers don't need to overwrite the hooks where this usually happens). -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 0/2] Add MediaTek display PWM driver
Hi YH, Please also include a patch that adds PWM bindings to mt8173.dtsi. The clock definitions (CLK_MM_DISP_PWM*) are added by James LIao's patch: clk: mediatek: Add subsystem clocks of MT8173 I think it is ok to mention in the cover-letter that the PWM .dtsi change depends on that other patch. Also, cover-letters usually contain a "shortlog" and diffstatm that gives summary of patches and changed files, generated along with the patches using: git format-patch --cover-letter Thanks, -Daniel On Mon, Jun 29, 2015 at 11:03 PM, YH Huang wrote: > This patch series add the use of display PWM driver and documentation > for Mediatek SoCs. The driver is used to support the backlight of > the panel. This is based on v4.1-rc1. > > Change in v3: > 1. Add suspend/resume function > 2. Fix the formula for high_width calculation > 3. Rewrite some code to make it easier to read > 4. Add more information in the commit message > > -- > 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/ -- 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 RESEND v0] arm64: dts: Add APM X-Gene standby GPIO controller DTS entries
On Tue, Jun 16, 2015 at 11:49 AM, Y Vo wrote: > Add standby domain gpio controller for APM X-Gene SoC platform. > > Signed-off-by: Y Vo Acked-by: Linus Walleij Please funnel this through the ARM SoC tree. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] gpio / ACPI: Add label to the gpio request
On Mon, Jun 15, 2015 at 4:29 AM, Alexandre Courbot wrote: > On Mon, Jun 15, 2015 at 7:00 AM, Tobias Diedrich > wrote: >> In leds-gpio.c create_gpio_led only the legacy path propagates the label >> by passing it into devm_gpio_request_one. Similarily gpio_keys_polled.c >> also neglects to propagate the name to the gpio subsystem. >> >> On the newer devicetree/acpi path the label is lost as far as the GPIO >> subsystem goes (it is only retained as name in struct gpio_led. >> >> Amend devm_get_gpiod_from_child to take an additonal (optional) label >> argument and propagate it so it will show up in /sys/kernel/debug/gpio. >> >> So instead of: >> >> GPIOs 288-511, platform/PRP0001:00, AMD SBX00: >> gpio-475 (? ) in hi >> gpio-477 (? ) out hi >> gpio-478 (? ) out lo >> gpio-479 (? ) out hi >> >> we get the much nicer output: >> >> GPIOs 288-511, platform/PRP0001:00, AMD SBX00: >> gpio-475 (switch1 ) in hi >> gpio-477 (led1) out hi >> gpio-478 (led2) out lo >> gpio-479 (led3) out hi > > We want to reuse higher-level information (like the con_id) as much as > possible to generate labels, but in the case of > devm_get_gpiod_from_child() there is no such information available > anyway, so why not. > > Acked-by: Alexandre Courbot I don't have the actual v2 patch in my inbox :( Tobias, can you resend a v3 with the ACKs. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [!GIT PULL] kdbus for 4.2
Am 30.06.2015 um 03:06 schrieb chunshan.zhu: > David's out tree modules kdbus tree > > > https://github.com/systemd/kdbus Thank you Chunshan, but this does not an answer to my questions. Let's try again. ;) Where does (or did?) the development happen? Will it happen on LKML in future? Is there a mailinglist? The reason I'm asking is, reading the discussion behind patches is very useful to understand them. If a reviewer can see the path to a patch with all patch iterations it can help to understand it better and faster. Of course this is not a must, but *very* useful. Thanks, //richard -- 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] futex: Enhance comments in futex_lock_pi() for blocking paths
... serves a bit better to clarify between blocking and non-blocking code paths. Signed-off-by: Davidlohr Bueso --- kernel/futex.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/kernel/futex.c b/kernel/futex.c index c4a182f..153eb22 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -2268,8 +2268,11 @@ static long futex_wait_restart(struct restart_block *restart) /* * Userspace tried a 0 -> TID atomic transition of the futex value * and failed. The kernel side here does the whole locking operation: - * if there are waiters then it will block, it does PI, etc. (Due to - * races the kernel might see a 0 value of the futex too.) + * if there are waiters then it will block as a consequence of relying + * on rt-mutexes, it does PI, etc. (Due to races the kernel might see + * a 0 value of the futex too.). + * + * Also serves as futex trylock_pi()'ing, and due semantics. */ static int futex_lock_pi(u32 __user *uaddr, unsigned int flags, ktime_t *time, int trylock) @@ -2300,6 +2303,10 @@ retry_private: ret = futex_lock_pi_atomic(uaddr, hb, &q.key, &q.pi_state, current, 0); if (unlikely(ret)) { + /* +* Atomic work succeeded and we got the lock, +* or failed. Either way, we do _not_ block. +*/ switch (ret) { case 1: /* We got the lock. */ -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] bufferhead: Add _gfp version for sb_getblk()
sb_getblk() is used during ext4 (and possibly other FSes) writeback paths. Sometimes such path require allocating memory and guaranteeing that such allocation won't block. Currently, however, there is no way to provide user flags for sb_getblk which could lead to deadlocks. This patch implements a sb_getblk_gfp with the only difference it can accept user-provided GFP flags. Signed-off-by: Nikolay Borisov --- As per the discussion in this thread (http://marc.info/?l=linux-ext4&m=143563347324528&w=2) here are the patches which hopefully implement Ted's suggestion. include/linux/buffer_head.h |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 73b4522..e6797de 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -317,6 +317,13 @@ sb_getblk(struct super_block *sb, sector_t block) return __getblk_gfp(sb->s_bdev, block, sb->s_blocksize, __GFP_MOVABLE); } + +static inline struct buffer_head * +sb_getblk_gfp(struct super_block *sb, sector_t block, gfp_t gfp) +{ + return __getblk_gfp(sb->s_bdev, block, sb->s_blocksize, gfp); +} + static inline struct buffer_head * sb_find_get_block(struct super_block *sb, sector_t block) { -- 1.7.1 -- 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] clk: samsung: fix cpu clock's flags checking
On Tue, Jun 30, 2015 at 2:06 AM, Krzysztof Kozlowski wrote: > On 30.06.2015 02:29, Bartlomiej Zolnierkiewicz wrote: >> CLK_CPU_HAS_DIV1 and CLK_CPU_NEEDS_DEBUG_ALT_DIV masks were >> incorrectly used as a bit numbers. Fix it. >> >> Tested on Exynos4210 based Origen board and on Exynos5250 based >> Arndale board. >> >> Cc: Tomasz Figa >> Cc: Michael Turquette >> Cc: Javier Martinez Canillas >> Cc: Thomas Abraham >> Reported-by: Dan Carpenter >> Signed-off-by: Bartlomiej Zolnierkiewicz >> --- >> drivers/clk/samsung/clk-cpu.c | 10 +- >> 1 file changed, 5 insertions(+), 5 deletions(-) > > Reviewed-by: Krzysztof Kozlowski > Looks good to me as well. Reviewed-by: Javier Martinez Canillas > Best regards, > Krzysztof > Best regards, Javier -- 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] futex: Fault/error injection capabilities
Although futexes are well known for being a royal pita, we really have very little debugging capabilities - except for relying on tglx's eye half the time. By simply making use of the existing fault-injection machinery, we can improve this situation, allowing generating artificial uaddress faults and deadlock scenarios. Of course, when this is disabled in production systems, the overhead for failure checks is practically zero -- so this is very cheap at the same time. Future work would be nice to now enhance trinity to make use of this. There is a special tunable 'ignore-private', which can filter out private futexes. Given the tsk->make_it_fail filter and this option, pi futexes can be narrowed down pretty closely. Signed-off-by: Davidlohr Bueso --- Documentation/fault-injection/fault-injection.txt | 11 +++ kernel/futex.c| 89 ++- lib/Kconfig.debug | 7 ++ 3 files changed, 105 insertions(+), 2 deletions(-) diff --git a/Documentation/fault-injection/fault-injection.txt b/Documentation/fault-injection/fault-injection.txt index 4cf1a2a..415484f 100644 --- a/Documentation/fault-injection/fault-injection.txt +++ b/Documentation/fault-injection/fault-injection.txt @@ -15,6 +15,10 @@ o fail_page_alloc injects page allocation failures. (alloc_pages(), get_free_pages(), ...) +o fail_futex + + injects futex deadlock and uaddr fault errors. + o fail_make_request injects disk IO errors on devices permitted by setting @@ -113,6 +117,12 @@ configuration of fault-injection capabilities. specifies the minimum page allocation order to be injected failures. +- /sys/kernel/debug/fail_futex/ignore-private: + + Format: { 'Y' | 'N' } + default is 'N', setting it to 'Y' will disable failure injections + when dealing with private (address space) futexes. + o Boot option In order to inject faults while debugfs is not available (early boot time), @@ -121,6 +131,7 @@ use the boot option: failslab= fail_page_alloc= fail_make_request= + fail_futex= mmc_core.fail_request=,,, How to add new fault injection capability diff --git a/kernel/futex.c b/kernel/futex.c index 153eb22..6ea31bb 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -64,6 +64,7 @@ #include #include #include +#include #include @@ -258,6 +259,66 @@ static unsigned long __read_mostly futex_hashsize; static struct futex_hash_bucket *futex_queues; +/* + * Fault injections for futexes. + */ +#ifdef CONFIG_FAIL_FUTEX + +static struct { + struct fault_attr attr; + + u32 ignore_private; +} fail_futex = { + .attr = FAULT_ATTR_INITIALIZER, + .ignore_private = 0, +}; + +static int __init setup_fail_futex(char *str) +{ + return setup_fault_attr(&fail_futex.attr, str); +} +__setup("fail_futex=", setup_fail_futex); + +bool should_fail_futex(bool fshared) +{ + if (fail_futex.ignore_private && !fshared) + return false; + + return should_fail(&fail_futex.attr, 1); +} + +#ifdef CONFIG_FAULT_INJECTION_DEBUG_FS + +static int __init fail_futex_debugfs(void) +{ + umode_t mode = S_IFREG | S_IRUSR | S_IWUSR; + struct dentry *dir; + + dir = fault_create_debugfs_attr("fail_futex", NULL, + &fail_futex.attr); + if (IS_ERR(dir)) + return PTR_ERR(dir); + + if (!debugfs_create_bool("ignore-private", mode, dir, +&fail_futex.ignore_private)) { + debugfs_remove_recursive(dir); + return -ENOMEM; + } + + return 0; +} + +late_initcall(fail_futex_debugfs); + +#endif /* CONFIG_FAULT_INJECTION_DEBUG_FS */ + +#else +static inline bool should_fail_futex(bool fshared) +{ + return false; +} +#endif /* CONFIG_FAIL_FUTEX */ + static inline void futex_get_mm(union futex_key *key) { atomic_inc(&key->private.mm->mm_count); @@ -413,6 +474,9 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, int rw) if (unlikely(!access_ok(rw, uaddr, sizeof(u32 return -EFAULT; + if (unlikely(should_fail_futex(fshared))) + return -EFAULT; + /* * PROCESS_PRIVATE futexes are fast. * As the mm cannot disappear under us and the 'key' only needs @@ -428,6 +492,10 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, int rw) } again: + /* Ignore any VERIFY_READ mapping (futex common case) */ + if (unlikely(should_fail_futex(fshared))) + return -EFAULT; + err = get_user_pages_fast(address, 1, 1, &page); /* * If write access is not required (eg. FUTEX_WAIT), try @@ -516,7 +584,7 @@ again: * A RO anonymous page will never change and thus doesn't make * sense for futex operations. */ -
[PATCH 2/2] ext4: make use of sb_getblk_gfp
Switch ext4 to using sb_getblk_gfp with GFP_NOFS added, this fixes possible deadlocks in the page writeback path. Signed-off-by: Nikolay Borisov --- fs/ext4/extents.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index e003a1e..87ba10d 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -503,7 +503,7 @@ __read_extent_tree_block(const char *function, unsigned int line, struct buffer_head *bh; int err; - bh = sb_getblk(inode->i_sb, pblk); + bh = sb_getblk_gfp(inode->i_sb, pblk, __GFP_MOVABLE | GFP_NOFS); if (unlikely(!bh)) return ERR_PTR(-ENOMEM); @@ -1088,7 +1088,7 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode, err = -EIO; goto cleanup; } - bh = sb_getblk(inode->i_sb, newblock); + bh = sb_getblk_gfp(inode->i_sb, newblock, __GFP_MOVABLE | GFP_NOFS); if (unlikely(!bh)) { err = -ENOMEM; goto cleanup; @@ -1282,7 +1282,7 @@ static int ext4_ext_grow_indepth(handle_t *handle, struct inode *inode, if (newblock == 0) return err; - bh = sb_getblk(inode->i_sb, newblock); + bh = sb_getblk_gfp(inode->i_sb, newblock, __GFP_MOVABLE | GFP_NOFS); if (unlikely(!bh)) return -ENOMEM; lock_buffer(bh); -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 2/2] arm64: dts: mt8173: Add I2C device node
On Fri, Jun 12, 2015 at 7:13 PM, Matthias Brugger wrote: > In the future when all the device drivers are implemented, this gets you a > really huge dtsi. AFAIK this can cause a somewhat long parsing time of the dtb > when booting the system. Boot time claims need to be backed up with ftrace logs or something. One of the arguments against device tree in the beginning was parse time and then we made measurements and it proved moot. However being unable to manage the dts[i] sources is a valid argument for simplifying and splitting up stuff. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH -tip 0/2] futex: Fault/error injection capabilities
Hello, I've been wanting this for a while to improve overall futex testing. I must say that I checked rather late when I was nearly finished with patch 2 if something similar for futexes had already been proposed. Sure enough, in 2009 this was discussed[1]. Coincidently, I also took the natural approach of making use of our fault-injection machinery. I have no idea if perf nowadays does such things, and if it does not, I honestly don't have the bandwidth to do it Ingo's preferred way -- when there is nothing wrong with this approach, imho (0 overhead). Anyway, here's a working patch. Patch 1 is merely a trivial add-on. [1]: https://lwn.net/Articles/364742/ Thanks! Davidlohr Bueso (2): futex: Enhance comments in futex_lock_pi() for blocking paths futex: Fault/error injection capabilities Documentation/fault-injection/fault-injection.txt | 11 +++ kernel/futex.c| 100 +- lib/Kconfig.debug | 7 ++ 3 files changed, 114 insertions(+), 4 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] ALSA: Fix uninintialized error return
On 29/06/15 18:10, Takashi Iwai wrote: > At Mon, 29 Jun 2015 17:10:22 +0100, > Colin King wrote: >> >> From: Colin Ian King >> >> Static analysis with cppcheck found the following error: >> [sound/core/init.c:118]: (error) Uninitialized variable: err >> >> ..this was introduced by commit 2471b6c80a70e80de69f5ff4c37187c3912e5874 >> ("ALSA: info: Register proc entries recursively, too") where the call >> to snd_info_card_register was removed and no longer setting the error >> return in err. When snd_info_create_card_entry fails to allocate a >> an entry, the error path exits with garbage in err. Fix is to return >> -ENOMEM if entry fails to be allocated. >> >> Author: Takashi Iwai >> Date: Mon May 18 09:20:24 2015 +0200 > > These two lines seem superfluous. I removed them and applied the > patch now. Thanks. > Thanks, somehow I missed that cut-n-paste mistake. > > Takashi > >> >> Fixes: 2471b6c80a ("ALSA: info: Register proc entries recursively, too") >> Signed-off-by: Colin Ian King >> --- >> sound/core/init.c | 3 +-- >> 1 file changed, 1 insertion(+), 2 deletions(-) >> >> diff --git a/sound/core/init.c b/sound/core/init.c >> index 3e0ceba..20f37fb 100644 >> --- a/sound/core/init.c >> +++ b/sound/core/init.c >> @@ -109,13 +109,12 @@ static void snd_card_id_read(struct snd_info_entry >> *entry, >> >> static int init_info_for_card(struct snd_card *card) >> { >> -int err; >> struct snd_info_entry *entry; >> >> entry = snd_info_create_card_entry(card, "id", card->proc_root); >> if (!entry) { >> dev_dbg(card->dev, "unable to create card entry\n"); >> -return err; >> +return -ENOMEM; >> } >> entry->c.text.read = snd_card_id_read; >> card->proc_id = entry; >> -- >> 2.1.4 >> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] pinctrl: samsung: Remove old unused defines
On Mon, Jun 15, 2015 at 6:54 AM, Krzysztof Kozlowski wrote: > Since 9a2c1c3b91aa ("pinctrl: samsung: Allow grouping multiple > pinmux/pinconf nodes") the defines for GPIO group and function names are > not used anywhere in the driver. > > Signed-off-by: Krzysztof Kozlowski > Inspired-by: Dan Carpenter Patch applied. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] gpio: generic: add get_direction support
On Fri, Jun 12, 2015 at 6:20 PM, Philipp Zabel wrote: > Allow to determine the current direction configuration by > reading back from the direction register. > > Signed-off-by: Philipp Zabel Patch applied for the next kernel cycle (4.3). Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 2/2] schedstat: Expose /proc/pid/schedstat if CONFIG_SCHED_INFO is set
On 2015/06/30 11:25AM, Srikar Dronamraju wrote: > * Naveen N. Rao [2015-06-25 23:53:38]: > > > /* > > * Provides /proc/PID/schedstat > > */ > > static int proc_pid_schedstat(struct seq_file *m, struct pid_namespace *ns, > > struct pid *pid, struct task_struct *task) > > { > > - seq_printf(m, "%llu %llu %lu\n", > > + if (unlikely(!sched_info_on())) > > + seq_printf(m, "0 0 0\n"); > > + else > > + seq_printf(m, "%llu %lld %ld\n", > > Should the above be seq_printf(m, "%llu %llu %lu\n", ? Yikes! Nice catch, thanks! This looks to be left over from my tests with returning -1. Fixed patch on the way... Regards, Naveen -- 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] backlight: lp855x: use private data for regulator control
LP855x backlight device can be enabled by external VDD input. The 'supply' data is used for this purpose. It's kind of private data which runs internally, so there is no reason to expose to the platform data. And LP855x DT property, 'power-supply' is unnecessary. If a regulator is registered correctly, then lp855x driver can get regulator resource by using devm_regulator_get(). So devm_regulator_get() is moved from _parse_dt() to _probe(). Ex) The following device tree works without 'power-supply' property. i2c0: i2c@10002000 { (snip) backlight@2c { compatible = "ti,lp8556"; reg = <0x2c>; bl-name = "lcd-bl"; dev-ctrl = /bits/ 8 <0x85>; init-brt = /bits/ 8 <0x10>; }; }; /* 'power' regulator for LP8556 VDD */ bl_vdd: fixed-regulator@1 { compatible = "regulator-fixed"; regulator-name = "power"; regulator-min-microvolt = <330>; regulator-max-microvolt = <330>; (snip) }; Cc: Sean Paul Cc: Jingoo Han Cc: Lee Jones Cc: devicet...@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Milo Kim --- .../devicetree/bindings/video/backlight/lp855x.txt | 2 -- drivers/video/backlight/lp855x_bl.c | 20 +--- include/linux/platform_data/lp855x.h | 2 -- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Documentation/devicetree/bindings/video/backlight/lp855x.txt b/Documentation/devicetree/bindings/video/backlight/lp855x.txt index 0a3ecbc..96e83a5 100644 --- a/Documentation/devicetree/bindings/video/backlight/lp855x.txt +++ b/Documentation/devicetree/bindings/video/backlight/lp855x.txt @@ -12,7 +12,6 @@ Optional properties: - pwm-period: PWM period value. Set only PWM input mode used (u32) - rom-addr: Register address of ROM area to be updated (u8) - rom-val: Register value to be updated (u8) - - power-supply: Regulator which controls the 3V rail Example: @@ -57,7 +56,6 @@ Example: backlight@2c { compatible = "ti,lp8557"; reg = <0x2c>; - power-supply = <&backlight_vdd>; dev-ctrl = /bits/ 8 <0x41>; init-brt = /bits/ 8 <0x0a>; diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c index a26d3bb..277d5ca 100644 --- a/drivers/video/backlight/lp855x_bl.c +++ b/drivers/video/backlight/lp855x_bl.c @@ -73,6 +73,7 @@ struct lp855x { struct device *dev; struct lp855x_platform_data *pdata; struct pwm_device *pwm; + struct regulator *supply; /* regulator for VDD input */ }; static int lp855x_write_byte(struct lp855x *lp, u8 reg, u8 data) @@ -384,13 +385,6 @@ static int lp855x_parse_dt(struct lp855x *lp) pdata->rom_data = &rom[0]; } - pdata->supply = devm_regulator_get(dev, "power"); - if (IS_ERR(pdata->supply)) { - if (PTR_ERR(pdata->supply) == -EPROBE_DEFER) - return -EPROBE_DEFER; - pdata->supply = NULL; - } - lp->pdata = pdata; return 0; @@ -431,8 +425,12 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id) else lp->mode = REGISTER_BASED; - if (lp->pdata->supply) { - ret = regulator_enable(lp->pdata->supply); + lp->supply = devm_regulator_get(lp->dev, "power"); + if (IS_ERR(lp->supply)) + lp->supply = NULL; + + if (lp->supply) { + ret = regulator_enable(lp->supply); if (ret < 0) { dev_err(&cl->dev, "failed to enable supply: %d\n", ret); return ret; @@ -470,8 +468,8 @@ static int lp855x_remove(struct i2c_client *cl) lp->bl->props.brightness = 0; backlight_update_status(lp->bl); - if (lp->pdata->supply) - regulator_disable(lp->pdata->supply); + if (lp->supply) + regulator_disable(lp->supply); sysfs_remove_group(&lp->dev->kobj, &lp855x_attr_group); return 0; diff --git a/include/linux/platform_data/lp855x.h b/include/linux/platform_data/lp855x.h index 9c7fd1e..1b2ba24 100644 --- a/include/linux/platform_data/lp855x.h +++ b/include/linux/platform_data/lp855x.h @@ -136,7 +136,6 @@ struct lp855x_rom_data { Only valid when mode is PWM_BASED. * @size_program : total size of lp855x_rom_data * @rom_data : list of new eeprom/eprom registers - * @supply : regulator that supplies 3V input */ struct lp855x_platform_data { const char *name; @@ -145,7 +144,6 @@ struct lp855x_platform_data { unsigned int period_ns; int size_program; struct lp855x_rom_data *rom_data; - st
Re: [PATCH] rts5208:Fix checkpatch warnings
On Tue, Jun 30, 2015 at 11:25:24AM +0530, Ravi Teja Darbha wrote: > Else condition after if statement is not necessary, hence removed. else is not necessary after if??? then what it is supposed to be used? :) I think your commit message should have been: "else is not necessary after return statement." regards sudip -- 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/3] mfd: Remove MFD_CROS_EC depends on X86 || ARM
[Re: [PATCH 2/3] mfd: Remove MFD_CROS_EC depends on X86 || ARM] On 25/06/2015 (Thu 10:44) Javier Martinez Canillas wrote: > Hello Lee, > > On 06/25/2015 10:38 AM, Lee Jones wrote: > > On Thu, 25 Jun 2015, Javier Martinez Canillas wrote: > > > >> A dependency on X86 || ARM for MFD_CROS_EC was added to fix the warning: > >> > >> (MFD_CROS_EC) selects CHROME_PLATFORMS which has unmet direct dependencies > >> (X86 || ARM) > >> > >> This happened because CHROME_PLATFORMS had a dependency on X86 || ARM but > >> that dependency was removed since there isn't a reason why the option can > >> not be selected on other architectures. So now the above warning will not > >> happen and the MFD_CROS_EC dependency can be removed since is not needed. > >> > >> Signed-off-by: Javier Martinez Canillas > >> --- > >> > >> drivers/mfd/Kconfig | 1 - > >> 1 file changed, 1 deletion(-) > > > > Applied for v4.3, thanks. > > > > Thanks a lot. > > Olof, > > Could you please ack patch 1/3 so Lee can pick it through the mfd tree? > Since both patches 1/3 and 2/3 are needed to fix the build warning for > !X86 and !ARM architectures. Checking this didn't fall through the cracks ; still seeing the issue in xtensa (and other arch) builds of linux-next currently: http://kisskb.ellerman.id.au/kisskb/buildresult/12452368/ Paul. -- > > Best regards, > Javier -- 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: vfio: powerpc/spapr: One function call less in tce_iommu_attach_group() after kzalloc() failure
>>> than the existing one should have been renamed to "free_exit" or >>> "free_unlock_exit" >>> and new one would be "unlock_exit". >> >> I chose a smaller change at this place. > > I'd just drop this patch. How do you think about to improve the affected jump labels a bit more there? Regards, Markus -- 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] watchdog: omap_wdt: early_enable module parameter
On Thu, Jun 25, 2015 at 9:46 AM, Guenter Roeck wrote: > On 06/25/2015 03:21 AM, poesc...@lemonage.de wrote: >> >> From: Lars Poeschel >> >> Add a early_enable module parameter to the omap_wdt that starts the >> watchdog on module insertion. The default value is 0 which does not >> start the watchdog - which also does not change the behavior if the >> parameter is not given. >> >> Signed-off-by: Lars Poeschel > > > Reviewed-by: Guenter Roeck In case the info hasn't looped back around yet, this breaks the omap builds in linux-next: drivers/watchdog/omap_wdt.c:288:18: error: 'omap_wdt' undeclared (first use in this function) (Not sure how this could have ever worked as-is.) http://kisskb.ellerman.id.au/kisskb/buildresult/12452335/ I see a patch has already been posted to arm-kernel but not Cc'd to all originally involved so figured I'd mention it. Paul. -- > > > -- > 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/ -- 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 2/2] schedstat: Expose /proc/pid/schedstat if CONFIG_SCHED_INFO is set
* Naveen N. Rao [2015-06-25 23:53:38]: > /* > * Provides /proc/PID/schedstat > */ > static int proc_pid_schedstat(struct seq_file *m, struct pid_namespace *ns, > struct pid *pid, struct task_struct *task) > { > - seq_printf(m, "%llu %llu %lu\n", > + if (unlikely(!sched_info_on())) > + seq_printf(m, "0 0 0\n"); > + else > + seq_printf(m, "%llu %lld %ld\n", Should the above be seq_printf(m, "%llu %llu %lu\n", ? > (unsigned long long)task->se.sum_exec_runtime, > (unsigned long long)task->sched_info.run_delay, > task->sched_info.pcount); > -- > 2.4.0 > -- Thanks and Regards Srikar Dronamraju -- 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] rtl8712:Fix checkpatch warning
On 06/29/2015 11:29 PM, Sudip Mukherjee wrote: On Tue, Jun 30, 2015 at 01:27:47AM +0530, Ravi Teja Darbha wrote: 1. Fix line over 80 characters warning. 2. The checkpatch warning at line 499 seems to be false positive. WARNING: else is not generally useful after a break or return #499: FILE: rtl8712_recv.c:499: +return false; +else while(condition1) { if(condition2) foo(); else if(condition3) return false; else break; } The else condition here cannot be eliminated You can try something like this to eliminate the else: diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c index fcb8c61..165161b 100644 --- a/drivers/staging/rtl8712/rtl8712_recv.c +++ b/drivers/staging/rtl8712/rtl8712_recv.c @@ -492,12 +492,13 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, while (end_of_queue_search(phead, plist) == false) { pnextrframe = LIST_CONTAINOR(plist, union recv_frame, u); pnextattrib = &pnextrframe->u.hdr.attrib; - if (SN_LESS(pnextattrib->seq_num, pattrib->seq_num)) + if (SN_LESS(pnextattrib->seq_num, pattrib->seq_num)) { plist = plist->next; + continue; + } else if (SN_EQUAL(pnextattrib->seq_num, pattrib->seq_num)) return false; - else - break; + break; } list_del_init(&(prframe->u.hdr.list)); list_add_tail(&(prframe->u.hdr.list), plist); NACK on this idea. Checkpatch is not the complete arbiter of style. Just leave the code alone. Larry -- 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] rts5208:Fix checkpatch warnings
Else condition after if statement is not necessary, hence removed. Signed-off-by: Ravi Teja Darbha --- drivers/staging/rts5208/xd.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rts5208/xd.c b/drivers/staging/rts5208/xd.c index 10fea7b..42d8d82 100644 --- a/drivers/staging/rts5208/xd.c +++ b/drivers/staging/rts5208/xd.c @@ -1689,10 +1689,9 @@ static int xd_read_multiple_pages(struct rtsx_chip *chip, u32 phy_blk, xd_set_err_code(chip, XD_TO_ERROR); rtsx_trace(chip); return STATUS_FAIL; - } else { - rtsx_trace(chip); - goto Fail; } + rtsx_trace(chip); + goto Fail; } return STATUS_SUCCESS; @@ -1905,10 +1904,9 @@ static int xd_write_multiple_pages(struct rtsx_chip *chip, u32 old_blk, xd_set_err_code(chip, XD_TO_ERROR); rtsx_trace(chip); return STATUS_FAIL; - } else { - rtsx_trace(chip); - goto Fail; } + rtsx_trace(chip); + goto Fail; } if (end_page == (xd_card->page_off + 1)) { -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
linux-next: Tree for Jun 30
Hi all, Changes since 20150629: I added a supplied patch to the akpm tree to fix a build problem. Non-merge commits (relative to Linus' tree): 1766 1583 files changed, 96150 insertions(+), 24683 deletions(-) I have created today's linux-next tree at git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git (patches at http://www.kernel.org/pub/linux/kernel/next/ ). If you are tracking the linux-next tree using git, you should not use "git pull" to do so as that will try to merge the new linux-next release with the old one. You should use "git fetch" and checkout or reset to the new master. You can see which trees have been included by looking in the Next/Trees file in the source. There are also quilt-import.log and merge.log files in the Next directory. Between each merge, the tree was built with a ppc64_defconfig for powerpc and an allmodconfig for x86_64 and a multi_v7_defconfig for arm. After the final fixups (if any), it is also built with powerpc allnoconfig (32 and 64 bit), ppc44x_defconfig and allyesconfig (this fails its final link) and i386, sparc, sparc64 and arm defconfig. Below is a summary of the state of the merge. I am currently merging 221 trees (counting Linus' and 31 trees of patches pending for Linus' tree). Stats about the size of the tree over time can be seen at http://neuling.org/linux-next-size.html . Status of my local build tests will be at http://kisskb.ellerman.id.au/linux-next . If maintainers want to give advice about cross compilers/configs that work, we are always open to add more builds. Thanks to Randy Dunlap for doing many randconfig builds. And to Paul Gortmaker for triage and bug fixes. -- Cheers, Stephen Rothwells...@canb.auug.org.au $ git checkout master $ git reset --hard stable Merging origin/master (6aaf0da8728c Merge tag 'md/4.2' of git://neil.brown.name/md) Merging fixes/master (e0dd880a545c Merge branch 'for-4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq) Merging kbuild-current/rc-fixes (c517d838eb7d Linux 4.0-rc1) Merging arc-current/for-curr (e4140819dadc ARC: signal handling robustify) Merging arm-current/fixes (0bbe6b5a73c0 ARM: 8388/1: tcm: Don't crash when TCM banks are protected by TrustZone) Merging m68k-current/for-linus (1214c525484c m68k: Use for_each_sg()) Merging metag-fixes/fixes (0164a711c97b metag: Fix ioremap_wc/ioremap_cached build errors) Merging mips-fixes/mips-fixes (1795cd9b3a91 Linux 3.16-rc5) Merging powerpc-merge-mpe/fixes (b953c0d234bc Linux 4.1) Merging powerpc-merge/merge (c517d838eb7d Linux 4.0-rc1) Merging sparc/master (4a10a91756ef Merge branch 'upstream' of git://git.infradead.org/users/pcmoore/audit) Merging net/master (1625fecf56e0 net: icplus: fix typo in constant name) Merging ipsec/master (31a418986a58 xen: netback: read hotplug script once at start of day.) Merging sound-current/for-linus (0755e74b8f04 ALSA: Fix uninintialized error return) Merging pci-current/for-linus (552bc94ebeeb PCI: Preserve resource size during alignment reordering) Merging wireless-drivers/master (38fe44e61a89 Merge tag 'iwlwifi-for-kalle-2015-05-28' of https://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-fixes) Merging driver-core.current/driver-core-linus (d4a4f75cd8f2 Linux 4.1-rc7) Merging tty.current/tty-linus (d4a4f75cd8f2 Linux 4.1-rc7) Merging usb.current/usb-linus (d4a4f75cd8f2 Linux 4.1-rc7) Merging usb-gadget-fixes/fixes (c94e289f195e usb: gadget: remove incorrect __init/__exit annotations) Merging usb-serial-fixes/usb-linus (0f57d86787d8 Linux 4.1-rc8) Merging staging.current/staging-linus (2a298679b411 Merge tag 'usb-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb) Merging char-misc.current/char-misc-linus (2a298679b411 Merge tag 'usb-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb) Merging input-current/for-linus (f7ebc4dcdeb1 Merge branch 'next' into for-linus) Merging crypto-current/master (0fbafd06bdde crypto: aesni - fix failing setkey for rfc4106-gcm-aesni) Merging ide/master (d681f1166919 ide: remove deprecated use of pci api) Merging devicetree-current/devicetree/merge (f76502aa9140 of/dynamic: Fix test for PPC_PSERIES) Merging rr-fixes/fixes (f36963c9d3f6 cpumask_set_cpu_local_first => cpumask_local_spread, lament) Merging vfio-fixes/for-linus (db7d4d7f4021 vfio: Fix runaway interruptible timeout) Merging kselftest-fixes/fixes (ba155e2d21f6 Linux 4.1-rc5) Merging backlight-fixes/for-backlight-fixes (68feaca0b13e backlight: pwm: Handle EPROBE_DEFER while requesting the PWM) Merging drm-intel-fixes/for-linux-next-fixes (b953c0d234bc Linux 4.1) Merging asm-generic/master (643165c8bbc8 Merge tag 'uaccess_for_upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost into asm-generic
[PATCH V1] regulator: da9211: support da9215
This is a patch for supporting da9215 buck converter. Signed-off-by: James Ban --- This patch is relative to linux-next repository tag next-20150625. .../devicetree/bindings/regulator/da9211.txt | 32 +++- drivers/regulator/Kconfig |6 +-- drivers/regulator/da9211-regulator.c | 40 ++-- drivers/regulator/da9211-regulator.h | 18 - include/linux/regulator/da9211.h | 19 +- 5 files changed, 81 insertions(+), 34 deletions(-) diff --git a/Documentation/devicetree/bindings/regulator/da9211.txt b/Documentation/devicetree/bindings/regulator/da9211.txt index eb61890..c620493 100644 --- a/Documentation/devicetree/bindings/regulator/da9211.txt +++ b/Documentation/devicetree/bindings/regulator/da9211.txt @@ -1,7 +1,7 @@ -* Dialog Semiconductor DA9211/DA9213 Voltage Regulator +* Dialog Semiconductor DA9211/DA9213/DA9215 Voltage Regulator Required properties: -- compatible: "dlg,da9211" or "dlg,da9213". +- compatible: "dlg,da9211" or "dlg,da9213" or "dlg,da9215" - reg: I2C slave address, usually 0x68. - interrupts: the interrupt outputs of the controller - regulators: A node that houses a sub-node for each regulator within the @@ -66,3 +66,31 @@ Example 2) DA9213 }; }; }; + + +Example 3) DA9215 + pmic: da9215@68 { + compatible = "dlg,da9215"; + reg = <0x68>; + interrupts = <3 27>; + + regulators { + BUCKA { + regulator-name = "VBUCKA"; + regulator-min-microvolt = < 30>; + regulator-max-microvolt = <157>; + regulator-min-microamp = <400>; + regulator-max-microamp = <700>; + enable-gpios = <&gpio 27 0>; + }; + BUCKB { + regulator-name = "VBUCKB"; + regulator-min-microvolt = < 30>; + regulator-max-microvolt = <157>; + regulator-min-microamp = <400>; + regulator-max-microamp = <700>; + enable-gpios = <&gpio 17 0>; + }; + }; + }; + diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index bef3bde..23496da 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -209,13 +209,13 @@ config REGULATOR_DA9210 interface. config REGULATOR_DA9211 - tristate "Dialog Semiconductor DA9211/DA9212/DA9213/DA9214 regulator" + tristate "Dialog Semiconductor DA9211/DA9212/DA9213/DA9214/DA9215 regulator" depends on I2C select REGMAP_I2C help Say y here to support for the Dialog Semiconductor DA9211/DA9212 - /DA9213/DA9214. - The DA9211/DA9212/DA9213/DA9214 is a multi-phase synchronous + /DA9213/DA9214/DA9215. + The DA9211/DA9212/DA9213/DA9214/DA9215 is a multi-phase synchronous step down converter 12A or 16A DC-DC Buck controlled through an I2C interface. diff --git a/drivers/regulator/da9211-regulator.c b/drivers/regulator/da9211-regulator.c index df79e4b..0858100 100644 --- a/drivers/regulator/da9211-regulator.c +++ b/drivers/regulator/da9211-regulator.c @@ -1,6 +1,6 @@ /* - * da9211-regulator.c - Regulator device driver for DA9211/DA9213 - * Copyright (C) 2014 Dialog Semiconductor Ltd. + * da9211-regulator.c - Regulator device driver for DA9211/DA9213/DA9215 + * Copyright (C) 2015 Dialog Semiconductor Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -32,6 +32,7 @@ /* DEVICE IDs */ #define DA9211_DEVICE_ID 0x22 #define DA9213_DEVICE_ID 0x23 +#define DA9215_DEVICE_ID 0x24 #define DA9211_BUCK_MODE_SLEEP 1 #define DA9211_BUCK_MODE_SYNC 2 @@ -90,6 +91,13 @@ static const int da9213_current_limits[] = { 300, 320, 340, 360, 380, 400, 420, 440, 460, 480, 500, 520, 540, 560, 580, 600 }; +/* Current limits for DA9215 buck (uA) indices + * corresponds with register values + */ +static const int da9215_current_limits[] = { + 400, 420, 440, 460, 480, 500, 520, 540, + 560, 580, 600, 620, 640, 660, 680, 700 +}; static unsigned int da9211_buck_get_mode(struct regulator_dev *rdev) { @@ -157,6 +165,10 @@ static int da9211_set_current_limit(struct regulator_dev *rdev, int min, current_limits = da9213_current_limits; max_size = ARRAY_SIZE(da9213_current_limits
[PATCH v2] kexec: Make a pair of map and unmap reserved pages when kdump fails to start
For some arch, kexec shall map the reserved pages, then use them, when we try to start the kdump service. Now kexec will never unmap the reserved pages, once it fails to continue starting the kdump service. Make a pair of reserved pages in kdump starting path, whatever kexec fails or not. Signed-off-by: Minfei Huang --- kernel/kexec.c | 26 ++ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/kernel/kexec.c b/kernel/kexec.c index 4589899..68f6dfb 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c @@ -1291,35 +1291,37 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments, */ kimage_free(xchg(&kexec_crash_image, NULL)); - result = kimage_alloc_init(&image, entry, nr_segments, - segments, flags); - crash_map_reserved_pages(); - } else { - /* Loading another kernel to reboot into. */ - - result = kimage_alloc_init(&image, entry, nr_segments, - segments, flags); } + + result = kimage_alloc_init(&image, entry, nr_segments, + segments, flags); if (result) goto out; + if (flags & KEXEC_ON_CRASH) + crash_map_reserved_pages(); + if (flags & KEXEC_PRESERVE_CONTEXT) image->preserve_context = 1; result = machine_kexec_prepare(image); if (result) - goto out; + goto failure; for (i = 0; i < nr_segments; i++) { result = kimage_load_segment(image, &image->segment[i]); if (result) - goto out; + goto failure; } kimage_terminate(image); + +failure: if (flags & KEXEC_ON_CRASH) crash_unmap_reserved_pages(); } - /* Install the new kernel, and Uninstall the old */ - image = xchg(dest_image, image); + + if (result == 0) + /* Install the new kernel, and Uninstall the old */ + image = xchg(dest_image, image); out: mutex_unlock(&kexec_mutex); -- 2.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-V5 4/4] mfd: devicetree: bindings: Add new 88pm800 mfd binding
On Tuesday 30 June 2015 06:01 AM, Krzysztof Kozlowski wrote: 2015-06-30 0:31 GMT+09:00 Vaibhav Hiremath : With addition of DT support to 88pm800 mfd driver, this patch adds new DT binding documentation along with respective properties. Signed-off-by: Vaibhav Hiremath (once again, too early hit return) Looks okay. Just a hint - put the binding at beginning of the patchset. OK, next time onwards will take care of it. Reviewed-by: Krzysztof Kozlowski Thanks for your review. Thanks, Vaibhav -- 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/
[tip:x86/urgent] x86/fpu: Fix FPU related boot regression when CPUID masking BIOS feature is enabled
Commit-ID: db52ef74b35dcb91fd154fa52c618bdd1b90e28e Gitweb: http://git.kernel.org/tip/db52ef74b35dcb91fd154fa52c618bdd1b90e28e Author: Ingo Molnar AuthorDate: Sat, 27 Jun 2015 10:25:14 +0200 Committer: Ingo Molnar CommitDate: Tue, 30 Jun 2015 07:22:10 +0200 x86/fpu: Fix FPU related boot regression when CPUID masking BIOS feature is enabled Mike Galbraith reported: " My i7-4790 box is having one hell of a time with this merge window, dead in the water. BIOS setting "Limit CPUID Maximum" upsets new fpu code mightily. " It turns out that Linux does a double workaround here, as per: 066941bd4eeb ("x86: unmask CPUID levels on Intel CPUs") it undoes the BIOS workaround - but as a side effect the CPUID state is not completely constant during early init anymore, and the new FPU init code did not take this into account. So what happened is that the xstate init code did not have full CPUID available, which broke subsequent attempts to use xstate features. Fix this by ordering the early FPU init code to after we've stabilized the CPUID state. Reported-bisected-and-tested-by: Mike Galbraith Cc: Andrew Morton Cc: Borislav Petkov Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Mike Galbraith Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/20150627082514.ga10...@gmail.com Signed-off-by: Ingo Molnar --- arch/x86/kernel/cpu/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 9fc5e3d..922c5e0 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -742,7 +742,6 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c) cpu_detect(c); get_cpu_vendor(c); get_cpu_cap(c); - fpu__init_system(c); if (this_cpu->c_early_init) this_cpu->c_early_init(c); @@ -754,6 +753,7 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c) this_cpu->c_bsp_init(c); setup_force_cpu_cap(X86_FEATURE_ALWAYS); + fpu__init_system(c); } void __init early_cpu_init(void) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RFC 2/2] drm/dsi: Get DSI host by DT device node
mipi_dsi_devices are inherently aware of their host because they share a parent-child hierarchy in the device tree. Non-dsi drivers that create a dummy dsi device don't have this data. In order to get this information, they require to a phandle to the dsi host in the device tree. Maintain a list of all the hosts DSI that are currently registered. This list will be used to find the mipi_dsi_host corresponding to the device_node passed in of_find_mipi_dsi_host_by_node. Signed-off-by: Archit Taneja --- drivers/gpu/drm/drm_mipi_dsi.c | 30 ++ include/drm/drm_mipi_dsi.h | 2 ++ 2 files changed, 32 insertions(+) diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index 9bfe215..81ddb73 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -239,6 +239,28 @@ struct mipi_dsi_device *mipi_dsi_new_dummy(struct mipi_dsi_host *host, u32 reg) return dsi; } +static DEFINE_MUTEX(host_lock); +static LIST_HEAD(host_list); + +struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node) +{ + struct mipi_dsi_host *host; + + mutex_lock(&host_lock); + + list_for_each_entry(host, &host_list, list) { + if (host->dev->of_node == node) { + mutex_unlock(&host_lock); + return host; + } + } + + mutex_unlock(&host_lock); + + return NULL; +} +EXPORT_SYMBOL(of_find_mipi_dsi_host_by_node); + int mipi_dsi_host_register(struct mipi_dsi_host *host) { struct device_node *node; @@ -250,6 +272,10 @@ int mipi_dsi_host_register(struct mipi_dsi_host *host) of_mipi_dsi_device_add(host, node); } + mutex_lock(&host_lock); + list_add_tail(&host->list, &host_list); + mutex_unlock(&host_lock); + return 0; } EXPORT_SYMBOL(mipi_dsi_host_register); @@ -266,6 +292,10 @@ static int mipi_dsi_remove_device_fn(struct device *dev, void *priv) void mipi_dsi_host_unregister(struct mipi_dsi_host *host) { device_for_each_child(host->dev, NULL, mipi_dsi_remove_device_fn); + + mutex_lock(&host_lock); + list_del_init(&host->list); + mutex_unlock(&host_lock); } EXPORT_SYMBOL(mipi_dsi_host_unregister); diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index d06ba99..1684a0e 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -100,10 +100,12 @@ struct mipi_dsi_host_ops { struct mipi_dsi_host { struct device *dev; const struct mipi_dsi_host_ops *ops; + struct list_head list; }; int mipi_dsi_host_register(struct mipi_dsi_host *host); void mipi_dsi_host_unregister(struct mipi_dsi_host *host); +struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node); /* DSI mode flags */ -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RFC 1/2] drm/dsi: Create dummy DSI devices
We can have devices where the data bus is MIPI DSI, but the control bus is something else (i2c, spi etc). A typical example is i2c controlled encoder bridge chips. Such devices too require passing DSI specific parameters (number of data lanes, DSI mode flags, color format etc) to their DSI host. For a device that isn't 'mipi_dsi_device', there is no way of passing such parameters. Provide the option of creating a dummy DSI device. The main purpose of this would be to attach to a DSI host by calling mipi_dsi_attach, and pass DSI params. Create mipi_dsi_new_dummy for creating a dummy dsi device. The driver calling this needs to be aware of the mipi_dsi_host it wants to attach to, and also the DSI virtual channel the DSI device intends to use. Signed-off-by: Archit Taneja --- drivers/gpu/drm/drm_mipi_dsi.c | 78 -- include/drm/drm_mipi_dsi.h | 2 ++ 2 files changed, 78 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index 2d5ca8ee..9bfe215 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -47,7 +47,14 @@ static int mipi_dsi_device_match(struct device *dev, struct device_driver *drv) { - return of_driver_match_device(dev, drv); + if (of_driver_match_device(dev, drv)) + return 1; + + if (!strcmp(drv->name, "mipi_dsi_dummy") && + strstr(dev_name(dev), "dummy_dev")) + return 1; + + return 0; } static const struct dev_pm_ops mipi_dsi_device_pm_ops = { @@ -171,6 +178,67 @@ of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node) return dsi; } +static int dummy_probe(struct mipi_dsi_device *dsi) +{ + return 0; +} + +static int dummy_remove(struct mipi_dsi_device *dsi) +{ + return 0; +} + +static void dummy_shutdown(struct mipi_dsi_device *dsi) +{ +} + +static struct mipi_dsi_driver dummy_dsi_driver = { + .probe = dummy_probe, + .remove = dummy_remove, + .shutdown = dummy_shutdown, + .driver.name = "mipi_dsi_dummy", +}; + +static int mipi_dsi_device_add_dummy(struct mipi_dsi_device *dsi) +{ + struct mipi_dsi_host *host = dsi->host; + + dev_set_name(&dsi->dev, "%s.dummy_dev.%d", dev_name(host->dev), + dsi->channel); + + return device_add(&dsi->dev); +} + +struct mipi_dsi_device *mipi_dsi_new_dummy(struct mipi_dsi_host *host, u32 reg) +{ + struct mipi_dsi_device *dsi; + struct device *dev = host->dev; + int ret; + + if (reg > 3) { + dev_err(dev, "invalid reg property %u\n", reg); + return ERR_PTR(-EINVAL); + } + + dsi = mipi_dsi_device_alloc(host); + if (IS_ERR(dsi)) { + dev_err(dev, "failed to allocate dummy DSI device %ld\n", + PTR_ERR(dsi)); + return dsi; + } + + dsi->channel = reg; + + ret = mipi_dsi_device_add_dummy(dsi); + if (ret) { + dev_err(dev, "failed to add dummy DSI device %d\n", ret); + kfree(dsi); + return ERR_PTR(ret); + } + + return dsi; +} + int mipi_dsi_host_register(struct mipi_dsi_host *host) { struct device_node *node; @@ -924,7 +992,13 @@ EXPORT_SYMBOL(mipi_dsi_driver_unregister); static int __init mipi_dsi_bus_init(void) { - return bus_register(&mipi_dsi_bus_type); + int ret; + + ret = bus_register(&mipi_dsi_bus_type); + if (ret < 0) + return ret; + + return mipi_dsi_driver_register(&dummy_dsi_driver); } postcore_initcall(mipi_dsi_bus_init); diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index f1d8d0d..d06ba99 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -174,6 +174,8 @@ ssize_t mipi_dsi_generic_write(struct mipi_dsi_device *dsi, const void *payload, ssize_t mipi_dsi_generic_read(struct mipi_dsi_device *dsi, const void *params, size_t num_params, void *data, size_t size); +struct mipi_dsi_device *mipi_dsi_new_dummy(struct mipi_dsi_host *host, u32 reg); + /** * enum mipi_dsi_dcs_tear_mode - Tearing Effect Output Line mode * @MIPI_DSI_DCS_TEAR_MODE_VBLANK: the TE output line consists of V-Blanking -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RFC 0/2] drm/dsi: DSI for devices with different control bus
We are currently restricted when it comes to supporting DSI on devices that have a non-DSI control bus. For example, DSI encoder chips are available in the market that are configured via i2c. Configuring their registers via DSI bus is either optional or not available at all. These devices still need to pass DSI parameters (data lanes, mode flags etc) to the DSI host they are connected to. We don't have a way to do that at the moment. The method presented in these patches is to provide an API to create a 'dummy' mipi_dsi_device. This device is populated with the desired DSI params, which are passed on to the host via mipi_dsi_attach(). This method will require the device driver to get a phandle to the DSI host since there is no parent-child relation between the two. Is there a better way to do this? Please let me know! Archit Taneja (2): drm/dsi: Create dummy DSI devices drm/dsi: Get DSI host by DT device node drivers/gpu/drm/drm_mipi_dsi.c | 108 - include/drm/drm_mipi_dsi.h | 4 ++ 2 files changed, 110 insertions(+), 2 deletions(-) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation -- 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/3] x86_64: kasan: add message about kasan being initialized
* Andrey Ryabinin wrote: > On 06/20/2015 04:18 PM, Ingo Molnar wrote: > > > > Please call it 'kasan' or 'KASAN', and also explain it in the message and > > prefix > > it properly with the subsystem name (kasan), so something like: > > > > pr_info("kasan: Kernel Address SANitizer (KASAN) initialized\n"); > > > > Other kasan messages should also carry a 'kasan: ' prefix, so that it's > > unambiguous what generated the message, and also to make it easier to grep > > out of > > logs. > > > > This patch adds "kasan: " prefix for all messages from this file ( +#define > pr_fmt(fmt) "kasan: " fmt ) > > I'm agree with Dmitry, I would choose kasan name too. > In this case, adding explanation in the message will produce too much kasans > in one short message: > > kasan: Kernel address sanitizer (kasan) initialized > > Perhaps it would be better to keep this patch as is. Ok? So if there's a latest series of fixes to apply, please send it. Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [v2,2/3] watchdog: max63xx: add GPIO support
Hi Guenter, On Jun 27, 2015, at 12:17 PM, Guenter Roeck li...@roeck-us.net wrote: > On 06/22/2015 01:43 PM, Vivien Didelot wrote: >> Hi Guenter, >> >> On Jun 22, 2015, at 12:53 PM, Guenter Roeck li...@roeck-us.net wrote: >>> On Wed, Jun 17, 2015 at 06:58:59PM -0400, Vivien Didelot wrote: Introduce a new struct max63xx_platform_data to support MAX63xx watchdog chips connected via GPIO. A platform code can fill this structure with GPIO numbers for WDI and WDSET pins to enable GPIO support in the code. The driver takes care of requesting and releasing the GPIOs. Signed-off-by: Vivien Didelot >>> >>> would it be possible to use gpiod functions ? >> >> It might be, but I never played with it yet though. I'm using integer-based >> GPIOs from a TCA6424 on an x86 platform (no Device Tree). Is it ok to keep >> max63xx_gpio_{ping,set} for legacy GPIOs, and let someone add >> max63xx_gpiod_{ping,set} if there is a need? >> > > Hi Vivien, > > That would pretty much defeat the purpose. The gpiod API is supposed > to replace the gpio API, not to augment it. Having both at the same time > does not really make sense. > > There is a mapping from integer based pins to name based pins; check out > gpiod_add_lookup_table(). Essentially platform initialization code > (in your case probably the code which instantiates the tca6424) would > set up a pin lookup table, and then you would request pins using > a name instead of a number. That would also solve the "is the pin > valid" problem in patch 3/3 since you would have a string to identify > the gpio pin. Unless I'm missing something, it seems like it won't work in my case. Here's my setup. I have 2 TCA6424 I2C I/O expanders, exposing 24 GPIOs each. They are registered like this: static struct i2c_board_info i2c_devices[] = { { I2C_BOARD_INFO("tca6424", 0x22), .platform_data = &tca6424_1_pdata, // base = 100 }, { I2C_BOARD_INFO("tca6424", 0x23), .platform_data = &tca6424_2_pdata, // base = 200 } }; Then the pca953x driver adds two gpio chips, both labeled with the device name, i.e. "tca6424". I have to pass pins 219 to 222 to the max63xx_platform_data. I can declare a GPIO lookup table like this: static struct gpiod_lookup_table lookup_table = { .dev_id = "max6373_wdt", .table = { GPIOD_LOOKUP("tca6424", 19, "MAX6373 WDI", GPIO_ACTIVE_HIGH), GPIOD_LOOKUP_IDX("tca6424", 20, "MAX6373 SET", 0, GPIO_ACTIVE_HIGH), GPIOD_LOOKUP_IDX("tca6424", 21, "MAX6373 SET", 1, GPIO_ACTIVE_HIGH), GPIOD_LOOKUP_IDX("tca6424", 22, "MAX6373 SET", 2, GPIO_ACTIVE_HIGH), } }; but from what I've seen, the gpio_chip lookup by name will always return the first TCA6424 instance. To me, it looks like the gpiod API doesn't support several GPIO chips with the same name. Either this must be fixed, or I should find a way to give the 2 I/O expanders different names (e.g. "tca6424.0" and "tca6424.1"). As struct gpiod_lookup are meant for platform code, would that be bad if they ignore the chip_label and care about a global GPIO number (i.e. base + hwnum)? Do you have an idea for this setup? Thanks, -v -- 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: [all better] Re: regression: massive trouble with fpu rework
* H. Peter Anvin wrote: > On 06/28/2015 11:40 PM, Ingo Molnar wrote: > > > > Ok, so could you please move the fpu__init_system() further up and see > > which > > position is that starts breaking with the BIOS option set? > > > > here's the current, broken layout of the code: > > > > get_cpu_cap(c); > > [0] fpu__init_system(c); > > > > if (this_cpu->c_early_init) > > this_cpu->c_early_init(c); > > > > [1] > > c->cpu_index = 0; > > [2] > > filter_cpuid_features(c, false); > > > > [3] > > if (this_cpu->c_bsp_init) > > this_cpu->c_bsp_init(c); > > > > [4] > > setup_force_cpu_cap(X86_FEATURE_ALWAYS); > > [5] > > } > > > > and we know it from your testing that moving [0] to [5] fixes the crash. > > > > The question is, can we move it to [4], [3], [2] or even [1] instead, > > without > > breaking the system? > > > > I still don't see where the breakage comes from, but this would help us > > narrow it > > down. > > > > It should be moved to [4] or [5]. I would argue that the line setting > X86_FEATURE_ALWAYS should moved up and then fpu__init_system(c) should > be moved after the c_bsp_init() line. Yeah, so the patch I sent to Mike (and which solved the bug) moved it to [5]. Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [all better] Re: regression: massive trouble with fpu rework
* Borislav Petkov wrote: > On Mon, Jun 29, 2015 at 02:27:23PM +0200, Mike Galbraith wrote: > > With it commented out, and fpu__init_system() either back at previously > > booting position [5] or at original [0], doesn't matter, box is dead, > > but differently. It stalls after setting clocksource to tsc, and just > > sits there. > > ... which means that unmasking the CPUID features is absolutely needed > on Linux. Not unmasking probably triggers this original bug which > > 066941bd4eeb ("x86: unmask CPUID levels on Intel CPUs") > > fixed. Yes. And I'd consider us hanging a separate (but not high prio) bug: the kernel should be robust as long as the CPUID data is stable. In that sense the original fix is right (we really want to unmask all available CPUID leaves), but it also masked another (less severe) kernel bug. For example virtualization is known to tweak CPUID details creatively, and firmware (as this example shows it) can mess it up a well, so we generally want to treat it as untrusted input data that needs to be validated. Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [all better] Re: regression: massive trouble with fpu rework
* H. Peter Anvin wrote: > On 06/29/2015 02:35 AM, Ingo Molnar wrote: > > > > Indeed, I bet that makes a difference! > > > > I wish that 'unmasking' logic came with more comments: > > > > - Why do BIOSen ever mask CPUIDs? > > > > To work around bugs in legacy operating systems. > > > - Why do we unmask the masking? > > Because we don't have those specific bugs. Great - would be nice to put those reasons between /* */ markers, to keep future generations (and overworked maintainers!) from wondering. > > - Why doesn't the kernel keep on working just fine even if certain CPUID > > aspects > > are turned off? > > Because it exercises code paths that are otherwise impossible, for example, > it > exposes the XSAVE capability without exposing the XSAVE information in higher > CPUID leaves. > > The other option would be to have a list of CPU features that should be > turned > off whenever the CPUID leaf maximum is too low, but it gives a better user > experience to just override the BIOS capping and then we have fewer code > paths > in the kernel to worry about. 1) As a side note, I think we should generally be robust enough to recognize pretty much any CPUID 'mischief' and at minimum not crash. 2) But this FPU crash is different, here the reason for the crash is the following bug in the FPU code: fpu__init_system(); /* inits the FPU based on masked CPUID */ ... CPUID *extends* ... fpu__init_cpu(); /* Actually uses the FPU now based on the expanded CPUID */ *KABOOM* I.e. we (obviously) should not base half on the FPU logic on different CPUID bits than the other half of the FPU logic. I'll queue up the fix, which is to do the early FPU init after our CPUID state stabilizes. (i.e. the second patch I sent to Mike.) Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/1] igb: Use ARRAY_SIZE instead fo sizeof(a)/sizeof(a[0])
On Tue, 2015-06-30 at 10:25 +0530, Maninder Singh wrote: > Use ARRAY_SIZE instead fo sizeof(a)/sizeof(a[0]) I think all of these #defines should be removed instead as they are all used only once. > diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.c > b/drivers/net/ethernet/intel/igb/e1000_phy.c [] > @@ -37,8 +37,7 @@ static s32 igb_set_master_slave_mode(struct e1000_hw *hw); > static const u16 e1000_m88_cable_length_table[] = { > 0, 50, 80, 110, 140, 140, E1000_CABLE_LENGTH_UNDEFINED }; > #define M88E1000_CABLE_LENGTH_TABLE_SIZE \ > - (sizeof(e1000_m88_cable_length_table) / \ > - sizeof(e1000_m88_cable_length_table[0])) > + ARRAY_SIZE(e1000_m88_cable_length_table) > > static const u16 e1000_igp_2_cable_length_table[] = { > 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 11, 13, 16, 18, 21, > @@ -50,8 +49,7 @@ static const u16 e1000_igp_2_cable_length_table[] = { > 83, 89, 95, 100, 105, 109, 113, 116, 119, 122, 124, > 104, 109, 114, 118, 121, 124}; > #define IGP02E1000_CABLE_LENGTH_TABLE_SIZE \ > - (sizeof(e1000_igp_2_cable_length_table) / \ > - sizeof(e1000_igp_2_cable_length_table[0])) > + ARRAY_SIZE(e1000_igp_2_cable_length_table) > > /** > * igb_check_reset_block - Check if PHY reset is blocked -- 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] fs/file.c: __fget() and dup2() atomicity rules
On Mon, 2015-06-29 at 18:46 +0100, Al Viro wrote: > On Mon, Jun 29, 2015 at 05:10:30PM +0200, Eric Dumazet wrote: > > From: Eric Dumazet > > > > __fget() makes sure a file refcount is not zero before > > taking a reference. It should also fetch again file pointer > > in order to respect dup2() atomicity requirements. > > > > It should either read a NULL pointer or a file on which > > a refcount can be taken. > > Hmm... The problem is real, but I wonder if one could trigger a long > spin there... I do not believe we can spin a long time. By the time do_dup2() calls filp_close(tofree, files), we already have a stable fdt->fd[fd], because of spin_unlock(&files->file_lock) was called before filp_close() A loop would require threads doing dup2() calls like crazy on same destination fd. -- 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/
[tip:perf/urgent] perf stat: Introduce print_counters function
Commit-ID: d4f63a4741a808c0bf25d92884713008706fca16 Gitweb: http://git.kernel.org/tip/d4f63a4741a808c0bf25d92884713008706fca16 Author: Jiri Olsa AuthorDate: Fri, 26 Jun 2015 11:29:26 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 12:00:50 -0300 perf stat: Introduce print_counters function Centralize counters print code into single print_counters function. Signed-off-by: Jiri Olsa Cc: Adrian Hunter Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1435310967-14570-22-git-send-email-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 127 +++--- 1 file changed, 64 insertions(+), 63 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 39a97ade..56dc888 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -67,10 +67,7 @@ #define CNTR_NOT_SUPPORTED "" #define CNTR_NOT_COUNTED "" -static void print_stat(int argc, const char **argv); -static void print_counter_aggr(struct perf_evsel *counter, char *prefix); -static void print_counter(struct perf_evsel *counter, char *prefix); -static void print_aggr(char *prefix); +static void print_counters(struct timespec *ts, int argc, const char **argv); /* Default events used for perf stat -T */ static const char *transaction_attrs = { @@ -365,53 +362,14 @@ static void read_counters(bool close) static void process_interval(void) { - static int num_print_interval; - struct perf_evsel *counter; struct timespec ts, rs; - char prefix[64]; read_counters(false); clock_gettime(CLOCK_MONOTONIC, &ts); diff_timespec(&rs, &ts, &ref_time); - sprintf(prefix, "%6lu.%09lu%s", rs.tv_sec, rs.tv_nsec, csv_sep); - - if (num_print_interval == 0 && !csv_output) { - switch (aggr_mode) { - case AGGR_SOCKET: - fprintf(output, "# time socket cpus counts %*s events\n", unit_width, "unit"); - break; - case AGGR_CORE: - fprintf(output, "# time core cpus counts %*s events\n", unit_width, "unit"); - break; - case AGGR_NONE: - fprintf(output, "# time CPU counts %*s events\n", unit_width, "unit"); - break; - case AGGR_GLOBAL: - default: - fprintf(output, "# time counts %*s events\n", unit_width, "unit"); - } - } - - if (++num_print_interval == 25) - num_print_interval = 0; - switch (aggr_mode) { - case AGGR_CORE: - case AGGR_SOCKET: - print_aggr(prefix); - break; - case AGGR_NONE: - evlist__for_each(evsel_list, counter) - print_counter(counter, prefix); - break; - case AGGR_GLOBAL: - default: - evlist__for_each(evsel_list, counter) - print_counter_aggr(counter, prefix); - } - - fflush(output); + print_counters(&rs, 0, NULL); } static void handle_initial_delay(void) @@ -901,9 +859,35 @@ static void print_counter(struct perf_evsel *counter, char *prefix) } } -static void print_stat(int argc, const char **argv) +static void print_interval(char *prefix, struct timespec *ts) +{ + static int num_print_interval; + + sprintf(prefix, "%6lu.%09lu%s", ts->tv_sec, ts->tv_nsec, csv_sep); + + if (num_print_interval == 0 && !csv_output) { + switch (aggr_mode) { + case AGGR_SOCKET: + fprintf(output, "# time socket cpus counts %*s events\n", unit_width, "unit"); + break; + case AGGR_CORE: + fprintf(output, "# time core cpus counts %*s events\n", unit_width, "unit"); + break; + case AGGR_NONE: + fprintf(output, "# time CPU counts %*s events\n", unit_width, "unit"); + break; + case AGGR_GLOBAL: + default: + fprintf(output, "# time counts %*s events\n", unit_width, "unit"); + } + } + + if (++num_print_interval == 25) + num_print_interval = 0; +} + +static void print_header(int argc, const char **argv) { - struct perf_evsel *counter; int i; fflush(stdout); @@ -929,36 +913,53 @@ static void print_stat(int argc, const char **argv) fprintf(output, " (%d runs)", run_count); fprintf(output
[tip:perf/urgent] perf symbols: Check access permission when reading symbol files
Commit-ID: 36c8bb56a9f718a9a5f35d1834ca9dcec95deb4a Gitweb: http://git.kernel.org/tip/36c8bb56a9f718a9a5f35d1834ca9dcec95deb4a Author: Li Zhang AuthorDate: Fri, 19 Jun 2015 16:57:33 +0800 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 12:11:53 -0300 perf symbols: Check access permission when reading symbol files There 2 problems when reading symbols files: * It doesn't report any errors even if when users specify symbol files which don't exist with --kallsyms or --vmlinux. The result just shows the address without symbols, which is not what is expected. So it's better to report errors and exit the program. * When using command perf report --kallsyms=/proc/kallsyms with a non-root user, symbols are resolved. Then select one symbol and annotate it, it reports the error as the following: Can't annotate __clear_user: No vmlinux file with build id xxx was found. The problem is caused by reading /proc/kcore without access permission. /proc/kcore requires CAP_SYS_RAWIO capability to access, so it needs to change access permission to allow a specific user to read /proc/kcore or use root to execute the perf command. This patch is to report errors when symbol files specified by users don't exist. And check access permission of /proc/kcore when reading it. Signed-off-by: Li Zhang Cc: Sukadev Bhattiprolu Link: http://lkml.kernel.org/r/1434704253-2632-1-git-send-email-zhlci...@linux.vnet.ibm.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-report.c | 11 +++ tools/perf/util/symbol.c| 5 - 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 32626ea..348bed4 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -742,6 +742,17 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) argc = parse_options(argc, argv, options, report_usage, 0); + if (symbol_conf.vmlinux_name && + access(symbol_conf.vmlinux_name, R_OK)) { + pr_err("Invalid file: %s\n", symbol_conf.vmlinux_name); + return -EINVAL; + } + if (symbol_conf.kallsyms_name && + access(symbol_conf.kallsyms_name, R_OK)) { + pr_err("Invalid file: %s\n", symbol_conf.kallsyms_name); + return -EINVAL; + } + if (report.use_stdio) use_browser = 0; else if (report.use_tui) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 504f2d7..48b588c 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -1132,8 +1132,11 @@ static int dso__load_kcore(struct dso *dso, struct map *map, INIT_LIST_HEAD(&md.maps); fd = open(kcore_filename, O_RDONLY); - if (fd < 0) + if (fd < 0) { + pr_err("%s requires CAP_SYS_RAWIO capability to access.\n", + kcore_filename); return -EINVAL; + } /* Read new maps into temporary lists */ err = file__read_maps(fd, md.type == MAP__FUNCTION, kcore_mapfn, &md, -- 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/
[tip:perf/urgent] perf stat: Introduce --per-thread option
Commit-ID: 32b8af82e3708bc19af75c31fa773a98449f0edc Gitweb: http://git.kernel.org/tip/32b8af82e3708bc19af75c31fa773a98449f0edc Author: Jiri Olsa AuthorDate: Fri, 26 Jun 2015 11:29:27 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 12:05:04 -0300 perf stat: Introduce --per-thread option Currently all the -p option PID arguments tasks values get aggregated and printed as single values. Adding --per-tasks option to print values per task. $ perf stat -e cycles,instructions --per-thread -p 30190,30242 ^C Performance counter stats for process id '30190,30242': cat-30190 0 cycles yes-30242 3,842,525,421 cycles cat-30190 0 instructions yes-3024210,370,817,010 instructions 1.143155657 seconds time elapsed Also works under interval mode: $ perf stat -e cycles,instructions --per-thread -p 30190,30242 -I 1000 # time comm-pid counts unit events 1.73435 cat-3019089,058 cycles 1.73435 yes-30242 3,360,786,902 cycles (100.00%) 1.73435 cat-3019014,066 instructions 1.73435 yes-30242 9,069,937,462 instructions 2.000204830 cat-30190 0 cycles 2.000204830 yes-30242 3,351,667,626 cycles 2.000204830 cat-30190 0 instructions 2.000204830 yes-30242 9,045,796,885 instructions ^C 2.771286639 cat-30190 0 cycles 2.771286639 yes-30242 2,593,884,166 cycles 2.771286639 cat-30190 0 instructions 2.771286639 yes-30242 7,001,171,191 instructions It works only with -t and -p options, otherwise following error is printed: $ perf stat -e cycles --per-thread -I 1000 ls The --per-thread option is only available when monitoring via -p -t options. -p, --pidstat events on existing process id -t, --tidstat events on existing thread id Signed-off-by: Jiri Olsa Tested-by: Arnaldo Carvalho de Melo Cc: Adrian Hunter Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1435310967-14570-23-git-send-email-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/Documentation/perf-stat.txt | 4 ++ tools/perf/builtin-stat.c | 76 +- tools/perf/util/stat.h | 1 + 3 files changed, 79 insertions(+), 2 deletions(-) diff --git a/tools/perf/Documentation/perf-stat.txt b/tools/perf/Documentation/perf-stat.txt index 04e150d..47469ab 100644 --- a/tools/perf/Documentation/perf-stat.txt +++ b/tools/perf/Documentation/perf-stat.txt @@ -144,6 +144,10 @@ is a useful mode to detect imbalance between physical cores. To enable this mod use --per-core in addition to -a. (system-wide). The output includes the core number and the number of online logical processors on that physical processor. +--per-thread:: +Aggregate counts per monitored threads, when monitoring threads (-t option) +or processes (-p option). + -D msecs:: --delay msecs:: After starting the program, wait msecs before measuring. This is useful to diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 56dc888..37e301a 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -231,6 +231,7 @@ process_counter_values(struct perf_evsel *evsel, int cpu, int thread, count = &zero; switch (aggr_mode) { + case AGGR_THREAD: case AGGR_CORE: case AGGR_SOCKET: case AGGR_NONE: @@ -602,6 +603,14 @@ static void aggr_printout(struct perf_evsel *evsel, int id, int nr) csv_output ? 0 : -4, perf_evsel__cpus(evsel)->map[id], csv_sep); break; + case AGGR_THREAD: + fprintf(output, "%*s-%*d%s", + csv_output ? 0 : 16, + thread_map__comm(evsel->threads, id), + csv_output ? 0 : -8, + thread_map__pid(evsel->threads, id), + csv_sep); + break; case AGGR_GLOBAL: default: break; @@ -750,6 +759,40 @@ static void print_aggr(char *prefix) } } +static void print_aggr_thread(struct perf_evsel *counter, char *prefix) +{ + int nthreads = thread_map__nr(counter->threads); + int ncpus = cpu_map__nr(counter->cpus); + int cpu, thread; + double uval; + + for (threa
Re: [GIT PULL 0/8] perf/pt -> Intel PT/BTS
* Arnaldo Carvalho de Melo wrote: > Hi Ingo, > > Please consider pulling, there are several other patches after this, > but I think that this may be acceptable to showcase the capabilities already > present, look at the output of 'perf script' and callchains for userspace > without using any extra debugging info (no need for DWARF, CFI, nothing), > really cool capabilities... :-) > > Adrian wrote some docs and I tested it both on a Ivy Bridge machine > where there is only BTS and on a Broadwell machine with the whole shebang, > adding the output of the commands to the csets, to further showcase what is > there already. > > This is on top of my last perf-core-for-mingo tag. > > Up to you, please let us know what you think and we'll continue working > on having this in an acceptable form for merging, > > Regards, > > - Arnaldo > > P.S. Kudos for Adrian for the patience with this process, way more is needed > to > polish this, but the promise is there, cool stuff indeed! :-) > > The following changes since commit 36c8bb56a9f718a9a5f35d1834ca9dcec95deb4a: > > perf symbols: Check access permission when reading symbol files (2015-06-26 > 12:11:53 -0300) > > are available in the git repository at: > > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git > tags/perf-pt-for-mingo > > for you to fetch changes up to 04759f172270afb28c8004f5cad62ed55710a499: > > perf tools: Add Intel BTS support (2015-06-26 18:36:11 -0300) > > > Put Intel PT and BTS into initial use (Adrian Hunter) > > Signed-off-by: Arnaldo Carvalho de Melo > > > Adrian Hunter (8): > perf auxtrace: Add Intel PT as an AUX area tracing type > perf tools: Add Intel PT packet decoder > perf tools: Add Intel PT instruction decoder > perf tools: Add Intel PT log > perf tools: Add Intel PT decoder > perf tools: Add Intel PT support > perf tools: Take Intel PT into use > perf tools: Add Intel BTS support > > tools/build/Makefile.build |2 + > tools/perf/.gitignore |2 + > tools/perf/Documentation/intel-bts.txt | 86 + > tools/perf/Documentation/intel-pt.txt | 588 ++ > tools/perf/MANIFEST|7 + > tools/perf/Makefile.perf | 12 +- > tools/perf/arch/x86/util/Build |5 + > tools/perf/arch/x86/util/auxtrace.c| 83 + > tools/perf/arch/x86/util/intel-bts.c | 458 + > tools/perf/arch/x86/util/intel-pt.c| 752 > tools/perf/arch/x86/util/pmu.c | 18 + > tools/perf/util/Build |3 + > tools/perf/util/auxtrace.c |9 +- > tools/perf/util/auxtrace.h |2 + > tools/perf/util/intel-bts.c| 791 > tools/perf/util/intel-bts.h| 43 + > tools/perf/util/intel-pt-decoder/Build | 14 + > .../perf/util/intel-pt-decoder/intel-pt-decoder.c | 1759 ++ > .../perf/util/intel-pt-decoder/intel-pt-decoder.h | 102 ++ > .../util/intel-pt-decoder/intel-pt-insn-decoder.c | 246 +++ > .../util/intel-pt-decoder/intel-pt-insn-decoder.h | 65 + > tools/perf/util/intel-pt-decoder/intel-pt-log.c| 155 ++ > tools/perf/util/intel-pt-decoder/intel-pt-log.h| 52 + > .../util/intel-pt-decoder/intel-pt-pkt-decoder.c | 400 + > .../util/intel-pt-decoder/intel-pt-pkt-decoder.h | 64 + > tools/perf/util/intel-pt.c | 1889 > > tools/perf/util/intel-pt.h | 51 + > tools/perf/util/pmu.c |4 - > 28 files changed, 7655 insertions(+), 7 deletions(-) > create mode 100644 tools/perf/Documentation/intel-bts.txt > create mode 100644 tools/perf/Documentation/intel-pt.txt > create mode 100644 tools/perf/arch/x86/util/auxtrace.c > create mode 100644 tools/perf/arch/x86/util/intel-bts.c > create mode 100644 tools/perf/arch/x86/util/intel-pt.c > create mode 100644 tools/perf/arch/x86/util/pmu.c > create mode 100644 tools/perf/util/intel-bts.c > create mode 100644 tools/perf/util/intel-bts.h > create mode 100644 tools/perf/util/intel-pt-decoder/Build > create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-decoder.c > create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-decoder.h > create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c > create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.h > create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-log.c > create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-log.h > create mode 100644 to
[tip:perf/urgent] perf stat: Move perf_stat initialization counter process code
Commit-ID: 7ddb1b6bbf1e614e6700f226cb0a559c5c635336 Gitweb: http://git.kernel.org/tip/7ddb1b6bbf1e614e6700f226cb0a559c5c635336 Author: Jiri Olsa AuthorDate: Fri, 26 Jun 2015 11:29:22 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 11:50:19 -0300 perf stat: Move perf_stat initialization counter process code Moving perf_stat initialization counter process code, to make the reading path free of processing logic. Signed-off-by: Jiri Olsa Cc: Adrian Hunter Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1435310967-14570-18-git-send-email-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index b7c184b..526f677 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -284,6 +284,7 @@ static int process_counter(struct perf_evsel *counter) int i, ret; aggr->val = aggr->ena = aggr->run = 0; + memset(ps->res_stats, 0, sizeof(ps->res_stats)); if (counter->per_pkg) zero_per_pkg(counter); @@ -347,12 +348,8 @@ static int read_counter(struct perf_evsel *counter) static void read_counters(bool close) { struct perf_evsel *counter; - struct perf_stat *ps; evlist__for_each(evsel_list, counter) { - ps = counter->priv; - memset(ps->res_stats, 0, sizeof(ps->res_stats)); - if (read_counter(counter)) pr_warning("failed to read counter %s\n", counter->name); -- 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/
[tip:perf/urgent] perf stat: Using init_stats instead of memset
Commit-ID: 5835e2286583e4fa6c2a609446e1320e7da2b161 Gitweb: http://git.kernel.org/tip/5835e2286583e4fa6c2a609446e1320e7da2b161 Author: Jiri Olsa AuthorDate: Fri, 26 Jun 2015 11:29:25 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 11:51:49 -0300 perf stat: Using init_stats instead of memset The init_stats function is meant to init 'struct stats'. Reported-by: David Ahern Signed-off-by: Jiri Olsa Cc: Adrian Hunter Cc: Andi Kleen Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1435310967-14570-21-git-send-email-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index aa706fc..39a97ade 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -284,7 +284,7 @@ static int process_counter(struct perf_evsel *counter) int i, ret; aggr->val = aggr->ena = aggr->run = 0; - memset(ps->res_stats, 0, sizeof(ps->res_stats)); + init_stats(ps->res_stats); if (counter->per_pkg) zero_per_pkg(counter); -- 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/
[tip:perf/urgent] perf stat: Remove perf_evsel__read_cb function
Commit-ID: d8ee3b54d0458cbed0a31a410458f4bfd38fc147 Gitweb: http://git.kernel.org/tip/d8ee3b54d0458cbed0a31a410458f4bfd38fc147 Author: Jiri Olsa AuthorDate: Fri, 26 Jun 2015 11:29:23 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 11:50:51 -0300 perf stat: Remove perf_evsel__read_cb function It's no longer used, the stat command uses perf_evsel__read now. Signed-off-by: Jiri Olsa Cc: Adrian Hunter Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1435310967-14570-19-git-send-email-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/evsel.c | 16 tools/perf/util/evsel.h | 7 --- 2 files changed, 23 deletions(-) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 2e0a4e0..2936b30 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -939,22 +939,6 @@ void perf_counts_values__scale(struct perf_counts_values *count, *pscaled = scaled; } -int perf_evsel__read_cb(struct perf_evsel *evsel, int cpu, int thread, - perf_evsel__read_cb_t cb) -{ - struct perf_counts_values count; - - memset(&count, 0, sizeof(count)); - - if (FD(evsel, cpu, thread) < 0) - return -EINVAL; - - if (readn(FD(evsel, cpu, thread), &count, sizeof(count)) < 0) - return -errno; - - return cb(evsel, cpu, thread, &count); -} - int perf_evsel__read(struct perf_evsel *evsel, int cpu, int thread, struct perf_counts_values *count) { diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index a79944a..4a7ed56 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h @@ -229,13 +229,6 @@ static inline bool perf_evsel__match2(struct perf_evsel *e1, (a)->attr.type == (b)->attr.type &&\ (a)->attr.config == (b)->attr.config) -typedef int (perf_evsel__read_cb_t)(struct perf_evsel *evsel, - int cpu, int thread, - struct perf_counts_values *count); - -int perf_evsel__read_cb(struct perf_evsel *evsel, int cpu, int thread, - perf_evsel__read_cb_t cb); - int perf_evsel__read(struct perf_evsel *evsel, int cpu, int thread, struct perf_counts_values *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/
[tip:perf/urgent] perf stat: Rename print_interval to process_interval
Commit-ID: ba411a954eae3e88c02667a5670cac97fb9c3f58 Gitweb: http://git.kernel.org/tip/ba411a954eae3e88c02667a5670cac97fb9c3f58 Author: Jiri Olsa AuthorDate: Fri, 26 Jun 2015 11:29:24 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 11:51:23 -0300 perf stat: Rename print_interval to process_interval It suits better, because the function also reads counter's data. Also the 'print_interval' name will be used in following generalization of counters display. Signed-off-by: Jiri Olsa Cc: Adrian Hunter Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1435310967-14570-20-git-send-email-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 526f677..aa706fc 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -363,7 +363,7 @@ static void read_counters(bool close) } } -static void print_interval(void) +static void process_interval(void) { static int num_print_interval; struct perf_evsel *counter; @@ -526,7 +526,7 @@ static int __run_perf_stat(int argc, const char **argv) if (interval) { while (!waitpid(child_pid, &status, WNOHANG)) { nanosleep(&ts, NULL); - print_interval(); + process_interval(); } } wait(&status); @@ -544,7 +544,7 @@ static int __run_perf_stat(int argc, const char **argv) while (!done) { nanosleep(&ts, NULL); if (interval) - print_interval(); + process_interval(); } } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH 1/2] regmap: add configurable lock class key for lockdep
On Mon, Jun 29, 2015 at 04:34:11PM +0100, Mark Brown wrote: > On Mon, Jun 29, 2015 at 04:18:11PM +0200, Lars-Peter Clausen wrote: > > Leaves us pretty much with only two options. Either add a lock key pointer > > to regmap_config which needs to be manually initialized. Or wrap all > > regmap_init() variants to create a static lock key. I'd slightly prefer the > > later. We can avoid most of the boiler-plate code by using some helper > > macros to generate the wrappers. > > It's better to keep the bodges in the core, yes. Partial attempt below. Of course all other _init functions will need to be converted as well. I'd like to get feedback before I do the rest of the work. The macro part is quite repetitive and I don't think it can be simplified. Thanks! >8--8< Subject: [PATCH] regmap: Use different lockdep classes for each regmap init call Lockdep validator complains about recursive locking and deadlock when two different regmap instances are called in a nested order. That happens anytime a regmap read/write call needs to access another regmap. This is because, for performance reason, lockdep groups all locks initialized by the same mutex_init() in the same lock class. Therefore all regmap mutexes are in the same lock class, leading to lockdep "nested locking" warnings if a regmap accesses another regmap. In general, it is impossible to establish in advance the hierarchy of regmaps, so we make sure that each regmap init call initializes its own static lock_class_key. This is done by wrapping all regmap_init calls into macros. This also allows us to give meaningful names to the lock_class_key. For example, in rt5677 case, we have in /proc/lockdep_chains: irq_context: 0 [ffc0018d2198] &dev->mutex [ffc0018d2198] &dev->mutex [ffc001bd7f60] rt5677:5104:(&rt5677_regmap)->_lock [ffc001bd7f58] rt5677:5096:(&rt5677_regmap_physical)->_lock [ffc001b95448] &(&base->lock)->rlock The above would have resulted in a lockdep recursive warning previously. This is not the case anymore as the lockdep validator now clearly identifies the 2 locks as separate. Signed-off-by: Nicolas Boichat --- drivers/base/regmap/regmap-i2c.c | 22 ++ drivers/base/regmap/regmap.c | 31 +- include/linux/regmap.h | 91 ++-- 3 files changed, 113 insertions(+), 31 deletions(-) diff --git a/drivers/base/regmap/regmap-i2c.c b/drivers/base/regmap/regmap-i2c.c index 053150a..c1f9396 100644 --- a/drivers/base/regmap/regmap-i2c.c +++ b/drivers/base/regmap/regmap-i2c.c @@ -198,17 +198,20 @@ static const struct regmap_bus *regmap_get_i2c_bus(struct i2c_client *i2c, * The return value will be an ERR_PTR() on error or a valid pointer to * a struct regmap. */ -struct regmap *regmap_init_i2c(struct i2c_client *i2c, - const struct regmap_config *config) +struct regmap *__regmap_init_i2c(struct i2c_client *i2c, +const struct regmap_config *config, +struct lock_class_key *lock_key, +const char *lock_name) { const struct regmap_bus *bus = regmap_get_i2c_bus(i2c, config); if (IS_ERR(bus)) return ERR_CAST(bus); - return regmap_init(&i2c->dev, bus, &i2c->dev, config); + return __regmap_init(&i2c->dev, bus, &i2c->dev, config, +lock_key, lock_name); } -EXPORT_SYMBOL_GPL(regmap_init_i2c); +EXPORT_SYMBOL_GPL(__regmap_init_i2c); /** * devm_regmap_init_i2c(): Initialise managed register map @@ -220,16 +223,19 @@ EXPORT_SYMBOL_GPL(regmap_init_i2c); * to a struct regmap. The regmap will be automatically freed by the * device management code. */ -struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c, - const struct regmap_config *config) +struct regmap *__devm_regmap_init_i2c(struct i2c_client *i2c, + const struct regmap_config *config, + struct lock_class_key *lock_key, + const char *lock_name) { const struct regmap_bus *bus = regmap_get_i2c_bus(i2c, config); if (IS_ERR(bus)) return ERR_CAST(bus); - return devm_regmap_init(&i2c->dev, bus, &i2c->dev, config); + return __devm_regmap_init(&i2c->dev, bus, &i2c->dev, config, + lock_key, lock_name); } -EXPORT_SYMBOL_GPL(devm_regmap_init_i2c); +EXPORT_SYMBOL_GPL(__devm_regmap_init_i2c); MODULE_LICENSE("GPL"); diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index d2f8a81..b8e26af 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -526,10 +526,12 @@ static enum regmap_endian regmap_get_val_endian(struct device *dev, * a struct regmap. This function should generally not be called
[tip:perf/urgent] perf stat: Move zero_per_pkg into counter process code
Commit-ID: 32ce0a47aaa401a7dd27dfe65210f3e3aa809682 Gitweb: http://git.kernel.org/tip/32ce0a47aaa401a7dd27dfe65210f3e3aa809682 Author: Jiri Olsa AuthorDate: Fri, 26 Jun 2015 11:29:21 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 11:49:45 -0300 perf stat: Move zero_per_pkg into counter process code Moving zero_per_pkg into counter process code, to make the reading path free of processing logic. Signed-off-by: Jiri Olsa Cc: Adrian Hunter Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1435310967-14570-17-git-send-email-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 74ac92b..b7c184b 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -285,6 +285,9 @@ static int process_counter(struct perf_evsel *counter) aggr->val = aggr->ena = aggr->run = 0; + if (counter->per_pkg) + zero_per_pkg(counter); + ret = process_counter_maps(counter); if (ret) return ret; @@ -328,9 +331,6 @@ static int read_counter(struct perf_evsel *counter) if (counter->system_wide) nthreads = 1; - if (counter->per_pkg) - zero_per_pkg(counter); - for (thread = 0; thread < nthreads; thread++) { for (cpu = 0; cpu < ncpus; cpu++) { struct perf_counts_values *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/
[tip:perf/urgent] perf stat: Separate counters reading and processing
Commit-ID: 3b3eb044519ac4c422dbc6084303c470b8d2dc61 Gitweb: http://git.kernel.org/tip/3b3eb044519ac4c422dbc6084303c470b8d2dc61 Author: Jiri Olsa AuthorDate: Fri, 26 Jun 2015 11:29:20 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 11:49:03 -0300 perf stat: Separate counters reading and processing Separating counters reading and processing so we could use the processing part in following patches. Using simple reading via perf_evsel__read function to read counters now, because part of the processing was in the read_cb callback. Signed-off-by: Jiri Olsa Cc: Adrian Hunter Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1435310967-14570-16-git-send-email-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 56 +-- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 158859e..74ac92b 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -217,8 +217,9 @@ static int check_per_pkg(struct perf_evsel *counter, int cpu, bool *skip) return 0; } -static int read_cb(struct perf_evsel *evsel, int cpu, int thread, - struct perf_counts_values *count) +static int +process_counter_values(struct perf_evsel *evsel, int cpu, int thread, + struct perf_counts_values *count) { struct perf_counts_values *aggr = &evsel->counts->aggr; static struct perf_counts_values zero; @@ -239,7 +240,6 @@ static int read_cb(struct perf_evsel *evsel, int cpu, int thread, if (!evsel->snapshot) perf_evsel__compute_deltas(evsel, cpu, thread, count); perf_counts_values__scale(count, scale, NULL); - *perf_counts(evsel->counts, cpu, thread) = *count; if (aggr_mode == AGGR_NONE) perf_stat__update_shadow_stats(evsel, count->values, cpu); break; @@ -256,23 +256,41 @@ static int read_cb(struct perf_evsel *evsel, int cpu, int thread, return 0; } -static int read_counter(struct perf_evsel *counter); +static int process_counter_maps(struct perf_evsel *counter) +{ + int nthreads = thread_map__nr(counter->threads); + int ncpus = perf_evsel__nr_cpus(counter); + int cpu, thread; -/* - * Read out the results of a single counter: - * aggregate counts across CPUs in system-wide mode - */ -static int read_counter_aggr(struct perf_evsel *counter) + if (counter->system_wide) + nthreads = 1; + + for (thread = 0; thread < nthreads; thread++) { + for (cpu = 0; cpu < ncpus; cpu++) { + if (process_counter_values(counter, cpu, thread, + perf_counts(counter->counts, cpu, thread))) + return -1; + } + } + + return 0; +} + +static int process_counter(struct perf_evsel *counter) { struct perf_counts_values *aggr = &counter->counts->aggr; struct perf_stat *ps = counter->priv; u64 *count = counter->counts->aggr.values; - int i; + int i, ret; aggr->val = aggr->ena = aggr->run = 0; - if (read_counter(counter)) - return -1; + ret = process_counter_maps(counter); + if (ret) + return ret; + + if (aggr_mode != AGGR_GLOBAL) + return 0; if (!counter->snapshot) perf_evsel__compute_deltas(counter, -1, -1, aggr); @@ -315,7 +333,10 @@ static int read_counter(struct perf_evsel *counter) for (thread = 0; thread < nthreads; thread++) { for (cpu = 0; cpu < ncpus; cpu++) { - if (perf_evsel__read_cb(counter, cpu, thread, read_cb)) + struct perf_counts_values *count; + + count = perf_counts(counter->counts, cpu, thread); + if (perf_evsel__read(counter, cpu, thread, count)) return -1; } } @@ -332,10 +353,11 @@ static void read_counters(bool close) ps = counter->priv; memset(ps->res_stats, 0, sizeof(ps->res_stats)); - if (aggr_mode == AGGR_GLOBAL) - read_counter_aggr(counter); - else - read_counter(counter); + if (read_counter(counter)) + pr_warning("failed to read counter %s\n", counter->name); + + if (process_counter(counter)) + pr_warning("failed to process counter %s\n", counter->name); if (close) { perf_evsel__close_fd(counter, perf_evsel__nr_cpus(counter), -- To unsubscribe from this list: send the lin
[tip:perf/urgent] perf stat: Introduce read_counters function
Commit-ID: 106a94a0f8c207ef4113ce7e32f34a00b3b174e7 Gitweb: http://git.kernel.org/tip/106a94a0f8c207ef4113ce7e32f34a00b3b174e7 Author: Jiri Olsa AuthorDate: Fri, 26 Jun 2015 11:29:19 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 11:48:02 -0300 perf stat: Introduce read_counters function Moving read counters logic into single read_counters function, which will be called for both interval and overall processing legs. The reason is to split reading and processing (following patches) counters code, so we could read counters from other sources (like perf.data) and process them in the same way as 'perf stat' command does. Signed-off-by: Jiri Olsa Cc: Adrian Hunter Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1435310967-14570-15-git-send-email-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 47 ++- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 3e385f9..158859e 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -323,27 +323,35 @@ static int read_counter(struct perf_evsel *counter) return 0; } -static void print_interval(void) +static void read_counters(bool close) { - static int num_print_interval; struct perf_evsel *counter; struct perf_stat *ps; - struct timespec ts, rs; - char prefix[64]; - if (aggr_mode == AGGR_GLOBAL) { - evlist__for_each(evsel_list, counter) { - ps = counter->priv; - memset(ps->res_stats, 0, sizeof(ps->res_stats)); + evlist__for_each(evsel_list, counter) { + ps = counter->priv; + memset(ps->res_stats, 0, sizeof(ps->res_stats)); + + if (aggr_mode == AGGR_GLOBAL) read_counter_aggr(counter); - } - } else { - evlist__for_each(evsel_list, counter) { - ps = counter->priv; - memset(ps->res_stats, 0, sizeof(ps->res_stats)); + else read_counter(counter); + + if (close) { + perf_evsel__close_fd(counter, perf_evsel__nr_cpus(counter), + thread_map__nr(evsel_list->threads)); } } +} + +static void print_interval(void) +{ + static int num_print_interval; + struct perf_evsel *counter; + struct timespec ts, rs; + char prefix[64]; + + read_counters(false); clock_gettime(CLOCK_MONOTONIC, &ts); diff_timespec(&rs, &ts, &ref_time); @@ -525,18 +533,7 @@ static int __run_perf_stat(int argc, const char **argv) update_stats(&walltime_nsecs_stats, t1 - t0); - if (aggr_mode == AGGR_GLOBAL) { - evlist__for_each(evsel_list, counter) { - read_counter_aggr(counter); - perf_evsel__close_fd(counter, perf_evsel__nr_cpus(counter), - thread_map__nr(evsel_list->threads)); - } - } else { - evlist__for_each(evsel_list, counter) { - read_counter(counter); - perf_evsel__close_fd(counter, perf_evsel__nr_cpus(counter), 1); - } - } + read_counters(true); return WEXITSTATUS(status); } -- 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/
[tip:perf/urgent] perf stat: Introduce perf_evsel__read function
Commit-ID: f99f4719b841a9745d6a7652eef3956aaf2db66a Gitweb: http://git.kernel.org/tip/f99f4719b841a9745d6a7652eef3956aaf2db66a Author: Jiri Olsa AuthorDate: Fri, 26 Jun 2015 11:29:18 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 11:46:57 -0300 perf stat: Introduce perf_evsel__read function Adding simple read function that reads/store data into given struct perf_counts_values *count object. Signed-off-by: Jiri Olsa Cc: Adrian Hunter Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1435310967-14570-14-git-send-email-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/evsel.c | 14 ++ tools/perf/util/evsel.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index cd6ce70..2e0a4e0 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -955,6 +955,20 @@ int perf_evsel__read_cb(struct perf_evsel *evsel, int cpu, int thread, return cb(evsel, cpu, thread, &count); } +int perf_evsel__read(struct perf_evsel *evsel, int cpu, int thread, +struct perf_counts_values *count) +{ + memset(count, 0, sizeof(*count)); + + if (FD(evsel, cpu, thread) < 0) + return -EINVAL; + + if (readn(FD(evsel, cpu, thread), count, sizeof(*count)) < 0) + return -errno; + + return 0; +} + int __perf_evsel__read_on_cpu(struct perf_evsel *evsel, int cpu, int thread, bool scale) { diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 020f7e1..a79944a 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h @@ -236,6 +236,9 @@ typedef int (perf_evsel__read_cb_t)(struct perf_evsel *evsel, int perf_evsel__read_cb(struct perf_evsel *evsel, int cpu, int thread, perf_evsel__read_cb_t cb); +int perf_evsel__read(struct perf_evsel *evsel, int cpu, int thread, +struct perf_counts_values *count); + int __perf_evsel__read_on_cpu(struct perf_evsel *evsel, int cpu, int thread, bool scale); -- 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/1] igb: Use ARRAY_SIZE instead fo sizeof(a)/sizeof(a[0])
Use ARRAY_SIZE instead fo sizeof(a)/sizeof(a[0]) Signed-off-by: Maninder Singh Reviewed-by: Yogesh Narayan Gaur --- drivers/net/ethernet/intel/igb/e1000_phy.c |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.c b/drivers/net/ethernet/intel/igb/e1000_phy.c index c1bb64d..e399b3c 100644 --- a/drivers/net/ethernet/intel/igb/e1000_phy.c +++ b/drivers/net/ethernet/intel/igb/e1000_phy.c @@ -37,8 +37,7 @@ static s32 igb_set_master_slave_mode(struct e1000_hw *hw); static const u16 e1000_m88_cable_length_table[] = { 0, 50, 80, 110, 140, 140, E1000_CABLE_LENGTH_UNDEFINED }; #define M88E1000_CABLE_LENGTH_TABLE_SIZE \ - (sizeof(e1000_m88_cable_length_table) / \ - sizeof(e1000_m88_cable_length_table[0])) + ARRAY_SIZE(e1000_m88_cable_length_table) static const u16 e1000_igp_2_cable_length_table[] = { 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 11, 13, 16, 18, 21, @@ -50,8 +49,7 @@ static const u16 e1000_igp_2_cable_length_table[] = { 83, 89, 95, 100, 105, 109, 113, 116, 119, 122, 124, 104, 109, 114, 118, 121, 124}; #define IGP02E1000_CABLE_LENGTH_TABLE_SIZE \ - (sizeof(e1000_igp_2_cable_length_table) / \ -sizeof(e1000_igp_2_cable_length_table[0])) + ARRAY_SIZE(e1000_igp_2_cable_length_table) /** * igb_check_reset_block - Check if PHY reset is blocked -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:perf/urgent] perf stat: Introduce perf_evsel__alloc_stats function
Commit-ID: a7d0a102e4ae46b75b70a9500979e7ed3cdf183f Gitweb: http://git.kernel.org/tip/a7d0a102e4ae46b75b70a9500979e7ed3cdf183f Author: Jiri Olsa AuthorDate: Fri, 26 Jun 2015 11:29:17 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 11:46:00 -0300 perf stat: Introduce perf_evsel__alloc_stats function Move all stat allocation logic related to stat object under single function. This way we can use it separately for stat object out of evlist object. Signed-off-by: Jiri Olsa Cc: Adrian Hunter Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1435310967-14570-13-git-send-email-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/stat.c | 20 ++-- tools/perf/util/stat.h | 2 ++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index 818cb02..f2a0d15 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c @@ -189,17 +189,25 @@ void perf_evsel__free_prev_raw_counts(struct perf_evsel *evsel) evsel->prev_raw_counts = NULL; } +int perf_evsel__alloc_stats(struct perf_evsel *evsel, bool alloc_raw) +{ + int ncpus = perf_evsel__nr_cpus(evsel); + int nthreads = thread_map__nr(evsel->threads); + + if (perf_evsel__alloc_stat_priv(evsel) < 0 || + perf_evsel__alloc_counts(evsel, ncpus, nthreads) < 0 || + (alloc_raw && perf_evsel__alloc_prev_raw_counts(evsel, ncpus, nthreads) < 0)) + return -ENOMEM; + + return 0; +} + int perf_evlist__alloc_stats(struct perf_evlist *evlist, bool alloc_raw) { struct perf_evsel *evsel; - int nthreads = thread_map__nr(evlist->threads); evlist__for_each(evlist, evsel) { - int ncpus = perf_evsel__nr_cpus(evsel); - - if (perf_evsel__alloc_stat_priv(evsel) < 0 || - perf_evsel__alloc_counts(evsel, ncpus, nthreads) < 0 || - (alloc_raw && perf_evsel__alloc_prev_raw_counts(evsel, ncpus, nthreads) < 0)) + if (perf_evsel__alloc_stats(evsel, alloc_raw)) goto out_free; } diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h index 5f62db2..9f05c57 100644 --- a/tools/perf/util/stat.h +++ b/tools/perf/util/stat.h @@ -103,6 +103,8 @@ int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel, int ncpus, int nthreads); void perf_evsel__free_prev_raw_counts(struct perf_evsel *evsel); +int perf_evsel__alloc_stats(struct perf_evsel *evsel, bool alloc_raw); + int perf_evlist__alloc_stats(struct perf_evlist *evlist, bool alloc_raw); void perf_evlist__free_stats(struct perf_evlist *evlist); void perf_evlist__reset_stats(struct perf_evlist *evlist); -- 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/
[tip:perf/urgent] perf stat: Move perf_evsel__(alloc|free) _prev_raw_counts into stat object
Commit-ID: a939512d10a5583a32ae85c1bff6c4ae63a8a517 Gitweb: http://git.kernel.org/tip/a939512d10a5583a32ae85c1bff6c4ae63a8a517 Author: Jiri Olsa AuthorDate: Fri, 26 Jun 2015 11:29:15 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 11:34:43 -0300 perf stat: Move perf_evsel__(alloc|free)_prev_raw_counts into stat object Moving perf_evsel__(alloc|free)_prev_raw_counts into stat object, so it could be used in following patches. Signed-off-by: Jiri Olsa Cc: Adrian Hunter Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1435310967-14570-11-git-send-email-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 18 -- tools/perf/util/stat.c| 18 ++ tools/perf/util/stat.h| 4 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 8a7fd0c..0ccba5c 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -141,24 +141,6 @@ static inline void diff_timespec(struct timespec *r, struct timespec *a, } } -static int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel, -int ncpus, int nthreads) -{ - struct perf_counts *counts; - - counts = perf_counts__new(ncpus, nthreads); - if (counts) - evsel->prev_raw_counts = counts; - - return counts ? 0 : -ENOMEM; -} - -static void perf_evsel__free_prev_raw_counts(struct perf_evsel *evsel) -{ - perf_counts__delete(evsel->prev_raw_counts); - evsel->prev_raw_counts = NULL; -} - static void perf_evlist__free_stats(struct perf_evlist *evlist) { struct perf_evsel *evsel; diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index b8c329f..6221c38 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c @@ -168,3 +168,21 @@ void perf_evsel__free_stat_priv(struct perf_evsel *evsel) { zfree(&evsel->priv); } + +int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel, + int ncpus, int nthreads) +{ + struct perf_counts *counts; + + counts = perf_counts__new(ncpus, nthreads); + if (counts) + evsel->prev_raw_counts = counts; + + return counts ? 0 : -ENOMEM; +} + +void perf_evsel__free_prev_raw_counts(struct perf_evsel *evsel) +{ + perf_counts__delete(evsel->prev_raw_counts); + evsel->prev_raw_counts = NULL; +} diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h index c441cb3..454b268 100644 --- a/tools/perf/util/stat.h +++ b/tools/perf/util/stat.h @@ -96,4 +96,8 @@ void perf_evsel__free_counts(struct perf_evsel *evsel); void perf_evsel__reset_stat_priv(struct perf_evsel *evsel); int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel); void perf_evsel__free_stat_priv(struct perf_evsel *evsel); + +int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel, + int ncpus, int nthreads); +void perf_evsel__free_prev_raw_counts(struct perf_evsel *evsel); #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/
[tip:perf/urgent] perf stat: Move perf_evlist__(alloc|free|reset) _stats into stat object
Commit-ID: 24e34f68e21a47a582b3cc2eccdb835b80b1830a Gitweb: http://git.kernel.org/tip/24e34f68e21a47a582b3cc2eccdb835b80b1830a Author: Jiri Olsa AuthorDate: Fri, 26 Jun 2015 11:29:16 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 11:44:37 -0300 perf stat: Move perf_evlist__(alloc|free|reset)_stats into stat object Moving perf_evlist__(alloc|free|reset)_stats into stat object, so it could be used in following patches. Signed-off-by: Jiri Olsa Cc: Adrian Hunter Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1435310967-14570-12-git-send-email-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 42 -- tools/perf/util/evlist.h | 1 - tools/perf/util/stat.c| 44 tools/perf/util/stat.h| 6 ++ 4 files changed, 50 insertions(+), 43 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 0ccba5c..3e385f9 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -141,48 +141,6 @@ static inline void diff_timespec(struct timespec *r, struct timespec *a, } } -static void perf_evlist__free_stats(struct perf_evlist *evlist) -{ - struct perf_evsel *evsel; - - evlist__for_each(evlist, evsel) { - perf_evsel__free_stat_priv(evsel); - perf_evsel__free_counts(evsel); - perf_evsel__free_prev_raw_counts(evsel); - } -} - -static int perf_evlist__alloc_stats(struct perf_evlist *evlist, bool alloc_raw) -{ - struct perf_evsel *evsel; - int nthreads = thread_map__nr(evsel_list->threads); - - evlist__for_each(evlist, evsel) { - int ncpus = perf_evsel__nr_cpus(evsel); - - if (perf_evsel__alloc_stat_priv(evsel) < 0 || - perf_evsel__alloc_counts(evsel, ncpus, nthreads) < 0 || - (alloc_raw && perf_evsel__alloc_prev_raw_counts(evsel, ncpus, nthreads) < 0)) - goto out_free; - } - - return 0; - -out_free: - perf_evlist__free_stats(evlist); - return -1; -} - -static void perf_evlist__reset_stats(struct perf_evlist *evlist) -{ - struct perf_evsel *evsel; - - evlist__for_each(evlist, evsel) { - perf_evsel__reset_stat_priv(evsel); - perf_evsel__reset_counts(evsel); - } -} - static void perf_stat__reset_stats(void) { perf_evlist__reset_stats(evsel_list); diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index a8489b9..037633c 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h @@ -289,5 +289,4 @@ void perf_evlist__to_front(struct perf_evlist *evlist, void perf_evlist__set_tracking_event(struct perf_evlist *evlist, struct perf_evsel *tracking_evsel); - #endif /* __PERF_EVLIST_H */ diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index 6221c38..818cb02 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c @@ -1,6 +1,8 @@ #include #include "stat.h" +#include "evlist.h" #include "evsel.h" +#include "thread_map.h" void update_stats(struct stats *stats, u64 val) { @@ -186,3 +188,45 @@ void perf_evsel__free_prev_raw_counts(struct perf_evsel *evsel) perf_counts__delete(evsel->prev_raw_counts); evsel->prev_raw_counts = NULL; } + +int perf_evlist__alloc_stats(struct perf_evlist *evlist, bool alloc_raw) +{ + struct perf_evsel *evsel; + int nthreads = thread_map__nr(evlist->threads); + + evlist__for_each(evlist, evsel) { + int ncpus = perf_evsel__nr_cpus(evsel); + + if (perf_evsel__alloc_stat_priv(evsel) < 0 || + perf_evsel__alloc_counts(evsel, ncpus, nthreads) < 0 || + (alloc_raw && perf_evsel__alloc_prev_raw_counts(evsel, ncpus, nthreads) < 0)) + goto out_free; + } + + return 0; + +out_free: + perf_evlist__free_stats(evlist); + return -1; +} + +void perf_evlist__free_stats(struct perf_evlist *evlist) +{ + struct perf_evsel *evsel; + + evlist__for_each(evlist, evsel) { + perf_evsel__free_stat_priv(evsel); + perf_evsel__free_counts(evsel); + perf_evsel__free_prev_raw_counts(evsel); + } +} + +void perf_evlist__reset_stats(struct perf_evlist *evlist) +{ + struct perf_evsel *evsel; + + evlist__for_each(evlist, evsel) { + perf_evsel__reset_stat_priv(evsel); + perf_evsel__reset_counts(evsel); + } +} diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h index 454b268..5f62db2 100644 --- a/tools/perf/util/stat.h +++ b/tools/perf/util/stat.h @@ -70,6 +70,8 @@ static inline void init_stats(struct stats *stats) } struct perf_evsel; +struct perf_evlist; + b
[tip:perf/urgent] perf stat: Move perf_evsel__(alloc|free|reset) _stat_priv into stat object
Commit-ID: 9689edfabc1547155a7cdd1304fd294107054291 Gitweb: http://git.kernel.org/tip/9689edfabc1547155a7cdd1304fd294107054291 Author: Jiri Olsa AuthorDate: Fri, 26 Jun 2015 11:29:14 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 11:26:44 -0300 perf stat: Move perf_evsel__(alloc|free|reset)_stat_priv into stat object Moving perf_evsel__(alloc|free|reset)_stat_priv into stat object, so it could be used outside stat command in following patches. Signed-off-by: Jiri Olsa Cc: Adrian Hunter Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1435310967-14570-10-git-send-email-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 25 - tools/perf/util/stat.c| 25 + tools/perf/util/stat.h| 4 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 188cd98a..8a7fd0c 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -141,31 +141,6 @@ static inline void diff_timespec(struct timespec *r, struct timespec *a, } } -static void perf_evsel__reset_stat_priv(struct perf_evsel *evsel) -{ - int i; - struct perf_stat *ps = evsel->priv; - - for (i = 0; i < 3; i++) - init_stats(&ps->res_stats[i]); - - perf_stat_evsel_id_init(evsel); -} - -static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel) -{ - evsel->priv = zalloc(sizeof(struct perf_stat)); - if (evsel->priv == NULL) - return -ENOMEM; - perf_evsel__reset_stat_priv(evsel); - return 0; -} - -static void perf_evsel__free_stat_priv(struct perf_evsel *evsel) -{ - zfree(&evsel->priv); -} - static int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel, int ncpus, int nthreads) { diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index 197a2db..b8c329f 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c @@ -143,3 +143,28 @@ void perf_evsel__free_counts(struct perf_evsel *evsel) perf_counts__delete(evsel->counts); evsel->counts = NULL; } + +void perf_evsel__reset_stat_priv(struct perf_evsel *evsel) +{ + int i; + struct perf_stat *ps = evsel->priv; + + for (i = 0; i < 3; i++) + init_stats(&ps->res_stats[i]); + + perf_stat_evsel_id_init(evsel); +} + +int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel) +{ + evsel->priv = zalloc(sizeof(struct perf_stat)); + if (evsel->priv == NULL) + return -ENOMEM; + perf_evsel__reset_stat_priv(evsel); + return 0; +} + +void perf_evsel__free_stat_priv(struct perf_evsel *evsel) +{ + zfree(&evsel->priv); +} diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h index 295d1e2..c441cb3 100644 --- a/tools/perf/util/stat.h +++ b/tools/perf/util/stat.h @@ -92,4 +92,8 @@ void perf_counts__delete(struct perf_counts *counts); void perf_evsel__reset_counts(struct perf_evsel *evsel); int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus, int nthreads); void perf_evsel__free_counts(struct perf_evsel *evsel); + +void perf_evsel__reset_stat_priv(struct perf_evsel *evsel); +int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel); +void perf_evsel__free_stat_priv(struct perf_evsel *evsel); #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/
[tip:perf/urgent] perf stat: Rename struct perf_counts:: cpu member to values
Commit-ID: 57b289159ab4fe1f7b2b531464cf67f65e48dd00 Gitweb: http://git.kernel.org/tip/57b289159ab4fe1f7b2b531464cf67f65e48dd00 Author: Jiri Olsa AuthorDate: Fri, 26 Jun 2015 11:29:12 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 11:25:03 -0300 perf stat: Rename struct perf_counts::cpu member to values Renaming 'struct xyarray *cpu' pointer to more fitting/generic values, because now we store both cpu and thread values. Signed-off-by: Jiri Olsa Cc: Adrian Hunter Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1435310967-14570-8-git-send-email-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/stat.c | 12 ++-- tools/perf/util/stat.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index 7bcc19b..197a2db 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c @@ -100,15 +100,15 @@ struct perf_counts *perf_counts__new(int ncpus, int nthreads) struct perf_counts *counts = zalloc(sizeof(*counts)); if (counts) { - struct xyarray *cpu; + struct xyarray *values; - cpu = xyarray__new(ncpus, nthreads, sizeof(struct perf_counts_values)); - if (!cpu) { + values = xyarray__new(ncpus, nthreads, sizeof(struct perf_counts_values)); + if (!values) { free(counts); return NULL; } - counts->cpu = cpu; + counts->values = values; } return counts; @@ -117,14 +117,14 @@ struct perf_counts *perf_counts__new(int ncpus, int nthreads) void perf_counts__delete(struct perf_counts *counts) { if (counts) { - xyarray__delete(counts->cpu); + xyarray__delete(counts->values); free(counts); } } static void perf_counts__reset(struct perf_counts *counts) { - xyarray__reset(counts->cpu); + xyarray__reset(counts->values); } void perf_evsel__reset_counts(struct perf_evsel *evsel) diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h index e0b8dc5..295d1e2 100644 --- a/tools/perf/util/stat.h +++ b/tools/perf/util/stat.h @@ -46,13 +46,13 @@ struct perf_counts_values { struct perf_counts { s8scaled; struct perf_counts_values aggr; - struct xyarray*cpu; + struct xyarray*values; }; static inline struct perf_counts_values* perf_counts(struct perf_counts *counts, int cpu, int thread) { - return xyarray__entry(counts->cpu, cpu, thread); + return xyarray__entry(counts->values, cpu, thread); } void update_stats(struct stats *stats, u64 val); -- 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/
[tip:perf/urgent] perf stat: Make stats work over the thread dimension
Commit-ID: a6fa003855d38d53d90c1a8a5827102e62702334 Gitweb: http://git.kernel.org/tip/a6fa003855d38d53d90c1a8a5827102e62702334 Author: Jiri Olsa AuthorDate: Fri, 26 Jun 2015 11:29:11 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 11:20:02 -0300 perf stat: Make stats work over the thread dimension Now that we have space for thread dimension counts, let's store it. Signed-off-by: Jiri Olsa Cc: Adrian Hunter Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1435310967-14570-7-git-send-email-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 32 +- tools/perf/tests/openat-syscall-all-cpus.c | 6 +++--- tools/perf/tests/openat-syscall.c | 4 ++-- tools/perf/util/evsel.c| 12 +-- tools/perf/util/evsel.h| 2 +- tools/perf/util/stat.c | 8 tools/perf/util/stat.h | 8 7 files changed, 38 insertions(+), 34 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 055ce83..983bcbb 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -166,11 +166,12 @@ static void perf_evsel__free_stat_priv(struct perf_evsel *evsel) zfree(&evsel->priv); } -static int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel) +static int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel, +int ncpus, int nthreads) { struct perf_counts *counts; - counts = perf_counts__new(perf_evsel__nr_cpus(evsel)); + counts = perf_counts__new(ncpus, nthreads); if (counts) evsel->prev_raw_counts = counts; @@ -197,11 +198,14 @@ static void perf_evlist__free_stats(struct perf_evlist *evlist) static int perf_evlist__alloc_stats(struct perf_evlist *evlist, bool alloc_raw) { struct perf_evsel *evsel; + int nthreads = thread_map__nr(evsel_list->threads); evlist__for_each(evlist, evsel) { + int ncpus = perf_evsel__nr_cpus(evsel); + if (perf_evsel__alloc_stat_priv(evsel) < 0 || - perf_evsel__alloc_counts(evsel, perf_evsel__nr_cpus(evsel)) < 0 || - (alloc_raw && perf_evsel__alloc_prev_raw_counts(evsel) < 0)) + perf_evsel__alloc_counts(evsel, ncpus, nthreads) < 0 || + (alloc_raw && perf_evsel__alloc_prev_raw_counts(evsel, ncpus, nthreads) < 0)) goto out_free; } @@ -294,7 +298,7 @@ static int check_per_pkg(struct perf_evsel *counter, int cpu, bool *skip) return 0; } -static int read_cb(struct perf_evsel *evsel, int cpu, int thread __maybe_unused, +static int read_cb(struct perf_evsel *evsel, int cpu, int thread, struct perf_counts_values *count) { struct perf_counts_values *aggr = &evsel->counts->aggr; @@ -314,9 +318,9 @@ static int read_cb(struct perf_evsel *evsel, int cpu, int thread __maybe_unused, case AGGR_SOCKET: case AGGR_NONE: if (!evsel->snapshot) - perf_evsel__compute_deltas(evsel, cpu, count); + perf_evsel__compute_deltas(evsel, cpu, thread, count); perf_counts_values__scale(count, scale, NULL); - *perf_counts(evsel->counts, cpu) = *count; + *perf_counts(evsel->counts, cpu, thread) = *count; if (aggr_mode == AGGR_NONE) perf_stat__update_shadow_stats(evsel, count->values, cpu); break; @@ -352,7 +356,7 @@ static int read_counter_aggr(struct perf_evsel *counter) return -1; if (!counter->snapshot) - perf_evsel__compute_deltas(counter, -1, aggr); + perf_evsel__compute_deltas(counter, -1, -1, aggr); perf_counts_values__scale(aggr, scale, &counter->counts->scaled); for (i = 0; i < 3; i++) @@ -805,9 +809,9 @@ static void print_aggr(char *prefix) s2 = aggr_get_id(evsel_list->cpus, cpu2); if (s2 != id) continue; - val += perf_counts(counter->counts, cpu)->val; - ena += perf_counts(counter->counts, cpu)->ena; - run += perf_counts(counter->counts, cpu)->run; + val += perf_counts(counter->counts, cpu, 0)->val; + ena += perf_counts(counter->counts, cpu, 0)->ena; + run += perf_counts(counter->counts, cpu, 0)->run; nr++; } if (prefix) @@ -915,9 +919,9 @@ static void print_counter(struc
[tip:perf/urgent] perf stat: Introduce perf_evlist__reset_stats
Commit-ID: 254ecbc7474dfa08155c5595e90cd4a0fa9d14ce Gitweb: http://git.kernel.org/tip/254ecbc7474dfa08155c5595e90cd4a0fa9d14ce Author: Jiri Olsa AuthorDate: Fri, 26 Jun 2015 11:29:13 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 11:25:39 -0300 perf stat: Introduce perf_evlist__reset_stats To fit in with the rest of the helpers (alloc and free). Signed-off-by: Jiri Olsa Cc: Adrian Hunter Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1435310967-14570-9-git-send-email-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 983bcbb..188cd98a 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -216,7 +216,7 @@ out_free: return -1; } -static void perf_stat__reset_stats(struct perf_evlist *evlist) +static void perf_evlist__reset_stats(struct perf_evlist *evlist) { struct perf_evsel *evsel; @@ -224,7 +224,11 @@ static void perf_stat__reset_stats(struct perf_evlist *evlist) perf_evsel__reset_stat_priv(evsel); perf_evsel__reset_counts(evsel); } +} +static void perf_stat__reset_stats(void) +{ + perf_evlist__reset_stats(evsel_list); perf_stat__reset_shadow_stats(); } @@ -1473,7 +1477,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused) status = run_perf_stat(argc, argv); if (forever && status != -1) { print_stat(argc, argv); - perf_stat__reset_stats(evsel_list); + perf_stat__reset_stats(); } } -- 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/
[tip:perf/urgent] perf stat: Introduce perf_counts function
Commit-ID: 1ac77e1ce8654ec94ada0c508d58ba80a4647fba Gitweb: http://git.kernel.org/tip/1ac77e1ce8654ec94ada0c508d58ba80a4647fba Author: Jiri Olsa AuthorDate: Fri, 26 Jun 2015 11:29:09 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 11:11:26 -0300 perf stat: Introduce perf_counts function Introducing perf_counts function, that returns 'struct perf_counts_values' pointer for given cpu. Also moving perf_counts* structures into stat.h. Signed-off-by: Jiri Olsa Cc: Adrian Hunter Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1435310967-14570-5-git-send-email-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 14 +++--- tools/perf/tests/openat-syscall-all-cpus.c | 4 ++-- tools/perf/tests/openat-syscall.c | 2 +- tools/perf/util/evsel.c| 6 +++--- tools/perf/util/evsel.h| 18 +- tools/perf/util/stat.h | 23 +++ 6 files changed, 37 insertions(+), 30 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 3e1636c..49b9037 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -316,7 +316,7 @@ static int read_cb(struct perf_evsel *evsel, int cpu, int thread __maybe_unused, if (!evsel->snapshot) perf_evsel__compute_deltas(evsel, cpu, count); perf_counts_values__scale(count, scale, NULL); - evsel->counts->cpu[cpu] = *count; + *perf_counts(evsel->counts, cpu) = *count; if (aggr_mode == AGGR_NONE) perf_stat__update_shadow_stats(evsel, count->values, cpu); break; @@ -805,9 +805,9 @@ static void print_aggr(char *prefix) s2 = aggr_get_id(evsel_list->cpus, cpu2); if (s2 != id) continue; - val += counter->counts->cpu[cpu].val; - ena += counter->counts->cpu[cpu].ena; - run += counter->counts->cpu[cpu].run; + val += perf_counts(counter->counts, cpu)->val; + ena += perf_counts(counter->counts, cpu)->ena; + run += perf_counts(counter->counts, cpu)->run; nr++; } if (prefix) @@ -915,9 +915,9 @@ static void print_counter(struct perf_evsel *counter, char *prefix) int cpu; for (cpu = 0; cpu < perf_evsel__nr_cpus(counter); cpu++) { - val = counter->counts->cpu[cpu].val; - ena = counter->counts->cpu[cpu].ena; - run = counter->counts->cpu[cpu].run; + val = perf_counts(counter->counts, cpu)->val; + ena = perf_counts(counter->counts, cpu)->ena; + run = perf_counts(counter->counts, cpu)->run; if (prefix) fprintf(output, "%s", prefix); diff --git a/tools/perf/tests/openat-syscall-all-cpus.c b/tools/perf/tests/openat-syscall-all-cpus.c index b8d552b..e8d944f 100644 --- a/tools/perf/tests/openat-syscall-all-cpus.c +++ b/tools/perf/tests/openat-syscall-all-cpus.c @@ -98,9 +98,9 @@ int test__openat_syscall_event_on_all_cpus(void) } expected = nr_openat_calls + cpu; - if (evsel->counts->cpu[cpu].val != expected) { + if (perf_counts(evsel->counts, cpu)->val != expected) { pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls on cpu %d, got %" PRIu64 "\n", -expected, cpus->map[cpu], evsel->counts->cpu[cpu].val); +expected, cpus->map[cpu], perf_counts(evsel->counts, cpu)->val); err = -1; } } diff --git a/tools/perf/tests/openat-syscall.c b/tools/perf/tests/openat-syscall.c index bdfa1f4..e86fc47 100644 --- a/tools/perf/tests/openat-syscall.c +++ b/tools/perf/tests/openat-syscall.c @@ -44,7 +44,7 @@ int test__openat_syscall_event(void) goto out_close_fd; } - if (evsel->counts->cpu[0].val != nr_openat_calls) { + if (perf_counts(evsel->counts, 0)->val != nr_openat_calls) { pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls, got %" PRIu64 "\n", nr_openat_calls, evsel->counts->cpu[0].val); goto out_close_fd; diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 1b2f480..8401b04 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -910,8 +910,8 @@ void perf_evsel__compute_deltas(struct perf_evsel *evsel, int cpu,
[tip:perf/urgent] perf stat: Use xyarray for cpu evsel counts
Commit-ID: a8e02324dfe6bcafc15d02b790f33321ec4facb0 Gitweb: http://git.kernel.org/tip/a8e02324dfe6bcafc15d02b790f33321ec4facb0 Author: Jiri Olsa AuthorDate: Fri, 26 Jun 2015 11:29:10 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 11:19:19 -0300 perf stat: Use xyarray for cpu evsel counts Switching single dimensional array of 'struct perf_counts_values' with xyarray object, so we could store thread dimension counts. Signed-off-by: Jiri Olsa Cc: Adrian Hunter Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1435310967-14570-6-git-send-email-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 2 +- tools/perf/tests/openat-syscall.c | 2 +- tools/perf/util/stat.c| 31 ++- tools/perf/util/stat.h| 7 --- 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 49b9037..055ce83 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -218,7 +218,7 @@ static void perf_stat__reset_stats(struct perf_evlist *evlist) evlist__for_each(evlist, evsel) { perf_evsel__reset_stat_priv(evsel); - perf_evsel__reset_counts(evsel, perf_evsel__nr_cpus(evsel)); + perf_evsel__reset_counts(evsel); } perf_stat__reset_shadow_stats(); diff --git a/tools/perf/tests/openat-syscall.c b/tools/perf/tests/openat-syscall.c index e86fc47..bd882f0 100644 --- a/tools/perf/tests/openat-syscall.c +++ b/tools/perf/tests/openat-syscall.c @@ -46,7 +46,7 @@ int test__openat_syscall_event(void) if (perf_counts(evsel->counts, 0)->val != nr_openat_calls) { pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls, got %" PRIu64 "\n", -nr_openat_calls, evsel->counts->cpu[0].val); +nr_openat_calls, perf_counts(evsel->counts, 0)->val); goto out_close_fd; } diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index 4014b70..453480a 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c @@ -97,26 +97,39 @@ void perf_stat_evsel_id_init(struct perf_evsel *evsel) struct perf_counts *perf_counts__new(int ncpus) { - int size = sizeof(struct perf_counts) + - ncpus * sizeof(struct perf_counts_values); + struct perf_counts *counts = zalloc(sizeof(*counts)); - return zalloc(size); + if (counts) { + struct xyarray *cpu; + + cpu = xyarray__new(ncpus, 1, sizeof(struct perf_counts_values)); + if (!cpu) { + free(counts); + return NULL; + } + + counts->cpu = cpu; + } + + return counts; } void perf_counts__delete(struct perf_counts *counts) { - free(counts); + if (counts) { + xyarray__delete(counts->cpu); + free(counts); + } } -static void perf_counts__reset(struct perf_counts *counts, int ncpus) +static void perf_counts__reset(struct perf_counts *counts) { - memset(counts, 0, (sizeof(*counts) + - (ncpus * sizeof(struct perf_counts_values; + xyarray__reset(counts->cpu); } -void perf_evsel__reset_counts(struct perf_evsel *evsel, int ncpus) +void perf_evsel__reset_counts(struct perf_evsel *evsel) { - perf_counts__reset(evsel->counts, ncpus); + perf_counts__reset(evsel->counts); } int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus) diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h index 5e43348..6d07612 100644 --- a/tools/perf/util/stat.h +++ b/tools/perf/util/stat.h @@ -3,6 +3,7 @@ #include #include +#include "xyarray.h" struct stats { @@ -45,13 +46,13 @@ struct perf_counts_values { struct perf_counts { s8scaled; struct perf_counts_values aggr; - struct perf_counts_values cpu[]; + struct xyarray*cpu; }; static inline struct perf_counts_values* perf_counts(struct perf_counts *counts, int cpu) { - return &counts->cpu[cpu]; + return xyarray__entry(counts->cpu, cpu, 0); } void update_stats(struct stats *stats, u64 val); @@ -88,7 +89,7 @@ void perf_stat__print_shadow_stats(FILE *out, struct perf_evsel *evsel, struct perf_counts *perf_counts__new(int ncpus); void perf_counts__delete(struct perf_counts *counts); -void perf_evsel__reset_counts(struct perf_evsel *evsel, int ncpus); +void perf_evsel__reset_counts(struct perf_evsel *evsel); int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus); void perf_evsel__free_counts(struct perf_evsel *evsel); #endif -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel
[tip:perf/urgent] perf tests: Add thread_map object tests
Commit-ID: 134aa44f6bff6b967efb85255ee9e8982cb8e486 Gitweb: http://git.kernel.org/tip/134aa44f6bff6b967efb85255ee9e8982cb8e486 Author: Jiri Olsa AuthorDate: Fri, 26 Jun 2015 11:29:08 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 11:09:38 -0300 perf tests: Add thread_map object tests Adding thread_map object tests for comm name values. Signed-off-by: Jiri Olsa Tested-by: Arnaldo Carvalho de Melo Cc: Adrian Hunter Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1435310967-14570-4-git-send-email-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/Build | 1 + tools/perf/tests/builtin-test.c | 4 tools/perf/tests/tests.h| 1 + tools/perf/tests/thread-map.c | 38 ++ 4 files changed, 44 insertions(+) diff --git a/tools/perf/tests/Build b/tools/perf/tests/Build index ee41e70..d20d6e6 100644 --- a/tools/perf/tests/Build +++ b/tools/perf/tests/Build @@ -31,6 +31,7 @@ perf-y += code-reading.o perf-y += sample-parsing.o perf-y += parse-no-sample-id-all.o perf-y += kmod-path.o +perf-y += thread-map.o perf-$(CONFIG_X86) += perf-time-to-tsc.o diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c index 87b9961..c1dde73 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c @@ -171,6 +171,10 @@ static struct test { .func = test__kmod_path__parse, }, { + .desc = "Test thread map", + .func = test__thread_map, + }, + { .func = NULL, }, }; diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h index 8e5038b..ebb47d9 100644 --- a/tools/perf/tests/tests.h +++ b/tools/perf/tests/tests.h @@ -61,6 +61,7 @@ int test__switch_tracking(void); int test__fdarray__filter(void); int test__fdarray__add(void); int test__kmod_path__parse(void); +int test__thread_map(void); #if defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__aarch64__) #ifdef HAVE_DWARF_UNWIND_SUPPORT diff --git a/tools/perf/tests/thread-map.c b/tools/perf/tests/thread-map.c new file mode 100644 index 000..5acf000 --- /dev/null +++ b/tools/perf/tests/thread-map.c @@ -0,0 +1,38 @@ +#include +#include +#include "tests.h" +#include "thread_map.h" +#include "debug.h" + +int test__thread_map(void) +{ + struct thread_map *map; + + /* test map on current pid */ + map = thread_map__new_by_pid(getpid()); + TEST_ASSERT_VAL("failed to alloc map", map); + + thread_map__read_comms(map); + + TEST_ASSERT_VAL("wrong nr", map->nr == 1); + TEST_ASSERT_VAL("wrong pid", + thread_map__pid(map, 0) == getpid()); + TEST_ASSERT_VAL("wrong comm", + thread_map__comm(map, 0) && + !strcmp(thread_map__comm(map, 0), "perf")); + thread_map__put(map); + + /* test dummy pid */ + map = thread_map__new_dummy(); + TEST_ASSERT_VAL("failed to alloc map", map); + + thread_map__read_comms(map); + + TEST_ASSERT_VAL("wrong nr", map->nr == 1); + TEST_ASSERT_VAL("wrong pid", thread_map__pid(map, 0) == -1); + TEST_ASSERT_VAL("wrong comm", + thread_map__comm(map, 0) && + !strcmp(thread_map__comm(map, 0), "dummy")); + thread_map__put(map); + return 0; +} -- 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/
[tip:perf/urgent] perf thrad_map: Add comm string into array
Commit-ID: 792402fd5c0a5a5300868e9dfc8ee569f3a39169 Gitweb: http://git.kernel.org/tip/792402fd5c0a5a5300868e9dfc8ee569f3a39169 Author: Jiri Olsa AuthorDate: Fri, 26 Jun 2015 11:29:07 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 11:07:01 -0300 perf thrad_map: Add comm string into array Adding support to hold comm name together with pids in 'struct thread_map'. It will be useful for --per-thread option to display task pid together with task name. Adding thread_map__read_comms function that reads/set comm string for the 'struct thread_map'. Getting the task name from /proc/$pid/comm. Signed-off-by: Jiri Olsa Cc: Adrian Hunter Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1435310967-14570-3-git-send-email-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/python-ext-sources | 1 + tools/perf/util/thread_map.c | 59 ++ tools/perf/util/thread_map.h | 8 ++ 3 files changed, 68 insertions(+) diff --git a/tools/perf/util/python-ext-sources b/tools/perf/util/python-ext-sources index 5925fec..e23ded4 100644 --- a/tools/perf/util/python-ext-sources +++ b/tools/perf/util/python-ext-sources @@ -20,3 +20,4 @@ util/stat.c util/strlist.c util/trace-event.c ../../lib/rbtree.c +util/string.c diff --git a/tools/perf/util/thread_map.c b/tools/perf/util/thread_map.c index ed76c17..da7646d 100644 --- a/tools/perf/util/thread_map.c +++ b/tools/perf/util/thread_map.c @@ -8,9 +8,11 @@ #include #include "strlist.h" #include +#include #include "asm/bug.h" #include "thread_map.h" #include "util.h" +#include "debug.h" /* Skip "." and ".." directories */ static int filter(const struct dirent *dir) @@ -319,8 +321,12 @@ struct thread_map *thread_map__new_str(const char *pid, const char *tid, static void thread_map__delete(struct thread_map *threads) { if (threads) { + int i; + WARN_ONCE(atomic_read(&threads->refcnt) != 0, "thread map refcnt unbalanced\n"); + for (i = 0; i < threads->nr; i++) + free(thread_map__comm(threads, i)); free(threads); } } @@ -348,3 +354,56 @@ size_t thread_map__fprintf(struct thread_map *threads, FILE *fp) return printed + fprintf(fp, "\n"); } + +static int get_comm(char **comm, pid_t pid) +{ + char *path; + size_t size; + int err; + + if (asprintf(&path, "%s/%d/comm", procfs__mountpoint(), pid) == -1) + return -ENOMEM; + + err = filename__read_str(path, comm, &size); + if (!err) { + /* +* We're reading 16 bytes, while filename__read_str +* allocates data per BUFSIZ bytes, so we can safely +* mark the end of the string. +*/ + (*comm)[size] = 0; + rtrim(*comm); + } + + free(path); + return err; +} + +static void comm_init(struct thread_map *map, int i) +{ + pid_t pid = thread_map__pid(map, i); + char *comm = NULL; + + /* dummy pid comm initialization */ + if (pid == -1) { + map->map[i].comm = strdup("dummy"); + return; + } + + /* +* The comm name is like extra bonus ;-), +* so just warn if we fail for any reason. +*/ + if (get_comm(&comm, pid)) + pr_warning("Couldn't resolve comm name for pid %d\n", pid); + + map->map[i].comm = comm; +} + +void thread_map__read_comms(struct thread_map *threads) +{ + int i; + + for (i = 0; i < threads->nr; ++i) + comm_init(threads, i); +} diff --git a/tools/perf/util/thread_map.h b/tools/perf/util/thread_map.h index 6b0cd2d..af679d8 100644 --- a/tools/perf/util/thread_map.h +++ b/tools/perf/util/thread_map.h @@ -7,6 +7,7 @@ struct thread_map_data { pid_tpid; + char*comm; }; struct thread_map { @@ -44,4 +45,11 @@ thread_map__set_pid(struct thread_map *map, int thread, pid_t pid) { map->map[thread].pid = pid; } + +static inline char *thread_map__comm(struct thread_map *map, int thread) +{ + return map->map[thread].comm; +} + +void thread_map__read_comms(struct thread_map *threads); #endif /* __PERF_THREAD_MAP_H */ -- 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/
[tip:perf/urgent] perf thread_map: Introduce thread_map__reset function
Commit-ID: 62eea464380633b88902da35bf9cbd8515289703 Gitweb: http://git.kernel.org/tip/62eea464380633b88902da35bf9cbd8515289703 Author: Jiri Olsa AuthorDate: Fri, 26 Jun 2015 11:29:06 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 11:03:41 -0300 perf thread_map: Introduce thread_map__reset function We need to reset newly allocated 'struct thread_map_data' entries, because we will introduce new comm memeber, which will get set later or not at all. Signed-off-by: Jiri Olsa Cc: Adrian Hunter Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1435310967-14570-2-git-send-email-jo...@kernel.org [ Use sizeof(map->map[0]) to be independent of the array entry type ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/thread_map.c | 17 - 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/thread_map.c b/tools/perf/util/thread_map.c index 368cc58..ed76c17 100644 --- a/tools/perf/util/thread_map.c +++ b/tools/perf/util/thread_map.c @@ -21,11 +21,26 @@ static int filter(const struct dirent *dir) return 1; } +static void thread_map__reset(struct thread_map *map, int start, int nr) +{ + size_t size = (nr - start) * sizeof(map->map[0]); + + memset(&map->map[start], 0, size); +} + static struct thread_map *thread_map__realloc(struct thread_map *map, int nr) { size_t size = sizeof(*map) + sizeof(map->map[0]) * nr; + int start = map ? map->nr : 0; - return realloc(map, size); + map = realloc(map, size); + /* +* We only realloc to add more items, let's reset new items. +*/ + if (map) + thread_map__reset(map, start, nr); + + return map; } #define thread_map__alloc(__nr) thread_map__realloc(NULL, __nr) -- 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/
[tip:perf/urgent] perf trace: Validate syscall list passed via -e argument
Commit-ID: d0cc439b30be638c3a606767e9469c300d397433 Gitweb: http://git.kernel.org/tip/d0cc439b30be638c3a606767e9469c300d397433 Author: Arnaldo Carvalho de Melo AuthorDate: Thu, 25 Jun 2015 19:32:33 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 26 Jun 2015 10:47:41 -0300 perf trace: Validate syscall list passed via -e argument The 'trace' tool was accepting any names passed and just looking if syscalls returned via the raw_syscalls:* tracepoints were in that list, leading to it accepting perf events and then never finding any, as those are not valid syscall names, confusing users. Fix it by checking each entry in the list using audit_name_to_syscall, telling the user which entries are invalid and suggesting where to look for valid syscall names. E.g: [root@zoo ~]# trace -e open,foo,bar,close,baz Error: Invalid syscall bar, baz, foo Hint: try 'perf list syscalls:sys_enter_*' Hint: and: 'man syscalls' [root@zoo ~]# Reported-by: Flavio Leitner Cc: Adrian Hunter Cc: Borislav Petkov Cc: David Ahern Cc: Don Zickus Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Namhyung Kim Link: http://lkml.kernel.org/n/tip-4g1i3m1z6fzsrznn2umi0...@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-trace.c | 32 1 file changed, 32 insertions(+) diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 2bf2ca7..39ad4d0 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -1617,6 +1617,34 @@ static int trace__read_syscall_info(struct trace *trace, int id) return syscall__set_arg_fmts(sc); } +static int trace__validate_ev_qualifier(struct trace *trace) +{ + int err = 0; + struct str_node *pos; + + strlist__for_each(pos, trace->ev_qualifier) { + const char *sc = pos->s; + + if (audit_name_to_syscall(sc, trace->audit.machine) < 0) { + if (err == 0) { + fputs("Error:\tInvalid syscall ", trace->output); + err = -EINVAL; + } else { + fputs(", ", trace->output); + } + + fputs(sc, trace->output); + } + } + + if (err < 0) { + fputs("\nHint:\ttry 'perf list syscalls:sys_enter_*'" + "\nHint:\tand: 'man syscalls'\n", trace->output); + } + + return err; +} + /* * args is to be interpreted as a series of longs but we need to handle * 8-byte unaligned accesses. args points to raw_data within the event @@ -2862,6 +2890,10 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused) err = -ENOMEM; goto out_close; } + + err = trace__validate_ev_qualifier(&trace); + if (err) + goto out_close; } err = target__validate(&trace.opts.target); -- 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/