3.15.6-stable review
Greg Kroah-Hartman
maintainercover 3.15.6-stable review
This is the start of the stable review cycle for the 3.15.6 release. There are 84 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Jul 17 23:17:00 UTC 2014. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.15.6-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.15.6-rc1
Lan Tianyu <[email protected]>
ACPI / battery: Retry to get battery information if failed during probing
Roland Dreier <[email protected]>
x86, ioremap: Speed up check for RAM pages
H. Peter Anvin <[email protected]>
x86, espfix: Make it possible to disable 16-bit support
H. Peter Anvin <[email protected]>
x86, espfix: Make espfix64 a Kconfig option, fix UML
H. Peter Anvin <[email protected]>
x86, espfix: Fix broken header guard
H. Peter Anvin <[email protected]>
x86, espfix: Move espfix definitions into a separate header file
H. Peter Anvin <[email protected]>
x86-64, espfix: Don't leak bits 31:16 of %esp returning to 16-bit stack
H. Peter Anvin <[email protected]>
Revert "x86-64, modify_ldt: Make support for 16-bit segments a runtime option"
Guenter Roeck <[email protected]>
powerpc: Disable RELOCATABLE for COMPILE_TEST with PPC64
Chen Gang <[email protected]>
drivers/rtc/rtc-puv3.c: use dev_dbg() instead of dev_debug() for typo issue
Chen Gang <[email protected]>
drivers/rtc/rtc-puv3.c: remove "&dev->" for typo issue
Jaegeuk Kim <[email protected]>
f2fs: check bdi->dirty_exceeded when trying to skip data writes
Jaegeuk Kim <[email protected]>
f2fs: adjust free mem size to flush dentry blocks
Li Zefan <[email protected]>
cgroup: fix a race between cgroup_mount() and cgroup_kill_sb()
Li Zefan <[email protected]>
kernfs: introduce kernfs_pin_sb()
Tejun Heo <[email protected]>
kernfs: implement kernfs_root->supers list
Li Zefan <[email protected]>
cgroup: fix mount failure in a corner case
Ted Juan <[email protected]>
mtd: nand: omap: fix omap_calculate_ecc_bch() for-loop error
Jean Sacren <[email protected]>
i40e: fix passing wrong error code to i40e_open()
Steven Rostedt (Red Hat) <[email protected]>
ring-buffer: Check if buffer exists before polling
Joonsoo Kim <[email protected]>
DMA, CMA: fix possible memory leak
Ville Syrjälä <[email protected]>
drm/i915: Don't clobber the GTT when it's within stolen memory
Scot Doyle <[email protected]>
drm/i915: Toshiba CB35 has a controllable backlight
Scot Doyle <[email protected]>
drm/i915: Acer C720 and C720P have controllable backlights
Scot Doyle <[email protected]>
drm/i915: quirk asserts controllable backlight presence, overriding VBT
Christian König <[email protected]>
drm/radeon: stop poisoning the GART TLB
Christian König <[email protected]>
drm/radeon: page table BOs are kernel allocations
Alex Deucher <[email protected]>
drm/radeon: fix typo in golden register setup on evergreen
Alex Deucher <[email protected]>
drm/radeon: fix typo in ci_stop_dpm()
Alexandre Demers <[email protected]>
drm/radeon/dpm: Reenabling SS on Cayman
Theodore Ts'o <[email protected]>
ext4: fix a potential deadlock in __ext4_es_shrink()
Theodore Ts'o <[email protected]>
ext4: revert commit which was causing fs corruption after journal replays
Eric Sandeen <[email protected]>
ext4: disable synchronous transaction batching if max_batch_time==0
Theodore Ts'o <[email protected]>
ext4: clarify ext4_error message in ext4_mb_generate_buddy_error()
Theodore Ts'o <[email protected]>
ext4: clarify error count warning messages
Theodore Ts'o <[email protected]>
ext4: fix unjournalled bg descriptor while initializing inode bitmap
Alex Williamson <[email protected]>
PCI: Fix unaligned access in AF transaction pending test
Vincent Minet <[email protected]>
intel_pstate: Set CPU number before accessing MSRs
Dirk Brandewie <[email protected]>
intel_pstate: Update documentation of {max,min}_perf_pct sysfs files
Dirk Brandewie <[email protected]>
intel_pstate: don't touch turbo bit if turbo disabled or unavailable.
Dirk Brandewie <[email protected]>
intel_pstate: Fix setting VID
Mikulas Patocka <[email protected]>
dm: allocate a special workqueue for deferred device removal
Joe Thornber <[email protected]>
dm io: fix a race condition in the wake up code for sync_io
Jun'ichi Nomura <[email protected]>
dm mpath: fix IO hang due to logic bug in multipath_busy
K. Y. Srinivasan <[email protected]>
Drivers: hv: vmbus: Fix a bug in the channel callback dispatch code
Stephen Boyd <[email protected]>
clk: qcom: HDMI source sel is 3 not 2
Krzysztof Kozlowski <[email protected]>
clk: s2mps11: Fix double free corruption during driver unbind
Thomas Gleixner <[email protected]>
clk: spear3xx: Use proper control register offset
Roger Quadros <[email protected]>
phy: core: Fix error path in phy_create()
Colin Cross <[email protected]>
arm64: implement TASK_SIZE_OF
Cristian Stoica <[email protected]>
crypto: caam - fix memleak in caam_jr module
Jussi Kivilinna <[email protected]>
crypto: sha512_ssse3 - fix byte count to bit count conversion
Prabhakar Lad <[email protected]>
cpufreq: Makefile: fix compilation for davinci platform
Joel Stanley <[email protected]>
powerpc/perf: Clear MMCR2 when enabling PMU
Joel Stanley <[email protected]>
powerpc/perf: Add PPMU_ARCH_207S define
Anton Blanchard <[email protected]>
powerpc/perf: Never program book3s PMCs with values >= 0x80000000
Joel Stanley <[email protected]>
powerpc/kvm: Remove redundant save of SIER AND MMCR2
Lv Zheng <[email protected]>
ACPI / EC: Fix race condition in ec_transaction_completed()
Lv Zheng <[email protected]>
ACPI / EC: Remove duplicated ec_wait_ibf0() waiter
Lv Zheng <[email protected]>
ACPI / EC: Add asynchronous command byte write support
Lv Zheng <[email protected]>
ACPI / EC: Avoid race condition related to advance_transaction()
Andy Whitcroft <[email protected]>
ACPI / resources: only reject zero length resources based at address zero
Lan Tianyu <[email protected]>
Revert "ACPI / AC: Remove AC's proc directory."
Axel Lin <[email protected]>
hwmon: (adm1021) Fix cache problem when writing temperature limits
Axel Lin <[email protected]>
hwmon: (adm1029) Ensure the fan_div cache is updated in set_fan_div
Guenter Roeck <[email protected]>
hwmon: (adm1031) Fix writes to limit registers
Guenter Roeck <[email protected]>
hwmon: (emc2103) Clamp limits instead of bailing out
Axel Lin <[email protected]>
hwmon: (amc6821) Fix permissions for temp2_input
Guenter Roeck <[email protected]>
hwmon: (adc128d818) Drop write support on inX_input attributes
Aaron Lu <[email protected]>
thermal: hwmon: Make the check for critical temp valid consistent
Peter Hurley <[email protected]>
serial: imx: Fix build breakage
Guenter Roeck <[email protected]>
i8k: Fix non-SMP operation
Shawn Guo <[email protected]>
ahci: imx: manage only sata_ref_clk in imx_sata_enable[disable]
Yasuaki Ishimatsu <[email protected]>
workqueue: zero cpumask of wq_numa_possible_cpumask on init
Gu Zheng <[email protected]>
cpuset,mempolicy: fix sleeping function called from invalid context
Maxime Bizon <[email protected]>
workqueue: fix dev_set_uevent_suppress() imbalance
Helge Deller <[email protected]>
parisc: fix fanotify_mark() syscall on 32bit compat kernel
Helge Deller <[email protected]>
parisc: add serial ports of C8000/1GHz machine to hardware database
Peter Hurley <[email protected]>
serial: Test for no tx data on tx restart
Jan Kardell <[email protected]>
iio: ti_am335x_adc: Fix: Use same step id at FIFOs both ends
Michal Sojka <[email protected]>
USB: serial: ftdi_sio: Add Infineon Triboard
Bert Vermeulen <[email protected]>
USB: ftdi_sio: Add extra PID.
Andras Kovacs <[email protected]>
USB: cp210x: add support for Corsair usb dongle
Bernd Wachter <[email protected]>
usb: option: Add ID for Telewell TW-LTE 4G v2
-------------
Diffstat:
Documentation/cpu-freq/intel-pstate.txt | 7 +- Documentation/x86/x86_64/mm.txt | 2 + Makefile | 4 +- arch/arm64/include/asm/memory.h | 2 + arch/parisc/kernel/hardware.c | 3 +- arch/parisc/kernel/sys_parisc32.c | 10 ++ arch/parisc/kernel/syscall_table.S | 2 +- arch/powerpc/Kconfig | 3 +- arch/powerpc/include/asm/perf_event_server.h | 3 +- arch/powerpc/kvm/book3s_hv_interrupts.S | 5 - arch/powerpc/perf/core-book3s.c | 26 +++- arch/powerpc/perf/power8-pmu.c | 2 +- arch/x86/Kconfig | 25 +++- arch/x86/crypto/sha512_ssse3_glue.c | 2 +- arch/x86/include/asm/espfix.h | 16 ++ arch/x86/include/asm/pgtable_64_types.h | 2 + arch/x86/include/asm/setup.h | 2 + arch/x86/kernel/Makefile | 1 + arch/x86/kernel/entry_32.S | 12 ++ arch/x86/kernel/entry_64.S | 81 ++++++++++- arch/x86/kernel/espfix_64.c | 209 +++++++++++++++++++++++++++ arch/x86/kernel/ldt.c | 10 +- arch/x86/kernel/smpboot.c | 7 + arch/x86/mm/dump_pagetables.c | 44 ++++-- arch/x86/mm/ioremap.c | 26 +++- arch/x86/vdso/vdso32-setup.c | 8 - drivers/acpi/ac.c | 130 ++++++++++++++++- drivers/acpi/battery.c | 27 +++- drivers/acpi/ec.c | 128 ++++++++-------- drivers/acpi/resource.c | 10 +- drivers/ata/ahci_imx.c | 35 ++++- drivers/base/dma-contiguous.c | 12 +- drivers/char/i8k.c | 4 +- drivers/clk/clk-s2mps11.c | 7 +- drivers/clk/qcom/mmcc-msm8960.c | 2 +- drivers/clk/spear/spear3xx_clock.c | 2 +- drivers/cpufreq/Makefile | 2 +- drivers/cpufreq/intel_pstate.c | 35 +++-- drivers/crypto/caam/jr.c | 8 +- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_gem_stolen.c | 44 ++++++ drivers/gpu/drm/i915/i915_reg.h | 3 + drivers/gpu/drm/i915/intel_display.c | 14 ++ drivers/gpu/drm/i915/intel_panel.c | 8 +- drivers/gpu/drm/radeon/ci_dpm.c | 2 +- drivers/gpu/drm/radeon/evergreen.c | 8 +- drivers/gpu/drm/radeon/radeon_vm.c | 4 +- drivers/gpu/drm/radeon/rs600.c | 6 +- drivers/gpu/drm/radeon/rv770_dpm.c | 6 - drivers/hv/connection.c | 8 +- drivers/hwmon/adc128d818.c | 28 ++-- drivers/hwmon/adm1021.c | 14 +- drivers/hwmon/adm1029.c | 3 + drivers/hwmon/adm1031.c | 8 +- drivers/hwmon/amc6821.c | 2 +- drivers/hwmon/emc2103.c | 15 +- drivers/iio/adc/ti_am335x_adc.c | 2 +- drivers/md/dm-io.c | 22 +-- drivers/md/dm-mpath.c | 5 +- drivers/md/dm.c | 15 +- drivers/mtd/nand/omap2.c | 10 +- drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +- drivers/pci/pci.c | 9 +- drivers/phy/phy-core.c | 7 +- drivers/rtc/rtc-puv3.c | 4 +- drivers/thermal/thermal_hwmon.c | 33 +++-- drivers/tty/serial/imx.c | 3 + drivers/tty/serial/ip22zilog.c | 2 + drivers/tty/serial/m32r_sio.c | 8 +- drivers/tty/serial/pmac_zilog.c | 3 + drivers/tty/serial/sunsab.c | 3 + drivers/tty/serial/sunzilog.c | 2 + drivers/usb/serial/cp210x.c | 1 + drivers/usb/serial/ftdi_sio.c | 5 +- drivers/usb/serial/ftdi_sio_ids.h | 9 +- drivers/usb/serial/option.c | 2 + fs/ext4/extents_status.c | 4 +- fs/ext4/ialloc.c | 14 +- fs/ext4/mballoc.c | 4 +- fs/ext4/super.c | 60 ++++---- fs/f2fs/data.c | 3 +- fs/f2fs/f2fs.h | 1 + fs/f2fs/node.c | 46 +++--- fs/f2fs/node.h | 5 +- fs/jbd2/transaction.c | 5 +- fs/kernfs/dir.c | 1 + fs/kernfs/kernfs-internal.h | 5 + fs/kernfs/mount.c | 41 ++++++ include/linux/kernfs.h | 5 + include/linux/ring_buffer.h | 2 +- init/main.c | 4 + kernel/cgroup.c | 53 ++++++- kernel/cpuset.c | 8 +- kernel/trace/ring_buffer.c | 5 +- kernel/trace/trace.c | 25 +++- kernel/trace/trace.h | 4 +- kernel/workqueue.c | 3 +- mm/mempolicy.c | 2 - 98 files changed, 1180 insertions(+), 357 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/84 usb: option: Add ID for Telewell TW-LTE 4G v2
3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bernd Wachter <[email protected]>
commit 3d28bd840b2d3981cd28caf5fe1df38f1344dd60 upstream.
Add ID of the Telewell 4G v2 hardware to option driver to get legacy serial interface working
--- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/option.c +2 -0
@@ -1487,6 +1487,8 @@ static const struct usb_device_id option .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1426, 0xff, 0xff, 0xff), /* ZTE MF91 */ .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1428, 0xff, 0xff, 0xff), /* Telewell TW-LTE 4G v2 */ + .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1533, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1534, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1535, 0xff, 0xff, 0xff) },
Greg Kroah-Hartman
maintainerPATCH 2/84 USB: cp210x: add support for Corsair usb dongle
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andras Kovacs <[email protected]>
commit b9326057a3d8447f5d2e74a7b521ccf21add2ec0 upstream.
Corsair USB Dongles are shipped with Corsair AXi series PSUs. These are cp210x serial usb devices, so make driver detect these. I have a program, that can get information from these PSUs.
Tested with 2 different dongles shipped with Corsair AX860i and AX1200i units.
--- drivers/usb/serial/cp210x.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/cp210x.c +1 -0
@@ -153,6 +153,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ + { USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */ { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */ { USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */
Greg Kroah-Hartman
maintainerPATCH 3/84 USB: ftdi_sio: Add extra PID.
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bert Vermeulen <[email protected]>
commit 5a7fbe7e9ea0b1b9d7ffdba64db1faa3a259164c upstream.
This patch adds PID 0x0003 to the VID 0x128d (Testo). At least the Testo 435-4 uses this, likely other gear as well.
--- drivers/usb/serial/ftdi_sio.c | 3 ++- drivers/usb/serial/ftdi_sio_ids.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/usb/serial/ftdi_sio.c +2 -1
@@ -720,7 +720,8 @@ static const struct usb_device_id id_tab { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) }, - { USB_DEVICE(TESTO_VID, TESTO_USB_INTERFACE_PID) }, + { USB_DEVICE(TESTO_VID, TESTO_1_PID) }, + { USB_DEVICE(TESTO_VID, TESTO_3_PID) }, { USB_DEVICE(FTDI_VID, FTDI_GAMMA_SCOUT_PID) }, { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13M_PID) }, { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13S_PID) },
drivers/usb/serial/ftdi_sio_ids.h +2 -1
@@ -798,7 +798,8 @@* Submitted by Colin Leroy */ #define TESTO_VID 0x128D -#define TESTO_USB_INTERFACE_PID 0x0001 +#define TESTO_1_PID 0x0001 +#define TESTO_3_PID 0x0003/* * Mobility Electronics products.
Greg Kroah-Hartman
maintainerPATCH 4/84 USB: serial: ftdi_sio: Add Infineon Triboard
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Sojka <[email protected]>
commit d8279a40e50ad55539780aa617a32a53d7f0953e upstream.
This adds support for Infineon TriBoard TC1798 [1]. Only interface 1 is used as serial line (see [2], Figure 8-6).
[1] http://www.infineon.com/cms/de/product/microcontroller/development-tools-software-and-kits/tricore-tm-development-tools-software-and-kits/starterkits-and-evaluation-boards/starter-kit-tc1798/channel.html?channel=db3a304333b8a7ca0133cfa3d73e4268
[2] http://www.infineon.com/dgdl/TriBoardManual-TC1798-V10.pdf?folderId=db3a304412b407950112b409ae7c0343&fileId=db3a304333b8a7ca0133cfae99fe426a
--- drivers/usb/serial/ftdi_sio.c | 2 ++ drivers/usb/serial/ftdi_sio_ids.h | 6 ++++++ 2 files changed, 8 insertions(+)
drivers/usb/serial/ftdi_sio.c +2 -0
@@ -945,6 +945,8 @@ static const struct usb_device_id id_tab { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_2_PID) }, { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_3_PID) }, { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_4_PID) }, +/* Infineon Devices */ + { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) }, { } /* Terminating entry */ };
drivers/usb/serial/ftdi_sio_ids.h +6 -0
@@ -584,6 +584,12 @@#define RATOC_PRODUCT_ID_USB60F 0xb020/* +* Infineon Technologies +*/ +#define INFINEON_VID 0x058b +#define INFINEON_TRIBOARD_PID 0x0028/* DAS JTAG TriBoard TC1798 V1.0 */ + +/* * Acton Research Corp. */ #define ACTON_VID 0x0647/* Vendor ID */
Greg Kroah-Hartman
maintainerPATCH 5/84 iio: ti_am335x_adc: Fix: Use same step id at FIFOs both ends
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kardell <[email protected]>
commit baa3c65298c089a9014b4e523a14ec2885cca1bc upstream.
Since AI lines could be selected at will (linux-3.11) the sending and receiving ends of the FIFO does not agree about what step is used for a line. It only works if the last lines are used, like 5,6,7, and fails if ie 2,4,6 is selected in DT.
--- drivers/iio/adc/ti_am335x_adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ti_am335x_adc.c +1 -1
@@ -374,7 +374,7 @@ static int tiadc_read_raw(struct iio_devreturn -EAGAIN ; } } - map_val = chan->channel +TOTAL_CHANNELS ; + map_val = adc_dev->channel_step[chan->scan_index];/* * We check the complete FIFO. We programmed just one entry but in case
Greg Kroah-Hartman
maintainerPATCH 6/84 serial: Test for no tx data on tx restart
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Hurley <[email protected]>
commit c557d392fbf5badd693ea1946a4317c87a26a716 upstream.
Commit 717f3bbab3c7628736ef738fdbf3d9a28578c26c, 'serial_core: Fix conditional start_tx on ring buffer not empty' exposes an incorrect assumption in several drivers' start_tx methods; the tx ring buffer can, in fact, be empty when restarting tx while performing flow control.
Affected drivers:sunsab.cip22zilog.cpmac_zilog.csunzilog.cm32r_sio.cimx.c
Other in-tree serial drivers either are not affected or already test for empty tx ring buffer before transmitting.
Test for empty tx ring buffer in start_tx() method, after transmitting x_char (if applicable).
--- drivers/tty/serial/imx.c | 3 +++ drivers/tty/serial/ip22zilog.c | 2 ++ drivers/tty/serial/m32r_sio.c | 8 +++++--- drivers/tty/serial/pmac_zilog.c | 3 +++ drivers/tty/serial/sunsab.c | 3 +++ drivers/tty/serial/sunzilog.c | 2 ++ 6 files changed, 18 insertions(+), 3 deletions(-)
drivers/tty/serial/imx.c +3 -0
@@ -563,6 +563,9 @@ static void imx_start_tx(struct uart_porstruct imx_port *sport = (struct imx_port *)port;unsigned long temp; +if (uart_circ_empty (&port.state->xmit)) +return ; +if (USE_IRDA (sport)) {/* half duplex in IrDA mode; have to disable receive mode */ temp =readl (sport->port.membase +UCR4 );
drivers/tty/serial/ip22zilog.c +2 -0
@@ -603,6 +603,8 @@ static void ip22zilog_start_tx(struct ua }else {struct circ_buf *xmit = &port->state->xmit; +if (uart_circ_empty (xmit)) +return ;writeb (xmit->buf[xmit->tail], &channel->data);ZSDELAY ();ZS_WSYNC (channel);
drivers/tty/serial/m32r_sio.c +5 -3
@@ -266,9 +266,11 @@ static void m32r_sio_start_tx(struct uarif (!(up->ier &UART_IER_THRI )) { up->ier |=UART_IER_THRI ;serial_out (up,UART_IER , up->ier); -serial_out (up,UART_TX , xmit->buf[xmit->tail]); - xmit->tail = (xmit->tail +1 ) & (UART_XMIT_SIZE -1 ); - up->port.icount.tx++; +if (!uart_circ_empty (xmit)) { +serial_out (up,UART_TX , xmit->buf[xmit->tail]); + xmit->tail = (xmit->tail +1 ) & (UART_XMIT_SIZE -1 ); + up->port.icount.tx++; + } }while ((serial_in (up,UART_LSR ) &UART_EMPTY ) !=UART_EMPTY );#else
drivers/tty/serial/pmac_zilog.c +3 -0
@@ -653,6 +653,8 @@ static void pmz_start_tx(struct uart_por }else {struct circ_buf *xmit = &port->state->xmit; +if (uart_circ_empty (xmit)) + goto out;write_zsdata (uap, xmit->buf[xmit->tail]);zssync (uap); xmit->tail = (xmit->tail +1 ) & (UART_XMIT_SIZE -1 );
@@ -661,6 +663,7 @@ static void pmz_start_tx(struct uart_porif (uart_circ_chars_pending (xmit) <WAKEUP_CHARS )uart_write_wakeup (&uap->port); } + out:pmz_debug ("pmz: start_tx() done.\n" ); }
drivers/tty/serial/sunsab.c +3 -0
@@ -427,6 +427,9 @@ static void sunsab_start_tx(struct uart_struct circ_buf *xmit = &up->port.state->xmit;int i; +if (uart_circ_empty (xmit)) +return ; + up->interrupt_mask1 &= ~(SAB82532_IMR1_ALLS |SAB82532_IMR1_XPR );writeb (up->interrupt_mask1, &up->regs->w.imr1);
drivers/tty/serial/sunzilog.c +2 -0
@@ -703,6 +703,8 @@ static void sunzilog_start_tx(struct uar }else {struct circ_buf *xmit = &port->state->xmit; +if (uart_circ_empty (xmit)) +return ;writeb (xmit->buf[xmit->tail], &channel->data);ZSDELAY ();ZS_WSYNC (channel);
Greg Kroah-Hartman
maintainerPATCH 7/84 parisc: add serial ports of C8000/1GHz machine to hardware database
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit eadcc7208a2237016be7bdff4551ba7614da85c8 upstream.
--- arch/parisc/kernel/hardware.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/parisc/kernel/hardware.c +2 -1
@@ -1210,7 +1210,8 @@ static struct hp_hardware hp_hardware_li {HPHW_FIO, 0x004, 0x00320, 0x0, "Metheus Frame Buffer"}, {HPHW_FIO, 0x004, 0x00340, 0x0, "BARCO CX4500 VME Grphx Cnsl"}, {HPHW_FIO, 0x004, 0x00360, 0x0, "Hughes TOG VME FDDI"}, - {HPHW_FIO, 0x076, 0x000AD, 0x00, "Crestone Peak RS-232"}, + {HPHW_FIO, 0x076, 0x000AD, 0x0, "Crestone Peak Core RS-232"}, + {HPHW_FIO, 0x077, 0x000AD, 0x0, "Crestone Peak Fast? Core RS-232"}, {HPHW_IOA, 0x185, 0x0000B, 0x00, "Java BC Summit Port"}, {HPHW_IOA, 0x1FF, 0x0000B, 0x00, "Hitachi Ghostview Summit Port"}, {HPHW_IOA, 0x580, 0x0000B, 0x10, "U2-IOA BC Runway Port"},
Greg Kroah-Hartman
maintainerPATCH 8/84 parisc: fix fanotify_mark() syscall on 32bit compat kernel
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit ab8a261ba5e2dd9206da640de5870cc31d568a7c upstream.
On parisc we can not use the existing compat implementation for fanotify_mark() because for the 64bit mask parameter the higher and lower 32bits are ordered differently than what the compat function expects from big endian architectures.
Specifically:
It finally turned out, that on hppa we end up with different assignments of parameters to kernel arguments depending on if we call the glibc wrapper function
int fanotify_mark (int __fanotify_fd, unsigned int __flags,
uint64_t __mask, int __dfd, const char *__pathname);
or directly calling the syscall manually
syscall(__NR_fanotify_mark, ...)
Reason is, that the syscall() function is implemented as C-function and because we now have the sysno as first parameter in front of the other parameters the compiler will unexpectedly add an empty paramenter in front of the u64 value to ensure the correct calling alignment for 64bit values.
This means, on hppa you can't simply use syscall() to call the kernel fanotify_mark() function directly, but you have to use the glibc function instead.
This patch fixes the kernel in the hppa-arch specifc coding to adjust the parameters in a way as if userspace calls the glibc wrapper function fanotify_mark().
--- arch/parisc/kernel/sys_parisc32.c | 10 ++++++++++ arch/parisc/kernel/syscall_table.S | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-)
arch/parisc/kernel/sys_parisc32.c +10 -0
@@ -4,6 +4,7 @@* Copyright (C) 2000-2001 Hewlett Packard Company * Copyright (C) 2000 John Marvin * Copyright (C) 2001 Matthew Wilcox +* Copyright (C) 2014 Helge Deller <[email protected]> * * These routines maintain argument size conversion between 32bit and 64bit * environment. Based heavily on sys_ia32.c and sys_sparc32.c.
@@ -57,3 +58,12 @@ asmlinkage long sys32_unimplemented(int current->comm, current->pid, r20);return -ENOSYS ; } + +asmlinkage long sys32_fanotify_mark (compat_int_t fanotify_fd,compat_uint_t flags, +compat_uint_t mask0,compat_uint_t mask1,compat_int_t dfd, +const char __user * pathname) +{ +return sys_fanotify_mark (fanotify_fd, flags, + ((__u64 )mask1 <<32 ) | mask0, + dfd, pathname); +}
arch/parisc/kernel/syscall_table.S +1 -1
@@ -418,7 +418,7 @@ ENTRY_SAME(accept4) /* 320 */ ENTRY_SAME(prlimit64) ENTRY_SAME(fanotify_init) - ENTRY_COMP(fanotify_mark) + ENTRY_DIFF(fanotify_mark) ENTRY_COMP(clock_adjtime) ENTRY_SAME(name_to_handle_at) /* 325 */ ENTRY_COMP(open_by_handle_at)
Greg Kroah-Hartman
maintainerPATCH 9/84 workqueue: fix dev_set_uevent_suppress() imbalance
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Bizon <[email protected]>
commit bddbceb688c6d0decaabc7884fede319d02f96c8 upstream.
Uevents are suppressed during attributes registration, but never restored, so kobject_uevent() does nothing.
--- kernel/workqueue.c | 1 + 1 file changed, 1 insertion(+)
kernel/workqueue.c +1 -0
@@ -3422,6 +3422,7 @@ int workqueue_sysfs_register(struct work } } +dev_set_uevent_suppress (&wq_dev->dev, false);kobject_uevent (&wq_dev->dev.kobj,KOBJ_ADD );return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 10/84 cpuset,mempolicy: fix sleeping function called from invalid context
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gu Zheng <[email protected]>
commit 391acf970d21219a2a5446282d3b20eace0c0d7a upstream.
When runing with the kernel(3.15-rc7+), the follow bug occurs:
[ 9969.258987] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:586 [ 9969.359906] in_atomic(): 1, irqs_disabled(): 0, pid: 160655, name: python [ 9969.441175] INFO: lockdep is turned off. [ 9969.488184] CPU: 26 PID: 160655 Comm: python Tainted: G A 3.15.0-rc7+ #85 [ 9969.581032] Hardware name: FUJITSU-SV PRIMEQUEST 1800E/SB, BIOS PRIMEQUEST 1000 Series BIOS Version 1.39 11/16/2012 [ 9969.706052] ffffffff81a20e60 ffff8803e941fbd0 ffffffff8162f523 ffff8803e941fd18 [ 9969.795323] ffff8803e941fbe0 ffffffff8109995a ffff8803e941fc58 ffffffff81633e6c [ 9969.884710] ffffffff811ba5dc ffff880405c6b480 ffff88041fdd90a0 0000000000002000 [ 9969.974071] Call Trace: [ 9970.003403] [<ffffffff8162f523>] dump_stack+0x4d/0x66 [ 9970.065074] [<ffffffff8109995a>] __might_sleep+0xfa/0x130 [ 9970.130743] [<ffffffff81633e6c>] mutex_lock_nested+0x3c/0x4f0 [ 9970.200638] [<ffffffff811ba5dc>] ? kmem_cache_alloc+0x1bc/0x210 [ 9970.272610] [<ffffffff81105807>] cpuset_mems_allowed+0x27/0x140 [ 9970.344584] [<ffffffff811b1303>] ? __mpol_dup+0x63/0x150 [ 9970.409282] [<ffffffff811b1385>] __mpol_dup+0xe5/0x150 [ 9970.471897] [<ffffffff811b1303>] ? __mpol_dup+0x63/0x150 [ 9970.536585] [<ffffffff81068c86>] ? copy_process.part.23+0x606/0x1d40 [ 9970.613763] [<ffffffff810bf28d>] ? trace_hardirqs_on+0xd/0x10 [ 9970.683660] [<ffffffff810ddddf>] ? monotonic_to_bootbased+0x2f/0x50 [ 9970.759795] [<ffffffff81068cf0>] copy_process.part.23+0x670/0x1d40 [ 9970.834885] [<ffffffff8106a598>] do_fork+0xd8/0x380 [ 9970.894375] [<ffffffff81110e4c>] ? __audit_syscall_entry+0x9c/0xf0 [ 9970.969470] [<ffffffff8106a8c6>] SyS_clone+0x16/0x20 [ 9971.030011] [<ffffffff81642009>] stub_clone+0x69/0x90 [ 9971.091573] [<ffffffff81641c29>] ? system_call_fastpath+0x16/0x1b
The cause is that cpuset_mems_allowed() try to take mutex_lock(&callback_mutex) under the rcu_read_lock(which was hold in __mpol_dup()). And in cpuset_mems_allowed(), the access to cpuset is under rcu_read_lock, so in __mpol_dup, we can reduce the rcu_read_lock protection region to protect the access to cpuset only in current_cpuset_is_being_rebound(). So that we can avoid this bug.
This patch is a temporary solution that just addresses the bug mentioned above, can not fix the long-standing issue about cpuset.mems rebinding on fork():
"When the forker's task_struct is duplicated (which includes
->mems_allowed) and it races with an update to cpuset_being_rebound in update_tasks_nodemask() then the task's mems_allowed doesn't get updated. And the child task's mems_allowed can be wrong if the cpuset's nodemask changes before the child has been added to the cgroup's tasklist."
--- kernel/cpuset.c | 8 +++++++- mm/mempolicy.c | 2 -- 2 files changed, 7 insertions(+), 3 deletions(-)
kernel/cpuset.c +7 -1
@@ -1188,7 +1188,13 @@ done:int current_cpuset_is_being_rebound (void ) { -return task_cs (current) == cpuset_being_rebound; +int ret; + +rcu_read_lock (); + ret =task_cs (current) == cpuset_being_rebound; +rcu_read_unlock (); + +return ret; }static int update_relax_domain_level (struct cpuset *cs,s64 val)
mm/mempolicy.c +0 -2
@@ -2136,7 +2136,6 @@ struct mempolicy *__mpol_dup(struct memp }else *new = *old; -rcu_read_lock ();if (current_cpuset_is_being_rebound ()) {nodemask_t mems =cpuset_mems_allowed (current);if (new->flags &MPOL_F_REBINDING )
@@ -2144,7 +2143,6 @@ struct mempolicy *__mpol_dup(struct mempelse mpol_rebind_policy (new, &mems,MPOL_REBIND_ONCE ); } -rcu_read_unlock ();atomic_set (&new->refcnt,1 );return new; }
Greg Kroah-Hartman
maintainerPATCH 11/84 workqueue: zero cpumask of wq_numa_possible_cpumask on init
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yasuaki Ishimatsu <[email protected]>
commit 5a6024f1604eef119cf3a6fa413fe0261a81a8f3 upstream.
When hot-adding and onlining CPU, kernel panic occurs, showing following call trace.
BUG: unable to handle kernel paging request at 0000000000001d08 IP: [<ffffffff8114acfd>] __alloc_pages_nodemask+0x9d/0xb10 PGD 0 Oops: 0000 [#1] SMP ... Call Trace: [<ffffffff812b8745>] ? cpumask_next_and+0x35/0x50 [<ffffffff810a3283>] ? find_busiest_group+0x113/0x8f0 [<ffffffff81193bc9>] ? deactivate_slab+0x349/0x3c0 [<ffffffff811926f1>] new_slab+0x91/0x300 [<ffffffff815de95a>] __slab_alloc+0x2bb/0x482 [<ffffffff8105bc1c>] ? copy_process.part.25+0xfc/0x14c0 [<ffffffff810a3c78>] ? load_balance+0x218/0x890 [<ffffffff8101a679>] ? sched_clock+0x9/0x10 [<ffffffff81105ba9>] ? trace_clock_local+0x9/0x10 [<ffffffff81193d1c>] kmem_cache_alloc_node+0x8c/0x200 [<ffffffff8105bc1c>] copy_process.part.25+0xfc/0x14c0 [<ffffffff81114d0d>] ? trace_buffer_unlock_commit+0x4d/0x60 [<ffffffff81085a80>] ? kthread_create_on_node+0x140/0x140 [<ffffffff8105d0ec>] do_fork+0xbc/0x360 [<ffffffff8105d3b6>] kernel_thread+0x26/0x30 [<ffffffff81086652>] kthreadd+0x2c2/0x300 [<ffffffff81086390>] ? kthread_create_on_cpu+0x60/0x60 [<ffffffff815f20ec>] ret_from_fork+0x7c/0xb0 [<ffffffff81086390>] ? kthread_create_on_cpu+0x60/0x60
In my investigation, I found the root cause is wq_numa_possible_cpumask. All entries of wq_numa_possible_cpumask is allocated by alloc_cpumask_var_node(). And these entries are used without initializing. So these entries have wrong value.
When hot-adding and onlining CPU, wq_update_unbound_numa() is called. wq_update_unbound_numa() calls alloc_unbound_pwq(). And alloc_unbound_pwq() calls get_unbound_pool(). In get_unbound_pool(), worker_pool->node is set as follow:
3592 /* if cpumask is contained inside a NUMA node, we belong to that node */
3593 if (wq_numa_enabled) {
3594 for_each_node(node) {
3595 if (cpumask_subset(pool->attrs->cpumask,
3596 wq_numa_possible_cpumask[node])) {
3597 pool->node = node;
3598 break;
3599 }
3600 }
3601 }
But wq_numa_possible_cpumask[node] does not have correct cpumask. So, wrong node is selected. As a result, kernel panic occurs.
By this patch, all entries of wq_numa_possible_cpumask are allocated by zalloc_cpumask_var_node to initialize them. And the panic disappeared.
--- kernel/workqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/workqueue.c +1 -1
@@ -5034,7 +5034,7 @@ static void __init wq_numa_init(void)BUG_ON (!tbl);for_each_node (node) -BUG_ON (!alloc_cpumask_var_node (&tbl[node],GFP_KERNEL , +BUG_ON (!zalloc_cpumask_var_node (&tbl[node],GFP_KERNEL ,node_online (node) ? node :NUMA_NO_NODE ));for_each_possible_cpu (cpu) {
Greg Kroah-Hartman
maintainerPATCH 12/84 ahci: imx: manage only sata_ref_clk in imx_sata_enable[disable]
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shawn Guo <[email protected]>
commit e6dd42a917e62d916c6e513dbf87a4dec8cf3a1c upstream.
Doing suspend/resume on imx6q and imx53 boards with no SATA disk attached will trigger the following warning.
------------[ cut here ]------------ WARNING: CPU: 0 PID: 661 at drivers/ata/libahci.c:224 ahci_enable_ahci+0x74/0x8) Modules linked in: CPU: 0 PID: 661 Comm: sh Tainted: G W 3.15.0-rc5-next-20140521-000027 Backtrace: [<80011c90>] (dump_backtrace) from [<80011e2c>] (show_stack+0x18/0x1c) r6:803a22f4 r5:00000000 r4:00000000 r3:00000000 [<80011e14>] (show_stack) from [<80661e60>] (dump_stack+0x88/0xa4) [<80661dd8>] (dump_stack) from [<80028fdc>] (warn_slowpath_common+0x70/0x94) r5:00000009 r4:00000000 [<80028f6c>] (warn_slowpath_common) from [<80029024>] (warn_slowpath_null+0x24/) r8:808f68c4 r7:00000000 r6:00000000 r5:00000000 r4:e0810004 [<80029000>] (warn_slowpath_null) from [<803a22f4>] (ahci_enable_ahci+0x74/0x80) [<803a2280>] (ahci_enable_ahci) from [<803a2324>] (ahci_reset_controller+0x24/0) r8:ddcd9410 r7:80351178 r6:ddcd9444 r5:dde8b850 r4:e0810000 r3:ddf35e90
[<803a2300>] (ahci_reset_controller) from [<803a2c68>] (ahci_platform_resume_ho)
r7:80351178 r6:ddcd9444 r5:dde8b850 r4:ddcd9410
[<803a2c30>] (ahci_platform_resume_host) from [<803a38f0>] (imx_ahci_resume+0x2)
r5:00000000 r4:ddcd9410
[<803a38c4>] (imx_ahci_resume) from [<803511ac>] (platform_pm_resume+0x34/0x54)
....
The reason is that the SATA controller has no working clock at this point, and thus ahci_enable_ahci() fails to enable the controller. In case that there is no SATA disk attached, the imx_sata_disable() gets called in ahci_imx_error_handler(), and both sata_clk and sata_ref_clk will be disabled there. Because all the imx_sata_enable() calls afterward will return immediately due to imxpriv->no_device check, the SATA controller working clock sata_clk will never get any chance to be enabled again.
This is a regression caused by commit 90870d79d4f2 (ahci-imx: Port to library-ised ahci_platform). Before the commit, only sata_ref_clk is managed by the driver in enable/disable function. But after the commit, all the clocks are enabled/disabled in a row by ahci platform helpers ahci_platform_enable[disable]_clks. Since ahb_clk is a bus clock which does not have gate at all, and i.MX low-power hardware module already manages sata_clk across suspend/resume cycle, the only clock that needs to be managed by software is sata_ref_clk.
So instead of using ahci_platform_enable[disable]_clks to manage all the clocks in a row from imx_sata_enable[disable], we should manage only sata_ref_clk in there.
--- drivers/ata/ahci_imx.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-)
drivers/ata/ahci_imx.c +31 -4
@@ -58,6 +58,8 @@ enum ahci_imx_type {struct imx_ahci_priv {struct platform_device *ahci_pdev;enum ahci_imx_type type; +struct clk *sata_clk; +struct clk *sata_ref_clk;struct clk *ahb_clk;struct regmap *gpr;bool no_device;
@@ -224,7 +226,7 @@ static int imx_sata_enable(struct ahci_hreturn ret; } - ret =ahci_platform_enable_clks (hpriv); + ret =clk_prepare_enable (imxpriv->sata_ref_clk);if (ret <0 ) goto disable_regulator;
@@ -291,7 +293,7 @@ static void imx_sata_disable(struct ahci !IMX6Q_GPR13_SATA_MPLL_CLK_EN); } -ahci_platform_disable_clks (hpriv); +clk_disable_unprepare (imxpriv->sata_ref_clk);if (hpriv->target_pwr)regulator_disable (hpriv->target_pwr);
@@ -385,6 +387,19 @@ static int imx_ahci_probe(struct platfor imxpriv->no_device = false; imxpriv->first_time = true; imxpriv->type = (enum ahci_imx_type )of_id->data; + + imxpriv->sata_clk =devm_clk_get (dev,"sata" ); +if (IS_ERR (imxpriv->sata_clk)) { +dev_err (dev,"can't get sata clock.\n" ); +return PTR_ERR (imxpriv->sata_clk); + } + + imxpriv->sata_ref_clk =devm_clk_get (dev,"sata_ref" ); +if (IS_ERR (imxpriv->sata_ref_clk)) { +dev_err (dev,"can't get sata_ref clock.\n" ); +return PTR_ERR (imxpriv->sata_ref_clk); + } + imxpriv->ahb_clk =devm_clk_get (dev,"ahb" );if (IS_ERR (imxpriv->ahb_clk)) {dev_err (dev,"can't get ahb clock.\n" );
@@ -407,10 +422,14 @@ static int imx_ahci_probe(struct platfor hpriv->plat_data = imxpriv; - ret =imx_sata_enable (hpriv); + ret =clk_prepare_enable (imxpriv->sata_clk);if (ret)return ret; + ret =imx_sata_enable (hpriv); +if (ret) + goto disable_clk; +/* * Configure the HWINIT bits of the HOST_CAP and HOST_PORTS_IMPL, * and IP vendor specific register IMX_TIMER1MS.
@@ -434,16 +453,24 @@ static int imx_ahci_probe(struct platfor ret =ahci_platform_init_host (pdev, hpriv, &ahci_imx_port_info,0 ,0 );if (ret) -imx_sata_disable (hpriv); + goto disable_sata; + +return 0 ; +disable_sata: +imx_sata_disable (hpriv); +disable_clk: +clk_disable_unprepare (imxpriv->sata_clk);return ret; }static void ahci_imx_host_stop (struct ata_host *host) {struct ahci_host_priv *hpriv = host->private_data; +struct imx_ahci_priv *imxpriv = hpriv->plat_data;imx_sata_disable (hpriv); +clk_disable_unprepare (imxpriv->sata_clk); }#ifdef CONFIG_PM_SLEEP
Greg Kroah-Hartman
maintainerPATCH 13/84 i8k: Fix non-SMP operation
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 6d827fbcc370ca259a2905309f64161ab7b10596 upstream.
Commit f36fdb9f0266 (i8k: Force SMM to run on CPU 0) adds support for multi-core CPUs to the driver. Unfortunately, that causes it to fail loading if compiled without SMP support, at least on 32 bit kernels. Kernel log shows "i8k: unable to get SMM Dell signature", and function i8k_smm is found to return -EINVAL.
Testing revealed that the culprit is the missing return value check of set_cpus_allowed_ptr.
--- drivers/char/i8k.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/char/i8k.c +3 -1
@@ -138,7 +138,9 @@ static int i8k_smm(struct smm_regs *regsif (!alloc_cpumask_var (&old_mask,GFP_KERNEL ))return -ENOMEM ;cpumask_copy (old_mask, ¤t->cpus_allowed); -set_cpus_allowed_ptr (current,cpumask_of (0 )); + rc =set_cpus_allowed_ptr (current,cpumask_of (0 )); +if (rc) + goto out;if (smp_processor_id () !=0 ) { rc = -EBUSY ; goto out;
Greg Kroah-Hartman
maintainerPATCH 14/84 serial: imx: Fix build breakage
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Hurley <[email protected]>
commit 8bec751bd63847b4044aab8b215db52aa6abde61 upstream.
Fix breakage introduced by
commit c557d392fbf5badd693ea1946a4317c87a26a716,
'serial: Test for no tx data on tx restart'.
--- drivers/tty/serial/imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/imx.c +1 -1
@@ -563,7 +563,7 @@ static void imx_start_tx(struct uart_porstruct imx_port *sport = (struct imx_port *)port;unsigned long temp; -if (uart_circ_empty (&port.state->xmit)) +if (uart_circ_empty (&port->state->xmit))return ;if (USE_IRDA (sport)) {
Re: [PATCH 3.15 14/84] serial: imx: Fix build breakage
Hi Greg,
Quoted 5 lines · On Tue, 15 Jul 2014 16:17:11 -0700 Greg Kroah-Hartman…
3.15-stable review patch. If anyone has any objections, please let me know.
------------------
Quoted 7 lines
From: Peter Hurley <[email protected]>
commit
8bec751bd63847b4044aab8b215db52aa6abde61upstream.Fix breakage introduced by
commitc557d392fbf5badd693ea1946a4317c87a26a716,
'serial: Test for no tx data on tx restart'.
That commit only entered Linus' tree at v3.16-rc5, so this fix shouldn't need to go into 3.15-stable (unless the original patch was backported as well - in which case maybe the backport commit id should be mentioned as well).
Signature · 2 lines
Cheers, Stephen Rothwell [email protected]
Greg Kroah-Hartman
maintainerRe: [PATCH 3.15 14/84] serial: imx: Fix build breakage
Quoted 12 lines · Stephen Rothwell
Hi Greg,
Quoted 9 lines · On Tue, 15 Jul 2014 16:17:11 -0700 Greg Kroah-Hartman…
3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Hurley <[email protected]>
commit
8bec751bd63847b4044aab8b215db52aa6abde61upstream.
Quoted 8 lines
Quoted 3 lines
Fix breakage introduced by
commitc557d392fbf5badd693ea1946a4317c87a26a716,
'serial: Test for no tx data on tx restart'.That commit only entered Linus' tree at v3.16-rc5, so this fix shouldn't need to go into 3.15-stable (unless the original patch was backported as well - in which case maybe the backport commit id should be mentioned as well).
c557d392fbf5badd693ea1946a4317c87a26a716, is marked for stable (and is earlier in the series) so leaving this as-is, should be fine, as that commit id will show up in the stable kernels as well in the changelog entry.
thanks,
greg k-h
Re: [PATCH 3.15 14/84] serial: imx: Fix build breakage
Hi Greg,
Quoted 22 lines · On Tue, 15 Jul 2014 17:42:02 -0700 Greg Kroah-Hartman…
Quoted 11 lines · Stephen Rothwell
Quoted 9 lines · On Tue, 15 Jul 2014 16:17:11 -0700 Greg Kroah-Hartman…
3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Hurley <[email protected]>
commit
8bec751bd63847b4044aab8b215db52aa6abde61upstream.Quoted 8 lines
Quoted 3 lines
Fix breakage introduced by
commitc557d392fbf5badd693ea1946a4317c87a26a716,
'serial: Test for no tx data on tx restart'.That commit only entered Linus' tree at v3.16-rc5, so this fix shouldn't need to go into 3.15-stable (unless the original patch was backported as well - in which case maybe the backport commit id should be mentioned as well).
Quoted 4 lines
c557d392fbf5badd693ea1946a4317c87a26a716, is marked for stable (and is earlier in the series) so leaving this as-is, should be fine, as that commit id will show up in the stable kernels as well in the changelog entry.
Ah, ok. So you don't merge "fixes for fixes" to save bisection problems, then? (Just asking)
Signature · 2 lines
Cheers, Stephen Rothwell [email protected]
Greg Kroah-Hartman
maintainerRe: [PATCH 3.15 14/84] serial: imx: Fix build breakage
Quoted 25 lines · Stephen Rothwell
Hi Greg,
Quoted 22 lines · On Tue, 15 Jul 2014 17:42:02 -0700 Greg Kroah-Hartman…
Quoted 19 lines · Stephen Rothwell
Quoted 5 lines · On Tue, 15 Jul 2014 16:17:11 -0700 Greg Kroah-Hartman…
3.15-stable review patch. If anyone has any objections, please let me know.
------------------
Quoted 7 lines
From: Peter Hurley <[email protected]>
commit
8bec751bd63847b4044aab8b215db52aa6abde61upstream.Fix breakage introduced by
commitc557d392fbf5badd693ea1946a4317c87a26a716,
'serial: Test for no tx data on tx restart'.That commit only entered Linus' tree at v3.16-rc5, so this fix shouldn't need to go into 3.15-stable (unless the original patch was backported as well - in which case maybe the backport commit id should be mentioned as well).
Quoted 7 lines
Quoted 4 lines
c557d392fbf5badd693ea1946a4317c87a26a716, is marked for stable (and is earlier in the series) so leaving this as-is, should be fine, as that commit id will show up in the stable kernels as well in the changelog entry.Ah, ok. So you don't merge "fixes for fixes" to save bisection problems, then? (Just asking)
No I do not, I much prefer to keep the patches identical to what is in Linus's tree if at all possible. It saves time overall, so you can track things better, instead of having to deal with "merged" patches, which can get messy very quickly.
thanks,
greg k-h
Re: [PATCH 3.15 14/84] serial: imx: Fix build breakage
Hi Greg,
Quoted 5 lines · On Tue, 15 Jul 2014 18:07:59 -0700 Greg Kroah-Hartman…
No I do not, I much prefer to keep the patches identical to what is in Linus's tree if at all possible. It saves time overall, so you can track things better, instead of having to deal with "merged" patches, which can get messy very quickly.
OK, make sense, thanks.
Signature · 2 lines
Cheers, Stephen Rothwell [email protected]
Greg Kroah-Hartman
maintainerPATCH 15/84 thermal: hwmon: Make the check for critical temp valid consistent
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Lu <[email protected]>
commit e8db5d6736a712a3e2280c0e31f4b301d85172d8 upstream.
Quoted 7 lines · Aaron Lu
Quoted 6 lines · Kui Zhang
Hello,
I get following error when rmmod thermal.
rmmod thermal
Killed
While dealing with this problem, I found another problem that also results in a kernel crash on thermal module removal:
From: Aaron Lu <[email protected]>
Date: Wed, 21 May 2014 16:05:38 +0800
Subject: [PATCH 3.15 15/84] thermal: hwmon: Make the check for critical temp valid consistent
We used the tz->ops->get_crit_temp && !tz->ops->get_crit_temp(tz, temp) to decide if we need to create the temp_crit attribute file but we just check if tz->ops->get_crit_temp exists to decide if we need to remove that attribute file. Some ACPI thermal zone doesn't have a valid critical trip point and that would result in removing a non-existent device file on thermal module unload.
--- drivers/thermal/thermal_hwmon.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-)
drivers/thermal/thermal_hwmon.c +18 -15
@@ -140,6 +140,12 @@ thermal_hwmon_lookup_temp(const struct treturn NULL ; } +static bool thermal_zone_crit_temp_valid (struct thermal_zone_device *tz) +{ +unsigned long temp; +return tz->ops->get_crit_temp && !tz->ops->get_crit_temp (tz, &temp); +} +int thermal_add_hwmon_sysfs (struct thermal_zone_device *tz) {struct thermal_hwmon_device *hwmon;
@@ -189,21 +195,18 @@ int thermal_add_hwmon_sysfs(struct thermif (result) goto free_temp_mem; -if (tz->ops->get_crit_temp) { -unsigned long temperature; -if (!tz->ops->get_crit_temp (tz, &temperature)) { -snprintf (temp->temp_crit.name, -sizeof (temp->temp_crit.name), +if (thermal_zone_crit_temp_valid (tz)) { +snprintf (temp->temp_crit.name, +sizeof (temp->temp_crit.name),"temp%d_crit" , hwmon->count); - temp->temp_crit.attr.attr.name = temp->temp_crit.name; - temp->temp_crit.attr.attr.mode =0444 ; - temp->temp_crit.attr.show = temp_crit_show; -sysfs_attr_init (&temp->temp_crit.attr.attr); - result =device_create_file (hwmon->device, - &temp->temp_crit.attr); -if (result) - goto unregister_input; - } + temp->temp_crit.attr.attr.name = temp->temp_crit.name; + temp->temp_crit.attr.attr.mode =0444 ; + temp->temp_crit.attr.show = temp_crit_show; +sysfs_attr_init (&temp->temp_crit.attr.attr); + result =device_create_file (hwmon->device, + &temp->temp_crit.attr); +if (result) + goto unregister_input; }mutex_lock (&thermal_hwmon_list_lock);
@@ -250,7 +253,7 @@ void thermal_remove_hwmon_sysfs(struct t }device_remove_file (hwmon->device, &temp->temp_input.attr); -if (tz->ops->get_crit_temp) +if (thermal_zone_crit_temp_valid (tz))device_remove_file (hwmon->device, &temp->temp_crit.attr);mutex_lock (&thermal_hwmon_list_lock);
Greg Kroah-Hartman
maintainerPATCH 16/84 hwmon: (adc128d818) Drop write support on inX_input attributes
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 7fe7381cbdadf16792e733789983690b3fa82880 upstream.
Writes into input registers doesn't make sense, even more so since the writes actually ended up writing into the maximum limit registers. Drop it.
--- drivers/hwmon/adc128d818.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/hwmon/adc128d818.c +14 -14
@@ -239,50 +239,50 @@ static ssize_t adc128_show_alarm(structreturn sprintf (buf,"%u\n" , !!(alarms & mask)); } -static SENSOR_DEVICE_ATTR_2(in0_input, S_IWUSR | S_IRUGO, - adc128_show_in, adc128_set_in, 0, 0); +static SENSOR_DEVICE_ATTR_2(in0_input, S_IRUGO, + adc128_show_in, NULL, 0, 0); static SENSOR_DEVICE_ATTR_2(in0_min, S_IWUSR | S_IRUGO, adc128_show_in, adc128_set_in, 0, 1); static SENSOR_DEVICE_ATTR_2(in0_max, S_IWUSR | S_IRUGO, adc128_show_in, adc128_set_in, 0, 2); -static SENSOR_DEVICE_ATTR_2(in1_input, S_IWUSR | S_IRUGO, - adc128_show_in, adc128_set_in, 1, 0); +static SENSOR_DEVICE_ATTR_2(in1_input, S_IRUGO, + adc128_show_in, NULL, 1, 0); static SENSOR_DEVICE_ATTR_2(in1_min, S_IWUSR | S_IRUGO, adc128_show_in, adc128_set_in, 1, 1); static SENSOR_DEVICE_ATTR_2(in1_max, S_IWUSR | S_IRUGO, adc128_show_in, adc128_set_in, 1, 2); -static SENSOR_DEVICE_ATTR_2(in2_input, S_IWUSR | S_IRUGO, - adc128_show_in, adc128_set_in, 2, 0); +static SENSOR_DEVICE_ATTR_2(in2_input, S_IRUGO, + adc128_show_in, NULL, 2, 0); static SENSOR_DEVICE_ATTR_2(in2_min, S_IWUSR | S_IRUGO, adc128_show_in, adc128_set_in, 2, 1); static SENSOR_DEVICE_ATTR_2(in2_max, S_IWUSR | S_IRUGO, adc128_show_in, adc128_set_in, 2, 2); -static SENSOR_DEVICE_ATTR_2(in3_input, S_IWUSR | S_IRUGO, - adc128_show_in, adc128_set_in, 3, 0); +static SENSOR_DEVICE_ATTR_2(in3_input, S_IRUGO, + adc128_show_in, NULL, 3, 0); static SENSOR_DEVICE_ATTR_2(in3_min, S_IWUSR | S_IRUGO, adc128_show_in, adc128_set_in, 3, 1); static SENSOR_DEVICE_ATTR_2(in3_max, S_IWUSR | S_IRUGO, adc128_show_in, adc128_set_in, 3, 2); -static SENSOR_DEVICE_ATTR_2(in4_input, S_IWUSR | S_IRUGO, - adc128_show_in, adc128_set_in, 4, 0); +static SENSOR_DEVICE_ATTR_2(in4_input, S_IRUGO, + adc128_show_in, NULL, 4, 0); static SENSOR_DEVICE_ATTR_2(in4_min, S_IWUSR | S_IRUGO, adc128_show_in, adc128_set_in, 4, 1); static SENSOR_DEVICE_ATTR_2(in4_max, S_IWUSR | S_IRUGO, adc128_show_in, adc128_set_in, 4, 2); -static SENSOR_DEVICE_ATTR_2(in5_input, S_IWUSR | S_IRUGO, - adc128_show_in, adc128_set_in, 5, 0); +static SENSOR_DEVICE_ATTR_2(in5_input, S_IRUGO, + adc128_show_in, NULL, 5, 0); static SENSOR_DEVICE_ATTR_2(in5_min, S_IWUSR | S_IRUGO, adc128_show_in, adc128_set_in, 5, 1); static SENSOR_DEVICE_ATTR_2(in5_max, S_IWUSR | S_IRUGO, adc128_show_in, adc128_set_in, 5, 2); -static SENSOR_DEVICE_ATTR_2(in6_input, S_IWUSR | S_IRUGO, - adc128_show_in, adc128_set_in, 6, 0); +static SENSOR_DEVICE_ATTR_2(in6_input, S_IRUGO, + adc128_show_in, NULL, 6, 0); static SENSOR_DEVICE_ATTR_2(in6_min, S_IWUSR | S_IRUGO, adc128_show_in, adc128_set_in, 6, 1); static SENSOR_DEVICE_ATTR_2(in6_max, S_IWUSR | S_IRUGO,
Greg Kroah-Hartman
maintainerPATCH 17/84 hwmon: (amc6821) Fix permissions for temp2_input
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Axel Lin <[email protected]>
commit df86754b746e9a0ff6f863f690b1c01d408e3cdc upstream.
temp2_input should not be writable, fix it.
--- drivers/hwmon/amc6821.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/amc6821.c +1 -1
@@ -704,7 +704,7 @@ static SENSOR_DEVICE_ATTR(temp1_max_alar get_temp_alarm, NULL, IDX_TEMP1_MAX); static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, get_temp_alarm, NULL, IDX_TEMP1_CRIT); -static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO | S_IWUSR, +static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, get_temp, NULL, IDX_TEMP2_INPUT); static SENSOR_DEVICE_ATTR(temp2_min, S_IRUGO | S_IWUSR, get_temp, set_temp, IDX_TEMP2_MIN);
Greg Kroah-Hartman
maintainerPATCH 18/84 hwmon: (emc2103) Clamp limits instead of bailing out
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit f6c2dd20108c35e30e2c1f3c6142d189451a626b upstream.
It is customary to clamp limits instead of bailing out with an error if a configured limit is out of the range supported by the driver. This simplifies limit configuration, since the user will not typically know chip and/or driver specific limits.
--- drivers/hwmon/emc2103.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/hwmon/emc2103.c +5 -10
@@ -250,9 +250,7 @@ static ssize_t set_temp_min(struct devicif (result <0 )return result; - val =DIV_ROUND_CLOSEST (val,1000 ); -if ((val <-63 ) || (val >127 )) -return -EINVAL ; + val =clamp_val (DIV_ROUND_CLOSEST (val,1000 ),-63 ,127 );mutex_lock (&data->update_lock); data->temp_min[nr] = val;
@@ -274,9 +272,7 @@ static ssize_t set_temp_max(struct devicif (result <0 )return result; - val =DIV_ROUND_CLOSEST (val,1000 ); -if ((val <-63 ) || (val >127 )) -return -EINVAL ; + val =clamp_val (DIV_ROUND_CLOSEST (val,1000 ),-63 ,127 );mutex_lock (&data->update_lock); data->temp_max[nr] = val;
@@ -390,15 +386,14 @@ static ssize_t set_fan_target(struct dev {struct emc2103_data *data =emc2103_update_device (dev);struct i2c_client *client =to_i2c_client (dev); -long rpm_target; +unsigned long rpm_target; -int result =kstrtol (buf,10 , &rpm_target); +int result =kstrtoul (buf,10 , &rpm_target);if (result <0 )return result;/* Datasheet states 16384 as maximum RPM target (table 3.2) */ -if ((rpm_target <0 ) || (rpm_target >16384 )) -return -EINVAL ; + rpm_target =clamp_val (rpm_target,0 ,16384 );mutex_lock (&data->update_lock);
Greg Kroah-Hartman
maintainerPATCH 19/84 hwmon: (adm1031) Fix writes to limit registers
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 145e74a4e5022225adb84f4e5d4fff7938475c35 upstream.
Upper limit for write operations to temperature limit registers was clamped to a fractional value. However, limit registers do not support fractional values. As a result, upper limits of 127.5 degrees C or higher resulted in a rounded limit of 128 degrees C. Since limit registers are signed, this was stored as -128 degrees C. Clamp limits to (-55, +127) degrees C to solve the problem.
Value on writes to auto_temp[12]_min and auto_temp[12]_max were not clamped at all, but masked. As a result, out-of-range writes resulted in a more or less arbitrary limit. Clamp those attributes to (0, 127) degrees C for more predictable results.
--- drivers/hwmon/adm1031.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/hwmon/adm1031.c +5 -3
@@ -365,6 +365,7 @@ set_auto_temp_min(struct device *dev, stif (ret)return ret; + val =clamp_val (val,0 ,127000 );mutex_lock (&data->update_lock); data->auto_temp[nr] =AUTO_TEMP_MIN_TO_REG (val, data->auto_temp[nr]); adm1031_write_value(client, ADM1031_REG_AUTO_TEMP(nr),
@@ -394,6 +395,7 @@ set_auto_temp_max(struct device *dev, stif (ret)return ret; + val =clamp_val (val,0 ,127000 );mutex_lock (&data->update_lock); data->temp_max[nr] =AUTO_TEMP_MAX_TO_REG (val, data->auto_temp[nr], data->pwm[nr]);
@@ -696,7 +698,7 @@ static ssize_t set_temp_min(struct devicif (ret)return ret; - val =clamp_val (val,-55000 , nr ==0 ?127750 :127875 ); + val =clamp_val (val,-55000 ,127000 );mutex_lock (&data->update_lock); data->temp_min[nr] =TEMP_TO_REG (val); adm1031_write_value(client, ADM1031_REG_TEMP_MIN(nr),
@@ -717,7 +719,7 @@ static ssize_t set_temp_max(struct devicif (ret)return ret; - val =clamp_val (val,-55000 , nr ==0 ?127750 :127875 ); + val =clamp_val (val,-55000 ,127000 );mutex_lock (&data->update_lock); data->temp_max[nr] =TEMP_TO_REG (val); adm1031_write_value(client, ADM1031_REG_TEMP_MAX(nr),
@@ -738,7 +740,7 @@ static ssize_t set_temp_crit(struct deviif (ret)return ret; - val =clamp_val (val,-55000 , nr ==0 ?127750 :127875 ); + val =clamp_val (val,-55000 ,127000 );mutex_lock (&data->update_lock); data->temp_crit[nr] =TEMP_TO_REG (val); adm1031_write_value(client, ADM1031_REG_TEMP_CRIT(nr),
Greg Kroah-Hartman
maintainerPATCH 20/84 hwmon: (adm1029) Ensure the fan_div cache is updated in set_fan_div
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Axel Lin <[email protected]>
commit 1035a9e3e9c76b64a860a774f5b867d28d34acc2 upstream.
Writing to fanX_div does not clear the cache. As a result, reading from fanX_div may return the old value for up to two seconds after writing a new value.
This patch ensures the fan_div cache is updated in set_fan_div().
--- drivers/hwmon/adm1029.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/hwmon/adm1029.c +3 -0
@@ -232,6 +232,9 @@ static ssize_t set_fan_div(struct device/* Update the value */ reg = (reg &0x3F ) | (val <<6 ); +/* Update the cache */ + data->fan_div[attr->index] = reg; +/* Write value */ i2c_smbus_write_byte_data (client,ADM1029_REG_FAN_DIV [attr->index], reg);
Greg Kroah-Hartman
maintainerPATCH 21/84 hwmon: (adm1021) Fix cache problem when writing temperature limits
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Axel Lin <[email protected]>
commit c024044d4da2c9c3b32933b4235df1e409293b84 upstream.
The module test script for the adm1021 driver exposes a cache problem when writing temperature limits. temp_min and temp_max are expected to be stored in milli-degrees C but are stored in degrees C.
--- drivers/hwmon/adm1021.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/hwmon/adm1021.c +8 -6
@@ -185,7 +185,7 @@ static ssize_t set_temp_max(struct devicstruct adm1021_data *data =dev_get_drvdata (dev);struct i2c_client *client = data->client;long temp; -int err; +int reg_val, err; err =kstrtol (buf,10 , &temp);if (err)
@@ -193,10 +193,11 @@ static ssize_t set_temp_max(struct devic temp /=1000 ;mutex_lock (&data->update_lock); - data->temp_max[index] =clamp_val (temp,-128 ,127 ); + reg_val =clamp_val (temp,-128 ,127 ); + data->temp_max[index] = reg_val *1000 ;if (!read_only)i2c_smbus_write_byte_data (client,ADM1021_REG_TOS_W (index), - data->temp_max[index]); + reg_val);mutex_unlock (&data->update_lock);return count;
@@ -210,7 +211,7 @@ static ssize_t set_temp_min(struct devicstruct adm1021_data *data =dev_get_drvdata (dev);struct i2c_client *client = data->client;long temp; -int err; +int reg_val, err; err =kstrtol (buf,10 , &temp);if (err)
@@ -218,10 +219,11 @@ static ssize_t set_temp_min(struct devic temp /=1000 ;mutex_lock (&data->update_lock); - data->temp_min[index] =clamp_val (temp,-128 ,127 ); + reg_val =clamp_val (temp,-128 ,127 ); + data->temp_min[index] = reg_val *1000 ;if (!read_only)i2c_smbus_write_byte_data (client,ADM1021_REG_THYST_W (index), - data->temp_min[index]); + reg_val);mutex_unlock (&data->update_lock);return count;
Greg Kroah-Hartman
maintainerPATCH 22/84 Revert "ACPI / AC: Remove ACs proc directory."
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lan Tianyu <[email protected]>
commit e63f6e28dda6de3de2392ddca321e211fd860925 upstream.
Revert commit ab0fd674d6ce (ACPI / AC: Remove AC's proc directory.), because some old tools (e.g. kpowersave from kde 3.5.10) are still using /proc/acpi/ac_adapter.
--- drivers/acpi/ac.c | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 128 insertions(+), 2 deletions(-)
drivers/acpi/ac.c +128 -2
@@ -30,6 +30,10 @@#include <linux/types.h> #include <linux/dmi.h> #include <linux/delay.h> +#ifdef CONFIG_ACPI_PROCFS_POWER +#include <linux/proc_fs.h> +#include <linux/seq_file.h> +#endif #include <linux/platform_device.h> #include <linux/power_supply.h> #include <linux/acpi.h>
@@ -52,6 +56,7 @@ MODULE_AUTHOR("Paul Diefenbaugh");MODULE_DESCRIPTION ("ACPI AC Adapter Driver" );MODULE_LICENSE ("GPL" ); +static int acpi_ac_add (struct acpi_device *device);static int acpi_ac_remove (struct acpi_device *device);static void acpi_ac_notify (struct acpi_device *device,u32 event);
@@ -67,6 +72,13 @@ static int acpi_ac_resume(struct device#endif static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume); +#ifdef CONFIG_ACPI_PROCFS_POWER +extern struct proc_dir_entry *acpi_lock_ac_dir (void ); +extern void *acpi_unlock_ac_dir (struct proc_dir_entry *acpi_ac_dir); +static int acpi_ac_open_fs (struct inode *inode,struct file *file); +#endif + +static int ac_sleep_before_get_state_ms;static struct acpi_driver acpi_ac_driver = {
@@ -91,6 +103,16 @@ struct acpi_ac {#define to_acpi_ac (x) container_of(x, struct acpi_ac, charger) +#ifdef CONFIG_ACPI_PROCFS_POWER +static const struct file_operations acpi_ac_fops = { + .owner =THIS_MODULE , + .open = acpi_ac_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; +#endif +/* -------------------------------------------------------------------------- AC Adapter Management -------------------------------------------------------------------------- */
@@ -143,6 +165,83 @@ static enum power_supply_property ac_pro POWER_SUPPLY_PROP_ONLINE, }; +#ifdef CONFIG_ACPI_PROCFS_POWER +/* -------------------------------------------------------------------------- +FS Interface (/proc) +-------------------------------------------------------------------------- */ + +static struct proc_dir_entry *acpi_ac_dir; + +static int acpi_ac_seq_show (struct seq_file *seq,void *offset) +{ +struct acpi_ac *ac = seq->private; + + +if (!ac) +return 0 ; + +if (acpi_ac_get_state (ac)) { +seq_puts (seq,"ERROR: Unable to read AC Adapter state\n" ); +return 0 ; + } + +seq_puts (seq,"state: " ); +switch (ac->state) { +case ACPI_AC_STATUS_OFFLINE : +seq_puts (seq,"off-line\n" ); +break ; +case ACPI_AC_STATUS_ONLINE : +seq_puts (seq,"on-line\n" ); +break ; +default : +seq_puts (seq,"unknown\n" ); +break ; + } + +return 0 ; +} + +static int acpi_ac_open_fs (struct inode *inode,struct file *file) +{ +return single_open (file, acpi_ac_seq_show,PDE_DATA (inode)); +} + +static int acpi_ac_add_fs (struct acpi_ac *ac) +{ +struct proc_dir_entry *entry =NULL ; + + printk(KERN_WARNING PREFIX "Deprecated procfs I/F for AC is loaded," + " please retry with CONFIG_ACPI_PROCFS_POWER cleared\n"); +if (!acpi_device_dir (ac->device)) { +acpi_device_dir (ac->device) = +proc_mkdir (acpi_device_bid (ac->device), acpi_ac_dir); +if (!acpi_device_dir (ac->device)) +return -ENODEV ; + } + +/* 'state' [R] */ + entry =proc_create_data (ACPI_AC_FILE_STATE , +S_IRUGO ,acpi_device_dir (ac->device), + &acpi_ac_fops, ac); +if (!entry) +return -ENODEV ; +return 0 ; +} + +static int acpi_ac_remove_fs (struct acpi_ac *ac) +{ + +if (acpi_device_dir (ac->device)) { +remove_proc_entry (ACPI_AC_FILE_STATE , +acpi_device_dir (ac->device)); +remove_proc_entry (acpi_device_bid (ac->device), acpi_ac_dir); +acpi_device_dir (ac->device) =NULL ; + } + +return 0 ; +} +#endif +/* -------------------------------------------------------------------------- Driver Model -------------------------------------------------------------------------- */
@@ -243,6 +342,11 @@ static int acpi_ac_add(struct acpi_devic goto end; ac->charger.name =acpi_device_bid (device); +#ifdef CONFIG_ACPI_PROCFS_POWER + result =acpi_ac_add_fs (ac); +if (result) + goto end; +#endif ac->charger.type =POWER_SUPPLY_TYPE_MAINS ; ac->charger.properties = ac_props; ac->charger.num_properties =ARRAY_SIZE (ac_props);
@@ -258,8 +362,12 @@ static int acpi_ac_add(struct acpi_devic ac->battery_nb.notifier_call = acpi_ac_battery_notify;register_acpi_notifier (&ac->battery_nb); end: -if (result) +if (result) { +#ifdef CONFIG_ACPI_PROCFS_POWER +acpi_ac_remove_fs (ac); +#endif kfree (ac); + }dmi_check_system (ac_dmi_table);return result;
@@ -303,6 +411,10 @@ static int acpi_ac_remove(struct acpi_depower_supply_unregister (&ac->charger);unregister_acpi_notifier (&ac->battery_nb); +#ifdef CONFIG_ACPI_PROCFS_POWER +acpi_ac_remove_fs (ac); +#endif +kfree (ac);return 0 ;
@@ -315,9 +427,20 @@ static int __init acpi_ac_init(void)if (acpi_disabled)return -ENODEV ; +#ifdef CONFIG_ACPI_PROCFS_POWER + acpi_ac_dir =acpi_lock_ac_dir (); +if (!acpi_ac_dir) +return -ENODEV ; +#endif + + result =acpi_bus_register_driver (&acpi_ac_driver); -if (result <0 ) +if (result <0 ) { +#ifdef CONFIG_ACPI_PROCFS_POWER +acpi_unlock_ac_dir (acpi_ac_dir); +#endif return -ENODEV ; + }return 0 ; }
@@ -325,6 +448,9 @@ static int __init acpi_ac_init(void) static void __exit acpi_ac_exit(void) {acpi_bus_unregister_driver (&acpi_ac_driver); +#ifdef CONFIG_ACPI_PROCFS_POWER +acpi_unlock_ac_dir (acpi_ac_dir); +#endif }module_init (acpi_ac_init);module_exit (acpi_ac_exit);
Greg Kroah-Hartman
maintainerPATCH 23/84 ACPI / resources: only reject zero length resources based at address zero
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Whitcroft <[email protected]>
commit 867f9d463b82462793ea4610e748be0b04b37fc7 upstream.
The recently merged change (in v3.14-rc6) to ACPI resource detection (below) causes all zero length ACPI resources to be elided from the table:
commit b355cee88e3b1a193f0e9a81db810f6f83ad728b
Author: Zhang Rui <[email protected]>
Date: Thu Feb 27 11:37:15 2014 +0800
ACPI / resources: ignore invalid ACPI device resources
This change has caused a regression in (at least) serial port detection for a number of machines (see LP#1313981 [1]). These seem to represent their IO regions (presumably incorrectly) as a zero length region. Reverting the above commit restores these serial devices.
Only elide zero length resources which lie at address 0.
--- drivers/acpi/resource.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/acpi/resource.c +5 -5
@@ -77,7 +77,7 @@ bool acpi_dev_resource_memory(struct acpswitch (ares->type) {case ACPI_RESOURCE_TYPE_MEMORY24 : memory24 = &ares->data.memory24; -if (!memory24->address_length) +if (!memory24->minimum && !memory24->address_length)return false; acpi_dev_get_memresource(res, memory24->minimum, memory24->address_length,
@@ -85,7 +85,7 @@ bool acpi_dev_resource_memory(struct acpbreak ;case ACPI_RESOURCE_TYPE_MEMORY32 : memory32 = &ares->data.memory32; -if (!memory32->address_length) +if (!memory32->minimum && !memory32->address_length)return false; acpi_dev_get_memresource(res, memory32->minimum, memory32->address_length,
@@ -93,7 +93,7 @@ bool acpi_dev_resource_memory(struct acpbreak ;case ACPI_RESOURCE_TYPE_FIXED_MEMORY32 : fixed_memory32 = &ares->data.fixed_memory32; -if (!fixed_memory32->address_length) +if (!fixed_memory32->address && !fixed_memory32->address_length)return false; acpi_dev_get_memresource(res, fixed_memory32->address, fixed_memory32->address_length,
@@ -150,7 +150,7 @@ bool acpi_dev_resource_io(struct acpi_reswitch (ares->type) {case ACPI_RESOURCE_TYPE_IO : io = &ares->data.io; -if (!io->address_length) +if (!io->minimum && !io->address_length)return false; acpi_dev_get_ioresource(res, io->minimum, io->address_length,
@@ -158,7 +158,7 @@ bool acpi_dev_resource_io(struct acpi_rebreak ;case ACPI_RESOURCE_TYPE_FIXED_IO : fixed_io = &ares->data.fixed_io; -if (!fixed_io->address_length) +if (!fixed_io->address && !fixed_io->address_length)return false; acpi_dev_get_ioresource(res, fixed_io->address, fixed_io->address_length,
Greg Kroah-Hartman
maintainerPATCH 24/84 ACPI / EC: Avoid race condition related to advance_transaction()
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lv Zheng <[email protected]>
commit 66b42b78bc1e816f92b662e8888c89195e4199e1 upstream.
The advance_transaction() will be invoked from the IRQ context GPE handler and the task context ec_poll(). The handling of this function is locked so that the EC state machine are ensured to be advanced sequentially.
But there is a problem. Before invoking advance_transaction(), EC_SC(R) is read. Then for advance_transaction(), there could be race condition around the lock from both contexts. The first one reading the register could fail this race and when it passes the stale register value to the state machine advancement code, the hardware condition is totally different from when the register is read. And the hardware accesses determined from the wrong hardware status can break the EC state machine. And there could be cases that the functionalities of the platform firmware are seriously affected. For example:
1. When 2 EC_DATA(W) writes compete the IBF=0, the 2nd EC_DATA(W) write may be invalid due to IBF=1 after the 1st EC_DATA(W) write. Then the hardware will either refuse to respond a next EC_SC(W) write of the next command or discard the current WR_EC command when it receives a EC_SC(W) write of the next command.
2. When 1 EC_SC(W) write and 1 EC_DATA(W) write compete the IBF=0, the EC_DATA(W) write may be invalid due to IBF=1 after the EC_SC(W) write. The next EC_DATA(R) could never be responded by the hardware. This is the root cause of the reported issue.
Fix this issue by moving the EC_SC(R) access into the lock so that we can ensure that the state machine is advanced consistently.
--- drivers/acpi/ec.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/acpi/ec.c +6 -6
@@ -168,12 +168,15 @@ static void start_transaction(struct acpacpi_ec_write_cmd (ec, ec->curr->command); } -static void advance_transaction (struct acpi_ec *ec,u8 status) +static void advance_transaction (struct acpi_ec *ec) {unsigned long flags;struct transaction *t; +u8 status;spin_lock_irqsave (&ec->lock, flags); +pr_debug ("===== %s =====\n" ,in_interrupt () ?"IRQ" :"TASK" ); + status =acpi_ec_read_status (ec); t = ec->curr;if (!t) goto unlock;
@@ -236,7 +239,7 @@ static int ec_poll(struct acpi_ec *ec) msecs_to_jiffies(1)))return 0 ; } -advance_transaction (ec,acpi_ec_read_status (ec)); +advance_transaction (ec); }while (time_before (jiffies, delay));pr_debug ("controller reset, restart transaction\n" );spin_lock_irqsave (&ec->lock, flags);
@@ -635,11 +638,8 @@ static u32 acpi_ec_gpe_handler(acpi_hand u32 gpe_number, void *data) { struct acpi_ec *ec = data; -u8 status =acpi_ec_read_status (ec); - -pr_debug ("~~~> interrupt, status:0x%02x\n" , status); -advance_transaction (ec, status); +advance_transaction (ec);if (ec_transaction_done (ec) && (acpi_ec_read_status (ec) &ACPI_EC_FLAG_IBF ) ==0 ) {wake_up (&ec->wait);
Greg Kroah-Hartman
maintainerPATCH 25/84 ACPI / EC: Add asynchronous command byte write support
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lv Zheng <[email protected]>
commit f92fca0060fc4dc9227342d0072d75df98c1e5a5 upstream.
Move the first command byte write into advance_transaction() so that all EC register accesses that can affect the command processing state machine can happen in this asynchronous state machine advancement function.
The advance_transaction() function then can be a complete implementation of an asyncrhonous transaction for a single command so that:
1. The first command byte can be written in the interrupt context;
2. The command completion waiter can also be used to wait the first command
byte's timeout;
3. In BURST mode, the follow-up command bytes can be written in the interrupt context directly, so that it doesn't need to return to the task context. Returning to the task context reduces the throughput of the BURST mode and in the worst cases where the system workload is very high, this leads to the hardware driven automatic BURST mode exit.
In order not to increase memory consumption, convert 'done' into 'flags' to contain multiple indications:
1. ACPI_EC_COMMAND_COMPLETE: converting from original 'done' condition, indicating the completion of the command transaction.
2. ACPI_EC_COMMAND_POLL: indicating the availability of writing the first command byte. A new command can utilize this flag to compete for the right of accessing the underlying hardware. There is a follow-up bug fix that has utilized this new flag.
The 2 flags are important because it also reflects a key concept of IO programs' design used in the system softwares. Normally an IO program running in the kernel should first be implemented in the asynchronous way. And the 2 flags are the most common way to implement its synchronous operations on top of the asynchronous operations:
1. POLL: This flag can be used to block until the asynchronous operations can happen.
2. COMPLETE: This flag can be used to block until the asynchronous operations have completed.
By constructing code cleanly in this way, many difficult problems can be solved smoothly.
--- drivers/acpi/ec.c | 83 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 48 insertions(+), 35 deletions(-)
drivers/acpi/ec.c +48 -35
@@ -78,6 +78,9 @@ enum { EC_FLAGS_BLOCKED, /* Transactions are blocked */ }; +#define ACPI_EC_COMMAND_POLL 0x01/* Available for command byte */ +#define ACPI_EC_COMMAND_COMPLETE 0x02/* Completed last byte */ +/* ec.c is compiled in acpi namespace so this shows up as acpi.ec_delay param */ static unsigned int ec_delay__read_mostly =ACPI_EC_DELAY ;module_param (ec_delay, uint,0644 );
@@ -109,7 +112,7 @@ struct transaction {u8 ri;u8 wlen;u8 rlen; -bool done; +u8 flags; };struct acpi_ec *boot_ec, *first_ec;
@@ -150,63 +153,68 @@ static inline void acpi_ec_write_data(stoutb (data, ec->data_addr); } -static int ec_transaction_done (struct acpi_ec *ec) +static int ec_transaction_completed (struct acpi_ec *ec) {unsigned long flags;int ret =0 ;spin_lock_irqsave (&ec->lock, flags); -if (!ec->curr || ec->curr->done) +if (!ec->curr || (ec->curr->flags &ACPI_EC_COMMAND_COMPLETE )) ret =1 ;spin_unlock_irqrestore (&ec->lock, flags);return ret; } -static void start_transaction (struct acpi_ec *ec) -{ - ec->curr->irq_count = ec->curr->wi = ec->curr->ri =0 ; - ec->curr->done = false; -acpi_ec_write_cmd (ec, ec->curr->command); -} -static void advance_transaction (struct acpi_ec *ec) { -unsigned long flags;struct transaction *t;u8 status; -spin_lock_irqsave (&ec->lock, flags);pr_debug ("===== %s =====\n" ,in_interrupt () ?"IRQ" :"TASK" ); status =acpi_ec_read_status (ec); t = ec->curr;if (!t) - goto unlock; -if (t->wlen > t->wi) { -if ((status &ACPI_EC_FLAG_IBF ) ==0 ) -acpi_ec_write_data (ec, - t->wdata[t->wi++]); -else - goto err; - }else if (t->rlen > t->ri) { -if ((status &ACPI_EC_FLAG_OBF ) ==1 ) { - t->rdata[t->ri++] =acpi_ec_read_data (ec); -if (t->rlen == t->ri) - t->done = true; + goto err; +if (t->flags &ACPI_EC_COMMAND_POLL ) { +if (t->wlen > t->wi) { +if ((status &ACPI_EC_FLAG_IBF ) ==0 ) +acpi_ec_write_data (ec, t->wdata[t->wi++]); +else + goto err; + }else if (t->rlen > t->ri) { +if ((status &ACPI_EC_FLAG_OBF ) ==1 ) { + t->rdata[t->ri++] =acpi_ec_read_data (ec); +if (t->rlen == t->ri) + t->flags |=ACPI_EC_COMMAND_COMPLETE ; + }else + goto err; + }else if (t->wlen == t->wi && + (status &ACPI_EC_FLAG_IBF ) ==0 ) + t->flags |=ACPI_EC_COMMAND_COMPLETE ; +return ; + }else { +if ((status &ACPI_EC_FLAG_IBF ) ==0 ) { +acpi_ec_write_cmd (ec, t->command); + t->flags |=ACPI_EC_COMMAND_POLL ; }else goto err; - }else if (t->wlen == t->wi && - (status &ACPI_EC_FLAG_IBF ) ==0 ) - t->done = true; - goto unlock; +return ; + } err:/* * If SCI bit is set, then don't think it's a false IRQ * otherwise will take a not handled IRQ as a false one. */ -if (in_interrupt () && !(status &ACPI_EC_FLAG_SCI )) - ++t->irq_count; +if (!(status &ACPI_EC_FLAG_SCI )) { +if (in_interrupt () && t) + ++t->irq_count; + } +} -unlock: -spin_unlock_irqrestore (&ec->lock, flags); +static void start_transaction (struct acpi_ec *ec) +{ + ec->curr->irq_count = ec->curr->wi = ec->curr->ri =0 ; + ec->curr->flags =0 ; +advance_transaction (ec); }static int acpi_ec_sync_query (struct acpi_ec *ec,u8 *data);
@@ -231,15 +239,17 @@ static int ec_poll(struct acpi_ec *ec)/* don't sleep with disabled interrupts */ if (EC_FLAGS_MSI ||irqs_disabled ()) {udelay (ACPI_EC_MSI_UDELAY ); -if (ec_transaction_done (ec)) +if (ec_transaction_completed (ec))return 0 ; }else {if (wait_event_timeout (ec->wait, -ec_transaction_done (ec), +ec_transaction_completed (ec),msecs_to_jiffies (1 )))return 0 ; } +spin_lock_irqsave (&ec->lock, flags);advance_transaction (ec); +spin_unlock_irqrestore (&ec->lock, flags); }while (time_before (jiffies, delay));pr_debug ("controller reset, restart transaction\n" );spin_lock_irqsave (&ec->lock, flags);
@@ -637,10 +647,13 @@ static int ec_check_sci(struct acpi_ec *static u32 acpi_ec_gpe_handler (acpi_handle gpe_device,u32 gpe_number,void *data) { +unsigned long flags;struct acpi_ec *ec = data; +spin_lock_irqsave (&ec->lock, flags);advance_transaction (ec); -if (ec_transaction_done (ec) && +spin_unlock_irqrestore (&ec->lock, flags); +if (ec_transaction_completed (ec) && (acpi_ec_read_status (ec) &ACPI_EC_FLAG_IBF ) ==0 ) {wake_up (&ec->wait);ec_check_sci (ec,acpi_ec_read_status (ec));
Greg Kroah-Hartman
maintainerPATCH 26/84 ACPI / EC: Remove duplicated ec_wait_ibf0() waiter
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lv Zheng <[email protected]>
commit 9b80f0f73ae1583c22325ede341c74195847618c upstream.
After we've added the first command byte write into advance_transaction(), the IBF=0 waiter is duplicated with the command completion waiter implemented in the ec_poll() because:
If IBF=1 blocked the first command byte write invoked in the task context ec_poll(), it would be kicked off upon IBF=0 interrupt or timed out and retried again in the task context.
Remove this seperate and duplicate IBF=0 waiter. By doing so we can reduce the overall number of times to access the EC_SC(R) status register.
--- drivers/acpi/ec.c | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-)
drivers/acpi/ec.c +1 -26
@@ -281,23 +281,6 @@ static int acpi_ec_transaction_unlocked(return ret; } -static int ec_check_ibf0 (struct acpi_ec *ec) -{ -u8 status =acpi_ec_read_status (ec); -return (status &ACPI_EC_FLAG_IBF ) ==0 ; -} - -static int ec_wait_ibf0 (struct acpi_ec *ec) -{ -unsigned long delay = jiffies +msecs_to_jiffies (ec_delay); -/* interrupt wait manually if GPE mode is not active */ -while (time_before (jiffies, delay)) -if (wait_event_timeout (ec->wait,ec_check_ibf0 (ec), -msecs_to_jiffies (1 ))) -return 0 ; -return -ETIME ; -} -static int acpi_ec_transaction (struct acpi_ec *ec,struct transaction *t) {int status;
@@ -318,12 +301,6 @@ static int acpi_ec_transaction(struct ac goto unlock; } } -if (ec_wait_ibf0 (ec)) { -pr_err ("input buffer is not empty, " -"aborting transaction\n" ); - status = -ETIME ; - goto end; - }pr_debug ("transaction start (cmd=0x%02x, addr=0x%02x)\n" , t->command, t->wdata ? t->wdata[0 ] :0 );/* disable GPE during transaction if storm is detected */
@@ -347,7 +324,6 @@ static int acpi_ec_transaction(struct acset_bit (EC_FLAGS_GPE_STORM , &ec->flags); }pr_debug ("transaction end\n" ); -end:if (ec->global_lock)acpi_release_global_lock (glk); unlock:
@@ -653,8 +629,7 @@ static u32 acpi_ec_gpe_handler(acpi_handspin_lock_irqsave (&ec->lock, flags);advance_transaction (ec);spin_unlock_irqrestore (&ec->lock, flags); -if (ec_transaction_completed (ec) && - (acpi_ec_read_status (ec) &ACPI_EC_FLAG_IBF ) ==0 ) { +if (ec_transaction_completed (ec)) {wake_up (&ec->wait);ec_check_sci (ec,acpi_ec_read_status (ec)); }
Greg Kroah-Hartman
maintainerPATCH 27/84 ACPI / EC: Fix race condition in ec_transaction_completed()
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lv Zheng <[email protected]>
commit c0d653412fc8450370167a3268b78fc772ff9c87 upstream.
There is a race condition in ec_transaction_completed().
When ec_transaction_completed() is called in the GPE handler, it could return true because of (ec->curr == NULL). Then the wake_up() invocation could complete the next command unexpectedly since there is no lock between the 2 invocations. With the previous cleanup, the IBF=0 waiter race need not be handled any more. It's now safe to return a flag from advance_condition() to indicate the requirement of wakeup, the flag is returned from a locked context.
The ec_transaction_completed() is now only invoked by the ec_poll() where the ec->curr is ensured to be different from NULL.
After cleaning up, the EVT_SCI=1 check should be moved out of the wakeup condition so that an EVT_SCI raised with (ec->curr == NULL) can trigger a QR_SC command.
--- drivers/acpi/ec.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-)
drivers/acpi/ec.c +17 -13
@@ -158,16 +158,17 @@ static int ec_transaction_completed(struunsigned long flags;int ret =0 ;spin_lock_irqsave (&ec->lock, flags); -if (!ec->curr || (ec->curr->flags &ACPI_EC_COMMAND_COMPLETE )) +if (ec->curr && (ec->curr->flags &ACPI_EC_COMMAND_COMPLETE )) ret =1 ;spin_unlock_irqrestore (&ec->lock, flags);return ret; } -static void advance_transaction (struct acpi_ec *ec) +static bool advance_transaction (struct acpi_ec *ec) {struct transaction *t;u8 status; +bool wakeup = false;pr_debug ("===== %s =====\n" ,in_interrupt () ?"IRQ" :"TASK" ); status =acpi_ec_read_status (ec);
@@ -183,21 +184,25 @@ static void advance_transaction(struct a }else if (t->rlen > t->ri) {if ((status &ACPI_EC_FLAG_OBF ) ==1 ) { t->rdata[t->ri++] =acpi_ec_read_data (ec); -if (t->rlen == t->ri) +if (t->rlen == t->ri) { t->flags |=ACPI_EC_COMMAND_COMPLETE ; + wakeup = true; + } }else goto err; }else if (t->wlen == t->wi && - (status &ACPI_EC_FLAG_IBF ) ==0 ) + (status &ACPI_EC_FLAG_IBF ) ==0 ) { t->flags |=ACPI_EC_COMMAND_COMPLETE ; -return ; + wakeup = true; + } +return wakeup; }else {if ((status &ACPI_EC_FLAG_IBF ) ==0 ) {acpi_ec_write_cmd (ec, t->command); t->flags |=ACPI_EC_COMMAND_POLL ; }else goto err; -return ; +return wakeup; } err:/*
@@ -208,13 +213,14 @@ err:if (in_interrupt () && t) ++t->irq_count; } +return wakeup; }static void start_transaction (struct acpi_ec *ec) { ec->curr->irq_count = ec->curr->wi = ec->curr->ri =0 ; ec->curr->flags =0 ; -advance_transaction (ec); + (void )advance_transaction (ec); }static int acpi_ec_sync_query (struct acpi_ec *ec,u8 *data);
@@ -248,7 +254,7 @@ static int ec_poll(struct acpi_ec *ec)return 0 ; }spin_lock_irqsave (&ec->lock, flags); -advance_transaction (ec); + (void )advance_transaction (ec);spin_unlock_irqrestore (&ec->lock, flags); }while (time_before (jiffies, delay));pr_debug ("controller reset, restart transaction\n" );
@@ -627,12 +633,10 @@ static u32 acpi_ec_gpe_handler(acpi_handstruct acpi_ec *ec = data;spin_lock_irqsave (&ec->lock, flags); -advance_transaction (ec); -spin_unlock_irqrestore (&ec->lock, flags); -if (ec_transaction_completed (ec)) { +if (advance_transaction (ec))wake_up (&ec->wait); -ec_check_sci (ec,acpi_ec_read_status (ec)); - } +spin_unlock_irqrestore (&ec->lock, flags); +ec_check_sci (ec,acpi_ec_read_status (ec));return ACPI_INTERRUPT_HANDLED |ACPI_REENABLE_GPE ; }
Greg Kroah-Hartman
maintainerPATCH 28/84 powerpc/kvm: Remove redundant save of SIER AND MMCR2
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joel Stanley <[email protected]>
commit f73128f4f680e8be68cda831f2710214559583cb upstream.
These two registers are already saved in the block above. Aside from being unnecessary, by the time we get down to the second save location r8 no longer contains MMCR2, so we are clobbering the saved value with PMC5.
MMCR2 primarily consists of counter freeze bits. So restoring the value of PMC5 into MMCR2 will most likely have the effect of freezing counters.
--- arch/powerpc/kvm/book3s_hv_interrupts.S | 5 ----- 1 file changed, 5 deletions(-)
arch/powerpc/kvm/book3s_hv_interrupts.S +0 -5
@@ -127,11 +127,6 @@ BEGIN_FTR_SECTION stw r10, HSTATE_PMC + 24(r13) stw r11, HSTATE_PMC + 28(r13) END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201) -BEGIN_FTR_SECTION - mfspr r9, SPRN_SIER - std r8, HSTATE_MMCR + 40(r13) - std r9, HSTATE_MMCR + 48(r13) -END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) 31: /*
Greg Kroah-Hartman
maintainerPATCH 29/84 powerpc/perf: Never program book3s PMCs with values >= 0x80000000
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Blanchard <[email protected]>
commit f56029410a13cae3652d1f34788045c40a13ffc7 upstream.
We are seeing a lot of PMU warnings on POWER8:
Can't find PMC that caused IRQ
Looking closer, the active PMC is 0 at this point and we took a PMU exception on the transition from negative to 0. Some versions of POWER8 have an issue where they edge detect and not level detect PMC overflows.
A number of places program the PMC with (0x80000000 - period_left), where period_left can be negative. We can either fix all of these or just ensure that period_left is always >= 1.
This patch takes the second option.
--- arch/powerpc/perf/core-book3s.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
arch/powerpc/perf/core-book3s.c +16 -1
@@ -996,7 +996,22 @@ static void power_pmu_read(struct perf_e }while (local64_cmpxchg (&event->hw.prev_count, prev, val) != prev);local64_add (delta, &event->count); -local64_sub (delta, &event->hw.period_left); + +/* +* A number of places program the PMC with (0x80000000 - period_left). +* We never want period_left to be less than 1 because we will program +* the PMC with a value >= 0x800000000 and an edge detected PMC will +* roll around to 0 before taking an exception. We have seen this +* on POWER8. +* +* To fix this, clamp the minimum value of period_left to 1. +*/ +do { + prev =local64_read (&event->hw.period_left); + val = prev - delta; +if (val <1 ) + val =1 ; + }while (local64_cmpxchg (&event->hw.period_left, prev, val) != prev); }/*
Greg Kroah-Hartman
maintainerPATCH 30/84 powerpc/perf: Add PPMU_ARCH_207S define
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joel Stanley <[email protected]>
commit 4d9690dd56b0d18f2af8a9d4a279cb205aae3345 upstream.
Instead of separate bits for every POWER8 PMU feature, have a single one for v2.07 of the architecture.
This saves us adding a MMCR2 define for a future patch.
--- arch/powerpc/include/asm/perf_event_server.h | 3 +-- arch/powerpc/perf/core-book3s.c | 6 +++--- arch/powerpc/perf/power8-pmu.c | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-)
arch/powerpc/include/asm/perf_event_server.h +1 -2
@@ -61,8 +61,7 @@ struct power_pmu {#define PPMU_SIAR_VALID 0x00000010/* Processor has SIAR Valid bit */ #define PPMU_HAS_SSLOT 0x00000020/* Has sampled slot in MMCRA */ #define PPMU_HAS_SIER 0x00000040/* Has SIER */ -#define PPMU_BHRB 0x00000080/* has BHRB feature enabled */ -#define PPMU_EBB 0x00000100/* supports event based branch */ +#define PPMU_ARCH_207S 0x00000080/* PMC is architecture v2.07S */ /* * Values for flags to get_alternatives()
arch/powerpc/perf/core-book3s.c +3 -3
@@ -485,7 +485,7 @@ static bool is_ebb_event(struct perf_eve* check that the PMU supports EBB, meaning those that don't can still * use bit 63 of the event code for something else if they wish. */ -return (ppmu->flags &PPMU_EBB ) && +return (ppmu->flags &PPMU_ARCH_207S ) && ((event->attr.config >>PERF_EVENT_CONFIG_EBB_SHIFT ) &1 ); }
@@ -777,7 +777,7 @@ void perf_event_print_debug(void)if (ppmu->flags &PPMU_HAS_SIER ) sier =mfspr (SPRN_SIER ); -if (ppmu->flags &PPMU_EBB ) { +if (ppmu->flags &PPMU_ARCH_207S ) {pr_info ("MMCR2: %016lx EBBHR: %016lx\n" ,mfspr (SPRN_MMCR2 ),mfspr (SPRN_EBBHR )); pr_info("EBBRR: %016lx BESCR: %016lx\n",
@@ -1711,7 +1711,7 @@ static int power_pmu_event_init(struct pif (has_branch_stack (event)) {/* PMU has BHRB enabled */ -if (!(ppmu->flags &PPMU_BHRB )) +if (!(ppmu->flags &PPMU_ARCH_207S ))return -EOPNOTSUPP ; }
arch/powerpc/perf/power8-pmu.c +1 -1
@@ -792,7 +792,7 @@ static struct power_pmu power8_pmu = { .get_constraint = power8_get_constraint, .get_alternatives = power8_get_alternatives, .disable_pmc = power8_disable_pmc, - .flags = PPMU_HAS_SSLOT | PPMU_HAS_SIER | PPMU_BHRB | PPMU_EBB, + .flags = PPMU_HAS_SSLOT | PPMU_HAS_SIER | PPMU_ARCH_207S, .n_generic = ARRAY_SIZE(power8_generic_events), .generic_events = power8_generic_events, .cache_events = &power8_cache_events,
Greg Kroah-Hartman
maintainerPATCH 31/84 powerpc/perf: Clear MMCR2 when enabling PMU
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joel Stanley <[email protected]>
commit b50a6c584bb47b370f84bfd746770c0bbe7129b7 upstream.
On POWER8 when switching to a KVM guest we set bits in MMCR2 to freeze the PMU counters. Aside from on boot they are then never reset, resulting in stuck perf counters for any user in the guest or host.
We now set MMCR2 to 0 whenever enabling the PMU, which provides a sane state for perf to use the PMU counters under either the guest or the host.
This was manifesting as a bug with ppc64_cpu --frequency:
$ sudo ppc64_cpu --frequency
WARNING: couldn't run on cpu 0
WARNING: couldn't run on cpu 8
...
WARNING: couldn't run on cpu 144
WARNING: couldn't run on cpu 152
min: 18446744073.710 GHz (cpu -1)
max: 0.000 GHz (cpu -1)
avg: 0.000 GHzThe command uses a perf counter to measure CPU cycles over a fixed amount of time, in order to approximate the frequency of the machine. The counters were returning zero once a guest was started, regardless of weather it was still running or had been shut down.
By dumping the value of MMCR2, it was observed that once a guest is running MMCR2 is set to 1s - which stops counters from running:
$ sudo sh -c 'echo p > /proc/sysrq-trigger'
CPU: 0 PMU registers, ppmu = POWER8 n_counters = 6
PMC1: 5b635e38 PMC2: 00000000 PMC3: 00000000 PMC4: 00000000
PMC5: 1bf5a646 PMC6: 5793d378 PMC7: deadbeef PMC8: deadbeef
MMCR0: 0000000080000000 MMCR1: 000000001e000000 MMCRA: 0000040000000000
MMCR2: fffffffffffffc00 EBBHR: 0000000000000000
EBBRR: 0000000000000000 BESCR: 0000000000000000
SIAR: 00000000000a51cc SDAR: c00000000fc40000 SIER: 0000000001000000This is done unconditionally in book3s_hv_interrupts.S upon entering the guest, and the original value is only save/restored if the host has indicated it was using the PMU. This is okay, however the user of the PMU needs to ensure that it is in a defined state when it starts using it.
--- arch/powerpc/perf/core-book3s.c | 3 +++ 1 file changed, 3 insertions(+)
arch/powerpc/perf/core-book3s.c +3 -0
@@ -1315,6 +1315,9 @@ static void power_pmu_enable(struct pmuwrite_mmcr0 (cpuhw, mmcr0); +if (ppmu->flags &PPMU_ARCH_207S ) +mtspr (SPRN_MMCR2 ,0 ); +/* * Enable instruction sampling if necessary */
Greg Kroah-Hartman
maintainerPATCH 32/84 cpufreq: Makefile: fix compilation for davinci platform
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prabhakar Lad <[email protected]>
commit 5a90af67c2126fe1d04ebccc1f8177e6ca70d3a9 upstream.
Since commtit 8a7b1227e303 (cpufreq: davinci: move cpufreq driver to drivers/cpufreq) this added dependancy only for CONFIG_ARCH_DAVINCI_DA850 where as davinci_cpufreq_init() call is used by all davinci platform.
This patch fixes following build error:
arch/arm/mach-davinci/built-in.o: In function `davinci_init_late':
:(.init.text+0x928): undefined reference to `davinci_cpufreq_init'
make: *** [vmlinux] Error 1
--- drivers/cpufreq/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/Makefile +1 -1
@@ -47,7 +47,7 @@ obj-$(CONFIG_ARM_BIG_LITTLE_CPUFREQ) += # LITTLE drivers, so that it is probed last. obj-$(CONFIG_ARM_DT_BL_CPUFREQ) += arm_big_little_dt.o -obj-$(CONFIG_ARCH_DAVINCI_DA850) += davinci-cpufreq.o +obj-$(CONFIG_ARCH_DAVINCI) += davinci-cpufreq.o obj-$(CONFIG_UX500_SOC_DB8500) += dbx500-cpufreq.o obj-$(CONFIG_ARM_EXYNOS_CPUFREQ) += exynos-cpufreq.o obj-$(CONFIG_ARM_EXYNOS4210_CPUFREQ) += exynos4210-cpufreq.o
Greg Kroah-Hartman
maintainerPATCH 33/84 crypto: sha512_ssse3 - fix byte count to bit count conversion
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jussi Kivilinna <[email protected]>
commit cfe82d4f45c7cc39332a2be7c4c1d3bf279bbd3d upstream.
Byte-to-bit-count computation is only partly converted to big-endian and is mixing in CPU-endian values. Problem was noticed by sparce with warning:
CHECK arch/x86/crypto/sha512_ssse3_glue.carch/x86/crypto/sha512_ssse3_glue.c:144:19: warning: restricted __be64 degrades to integer arch/x86/crypto/sha512_ssse3_glue.c:144:17: warning: incorrect type in assignment (different base types)arch/x86/crypto/sha512_ssse3_glue.c:144:17: expected restricted __be64 <noident>arch/x86/crypto/sha512_ssse3_glue.c:144:17: got unsigned long long
--- arch/x86/crypto/sha512_ssse3_glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/crypto/sha512_ssse3_glue.c +1 -1
@@ -141,7 +141,7 @@ static int sha512_ssse3_final(struct sha/* save number of bits */ bits[1 ] =cpu_to_be64 (sctx->count[0 ] <<3 ); - bits[0 ] =cpu_to_be64 (sctx->count[1 ] <<3 ) | sctx->count[0 ] >>61 ; + bits[0 ] =cpu_to_be64 (sctx->count[1 ] <<3 | sctx->count[0 ] >>61 );/* Pad out to 112 mod 128 and append length */ index = sctx->count[0 ] &0x7f ;
Greg Kroah-Hartman
maintainerPATCH 34/84 crypto: caam - fix memleak in caam_jr module
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cristian Stoica <[email protected]>
commit 0378c9a855bfa395f595fbfb049707093e270f69 upstream.
This patch fixes a memory leak that appears when caam_jr module is unloaded.
--- drivers/crypto/caam/jr.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/crypto/caam/jr.c +3 -5
@@ -453,8 +453,8 @@ static int caam_jr_probe(struct platformint error; jrdev = &pdev->dev; - jrpriv =kmalloc (sizeof (struct caam_drv_private_jr ), -GFP_KERNEL ); + jrpriv =devm_kmalloc (jrdev,sizeof (struct caam_drv_private_jr ), +GFP_KERNEL );if (!jrpriv)return -ENOMEM ;
@@ -487,10 +487,8 @@ static int caam_jr_probe(struct platform/* Now do the platform independent part */ error =caam_jr_init (jrdev);/* now turn on hardware */ -if (error) { -kfree (jrpriv); +if (error)return error; - } jrpriv->dev = jrdev;spin_lock (&driver_data.jr_alloc_lock);
Greg Kroah-Hartman
maintainerPATCH 35/84 arm64: implement TASK_SIZE_OF
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Cross <[email protected]>
commit fa2ec3ea10bd377f9d55772b1dab65178425a1a2 upstream.
include/linux/sched.h implements TASK_SIZE_OF as TASK_SIZE if it is not set by the architecture headers. TASK_SIZE uses the current task to determine the size of the virtual address space. On a 64-bit kernel this will cause reading /proc/pid/pagemap of a 64-bit process from a 32-bit process to return EOF when it reads past 0xffffffff.
Implement TASK_SIZE_OF exactly the same as TASK_SIZE with test_tsk_thread_flag instead of test_thread_flag.
--- arch/arm64/include/asm/memory.h | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/include/asm/memory.h +2 -0
@@ -56,6 +56,8 @@#define TASK_SIZE_32 UL(0x100000000)#define TASK_SIZE (test_thread_flag(TIF_32BIT) ? \ TASK_SIZE_32 : TASK_SIZE_64) +#define TASK_SIZE_OF (tsk) (test_tsk_thread_flag(tsk, TIF_32BIT) ? \ + TASK_SIZE_32 : TASK_SIZE_64)#else #define TASK_SIZE TASK_SIZE_64#endif /* CONFIG_COMPAT */
Greg Kroah-Hartman
maintainerPATCH 36/84 phy: core: Fix error path in phy_create()
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roger Quadros <[email protected]>
commit e73b49f1c4e75c44d62585cc3e5b9c7894b61c32 upstream.
Prevent resources from being freed twice in case device_add() call fails within phy_create(). Also use ida_simple_remove() instead of ida_remove() as we had used ida_simple_get() to allocate the ida.
--- drivers/phy/phy-core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/phy/phy-core.c +4 -3
@@ -614,8 +614,9 @@ struct phy *phy_create(struct device *dereturn phy; put_dev: -put_device (&phy->dev); -ida_remove (&phy_ida, phy->id); +put_device (&phy->dev);/* calls phy_release() which frees resources */ +return ERR_PTR (ret); + free_phy:kfree (phy);return ERR_PTR (ret);
@@ -799,7 +800,7 @@ static void phy_release(struct device *d phy =to_phy (dev);dev_vdbg (dev,"releasing '%s'\n" ,dev_name (dev)); -ida_remove (&phy_ida, phy->id); +ida_simple_remove (&phy_ida, phy->id);kfree (phy); }
Greg Kroah-Hartman
maintainerPATCH 37/84 clk: spear3xx: Use proper control register offset
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit 15ebb05248d025534773c9ef64915bd888f04e4b upstream.
The control register is at offset 0x10, not 0x0. This is wreckaged since commit 5df33a62c (SPEAr: Switch to common clock framework).
--- drivers/clk/spear/spear3xx_clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/spear/spear3xx_clock.c +1 -1
@@ -211,7 +211,7 @@ static inline void spear310_clk_init(voi/* array of all spear 320 clock lookups */ #ifdef CONFIG_MACH_SPEAR320 -#define SPEAR320_CONTROL_REG (soc_config_base + 0x0000) +#define SPEAR320_CONTROL_REG (soc_config_base + 0x0010)#define SPEAR320_EXT_CTRL_REG (soc_config_base + 0x0018)#define SPEAR320_UARTX_PCLK_MASK 0x1
Greg Kroah-Hartman
maintainerPATCH 38/84 clk: s2mps11: Fix double free corruption during driver unbind
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 2a96dfa49c83a2a7cbdb11382976aaa6b2636764 upstream.
After unbinding the driver memory was corrupted by double free of clk_lookup structure. This lead to OOPS when re-binding the driver again.
The driver allocated memory for 'clk_lookup' with devm_kzalloc. During driver removal this memory was freed twice: once by clkdev_drop() and second by devm code.
Kernel panic log: [ 30.839284] Unable to handle kernel paging request at virtual address 5f343173 [ 30.846476] pgd = dee14000 [ 30.849165] [5f343173] *pgd=00000000 [ 30.852703] Internal error: Oops: 805 [#1] PREEMPT SMP ARM [ 30.858166] Modules linked in: [ 30.861208] CPU: 0 PID: 1 Comm: bash Not tainted 3.16.0-rc2-00239-g94bdf617b07e-dirty #40 [ 30.869364] task: df478000 ti: df480000 task.ti: df480000 [ 30.874752] PC is at clkdev_add+0x2c/0x38 [ 30.878738] LR is at clkdev_add+0x18/0x38 [ 30.882732] pc : [<c0350908>] lr : [<c03508f4>] psr: 60000013 [ 30.882732] sp : df481e78 ip : 00000001 fp : c0700ed8 [ 30.894187] r10: 0000000c r9 : 00000000 r8 : c07b0e3c [ 30.899396] r7 : 00000002 r6 : df45f9d0 r5 : df421390 r4 : c0700d6c [ 30.905906] r3 : 5f343173 r2 : c0700d84 r1 : 60000013 r0 : c0700d6c [ 30.912417] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user [ 30.919534] Control: 10c53c7d Table: 5ee1406a DAC: 00000015 [ 30.925262] Process bash (pid: 1, stack limit = 0xdf480240) [ 30.930817] Stack: (0xdf481e78 to 0xdf482000) [ 30.935159] 1e60: 00001000 df6de610 [ 30.943321] 1e80: df7f4558 c0355650 c05ec6ec c0700eb0 df6de600 df7f4510 dec9d69c 00000014 [ 30.951480] 1ea0: 00167b48 df6de610 c0700e30 c0713518 00000000 c0700e30 dec9d69c 00000006 [ 30.959639] 1ec0: 00167b48 c02c1b7c c02c1b64 df6de610 c07aff48 c02c0420 c06fb150 c047cc20 [ 30.967798] 1ee0: df6de610 df6de610 c0700e30 df6de644 c06fb150 0000000c dec9d690 c02bef90 [ 30.975957] 1f00: dec9c6c0 dece4c00 df481f80 dece4c00 0000000c c02be73c 0000000c c016ca8c [ 30.984116] 1f20: c016ca48 00000000 00000000 c016c1f4 00000000 00000000 b6f18000 df481f80 [ 30.992276] 1f40: df7f66c0 0000000c df480000 df480000 b6f18000 c011094c df47839c 60000013 [ 31.000435] 1f60: 00000000 00000000 df7f66c0 df7f66c0 0000000c df480000 b6f18000 c0110dd4 [ 31.008594] 1f80: 00000000 00000000 0000000c b6ec05d8 0000000c b6f18000 00000004 c000f2a8 [ 31.016753] 1fa0: 00001000 c000f0e0 b6ec05d8 0000000c 00000001 b6f18000 0000000c 00000000 [ 31.024912] 1fc0: b6ec05d8 0000000c b6f18000 00000004 0000000c 00000001 00000000 00167b48 [ 31.033071] 1fe0: 00000000 bed83a80 b6e004f0 b6e5122c 60000010 00000001 ffffffff ffffffff [ 31.041248] [<c0350908>] (clkdev_add) from [<c0355650>] (s2mps11_clk_probe+0x2b4/0x3b4) [ 31.049223] [<c0355650>] (s2mps11_clk_probe) from [<c02c1b7c>] (platform_drv_probe+0x18/0x48) [ 31.057728] [<c02c1b7c>] (platform_drv_probe) from [<c02c0420>] (driver_probe_device+0x13c/0x384) [ 31.066579] [<c02c0420>] (driver_probe_device) from [<c02bef90>] (bind_store+0x88/0xd8) [ 31.074564] [<c02bef90>] (bind_store) from [<c02be73c>] (drv_attr_store+0x20/0x2c) [ 31.082118] [<c02be73c>] (drv_attr_store) from [<c016ca8c>] (sysfs_kf_write+0x44/0x48) [ 31.090016] [<c016ca8c>] (sysfs_kf_write) from [<c016c1f4>] (kernfs_fop_write+0xc0/0x17c) [ 31.098176] [<c016c1f4>] (kernfs_fop_write) from [<c011094c>] (vfs_write+0xa0/0x1c4) [ 31.105899] [<c011094c>] (vfs_write) from [<c0110dd4>] (SyS_write+0x40/0x8c) [ 31.112931] [<c0110dd4>] (SyS_write) from [<c000f0e0>] (ret_fast_syscall+0x0/0x3c) [ 31.120481] Code: e2842018 e584501c e1a00004 e885000c (e5835000) [ 31.126596] ---[ end trace efad45bfa3a61b05 ]--- [ 31.131181] Kernel panic - not syncing: Fatal exception [ 31.136368] CPU1: stopping [ 31.139054] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G D 3.16.0-rc2-00239-g94bdf617b07e-dirty #40 [ 31.148697] [<c0016480>] (unwind_backtrace) from [<c0012950>] (show_stack+0x10/0x14) [ 31.156419] [<c0012950>] (show_stack) from [<c0480db8>] (dump_stack+0x80/0xcc) [ 31.163622] [<c0480db8>] (dump_stack) from [<c001499c>] (handle_IPI+0x130/0x15c) [ 31.170998] [<c001499c>] (handle_IPI) from [<c000862c>] (gic_handle_irq+0x60/0x68) [ 31.178549] [<c000862c>] (gic_handle_irq) from [<c0013480>] (__irq_svc+0x40/0x70) [ 31.186009] Exception stack(0xdf4bdf88 to 0xdf4bdfd0) [ 31.191046] df80: ffffffed 00000000 00000000 00000000 df4bc000 c06d042c [ 31.199207] dfa0: 00000000 ffffffed c06d03c0 00000000 c070c288 00000000 00000000 df4bdfd0 [ 31.207363] dfc0: c0010324 c0010328 60000013 ffffffff [ 31.212402] [<c0013480>] (__irq_svc) from [<c0010328>] (arch_cpu_idle+0x28/0x30) [ 31.219783] [<c0010328>] (arch_cpu_idle) from [<c005f150>] (cpu_startup_entry+0x2c4/0x3f0) [ 31.228027] [<c005f150>] (cpu_startup_entry) from [<400086c4>] (0x400086c4) [ 31.234968] ---[ end Kernel panic - not syncing: Fatal exception
--- drivers/clk/clk-s2mps11.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/clk/clk-s2mps11.c +2 -5
@@ -206,16 +206,13 @@ static int s2mps11_clk_probe(struct plat goto err_reg; } - s2mps11_clk->lookup =devm_kzalloc (&pdev->dev, -sizeof (struct clk_lookup ),GFP_KERNEL ); + s2mps11_clk->lookup =clkdev_alloc (s2mps11_clk->clk, +s2mps11_name (s2mps11_clk),NULL );if (!s2mps11_clk->lookup) { ret = -ENOMEM ; goto err_lup; } - s2mps11_clk->lookup->con_id =s2mps11_name (s2mps11_clk); - s2mps11_clk->lookup->clk = s2mps11_clk->clk; -clkdev_add (s2mps11_clk->lookup); }
Greg Kroah-Hartman
maintainerPATCH 39/84 clk: qcom: HDMI source sel is 3 not 2
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Boyd <[email protected]>
commit c556bcddc78096caeb46dbe3ad0314dd951f1665 upstream.
The HDMI PLL input to the tv mux is supposed to be 3, not 2. Fix the code so that we can properly select the HDMI PLL.
--- drivers/clk/qcom/mmcc-msm8960.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/mmcc-msm8960.c +1 -1
@@ -1208,7 +1208,7 @@ static struct clk_branch rot_clk = {static u8 mmcc_pxo_hdmi_map[] = { [P_PXO ] =0 , - [P_HDMI_PLL ] =2 , + [P_HDMI_PLL ] =3 , };static const char *mmcc_pxo_hdmi[] = {
Greg Kroah-Hartman
maintainerPATCH 40/84 Drivers: hv: vmbus: Fix a bug in the channel callback dispatch code
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: "K. Y. Srinivasan" <[email protected]>
commit affb1aff300ddee54df307812b38f166e8a865ef upstream.
Starting with Win8, we have implemented several optimizations to improve the scalability and performance of the VMBUS transport between the Host and the Guest. Some of the non-performance critical services cannot leverage these optimization since they only read and process one message at a time. Make adjustments to the callback dispatch code to account for the way non-performance critical drivers handle reading of the channel.
--- drivers/hv/connection.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/hv/connection.c +6 -2
@@ -319,9 +319,13 @@ static void process_chn_event(u32 relid)*/ do { -hv_begin_read (&channel->inbound); +if (read_state) +hv_begin_read (&channel->inbound); channel->onchannel_callback (arg); - bytes_to_read =hv_end_read (&channel->inbound); +if (read_state) + bytes_to_read =hv_end_read (&channel->inbound); +else + bytes_to_read =0 ; }while (read_state && (bytes_to_read !=0 )); }else {pr_err ("no channel callback for relid - %u\n" , relid);
Greg Kroah-Hartman
maintainerPATCH 41/84 dm mpath: fix IO hang due to logic bug in multipath_busy
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jun'ichi Nomura <[email protected]>
commit 7a7a3b45fed9a144dbf766ee842a4c5d0632b81d upstream.
Commit e80991773 ("dm mpath: push back requests instead of queueing") modified multipath_busy() to return true if !pg_ready(). pg_ready() checks the current state of the multipath device and may return false even if a new IO is needed to change the state.
Bart Van Assche reported that he had multipath IO lockup when he was performing cable pull tests. Analysis showed that the multipath device had a single path group with both paths active, but that the path group itself was not active. During the multipath device state transitions 'queue_io' got set but nothing could clear it. Clearing 'queue_io' only happens in __choose_pgpath(), but it won't be called if multipath_busy() returns true due to pg_ready() returning false when 'queue_io' is set.
As such the !pg_ready() check in multipath_busy() is wrong because new IO will not be sent to multipath target and the multipath state change won't happen. That results in multipath IO lockup.
The intent of multipath_busy() is to avoid unnecessary cycles of dequeue + request_fn + requeue if it is known that the multipath device will requeue.
Such "busy" situations would be:
- path group is being activated
- there is no path and the multipath is setup to requeue if no path
Fix multipath_busy() to return "busy" early only for these specific situations.
--- drivers/md/dm-mpath.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/md/dm-mpath.c +3 -2
@@ -1620,8 +1620,9 @@ static int multipath_busy(struct dm_targspin_lock_irqsave (&m->lock, flags); -/* pg_init in progress, requeue until done */ -if (!pg_ready (m)) { +/* pg_init in progress or no paths available */ +if (m->pg_init_in_progress || + (!m->nr_valid_paths && m->queue_if_no_path)) { busy =1 ; goto out; }
Greg Kroah-Hartman
maintainerPATCH 42/84 dm io: fix a race condition in the wake up code for sync_io
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Thornber <[email protected]>
commit 10f1d5d111e8aed46a0f1179faf9a3cf422f689e upstream.
There's a race condition between the atomic_dec_and_test(&io->count) in dec_count() and the waking of the sync_io() thread. If the thread is spuriously woken immediately after the decrement it may exit, making the on stack io struct invalid, yet the dec_count could still be using it.
Fix this race by using a completion in sync_io() and dec_count().
--- drivers/md/dm-io.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-)
drivers/md/dm-io.c +8 -14
@@ -10,6 +10,7 @@#include <linux/device-mapper.h> #include <linux/bio.h> +#include <linux/completion.h> #include <linux/mempool.h> #include <linux/module.h> #include <linux/sched.h>
@@ -32,7 +33,7 @@ struct dm_io_client {struct io {unsigned long error_bits;atomic_t count; -struct task_struct *sleeper; +struct completion *wait;struct dm_io_client *client;io_notify_fn callback;void *context;
@@ -121,8 +122,8 @@ static void dec_count(struct io *io, unsinvalidate_kernel_vmap_range (io->vma_invalidate_address, io->vma_invalidate_size); -if (io->sleeper) -wake_up_process (io->sleeper); +if (io->wait) +complete (io->wait);else {unsigned long r = io->error_bits;
@@ -387,6 +388,7 @@ static int sync_io(struct dm_io_client **/ volatile char io_[sizeof (struct io ) + __alignof__(struct io ) -1 ];struct io *io = (struct io *)PTR_ALIGN (&io_, __alignof__(struct io )); +DECLARE_COMPLETION_ONSTACK (wait);if (num_regions >1 && (rw &RW_MASK ) !=WRITE ) {WARN_ON (1 );
@@ -395,7 +397,7 @@ static int sync_io(struct dm_io_client * io->error_bits =0 ;atomic_set (&io->count,1 );/* see dispatch_io() */ - io->sleeper = current; + io->wait = &wait; io->client = client; io->vma_invalidate_address = dp->vma_invalidate_address;
@@ -403,15 +405,7 @@ static int sync_io(struct dm_io_client *dispatch_io (rw, num_regions, where, dp, io,1 ); -while (1 ) { -set_current_state (TASK_UNINTERRUPTIBLE ); - -if (!atomic_read (&io->count)) -break ; - -io_schedule (); - } -set_current_state (TASK_RUNNING ); +wait_for_completion_io (&wait);if (error_bits) *error_bits = io->error_bits;
@@ -434,7 +428,7 @@ static int async_io(struct dm_io_client io =mempool_alloc (client->pool,GFP_NOIO ); io->error_bits =0 ;atomic_set (&io->count,1 );/* see dispatch_io() */ - io->sleeper =NULL ; + io->wait =NULL ; io->client = client; io->callback = fn; io->context = context;
Greg Kroah-Hartman
maintainerPATCH 43/84 dm: allocate a special workqueue for deferred device removal
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit acfe0ad74d2e1bfc81d1d7bf5e15b043985d3650 upstream.
The commit 2c140a246dc ("dm: allow remove to be deferred") introduced a deferred removal feature for the device mapper. When this feature is used (by passing a flag DM_DEFERRED_REMOVE to DM_DEV_REMOVE_CMD ioctl) and the user tries to remove a device that is currently in use, the device will be removed automatically in the future when the last user closes it.
Device mapper used the system workqueue to perform deferred removals. However, some targets (dm-raid1, dm-mpath, dm-stripe) flush work items scheduled for the system workqueue from their destructor. If the destructor itself is called from the system workqueue during deferred removal, it introduces a possible deadlock - the workqueue tries to flush itself.
Fix this possible deadlock by introducing a new workqueue for deferred removals. We allocate just one workqueue for all dm targets. The ability of dm targets to process IOs isn't dependent on deferred removal of unused targets, so a deadlock due to shared workqueue isn't possible.
Also, cleanup local_init() to eliminate potential for returning success on failure.
--- drivers/md/dm.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/md/dm.c +13 -2
@@ -54,6 +54,8 @@ static void do_deferred_remove(struct wo static DECLARE_WORK(deferred_remove_work, do_deferred_remove); +static struct workqueue_struct *deferred_remove_workqueue; +/* * For bio-based dm. * One of these is allocated per bio.
@@ -276,16 +278,24 @@ static int __init local_init(void)if (r) goto out_free_rq_tio_cache; + deferred_remove_workqueue =alloc_workqueue ("kdmremove" ,WQ_UNBOUND ,1 ); +if (!deferred_remove_workqueue) { + r = -ENOMEM ; + goto out_uevent_exit; + } + _major = major; r =register_blkdev (_major, _name);if (r <0 ) - goto out_uevent_exit; + goto out_free_workqueue;if (!_major) _major = r;return 0 ; +out_free_workqueue: +destroy_workqueue (deferred_remove_workqueue); out_uevent_exit:dm_uevent_exit (); out_free_rq_tio_cache:
@@ -299,6 +309,7 @@ out_free_io_cache:static void local_exit (void ) {flush_scheduled_work (); +destroy_workqueue (deferred_remove_workqueue);kmem_cache_destroy (_rq_tio_cache);kmem_cache_destroy (_io_cache);
@@ -407,7 +418,7 @@ static void dm_blk_close(struct gendiskif (atomic_dec_and_test (&md->open_count) && (test_bit (DMF_DEFERRED_REMOVE , &md->flags))) -schedule_work (&deferred_remove_work); +queue_work (deferred_remove_workqueue, &deferred_remove_work);dm_put (md);
Greg Kroah-Hartman
maintainerPATCH 44/84 intel_pstate: Fix setting VID
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dirk Brandewie <[email protected]>
commit c16ed06024a6e699c332831dd50d8276744e3de8 upstream.
Commit 21855ff5 (intel_pstate: Set turbo VID for BayTrail) introduced setting the turbo VID which is required to prevent a machine check on some Baytrail SKUs under heavy graphics based workloads. The docmumentation update that brought the requirement to light also changed the bit mask used for enumerating P state and VID values from 0x7f to 0x3f.
This change returns the mask value to 0x7f.
Tested with the Intel NUC DN2820FYK,
BIOS version FYBYT10H.86A.0034.2014.0513.1413 with v3.16-rc1 and v3.14.8 kernel versions.
--- drivers/cpufreq/intel_pstate.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/cpufreq/intel_pstate.c +5 -5
@@ -361,21 +361,21 @@ static int byt_get_min_pstate(void) {u64 value;rdmsrl (BYT_RATIOS , value); -return (value >>8 ) &0x3F ; +return (value >>8 ) &0x7F ; }static int byt_get_max_pstate (void ) {u64 value;rdmsrl (BYT_RATIOS , value); -return (value >>16 ) &0x3F ; +return (value >>16 ) &0x7F ; }static int byt_get_turbo_pstate (void ) {u64 value;rdmsrl (BYT_TURBO_RATIOS , value); -return value &0x3F ; +return value &0x7F ; }static void byt_set_pstate (struct cpudata *cpudata,int pstate)
@@ -409,8 +409,8 @@ static void byt_get_vid(struct cpudata *rdmsrl (BYT_VIDS , value); - cpudata->vid.min =int_tofp ((value >>8 ) &0x3f ); - cpudata->vid.max =int_tofp ((value >>16 ) &0x3f ); + cpudata->vid.min =int_tofp ((value >>8 ) &0x7f ); + cpudata->vid.max =int_tofp ((value >>16 ) &0x7f ); cpudata->vid.ratio = div_fp( cpudata->vid.max - cpudata->vid.min, int_tofp(cpudata->pstate.max_pstate -
Greg Kroah-Hartman
maintainerPATCH 45/84 intel_pstate: dont touch turbo bit if turbo disabled or unavailable.
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dirk Brandewie <[email protected]>
commit dd5fbf70f96dbfd7ee432096a1f979b2b3267856 upstream.
If turbo is disabled in the BIOS bit 38 should be set in MSR_IA32_MISC_ENABLE register per section 14.3.2.1 of the SDM Vol 3 document 325384-050US Feb 2014. If this bit is set do *not* attempt to disable trubo via the MSR_IA32_PERF_CTL register. On some systems trying to disable turbo via MSR_IA32_PERF_CTL will cause subsequent writes to MSR_IA32_PERF_CTL not take affect, in fact reading MSR_IA32_PERF_CTL will not show the IDA/Turbo DISENGAGE bit(32) as set. A write of bit 32 to zero returns to normal operation.
Also deal with the case where the processor does not support turbo and the BIOS does not report the fact in MSR_IA32_MISC_ENABLE but does report the max and turbo P states as the same value.
--- drivers/cpufreq/intel_pstate.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
drivers/cpufreq/intel_pstate.c +16 -6
@@ -132,6 +132,7 @@ static struct pstate_funcs pstate_funcs;struct perf_limits {int no_turbo; +int turbo_disabled;int max_perf_pct;int min_perf_pct;int32_t max_perf;
@@ -291,7 +292,10 @@ static ssize_t store_no_turbo(struct kobif (ret !=1 )return -EINVAL ; limits.no_turbo =clamp_t (int, input,0 ,1 ); - +if (limits.turbo_disabled) { +pr_warn ("Turbo disabled by BIOS or unavailable on processor\n" ); + limits.no_turbo = limits.turbo_disabled; + }return count; }
@@ -385,7 +389,7 @@ static void byt_set_pstate(struct cpudatu32 vid; val = pstate <<8 ; -if (limits.no_turbo) +if (limits.no_turbo && !limits.turbo_disabled) val |= (u64 )1 <<32 ; vid_fp = cpudata->vid.min + mul_fp(
@@ -452,7 +456,7 @@ static void core_set_pstate(struct cpudau64 val; val = pstate <<8 ; -if (limits.no_turbo) +if (limits.no_turbo && !limits.turbo_disabled) val |= (u64 )1 <<32 ;wrmsrl_on_cpu (cpudata->cpu,MSR_IA32_PERF_CTL , val);
@@ -750,7 +754,7 @@ static int intel_pstate_set_policy(struc limits.min_perf =int_tofp (1 ); limits.max_perf_pct =100 ; limits.max_perf =int_tofp (1 ); - limits.no_turbo =0 ; + limits.no_turbo = limits.turbo_disabled;return 0 ; } limits.min_perf_pct = (policy->min *100 ) / policy->cpuinfo.max_freq;
@@ -793,6 +797,7 @@ static int intel_pstate_cpu_init(struct {struct cpudata *cpu;int rc; +u64 misc_en; rc =intel_pstate_init_cpu (policy->cpu);if (rc)
@@ -800,8 +805,13 @@ static int intel_pstate_cpu_init(struct cpu = all_cpu_data[policy->cpu]; -if (!limits.no_turbo && - limits.min_perf_pct ==100 && limits.max_perf_pct ==100 ) +rdmsrl (MSR_IA32_MISC_ENABLE , misc_en); +if (misc_en &MSR_IA32_MISC_ENABLE_TURBO_DISABLE || + cpu->pstate.max_pstate == cpu->pstate.turbo_pstate) { + limits.turbo_disabled =1 ; + limits.no_turbo =1 ; + } +if (limits.min_perf_pct ==100 && limits.max_perf_pct ==100 ) policy->policy =CPUFREQ_POLICY_PERFORMANCE ;else policy->policy =CPUFREQ_POLICY_POWERSAVE ;
Greg Kroah-Hartman
maintainerPATCH 46/84 intel_pstate: Update documentation of {max,min}_perf_pct sysfs files
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dirk Brandewie <[email protected]>
commit 41629a8233470325bfbb60377f555f9e8acc879f upstream.
Update documentation to make the interpretation of the values clearer
--- Documentation/cpu-freq/intel-pstate.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
Documentation/cpu-freq/intel-pstate.txt +5 -2
@@ -15,10 +15,13 @@ New sysfs files for controlling P state /sys/devices/system/cpu/intel_pstate/ max_perf_pct: limits the maximum P state that will be requested by - the driver stated as a percentage of the available performance. + the driver stated as a percentage of the available performance. The + available (P states) performance may be reduced by the no_turbo + setting described below. min_perf_pct: limits the minimum P state that will be requested by - the driver stated as a percentage of the available performance. + the driver stated as a percentage of the max (non-turbo) + performance level. no_turbo: limits the driver to selecting P states below the turbo frequency range.
Greg Kroah-Hartman
maintainerPATCH 47/84 intel_pstate: Set CPU number before accessing MSRs
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vincent Minet <[email protected]>
commit 179e8471673ce0249cd4ecda796008f7757e5bad upstream.
Ensure that cpu->cpu is set before writing MSR_IA32_PERF_CTL during CPU initialization. Otherwise only cpu0 has its P-state set and all other cores are left with their values unchanged.
In most cases, this is not too serious because the P-states will be set correctly when the timer function is run. But when the default governor is set to performance, the per-CPU current_pstate stays the same forever and no attempts are made to write the MSRs again.
--- drivers/cpufreq/intel_pstate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/cpufreq/intel_pstate.c +1 -2
@@ -709,9 +709,8 @@ static int intel_pstate_init_cpu(unsigne cpu = all_cpu_data[cpunum]; -intel_pstate_get_cpu_pstates (cpu); - cpu->cpu = cpunum; +intel_pstate_get_cpu_pstates (cpu);init_timer_deferrable (&cpu->timer); cpu->timer.function = intel_pstate_timer_func;
Greg Kroah-Hartman
maintainerPATCH 48/84 PCI: Fix unaligned access in AF transaction pending test
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Williamson <[email protected]>
commit d066c946a866268c14a120b33e7226e899981998 upstream.
pci_wait_for_pending() uses word access, so we shouldn't be passing an offset that is only byte aligned. Use the control register offset instead, shifting the mask to match.
--- drivers/pci/pci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/pci/pci.c +7 -2
@@ -3109,8 +3109,13 @@ static int pci_af_flr(struct pci_dev *deif (probe)return 0 ; -/* Wait for Transaction Pending bit clean */ -if (pci_wait_for_pending (dev, pos +PCI_AF_STATUS ,PCI_AF_STATUS_TP )) +/* +* Wait for Transaction Pending bit to clear. A word-aligned test +* is used, so we use the conrol offset rather than status and shift +* the test bit to match. +*/ +if (pci_wait_for_pending (dev, pos +PCI_AF_CTRL , +PCI_AF_STATUS_TP <<8 )) goto clear; dev_err(&dev->dev, "transaction is not cleared; "
Greg Kroah-Hartman
maintainerPATCH 49/84 ext4: fix unjournalled bg descriptor while initializing inode bitmap
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 61c219f5814277ecb71d64cb30297028d6665979 upstream.
The first time that we allocate from an uninitialized inode allocation bitmap, if the block allocation bitmap is also uninitalized, we need to get write access to the block group descriptor before we start modifying the block group descriptor flags and updating the free block count, etc. Otherwise, there is the potential of a bad journal checksum (if journal checksums are enabled), and of the file system becoming inconsistent if we crash at exactly the wrong time.
--- fs/ext4/ialloc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
fs/ext4/ialloc.c +7 -7
@@ -851,6 +851,13 @@ got: goto out; } +BUFFER_TRACE (group_desc_bh,"get_write_access" ); + err =ext4_journal_get_write_access (handle, group_desc_bh); +if (err) { +ext4_std_error (sb, err); + goto out; + } +/* We may have to initialize the block bitmap if it isn't already */ if (ext4_has_group_desc_csum (sb) && gdp->bg_flags &cpu_to_le16 (EXT4_BG_BLOCK_UNINIT )) {
@@ -887,13 +894,6 @@ got: } } -BUFFER_TRACE (group_desc_bh,"get_write_access" ); - err =ext4_journal_get_write_access (handle, group_desc_bh); -if (err) { -ext4_std_error (sb, err); - goto out; - } -/* Update the relevant bg descriptor fields */ if (ext4_has_group_desc_csum (sb)) {int free;
Greg Kroah-Hartman
maintainerPATCH 50/84 ext4: clarify error count warning messages
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit ae0f78de2c43b6fadd007c231a352b13b5be8ed2 upstream.
Make it clear that values printed are times, and that it is error since last fsck. Also add note about fsck version required.
--- fs/ext4/super.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/ext4/super.c +4 -3
@@ -2798,10 +2798,11 @@ static void print_daily_error_info(unsig es = sbi->s_es;if (es->s_error_count) -ext4_msg (sb,KERN_NOTICE ,"error count: %u" , +/* fsck newer than v1.41.13 is needed to clean this condition. */ +ext4_msg (sb,KERN_NOTICE ,"error count since last fsck: %u" ,le32_to_cpu (es->s_error_count));if (es->s_first_error_time) { - printk(KERN_NOTICE "EXT4-fs (%s): initial error at %u: %.*s:%d", + printk(KERN_NOTICE "EXT4-fs (%s): initial error at time %u: %.*s:%d", sb->s_id, le32_to_cpu(es->s_first_error_time), (int) sizeof(es->s_first_error_func), es->s_first_error_func,
@@ -2815,7 +2816,7 @@ static void print_daily_error_info(unsigprintk ("\n" ); }if (es->s_last_error_time) { - printk(KERN_NOTICE "EXT4-fs (%s): last error at %u: %.*s:%d", + printk(KERN_NOTICE "EXT4-fs (%s): last error at time %u: %.*s:%d", sb->s_id, le32_to_cpu(es->s_last_error_time), (int) sizeof(es->s_last_error_func), es->s_last_error_func,
Greg Kroah-Hartman
maintainerPATCH 51/84 ext4: clarify ext4_error message in ext4_mb_generate_buddy_error()
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 94d4c066a4ff170a2671b1a9b153febbf36796f6 upstream.
We are spending a lot of time explaining to users what this error means. Let's try to improve the message to avoid this problem.
--- fs/ext4/mballoc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ext4/mballoc.c +2 -2
@@ -751,8 +751,8 @@ void ext4_mb_generate_buddy(struct superif (free != grp->bb_free) {ext4_grp_locked_error (sb, group,0 ,0 , -"%u clusters in bitmap, %u in gd; " -"block bitmap corrupt." , +"block bitmap and bg descriptor " +"inconsistent: %u vs %u free clusters" , free, grp->bb_free);/* * If we intend to continue, we consider group descriptor
Greg Kroah-Hartman
maintainerPATCH 52/84 ext4: disable synchronous transaction batching if max_batch_time==0
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Sandeen <[email protected]>
commit 5dd214248f94d430d70e9230bda72f2654ac88a8 upstream.
The mount manpage says of the max_batch_time option,
This optimization can be turned off entirely by setting max_batch_time to 0.
But the code doesn't do that. So fix the code to do that.
--- fs/ext4/super.c | 2 -- fs/jbd2/transaction.c | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-)
fs/ext4/super.c +0 -2
@@ -1524,8 +1524,6 @@ static int handle_mount_opt(struct super arg =JBD2_DEFAULT_MAX_COMMIT_AGE ; sbi->s_commit_interval =HZ * arg; }else if (token == Opt_max_batch_time) { -if (arg ==0 ) - arg =EXT4_DEF_MAX_BATCH_TIME ; sbi->s_max_batch_time = arg; }else if (token == Opt_min_batch_time) { sbi->s_min_batch_time = arg;
fs/jbd2/transaction.c +4 -1
@@ -1588,9 +1588,12 @@ int jbd2_journal_stop(handle_t *handle)* to perform a synchronous write. We do this to detect the * case where a single process is doing a stream of sync * writes. No point in waiting for joiners in that case. +* +* Setting max_batch_time to 0 disables this completely. */ pid = current->pid; -if (handle->h_sync && journal->j_last_sync_writer != pid) { +if (handle->h_sync && journal->j_last_sync_writer != pid && + journal->j_max_batch_time) {u64 commit_time, trans_time; journal->j_last_sync_writer = pid;
Greg Kroah-Hartman
maintainerPATCH 53/84 ext4: revert commit which was causing fs corruption after journal replays
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit f9ae9cf5d72b3926ca48ea60e15bdbb840f42372 upstream.
Commit 007649375f6af2 ("ext4: initialize multi-block allocator before checking block descriptors") causes the block group descriptor's count of the number of free blocks to become inconsistent with the number of free blocks in the allocation bitmap. This is a harmless form of fs corruption, but it causes the kernel to potentially remount the file system read-only, or to panic, depending on the file systems's error behavior.
Thanks to Eric Whitney for his tireless work to reproduce and to find the guilty commit.
--- fs/ext4/super.c | 51 ++++++++++++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 27 deletions(-)
fs/ext4/super.c +24 -27
@@ -3868,38 +3868,19 @@ static int ext4_fill_super(struct super_ goto failed_mount2; } } - -/* -* set up enough so that it can read an inode, -* and create new inode for buddy allocator -*/ - sbi->s_gdb_count = db_count; -if (!test_opt (sb,NOLOAD ) && -EXT4_HAS_COMPAT_FEATURE (sb,EXT4_FEATURE_COMPAT_HAS_JOURNAL )) - sb->s_op = &ext4_sops; -else - sb->s_op = &ext4_nojournal_sops; - -ext4_ext_init (sb); - err =ext4_mb_init (sb); -if (err) { -ext4_msg (sb,KERN_ERR ,"failed to initialize mballoc (%d)" , - err); - goto failed_mount2; - } -if (!ext4_check_descriptors (sb, &first_not_zeroed)) {ext4_msg (sb,KERN_ERR ,"group descriptors corrupted!" ); - goto failed_mount2a; + goto failed_mount2; }if (EXT4_HAS_INCOMPAT_FEATURE (sb,EXT4_FEATURE_INCOMPAT_FLEX_BG ))if (!ext4_fill_flex_info (sb)) {ext4_msg (sb,KERN_ERR ,"unable to initialize " "flex_bg meta info!" ); - goto failed_mount2a; + goto failed_mount2; } + sbi->s_gdb_count = db_count;get_random_bytes (&sbi->s_next_generation,sizeof (u32));spin_lock_init (&sbi->s_next_gen_lock);
@@ -3934,6 +3915,14 @@ static int ext4_fill_super(struct super_ sbi->s_stripe =ext4_get_stripe_size (sbi); sbi->s_extent_max_zeroout_kb =32 ; +/* +* set up enough so that it can read an inode +*/ +if (!test_opt (sb,NOLOAD ) && +EXT4_HAS_COMPAT_FEATURE (sb,EXT4_FEATURE_COMPAT_HAS_JOURNAL )) + sb->s_op = &ext4_sops; +else + sb->s_op = &ext4_nojournal_sops; sb->s_export_op = &ext4_export_ops; sb->s_xattr = ext4_xattr_handlers;#ifdef CONFIG_QUOTA
@@ -4123,13 +4112,21 @@ no_journal:if (err) {ext4_msg (sb,KERN_ERR ,"failed to reserve %llu clusters for " "reserved pool" ,ext4_calculate_resv_clusters (sb)); - goto failed_mount5; + goto failed_mount4a; } err =ext4_setup_system_zone (sb);if (err) {ext4_msg (sb,KERN_ERR ,"failed to initialize system " "zone (%d)" , err); + goto failed_mount4a; + } + +ext4_ext_init (sb); + err =ext4_mb_init (sb); +if (err) { +ext4_msg (sb,KERN_ERR ,"failed to initialize mballoc (%d)" , + err); goto failed_mount5; }
@@ -4206,8 +4203,11 @@ failed_mount8: failed_mount7:ext4_unregister_li_request (sb); failed_mount6: -ext4_release_system_zone (sb); +ext4_mb_release (sb); failed_mount5: +ext4_ext_release (sb); +ext4_release_system_zone (sb); +failed_mount4a:dput (sb->s_root); sb->s_root =NULL ; failed_mount4:
@@ -4231,14 +4231,11 @@ failed_mount3:percpu_counter_destroy (&sbi->s_extent_cache_cnt);if (sbi->s_mmp_tsk)kthread_stop (sbi->s_mmp_tsk); -failed_mount2a: -ext4_mb_release (sb); failed_mount2:for (i =0 ; i < db_count; i++)brelse (sbi->s_group_desc[i]);ext4_kvfree (sbi->s_group_desc); failed_mount: -ext4_ext_release (sb);if (sbi->s_chksum_driver)crypto_free_shash (sbi->s_chksum_driver);if (sbi->s_proc) {
Greg Kroah-Hartman
maintainerPATCH 54/84 ext4: fix a potential deadlock in __ext4_es_shrink()
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 3f1f9b851311a76226140b55b1ea22111234a7c2 upstream.
This fixes the following lockdep complaint:
[ INFO: possible circular locking dependency detected ]
3.16.0-rc2-mm1+ #7 Tainted: G O
-------------------------------------------------------
kworker/u24:0/4356 is trying to acquire lock:
(&(&sbi->s_es_lru_lock)->rlock){+.+.-.}, at: [<ffffffff81285fff>] __ext4_es_shrink+0x4f/0x2e0
but task is already holding lock:
(&ei->i_es_lock){++++-.}, at: [<ffffffff81286961>] ext4_es_insert_extent+0x71/0x180
which lock already depends on the new lock.
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&ei->i_es_lock);
lock(&(&sbi->s_es_lru_lock)->rlock);
lock(&ei->i_es_lock);lock(&(&sbi->s_es_lru_lock)->rlock);
*** DEADLOCK ***
6 locks held by kworker/u24:0/4356:
#0: ("writeback"){.+.+.+}, at: [<ffffffff81071d00>] process_one_work+0x180/0x560
#1: ((&(&wb->dwork)->work)){+.+.+.}, at: [<ffffffff81071d00>] process_one_work+0x180/0x560
#2: (&type->s_umount_key#22){++++++}, at: [<ffffffff811a9c74>] grab_super_passive+0x44/0x90
#3: (jbd2_handle){+.+...}, at: [<ffffffff812979f9>] start_this_handle+0x189/0x5f0
#4: (&ei->i_data_sem){++++..}, at: [<ffffffff81247062>] ext4_map_blocks+0x132/0x550
#5: (&ei->i_es_lock){++++-.}, at: [<ffffffff81286961>] ext4_es_insert_extent+0x71/0x180stack backtrace: CPU: 0 PID: 4356 Comm: kworker/u24:0 Tainted: G O 3.16.0-rc2-mm1+ #7 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 Workqueue: writeback bdi_writeback_workfn (flush-253:0) ffffffff8213dce0 ffff880014b07538 ffffffff815df0bb 0000000000000007 ffffffff8213e040 ffff880014b07588 ffffffff815db3dd ffff880014b07568 ffff880014b07610 ffff88003b868930 ffff88003b868908 ffff88003b868930 Call Trace: [<ffffffff815df0bb>] dump_stack+0x4e/0x68 [<ffffffff815db3dd>] print_circular_bug+0x1fb/0x20c [<ffffffff810a7a3e>] __lock_acquire+0x163e/0x1d00 [<ffffffff815e89dc>] ? retint_restore_args+0xe/0xe [<ffffffff815ddc7b>] ? __slab_alloc+0x4a8/0x4ce [<ffffffff81285fff>] ? __ext4_es_shrink+0x4f/0x2e0 [<ffffffff810a8707>] lock_acquire+0x87/0x120 [<ffffffff81285fff>] ? __ext4_es_shrink+0x4f/0x2e0 [<ffffffff8128592d>] ? ext4_es_free_extent+0x5d/0x70 [<ffffffff815e6f09>] _raw_spin_lock+0x39/0x50 [<ffffffff81285fff>] ? __ext4_es_shrink+0x4f/0x2e0 [<ffffffff8119760b>] ? kmem_cache_alloc+0x18b/0x1a0 [<ffffffff81285fff>] __ext4_es_shrink+0x4f/0x2e0 [<ffffffff812869b8>] ext4_es_insert_extent+0xc8/0x180 [<ffffffff812470f4>] ext4_map_blocks+0x1c4/0x550 [<ffffffff8124c4c4>] ext4_writepages+0x6d4/0xd00 ...
--- fs/ext4/extents_status.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ext4/extents_status.c +2 -2
@@ -960,10 +960,10 @@ retry:continue ; } -if (ei->i_es_lru_nr ==0 || ei == locked_ei) +if (ei->i_es_lru_nr ==0 || ei == locked_ei || + !write_trylock (&ei->i_es_lock))continue ; -write_lock (&ei->i_es_lock); shrunk =__es_try_to_reclaim_extents (ei, nr_to_scan);if (ei->i_es_lru_nr ==0 )list_del_init (&ei->i_es_lru);
Greg Kroah-Hartman
maintainerPATCH 55/84 drm/radeon/dpm: Reenabling SS on Cayman
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Demers <[email protected]>
commit 41959341ac7e33dd360c7a881d13566f9eca37b2 upstream.
It reverts commit c745fe611ca42295c9d91d8e305d27983e9132ef now that Cayman is stable since VDDCI fix. Spread spectrum was not the culprit.
This depends on b0880e87c1fd038b84498944f52e52c3e86ebe59 (drm/radeon/dpm: fix vddci setup typo on cayman).
--- drivers/gpu/drm/radeon/rv770_dpm.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/gpu/drm/radeon/rv770_dpm.c +0 -6
@@ -2329,12 +2329,6 @@ void rv770_get_engine_memory_ss(struct r pi->mclk_ss =radeon_atombios_get_asic_ss_info (rdev, &ss,ASIC_INTERNAL_MEMORY_SS ,0 ); -/* disable ss, causes hangs on some cayman boards */ -if (rdev->family ==CHIP_CAYMAN ) { - pi->sclk_ss = false; - pi->mclk_ss = false; - } -if (pi->sclk_ss || pi->mclk_ss) pi->dynamic_ss = true;else
Greg Kroah-Hartman
maintainerPATCH 56/84 drm/radeon: fix typo in ci_stop_dpm()
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit ed96377132e564d797c48a5490fd46bed01c4273 upstream.
Need to use the RREG32_SMC() accessor since the register is an smc indirect index.
--- drivers/gpu/drm/radeon/ci_dpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/ci_dpm.c +1 -1
@@ -1179,7 +1179,7 @@ static int ci_stop_dpm(struct radeon_dev tmp &= ~GLOBAL_PWRMGT_EN ;WREG32_SMC (GENERAL_PWRMGT , tmp); - tmp =RREG32 (SCLK_PWRMGT_CNTL ); + tmp =RREG32_SMC (SCLK_PWRMGT_CNTL ); tmp &= ~DYNAMIC_PM_EN ;WREG32_SMC (SCLK_PWRMGT_CNTL , tmp);
Greg Kroah-Hartman
maintainerPATCH 57/84 drm/radeon: fix typo in golden register setup on evergreen
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 6abafb78f9881b4891baf74ab4e9f090ae45230e upstream.
Fixes hangs on driver load on some cards.
bug:
https://bugs.freedesktop.org/show_bug.cgi?id=76998
--- drivers/gpu/drm/radeon/evergreen.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/evergreen.c +4 -4
@@ -189,7 +189,7 @@ static const u32 evergreen_golden_regist0x8c1c ,0xffffffff ,0x00001010 ,0x28350 ,0xffffffff ,0x00000000 ,0xa008 ,0xffffffff ,0x00010000 , -0x5cc ,0xffffffff ,0x00000001 , +0x5c4 ,0xffffffff ,0x00000001 ,0x9508 ,0xffffffff ,0x00000002 ,0x913c ,0x0000000f ,0x0000000a };
@@ -476,7 +476,7 @@ static const u32 cedar_golden_registers[0x8c1c ,0xffffffff ,0x00001010 ,0x28350 ,0xffffffff ,0x00000000 ,0xa008 ,0xffffffff ,0x00010000 , -0x5cc ,0xffffffff ,0x00000001 , +0x5c4 ,0xffffffff ,0x00000001 ,0x9508 ,0xffffffff ,0x00000002 };
@@ -635,7 +635,7 @@ static const u32 juniper_mgcg_init[] =static const u32 supersumo_golden_registers[] = {0x5eb4 ,0xffffffff ,0x00000002 , -0x5cc ,0xffffffff ,0x00000001 , +0x5c4 ,0xffffffff ,0x00000001 ,0x7030 ,0xffffffff ,0x00000011 ,0x7c30 ,0xffffffff ,0x00000011 ,0x6104 ,0x01000300 ,0x00000000 ,
@@ -719,7 +719,7 @@ static const u32 sumo_golden_registers[]static const u32 wrestler_golden_registers[] = {0x5eb4 ,0xffffffff ,0x00000002 , -0x5cc ,0xffffffff ,0x00000001 , +0x5c4 ,0xffffffff ,0x00000001 ,0x7030 ,0xffffffff ,0x00000011 ,0x7c30 ,0xffffffff ,0x00000011 ,0x6104 ,0x01000300 ,0x00000000 ,
Greg Kroah-Hartman
maintainerPATCH 60/84 drm/i915: quirk asserts controllable backlight presence, overriding VBT
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Scot Doyle <[email protected]>
commit 9c72cc6f00d24711ef585772396dd1ae180881a6 upstream.
commit c675949ec58ca50d5a3ae3c757892f1560f6e896
Author: Jani Nikula <[email protected]> Date: Wed Apr 9 11:31:37 2014 +0300
drm/i915: do not setup backlight if not available according to VBT
caused a regression on machines with a misconfigured VBT. Add a quirk to assert the presence of a controllable backlight. Use it to ignore the VBT backlight presence check during backlight setup.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79813
--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_display.c | 8 ++++++++ drivers/gpu/drm/i915/intel_panel.c | 8 ++++++-- 3 files changed, 15 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -803,6 +803,7 @@ enum intel_sbi_destination {#define QUIRK_PIPEA_FORCE (1<<0)#define QUIRK_LVDS_SSC_DISABLE (1<<1)#define QUIRK_INVERT_BRIGHTNESS (1<<2) +#define QUIRK_BACKLIGHT_PRESENT (1<<3)struct intel_fbdev ;struct intel_fbc_work ;
drivers/gpu/drm/i915/intel_display.c +8 -0
@@ -11166,6 +11166,14 @@ static void quirk_invert_brightness(struDRM_INFO ("applying inverted panel brightness quirk\n" ); } +/* Some VBT's incorrectly indicate no backlight is present */ +static void quirk_backlight_present (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; + dev_priv->quirks |=QUIRK_BACKLIGHT_PRESENT ; +DRM_INFO ("applying backlight present quirk\n" ); +} +struct intel_quirk {int device;int subsystem_vendor;
drivers/gpu/drm/i915/intel_panel.c +6 -2
@@ -1065,8 +1065,12 @@ int intel_panel_setup_backlight(struct dint ret;if (!dev_priv->vbt.backlight.present) { -DRM_DEBUG_KMS ("native backlight control not available per VBT\n" ); -return 0 ; +if (dev_priv->quirks &QUIRK_BACKLIGHT_PRESENT ) { +DRM_DEBUG_KMS ("no backlight present per VBT, but present per quirk\n" ); + }else { +DRM_DEBUG_KMS ("no backlight present per VBT\n" ); +return 0 ; + } }/* set level and max in panel struct */
Greg Kroah-Hartman
maintainerPATCH 61/84 drm/i915: Acer C720 and C720P have controllable backlights
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Scot Doyle <[email protected]>
commit 2e93a1aa9ca455aa3ad0294bcd6d66f38bf8b758 upstream.
The Acer C720 and C720P Chromebooks (with Celeron 2955U CPU) have a controllable backlight although their VBT reports otherwise. Apply quirk to ignore the backlight presence check during backlight setup.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79813
--- drivers/gpu/drm/i915/intel_display.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/intel_display.c +3 -0
@@ -11245,6 +11245,9 @@ static struct intel_quirk intel_quirks[]/* Acer Aspire 5336 */ { 0x2a42, 0x1025, 0x048a, quirk_invert_brightness }, + +/* Acer C720 and C720P Chromebooks (Celeron 2955U) have backlights */ + { 0x0a06, 0x1025, 0x0a11, quirk_backlight_present }, };static void intel_init_quirks (struct drm_device *dev)
Greg Kroah-Hartman
maintainerPATCH 62/84 drm/i915: Toshiba CB35 has a controllable backlight
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Scot Doyle <[email protected]>
commit d4967d8c6d4f52623f2be8eaff0b445dc5863c92 upstream.
The Toshiba CB35 Chromebook (with Celeron 2955U CPU) has a controllable backlight although its VBT reports otherwise. Apply quirk to ignore the backlight presence check during backlight setup.
Patch tested by author on Toshiba CB35.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79813
--- drivers/gpu/drm/i915/intel_display.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/intel_display.c +3 -0
@@ -11248,6 +11248,9 @@ static struct intel_quirk intel_quirks[]/* Acer C720 and C720P Chromebooks (Celeron 2955U) have backlights */ { 0x0a06, 0x1025, 0x0a11, quirk_backlight_present }, + +/* Toshiba CB35 Chromebook (Celeron 2955U) */ + { 0x0a06, 0x1179, 0x0a88, quirk_backlight_present }, };static void intel_init_quirks (struct drm_device *dev)
Greg Kroah-Hartman
maintainerPATCH 64/84 DMA, CMA: fix possible memory leak
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joonsoo Kim <[email protected]>
commit fe8eea4f4a3f299ef83ed090d5354698ebe4fda8 upstream.
We should free memory for bitmap when we find zone mismatch, otherwise this memory will leak.
Additionally, I copy code comment from PPC KVM's CMA code to inform why we need to check zone mis-match.
--- drivers/base/dma-contiguous.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/base/dma-contiguous.c +11 -1
@@ -155,13 +155,23 @@ static int __init cma_activate_area(stru base_pfn = pfn;for (j = pageblock_nr_pages; j; --j, pfn++) {WARN_ON_ONCE (!pfn_valid (pfn)); +/* +* alloc_contig_range requires the pfn range +* specified to be in the same zone. Make this +* simple by forcing the entire CMA resv range +* to be in the same zone. +*/ if (page_zone (pfn_to_page (pfn)) != zone) -return -EINVAL ; + goto err; }init_cma_reserved_pageblock (pfn_to_page (base_pfn)); }while (--i);return 0 ; + +err: +kfree (cma->bitmap); +return -EINVAL ; }static struct cma cma_areas[MAX_CMA_AREAS ];
Greg Kroah-Hartman
maintainerPATCH 65/84 ring-buffer: Check if buffer exists before polling
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (Red Hat)" <[email protected]>
commit 8b8b36834d0fff67fc8668093f4312dd04dcf21d upstream.
The per_cpu buffers are created one per possible CPU. But these do not mean that those CPUs are online, nor do they even exist.
With the addition of the ring buffer polling, it assumes that the caller polls on an existing buffer. But this is not the case if the user reads trace_pipe from a CPU that does not exist, and this causes the kernel to crash.
Simple fix is to check the cpu against buffer bitmask against to see if the buffer was allocated or not and return -ENODEV if it is not.
More updates were done to pass the -ENODEV back up to userspace.
--- include/linux/ring_buffer.h | 2 +- kernel/trace/ring_buffer.c | 5 ++++- kernel/trace/trace.c | 25 ++++++++++++++++++------- kernel/trace/trace.h | 4 ++-- 4 files changed, 25 insertions(+), 11 deletions(-)
include/linux/ring_buffer.h +1 -1
@@ -97,7 +97,7 @@ __ring_buffer_alloc(unsigned long size,__ring_buffer_alloc ((size), (flags), &__key); \ }) -void ring_buffer_wait (struct ring_buffer *buffer,int cpu); +int ring_buffer_wait (struct ring_buffer *buffer,int cpu);int ring_buffer_poll_wait (struct ring_buffer *buffer,int cpu,struct file *filp,poll_table *poll_table);
kernel/trace/ring_buffer.c +4 -1
@@ -543,7 +543,7 @@ static void rb_wake_up_waiters(struct ir* as data is added to any of the @buffer's cpu buffers. Otherwise * it will wait for data to be added to a specific cpu buffer. */ -void ring_buffer_wait (struct ring_buffer *buffer,int cpu) +int ring_buffer_wait (struct ring_buffer *buffer,int cpu) {struct ring_buffer_per_cpu *cpu_buffer;DEFINE_WAIT (wait);
@@ -557,6 +557,8 @@ void ring_buffer_wait(struct ring_bufferif (cpu ==RING_BUFFER_ALL_CPUS ) work = &buffer->irq_work;else { +if (!cpumask_test_cpu (cpu, buffer->cpumask)) +return -ENODEV ; cpu_buffer = buffer->buffers[cpu]; work = &cpu_buffer->irq_work; }
@@ -591,6 +593,7 @@ void ring_buffer_wait(struct ring_bufferschedule ();finish_wait (&work->waiters, &wait); +return 0 ; }/**
kernel/trace/trace.c +18 -7
@@ -1103,13 +1103,13 @@ update_max_tr_single(struct trace_array }#endif /* CONFIG_TRACER_MAX_TRACE */ -static void default_wait_pipe (struct trace_iterator *iter) +static int default_wait_pipe (struct trace_iterator *iter) {/* Iterators are static, they should be filled or empty */ if (trace_buffer_iter (iter, iter->cpu_file)) -return ; +return 0 ; -ring_buffer_wait (iter->trace_buffer->buffer, iter->cpu_file); +return ring_buffer_wait (iter->trace_buffer->buffer, iter->cpu_file); }#ifdef CONFIG_FTRACE_STARTUP_TEST
@@ -4236,17 +4236,19 @@ tracing_poll_pipe(struct file *filp, pol* * Anyway, this is really very primitive wakeup. */ -void poll_wait_pipe (struct trace_iterator *iter) +int poll_wait_pipe (struct trace_iterator *iter) {set_current_state (TASK_INTERRUPTIBLE );/* sleep for 100 msecs, and try again. */ schedule_timeout (HZ /10 ); +return 0 ; }/* Must be called with trace_types_lock mutex held. */ static int tracing_wait_pipe (struct file *filp) {struct trace_iterator *iter = filp->private_data; +int ret;while (trace_empty (iter)) {
@@ -4256,10 +4258,13 @@ static int tracing_wait_pipe(struct filemutex_unlock (&iter->mutex); - iter->trace->wait_pipe (iter); + ret = iter->trace->wait_pipe (iter);mutex_lock (&iter->mutex); +if (ret) +return ret; +if (signal_pending (current))return -EINTR ;
@@ -5196,8 +5201,12 @@ tracing_buffers_read(struct file *filp, goto out_unlock; }mutex_unlock (&trace_types_lock); - iter->trace->wait_pipe (iter); + ret = iter->trace->wait_pipe (iter);mutex_lock (&trace_types_lock); +if (ret) { + size = ret; + goto out_unlock; + }if (signal_pending (current)) { size = -EINTR ; goto out_unlock;
@@ -5407,8 +5416,10 @@ tracing_buffers_splice_read(struct file goto out; }mutex_unlock (&trace_types_lock); - iter->trace->wait_pipe (iter); + ret = iter->trace->wait_pipe (iter);mutex_lock (&trace_types_lock); +if (ret) + goto out;if (signal_pending (current)) { ret = -EINTR ; goto out;
kernel/trace/trace.h +2 -2
@@ -342,7 +342,7 @@ struct tracer {void (*stop)(struct trace_array *tr);void (*open)(struct trace_iterator *iter);void (*pipe_open)(struct trace_iterator *iter); -void (*wait_pipe)(struct trace_iterator *iter); +int (*wait_pipe)(struct trace_iterator *iter);void (*close)(struct trace_iterator *iter);void (*pipe_close)(struct trace_iterator *iter); ssize_t (*read)(struct trace_iterator *iter,
@@ -560,7 +560,7 @@ void trace_init_global_iter(struct tracevoid tracing_iter_reset (struct trace_iterator *iter,int cpu); -void poll_wait_pipe (struct trace_iterator *iter); +int poll_wait_pipe (struct trace_iterator *iter); void tracing_sched_switch_trace(struct trace_array *tr, struct task_struct *prev,
Greg Kroah-Hartman
maintainerPATCH 66/84 i40e: fix passing wrong error code to i40e_open()
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean Sacren <[email protected]>
commit ce9ccb17ef5b5088172f46dd246c92523fd3a524 upstream.
The commit 6c167f582ea9 ("i40e: Refactor and cleanup i40e_open(), adding i40e_vsi_open()") introduced a new function i40e_vsi_open() with the regression by a typo. Due to the commit, the wrong error code would be passed to i40e_open(). Fix this error in i40e_vsi_open() by turning the macro into a negative value so that i40e_open() could return the pertinent error code correctly.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -1
@@ -4310,7 +4310,7 @@ int i40e_vsi_open(struct i40e_vsi *vsi) goto err_setup_rx;if (!vsi->netdev) { - err =EINVAL ; + err = -EINVAL ; goto err_setup_rx; } snprintf(int_name, sizeof(int_name) - 1, "%s-%s",
Greg Kroah-Hartman
maintainerPATCH 67/84 mtd: nand: omap: fix omap_calculate_ecc_bch() for-loop error
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ted Juan <[email protected]>
commit 2913aae5f9eae2f857cdeff5388bb22d0751aa08 upstream.
mtd: nand: omap: ecc.calculate: merge omap3_calculate_ecc_bch4 in omap_calculate_ecc_bch
mtd: nand: omap: ecc.calculate: merge omap3_calculate_ecc_bch8 in omap_calculate_ecc_bch
--- drivers/mtd/nand/omap2.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/mtd/nand/omap2.c +5 -5
@@ -1162,7 +1162,7 @@ static int __maybe_unused omap_calculatestruct gpmc_nand_regs *gpmc_regs = &info->reg;u8 *ecc_code;unsigned long nsectors, bch_val1, bch_val2, bch_val3, bch_val4; -int i; +int i, j; nsectors = ((readl (info->reg.gpmc_ecc_config) >>4 ) &0x7 ) +1 ;for (i =0 ; i < nsectors; i++) {
@@ -1210,8 +1210,8 @@ static int __maybe_unused omap_calculatecase OMAP_ECC_BCH4_CODE_HW_DETECTION_SW :/* Add constant polynomial to remainder, so that * ECC of blank pages results in 0x0 on reading back */ -for (i =0 ; i < eccbytes; i++) - ecc_calc[i] ^= bch4_polynomial[i]; +for (j =0 ; j < eccbytes; j++) + ecc_calc[j] ^= bch4_polynomial[j];break ;case OMAP_ECC_BCH4_CODE_HW :/* Set 8th ECC byte as 0x0 for ROM compatibility */
@@ -1220,8 +1220,8 @@ static int __maybe_unused omap_calculatecase OMAP_ECC_BCH8_CODE_HW_DETECTION_SW :/* Add constant polynomial to remainder, so that * ECC of blank pages results in 0x0 on reading back */ -for (i =0 ; i < eccbytes; i++) - ecc_calc[i] ^= bch8_polynomial[i]; +for (j =0 ; j < eccbytes; j++) + ecc_calc[j] ^= bch8_polynomial[j];break ;case OMAP_ECC_BCH8_CODE_HW :/* Set 14th ECC byte as 0x0 for ROM compatibility */
Greg Kroah-Hartman
maintainerPATCH 68/84 cgroup: fix mount failure in a corner case
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Zefan <[email protected]>
commit 970317aa48c6ef66cd023c039c2650c897bad927 upstream.
# cat test.sh #! /bin/bash
mount -t cgroup -o cpu xxx /cgroup
umount /cgroup
mount -t cgroup -o cpu,cpuacct xxx /cgroup
umount /cgroup
# ./test.sh mount: xxx already mounted or /cgroup busy mount: according to mtab, xxx is already mounted on /cgroup
It's because the cgroupfs_root of the first mount was under destruction asynchronously.
Fix this by delaying and then retrying mount for this case.
v3:
- put the refcnt immediately after getting it. (Tejun)
v2:
- use percpu_ref_tryget_live() rather that introducing percpu_ref_alive(). (Tejun)
- adjust comment.
tj: Updated the comment a bit.
[lizf: Backported to 3.15:
- s/percpu_ref_tryget_live/atomic_inc_not_zero/
- Use goto instead of calling restart_syscall()
- Add cgroup_tree_mutex]
--- kernel/cgroup.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
kernel/cgroup.c +25 -0
@@ -1484,10 +1484,12 @@ static struct dentry *cgroup_mount(struc int flags, const char *unused_dev_name, void *data) { + struct cgroup_subsys *ss;struct cgroup_root *root;struct cgroup_sb_opts opts;struct dentry *dentry;int ret; +int i;bool new_sb;/*
@@ -1514,6 +1516,29 @@ retry: goto out_unlock; } +/* +* Destruction of cgroup root is asynchronous, so subsystems may +* still be dying after the previous unmount. Let's drain the +* dying subsystems. We just need to ensure that the ones +* unmounted previously finish dying and don't care about new ones +* starting. Testing ref liveliness is good enough. +*/ +for_each_subsys (ss, i) { +if (!(opts.subsys_mask & (1 << i)) || + ss->root == &cgrp_dfl_root) +continue ; + +if (!atomic_inc_not_zero (&ss->root->cgrp.refcnt)) { +mutex_unlock (&cgroup_mutex); +mutex_unlock (&cgroup_tree_mutex); +msleep (10 ); +mutex_lock (&cgroup_tree_mutex); +mutex_lock (&cgroup_mutex); + goto retry; + } +cgroup_put (&ss->root->cgrp); + } +for_each_root (root) {bool name_match = false;
Greg Kroah-Hartman
maintainerPATCH 69/84 kernfs: implement kernfs_root->supers list
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit 7d568a8383bbb9c1f5167781075906acb2bb1550 upstream.
Currently, there's no way to find out which super_blocks are associated with a given kernfs_root. Let's implement it - the planned inotify extension to kernfs_notify() needs it.
Make kernfs_super_info point back to the super_block and chain it at kernfs_root->supers.
--- fs/kernfs/dir.c | 1 + fs/kernfs/kernfs-internal.h | 5 +++++ fs/kernfs/mount.c | 11 +++++++++++ include/linux/kernfs.h | 4 ++++ 4 files changed, 21 insertions(+)
fs/kernfs/dir.c +1 -0
@@ -714,6 +714,7 @@ struct kernfs_root *kernfs_create_root(sreturn ERR_PTR (-ENOMEM );ida_init (&root->ino_ida); +INIT_LIST_HEAD (&root->supers); kn =__kernfs_new_node (root,"" ,S_IFDIR |S_IRUGO |S_IXUGO ,KERNFS_DIR );
fs/kernfs/kernfs-internal.h +5 -0
@@ -49,6 +49,8 @@ static inline struct kernfs_root *kernfs* mount.c */ struct kernfs_super_info { +struct super_block *sb; +/* * The root associated with this super_block. Each super_block is * identified by the root and ns it's associated with.
@@ -62,6 +64,9 @@ struct kernfs_super_info {* an array and compare kernfs_node tag against every entry. */ const void *ns; + +/* anchored at kernfs_root->supers, protected by kernfs_mutex */ +struct list_head node; };#define kernfs_info (SB ) ((struct kernfs_super_info *)(SB->s_fs_info))
fs/kernfs/mount.c +11 -0
@@ -68,6 +68,7 @@ static int kernfs_fill_super(struct supestruct inode *inode;struct dentry *root; + info->sb = sb; sb->s_blocksize =PAGE_CACHE_SIZE ; sb->s_blocksize_bits =PAGE_CACHE_SHIFT ; sb->s_magic = magic;
@@ -167,12 +168,18 @@ struct dentry *kernfs_mount_ns(struct fi *new_sb_created = !sb->s_root;if (!sb->s_root) { +struct kernfs_super_info *info =kernfs_info (sb); + error =kernfs_fill_super (sb, magic);if (error) {deactivate_locked_super (sb);return ERR_PTR (error); } sb->s_flags |=MS_ACTIVE ; + +mutex_lock (&kernfs_mutex); +list_add (&info->node, &root->supers); +mutex_unlock (&kernfs_mutex); }return dget (sb->s_root);
@@ -191,6 +198,10 @@ void kernfs_kill_sb(struct super_block *struct kernfs_super_info *info =kernfs_info (sb);struct kernfs_node *root_kn = sb->s_root->d_fsdata; +mutex_lock (&kernfs_mutex); +list_del (&info->node); +mutex_unlock (&kernfs_mutex); +/* * Remove the superblock from fs_supers/s_instances * so we can't find it, before freeing kernfs_super_info.
include/linux/kernfs.h +4 -0
@@ -161,6 +161,10 @@ struct kernfs_root {/* private fields, do not use outside kernfs proper */ struct ida ino_ida;struct kernfs_syscall_ops *syscall_ops; + +/* list of kernfs_super_info of this root, protected by kernfs_mutex */ +struct list_head supers; +wait_queue_head_t deactivate_waitq; };
Greg Kroah-Hartman
maintainerPATCH 70/84 kernfs: introduce kernfs_pin_sb()
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Zefan <[email protected]>
commit 4e26445faad366d67d7723622bf6a60a6f0f5993 upstream.
kernfs_pin_sb() tries to get a refcnt of the superblock.
This will be used by cgroupfs.
v2:
- make kernfs_pin_sb() return the superblock.
- drop kernfs_drop_sb().
tj: Updated the comment a bit.
--- fs/kernfs/mount.c | 30 ++++++++++++++++++++++++++++++ include/linux/kernfs.h | 1 + 2 files changed, 31 insertions(+)
fs/kernfs/mount.c +30 -0
@@ -211,6 +211,36 @@ void kernfs_kill_sb(struct super_block *kernfs_put (root_kn); } +/** +* kernfs_pin_sb: try to pin the superblock associated with a kernfs_root +* @kernfs_root: the kernfs_root in question +* @ns: the namespace tag +* +* Pin the superblock so the superblock won't be destroyed in subsequent +* operations. This can be used to block ->kill_sb() which may be useful +* for kernfs users which dynamically manage superblocks. +* +* Returns NULL if there's no superblock associated to this kernfs_root, or +* -EINVAL if the superblock is being freed. +*/ +struct super_block *kernfs_pin_sb (struct kernfs_root *root,const void *ns) +{ +struct kernfs_super_info *info; +struct super_block *sb =NULL ; + +mutex_lock (&kernfs_mutex); +list_for_each_entry (info, &root->supers, node) { +if (info->ns == ns) { + sb = info->sb; +if (!atomic_inc_not_zero (&info->sb->s_active)) + sb =ERR_PTR (-EINVAL ); +break ; + } + } +mutex_unlock (&kernfs_mutex); +return sb; +} +void __init kernfs_init (void ) { kernfs_node_cache = kmem_cache_create("kernfs_node_cache",
include/linux/kernfs.h +1 -0
@@ -304,6 +304,7 @@ struct dentry *kernfs_mount_ns(struct fi struct kernfs_root *root, unsigned long magic, bool *new_sb_created, const void *ns);void kernfs_kill_sb (struct super_block *sb); +struct super_block *kernfs_pin_sb (struct kernfs_root *root,const void *ns);void kernfs_init (void );
Greg Kroah-Hartman
maintainerPATCH 71/84 cgroup: fix a race between cgroup_mount() and cgroup_kill_sb()
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Zefan <[email protected]>
commit 3a32bd72d77058d768dbb38183ad517f720dd1bc upstream.
We've converted cgroup to kernfs so cgroup won't be intertwined with vfs objects and locking, but there are dark areas.
Run two instances of this script concurrently:
for ((; ;))
{
mount -t cgroup -o cpuacct xxx /cgroup
umount /cgroup
}After a while, I saw two mount processes were stuck at retrying, because they were waiting for a subsystem to become free, but the root associated with this subsystem never got freed.
This can happen, if thread A is in the process of killing superblock but hasn't called percpu_ref_kill(), and at this time thread B is mounting the same cgroup root and finds the root in the root list and performs percpu_ref_try_get().
To fix this, we try to increase both the refcnt of the superblock and the percpu refcnt of cgroup root.
v2:
- we should try to get both the superblock refcnt and cgroup_root refcnt, because cgroup_root may have no superblock assosiated with it.
- adjust/add comments.
tj: Updated comments. Renamed @sb to @pinned_sb.
[lizf: Backported to 3.15:
- Adjust context
- s/percpu_tryget_live/atomic_inc_not_zero/]
--- kernel/cgroup.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
kernel/cgroup.c +27 -1
@@ -1484,6 +1484,7 @@ static struct dentry *cgroup_mount(struc int flags, const char *unused_dev_name, void *data) { + struct super_block *pinned_sb = NULL;struct cgroup_subsys *ss;struct cgroup_root *root;struct cgroup_sb_opts opts;
@@ -1584,10 +1585,25 @@ retry:* destruction to complete so that the subsystems are free. * We can use wait_queue for the wait but this path is * super cold. Let's just sleep for a bit and retry. + +* We want to reuse @root whose lifetime is governed by its +* ->cgrp. Let's check whether @root is alive and keep it +* that way. As cgroup_kill_sb() can happen anytime, we +* want to block it by pinning the sb so that @root doesn't +* get killed before mount is complete. +* +* With the sb pinned, inc_not_zero can reliably indicate +* whether @root can be reused. If it's being killed, +* drain it. We can use wait_queue for the wait but this +* path is super cold. Let's just sleep a bit and retry. */ -if (!atomic_inc_not_zero (&root->cgrp.refcnt)) { + pinned_sb =kernfs_pin_sb (root->kf_root,NULL ); +if (IS_ERR (pinned_sb) || + !atomic_inc_not_zero (&root->cgrp.refcnt)) {mutex_unlock (&cgroup_mutex);mutex_unlock (&cgroup_tree_mutex); +if (!IS_ERR_OR_NULL (pinned_sb)) +deactivate_super (pinned_sb);msleep (10 );mutex_lock (&cgroup_tree_mutex);mutex_lock (&cgroup_mutex);
@@ -1634,6 +1650,16 @@ out_unlock: CGROUP_SUPER_MAGIC, &new_sb);if (IS_ERR (dentry) || !new_sb)cgroup_put (&root->cgrp); + +/* +* If @pinned_sb, we're reusing an existing root and holding an +* extra ref on its sb. Mount is complete. Put the extra ref. +*/ +if (pinned_sb) { +WARN_ON (new_sb); +deactivate_super (pinned_sb); + } +return dentry; }
Greg Kroah-Hartman
maintainerPATCH 72/84 f2fs: adjust free mem size to flush dentry blocks
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jaegeuk Kim <[email protected]>
commit 6fb03f3a40805a412c9b285010ffdc2e7563f81b upstream.
If so many dirty dentry blocks are cached, not reached to the flush condition, we should fall into livelock in balance_dirty_pages.
So, let's consider the mem size for the condition.
--- fs/f2fs/data.c | 3 ++- fs/f2fs/f2fs.h | 1 + fs/f2fs/node.c | 44 ++++++++++++++++++++++++++------------------ fs/f2fs/node.h | 5 +++-- 4 files changed, 32 insertions(+), 21 deletions(-)
fs/f2fs/data.c +2 -1
@@ -869,7 +869,8 @@ static int f2fs_write_data_pages(structreturn 0 ;if (S_ISDIR (inode->i_mode) && wbc->sync_mode ==WB_SYNC_NONE && -get_dirty_dents (inode) <nr_pages_to_skip (sbi,DATA )) +get_dirty_dents (inode) <nr_pages_to_skip (sbi,DATA ) && +available_free_memory (sbi,DIRTY_DENTS )) goto skip_write; diff =nr_pages_to_write (sbi,DATA , wbc);
fs/f2fs/f2fs.h +1 -0
@@ -1140,6 +1140,7 @@ f2fs_hash_t f2fs_dentry_hash(const charstruct dnode_of_data ;struct node_info ; +bool available_free_memory (struct f2fs_sb_info *,int );int is_checkpointed_node (struct f2fs_sb_info *,nid_t );bool fsync_mark_done (struct f2fs_sb_info *,nid_t );void get_node_info (struct f2fs_sb_info *,nid_t ,struct node_info *);
fs/f2fs/node.c +26 -18
110 lines not on this page · raw message
fs/f2fs/node.h +3 -2
@@ -75,9 +75,10 @@ static inline void node_info_from_raw_na ni->version = raw_ne->version; } -enum nid_type { +enum mem_type {FREE_NIDS ,/* indicates the free nid list */ -NAT_ENTRIES /* indicates the cached nat entry */ +NAT_ENTRIES ,/* indicates the cached nat entry */ +DIRTY_DENTS /* indicates dirty dentry pages */ };/*
Greg Kroah-Hartman
maintainerPATCH 73/84 f2fs: check bdi->dirty_exceeded when trying to skip data writes
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jaegeuk Kim <[email protected]>
commit 2743f865543c0c4a5e12fc13edb2bf89a6e9687c upstream.
If we don't check the current backing device status, balance_dirty_pages can fall into infinite pausing routine.
This can be occurred when a lot of directories make a small number of dirty dentry pages including files.
--- fs/f2fs/node.c | 2 ++ 1 file changed, 2 insertions(+)
fs/f2fs/node.c +2 -0
@@ -42,6 +42,8 @@ bool available_free_memory(struct f2fs_s mem_size = (nm_i->nat_cnt *sizeof (struct nat_entry )) >>12 ; res = mem_size < ((val.totalram * nm_i->ram_thresh /100 ) >>2 ); }else if (type ==DIRTY_DENTS ) { +if (sbi->sb->s_bdi->dirty_exceeded) +return false; mem_size =get_pages (sbi,F2FS_DIRTY_DENTS ); res = mem_size < ((val.totalram * nm_i->ram_thresh /100 ) >>1 ); }
Greg Kroah-Hartman
maintainerPATCH 74/84 drivers/rtc/rtc-puv3.c: remove "&dev->" for typo issue
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Gang <[email protected]>
commit 73fa540618d8b1f8c2266934f23bd84bb9e28d9e upstream.
It is only a typo issue, the related commit:
"1fbc4c4 drivers/rtc/rtc-puv3.c: use dev_dbg() instead of pr_debug()"
The related error (for unicore32 with allmodconfig):
CC [M] drivers/rtc/rtc-puv3.o
drivers/rtc/rtc-puv3.c: In function 'puv3_rtc_setalarm':
drivers/rtc/rtc-puv3.c:143: error: 'struct device' has no member named 'dev'
--- drivers/rtc/rtc-puv3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-puv3.c +1 -1
@@ -140,7 +140,7 @@ static int puv3_rtc_setalarm(struct devirtc_tm_to_time (tm, &rtcalarm_count);writel (rtcalarm_count,RTC_RTAR ); -puv3_rtc_setaie (&dev->dev, alrm->enabled); +puv3_rtc_setaie (dev, alrm->enabled);if (alrm->enabled)enable_irq_wake (puv3_rtc_alarmno);
Greg Kroah-Hartman
maintainerPATCH 75/84 drivers/rtc/rtc-puv3.c: use dev_dbg() instead of dev_debug() for typo issue
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Gang <[email protected]>
commit c863810cefc7ffd782e5648a21bfb36a32c8b081 upstream.
It is only a typo issue, the related commit:
"1fbc4c4 drivers/rtc/rtc-puv3.c: use dev_dbg() instead of pr_debug()"
The related error (unicore32 with allmodconfig):
CC [M] drivers/rtc/rtc-puv3.o
drivers/rtc/rtc-puv3.c: In function 'puv3_rtc_setpie':
drivers/rtc/rtc-puv3.c:74: error: implicit declaration of function 'dev_debug'
--- drivers/rtc/rtc-puv3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-puv3.c +1 -1
@@ -71,7 +71,7 @@ static int puv3_rtc_setpie(struct device {unsigned int tmp; -dev_debug (dev,"%s: pie=%d\n" , __func__, enabled); +dev_dbg (dev,"%s: pie=%d\n" , __func__, enabled);spin_lock_irq (&puv3_rtc_pie_lock); tmp =readl (RTC_RTSR ) & ~RTC_RTSR_HZE ;
Greg Kroah-Hartman
maintainerPATCH 76/84 powerpc: Disable RELOCATABLE for COMPILE_TEST with PPC64
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit fb43e8477ed9006c4f397f904c691a120503038c upstream.
powerpc:allmodconfig has been failing for some time with the following error.
arch/powerpc/kernel/exceptions-64s.S: Assembler messages:arch/powerpc/kernel/exceptions-64s.S:1312: Error: attempt to move .org backwards make[1]: *** [arch/powerpc/kernel/head_64.o] Error 1
A number of attempts to fix the problem by moving around code have been unsuccessful and resulted in failed builds for some configurations and the discovery of toolchain bugs.
Fix the problem by disabling RELOCATABLE for COMPILE_TEST builds instead. While this is less than perfect, it avoids substantial code changes which would otherwise be necessary just to make COMPILE_TEST builds happy and might have undesired side effects.
--- arch/powerpc/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/Kconfig +2 -1
@@ -414,7 +414,7 @@ config KEXEC config CRASH_DUMP bool "Build a kdump crash kernel" depends on PPC64 || 6xx || FSL_BOOKE || (44x && !SMP) - select RELOCATABLE if PPC64 || 44x || FSL_BOOKE + select RELOCATABLE if (PPC64 && !COMPILE_TEST) || 44x || FSL_BOOKE help Build a kernel suitable for use as a kdump capture kernel. The same kernel binary can be used as production kernel and dump
@@ -1009,6 +1009,7 @@ endmenu if PPC64 config RELOCATABLE bool "Build a relocatable kernel" + depends on !COMPILE_TEST select NONSTATIC_KERNEL help This builds a kernel image that is capable of running anywhere
Greg Kroah-Hartman
maintainerPATCH 77/84 Revert "x86-64, modify_ldt: Make support for 16-bit segments a runtime option"
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: "H. Peter Anvin" <[email protected]>
commit 7ed6fb9b5a5510e4ef78ab27419184741169978a upstream.
This reverts commit fa81511bb0bbb2b1aace3695ce869da9762624ff in preparation of merging in the proper fix (espfix64).
--- arch/x86/kernel/ldt.c | 4 +--- arch/x86/vdso/vdso32-setup.c | 8 -------- 2 files changed, 1 insertion(+), 11 deletions(-)
arch/x86/kernel/ldt.c +1 -3
@@ -20,8 +20,6 @@#include <asm/mmu_context.h> #include <asm/syscalls.h> -int sysctl_ldt16 =0 ; -#ifdef CONFIG_SMP static void flush_ldt (void *current_mm) {
@@ -236,7 +234,7 @@ static int write_ldt(void __user *ptr, u* IRET leaking the high bits of the kernel stack address. */ #ifdef CONFIG_X86_64 -if (!ldt_info.seg_32bit && !sysctl_ldt16) { +if (!ldt_info.seg_32bit) { error = -EINVAL ; goto out_unlock; }
arch/x86/vdso/vdso32-setup.c +0 -8
@@ -39,7 +39,6 @@#ifdef CONFIG_X86_64 #define vdso_enabled sysctl_vsyscall32#define arch_setup_additional_pages syscall32_setup_pages -extern int sysctl_ldt16;#endif /*
@@ -250,13 +249,6 @@ static struct ctl_table abi_table2[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec - }, - { - .procname = "ldt16", - .data = &sysctl_ldt16, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec }, {} };
Greg Kroah-Hartman
maintainerPATCH 78/84 x86-64, espfix: Dont leak bits 31:16 of %esp returning to 16-bit stack
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: "H. Peter Anvin" <[email protected]>
commit 3891a04aafd668686239349ea58f3314ea2af86b upstream.
The IRET instruction, when returning to a 16-bit segment, only restores the bottom 16 bits of the user space stack pointer. This causes some 16-bit software to break, but it also leaks kernel state to user space. We have a software workaround for that ("espfix") for the 32-bit kernel, but it relies on a nonzero stack segment base which is not available in 64-bit mode.
In checkin:
b3b42ac2cbae x86-64, modify_ldt: Ban 16-bit segments on 64-bit kernels
we "solved" this by forbidding 16-bit segments on 64-bit kernels, with the logic that 16-bit support is crippled on 64-bit kernels anyway (no V86 support), but it turns out that people are doing stuff like running old Win16 binaries under Wine and expect it to work.
This works around this by creating percpu "ministacks", each of which is mapped 2^16 times 64K apart. When we detect that the return SS is on the LDT, we copy the IRET frame to the ministack and use the relevant alias to return to userspace. The ministacks are mapped readonly, so if IRET faults we promote #GP to #DF which is an IST vector and thus has its own stack; we then do the fixup in the #DF handler.
(Making #GP an IST exception would make the msr_safe functions unsafe in NMI/MC context, and quite possibly have other effects.)
Special thanks to:
- Andy Lutomirski, for the suggestion of using very small stack slots and copy (as opposed to map) the IRET frame there, and for the suggestion to mark them readonly and let the fault promote to #DF.
- Konrad Wilk for paravirt fixup and testing.
- Borislav Petkov for testing help and useful comments.
--- Documentation/x86/x86_64/mm.txt | 2 arch/x86/include/asm/pgtable_64_types.h | 2 arch/x86/include/asm/setup.h | 3 arch/x86/kernel/Makefile | 1 arch/x86/kernel/entry_64.S | 73 ++++++++++- arch/x86/kernel/espfix_64.c | 208 ++++++++++++++++++++++++++++++++ arch/x86/kernel/ldt.c | 11 - arch/x86/kernel/smpboot.c | 7 + arch/x86/mm/dump_pagetables.c | 44 +++++- init/main.c | 4 10 files changed, 329 insertions(+), 26 deletions(-)
Documentation/x86/x86_64/mm.txt +2 -0
@@ -12,6 +12,8 @@ ffffc90000000000 - ffffe8ffffffffff (=45 ffffe90000000000 - ffffe9ffffffffff (=40 bits) hole ffffea0000000000 - ffffeaffffffffff (=40 bits) virtual memory map (1TB) ... unused hole ... +ffffff0000000000 - ffffff7fffffffff (=39 bits) %esp fixup stacks +... unused hole ... ffffffff80000000 - ffffffffa0000000 (=512 MB) kernel text mapping, from phys 0 ffffffffa0000000 - ffffffffff5fffff (=1525 MB) module mapping space ffffffffff600000 - ffffffffffdfffff (=8 MB) vsyscalls
arch/x86/include/asm/pgtable_64_types.h +2 -0
@@ -61,6 +61,8 @@ typedef struct { pteval_t pte; } pte_t;#define MODULES_VADDR (__START_KERNEL_map + KERNEL_IMAGE_SIZE)#define MODULES_END _AC(0xffffffffff000000, UL)#define MODULES_LEN (MODULES_END - MODULES_VADDR) +#define ESPFIX_PGD_ENTRY _AC(-2, UL) +#define ESPFIX_BASE_ADDR (ESPFIX_PGD_ENTRY << PGDIR_SHIFT)#define EARLY_DYNAMIC_PAGE_TABLES 64
arch/x86/include/asm/setup.h +3 -0
@@ -57,6 +57,9 @@ extern void x86_ce4100_early_setup(void)static inline void x86_ce4100_early_setup (void ) { }#endif +extern void init_espfix_bsp (void ); +extern void init_espfix_ap (void ); +#ifndef _SETUP/*
arch/x86/kernel/Makefile +1 -0
@@ -29,6 +29,7 @@ obj-$(CONFIG_X86_64) += sys_x86_64.o x86 obj-y += syscall_$(BITS).o vsyscall_gtod.o obj-$(CONFIG_X86_64) += vsyscall_64.o obj-$(CONFIG_X86_64) += vsyscall_emu_64.o +obj-$(CONFIG_X86_64) += espfix_64.o obj-$(CONFIG_SYSFS) += ksysfs.o obj-y += bootflag.o e820.o obj-y += pci-dma.o quirks.o topology.o kdebugfs.o
arch/x86/kernel/entry_64.S +69 -4
112 lines not on this page · raw message
arch/x86/kernel/espfix_64.c new file +208 -0
208 lines not on this page · raw message
arch/x86/kernel/ldt.c +0 -11
@@ -229,17 +229,6 @@ static int write_ldt(void __user *ptr, u } } -/* -* On x86-64 we do not support 16-bit segments due to -* IRET leaking the high bits of the kernel stack address. -*/ -#ifdef CONFIG_X86_64 -if (!ldt_info.seg_32bit) { - error = -EINVAL ; - goto out_unlock; - } -#endif -fill_ldt (&ldt, &ldt_info);if (oldmode) ldt.avl =0 ;
arch/x86/kernel/smpboot.c +7 -0
@@ -244,6 +244,13 @@ static void notrace start_secondary(voidcheck_tsc_sync_target ();/* +* Enable the espfix hack for this CPU +*/ +#ifdef CONFIG_X86_64 +init_espfix_ap (); +#endif + +/* * We need to hold vector_lock so there the set of online cpus * does not change while we are assigning vectors to cpus. Holding * this lock ensures we don't half assign or remove an irq from a cpu.
arch/x86/mm/dump_pagetables.c +33 -11
94 lines not on this page · raw message
init/main.c +4 -0
@@ -617,6 +617,10 @@ asmlinkage __visible void __init start_kif (efi_enabled (EFI_RUNTIME_SERVICES ))efi_enter_virtual_mode ();#endif +#ifdef CONFIG_X86_64 +/* Should be run before the first non-init thread is created */ +init_espfix_bsp (); +#endif thread_info_cache_init ();cred_init ();fork_init (totalram_pages);
Greg Kroah-Hartman
maintainerPATCH 79/84 x86, espfix: Move espfix definitions into a separate header file
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: "H. Peter Anvin" <[email protected]>
commit e1fe9ed8d2a4937510d0d60e20705035c2609aea upstream.
Sparse warns that the percpu variables aren't declared before they are defined. Rather than hacking around it, move espfix definitions into a proper header file.
--- arch/x86/include/asm/espfix.h | 16 ++++++++++++++++ arch/x86/include/asm/setup.h | 5 ++--- arch/x86/kernel/espfix_64.c | 1 + 3 files changed, 19 insertions(+), 3 deletions(-)
arch/x86/include/asm/espfix.h new file +16 -0
@@ -0,0 +1,16 @@ +#ifdef _ASM_X86_ESPFIX_H +#define _ASM_X86_ESPFIX_H + +#ifdef CONFIG_X86_64 + +#include <asm/percpu.h> + +DECLARE_PER_CPU_READ_MOSTLY(unsigned long, espfix_stack); +DECLARE_PER_CPU_READ_MOSTLY(unsigned long, espfix_waddr); + +extern void init_espfix_bsp (void ); +extern void init_espfix_ap (void ); + +#endif /* CONFIG_X86_64 */ + +#endif /* _ASM_X86_ESPFIX_H */
arch/x86/include/asm/setup.h +2 -3
@@ -57,11 +57,10 @@ extern void x86_ce4100_early_setup(void)static inline void x86_ce4100_early_setup (void ) { }#endif -extern void init_espfix_bsp (void ); -extern void init_espfix_ap (void ); -#ifndef _SETUP +#include <asm/espfix.h> +/* * This is set up by the setup-routine at boot-time */
arch/x86/kernel/espfix_64.c +1 -0
@@ -40,6 +40,7 @@#include <asm/pgtable.h> #include <asm/pgalloc.h> #include <asm/setup.h> +#include <asm/espfix.h> /* * Note: we only need 6*8 = 48 bytes for the espfix stack, but round
Greg Kroah-Hartman
maintainerPATCH 80/84 x86, espfix: Fix broken header guard
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: "H. Peter Anvin" <[email protected]>
commit 20b68535cd27183ebd3651ff313afb2b97dac941 upstream.
Header guard is #ifndef, not #ifdef...
--- arch/x86/include/asm/espfix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/espfix.h +1 -1
@@ -1,4 +1,4 @@ -#ifdef _ASM_X86_ESPFIX_H +#ifndef _ASM_X86_ESPFIX_H#define _ASM_X86_ESPFIX_H#ifdef CONFIG_X86_64
Greg Kroah-Hartman
maintainerPATCH 81/84 x86, espfix: Make espfix64 a Kconfig option, fix UML
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: "H. Peter Anvin" <[email protected]>
commit 197725de65477bc8509b41388157c1a2283542bb upstream.
Make espfix64 a hidden Kconfig option. This fixes the x86-64 UML build which had broken due to the non-existence of init_espfix_bsp() in UML: since UML uses its own Kconfig, this option does not appear in the UML build.
This also makes it possible to make support for 16-bit segments a configuration option, for the people who want to minimize the size of the kernel.
--- arch/x86/Kconfig | 4 ++++ arch/x86/kernel/Makefile | 2 +- arch/x86/kernel/smpboot.c | 2 +- init/main.c | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-)
arch/x86/Kconfig +4 -0
@@ -914,6 +914,10 @@ config VM86 XFree86 to initialize some video cards via BIOS. Disabling this option saves about 6k. +config X86_ESPFIX64 + def_bool y + depends on X86_64 + config TOSHIBA tristate "Toshiba Laptop support" depends on X86_32
arch/x86/kernel/Makefile +1 -1
@@ -29,7 +29,7 @@ obj-$(CONFIG_X86_64) += sys_x86_64.o x86 obj-y += syscall_$(BITS).o vsyscall_gtod.o obj-$(CONFIG_X86_64) += vsyscall_64.o obj-$(CONFIG_X86_64) += vsyscall_emu_64.o -obj-$(CONFIG_X86_64) += espfix_64.o +obj-$(CONFIG_X86_ESPFIX64) += espfix_64.o obj-$(CONFIG_SYSFS) += ksysfs.o obj-y += bootflag.o e820.o obj-y += pci-dma.o quirks.o topology.o kdebugfs.o
arch/x86/kernel/smpboot.c +1 -1
@@ -246,7 +246,7 @@ static void notrace start_secondary(void/* * Enable the espfix hack for this CPU */ -#ifdef CONFIG_X86_64 +#ifdef CONFIG_X86_ESPFIX64 init_espfix_ap ();#endif
init/main.c +1 -1
@@ -617,7 +617,7 @@ asmlinkage __visible void __init start_kif (efi_enabled (EFI_RUNTIME_SERVICES ))efi_enter_virtual_mode ();#endif -#ifdef CONFIG_X86_64 +#ifdef CONFIG_X86_ESPFIX64 /* Should be run before the first non-init thread is created */ init_espfix_bsp ();#endif
Greg Kroah-Hartman
maintainerPATCH 82/84 x86, espfix: Make it possible to disable 16-bit support
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: "H. Peter Anvin" <[email protected]>
commit 34273f41d57ee8d854dcd2a1d754cbb546cb548f upstream.
Embedded systems, which may be very memory-size-sensitive, are extremely unlikely to ever encounter any 16-bit software, so make it a CONFIG_EXPERT option to turn off support for any 16-bit software whatsoever.
--- arch/x86/Kconfig | 23 ++++++++++++++++++----- arch/x86/kernel/entry_32.S | 12 ++++++++++++ arch/x86/kernel/entry_64.S | 8 ++++++++ arch/x86/kernel/ldt.c | 5 +++++ 4 files changed, 43 insertions(+), 5 deletions(-)
arch/x86/Kconfig +18 -5
@@ -909,14 +909,27 @@ config VM86 default y depends on X86_32 ---help--- - This option is required by programs like DOSEMU to run 16-bit legacy - code on X86 processors. It also may be needed by software like - XFree86 to initialize some video cards via BIOS. Disabling this - option saves about 6k. + This option is required by programs like DOSEMU to run + 16-bit real mode legacy code on x86 processors. It also may + be needed by software like XFree86 to initialize some video + cards via BIOS. Disabling this option saves about 6K. + +config X86_16BIT + bool "Enable support for 16-bit segments" if EXPERT + default y + ---help--- + This option is required by programs like Wine to run 16-bit + protected mode legacy code on x86 processors. Disabling + this option saves about 300 bytes on i386, or around 6K text + plus 16K runtime memory on x86-64, + +config X86_ESPFIX32 + def_bool y + depends on X86_16BIT && X86_32 config X86_ESPFIX64 def_bool y - depends on X86_64 + depends on X86_16BIT && X86_64 config TOSHIBA tristate "Toshiba Laptop support"
arch/x86/kernel/entry_32.S +12 -0
@@ -528,6 +528,7 @@ syscall_exit: restore_all: TRACE_IRQS_IRET restore_all_notrace: +#ifdef CONFIG_X86_ESPFIX32 movl PT_EFLAGS(%esp), %eax # mix EFLAGS, SS and CS # Warning: PT_OLDSS(%esp) contains the wrong/random values if we # are returning to the kernel.
@@ -538,6 +539,7 @@ restore_all_notrace: cmpl $((SEGMENT_LDT << 8) | USER_RPL), %eax CFI_REMEMBER_STATE je ldt_ss # returning to user-space with LDT SS +#endif restore_nocheck: RESTORE_REGS 4 # skip orig_eax/error_code irq_return:
@@ -550,6 +552,7 @@ ENTRY(iret_exc) .previous _ASM_EXTABLE(irq_return,iret_exc) +#ifdef CONFIG_X86_ESPFIX32 CFI_RESTORE_STATE ldt_ss: #ifdef CONFIG_PARAVIRT
@@ -593,6 +596,7 @@ ldt_ss: lss (%esp), %esp /* switch to espfix segment */ CFI_ADJUST_CFA_OFFSET -8 jmp restore_nocheck +#endif CFI_ENDPROC ENDPROC(system_call)
@@ -705,6 +709,7 @@ END(syscall_badsys) * the high word of the segment base from the GDT and swiches to the * normal stack and adjusts ESP with the matching offset. */ +#ifdef CONFIG_X86_ESPFIX32 /* fixup the stack */ mov GDT_ESPFIX_SS + 4, %al /* bits 16..23 */ mov GDT_ESPFIX_SS + 7, %ah /* bits 24..31 */
@@ -714,8 +719,10 @@ END(syscall_badsys) pushl_cfi %eax lss (%esp), %esp /* switch to the normal stack segment */ CFI_ADJUST_CFA_OFFSET -8 +#endif .endm .macro UNWIND_ESPFIX_STACK +#ifdef CONFIG_X86_ESPFIX32 movl %ss, %eax /* see if on espfix stack */ cmpw $__ESPFIX_SS, %ax
@@ -726,6 +733,7 @@ END(syscall_badsys) /* switch to normal stack */ FIXUP_ESPFIX_STACK 27: +#endif .endm /*
@@ -1356,11 +1364,13 @@ END(debug) ENTRY(nmi) RING0_INT_FRAME ASM_CLAC +#ifdef CONFIG_X86_ESPFIX32 pushl_cfi %eax movl %ss, %eax cmpw $__ESPFIX_SS, %ax popl_cfi %eax je nmi_espfix_stack +#endif cmpl $ia32_sysenter_target,(%esp) je nmi_stack_fixup pushl_cfi %eax
@@ -1400,6 +1410,7 @@ nmi_debug_stack_check: FIX_STACK 24, nmi_stack_correct, 1 jmp nmi_stack_correct +#ifdef CONFIG_X86_ESPFIX32 nmi_espfix_stack: /* We have a RING0_INT_FRAME here. *
@@ -1421,6 +1432,7 @@ nmi_espfix_stack: lss 12+4(%esp), %esp # back to espfix stack CFI_ADJUST_CFA_OFFSET -24 jmp irq_return +#endif CFI_ENDPROC END(nmi)
arch/x86/kernel/entry_64.S +8 -0
@@ -1045,8 +1045,10 @@ irq_return: * Are we returning to a stack segment from the LDT? Note: in * 64-bit mode SS:RSP on the exception stack is always valid. */ +#ifdef CONFIG_X86_ESPFIX64 testb $4,(SS-RIP)(%rsp) jnz irq_return_ldt +#endif irq_return_iret: INTERRUPT_RETURN
@@ -1058,6 +1060,7 @@ ENTRY(native_iret) _ASM_EXTABLE(native_iret, bad_iret) #endif +#ifdef CONFIG_X86_ESPFIX64 irq_return_ldt: pushq_cfi %rax pushq_cfi %rdi
@@ -1081,6 +1084,7 @@ irq_return_ldt: movq %rax,%rsp popq_cfi %rax jmp irq_return_iret +#endif .section .fixup,"ax" bad_iret:
@@ -1152,6 +1156,7 @@ END(common_interrupt) * modify the stack to make it look like we just entered * the #GP handler from user space, similar to bad_iret. */ +#ifdef CONFIG_X86_ESPFIX64 ALIGN __do_double_fault: XCPT_FRAME 1 RDI+8
@@ -1177,6 +1182,9 @@ __do_double_fault: retq CFI_ENDPROC END(__do_double_fault) +#else +# define __do_double_fault do_double_fault +#endif /* * End of kprobes section
arch/x86/kernel/ldt.c +5 -0
@@ -229,6 +229,11 @@ static int write_ldt(void __user *ptr, u } } +if (!IS_ENABLED (CONFIG_X86_16BIT ) && !ldt_info.seg_32bit) { + error = -EINVAL ; + goto out_unlock; + } +fill_ldt (&ldt, &ldt_info);if (oldmode) ldt.avl =0 ;
Greg Kroah-Hartman
maintainerPATCH 83/84 x86, ioremap: Speed up check for RAM pages
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roland Dreier <[email protected]>
commit c81c8a1eeede61e92a15103748c23d100880cc8a upstream.
In __ioremap_caller() (the guts of ioremap), we loop over the range of pfns being remapped and checks each one individually with page_is_ram(). For large ioremaps, this can be very slow. For example, we have a device with a 256 GiB PCI BAR, and ioremapping this BAR can take 20+ seconds -- sometimes long enough to trigger the soft lockup detector!
Internally, page_is_ram() calls walk_system_ram_range() on a single page. Instead, we can make a single call to walk_system_ram_range() from __ioremap_caller(), and do our further checks only for any RAM pages that we find. For the common case of MMIO, this saves an enormous amount of work, since the range being ioremapped doesn't intersect system RAM at all.
With this change, ioremap on our 256 GiB BAR takes less than 1 second.
--- arch/x86/mm/ioremap.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-)
arch/x86/mm/ioremap.c +19 -7
@@ -50,6 +50,21 @@ int ioremap_change_attr(unsigned long vareturn err; } +static int __ioremap_check_ram (unsigned long start_pfn,unsigned long nr_pages, +void *arg) +{ +unsigned long i; + +for (i =0 ; i < nr_pages; ++i) +if (pfn_valid (start_pfn + i) && + !PageReserved (pfn_to_page (start_pfn + i))) +return 1 ; + +WARN_ONCE (1 ,"ioremap on RAM pfn 0x%lx\n" , start_pfn); + +return 0 ; +} +/* * Remap an arbitrary physical address space into the kernel virtual * address space. Needed when the kernel wants to access high addresses
@@ -93,14 +108,11 @@ static void __iomem *__ioremap_caller(re/* * Don't allow anybody to remap normal RAM that we're using.. */ + pfn = phys_addr >>PAGE_SHIFT ; last_pfn = last_addr >>PAGE_SHIFT ; -for (pfn = phys_addr >>PAGE_SHIFT ; pfn <= last_pfn; pfn++) { -int is_ram =page_is_ram (pfn); - -if (is_ram &&pfn_valid (pfn) && !PageReserved (pfn_to_page (pfn))) -return NULL ; -WARN_ON_ONCE (is_ram); - } +if (walk_system_ram_range (pfn, last_pfn - pfn +1 ,NULL , + __ioremap_check_ram) ==1 ) +return NULL ;/* * Mappings have to be page-aligned
Greg Kroah-Hartman
maintainerPATCH 84/84 ACPI / battery: Retry to get battery information if failed during probing
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lan Tianyu <[email protected]>
commit 75646e758a0ecbed5024454507d5be5b9ea9dcbf upstream.
Some machines (eg. Lenovo Z480) ECs are not stable during boot up and causes battery driver fails to be loaded due to failure of getting battery information from EC sometimes. After several retries, the operation will work. This patch is to retry to get battery information 5 times if the first try fails.
[ backport to 3.14.5: removed second parameter in acpi_battery_update(), introduced by the commit 9e50bc14a7f58b5d8a55973b2d69355852ae2dae (ACPI /
battery: Accelerate battery resume callback)]
--- drivers/acpi/battery.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
drivers/acpi/battery.c +26 -1
@@ -34,6 +34,7 @@#include <linux/dmi.h> #include <linux/slab.h> #include <linux/suspend.h> +#include <linux/delay.h> #include <asm/unaligned.h> #ifdef CONFIG_ACPI_PROCFS_POWER
@@ -1069,6 +1070,28 @@ static struct dmi_system_id bat_dmi_tabl {}, }; +/* +* Some machines'(E,G Lenovo Z480) ECs are not stable +* during boot up and this causes battery driver fails to be +* probed due to failure of getting battery information +* from EC sometimes. After several retries, the operation +* may work. So add retry code here and 20ms sleep between +* every retries. +*/ +static int acpi_battery_update_retry (struct acpi_battery *battery) +{ +int retry, ret; + +for (retry =5 ; retry; retry--) { + ret =acpi_battery_update (battery); +if (!ret) +break ; + +msleep (20 ); + } +return ret; +} +static int acpi_battery_add (struct acpi_device *device) {int result =0 ;
@@ -1087,9 +1110,11 @@ static int acpi_battery_add(struct acpi_mutex_init (&battery->sysfs_lock);if (acpi_has_method (battery->device->handle,"_BIX" ))set_bit (ACPI_BATTERY_XINFO_PRESENT , &battery->flags); - result =acpi_battery_update (battery); + + result =acpi_battery_update_retry (battery);if (result) goto fail; +#ifdef CONFIG_ACPI_PROCFS_POWER result =acpi_battery_add_fs (device);#endif
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.15.6 release. There are 84 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Jul 17 23:17:00 UTC 2014. Anything received after that time might be too late.
Build results:
total: 139 pass: 139 fail: 0
Qemu tests all passed.
Another set of perfect results.
Details are available at http://server.roeck-us.net:8010/builders.
Guenter
At Tue, 15 Jul 2014 21:28:16 -0700,
Quoted 11 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.15.6 release. There are 84 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Jul 17 23:17:00 UTC 2014. Anything received after that time might be too late.
Quoted 8 lines
Build results:
total: 139 pass: 139 fail: 0Qemu tests all passed.
Another set of perfect results.
Details are available at http://server.roeck-us.net:8010/builders.
All 3.15.6-rc1, 3.14.13-rc1, 3.10.49-rc1, and 3.4.99-rc1 passed my test.
- Test Cases:
- Build this kernel.
- Boot this kernel.
- Build the latest mainline kernel with this kernel.
# "selftests" is not added to this list yet.
- Test Tool:
https://github.com/satoru-takeuchi/test-linux-stable
- Test Result (kernel .config, ktest config and test log):
http://satoru-takeuchi.org/test-linux-stable/results/<version>-<test datetime>.tar.xz
- Build Environment:
- OS: Debian Jessy x86_64
- CPU: Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz x 4
- memory: 8GB
- Test Target Environment:
- Debian Jessy x86_64 (KVM guest on the Build Environment)
- # of vCPU: 2
- memory: 2GB
Thanks,
Satoru
Greg Kroah-Hartman
maintainerQuoted 42 lines · Satoru Takeuchi
At Tue, 15 Jul 2014 21:28:16 -0700,
Quoted 11 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.15.6 release. There are 84 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Jul 17 23:17:00 UTC 2014. Anything received after that time might be too late.
Quoted 8 lines
Build results:
total: 139 pass: 139 fail: 0Qemu tests all passed.
Another set of perfect results.
Details are available at http://server.roeck-us.net:8010/builders.
All 3.15.6-rc1, 3.14.13-rc1, 3.10.49-rc1, and 3.4.99-rc1 passed my test.
- Test Cases:
- Build this kernel.
- Boot this kernel.
- Build the latest mainline kernel with this kernel.# "selftests" is not added to this list yet.
- Test Tool:
https://github.com/satoru-takeuchi/test-linux-stable- Test Result (kernel .config, ktest config and test log):
http://satoru-takeuchi.org/test-linux-stable/results/<version>-<test datetime>.tar.xz- Build Environment:
- OS: Debian Jessyx86_64
- CPU: Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz x 4
- memory: 8GB
Quoted 4 lines
- Test Target Environment:
- Debian Jessyx86_64(KVM guest on the Build Environment)
- # of vCPU: 2
- memory: 2GB
Thanks for testing these and letting me know.
greg k-h
Greg Kroah-Hartman
maintainerQuoted 11 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.15.6 release. There are 84 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Jul 17 23:17:00 UTC 2014. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.15.6-rc1.gzand the diffstat can be found below.
Due to some problems with Xen, I've removed a bunch of patches from this series (and the 3.4, 3.10, and 3.14 series) and done a -rc2 release with the updated set:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.15.6-rc2.gz
thanks,
greg k-h
Quoted 13 lines · Greg Kroah-Hartman
Quoted 11 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.15.6 release. There are 84 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Jul 17 23:17:00 UTC 2014. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.15.6-rc1.gzand the diffstat can be found below.
Quoted 6 lines
Due to some problems with Xen, I've removed a bunch of patches from this series (and the 3.4, 3.10, and 3.14 series) and done a -rc2 release with the updated set:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.15.6-rc2.gz
Build and qemu test for all releases is still fine.
Guenter
Greg Kroah-Hartman
maintainerQuoted 14 lines · Guenter Roeck
Quoted 13 lines · Greg Kroah-Hartman
Quoted 11 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.15.6 release. There are 84 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Jul 17 23:17:00 UTC 2014. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.15.6-rc1.gzand the diffstat can be found below.
Quoted 8 lines
Quoted 6 lines
Due to some problems with Xen, I've removed a bunch of patches from this series (and the 3.4, 3.10, and 3.14 series) and done a -rc2 release with the updated set:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.15.6-rc2.gzBuild and qemu test for all releases is still fine.
Great, thanks for letting me know.
greg k-h
At Wed, 16 Jul 2014 18:50:45 -0700,
Quoted 20 lines · Greg Kroah-Hartman
Quoted 18 lines · Guenter Roeck
Quoted 17 lines · Greg Kroah-Hartman
Quoted 11 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.15.6 release. There are 84 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Jul 17 23:17:00 UTC 2014. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.15.6-rc1.gzand the diffstat can be found below.
Due to some problems with Xen, I've removed a bunch of patches from this series (and the 3.4, 3.10, and 3.14 series) and done a -rc2 release with the updated set:
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.15.6-rc2.gzBuild and qemu test for all releases is still fine.
Great, thanks for letting me know.
greg k-h
All -rc2es passed my test too.
Thanks,
Satoru
Greg Kroah-Hartman
maintainerQuoted 25 lines · Satoru Takeuchi
At Wed, 16 Jul 2014 18:50:45 -0700,
Quoted 23 lines · Greg Kroah-Hartman
Quoted 21 lines · Guenter Roeck
Quoted 19 lines · Greg Kroah-Hartman
Quoted 11 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.15.6 release. There are 84 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Jul 17 23:17:00 UTC 2014. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.15.6-rc1.gzand the diffstat can be found below.
Due to some problems with Xen, I've removed a bunch of patches from this series (and the 3.4, 3.10, and 3.14 series) and done a -rc2 release with the updated set:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.15.6-rc2.gz
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Build and qemu test for all releases is still fine.
Great, thanks for letting me know.
greg k-h
All -rc2es passed my test too.
Wonderful, thanks.
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.15.6 release. There are 84 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Jul 17 23:17:00 UTC 2014. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.15.6-rc1.gzand the diffstat can be found below.
thanks,
greg k-h
rc1 and rc2 compiled and booted on my test system. No dmesg regressions.
-- Shuah
Signature · 4 lines
Shuah Khan Senior Linux Kernel Developer - Open Source Group Samsung Research America(Silicon Valley) [email protected] | (970) 672-0658
Greg Kroah-Hartman
maintainerQuoted 13 lines · Shuah Khan
Quoted 12 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.15.6 release. There are 84 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Jul 17 23:17:00 UTC 2014. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.15.6-rc1.gzand the diffstat can be found below.
Quoted 6 lines
Quoted 4 lines
thanks,
greg k-h
rc1 and rc2 compiled and booted on my test system. No dmesg regressions.
Thanks for testing all of these and letting me know.
greg k-h