summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-04-06ARM: dts: colibri imx6: increase sgtl5000 lrclk drive strenghtColibri-iMX7_LXDE-Image_2.7b2-20170410Colibri-iMX6_LXDE-Image_2.7b2-20170410Apalis-iMX6_LXDE-Image_2.7b2-20170410Max Krummenacher
Use the newly added "lrclk-strength" property to fix occational channel swap on audio start. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-05ASoC: sgtl5000: Allow LRCLK pad drive strength to be changedFabio Estevam
Introduce the "lrclk-strength" property to allow LRCLK pad drive strength to be changed via device tree. When running a stress playback loop test on a mx6dl wandboard channel swap can be noticed on about 10% of the times. While debugging this issue I noticed that when probing the SGTL5000 LRCLK pin with the scope the swap did not happen. After removing the probe the swap started to happen again. After changing the LRCLK pad drive strength to the maximum value the issue is gone. Same fix works on a mx6dl Colibri board as well. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Backport from http://mailman.alsa-project.org/pipermail/alsa-devel/2017-April/119525.html Conflicts: Documentation/devicetree/bindings/sound/sgtl5000.txt sound/soc/codecs/sgtl5000.c Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
2017-04-03Revert "ARM: dts: imx7-colibri: disable internal RTC on i.MX 7Solo"Stefan Agner
Colibri iMX7S V1.1B and later use a newer SoC tape-out which have the RTC issue resolved. Hence re-enable the internal RTC for Colibri iMX7S devices. This reverts commit 77662b82e2eff7da9f56e1b32b4222b3dbf989e9. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03apalis-imx6: use stopmode for poweroffMax Krummenacher
Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03pm-imx6.c: fix power off by stop modeMax Krummenacher
With the 3.14.28 release of the kernel imx6_stop_mode_poweroff() does not enter stop mode. Thus the function does not switch of power but returns. This seems to be caused by the second processor which has been stopped. Set the WFI event mask for the stopped processor works around the issue. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> (cherry-picked from commit 2acff0eaece38533e85e08431e7ae9f3027c677a)
2017-04-03colibri-imx6: use stopmode for poweroffMax Krummenacher
After the system has been shutdown with PMIC_ON_REQ and VCC_BATT is supplied from a battery it will never restart either by RESET or power cycle. So use the PMIC_STBY_REQ after shutdown to switch off power rails. Conflicts: arch/arm/mach-imx/pm-imx6.c drivers/regulator/pfuze100-regulator.c (cherry-picked from commit c8b186404065c4502b485820ad4a51515924795c) (cherry-picked from commit ee4c5c4da3b32f65528a2d523ca4bce574dee3c5) Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03net: fec: don't transfer ownership until descriptor write is completeTroy Kisky
If you don't own it, you shouldn't write to it. Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com> Signed-off-by: David S. Miller <davem@davemloft.net> (cherry picked from commit be293467b87c30cfdb24f74dcb225b693e436121) Conflicts: drivers/net/ethernet/freescale/fec_main.c
2017-04-03ARM: dts: imx: fix M41T0 RTC compatible stringStefan Agner
Toradex Carrier boards use the ST M41T0 RTC (not M41T00). The RTC is almost the same, but the M41T0 needs some special handling in case the oscillator fails. Now that support for this difference is available, using the new compatible string to make use of it. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03rtc: ds1307: support m41t0 variantStefan Agner
The m41t0 variant is very similar to the already supported m41t00 variant, with the notable exception of the oscillator fail bit. The data sheet notes: If the oscillator fail (OF) bit is internally set to a '1,' this indicates that the oscillator has either stopped, or was stopped for some period of time and can be used to judge the validity of the clock and date data. The bit will get cleared with a regular write of the system time, so no changes are needed to clear it. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03sgtl5000: switch on vag power for line_in -> outputMax Krummenacher
The VAG power is switched off whenever there is no ADC or DAC activity resulting in a non functional local loop from line in to headphone out. Switch on VAG power or keep it on when line in gets directly connected to the output. TODO: when switching the muxer back to DAC switch the VAG power off if no recording or playing is happening. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03ARM: dts: imx6qdl-apalis: fix gpio-bl-on pinctrl nodeMax Krummenacher
Move the gpio-bl-on node under the ipu function node to prevent the following boot error messages: [ 0.134945] imx6q-pinctrl 20e0000.iomuxc: no groups defined in /soc/aips-bus@02000000/iomuxc@020e0000/gpio-bl-on [ 0.387613] imx6q-pinctrl 20e0000.iomuxc: unable to find group for node gpio-bl-on Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03ARM: dts: imx6qdl-colibri: fix gpio-bl-on pinctrl nodeMax Krummenacher
Move the gpio-bl-on node under the ipu function node to prevent the following boot error messages: [ 0.122672] imx6dl-pinctrl 20e0000.iomuxc: no groups defined in /soc/aips-bus@02000000/iomuxc@020e0000/gpio-bl-on [ 0.298165] imx6dl-pinctrl 20e0000.iomuxc: unable to find group for node gpio-bl-on Delete the pin from its former gpio pincontrol so that it can be used from the backlight node. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03iio: adc: fix removeStefan Agner
Removing the device (e.g. using unbind) leads to a NULL pointer dereference stack trace. There is no need to manually unregister the platform device, so remove this obsolete code. This fixes unbinding the device e.g. using: # echo 2-0041 > /sys/bus/i2c/drivers/stmpe-i2c/unbind Also make sure the respective block is disabled in case we only unbind the ADC block: # echo stmpe-adc > /sys/bus/platform/drivers/stmpe-adc/unbind Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03ARM: dts: imx7-colibri: use reg value in node namesStefan Agner
By convention, the node name uses the address (specified by the reg property) appended to the node name. Follow this convention in SPI nodes too. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03ARM: dts: imx7-colibri: use pull-down for USBC_DET pinStefan Agner
The Standard Colibri pin for Client/Host detection USBC_DET (SODIMM pin 137) is multiplexed on the module with USB_OTG1_VBUS. The USB_OTG1_VBUS pad seems to be pulled low by default and not controllable through pinctrl. When the pin is unconnected on the Carrier board, the pin is at a intermediate voltage level which is not ideal. Pull-down the pin to make sure that the pin is at a defined state by default (low, USB host). Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03mmc: sdio: add forward declaration for struct mmc_hostStefan Agner
Add forward declaration for struct mmc_host. This avoid warnings when compiling SDIO WiFi driver other than the bcmdhd driver. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03ARM: imx: mu: let Cortex-M4 know about A7 stateStefan Agner
Introduce two new messages to let the Cortex-M4 know in what state the Linux system is in. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03ARM: imx: clk: do not force clock frequency of M4Stefan Agner
Let the M4 handle the clock frequency by itself. We also don't need to take care to make sure clocks stay on, the per domain CCM clock gate control registers can be used to let the CCM know that the M4 runs on that PLL: CCM_ControlGate(CCM, ccmPllGateSysDiv2, ccmClockNeededRun); Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03ARM: imx: busfreq: do not force high frequency during suspendStefan Agner
If the M4 core is running and in a low frequency mode, the A7 core should make sure that the AXI bus is left in a low frequency mode when entering suspend. So far the code unconditionally increased the high frequency variable which essentially forced the AXI bus to run in high frequency mode when entering suspend. With this change we leave the system in the state it was last in and also make sure that the last state change is actually applied before going to sleep. Typically high_bus_count ends up to be 0 because all devices requiring a high bus frequency release the bus during suspend, allowing the AXI bus to switch to 24MHz only. If the M4 is not running we don't want to artificially slow down the suspend process, hence let the bus run at full speed (it will get disabled anyway by hardware mechanism). Similar, when the M4 is running at high speed we likely need the bus capacity. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03ARM: imx: busfreq: initialize M4 frequency depending boot stateStefan Agner
Set low frequency state in case M4 start with 24MHz. This makes sure that Linux is aware of the M4 state and makes sure the bus frequency is not accidentally increased during suspend (bus_freq_pm_notify). Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03ARM: imx: busfreq: request bus frequency depending on M4 clockStefan Agner
Only request high bus frequency for Cortex-M4 if the Cortex-M4 is running in a high frequency mode. The Cortex-M4 clock is not directly connected with the bus frequency, however, we assume that when the M4 CPU is running at lower frequency a lower bus speed is sufficient too. The driver already has been doing this on i.MX 6SoloX, this change applies the same logic to i.MX 7. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03arm: dts: imx7: specify Cortex-M4 clockStefan Agner
The Cortex-M4 clock is used in the busfreq driver to determine whether a high bus frequency is required for the Cortex-M4 core. This follows the design used on i.MX 6SoloX. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03mmc: sdhci-esdhc-imx: make sure runtime PM is suspended in system suspendStefan Agner
Use force suspend/resume to trigger runtime PM when entering system suspend. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03mtd: gpmi: make sure runtime PM is suspended in system suspendStefan Agner
Use force suspend/resume to trigger runtime PM when entering system suspend. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03video: fbdev: mxsfb: make sure runtime PM is suspended in system suspendStefan Agner
Use force suspend/resume to trigger runtime PM when entering system suspend. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03net: fec: make sure runtime PM is suspended in system suspendStefan Agner
Use force suspend/resume to trigger runtime PM when entering system suspend. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03ARM: dts: imx7-colibri: use round numbersStefan Agner
Use round voltages as it is common in other device trees. Also fix wrong voltage of PWR_EN_+V3.3 rail. The error had no noticeable effect since no customer explicitly requested a specific voltage. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03ARM: dts: imx7-colibri: allow to disable Ethernet railStefan Agner
The regulator-always-on property on the Ethernet rail prevents Linux from disabling the rail when Ethernet is shut down (suspend or simply link down). With this change the regulator framework will disable the rail when the Ethernet PHY is not used, saving power especially on carrier board not using Ethernet. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03ARM: dts: imx7-colibri: add ENET sleep stateStefan Agner
Add sleep state for ENET pins to avoid pull-ups back-feeding the Ethernet rail through the PHY. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03ARM: dts: imx7-colibri: move USB power enable to carrier boardStefan Agner
The logic to enable USB power is part of the carrier board and might differ depending on the carrier board design. Introduce basic fixed regulators for power input and move the USB power enable regulator to the carrier board device tree. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03ARM: dts: imx7-colibri: improve power representationStefan Agner
Introduce module level input regulators to better reflect the real world power design. Also use correct rails for ADC/SGTL5000. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03imx_thermal.c: set trip point depending on temp gradeMax Krummenacher
Set the trip point temperature where a cooling device is set to maximized cooling was set statically to 85°C. For i.MX 6 set this dependend on the temperature grade of the device to 10°C below the maximum junction temperature. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03ARM: dts: apalis_imx6: make sure reset MOCI and eMMC get muxedStefan Agner
The two pinctrl settings for reset MOCI and eMMC reset do not get applied currently because pinctrl settings need to be in the top level of a device tree node. Move the settings to the respective device tree nodes. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-03imx: Expose SoC unique IDBhuvanchandra DV
Expose SoC unique ID read from OCOTP registers. Signed-off-by: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com> Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
2017-04-03drivers: soc: Add new sysfs attribute to expose SoC unique IDBhuvanchandra DV
Add new 'unique_id' sysfs attribute to expose SoC unique ID Signed-off-by: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com> Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
2017-04-03ARM: colibri_imx7_defconfig: enable BluetoothStefan Agner
Enable Bluetooth as a module by default. This allows to make use of USB/SDIO based Bluetooth solutions easier. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
2017-04-03ARM: dts: imx6qdl-apalis: Use enable-gpios for BL_ONBhuvanchandra DV
Use pwm-backlight driver 'enable-gpios' property for backlight on/off control. Signed-off-by: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com> Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
2017-04-03ARM: dts: imx6qdl-colibri: Use enable-gpios for BL_ONBhuvanchandra DV
Use pwm-backlight driver 'enable-gpios' property for backlight on/off control. Signed-off-by: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com> Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
2017-04-03ARM: dts: imx7-colibri: follow lpsr iomux pin name changeMax Krummenacher
Commit 5fd79049c122bd0f7bd906f676d3b8d65765a280 added _LPSR to all iomux pin names which are controlled by the lpsr iomux. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-03-24Merge remote-tracking branch 'fslc/4.1-2.0.x-imx' into toradex_4.1-2.0.x-imxMax Krummenacher
2017-03-17Merge tag 'v4.1.39' into 4.1-2.0.x-imxOtavio Salvador
Linux 4.1.39 * tag 'v4.1.39': (138 commits) Linux 4.1.39 KVM: x86: remove data variable from kvm_get_msr_common KVM: VMX: Fix host initiated access to guest MSR_TSC_AUX KVM: x86: pass host_initiated to functions that read MSRs perf/core: Fix the perf_cpu_time_max_percent check perf/core: Make sysctl_perf_cpu_time_max_percent conform to documentation perf/core: Fix implicitly enable dynamic interrupt throttle perf/core: Fix dynamic interrupt throttle Fix missing sanity check in /dev/sg printk: use rcuidle console tracepoint vfs: fix uninitialized flags in splice_to_pipe() drm/radeon: Use mode h/vdisplay fields to hide out of bounds HW cursor ARM: 8658/1: uaccess: fix zeroing of 64-bit get_user() drm/dp/mst: fix kernel oops when turning off secondary monitor [media] siano: make it work again with CONFIG_VMAP_STACK mmc: core: fix multi-bit bus width without high-speed mode futex: Move futex_init() to core_initcall xen-netfront: Delete rx_refill_timer in xennet_disconnect_backend() scsi: aacraid: Fix INTx/MSI-x issue with older controllers cpumask: use nr_cpumask_bits for parsing functions ... Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2017-03-13Linux 4.1.39Sasha Levin
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
2017-03-06KVM: x86: remove data variable from kvm_get_msr_commonNicolas Iooss
[ Upstream commit b0996ae48285364710bce812e70ce67771ea6ef7 ] Commit 609e36d372ad ("KVM: x86: pass host_initiated to functions that read MSRs") modified kvm_get_msr_common function to use msr_info->data instead of data but missed one occurrence. Replace it and remove the unused local variable. Fixes: 609e36d372ad ("KVM: x86: pass host_initiated to functions that read MSRs") Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
2017-03-06KVM: VMX: Fix host initiated access to guest MSR_TSC_AUXHaozhong Zhang
[ Upstream commit 81b1b9ca6d5ca5f3ce91c0095402def657cf5db3 ] The current handling of accesses to guest MSR_TSC_AUX returns error if vcpu does not support rdtscp, though those accesses are initiated by host. This can result in the reboot failure of some versions of QEMU. This patch fixes this issue by passing those host initiated accesses for further handling instead. Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
2017-03-06KVM: x86: pass host_initiated to functions that read MSRsPaolo Bonzini
[ Upstream commit 609e36d372ad9329269e4a1467bd35311893d1d6 ] SMBASE is only readable from SMM for the VCPU, but it must be always accessible if userspace is accessing it. Thus, all functions that read MSRs are changed to accept a struct msr_data; the host_initiated and index fields are pre-initialized, while the data field is filled on return. Reviewed-by: Radim Krčmář <rkrcmar@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
2017-03-06perf/core: Fix the perf_cpu_time_max_percent checkTan Xiaojun
Use "proc_dointvec_minmax" instead of "proc_dointvec" to check the input value from user-space. If not, we can set a big value and some vars will overflow like "sysctl_perf_event_sample_rate" which will cause a lot of unexpected problems. Signed-off-by: Tan Xiaojun <tanxiaojun@huawei.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: <acme@kernel.org> Cc: <alexander.shishkin@linux.intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vince Weaver <vincent.weaver@maine.edu> Link: http://lkml.kernel.org/r/1487829879-56237-1-git-send-email-tanxiaojun@huawei.com Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
2017-03-06perf/core: Make sysctl_perf_cpu_time_max_percent conform to documentationPeter Zijlstra
Markus reported that 0 should also disable the throttling we per Documentation/sysctl/kernel.txt. Reported-by: Markus Trippelsdorf <markus@trippelsdorf.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vince Weaver <vincent.weaver@maine.edu> Fixes: 91a612eea9a3 ("perf/core: Fix dynamic interrupt throttle") Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Tan Xiaojun <tanxiaojun@huawei.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
2017-03-06perf/core: Fix implicitly enable dynamic interrupt throttleKan Liang
This patch fixes an issue which was introduced by commit: 91a612eea9a3 ("perf/core: Fix dynamic interrupt throttle") ... which commit unconditionally sets the perf_sample_allowed_ns value to !0. But that could trigger a bug in the following corner case: The user can disable the dynamic interrupt throttle mechanism by setting perf_cpu_time_max_percent to 0. Then they change perf_event_max_sample_rate. For this case, the mechanism will be enabled implicitly, because perf_sample_allowed_ns becomes !0 - which is not what we want. This patch only updates perf_sample_allowed_ns when the dynamic interrupt throttle mechanism is enabled. Signed-off-by: Kan Liang <kan.liang@intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vince Weaver <vincent.weaver@maine.edu> Cc: acme@kernel.org Link: http://lkml.kernel.org/r/1462260366-3160-1-git-send-email-kan.liang@intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Tan Xiaojun <tanxiaojun@huawei.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
2017-03-06perf/core: Fix dynamic interrupt throttlePeter Zijlstra
There were two problems with the dynamic interrupt throttle mechanism, both triggered by the same action. When you (or perf_fuzzer) write a huge value into /proc/sys/kernel/perf_event_max_sample_rate the computed perf_sample_allowed_ns becomes 0. This effectively disables the whole dynamic throttle. This is fixed by ensuring update_perf_cpu_limits() never sets the value to 0. However, we allow disabling of the dynamic throttle by writing 100 to /proc/sys/kernel/perf_cpu_time_max_percent. This will generate a warning in dmesg. The second problem is that by setting the max_sample_rate to a huge number, the adaptive process can take a few tries, since it halfs the limit each time. Change that to directly compute a new value based on the observed duration. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: David Ahern <dsahern@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vince Weaver <vincent.weaver@maine.edu> Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Tan Xiaojun <tanxiaojun@huawei.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
2017-03-06Fix missing sanity check in /dev/sgAl Viro
[ Upstream commit 137d01df511b3afe1f05499aea05f3bafc0fb221 ] What happens is that a write to /dev/sg is given a request with non-zero ->iovec_count combined with zero ->dxfer_len. Or with ->dxferp pointing to an array full of empty iovecs. Having write permission to /dev/sg shouldn't be equivalent to the ability to trigger BUG_ON() while holding spinlocks... Found by Dmitry Vyukov and syzkaller. [ The BUG_ON() got changed to a WARN_ON_ONCE(), but this fixes the underlying issue. - Linus ] Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Reported-by: Dmitry Vyukov <dvyukov@google.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: stable@vger.kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>