4.9.5-stable review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 4.9.5-stable review
This is the start of the stable review cycle for the 4.9.5 release. There are 120 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 Fri Jan 20 10:46:26 UTC 2017. 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/v4.x/stable-review/patch-4.9.5-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.9.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.9.5-rc1
Niklas Söderlund <[email protected]>
pinctrl: sh-pfc: Do not unconditionally support PIN_CONFIG_BIAS_DISABLE
Huang Shijie <[email protected]>
arm64: hugetlb: fix the wrong return value for huge_ptep_set_access_flags
Huang Shijie <[email protected]>
arm64: hugetlb: remove the wrong pmd check in find_num_contig()
Huang Shijie <[email protected]>
arm64: hugetlb: fix the wrong address for several functions
Russell Currey <[email protected]>
powerpc/powernv: Don't warn on PE init if unfreeze is unsupported
Johan Hovold <[email protected]>
powerpc/ibmebus: Fix device reference leaks in sysfs interface
Johan Hovold <[email protected]>
powerpc/ibmebus: Fix further device reference leaks
Suraj Jitindar Singh <[email protected]>
powerpc/mm: Correct process and partition table max size
Johan Hovold <[email protected]>
bus: vexpress-config: fix device reference leak
Gabriel Krisman Bertazi <[email protected]>
blk-mq: Always schedule hctx->next_cpu
Andrew F. Davis <[email protected]>
power: supply: bq27xxx_battery: Fix register map for BQ27510 and BQ27520
Tony Lindgren <[email protected]>
bq24190_charger: Fix PM runtime use for bq24190_battery_set_property
Wei Yongjun <[email protected]>
iw_cxgb4: Fix error return code in c4iw_rdev_open()
Jacob Pan <[email protected]>
powercap/intel_rapl: fix and tidy up error handling
Prarit Bhargava <[email protected]>
ACPI / APEI: Fix NMI notification handling
Tejun Heo <[email protected]>
block: cfq_cpd_alloc() should use @gfp
Tobias Klauser <[email protected]>
block: Change extern inline to static inline
Dan Carpenter <[email protected]>
ACPI / CPPC: set an error code on probe error path
Charles Keepax <[email protected]>
regulators: helpers: Fix handling of bypass_val_on in get_bypass_regmap
Denis Kirjanov <[email protected]>
cpufreq: powernv: Disable preemption while checking CPU throttling state
Paul Mackerras <[email protected]>
powerpc/64: Simplify adaptation to new ISA v3.00 HPTE format
Wei Yongjun <[email protected]>
remoteproc: st: Fix error return code in st_rproc_probe()
Bjorn Andersson <[email protected]>
remoteproc: qcom_wcnss: Fix circular module dependency
Chris Wilson <[email protected]>
drm: Initialise drm_mm.head_node.allocated
Ville Syrjälä <[email protected]>
drm/i915: Move the min_pixclk[] handling to the end of readout
Chen-Yu Tsai <[email protected]>
drm/panel: simple: Check against num_timings when setting preferred for timing
Arnd Bergmann <[email protected]>
drm: avoid uninitialized timestamp use in wait_vblank
Imre Deak <[email protected]>
drm/i915/gen9: Fix PCODE polling during SAGV disabling
Russell King <[email protected]>
i2c: mux: pca954x: fix i2c mux selection caching
NeilBrown <[email protected]>
NFSv4.1: nfs4_fl_prepare_ds must be careful about reporting success.
Trond Myklebust <[email protected]>
NFS: Fix a performance regression in readdir
Trond Myklebust <[email protected]>
pNFS: Fix race in pnfs_wait_on_layoutreturn
Wei Yongjun <[email protected]>
NFS: fix typo in parameter description
Neil Armstrong <[email protected]>
pinctrl: meson: fix gpio request disabling other modes
Jeff Mahoney <[email protected]>
btrfs: fix error handling when run_delayed_extent_op fails
Jeff Mahoney <[email protected]>
btrfs: fix locking when we put back a delayed ref that's too new
Guilherme G. Piccoli <[email protected]>
nvme: apply DELAY_BEFORE_CHK_RDY quirk at probe time too
Lukasz Odzioba <[email protected]>
x86/cpu: Fix bootup crashes by sanitizing the argument of the 'clearcpuid=' command-line option
Ricardo Ribalda Delgado <[email protected]>
i2c: piix4: Avoid race conditions with IMC
Daniel Jurgens <[email protected]>
net/mlx5: Only cancel recovery work when cleaning up device
Johan Hovold <[email protected]>
USB: serial: ch341: fix modem-control and B0 handling
Alex Deucher <[email protected]>
drm/amdgpu: drop verde dpm quirks
Flora Cui <[email protected]>
drm/amdgpu: update si kicker smc firmware
Alex Deucher <[email protected]>
drm/radeon: drop verde dpm quirks
Alex Deucher <[email protected]>
drm/radeon: update smc firmware selection for SI
Laurent Pinchart <[email protected]>
drm: Clean up planes in atomic commit helper failure path
Imre Deak <[email protected]>
drm/i915/gen9: Fix PCODE polling timeout in stable backport
Julian Wiedmann <[email protected]>
net/af_iucv: don't use paged skbs for TX on HiperSockets
Zhou Chengming <[email protected]>
sysctl: Drop reference added by grab_header in proc_sys_readdir
Daniel Jedrychowski <[email protected]>
Clearing FIFOs in RS485 emulation mode causes subsequent transmits to break
Pan Bian <[email protected]>
extcon: return error code on failure
Akinobu Mita <[email protected]>
sysrq: attach sysrq handler correctly for 32-bit kernel
Andrew Lutomirski <[email protected]>
orinoco: Use shash instead of ahash for MIC calculations
Bryant G. Ly <[email protected]>
ibmvscsis: Fix srp_transfer_data fail return code
Richard Genoud <[email protected]>
tty/serial: atmel_serial: BUG: stop DMA from transmitting in stop_tx
Richard Genoud <[email protected]>
tty/serial: atmel: RS485 half duplex w/DMA: enable RX after TX is done
Christoph Hellwig <[email protected]>
virtio_blk: avoid DMA to stack for the sense buffer
Peter Ujfalusi <[email protected]>
dmaengine: omap-dma: Fix dynamic lch_map allocation
Robin Murphy <[email protected]>
drivers: char: mem: Fix thinkos in kmem address checks
Eric W. Biederman <[email protected]>
mnt: Protect the mountpoint hashtable with mount_lock
Andrei Vagin <[email protected]>
pid: fix lockdep deadlock warning due to ucount_lock
Augusto Mecking Caringi <[email protected]>
vme: Fix wrong pointer utilization in ca91cx42_slave_get
Herbert Xu <[email protected]>
Revert "tty: serial: 8250: add CON_CONSDEV to flags"
Takashi Sakamoto <[email protected]>
ASoC: hdmi-codec: use unsigned type to structure members with bit-field
David Sterba <[email protected]>
btrfs: fix crash when tracepoint arguments are freed by wq callbacks
Mathias Nyman <[email protected]>
xhci: fix deadlock at host remove by running watchdog correctly
Al Viro <[email protected]>
fix a fencepost error in pipe_advance()
Vlad Tsyrklevich <[email protected]>
i2c: fix kernel memory disclosure in dev interface
John Garry <[email protected]>
i2c: print correct device invalid address
Guenter Roeck <[email protected]>
Input: elants_i2c - avoid divide by 0 errors on bad touchscreen data
Johan Hovold <[email protected]>
USB: serial: ch341: fix open and resume after B0
Johan Hovold <[email protected]>
USB: serial: ch341: fix control-message error handling
Johan Hovold <[email protected]>
USB: serial: ch341: fix open error handling
Johan Hovold <[email protected]>
USB: serial: ch341: fix resume after reset
Johan Hovold <[email protected]>
USB: serial: ch341: fix initial modem-control state
Johan Hovold <[email protected]>
USB: serial: kl5kusb105: fix line-state error handling
Bin Liu <[email protected]>
usb: musb: fix runtime PM in debugfs
Andy Lutomirski <[email protected]>
wusbcore: Fix one more crypto-on-the-stack bug
Borislav Petkov <[email protected]>
x86/CPU/AMD: Fix Bulldozer topology
Thomas Gleixner <[email protected]>
x86/bugs: Separate AMD E400 erratum and C1E bug
Yazen Ghannam <[email protected]>
x86/cpu/AMD: Clean up cpu_llc_id assignment per topology feature
Artur Molchanov <[email protected]>
bridge: netfilter: Fix dropping packets that moving through bridge interface
Jan Kara <[email protected]>
xfs: Timely free truncated dirty pages
Geert Uytterhoeven <[email protected]>
gpio: Move freeing of GPIO hogs before numbing of the device
Johannes Berg <[email protected]>
nl80211: fix sched scan netlink socket owner destruction
Nicolai Stange <[email protected]>
x86/efi: Don't allocate memmap through memblock after mm_init()
Peter Jones <[email protected]>
efi/x86: Prune invalid memory map entries and fix boot regression
Prarit Bhargava <[email protected]>
perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init code
Ard Biesheuvel <[email protected]>
efi/libstub/arm*: Pass latest memory map to the kernel
Steve Rutherford <[email protected]>
KVM: x86: Introduce segmented_write_std
Radim Krčmář <[email protected]>
KVM: x86: emulate FXSAVE and FXRSTOR
Radim Krčmář <[email protected]>
KVM: x86: add asm_safe wrapper
Radim Krčmář <[email protected]>
KVM: x86: add Align16 instruction flag
Wanpeng Li <[email protected]>
KVM: x86: fix NULL deref in vcpu_scan_ioapic
David Matlack <[email protected]>
KVM: x86: flush pending lapic jump label updates on module unload
David Matlack <[email protected]>
jump_labels: API for flushing deferred jump label updates
Wanpeng Li <[email protected]>
KVM: eventfd: fix NULL deref irqbypass consumer
Paolo Bonzini <[email protected]>
KVM: x86: fix emulation of "MOV SS, null selector"
Mike Kravetz <[email protected]>
mm/hugetlb.c: fix reservation race when freeing surplus pages
John Sperbeck <[email protected]>
mm/slab.c: fix SLAB freelist randomization duplicate entries
Minchan Kim <[email protected]>
mm: support anonymous stable page
Michal Hocko <[email protected]>
mm, memcg: fix the active list aging for lowmem requests when memcg is enabled
Eric Ren <[email protected]>
ocfs2: fix crash caused by stale lvb with fsdlm plugin
Dan Williams <[email protected]>
mm: fix devm_memremap_pages crash, use mem_hotplug_{begin, done}Minchan Kim <[email protected]>
mm: pmd dirty emulation in page fault handler
Ross Zwisler <[email protected]>
dax: fix deadlock with DAX 4k holes
Minchan Kim <[email protected]>
zram: support BDI_CAP_STABLE_WRITES
Minchan Kim <[email protected]>
zram: revalidate disk under init_lock
Rolf Eike Beer <[email protected]>
selftests: do not require bash for the generated test
Rolf Eike Beer <[email protected]>
selftests: do not require bash to run netsocktests testcase
Dan Carpenter <[email protected]>
drm/savage: dereferencing an error pointer
Dan Carpenter <[email protected]>
drm/vc4: Fix a couple error codes in vc4_cl_lookup_bos()
Christophe Jaillet <[email protected]>
drm/tegra: dpaux: Fix error handling
Chen-Yu Tsai <[email protected]>
regulator: axp20x: Fix axp809 ldo_io registration error on cold boot
Andrew F. Davis <[email protected]>
regulator: tps65086: Fix 25mV ranges for BUCK regulators
Niklas Söderlund <[email protected]>
pinctrl: sh-pfc: Add helper to handle bias lookup table
Niklas Söderlund <[email protected]>
pinctrl: sh-pfc: r8a7795: Use lookup function for bias data
Gary Bisson <[email protected]>
pinctrl: imx: fix imx_pinctrl_desc initialization
Marcos Paulo de Souza <[email protected]>
Input: i8042 - add Pegatron touchpad to noloop table
Pavel Rojtberg <[email protected]>
Input: xpad - use correct product id for x360w controllers
-------------
Diffstat:
Documentation/devicetree/bindings/mfd/tps65086.txt | 2 +- Makefile | 4 +- arch/arm64/mm/hugetlbpage.c | 22 +- arch/powerpc/include/asm/book3s/64/mmu-hash.h | 47 ++- arch/powerpc/kernel/ibmebus.c | 16 +- arch/powerpc/mm/hash_native_64.c | 30 +- arch/powerpc/mm/pgtable-radix.c | 4 +- arch/powerpc/platforms/powernv/pci-ioda.c | 2 +- arch/powerpc/platforms/ps3/htab.c | 2 +- arch/powerpc/platforms/pseries/lpar.c | 2 +- arch/x86/events/intel/uncore_snbep.c | 2 +- arch/x86/include/asm/cpufeatures.h | 2 + arch/x86/kernel/cpu/amd.c | 58 ++-- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/process.c | 3 +- arch/x86/kvm/emulate.c | 249 +++++++++++++-- arch/x86/kvm/lapic.c | 6 + arch/x86/kvm/lapic.h | 1 + arch/x86/kvm/x86.c | 3 + arch/x86/platform/efi/efi.c | 66 ++++ arch/x86/platform/efi/quirks.c | 4 +- block/blk-mq.c | 4 +- block/cfq-iosched.c | 2 +- drivers/acpi/apei/ghes.c | 7 +- drivers/acpi/cppc_acpi.c | 4 +- drivers/block/virtio_blk.c | 4 +- drivers/block/zram/zram_drv.c | 19 +- drivers/bus/vexpress-config.c | 7 +- drivers/char/mem.c | 10 +- drivers/cpufreq/powernv-cpufreq.c | 8 +- drivers/dma/omap-dma.c | 30 +- drivers/extcon/extcon.c | 2 +- drivers/firmware/efi/fake_mem.c | 3 +- drivers/firmware/efi/libstub/efistub.h | 8 - drivers/firmware/efi/libstub/fdt.c | 87 ++++-- drivers/firmware/efi/memmap.c | 38 +++ drivers/gpio/gpiolib.c | 2 +- drivers/gpu/drm/amd/amdgpu/si_dpm.c | 70 ++--- drivers/gpu/drm/drm_atomic_helper.c | 4 +- drivers/gpu/drm/drm_irq.c | 4 +- drivers/gpu/drm/drm_mm.c | 1 + drivers/gpu/drm/i915/intel_display.c | 32 +- drivers/gpu/drm/i915/intel_pm.c | 38 +-- drivers/gpu/drm/panel/panel-simple.c | 2 +- drivers/gpu/drm/radeon/si.c | 60 ++-- drivers/gpu/drm/radeon/si_dpm.c | 13 - drivers/gpu/drm/savage/savage_state.c | 1 + drivers/gpu/drm/tegra/dpaux.c | 4 +- drivers/gpu/drm/vc4/vc4_gem.c | 9 +- drivers/i2c/busses/i2c-piix4.c | 22 ++ drivers/i2c/i2c-core.c | 2 +- drivers/i2c/i2c-dev.c | 2 +- drivers/i2c/muxes/i2c-mux-pca954x.c | 5 +- drivers/infiniband/hw/cxgb4/device.c | 4 +- drivers/input/joystick/xpad.c | 6 + drivers/input/serio/i8042-x86ia64io.h | 6 + drivers/input/touchscreen/elants_i2c.c | 4 +- drivers/net/ethernet/mellanox/mlx5/core/main.c | 6 +- drivers/net/wireless/intersil/orinoco/mic.c | 44 +-- drivers/net/wireless/intersil/orinoco/mic.h | 3 +- drivers/net/wireless/intersil/orinoco/orinoco.h | 4 +- drivers/nvme/host/core.c | 7 +- drivers/pinctrl/freescale/pinctrl-imx.c | 8 +- drivers/pinctrl/meson/pinctrl-meson.c | 2 +- drivers/pinctrl/sh-pfc/core.c | 15 + drivers/pinctrl/sh-pfc/core.h | 4 + drivers/pinctrl/sh-pfc/pfc-r8a7795.c | 343 +++++++++++---------- drivers/pinctrl/sh-pfc/pinctrl.c | 3 +- drivers/pinctrl/sh-pfc/sh_pfc.h | 6 + drivers/power/supply/bq24190_charger.c | 2 +- drivers/power/supply/bq27xxx_battery.c | 41 ++- drivers/power/supply/bq27xxx_battery_i2c.c | 4 +- drivers/powercap/intel_rapl.c | 25 +- drivers/regulator/axp20x-regulator.c | 12 +- drivers/regulator/helpers.c | 6 +- drivers/regulator/tps65086-regulator.c | 54 ++-- drivers/remoteproc/Kconfig | 5 - drivers/remoteproc/Makefile | 5 +- drivers/remoteproc/qcom_wcnss.c | 25 +- drivers/remoteproc/qcom_wcnss.h | 2 + drivers/remoteproc/qcom_wcnss_iris.c | 8 +- drivers/remoteproc/st_remoteproc.c | 4 +- drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 2 +- drivers/tty/serial/8250/8250_core.c | 2 +- drivers/tty/serial/8250/8250_port.c | 2 +- drivers/tty/serial/atmel_serial.c | 22 +- drivers/tty/sysrq.c | 4 +- drivers/usb/host/xhci-ring.c | 11 - drivers/usb/host/xhci.c | 13 - drivers/usb/musb/musb_debugfs.c | 20 +- drivers/usb/serial/ch341.c | 84 +++-- drivers/usb/serial/kl5kusb105.c | 9 +- drivers/usb/wusbcore/crypto.c | 3 +- drivers/vme/bridges/vme_ca91cx42.c | 2 +- fs/btrfs/async-thread.c | 15 +- fs/btrfs/extent-tree.c | 5 +- fs/dcache.c | 7 +- fs/namespace.c | 64 ++-- fs/nfs/dir.c | 15 +- fs/nfs/filelayout/filelayoutdev.c | 3 +- fs/nfs/pnfs.c | 8 +- fs/nfs/super.c | 2 +- fs/ocfs2/dlmglue.c | 10 + fs/ocfs2/stackglue.c | 6 + fs/ocfs2/stackglue.h | 3 + fs/proc/proc_sysctl.c | 3 +- fs/xfs/xfs_aops.c | 19 +- include/linux/blkdev.h | 2 +- include/linux/efi.h | 2 + include/linux/jump_label_ratelimit.h | 5 + include/linux/memcontrol.h | 26 +- include/linux/mm_inline.h | 2 +- include/linux/power/bq27xxx_battery.h | 3 +- include/linux/swap.h | 3 +- include/sound/hdmi-codec.h | 8 +- include/trace/events/btrfs.h | 22 +- kernel/jump_label.c | 7 + kernel/memremap.c | 4 + kernel/pid_namespace.c | 10 +- lib/iov_iter.c | 54 ++-- mm/filemap.c | 2 +- mm/huge_memory.c | 6 +- mm/hugetlb.c | 37 ++- mm/memcontrol.c | 18 +- mm/slab.c | 8 +- mm/swapfile.c | 20 +- mm/vmscan.c | 27 +- net/bridge/br_netfilter_hooks.c | 2 +- net/iucv/af_iucv.c | 25 +- net/wireless/nl80211.c | 16 +- tools/testing/selftests/Makefile | 2 +- tools/testing/selftests/net/run_netsocktests | 2 +- virt/lib/irqbypass.c | 4 +- 133 files changed, 1517 insertions(+), 823 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/120 Input: xpad - use correct product id for x360w controllers
4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Rojtberg <[email protected]>
commit b6fc513da50c5dbc457a8ad6b58b046a6a68fd9d upstream.
currently the controllers get the same product id as the wireless receiver. However the controllers actually have their own product id.
The patch makes the driver expose the same product id as the windows driver.
This improves compatibility when running applications with WINE.
see https://github.com/paroj/xpad/issues/54
--- drivers/input/joystick/xpad.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/input/joystick/xpad.c +6 -0
@@ -1376,6 +1376,12 @@ static int xpad_init_input(struct usb_xp input_dev->name = xpad->name; input_dev->phys = xpad->phys;usb_to_input_id (xpad->udev, &input_dev->id); + +if (xpad->xtype ==XTYPE_XBOX360W ) { +/* x360w controllers and the receiver have different ids */ + input_dev->id.product =0x02a1 ; + } + input_dev->dev.parent = &xpad->intf->dev;input_set_drvdata (input_dev, xpad);
Greg Kroah-Hartman
maintainerPATCH 2/120 Input: i8042 - add Pegatron touchpad to noloop table
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcos Paulo de Souza <[email protected]>
commit 41c567a5d7d1a986763e58c3394782813c3bcb03 upstream.
Avoid AUX loopback in Pegatron C15B touchpad, so input subsystem is able to recognize a Synaptics touchpad in the AUX port.
Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=93791
(Touchpad is not detected on DNS 0801480 notebook (PEGATRON C15B))
--- drivers/input/serio/i8042-x86ia64io.h | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/input/serio/i8042-x86ia64io.h +6 -0
@@ -211,6 +211,12 @@ static const struct dmi_system_id __init DMI_MATCH(DMI_PRODUCT_VERSION, "Rev 1"), }, }, + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "PEGATRON CORPORATION"), + DMI_MATCH(DMI_PRODUCT_NAME, "C15B"), + }, + }, { } };
Greg Kroah-Hartman
maintainerPATCH 3/120 pinctrl: imx: fix imx_pinctrl_desc initialization
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gary Bisson <[email protected]>
commit 8f5983ad6b81070376db9487ce81000c85a16027 upstream.
--- drivers/pinctrl/freescale/pinctrl-imx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pinctrl/freescale/pinctrl-imx.c +4 -4
@@ -778,10 +778,10 @@ int imx_pinctrl_probe(struct platform_de imx_pinctrl_desc->name =dev_name (&pdev->dev); imx_pinctrl_desc->pins = info->pins; imx_pinctrl_desc->npins = info->npins; - imx_pinctrl_desc->pctlops = &imx_pctrl_ops, - imx_pinctrl_desc->pmxops = &imx_pmx_ops, - imx_pinctrl_desc->confops = &imx_pinconf_ops, - imx_pinctrl_desc->owner =THIS_MODULE , + imx_pinctrl_desc->pctlops = &imx_pctrl_ops; + imx_pinctrl_desc->pmxops = &imx_pmx_ops; + imx_pinctrl_desc->confops = &imx_pinconf_ops; + imx_pinctrl_desc->owner =THIS_MODULE ; ret =imx_pinctrl_probe_dt (pdev, info);if (ret) {
Greg Kroah-Hartman
maintainerPATCH 6/120 regulator: tps65086: Fix 25mV ranges for BUCK regulators
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew F. Davis <[email protected]>
commit d8ca5bd158f738c4fa6974ee388c381f64db7905 upstream.
The BUCK regulators 3, 4, and 5 also have a 10mV step mode, adjust the tables and logic to reflect the data-sheet for these regulators.
--- Documentation/devicetree/bindings/mfd/tps65086.txt | 2 drivers/regulator/tps65086-regulator.c | 54 ++++++++++----------- 2 files changed, 29 insertions(+), 27 deletions(-)
Documentation/devicetree/bindings/mfd/tps65086.txt +1 -1
@@ -23,7 +23,7 @@ Required properties: defined below. Optional regulator properties: - - ti,regulator-step-size-25mv : This is applicable for buck[1,2,6], set this + - ti,regulator-step-size-25mv : This is applicable for buck[1-6], set this if the regulator is factory set with a 25mv step voltage mapping. - ti,regulator-decay : This is applicable for buck[1-6], set this if
drivers/regulator/tps65086-regulator.c +28 -26
103 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 7/120 regulator: axp20x: Fix axp809 ldo_io registration error on cold boot
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
commit 618c808968852609d2d9f0e5cfc351a4807ef8d0 upstream.
The maximum supported voltage for ldo_io# is 3.3V, but on cold boot the selector comes up at 0x1f, which maps to 3.8V. This was previously corrected by Allwinner's U-boot, which set all regulators on the PMICs to some pre-configured voltage. With recent progress in U-boot SPL support, this is no longer the case. In any case we should handle this quirk in the kernel driver as well.
This invalid setting causes _regulator_get_voltage() to fail with -EINVAL which causes regulator registration to fail when constrains are used:
[ 1.054181] vcc-pg: failed to get the current voltage(-22) [ 1.059670] axp20x-regulator axp20x-regulator.0: Failed to register ldo_io0 [ 1.069749] axp20x-regulator: probe of axp20x-regulator.0 failed with error -22
This commits makes the axp20x regulator driver accept the 0x1f register value, fixing this.
The datasheet does not guarantee reliable operation above 3.3V, so on boards where this regulator is used the regulator-max-microvolt setting must be 3.3V or less.
This is essentially the same as the commit f40d4896bf32 ("regulator:
axp20x: Fix axp22x ldo_io registration error on cold boot") for AXP22x PMICs.
--- drivers/regulator/axp20x-regulator.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/regulator/axp20x-regulator.c +10 -2
@@ -337,10 +337,18 @@ static const struct regulator_desc axp80 AXP22X_ELDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(1)),AXP_DESC (AXP809 ,ELDO3 ,"eldo3" ,"eldoin" ,700 ,3300 ,100 ,AXP22X_ELDO3_V_OUT ,0x1f ,AXP22X_PWR_OUT_CTRL2 ,BIT (2 )), -AXP_DESC_IO (AXP809 ,LDO_IO0 ,"ldo_io0" ,"ips" ,700 ,3300 ,100 , +/* +* Note the datasheet only guarantees reliable operation up to +* 3.3V, this needs to be enforced via dts provided constraints +*/ +AXP_DESC_IO (AXP809 ,LDO_IO0 ,"ldo_io0" ,"ips" ,700 ,3800 ,100 ,AXP22X_LDO_IO0_V_OUT ,0x1f ,AXP20X_GPIO0_CTRL ,0x07 ,AXP22X_IO_ENABLED ,AXP22X_IO_DISABLED ), -AXP_DESC_IO (AXP809 ,LDO_IO1 ,"ldo_io1" ,"ips" ,700 ,3300 ,100 , +/* +* Note the datasheet only guarantees reliable operation up to +* 3.3V, this needs to be enforced via dts provided constraints +*/ +AXP_DESC_IO (AXP809 ,LDO_IO1 ,"ldo_io1" ,"ips" ,700 ,3800 ,100 ,AXP22X_LDO_IO1_V_OUT ,0x1f ,AXP20X_GPIO1_CTRL ,0x07 ,AXP22X_IO_ENABLED ,AXP22X_IO_DISABLED ), AXP_DESC_FIXED(AXP809, RTC_LDO, "rtc_ldo", "ips", 1800),
Greg Kroah-Hartman
maintainerPATCH 8/120 drm/tegra: dpaux: Fix error handling
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Jaillet <[email protected]>
commit 9376cad2073d2c122864754ea5f80025c8507b0b upstream.
The devm_pinctrl_register() function returns an error pointer or a valid handle. So checking for NULL here is pointless and can never trigger.
Check the returned value with IS_ERR instead and propagate this value as done in the other functions which call devm_pinctrl_register().
--- drivers/gpu/drm/tegra/dpaux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tegra/dpaux.c +2 -2
@@ -539,9 +539,9 @@ static int tegra_dpaux_probe(struct plat dpaux->desc.owner =THIS_MODULE ; dpaux->pinctrl =devm_pinctrl_register (&pdev->dev, &dpaux->desc, dpaux); -if (!dpaux->pinctrl) { +if (IS_ERR (dpaux->pinctrl)) {dev_err (&pdev->dev,"failed to register pincontrol\n" ); -return -ENODEV ; +return PTR_ERR (dpaux->pinctrl); }#endif /* enable and clear all interrupts */
Greg Kroah-Hartman
maintainerPATCH 9/120 drm/vc4: Fix a couple error codes in vc4_cl_lookup_bos()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit b2cdeb19f16ad984eb5bb9193f793d05a8101511 upstream.
If the allocation fails the current code returns success. If copy_from_user() fails it returns the number of bytes remaining instead of -EFAULT.
--- drivers/gpu/drm/vc4/vc4_gem.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/vc4/vc4_gem.c +5 -4
@@ -544,14 +544,15 @@ vc4_cl_lookup_bos(struct drm_device *dev handles =drm_malloc_ab (exec->bo_count,sizeof (uint32_t ));if (!handles) { + ret = -ENOMEM ;DRM_ERROR ("Failed to allocate incoming GEM handles\n" ); goto fail; } - ret =copy_from_user (handles, - (void __user *)(uintptr_t )args->bo_handles, - exec->bo_count *sizeof (uint32_t )); -if (ret) { +if (copy_from_user (handles, + (void __user *)(uintptr_t )args->bo_handles, + exec->bo_count *sizeof (uint32_t ))) { + ret = -EFAULT ;DRM_ERROR ("Failed to copy in GEM handles\n" ); goto fail; }
Greg Kroah-Hartman
maintainerPATCH 10/120 drm/savage: dereferencing an error pointer
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit f7741aa75e76440f4e9ecfe512feebe9bce33ca8 upstream.
A recent cleanup changed the kmalloc() + copy_from_user() to memdup_user() but the error handling wasn't updated so we might call kfree(-EFAULT) and crash.
--- drivers/gpu/drm/savage/savage_state.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/savage/savage_state.c +1 -0
@@ -1004,6 +1004,7 @@ int savage_bci_cmdbuf(struct drm_device kvb_addr =memdup_user (cmdbuf->vb_addr, cmdbuf->vb_size);if (IS_ERR (kvb_addr)) { ret =PTR_ERR (kvb_addr); + kvb_addr =NULL ; goto done; } cmdbuf->vb_addr = kvb_addr;
Greg Kroah-Hartman
maintainerPATCH 11/120 selftests: do not require bash to run netsocktests testcase
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rolf Eike Beer <[email protected]>
commit 3659f98b5375d195f1870c3e508fe51e52206839 upstream.
Nothing in this minimal script seems to require bash. We often run these tests on embedded devices where the only shell available is the busybox ash. Use sh instead.
--- tools/testing/selftests/net/run_netsocktests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/run_netsocktests +1 -1
@@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh echo "--------------------" echo "running socket test"
Greg Kroah-Hartman
maintainerPATCH 12/120 selftests: do not require bash for the generated test
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rolf Eike Beer <[email protected]>
commit a2b1e8a20c992b01eeb76de00d4f534cbe9f3822 upstream.
Nothing in this minimal script seems to require bash. We often run these tests on embedded devices where the only shell available is the busybox ash. Use sh instead.
--- tools/testing/selftests/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/Makefile +1 -1
@@ -87,7 +87,7 @@ ifdef INSTALL_PATH done; @# Ask all targets to emit their test scripts - echo "#!/bin/bash" > $(ALL_SCRIPT) + echo "#!/bin/sh" > $(ALL_SCRIPT) echo "cd \$$(dirname \$$0)" >> $(ALL_SCRIPT) echo "ROOT=\$$PWD" >> $(ALL_SCRIPT)
Greg Kroah-Hartman
maintainerPATCH 13/120 zram: revalidate disk under init_lock
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Minchan Kim <[email protected]>
commit e7ccfc4ccb703e0f033bd4617580039898e912dd upstream.
Commit b4c5c60920e3 ("zram: avoid lockdep splat by revalidate_disk") moved revalidate_disk call out of init_lock to avoid lockdep false-positive splat. However, commit 08eee69fcf6b ("zram: remove init_lock in zram_make_request") removed init_lock in IO path so there is no worry about lockdep splat. So, let's restore it.
This patch is needed to set BDI_CAP_STABLE_WRITES atomically in next patch.
--- drivers/block/zram/zram_drv.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/block/zram/zram_drv.c +1 -7
@@ -1094,14 +1094,8 @@ static ssize_t disksize_store(struct dev zram->comp = comp; zram->disksize = disksize;set_capacity (zram->disk, zram->disksize >>SECTOR_SHIFT ); -up_write (&zram->init_lock); - -/* -* Revalidate disk out of the init_lock to avoid lockdep splat. -* It's okay because disk's capacity is protected by init_lock -* so that revalidate_disk always sees up-to-date capacity. -*/ revalidate_disk (zram->disk); +up_write (&zram->init_lock);return len;
Greg Kroah-Hartman
maintainerPATCH 14/120 zram: support BDI_CAP_STABLE_WRITES
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Minchan Kim <[email protected]>
commit b09ab054b69b07077bd3292f67e777861ac796e5 upstream.
zram has used per-cpu stream feature from v4.7. It aims for increasing cache hit ratio of scratch buffer for compressing. Downside of that approach is that zram should ask memory space for compressed page in per-cpu context which requires stricted gfp flag which could be failed. If so, it retries to allocate memory space out of per-cpu context so it could get memory this time and compress the data again, copies it to the memory space.
In this scenario, zram assumes the data should never be changed but it is not true without stable page support. So, If the data is changed under us, zram can make buffer overrun so that zsmalloc free object chain is broken so system goes crash like below
https://bugzilla.suse.com/show_bug.cgi?id=997574
This patch adds BDI_CAP_STABLE_WRITES to zram for declaring "I am block device needing *stable write*".
--- drivers/block/zram/zram_drv.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/block/zram/zram_drv.c +11 -2
@@ -25,6 +25,7 @@#include <linux/genhd.h> #include <linux/highmem.h> #include <linux/slab.h> +#include <linux/backing-dev.h> #include <linux/string.h> #include <linux/vmalloc.h> #include <linux/err.h>
@@ -111,6 +112,14 @@ static inline bool is_partial_io(structreturn bvec->bv_len !=PAGE_SIZE ; } +static void zram_revalidate_disk (struct zram *zram) +{ +revalidate_disk (zram->disk); +/* revalidate_disk reset the BDI_CAP_STABLE_WRITES so set again */ + zram->disk->queue->backing_dev_info.capabilities |= +BDI_CAP_STABLE_WRITES ; +} +/* * Check if request is within bounds and aligned on zram logical blocks. */
@@ -1094,7 +1103,7 @@ static ssize_t disksize_store(struct dev zram->comp = comp; zram->disksize = disksize;set_capacity (zram->disk, zram->disksize >>SECTOR_SHIFT ); -revalidate_disk (zram->disk); +zram_revalidate_disk (zram);up_write (&zram->init_lock);return len;
@@ -1142,7 +1151,7 @@ static ssize_t reset_store(struct device/* Make sure all the pending I/O are finished */ fsync_bdev (bdev);zram_reset_device (zram); -revalidate_disk (zram->disk); +zram_revalidate_disk (zram);bdput (bdev);mutex_lock (&bdev->bd_mutex);
Greg Kroah-Hartman
maintainerPATCH 15/120 dax: fix deadlock with DAX 4k holes
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ross Zwisler <[email protected]>
commit 965d004af54088d138f806d04d803fb60d441986 upstream.
Currently in DAX if we have three read faults on the same hole address we can end up with the following:
Thread 0 Thread 1 Thread 2
-------- -------- --------dax_iomap_fault
grab_mapping_entry
lock_slot
<locks empty DAX entry>
dax_iomap_fault
grab_mapping_entry
get_unlocked_mapping_entry
<sleeps on empty DAX entry>
dax_iomap_fault
grab_mapping_entry
get_unlocked_mapping_entry
<sleeps on empty DAX entry>
dax_load_hole
find_or_create_page
...
page_cache_tree_insert
dax_wake_mapping_entry_waiter
<wakes one sleeper>
__radix_tree_replace
<swaps empty DAX entry with 4k zero page>
<wakes>
get_page
lock_page
...
put_locked_mapping_entry
unlock_page
put_page
<sleeps forever on the DAX
wait queue>
The crux of the problem is that once we insert a 4k zero page, all locking from then on is done in terms of that 4k zero page and any additional threads sleeping on the empty DAX entry will never be woken.
Fix this by waking all sleepers when we replace the DAX radix tree entry with a 4k zero page. This will allow all sleeping threads to successfully transition from locking based on the DAX empty entry to locking on the 4k zero page.
With the test case reported by Xiong this happens very regularly in my test setup, with some runs resulting in 9+ threads in this deadlocked state. With this fix I've been able to run that same test dozens of times in a loop without issue.
--- mm/filemap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/filemap.c +1 -1
@@ -144,7 +144,7 @@ static int page_cache_tree_insert(structworkingset_node_pages_dec (node);/* Wakeup waiters for exceptional entry lock */ dax_wake_mapping_entry_waiter (mapping, page->index, - false); + true); } }radix_tree_replace_slot (slot, page);
Greg Kroah-Hartman
maintainerPATCH 16/120 mm: pmd dirty emulation in page fault handler
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Minchan Kim <[email protected]>
commit 20f664aabeb88d582b623a625f83b0454fa34f07 upstream.
Andreas reported [1] made a test in jemalloc hang in THP mode in arm64:
http://lkml.kernel.org/r/[email protected]
The problem is currently page fault handler doesn't supports dirty bit emulation of pmd for non-HW dirty-bit architecture so that application stucks until VM marked the pmd dirty.
How the emulation work depends on the architecture. In case of arm64, when it set up pte firstly, it sets pte PTE_RDONLY to get a chance to mark the pte dirty via triggering page fault when store access happens. Once the page fault occurs, VM marks the pmd dirty and arch code for setting pmd will clear PTE_RDONLY for application to proceed.
IOW, if VM doesn't mark the pmd dirty, application hangs forever by repeated fault(i.e., store op but the pmd is PTE_RDONLY).
This patch enables pmd dirty-bit emulation for those architectures.
[1] b8d3c4c3009d, mm/huge_memory.c: don't split THP page when MADV_FREE syscall is called
--- mm/huge_memory.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
mm/huge_memory.c +4 -2
@@ -872,15 +872,17 @@ void huge_pmd_set_accessed(struct fault_ {pmd_t entry;unsigned long haddr; +bool write = fe->flags &FAULT_FLAG_WRITE ; fe->ptl =pmd_lock (fe->vma->vm_mm, fe->pmd);if (unlikely (!pmd_same (*fe->pmd, orig_pmd))) goto unlock; entry =pmd_mkyoung (orig_pmd); +if (write) + entry =pmd_mkdirty (entry); haddr = fe->address &HPAGE_PMD_MASK ; -if (pmdp_set_access_flags (fe->vma, haddr, fe->pmd, entry, - fe->flags &FAULT_FLAG_WRITE )) +if (pmdp_set_access_flags (fe->vma, haddr, fe->pmd, entry, write))update_mmu_cache_pmd (fe->vma, fe->address, fe->pmd); unlock:
Greg Kroah-Hartman
maintainerPATCH 17/120 mm: fix devm_memremap_pages crash, use mem_hotplug_{begin, done}
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit f931ab479dd24cf7a2c6e2df19778406892591fb upstream.
Both arch_add_memory() and arch_remove_memory() expect a single threaded context.
For example, arch/x86/mm/init_64.c::kernel_physical_mapping_init() does not hold any locks over this check and branch:
if (pgd_val(*pgd)) {
pud = (pud_t *)pgd_page_vaddr(*pgd);
paddr_last = phys_pud_init(pud, __pa(vaddr),
__pa(vaddr_end),
page_size_mask);
continue;
}
pud = alloc_low_page();
paddr_last = phys_pud_init(pud, __pa(vaddr), __pa(vaddr_end),
page_size_mask);The result is that two threads calling devm_memremap_pages() simultaneously can end up colliding on pgd initialization. This leads to crash signatures like the following where the loser of the race initializes the wrong pgd entry:
BUG: unable to handle kernel paging request at ffff888ebfff0000
IP: memcpy_erms+0x6/0x10
PGD 2f8e8fc067 PUD 0 /* <---- Invalid PUD */
Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
CPU: 54 PID: 3818 Comm: systemd-udevd Not tainted 4.6.7+ #13
task: ffff882fac290040 ti: ffff882f887a4000 task.ti: ffff882f887a4000
RIP: memcpy_erms+0x6/0x10
[..]
Call Trace:
? pmem_do_bvec+0x205/0x370 [nd_pmem]
? blk_queue_enter+0x3a/0x280
pmem_rw_page+0x38/0x80 [nd_pmem]
bdev_read_page+0x84/0xb0Hold the standard memory hotplug mutex over calls to arch_{add,remove}_memory().
--- kernel/memremap.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/memremap.c +4 -0
@@ -246,7 +246,9 @@ static void devm_memremap_pages_release(/* pages are dead and unused, undo the arch mapping */ align_start = res->start & ~(SECTION_SIZE -1 ); align_size =ALIGN (resource_size (res),SECTION_SIZE ); +mem_hotplug_begin ();arch_remove_memory (align_start, align_size); +mem_hotplug_done ();untrack_pfn (NULL ,PHYS_PFN (align_start), align_size);pgmap_radix_release (res); dev_WARN_ONCE(dev, pgmap->altmap && pgmap->altmap->alloc,
@@ -358,7 +360,9 @@ void *devm_memremap_pages(struct deviceif (error) goto err_pfn_remap; +mem_hotplug_begin (); error =arch_add_memory (nid, align_start, align_size, true); +mem_hotplug_done ();if (error) goto err_add_memory;
Greg Kroah-Hartman
maintainerPATCH 18/120 ocfs2: fix crash caused by stale lvb with fsdlm plugin
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Ren <[email protected]>
commit e7ee2c089e94067d68475990bdeed211c8852917 upstream.
The crash happens rather often when we reset some cluster nodes while nodes contend fiercely to do truncate and append.
The crash backtrace is below:
dlm: C21CBDA5E0774F4BA5A9D4F317717495: dlm_recover_grant 1 locks on 971 resources
dlm: C21CBDA5E0774F4BA5A9D4F317717495: dlm_recover 9 generation 5 done: 4 ms
ocfs2: Begin replay journal (node 318952601, slot 2) on device (253,18)
ocfs2: End replay journal (node 318952601, slot 2) on device (253,18)
ocfs2: Beginning quota recovery on device (253,18) for slot 2
ocfs2: Finishing quota recovery on device (253,18) for slot 2 (truncate,30154,1):ocfs2_truncate_file:470 ERROR: bug expression: le64_to_cpu(fe->i_size) != i_size_read(inode) (truncate,30154,1):ocfs2_truncate_file:470 ERROR: Inode 290321, inode i_size = 732 != di i_size = 937, i_flags = 0x1
------------[ cut here ]------------
kernel BUG at /usr/src/linux/fs/ocfs2/file.c:470!
invalid opcode: 0000 [#1] SMP
Modules linked in: ocfs2_stack_user(OEN) ocfs2(OEN) ocfs2_nodemanager ocfs2_stackglue(OEN) quota_tree dlm(OEN) configfs fuse sd_mod iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi af_packet iscsi_ibft iscsi_boot_sysfs softdog xfs libcrc32c ppdev parport_pc pcspkr parport joydev virtio_balloon virtio_net i2c_piix4 acpi_cpufreq button processor ext4 crc16 jbd2 mbcache ata_generic cirrus virtio_blk ata_piix drm_kms_helper ahci syscopyarea libahci sysfillrect sysimgblt fb_sys_fops ttm floppy libata drm virtio_pci virtio_ring uhci_hcd virtio ehci_hcd usbcore serio_raw usb_common sg dm_multipath dm_mod scsi_dh_rdac scsi_dh_emc scsi_dh_alua scsi_mod autofs4
Supported: No, Unsupported modules are loaded
CPU: 1 PID: 30154 Comm: truncate Tainted: G OE N 4.4.21-69-default #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.8.1-0-g4adadbd-20151112_172657-sheep25 04/01/2014
task: ffff88004ff6d240 ti: ffff880074e68000 task.ti: ffff880074e68000
RIP: 0010:[<ffffffffa05c8c30>] [<ffffffffa05c8c30>] ocfs2_truncate_file+0x640/0x6c0 [ocfs2]
RSP: 0018:ffff880074e6bd50 EFLAGS: 00010282
RAX: 0000000000000074 RBX: 000000000000029e RCX: 0000000000000000
RDX: 0000000000000001 RSI: 0000000000000246 RDI: 0000000000000246
RBP: ffff880074e6bda8 R08: 000000003675dc7a R09: ffffffff82013414
R10: 0000000000034c50 R11: 0000000000000000 R12: ffff88003aab3448
R13: 00000000000002dc R14: 0000000000046e11 R15: 0000000000000020
FS: 00007f839f965700(0000) GS:ffff88007fc80000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 00007f839f97e000 CR3: 0000000036723000 CR4: 00000000000006e0
Call Trace:
ocfs2_setattr+0x698/0xa90 [ocfs2]
notify_change+0x1ae/0x380
do_truncate+0x5e/0x90
do_sys_ftruncate.constprop.11+0x108/0x160
entry_SYSCALL_64_fastpath+0x12/0x6d
Code: 24 28 ba d6 01 00 00 48 c7 c6 30 43 62 a0 8b 41 2c 89 44 24 08 48 8b 41 20 48 c7 c1 78 a3 62 a0 48 89 04 24 31 c0 e8 a0 97 f9 ff <0f> 0b 3d 00 fe ff ff 0f 84 ab fd ff ff 83 f8 fc 0f 84 a2 fd ff
RIP [<ffffffffa05c8c30>] ocfs2_truncate_file+0x640/0x6c0 [ocfs2]It's because ocfs2_inode_lock() get us stale LVB in which the i_size is not equal to the disk i_size. We mistakenly trust the LVB because the underlaying fsdlm dlm_lock() doesn't set lkb_sbflags with DLM_SBF_VALNOTVALID properly for us. But, why?
The current code tries to downconvert lock without DLM_LKF_VALBLK flag to tell o2cb don't update RSB's LVB if it's a PR->NULL conversion, even if the lock resource type needs LVB. This is not the right way for fsdlm.
The fsdlm plugin behaves different on DLM_LKF_VALBLK, it depends on DLM_LKF_VALBLK to decide if we care about the LVB in the LKB. If DLM_LKF_VALBLK is not set, fsdlm will skip recovering RSB's LVB from this lkb and set the right DLM_SBF_VALNOTVALID appropriately when node failure happens.
The following diagram briefly illustrates how this crash happens:
RSB1 is inode metadata lock resource with LOCK_TYPE_USES_LVB;
The 1st round:
Node1 Node2
RSB1: PR
RSB1(master): NULL->EX
ocfs2_downconvert_lock(PR->NULL, set_lvb==0)
ocfs2_dlm_lock(no DLM_LKF_VALBLK)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
dlm_lock(no DLM_LKF_VALBLK)
convert_lock(overwrite lkb->lkb_exflags
with no DLM_LKF_VALBLK)
RSB1: NULL RSB1: EX
reset Node2dlm_recover_rsbs()
recover_lvb()
/* The LVB is not trustable if the node with EX fails and
* no lock >= PR is left. We should set RSB_VALNOTVALID for RSB1. */
if(!(kb_exflags & DLM_LKF_VALBLK)) /* This means we miss the chance to
return; * to invalid the LVB here.
*/
The 2nd round:
Node 1 Node2
RSB1(become master from recovery)
ocfs2_setattr()
ocfs2_inode_lock(NULL->EX)
/* dlm_lock() return the stale lvb without setting DLM_SBF_VALNOTVALID */ ocfs2_meta_lvb_is_trustable() return 1 /* so we don't refresh inode from disk */
ocfs2_truncate_file()
mlog_bug_on_msg(disk isize != i_size_read(inode)) /* crash! */
The fix is quite straightforward. We keep to set DLM_LKF_VALBLK flag for dlm_lock() if the lock resource type needs LVB and the fsdlm plugin is uesed.
--- fs/ocfs2/dlmglue.c | 10 ++++++++++ fs/ocfs2/stackglue.c | 6 ++++++ fs/ocfs2/stackglue.h | 3 +++ 3 files changed, 19 insertions(+)
fs/ocfs2/dlmglue.c +10 -0
@@ -3303,6 +3303,16 @@ static int ocfs2_downconvert_lock(structmlog (ML_BASTS ,"lockres %s, level %d => %d\n" , lockres->l_name, lockres->l_level, new_level); +/* +* On DLM_LKF_VALBLK, fsdlm behaves differently with o2cb. It always +* expects DLM_LKF_VALBLK being set if the LKB has LVB, so that +* we can recover correctly from node failure. Otherwise, we may get +* invalid LVB in LKB, but without DLM_SBF_VALNOTVALID being set. +*/ +if (!ocfs2_is_o2cb_active () && + lockres->l_ops->flags &LOCK_TYPE_USES_LVB ) + lvb =1 ; +if (lvb) dlm_flags |=DLM_LKF_VALBLK ;
fs/ocfs2/stackglue.c +6 -0
@@ -48,6 +48,12 @@ static char ocfs2_hb_ctl_path[OCFS2_MAX_*/ static struct ocfs2_stack_plugin *active_stack; +inline int ocfs2_is_o2cb_active (void ) +{ +return !strcmp (active_stack->sp_name,OCFS2_STACK_PLUGIN_O2CB ); +} +EXPORT_SYMBOL_GPL (ocfs2_is_o2cb_active); +static struct ocfs2_stack_plugin *ocfs2_stack_lookup (const char *name) {struct ocfs2_stack_plugin *p;
fs/ocfs2/stackglue.h +3 -0
@@ -298,6 +298,9 @@ void ocfs2_stack_glue_set_max_proto_versint ocfs2_stack_glue_register (struct ocfs2_stack_plugin *plugin);void ocfs2_stack_glue_unregister (struct ocfs2_stack_plugin *plugin); +/* In ocfs2_downconvert_lock(), we need to know which stack we are using */ +int ocfs2_is_o2cb_active (void ); +extern struct kset *ocfs2_kset;#endif /* STACKGLUE_H */
Greg Kroah-Hartman
maintainerPATCH 19/120 mm, memcg: fix the active list aging for lowmem requests when memcg is enabled
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Hocko <[email protected]>
commit b4536f0c829c8586544c94735c343f9b5070bd01 upstream.
Nils Holland and Klaus Ethgen have reported unexpected OOM killer invocations with 32b kernel starting with 4.8 kernels
kworker/u4:5 invoked oom-killer: gfp_mask=0x2400840(GFP_NOFS|__GFP_NOFAIL), nodemask=0, order=0, oom_score_adj=0 kworker/u4:5 cpuset=/ mems_allowed=0 CPU: 1 PID: 2603 Comm: kworker/u4:5 Not tainted 4.9.0-gentoo #2 [...] Mem-Info: active_anon:58685 inactive_anon:90 isolated_anon:0 active_file:274324 inactive_file:281962 isolated_file:0 unevictable:0 dirty:649 writeback:0 unstable:0 slab_reclaimable:40662 slab_unreclaimable:17754 mapped:7382 shmem:202 pagetables:351 bounce:0 free:206736 free_pcp:332 free_cma:0 Node 0 active_anon:234740kB inactive_anon:360kB active_file:1097296kB inactive_file:1127848kB unevictable:0kB isolated(anon):0kB isolated(file):0kB mapped:29528kB dirty:2596kB writeback:0kB shmem:0kB shmem_thp: 0kB shmem_pmdmapped: 184320kB anon_thp: 808kB writeback_tmp:0kB unstable:0kB pages_scanned:0 all_unreclaimable? no DMA free:3952kB min:788kB low:984kB high:1180kB active_anon:0kB inactive_anon:0kB active_file:7316kB inactive_file:0kB unevictable:0kB writepending:96kB present:15992kB managed:15916kB mlocked:0kB slab_reclaimable:3200kB slab_unreclaimable:1408kB kernel_stack:0kB pagetables:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB lowmem_reserve[]: 0 813 3474 3474 Normal free:41332kB min:41368kB low:51708kB high:62048kB active_anon:0kB inactive_anon:0kB active_file:532748kB inactive_file:44kB unevictable:0kB writepending:24kB present:897016kB managed:836248kB mlocked:0kB slab_reclaimable:159448kB slab_unreclaimable:69608kB kernel_stack:1112kB pagetables:1404kB bounce:0kB free_pcp:528kB local_pcp:340kB free_cma:0kB lowmem_reserve[]: 0 0 21292 21292 HighMem free:781660kB min:512kB low:34356kB high:68200kB active_anon:234740kB inactive_anon:360kB active_file:557232kB inactive_file:1127804kB unevictable:0kB writepending:2592kB present:2725384kB managed:2725384kB mlocked:0kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:0kB bounce:0kB free_pcp:800kB local_pcp:608kB free_cma:0kB
the oom killer is clearly pre-mature because there there is still a lot of page cache in the zone Normal which should satisfy this lowmem request. Further debugging has shown that the reclaim cannot make any forward progress because the page cache is hidden in the active list which doesn't get rotated because inactive_list_is_low is not memcg aware.
The code simply subtracts per-zone highmem counters from the respective memcg's lru sizes which doesn't make any sense. We can simply end up always seeing the resulting active and inactive counts 0 and return false. This issue is not limited to 32b kernels but in practice the effect on systems without CONFIG_HIGHMEM would be much harder to notice because we do not invoke the OOM killer for allocations requests targeting < ZONE_NORMAL.
Fix the issue by tracking per zone lru page counts in mem_cgroup_per_node and subtract per-memcg highmem counts when memcg is enabled. Introduce helper lruvec_zone_lru_size which redirects to either zone counters or mem_cgroup_get_zone_lru_size when appropriate.
We are losing empty LRU but non-zero lru size detection introduced by ca707239e8a7 ("mm: update_lru_size warn and reset bad lru_size") because of the inherent zone vs. node discrepancy.
--- include/linux/memcontrol.h | 26 +++++++++++++++++++++++--- include/linux/mm_inline.h | 2 +- mm/memcontrol.c | 18 ++++++++---------- mm/vmscan.c | 27 +++++++++++++++++---------- 4 files changed, 49 insertions(+), 24 deletions(-)
include/linux/memcontrol.h +23 -3
@@ -120,7 +120,7 @@ struct mem_cgroup_reclaim_iter {*/ struct mem_cgroup_per_node {struct lruvec lruvec; -unsigned long lru_size[NR_LRU_LISTS ]; +unsigned long lru_zone_size[MAX_NR_ZONES ][NR_LRU_LISTS ];struct mem_cgroup_reclaim_iter iter[DEF_PRIORITY +1 ];
@@ -432,7 +432,7 @@ static inline bool mem_cgroup_online(strint mem_cgroup_select_victim_node (struct mem_cgroup *memcg);void mem_cgroup_update_lru_size (struct lruvec *lruvec,enum lru_list lru, -int nr_pages); +int zid,int nr_pages);unsigned long mem_cgroup_node_nr_lru_pages (struct mem_cgroup *memcg,int nid,unsigned int lru_mask);
@@ -441,9 +441,23 @@ static inlineunsigned long mem_cgroup_get_lru_size (struct lruvec *lruvec,enum lru_list lru) {struct mem_cgroup_per_node *mz; +unsigned long nr_pages =0 ; +int zid; mz = container_of(lruvec, struct mem_cgroup_per_node, lruvec); -return mz->lru_size[lru]; +for (zid =0 ; zid <MAX_NR_ZONES ; zid++) + nr_pages += mz->lru_zone_size[zid][lru]; +return nr_pages; +} + +static inline +unsigned long mem_cgroup_get_zone_lru_size (struct lruvec *lruvec, +enum lru_list lru,int zone_idx) +{ +struct mem_cgroup_per_node *mz; + + mz = container_of(lruvec, struct mem_cgroup_per_node, lruvec); +return mz->lru_zone_size[zone_idx][lru]; }void mem_cgroup_handle_over_high (void );
@@ -671,6 +685,12 @@ mem_cgroup_get_lru_size(struct lruvec *l {return 0 ; } +static inline +unsigned long mem_cgroup_get_zone_lru_size (struct lruvec *lruvec, +enum lru_list lru,int zone_idx) +{ +return 0 ; +} static inline unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg,
include/linux/mm_inline.h +1 -1
@@ -39,7 +39,7 @@ static __always_inline void update_lru_s {__update_lru_size (lruvec, lru, zid, nr_pages);#ifdef CONFIG_MEMCG -mem_cgroup_update_lru_size (lruvec, lru, nr_pages); +mem_cgroup_update_lru_size (lruvec, lru, zid, nr_pages);#endif }
mm/memcontrol.c +8 -10
@@ -625,8 +625,8 @@ static void mem_cgroup_charge_statisticsunsigned long mem_cgroup_node_nr_lru_pages (struct mem_cgroup *memcg,int nid,unsigned int lru_mask) { +struct lruvec *lruvec =mem_cgroup_lruvec (NODE_DATA (nid), memcg);unsigned long nr =0 ; -struct mem_cgroup_per_node *mz;enum lru_list lru;VM_BUG_ON ((unsigned )nid >= nr_node_ids);
@@ -634,8 +634,7 @@ unsigned long mem_cgroup_node_nr_lru_pagfor_each_lru (lru) {if (!(BIT (lru) & lru_mask))continue ; - mz =mem_cgroup_nodeinfo (memcg, nid); - nr += mz->lru_size[lru]; + nr +=mem_cgroup_get_lru_size (lruvec, lru); }return nr; }
@@ -1002,6 +1001,7 @@ out:* mem_cgroup_update_lru_size - account for adding or removing an lru page * @lruvec: mem_cgroup per zone lru vector * @lru: index of lru list the page is sitting on +* @zid: zone id of the accounted pages * @nr_pages: positive when adding or negative when removing * * This function must be called under lru_lock, just before a page is added
@@ -1009,27 +1009,25 @@ out:* so as to allow it to check that lru_size 0 is consistent with list_empty). */ void mem_cgroup_update_lru_size (struct lruvec *lruvec,enum lru_list lru, -int nr_pages) +int zid,int nr_pages) {struct mem_cgroup_per_node *mz;unsigned long *lru_size;long size; -bool empty;if (mem_cgroup_disabled ())return ; mz = container_of(lruvec, struct mem_cgroup_per_node, lruvec); - lru_size = mz->lru_size + lru; - empty =list_empty (lruvec->lists + lru); + lru_size = &mz->lru_zone_size[zid][lru];if (nr_pages <0 ) *lru_size += nr_pages; size = *lru_size; -if (WARN_ONCE (size <0 || empty != !size, -"%s(%p, %d, %d): lru_size %ld but %sempty\n" , - __func__, lruvec, lru, nr_pages, size, empty ?"" :"not " )) { +if (WARN_ONCE (size <0 , +"%s(%p, %d, %d): lru_size %ld\n" , + __func__, lruvec, lru, nr_pages, size)) {VM_BUG_ON (1 ); *lru_size =0 ; }
mm/vmscan.c +17 -10
@@ -242,6 +242,16 @@ unsigned long lruvec_lru_size(struct lrureturn node_page_state (lruvec_pgdat (lruvec),NR_LRU_BASE + lru); } +unsigned long lruvec_zone_lru_size (struct lruvec *lruvec,enum lru_list lru, +int zone_idx) +{ +if (!mem_cgroup_disabled ()) +return mem_cgroup_get_zone_lru_size (lruvec, lru, zone_idx); + +return zone_page_state (&lruvec_pgdat (lruvec)->node_zones[zone_idx], +NR_ZONE_LRU_BASE + lru); +} +/* * Add a shrinker callback to be called from the vm. */
@@ -1382,8 +1392,7 @@ int __isolate_lru_page(struct page *page* be complete before mem_cgroup_update_lru_size due to a santity check. */ static __always_inline void update_lru_sizes(struct lruvec *lruvec, -enum lru_list lru,unsigned long *nr_zone_taken, -unsigned long nr_taken) +enum lru_list lru,unsigned long *nr_zone_taken) {int zid;
@@ -1392,11 +1401,11 @@ static __always_inline void update_lru_scontinue ;__update_lru_size (lruvec, lru, zid, -nr_zone_taken[zid]); - } -#ifdef CONFIG_MEMCG -mem_cgroup_update_lru_size (lruvec, lru, -nr_taken); +mem_cgroup_update_lru_size (lruvec, lru, zid, -nr_zone_taken[zid]);#endif + } + }/*
@@ -1501,7 +1510,7 @@ static unsigned long isolate_lru_pages(u *nr_scanned = scan;trace_mm_vmscan_lru_isolate (sc->reclaim_idx, sc->order, nr_to_scan, scan, nr_taken, mode,is_file_lru (lru)); -update_lru_sizes (lruvec, lru, nr_zone_taken, nr_taken); +update_lru_sizes (lruvec, lru, nr_zone_taken);return nr_taken; }
@@ -2047,10 +2056,8 @@ static bool inactive_list_is_low(structif (!managed_zone (zone))continue ; - inactive_zone =zone_page_state (zone, -NR_ZONE_LRU_BASE + (file *LRU_FILE )); - active_zone =zone_page_state (zone, -NR_ZONE_LRU_BASE + (file *LRU_FILE ) +LRU_ACTIVE ); + inactive_zone =lruvec_zone_lru_size (lruvec, file *LRU_FILE , zid); + active_zone =lruvec_zone_lru_size (lruvec, (file *LRU_FILE ) +LRU_ACTIVE , zid); inactive -=min (inactive, inactive_zone); active -=min (active, active_zone);
Greg Kroah-Hartman
maintainerPATCH 20/120 mm: support anonymous stable page
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Minchan Kim <[email protected]>
commit f05714293a591038304ddae7cb0dd747bb3786cc upstream.
During developemnt for zram-swap asynchronous writeback, I found strange corruption of compressed page, resulting in:
Modules linked in: zram(E)
CPU: 3 PID: 1520 Comm: zramd-1 Tainted: G E 4.8.0-mm1-00320-ge0d4894c9c38-dirty #3274
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
task: ffff88007620b840 task.stack: ffff880078090000
RIP: set_freeobj.part.43+0x1c/0x1f
RSP: 0018:ffff880078093ca8 EFLAGS: 00010246
RAX: 0000000000000018 RBX: ffff880076798d88 RCX: ffffffff81c408c8
RDX: 0000000000000018 RSI: 0000000000000000 RDI: 0000000000000246
RBP: ffff880078093cb0 R08: 0000000000000000 R09: 0000000000000000
R10: ffff88005bc43030 R11: 0000000000001df3 R12: ffff880076798d88
R13: 000000000005bc43 R14: ffff88007819d1b8 R15: 0000000000000001
FS: 0000000000000000(0000) GS:ffff88007e380000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fc934048f20 CR3: 0000000077b01000 CR4: 00000000000406e0
Call Trace:
obj_malloc+0x22b/0x260
zs_malloc+0x1e4/0x580
zram_bvec_rw+0x4cd/0x830 [zram]
page_requests_rw+0x9c/0x130 [zram]
zram_thread+0xe6/0x173 [zram]
kthread+0xca/0xe0
ret_from_fork+0x25/0x30With investigation, it reveals currently stable page doesn't support anonymous page. IOW, reuse_swap_page can reuse the page without waiting writeback completion so it can overwrite page zram is compressing.
Unfortunately, zram has used per-cpu stream feature from v4.7. It aims for increasing cache hit ratio of scratch buffer for compressing. Downside of that approach is that zram should ask memory space for compressed page in per-cpu context which requires stricted gfp flag which could be failed. If so, it retries to allocate memory space out of per-cpu context so it could get memory this time and compress the data again, copies it to the memory space.
In this scenario, zram assumes the data should never be changed but it is not true unless stable page supports. So, If the data is changed under us, zram can make buffer overrun because second compression size could be bigger than one we got in previous trial and blindly, copy bigger size object to smaller buffer which is buffer overrun. The overrun breaks zsmalloc free object chaining so system goes crash like above.
I think below is same problem.
https://bugzilla.suse.com/show_bug.cgi?id=997574
Unfortunately, reuse_swap_page should be atomic so that we cannot wait on writeback in there so the approach in this patch is simply return false if we found it needs stable page. Although it increases memory footprint temporarily, it happens rarely and it should be reclaimed easily althoug it happened. Also, It would be better than waiting of IO completion, which is critial path for application latency.
--- include/linux/swap.h | 3 ++- mm/swapfile.c | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-)
include/linux/swap.h +2 -1
@@ -150,8 +150,9 @@ enum {SWP_FILE = (1 <<7 ),/* set after swap_activate success */ SWP_AREA_DISCARD = (1 <<8 ),/* single-time swap area discards */ SWP_PAGE_DISCARD = (1 <<9 ),/* freed swap page-cluster discards */ +SWP_STABLE_WRITES = (1 <<10 ),/* no overwrite PG_writeback pages */ /* add others here before... */ - SWP_SCANNING = (1 << 10), /* refcount in scan_swap_map */ + SWP_SCANNING = (1 << 11), /* refcount in scan_swap_map */ };#define SWAP_CLUSTER_MAX 32UL
mm/swapfile.c +19 -1
@@ -943,11 +943,25 @@ bool reuse_swap_page(struct page *page, count =page_trans_huge_mapcount (page, total_mapcount);if (count <=1 &&PageSwapCache (page)) { count +=page_swapcount (page); -if (count ==1 && !PageWriteback (page)) { +if (count !=1 ) + goto out; +if (!PageWriteback (page)) {delete_from_swap_cache (page);SetPageDirty (page); + }else { +swp_entry_t entry; +struct swap_info_struct *p; + + entry.val =page_private (page); + p =swap_info_get (entry); +if (p->flags &SWP_STABLE_WRITES ) { +spin_unlock (&p->lock); +return false; + } +spin_unlock (&p->lock); } } +out:return count <=1 ; }
@@ -2449,6 +2463,10 @@ SYSCALL_DEFINE2(swapon, const char __use error = -ENOMEM ; goto bad_swap; } + +if (bdi_cap_stable_pages_required (inode_to_bdi (inode))) + p->flags |=SWP_STABLE_WRITES ; +if (p->bdev &&blk_queue_nonrot (bdev_get_queue (p->bdev))) {int cpu;
Greg Kroah-Hartman
maintainerPATCH 21/120 mm/slab.c: fix SLAB freelist randomization duplicate entries
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Sperbeck <[email protected]>
commit c4e490cf148e85ead0d1b1c2caaba833f1d5b29f upstream.
This patch fixes a bug in the freelist randomization code. When a high random number is used, the freelist will contain duplicate entries. It will result in different allocations sharing the same chunk.
It will result in odd behaviours and crashes. It should be uncommon but it depends on the machines. We saw it happening more often on some machines (every few hours of running tests).
--- mm/slab.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
mm/slab.c +4 -4
@@ -2475,7 +2475,6 @@ union freelist_init_state {unsigned int pos;unsigned int *list;unsigned int count; -unsigned int rand; };struct rnd_state rnd_state; };
@@ -2501,8 +2500,7 @@ static bool freelist_state_initialize(un }else { state->list = cachep->random_seq; state->count = count; - state->pos =0 ; - state->rand = rand; + state->pos = rand % count; ret = true; }return ret;
@@ -2511,7 +2509,9 @@ static bool freelist_state_initialize(un/* Get the next entry on the list and randomize it using a random shift */ static freelist_idx_t next_random_slot (union freelist_init_state *state) { -return (state->list[state->pos++] + state->rand) % state->count; +if (state->pos >= state->count) + state->pos =0 ; +return state->list[state->pos++]; }/* Swap two freelist entries */
Greg Kroah-Hartman
maintainerPATCH 22/120 mm/hugetlb.c: fix reservation race when freeing surplus pages
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Kravetz <[email protected]>
commit e5bbc8a6c992901058bc09e2ce01d16c111ff047 upstream.
return_unused_surplus_pages() decrements the global reservation count, and frees any unused surplus pages that were backing the reservation.
Commit 7848a4bf51b3 ("mm/hugetlb.c: add cond_resched_lock() in return_unused_surplus_pages()") added a call to cond_resched_lock in the loop freeing the pages.
As a result, the hugetlb_lock could be dropped, and someone else could use the pages that will be freed in subsequent iterations of the loop. This could result in inconsistent global hugetlb page state, application api failures (such as mmap) failures or application crashes.
When dropping the lock in return_unused_surplus_pages, make sure that the global reservation count (resv_huge_pages) remains sufficiently large to prevent someone else from claiming pages about to be freed.
Analyzed by Paul Cassella.
--- mm/hugetlb.c | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-)
mm/hugetlb.c +28 -9
@@ -1773,23 +1773,32 @@ free: }/* -* When releasing a hugetlb pool reservation, any surplus pages that were -* allocated to satisfy the reservation must be explicitly freed if they were -* never used. -* Called with hugetlb_lock held. +* This routine has two main purposes: +* 1) Decrement the reservation count (resv_huge_pages) by the value passed +* in unused_resv_pages. This corresponds to the prior adjustments made +* to the associated reservation map. +* 2) Free any unused surplus pages that may have been allocated to satisfy +* the reservation. As many as unused_resv_pages may be freed. +* +* Called with hugetlb_lock held. However, the lock could be dropped (and +* reacquired) during calls to cond_resched_lock. Whenever dropping the lock, +* we must make sure nobody else can claim pages we are in the process of +* freeing. Do this by ensuring resv_huge_page always is greater than the +* number of huge pages we plan to free when dropping the lock. */ static void return_unused_surplus_pages (struct hstate *h,unsigned long unused_resv_pages) {unsigned long nr_pages; -/* Uncommit the reservation */ - h->resv_huge_pages -= unused_resv_pages; -/* Cannot return gigantic pages currently */ if (hstate_is_gigantic (h)) -return ; + goto out; +/* +* Part (or even all) of the reservation could have been backed +* by pre-allocated pages. Only free surplus pages. +*/ nr_pages =min (unused_resv_pages, h->surplus_huge_pages);/*
@@ -1799,12 +1808,22 @@ static void return_unused_surplus_pages(* when the nodes with surplus pages have no free pages. * free_pool_huge_page() will balance the the freed pages across the * on-line nodes with memory and will handle the hstate accounting. +* +* Note that we decrement resv_huge_pages as we free the pages. If +* we drop the lock, resv_huge_pages will still be sufficiently large +* to cover subsequent pages we may free. */ while (nr_pages--) { + h->resv_huge_pages--; + unused_resv_pages--;if (!free_pool_huge_page (h, &node_states[N_MEMORY ],1 )) -break ; + goto out;cond_resched_lock (&hugetlb_lock); } + +out: +/* Fully uncommit the reservation */ + h->resv_huge_pages -= unused_resv_pages; }
Greg Kroah-Hartman
maintainerPATCH 23/120 KVM: x86: fix emulation of "MOV SS, null selector"
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Bonzini <[email protected]>
commit 33ab91103b3415e12457e3104f0e4517ce12d0f3 upstream.
This is CVE-2017-2583. On Intel this causes a failed vmentry because SS's type is neither 3 nor 7 (even though the manual says this check is only done for usable SS, and the dmesg splat says that SS is unusable!). On AMD it's worse: svm.c is confused and sets CPL to 0 in the vmcb.
The fix fabricates a data segment descriptor when SS is set to a null selector, so that CPL and SS.DPL are set correctly in the VMCS/vmcb. Furthermore, only allow setting SS to a NULL selector if SS.RPL < 3; this in turn ensures CPL < 3 because RPL must be equal to CPL.
Thanks to Andy Lutomirski and Willy Tarreau for help in analyzing the bug and deciphering the manuals.
--- arch/x86/kvm/emulate.c | 48 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 10 deletions(-)
arch/x86/kvm/emulate.c +38 -10
@@ -1544,7 +1544,6 @@ static int write_segment_descriptor(stru &ctxt->exception); } -/* Does not support long mode */ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt, u16 selector, int seg, u8 cpl, enum x86_transfer_type transfer,
@@ -1581,20 +1580,34 @@ static int __load_segment_descriptor(str rpl = selector &3 ; -/* NULL selector is not valid for TR, CS and SS (except for long mode) */ -if ((seg ==VCPU_SREG_CS - || (seg ==VCPU_SREG_SS - && (ctxt->mode !=X86EMUL_MODE_PROT64 || rpl != cpl)) - || seg ==VCPU_SREG_TR ) - && null_selector) - goto exception; -/* TR should be in GDT only */ if (seg ==VCPU_SREG_TR && (selector & (1 <<2 ))) goto exception; -if (null_selector)/* for NULL selector skip all following checks */ +/* NULL selector is not valid for TR, CS and (except for long mode) SS */ +if (null_selector) { +if (seg ==VCPU_SREG_CS || seg ==VCPU_SREG_TR ) + goto exception; + +if (seg ==VCPU_SREG_SS ) { +if (ctxt->mode !=X86EMUL_MODE_PROT64 || rpl != cpl) + goto exception; + +/* +* ctxt->ops->set_segment expects the CPL to be in +* SS.DPL, so fake an expand-up 32-bit data segment. +*/ + seg_desc.type =3 ; + seg_desc.p =1 ; + seg_desc.s =1 ; + seg_desc.dpl = cpl; + seg_desc.d =1 ; + seg_desc.g =1 ; + } + +/* Skip all following checks */ goto load; + } ret =read_segment_descriptor (ctxt, selector, &seg_desc, &desc_addr);if (ret !=X86EMUL_CONTINUE )
@@ -1710,6 +1723,21 @@ static int load_segment_descriptor(struc u16 selector, int seg) {u8 cpl = ctxt->ops->cpl (ctxt); + +/* +* None of MOV, POP and LSS can load a NULL selector in CPL=3, but +* they can load it at CPL<3 (Intel's manual says only LSS can, +* but it's wrong). +* +* However, the Intel manual says that putting IST=1/DPL=3 in +* an interrupt gate will result in SS=3 (the AMD manual instead +* says it doesn't), so allow SS=3 in __load_segment_descriptor +* and only forbid it here. +*/ +if (seg ==VCPU_SREG_SS && selector ==3 && + ctxt->mode ==X86EMUL_MODE_PROT64 ) +return emulate_exception (ctxt,GP_VECTOR ,0 , true); +return __load_segment_descriptor (ctxt, selector, seg, cpl,X86_TRANSFER_NONE ,NULL ); }
Greg Kroah-Hartman
maintainerPATCH 25/120 jump_labels: API for flushing deferred jump label updates
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Matlack <[email protected]>
commit b6416e61012429e0277bd15a229222fd17afc1c1 upstream.
Modules that use static_key_deferred need a way to synchronize with any delayed work that is still pending when the module is unloaded. Introduce static_key_deferred_flush() which flushes any pending jump label updates.
--- include/linux/jump_label_ratelimit.h | 5 +++++ kernel/jump_label.c | 7 +++++++ 2 files changed, 12 insertions(+)
include/linux/jump_label_ratelimit.h +5 -0
@@ -14,6 +14,7 @@ struct static_key_deferred {#ifdef HAVE_JUMP_LABEL extern void static_key_slow_dec_deferred (struct static_key_deferred *key); +extern void static_key_deferred_flush (struct static_key_deferred *key);extern void jump_label_rate_limit (struct static_key_deferred *key,unsigned long rl);
@@ -26,6 +27,10 @@ static inline void static_key_slow_dec_dSTATIC_KEY_CHECK_USE ();static_key_slow_dec (&key->key); } +static inline void static_key_deferred_flush (struct static_key_deferred *key) +{ +STATIC_KEY_CHECK_USE (); +}static inline void jump_label_rate_limit (struct static_key_deferred *key,unsigned long rl)
kernel/jump_label.c +7 -0
@@ -182,6 +182,13 @@ void static_key_slow_dec_deferred(struct }EXPORT_SYMBOL_GPL (static_key_slow_dec_deferred); +void static_key_deferred_flush (struct static_key_deferred *key) +{ +STATIC_KEY_CHECK_USE (); +flush_delayed_work (&key->work); +} +EXPORT_SYMBOL_GPL (static_key_deferred_flush); +void jump_label_rate_limit (struct static_key_deferred *key,unsigned long rl) {
Greg Kroah-Hartman
maintainerPATCH 26/120 KVM: x86: flush pending lapic jump label updates on module unload
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Matlack <[email protected]>
commit cef84c302fe051744b983a92764d3fcca933415d upstream.
KVM's lapic emulation uses static_key_deferred (apic_{hw,sw}_disabled). These are implemented with delayed_work structs which can still be pending when the KVM module is unloaded. We've seen this cause kernel panics when the kvm_intel module is quickly reloaded.
Use the new static_key_deferred_flush() API to flush pending updates on module unload.
--- arch/x86/kvm/lapic.c | 6 ++++++ arch/x86/kvm/lapic.h | 1 + arch/x86/kvm/x86.c | 1 + 3 files changed, 8 insertions(+)
arch/x86/kvm/lapic.c +6 -0
@@ -2360,3 +2360,9 @@ void kvm_lapic_init(void)jump_label_rate_limit (&apic_hw_disabled,HZ );jump_label_rate_limit (&apic_sw_disabled,HZ ); } + +void kvm_lapic_exit (void ) +{ +static_key_deferred_flush (&apic_hw_disabled); +static_key_deferred_flush (&apic_sw_disabled); +}
arch/x86/kvm/lapic.h +1 -0
@@ -108,6 +108,7 @@ static inline bool kvm_hv_vapic_assist_pint kvm_lapic_enable_pv_eoi (struct kvm_vcpu *vcpu,u64 data);void kvm_lapic_init (void ); +void kvm_lapic_exit (void );#define VEC_POS (v) ((v) & (32 - 1))#define REG_POS (v) (((v) >> 5) << 4)
arch/x86/kvm/x86.c +1 -0
@@ -5963,6 +5963,7 @@ out:void kvm_arch_exit (void ) { +kvm_lapic_exit ();perf_unregister_guest_info_callbacks (&kvm_guest_cbs);if (!boot_cpu_has (X86_FEATURE_CONSTANT_TSC ))
Greg Kroah-Hartman
maintainerPATCH 31/120 KVM: x86: Introduce segmented_write_std
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve Rutherford <[email protected]>
commit 129a72a0d3c8e139a04512325384fe5ac119e74d upstream.
Introduces segemented_write_std.
Switches from emulated reads/writes to standard read/writes in fxsave, fxrstor, sgdt, and sidt. This fixes CVE-2017-2584, a longstanding kernel memory leak.
Since commit 283c95d0e389 ("KVM: x86: emulate FXSAVE and FXRSTOR", 2016-11-09), which is luckily not yet in any final release, this would also be an exploitable kernel memory *write*!
--- arch/x86/kvm/emulate.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
arch/x86/kvm/emulate.c +18 -4
@@ -815,6 +815,20 @@ static int segmented_read_std(struct x86return ctxt->ops->read_std (ctxt, linear, data, size, &ctxt->exception); } +static int segmented_write_std (struct x86_emulate_ctxt *ctxt, +struct segmented_address addr, +void *data, +unsigned int size) +{ +int rc; +ulong linear; + + rc =linearize (ctxt, addr, size, true, &linear); +if (rc !=X86EMUL_CONTINUE ) +return rc; +return ctxt->ops->write_std (ctxt, linear, data, size, &ctxt->exception); +} +/* * Prefetch the remaining bytes of the instruction without crossing page * boundary if they are not in fetch_cache yet.
@@ -3710,8 +3724,8 @@ static int emulate_store_desc_ptr(struct }/* Disable writeback. */ ctxt->dst.type =OP_NONE ; -return segmented_write (ctxt, ctxt->dst.addr.mem, - &desc_ptr,2 + ctxt->op_bytes); +return segmented_write_std (ctxt, ctxt->dst.addr.mem, + &desc_ptr,2 + ctxt->op_bytes); }static int em_sgdt (struct x86_emulate_ctxt *ctxt)
@@ -3957,7 +3971,7 @@ static int em_fxsave(struct x86_emulate_else size = offsetof(struct fxregs_state, xmm_space[0]); -return segmented_write (ctxt, ctxt->memop.addr.mem, &fx_state, size); +return segmented_write_std (ctxt, ctxt->memop.addr.mem, &fx_state, size); } static int fxrstor_fixup(struct x86_emulate_ctxt *ctxt,
@@ -3999,7 +4013,7 @@ static int em_fxrstor(struct x86_emulateif (rc !=X86EMUL_CONTINUE )return rc; - rc =segmented_read (ctxt, ctxt->memop.addr.mem, &fx_state,512 ); + rc =segmented_read_std (ctxt, ctxt->memop.addr.mem, &fx_state,512 );if (rc !=X86EMUL_CONTINUE )return rc;
Greg Kroah-Hartman
maintainerPATCH 32/120 efi/libstub/arm*: Pass latest memory map to the kernel
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ard Biesheuvel <[email protected]>
commit abfb7b686a3e5be27bf81db62f9c5c895b76f5d1 upstream.
As reported by James Morse, the current libstub code involving the annotated memory map only works somewhat correctly by accident, due to the fact that a pool allocation happens to be reused immediately, retaining its former contents on most implementations of the UEFI boot services.
Instead of juggling memory maps, which makes the code more complex than it needs to be, simply put placeholder values into the FDT for the memory map parameters, and only write the actual values after ExitBootServices() has been called.
--- drivers/firmware/efi/libstub/efistub.h | 8 --- drivers/firmware/efi/libstub/fdt.c | 87 +++++++++++++++++++++------------ 2 files changed, 56 insertions(+), 39 deletions(-)
drivers/firmware/efi/libstub/efistub.h +0 -8
@@ -30,14 +30,6 @@ efi_status_t efi_file_close(void *handleunsigned long get_dram_base (efi_system_table_t *sys_table_arg); -efi_status_t update_fdt (efi_system_table_t *sys_table,void *orig_fdt, -unsigned long orig_fdt_size, -void *fdt,int new_fdt_size,char *cmdline_ptr, -u64 initrd_addr,u64 initrd_size, -efi_memory_desc_t *memory_map, -unsigned long map_size,unsigned long desc_size, -u32 desc_ver); - efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table, void *handle, unsigned long *new_fdt_addr,
drivers/firmware/efi/libstub/fdt.c +56 -31
155 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 33/120 perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init code
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prarit Bhargava <[email protected]>
commit 6d6daa20945f3f598e56e18d1f926c08754f5801 upstream.
hswep_uncore_cpu_init() uses a hardcoded physical package id 0 for the boot cpu. This works as long as the boot CPU is actually on the physical package 0, which is normaly the case after power on / reboot.
But it fails with a NULL pointer dereference when a kdump kernel is started on a secondary socket which has a different physical package id because the locigal package translation for physical package 0 does not exist.
Use the logical package id of the boot cpu instead of hard coded 0.
[ tglx: Rewrote changelog once more ]
--- arch/x86/events/intel/uncore_snbep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/intel/uncore_snbep.c +1 -1
@@ -2686,7 +2686,7 @@ static struct intel_uncore_type *hswep_mvoid hswep_uncore_cpu_init (void ) { -int pkg =topology_phys_to_logical_pkg (0 ); +int pkg = boot_cpu_data.logical_proc_id;if (hswep_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores) hswep_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores;
Prarit Bhargava
NAKRe: [PATCH 4.9 033/120] perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init code
Quoted 2 lines · Greg Kroah-Hartman
4.9-stable review patch. If anyone has any objections, please let me know.
Nack.
The value of boot_cpu_data.logical_proc_id may be uninitialized and set to default -1 on systems that pick a random core as boot cpu. This was inadvertently fixed by 9d85eb9119f4 ("x86/smpboot: Make logical package management more robust") which is in 4.10-rc1.
Before 9d85eb9119f4:
[ 3.971539] hswep_uncore_cpu_init: cpu 5 pkg 0 boot_cpu_data.logical_proc_id 65535 [ 3.976504] hswep_uncore_cpu_init: cpu 5 pkg 0 cpu_data(0).logical_proc_id 0
After 9d85eb9119f4:
[ 3.919112] hswep_uncore_cpu_init: cpu 5 pkg 0 boot_cpu_data.logical_proc_id 0 [ 3.923391] hswep_uncore_cpu_init: cpu 5 pkg 0 cpu_data(0).logical_proc_id 0
This patch should not be applied to any stable branch.
P.
Quoted 54 lines
------------------
From: Prarit Bhargava <[email protected]>
commit
6d6daa20945f3f598e56e18d1f926c08754f5801upstream.
hswep_uncore_cpu_init()uses a hardcoded physical package id 0 for the boot cpu. This works as long as the boot CPU is actually on the physical package 0, which is normaly the case after power on / reboot.But it fails with a NULL pointer dereference when a kdump kernel is started on a secondary socket which has a different physical package id because the locigal package translation for physical package 0 does not exist.
Use the logical package id of the boot cpu instead of hard coded 0.
[ tglx: Rewrote changelog once more ]
Fixes cf6d445f6897 ("perf/x86/uncore: Track packages, not per CPU data")Signed-off-by Prarit Bhargava <[email protected]>Cc Alexander Shishkin <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Borislav Petkov <[email protected]>Cc H. Peter Anvin <[email protected]>Cc Harish Chegondi <[email protected]>Cc Jiri Olsa <[email protected]>Cc Kan Liang <[email protected]>Cc Linus Torvalds <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Stephane Eranian <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Vince Weaver <[email protected]>Signed-off-by Ingo Molnar <[email protected]>Signed-off-by Thomas Gleixner <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- arch/x86/events/intel/uncore_snbep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/events/intel/uncore_snbep.c +1
-1@@ -2686,7 +2686,7 @@ static struct intel_uncore_type *hswep_mvoid hswep_uncore_cpu_init (void ) { -int pkg =topology_phys_to_logical_pkg (0 ); +int pkg = boot_cpu_data.logical_proc_id;if (hswep_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores) hswep_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores;
Greg Kroah-Hartman
maintainerRe: [PATCH 4.9 033/120] perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init code
Quoted 19 lines · Prarit Bhargava
Quoted 2 lines · Greg Kroah-Hartman
4.9-stable review patch. If anyone has any objections, please let me know.
Nack.
The value of boot_cpu_data.logical_proc_id may be uninitialized and set to default -1 on systems that pick a random core as boot cpu. This was inadvertently fixed by
9d85eb9119f4("x86/smpboot: Make logical package management more robust") which is in 4.10-rc1.Before
9d85eb9119f4:[ 3.971539] hswep_uncore_cpu_init: cpu 5 pkg 0 boot_cpu_data.logical_proc_id 65535 [ 3.976504] hswep_uncore_cpu_init: cpu 5 pkg 0 cpu_data(0).logical_proc_id 0
Quoted 6 lines
After
9d85eb9119f4:[ 3.919112] hswep_uncore_cpu_init: cpu 5 pkg 0 boot_cpu_data.logical_proc_id 0 [ 3.923391] hswep_uncore_cpu_init: cpu 5 pkg 0 cpu_data(0).logical_proc_id 0This patch should not be applied to any stable branch.
So the fixes: line lies? This isn't needed at all for 4.9?
confused,
greg k-h
Re: [PATCH 4.9 033/120] perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init code
Quoted 20 lines · Greg Kroah-Hartman
Quoted 19 lines · Prarit Bhargava
Quoted 2 lines · Greg Kroah-Hartman
4.9-stable review patch. If anyone has any objections, please let me know.
Nack.
The value of boot_cpu_data.logical_proc_id may be uninitialized and set to default -1 on systems that pick a random core as boot cpu. This was inadvertently fixed by
9d85eb9119f4("x86/smpboot: Make logical package management more robust") which is in 4.10-rc1.Before
9d85eb9119f4:[ 3.971539] hswep_uncore_cpu_init: cpu 5 pkg 0 boot_cpu_data.logical_proc_id 65535 [ 3.976504] hswep_uncore_cpu_init: cpu 5 pkg 0 cpu_data(0).logical_proc_id 0
Quoted 8 lines
Quoted 6 lines
After
9d85eb9119f4:[ 3.919112] hswep_uncore_cpu_init: cpu 5 pkg 0 boot_cpu_data.logical_proc_id 0 [ 3.923391] hswep_uncore_cpu_init: cpu 5 pkg 0 cpu_data(0).logical_proc_id 0This patch should not be applied to any stable branch.
So the fixes: line lies? This isn't needed at all for 4.9?
No, the fixes: line does not lie. This patch is not needed at all for 4.9. Other patches are required beyond this patch in order for 4.9 to remain stable.
This patch is 6d6daa20945f ("perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init code") which was tested on and applied to 4.10-rc3 IIRC. This patch was applied to 4.10-rc4.
[prarit@prarit linux]$ git describe --contains 6d6daa20945f v4.10-rc4~9^2~5
4.9 is broken and requires additional patches beyond this patch. Applying this patch to 4.9 stable without those additional fixes will result in kernel panics on some Haswell systems that boot on random cores.
P.
Quoted 5 lines
confused,
greg k-h
Greg Kroah-Hartman
maintainerRe: [PATCH 4.9 033/120] perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init code
Quoted 35 lines · Prarit Bhargava
Quoted 20 lines · Greg Kroah-Hartman
Quoted 19 lines · Prarit Bhargava
Quoted 2 lines · Greg Kroah-Hartman
4.9-stable review patch. If anyone has any objections, please let me know.
Nack.
The value of boot_cpu_data.logical_proc_id may be uninitialized and set to default -1 on systems that pick a random core as boot cpu. This was inadvertently fixed by
9d85eb9119f4("x86/smpboot: Make logical package management more robust") which is in 4.10-rc1.Before
9d85eb9119f4:[ 3.971539] hswep_uncore_cpu_init: cpu 5 pkg 0 boot_cpu_data.logical_proc_id 65535 [ 3.976504] hswep_uncore_cpu_init: cpu 5 pkg 0 cpu_data(0).logical_proc_id 0Quoted 8 lines
Quoted 6 lines
After
9d85eb9119f4:[ 3.919112] hswep_uncore_cpu_init: cpu 5 pkg 0 boot_cpu_data.logical_proc_id 0 [ 3.923391] hswep_uncore_cpu_init: cpu 5 pkg 0 cpu_data(0).logical_proc_id 0This patch should not be applied to any stable branch.
So the fixes: line lies? This isn't needed at all for 4.9?
No, the fixes: line does not lie. This patch is not needed at all for 4.9. Other patches are required beyond this patch in order for 4.9 to remain stable.
Quoted 6 lines
This patch is
6d6daa20945f("perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init code") which was tested on and applied to 4.10-rc3 IIRC. This patch was applied to 4.10-rc4.[prarit@prarit linux]$ git describe --contains
6d6daa20945fv4.10-rc4~9^2~5
Yes, but the patch says it is fixing a bug since 4.6-rc1. The fixes line says:
Fixes: cf6d445f6897 ("perf/x86/uncore: Track packages, not per CPU data")$ git dc cf6d445f6897 v4.6-rc1~165^2~28
(dc is my git alias for "describe --contains" as I type it so often...)
Quoted 3 lines
4.9 is broken and requires additional patches beyond this patch. Applying this patch to 4.9 stable without those additional fixes will result in kernel panics on some Haswell systems that boot on random cores.
So, does 4.9 on its own work properly on these systems? If not, what are the commits that are needed to fix it?
If 4.9 is fine as-is, great, we should drop this patch then, correct? But then that fixes: line lied :(
still confused,
greg k-h
Re: [PATCH 4.9 033/120] perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init code
Quoted 50 lines · Greg Kroah-Hartman
Quoted 35 lines · Prarit Bhargava
Quoted 20 lines · Greg Kroah-Hartman
Quoted 19 lines · Prarit Bhargava
Quoted 2 lines · Greg Kroah-Hartman
4.9-stable review patch. If anyone has any objections, please let me know.
Nack.
The value of boot_cpu_data.logical_proc_id may be uninitialized and set to default -1 on systems that pick a random core as boot cpu. This was inadvertently fixed by
9d85eb9119f4("x86/smpboot: Make logical package management more robust") which is in 4.10-rc1.Before
9d85eb9119f4:[ 3.971539] hswep_uncore_cpu_init: cpu 5 pkg 0 boot_cpu_data.logical_proc_id 65535 [ 3.976504] hswep_uncore_cpu_init: cpu 5 pkg 0 cpu_data(0).logical_proc_id 0Quoted 8 lines
Quoted 6 lines
After
9d85eb9119f4:[ 3.919112] hswep_uncore_cpu_init: cpu 5 pkg 0 boot_cpu_data.logical_proc_id 0 [ 3.923391] hswep_uncore_cpu_init: cpu 5 pkg 0 cpu_data(0).logical_proc_id 0This patch should not be applied to any stable branch.
So the fixes: line lies? This isn't needed at all for 4.9?
No, the fixes: line does not lie. This patch is not needed at all for 4.9. Other patches are required beyond this patch in order for 4.9 to remain stable.
Quoted 6 lines
This patch is
6d6daa20945f("perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init code") which was tested on and applied to 4.10-rc3 IIRC. This patch was applied to 4.10-rc4.[prarit@prarit linux]$ git describe --contains
6d6daa20945fv4.10-rc4~9^2~5Yes, but the patch says it is fixing a bug since 4.6-rc1. The fixes line says:
Fixes: cf6d445f6897 ("perf/x86/uncore: Track packages, not per CPU data")$ git dc cf6d445f6897 v4.6-rc1~165^2~28
Quoted 8 lines
(dc is my git alias for "describe --contains" as I type it so often...)
Quoted 3 lines
4.9 is broken and requires additional patches beyond this patch. Applying this patch to 4.9 stable without those additional fixes will result in kernel panics on some Haswell systems that boot on random cores.
So, does 4.9 on its own work properly on these systems? If not, what are the commits that are needed to fix it?
The system is being used by someone else atm. I know of at least two commits that are required but I have not tested them on 4.9 or 4.9 stable. I do know that 4.10-rc2-ish was broken on these systems when booting on any other cpu than cpu 0.
Quoted 3 lines
If 4.9 is fine as-is, great, we should drop this patch then, correct? But then that fixes: line lied :(
Let me see if I can explain it this way:
(The commits are displayed as commit hash, version that contains commit, and my own description)
cf6d445f6897 v4.6-rc1~165^2~28 <- what my commit "Fixes:"
d49597fd3bc v4.9-rc6~33^2 <- required for 9d85eb9119f, causes boot_cpu_data.logical_proc_id is -1.
9d85eb9119f v4.10-rc1~51^2~8 <- This patch unintentionally fixes code so that boot_cpu_data.logical_proc_id is greater than or equal to 0.
6d6daa20945f v4.10-rc4~9^2~5 <- my commit, expects boot_cpu_data.logical_proc_id greater than or equal to 0.
cf6d445f6897 v4.6-rc1~165^2~28 caused the bug to happen.
When I found the bug the upstream tree was at 4.10-rc2-ish. My fix for the bug is 6d6daa20945f v4.10-rc4~9^2~5 which has "Fixes: cf6d445f6897" because that commit causes this to happen.
If my commit 6d6daa20945f v4.10-rc4~9^2~5 is applied to 4.9 stable without 9d85eb9119f v4.10-rc1~51^2~8 things will be *worse* because boot_cpu_data.logical_proc_id is -1, and this will result in a NULL pointer panic during boot on *all* Haswell systems.
If we take d49597fd3bc, 9d85eb9119f, and 6d6daa20945f things should work but as I said above, I have not built or tested that. I can test this combination of patches if you think it is worthwhile for 4.9 stable.
I think the fixes: line is correct. The git bisect points at that commit. The problem with backporting my patch to 4.9 is that my fix requires other patches that are not in 4.9.
P.
Re: [PATCH 4.9 033/120] perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init code
In reply to Prarit BhargavaQuoted 3 lines · Prarit Bhargava
4.9 is broken and requires additional patches beyond this patch. Applying this patch to 4.9 stable without those additional fixes will result in kernel panics on some Haswell systems that boot on random cores.
Could you list the patches that are required? It would be nice to backport all required fixes to v4.9.
Thanks,
Ingo
Re: [PATCH 4.9 033/120] perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init code
Quoted 10 lines · Ingo Molnar
Quoted 3 lines · Prarit Bhargava
4.9 is broken and requires additional patches beyond this patch. Applying this patch to 4.9 stable without those additional fixes will result in kernel panics on some Haswell systems that boot on random cores.
Could you list the patches that are required? It would be nice to backport all required fixes to v4.9.
Yeah, I'm going to do that once I get the system back. I have a feeling that just the two additional patches are required but I want to make sure before I post anything.
P.
Quoted 4 lines
Thanks,
Ingo
Greg Kroah-Hartman
maintainerRe: [PATCH 4.9 033/120] perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init code
Quoted 10 lines · Prarit Bhargava
Quoted 7 lines · Ingo Molnar
Quoted 3 lines · Prarit Bhargava
4.9 is broken and requires additional patches beyond this patch. Applying this patch to 4.9 stable without those additional fixes will result in kernel panics on some Haswell systems that boot on random cores.
Quoted 7 lines
Quoted 3 lines
Could you list the patches that are required? It would be nice to backport all required fixes to v4.9.
Yeah, I'm going to do that once I get the system back. I have a feeling that just the two additional patches are required but I want to make sure before I post anything.
So what do I do here? Drop this single patch? Add others now? Ignore it and leave it as-is?
still confused,
greg k-h
Re: [PATCH 4.9 033/120] perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init code
Quoted 15 lines · Greg Kroah-Hartman
Quoted 14 lines · Prarit Bhargava
Quoted 10 lines · Ingo Molnar
Quoted 3 lines · Prarit Bhargava
4.9 is broken and requires additional patches beyond this patch. Applying this patch to 4.9 stable without those additional fixes will result in kernel panics on some Haswell systems that boot on random cores.
Could you list the patches that are required? It would be nice to backport all required fixes to v4.9.
Quoted 6 lines
Quoted 3 lines
Yeah, I'm going to do that once I get the system back. I have a feeling that just the two additional patches are required but I want to make sure before I post anything.
So what do I do here? Drop this single patch? Add others now? Ignore it and leave it as-is?
Drop this patch.
P.
Quoted 5 lines
still confused,
greg k-h
Greg Kroah-Hartman
maintainerRe: [PATCH 4.9 033/120] perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init code
Quoted 18 lines · Prarit Bhargava
Quoted 15 lines · Greg Kroah-Hartman
Quoted 14 lines · Prarit Bhargava
Quoted 10 lines · Ingo Molnar
Quoted 3 lines · Prarit Bhargava
4.9 is broken and requires additional patches beyond this patch. Applying this patch to 4.9 stable without those additional fixes will result in kernel panics on some Haswell systems that boot on random cores.
Could you list the patches that are required? It would be nice to backport all required fixes to v4.9.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Yeah, I'm going to do that once I get the system back. I have a feeling that just the two additional patches are required but I want to make sure before I post anything.
So what do I do here? Drop this single patch? Add others now? Ignore it and leave it as-is?
Drop this patch.
Ok, now dropped!
greg k-h
Re: [PATCH 4.9 033/120] perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init code
In reply to Greg Kroah-HartmanQuoted 15 lines · Greg Kroah-Hartman
Quoted 14 lines · Prarit Bhargava
Quoted 10 lines · Ingo Molnar
Quoted 3 lines · Prarit Bhargava
4.9 is broken and requires additional patches beyond this patch. Applying this patch to 4.9 stable without those additional fixes will result in kernel panics on some Haswell systems that boot on random cores.
Could you list the patches that are required? It would be nice to backport all required fixes to v4.9.
Quoted 8 lines
Quoted 3 lines
Yeah, I'm going to do that once I get the system back. I have a feeling that just the two additional patches are required but I want to make sure before I post anything.
So what do I do here? Drop this single patch? Add others now? Ignore it and leave it as-is?
still confused,
Please drop the patch for now - we'll sort it all out and will send you a list of commit IDs to backport once everything's clear!
Thanks,
Ingo
Greg Kroah-Hartman
maintainerRe: [PATCH 4.9 033/120] perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init code
Quoted 22 lines · Ingo Molnar
Quoted 19 lines · Greg Kroah-Hartman
Quoted 17 lines · Prarit Bhargava
Quoted 10 lines · Ingo Molnar
Quoted 3 lines · Prarit Bhargava
4.9 is broken and requires additional patches beyond this patch. Applying this patch to 4.9 stable without those additional fixes will result in kernel panics on some Haswell systems that boot on random cores.
Could you list the patches that are required? It would be nice to backport all required fixes to v4.9.
Yeah, I'm going to do that once I get the system back. I have a feeling that just the two additional patches are required but I want to make sure before I post anything.
Quoted 7 lines
Quoted 4 lines
So what do I do here? Drop this single patch? Add others now? Ignore it and leave it as-is?
still confused,
Please drop the patch for now - we'll sort it all out and will send you a list of commit IDs to backport once everything's clear!
Ok, now dropped, thanks.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 34/120 efi/x86: Prune invalid memory map entries and fix boot regression
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Jones <[email protected]>
commit 0100a3e67a9cef64d72cd3a1da86f3ddbee50363 upstream.
Some machines, such as the Lenovo ThinkPad W541 with firmware GNET80WW (2.28), include memory map entries with phys_addr=0x0 and num_pages=0.
These machines fail to boot after the following commit,
commit 8e80632fb23f ("efi/esrt: Use efi_mem_reserve() and avoid a kmalloc()")
Fix this by removing such bogus entries from the memory map.
Furthermore, currently the log output for this case (with efi=debug) looks like:
[ 0.000000] efi: mem45: [Reserved | | | | | | | | | | | | ] range=[0x0000000000000000-0xffffffffffffffff] (0MB)
This is clearly wrong, and also not as informative as it could be. This patch changes it so that if we find obviously invalid memory map entries, we print an error and skip those entries. It also detects the display of the address range calculation overflow, so the new output is:
[ 0.000000] efi: [Firmware Bug]: Invalid EFI memory map entries: [ 0.000000] efi: mem45: [Reserved | | | | | | | | | | | | ] range=[0x0000000000000000-0x0000000000000000] (invalid)
It also detects memory map sizes that would overflow the physical address, for example phys_addr=0xfffffffffffff000 and num_pages=0x0200000000000001, and prints:
[ 0.000000] efi: [Firmware Bug]: Invalid EFI memory map entries: [ 0.000000] efi: mem45: [Reserved | | | | | | | | | | | | ] range=[phys_addr=0xfffffffffffff000-0x20ffffffffffffffff] (invalid)
It then removes these entries from the memory map.
--- arch/x86/platform/efi/efi.c | 66 ++++++++++++++++++++++++++++++++++++++++++++ include/linux/efi.h | 1 2 files changed, 67 insertions(+)
arch/x86/platform/efi/efi.c +66 -0
@@ -210,6 +210,70 @@ int __init efi_memblock_x86_reserve_rangreturn 0 ; } +#define OVERFLOW_ADDR_SHIFT (64 - EFI_PAGE_SHIFT) +#define OVERFLOW_ADDR_MASK (U64_MAX << OVERFLOW_ADDR_SHIFT) +#define U64_HIGH_BIT (~(U64_MAX >> 1)) + +static bool __init efi_memmap_entry_valid (const efi_memory_desc_t *md,int i) +{ +u64 end = (md->num_pages <<EFI_PAGE_SHIFT ) + md->phys_addr -1 ; +u64 end_hi =0 ; +char buf[64 ]; + +if (md->num_pages ==0 ) { + end =0 ; + }else if (md->num_pages >EFI_PAGES_MAX || +EFI_PAGES_MAX - md->num_pages < + (md->phys_addr >>EFI_PAGE_SHIFT )) { + end_hi = (md->num_pages &OVERFLOW_ADDR_MASK ) + >>OVERFLOW_ADDR_SHIFT ; + +if ((md->phys_addr &U64_HIGH_BIT ) && !(end &U64_HIGH_BIT )) + end_hi +=1 ; + }else { +return true; + } + +pr_warn_once (FW_BUG "Invalid EFI memory map entries:\n" ); + +if (end_hi) { +pr_warn ("mem%02u: %s range=[0x%016llx-0x%llx%016llx] (invalid)\n" , + i,efi_md_typeattr_format (buf,sizeof (buf), md), + md->phys_addr, end_hi, end); + }else { +pr_warn ("mem%02u: %s range=[0x%016llx-0x%016llx] (invalid)\n" , + i,efi_md_typeattr_format (buf,sizeof (buf), md), + md->phys_addr, end); + } +return false; +} + +static void __init efi_clean_memmap (void ) +{ +efi_memory_desc_t *out = efi.memmap.map; +const efi_memory_desc_t *in = out; +const efi_memory_desc_t *end = efi.memmap.map_end; +int i, n_removal; + +for (i = n_removal =0 ; in < end; i++) { +if (efi_memmap_entry_valid (in, i)) { +if (out != in) +memcpy (out, in, efi.memmap.desc_size); + out = (void *)out + efi.memmap.desc_size; + }else { + n_removal++; + } + in = (void *)in + efi.memmap.desc_size; + } + +if (n_removal >0 ) { +u64 size = efi.memmap.nr_map - n_removal; + +pr_warn ("Removing %d invalid memory map entries.\n" , n_removal); +efi_memmap_install (efi.memmap.phys_map, size); + } +} +void __init efi_print_memmap (void ) {efi_memory_desc_t *md;
@@ -472,6 +536,8 @@ void __init efi_init(void) } } +efi_clean_memmap (); +if (efi_enabled (EFI_DBG ))efi_print_memmap (); }
include/linux/efi.h +1 -0
@@ -103,6 +103,7 @@ typedef struct {#define EFI_PAGE_SHIFT 12#define EFI_PAGE_SIZE (1UL << EFI_PAGE_SHIFT) +#define EFI_PAGES_MAX (U64_MAX >> EFI_PAGE_SHIFT) typedef struct { u32 type;
Greg Kroah-Hartman
maintainerPATCH 36/120 nl80211: fix sched scan netlink socket owner destruction
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit 753aacfd2e95df6a0caf23c03dc309020765bea9 upstream.
A single netlink socket might own multiple interfaces *and* a scheduled scan request (which might belong to another interface), so when it goes away both may need to be destroyed.
Remove the schedule_scan_stop indirection to fix this - it's only needed for interface destruction because of the way this works right now, with a single work taking care of all interfaces.
--- net/wireless/nl80211.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
net/wireless/nl80211.c +7 -9
@@ -14402,13 +14402,17 @@ static int nl80211_netlink_notify(structlist_for_each_entry_rcu (rdev, &cfg80211_rdev_list, list) {bool schedule_destroy_work = false; -bool schedule_scan_stop = false;struct cfg80211_sched_scan_request *sched_scan_req =rcu_dereference (rdev->sched_scan_req);if (sched_scan_req && notify->portid && - sched_scan_req->owner_nlportid == notify->portid) - schedule_scan_stop = true; + sched_scan_req->owner_nlportid == notify->portid) { + sched_scan_req->owner_nlportid =0 ; + +if (rdev->ops->sched_scan_stop && + rdev->wiphy.flags &WIPHY_FLAG_SUPPORTS_SCHED_SCAN ) +schedule_work (&rdev->sched_scan_stop_wk); + }list_for_each_entry_rcu (wdev, &rdev->wiphy.wdev_list, list) {cfg80211_mlme_unregister_socket (wdev, notify->portid);
@@ -14439,12 +14443,6 @@ static int nl80211_netlink_notify(structspin_unlock (&rdev->destroy_list_lock);schedule_work (&rdev->destroy_work); } - }else if (schedule_scan_stop) { - sched_scan_req->owner_nlportid =0 ; - -if (rdev->ops->sched_scan_stop && - rdev->wiphy.flags &WIPHY_FLAG_SUPPORTS_SCHED_SCAN ) -schedule_work (&rdev->sched_scan_stop_wk); } }
Greg Kroah-Hartman
maintainerPATCH 37/120 gpio: Move freeing of GPIO hogs before numbing of the device
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit 5018ada69a04c8ac21d74bd682fceb8e42dc0f96 upstream.
When removing a gpiochip that uses GPIO hogging (e.g. by unloading the chip's DT overlay), a warning is printed:
gpio gpiochip8: REMOVING GPIOCHIP WITH GPIOS STILL REQUESTED
This happens because gpiochip_free_hogs() is called after the gdev->chip pointer is reset to NULL. Hence __gpiod_free() cannot determine the chip in use, and cannot clear flags nor call the optional chip-specific .free() callback.
Move the call to gpiochip_free_hogs() up to fix this.
--- drivers/gpio/gpiolib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpiolib.c +1 -1
@@ -1317,12 +1317,12 @@ void gpiochip_remove(struct gpio_chip *c/* FIXME: should the legacy sysfs handling be moved to gpio_device? */ gpiochip_sysfs_unregister (gdev); +gpiochip_free_hogs (chip);/* Numb the device, cancelling all outstanding operations */ gdev->chip =NULL ;gpiochip_irqchip_remove (chip);acpi_gpiochip_remove (chip);gpiochip_remove_pin_ranges (chip); -gpiochip_free_hogs (chip);of_gpiochip_remove (chip);/* * We accept no more calls into the driver from this point, so
Greg Kroah-Hartman
maintainerPATCH 39/120 bridge: netfilter: Fix dropping packets that moving through bridge interface
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artur Molchanov <[email protected]>
commit 14221cc45caad2fcab3a8543234bb7eda9b540d5 upstream.
Problem:br_nf_pre_routing_finish() calls itself instead of br_nf_pre_routing_finish_bridge(). Due to this bug reverse path filter drops packets that go through bridge interface.
User impact:
Local docker containers with bridge network can not communicate with each other.
--- net/bridge/br_netfilter_hooks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bridge/br_netfilter_hooks.c +1 -1
@@ -399,7 +399,7 @@ bridged_dnat:br_nf_hook_thresh (NF_BR_PRE_ROUTING , net, sk, skb, skb->dev,NULL , - br_nf_pre_routing_finish); + br_nf_pre_routing_finish_bridge);return 0 ; }ether_addr_copy (eth_hdr (skb)->h_dest, dev->dev_addr);
Greg Kroah-Hartman
maintainerPATCH 40/120 x86/cpu/AMD: Clean up cpu_llc_id assignment per topology feature
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yazen Ghannam <[email protected]>
commit b6a50cddbcbda7105355898ead18f1a647c22520 upstream.
These changes do not affect current hw - just a cleanup:
Currently, we assume that a system has a single Last Level Cache (LLC) per node, and that the cpu_llc_id is thus equal to the node_id. This no longer applies since Fam17h can have multiple last level caches within a node.
So group the cpu_llc_id assignment by topology feature and family in order to make the computation of cpu_llc_id on the different families more clear.
Here is how the LLC ID is being computed on the different families:
The NODEID_MSR feature only applies to Fam10h in which case the LLC is at the node level.
The TOPOEXT feature is used on families 15h, 16h and 17h. So far we only see multiple last level caches if L3 caches are available. Otherwise, the cpu_llc_id will default to be the phys_proc_id.
We have L3 caches only on families 15h and 17h:
- on Fam15h, the LLC is at the node level.
- on Fam17h, the LLC is at the core complex level and can be found by right shifting the APIC ID. Also, keep the family checks explicit so that new families will fall back to the default, which will be node_id for TOPOEXT systems.
Single node systems in families 10h and 15h will have a Node ID of 0 which will be the same as the phys_proc_id, so we don't need to check for multiple nodes before using the node_id.
--- arch/x86/kernel/cpu/amd.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-)
arch/x86/kernel/cpu/amd.c +19 -12
@@ -314,11 +314,30 @@ static void amd_get_topology(struct cpui smp_num_siblings = ((ebx >>8 ) &3 ) +1 ; c->x86_max_cores /= smp_num_siblings; c->cpu_core_id = ebx &0xff ; + +/* +* We may have multiple LLCs if L3 caches exist, so check if we +* have an L3 cache by looking at the L3 cache CPUID leaf. +*/ +if (cpuid_edx (0x80000006 )) { +if (c->x86 ==0x17 ) { +/* +* LLC is at the core complex level. +* Core complex id is ApicId[3]. +*/ +per_cpu (cpu_llc_id, cpu) = c->apicid >>3 ; + }else { +/* LLC is at the node level. */ +per_cpu (cpu_llc_id, cpu) = node_id; + } + } }else if (cpu_has (c,X86_FEATURE_NODEID_MSR )) {u64 value;rdmsrl (MSR_FAM10H_NODE_ID , value); node_id = value &7 ; + +per_cpu (cpu_llc_id, cpu) = node_id; }else return ;
@@ -329,9 +348,6 @@ static void amd_get_topology(struct cpuiset_cpu_cap (c,X86_FEATURE_AMD_DCM ); cus_per_node = c->x86_max_cores / nodes_per_socket; -/* store NodeID, use llc_shared_map to store sibling info */ -per_cpu (cpu_llc_id, cpu) = node_id; -/* core id has to be in the [0 .. cores_per_node - 1] range */ c->cpu_core_id %= cus_per_node; }
@@ -356,15 +372,6 @@ static void amd_detect_cmp(struct cpuinf/* use socket ID also for last level cache */ per_cpu (cpu_llc_id, cpu) = c->phys_proc_id;amd_get_topology (c); - -/* -* Fix percpu cpu_llc_id here as LLC topology is different -* for Fam17h systems. -*/ -if (c->x86 !=0x17 || !cpuid_edx (0x80000006 )) -return ; - -per_cpu (cpu_llc_id, cpu) = c->apicid >>3 ;#endif }
Greg Kroah-Hartman
maintainerPATCH 41/120 x86/bugs: Separate AMD E400 erratum and C1E bug
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit 3344ed30791af66dbbad5f375008f3d1863b6c99 upstream.
The workaround for the AMD Erratum E400 (Local APIC timer stops in C1E state) is a two step process:
- Selection of the E400 aware idle routine
- Detection whether the platform is affected
The idle routine selection happens for possibly affected CPUs depending on family/model/stepping information. These range of CPUs is not necessarily affected as the decision whether to enable the C1E feature is made by the firmware. Unfortunately there is no way to query this at early boot.
The current implementation polls a MSR in the E400 aware idle routine to detect whether the CPU is affected. This is inefficient on non affected CPUs because every idle entry has to do the MSR read.
There is a better way to detect this before going idle for the first time which requires to seperate the bug flags:
X86_BUG_AMD_E400 - Selects the E400 aware idle routine and
enables the detection
X86_BUG_AMD_APIC_C1E - Set when the platform is affected by E400
Replace the current X86_BUG_AMD_APIC_C1E usage by the new X86_BUG_AMD_E400 bug bit to select the idle routine which currently does an unconditional detection poll. X86_BUG_AMD_APIC_C1E is going to be used in later patches to remove the MSR polling and simplify the handling of this misfeature.
--- arch/x86/include/asm/cpufeatures.h | 2 ++ arch/x86/kernel/cpu/amd.c | 20 +++++++++++++------- arch/x86/kernel/process.c | 3 +-- 3 files changed, 16 insertions(+), 9 deletions(-)
arch/x86/include/asm/cpufeatures.h +2 -0
@@ -311,4 +311,6 @@#define X86_BUG_NULL_SEG X86_BUG(10)/* Nulling a selector preserves the base */ #define X86_BUG_SWAPGS_FENCE X86_BUG(11)/* SWAPGS without input dep on GS */ #define X86_BUG_MONITOR X86_BUG(12)/* IPI required to wake up remote CPU */ +#define X86_BUG_AMD_E400 X86_BUG(13)/* CPU is among the affected by Erratum 400 */ +#endif /* _ASM_X86_CPUFEATURES_H */
arch/x86/kernel/cpu/amd.c +13 -7
@@ -20,6 +20,10 @@#include "cpu.h" +static const int amd_erratum_383[]; +static const int amd_erratum_400[]; +static bool cpu_has_amd_erratum (struct cpuinfo_x86 *cpu,const int *erratum); +/* * nodes_per_socket: Stores the number of nodes per socket. * Refer to Fam15h Models 00-0fh BKDG - CPUID Fn8000_001E_ECX
@@ -592,11 +596,16 @@ static void early_init_amd(struct cpuinf/* F16h erratum 793, CVE-2013-6885 */ if (c->x86 ==0x16 && c->x86_model <=0xf )msr_set_bit (MSR_AMD64_LS_CFG ,15 ); -} -static const int amd_erratum_383[]; -static const int amd_erratum_400[]; -static bool cpu_has_amd_erratum (struct cpuinfo_x86 *cpu,const int *erratum); +/* +* Check whether the machine is affected by erratum 400. This is +* used to select the proper idle routine and to enable the check +* whether the machine is affected in arch_post_acpi_init(), which +* sets the X86_BUG_AMD_APIC_C1E bug depending on the MSR check. +*/ +if (cpu_has_amd_erratum (c, amd_erratum_400)) +set_cpu_bug (c,X86_BUG_AMD_E400 ); +}static void init_amd_k8 (struct cpuinfo_x86 *c) {
@@ -777,9 +786,6 @@ static void init_amd(struct cpuinfo_x86if (c->x86 >0x11 )set_cpu_cap (c,X86_FEATURE_ARAT ); -if (cpu_has_amd_erratum (c, amd_erratum_400)) -set_cpu_bug (c,X86_BUG_AMD_APIC_C1E ); -rdmsr_safe (MSR_AMD64_PATCH_LEVEL , &c->microcode, &dummy);/* 3DNow or LM implies PREFETCHW */
arch/x86/kernel/process.c +1 -2
@@ -448,8 +448,7 @@ void select_idle_routine(const struct cpif (x86_idle || boot_option_idle_override ==IDLE_POLL )return ; -if (cpu_has_bug (c,X86_BUG_AMD_APIC_C1E )) { -/* E400: APIC timer interrupt does not wake up CPU from C1e */ +if (boot_cpu_has_bug (X86_BUG_AMD_E400 )) {pr_info ("using AMD E400 aware idle routine\n" ); x86_idle = amd_e400_idle; }else if (prefer_mwait_c1_over_halt (c)) {
Greg Kroah-Hartman
maintainerPATCH 42/120 x86/CPU/AMD: Fix Bulldozer topology
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Borislav Petkov <[email protected]>
commit a33d331761bc5dd330499ca5ceceb67f0640a8e6 upstream.
The following commit:
8196dab4fc15 ("x86/cpu: Get rid of compute_unit_id")
... broke the initial strategy for Bulldozer-based cores' topology, where we consider each thread of a compute unit a standalone core and not a HT or SMT thread.
Revert to the firmware-supplied core_id numbering and do not make them thread siblings as we don't consider them for such even if they technically are, more or less.
--- arch/x86/kernel/cpu/amd.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
arch/x86/kernel/cpu/amd.c +1 -8
@@ -309,15 +309,8 @@ static void amd_get_topology(struct cpui/* get information required for multi-node processors */ if (boot_cpu_has (X86_FEATURE_TOPOEXT )) { -u32 eax, ebx, ecx, edx; -cpuid (0x8000001e , &eax, &ebx, &ecx, &edx); - node_id = ecx &7 ; - -/* get compute unit information */ - smp_num_siblings = ((ebx >>8 ) &3 ) +1 ; - c->x86_max_cores /= smp_num_siblings; - c->cpu_core_id = ebx &0xff ; + node_id =cpuid_ecx (0x8000001e ) &7 ;/* * We may have multiple LLCs if L3 caches exist, so check if we
Greg Kroah-Hartman
maintainerPATCH 43/120 wusbcore: Fix one more crypto-on-the-stack bug
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 620f1a632ebcc9811c2f8009ba52297c7006f805 upstream.
The driver put a constant buffer of all zeros on the stack and pointed a scatterlist entry at it. This doesn't work with virtual stacks. Use ZERO_PAGE instead.
--- drivers/usb/wusbcore/crypto.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/wusbcore/crypto.c +1 -2
@@ -216,7 +216,6 @@ static int wusb_ccm_mac(struct crypto_skstruct scatterlist sg[4 ], sg_dst;void *dst_buf;size_t dst_size; -const u8 bzero[16 ] = {0 };u8 iv[crypto_skcipher_ivsize (tfm_cbc)];size_t zero_padding;
@@ -261,7 +260,7 @@ static int wusb_ccm_mac(struct crypto_sksg_set_buf (&sg[1 ], &scratch->b1,sizeof (scratch->b1));sg_set_buf (&sg[2 ], b, blen);/* 0 if well behaved :) */ -sg_set_buf (&sg[3 ], bzero, zero_padding); +sg_set_page (&sg[3 ],ZERO_PAGE (0 ), zero_padding,0 );sg_init_one (&sg_dst, dst_buf, dst_size);skcipher_request_set_tfm (req, tfm_cbc);
Greg Kroah-Hartman
maintainerPATCH 44/120 usb: musb: fix runtime PM in debugfs
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bin Liu <[email protected]>
commit 7b6c1b4c0e1e44544aa18161dba6a741c080a7ef upstream.
MUSB driver now has runtime PM support, but the debugfs driver misses the PM _get/_put() calls, which could cause MUSB register access failure.
--- drivers/usb/musb/musb_debugfs.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/usb/musb/musb_debugfs.c +19 -1
@@ -114,6 +114,7 @@ static int musb_regdump_show(struct seq_unsigned i;seq_printf (s,"MUSB (M)HDRC Register Dump\n" ); +pm_runtime_get_sync (musb->controller);for (i =0 ; i <ARRAY_SIZE (musb_regmap); i++) {switch (musb_regmap[i].size) {
@@ -132,6 +133,8 @@ static int musb_regdump_show(struct seq_ } } +pm_runtime_mark_last_busy (musb->controller); +pm_runtime_put_autosuspend (musb->controller);return 0 ; }
@@ -145,7 +148,10 @@ static int musb_test_mode_show(struct sestruct musb *musb = s->private;unsigned test; +pm_runtime_get_sync (musb->controller); test =musb_readb (musb->mregs,MUSB_TESTMODE ); +pm_runtime_mark_last_busy (musb->controller); +pm_runtime_put_autosuspend (musb->controller);if (test &MUSB_TEST_FORCE_HOST )seq_printf (s,"force host\n" );
@@ -194,11 +200,12 @@ static ssize_t musb_test_mode_write(struu8 test;char buf[18 ]; +pm_runtime_get_sync (musb->controller); test =musb_readb (musb->mregs,MUSB_TESTMODE );if (test) {dev_err (musb->controller,"Error: test mode is already set. " "Please do USB Bus Reset to start a new test.\n" ); -return count; + goto ret; }memset (buf,0x00 ,sizeof (buf));
@@ -234,6 +241,9 @@ static ssize_t musb_test_mode_write(strumusb_writeb (musb->mregs,MUSB_TESTMODE , test); +ret: +pm_runtime_mark_last_busy (musb->controller); +pm_runtime_put_autosuspend (musb->controller);return count; }
@@ -254,8 +264,13 @@ static int musb_softconnect_show(structswitch (musb->xceiv->otg->state) {case OTG_STATE_A_HOST :case OTG_STATE_A_WAIT_BCON : +pm_runtime_get_sync (musb->controller); + reg =musb_readb (musb->mregs,MUSB_DEVCTL ); connect = reg &MUSB_DEVCTL_SESSION ?1 :0 ; + +pm_runtime_mark_last_busy (musb->controller); +pm_runtime_put_autosuspend (musb->controller);break ;default : connect =-1 ;
@@ -284,6 +299,7 @@ static ssize_t musb_softconnect_write(stif (copy_from_user (&buf, ubuf,min_t (size_t,sizeof (buf) -1 , count)))return -EFAULT ; +pm_runtime_get_sync (musb->controller);if (!strncmp (buf,"0" ,1 )) {switch (musb->xceiv->otg->state) {case OTG_STATE_A_HOST :
@@ -314,6 +330,8 @@ static ssize_t musb_softconnect_write(st } } +pm_runtime_mark_last_busy (musb->controller); +pm_runtime_put_autosuspend (musb->controller);return count; }
Greg Kroah-Hartman
maintainerPATCH 45/120 USB: serial: kl5kusb105: fix line-state error handling
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 146cc8a17a3b4996f6805ee5c080e7101277c410 upstream.
The current implementation failed to detect short transfers when attempting to read the line state, and also, to make things worse, logged the content of the uninitialised heap transfer buffer.
--- drivers/usb/serial/kl5kusb105.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/usb/serial/kl5kusb105.c +5 -4
@@ -192,10 +192,11 @@ static int klsi_105_get_line_state(struc status_buf,KLSI_STATUSBUF_LEN ,10000 ); -if (rc <0 ) -dev_err (&port->dev,"Reading line status failed (error = %d)\n" , - rc); -else { +if (rc !=KLSI_STATUSBUF_LEN ) { +dev_err (&port->dev,"reading line status failed: %d\n" , rc); +if (rc >=0 ) + rc = -EIO ; + }else { status =get_unaligned_le16 (status_buf); dev_info(&port->serial->dev->dev, "read status %x %x\n",
Greg Kroah-Hartman
maintainerPATCH 46/120 USB: serial: ch341: fix initial modem-control state
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 4e2da44691cffbfffb1535f478d19bc2dca3e62b upstream.
DTR and RTS will be asserted by the tty-layer when the port is opened and deasserted on close (if HUPCL is set). Make sure the initial state is not-asserted before the port is first opened as well.
--- drivers/usb/serial/ch341.c | 1 - 1 file changed, 1 deletion(-)
drivers/usb/serial/ch341.c +0 -1
@@ -253,7 +253,6 @@ static int ch341_port_probe(struct usb_sspin_lock_init (&priv->lock); priv->baud_rate =DEFAULT_BAUD_RATE ; - priv->line_control =CH341_BIT_RTS |CH341_BIT_DTR ; r =ch341_configure (port->serial->dev, priv);if (r <0 )
Greg Kroah-Hartman
maintainerPATCH 47/120 USB: serial: ch341: fix resume after reset
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit ce5e292828117d1b71cbd3edf9e9137cf31acd30 upstream.
Fix reset-resume handling which failed to resubmit the read and interrupt URBs, thereby leaving a port that was open before suspend in a broken state until closed and reopened.
--- drivers/usb/serial/ch341.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/usb/serial/ch341.c +13 -4
@@ -538,14 +538,23 @@ static int ch341_tiocmget(struct tty_strstatic int ch341_reset_resume (struct usb_serial *serial) { -struct ch341_private *priv; - - priv =usb_get_serial_port_data (serial->port[0 ]); +struct usb_serial_port *port = serial->port[0 ]; +struct ch341_private *priv =usb_get_serial_port_data (port); +int ret;/* reconfigure ch341 serial port after bus-reset */ ch341_configure (serial->dev, priv); -return 0 ; +if (tty_port_initialized (&port->port)) { + ret =usb_submit_urb (port->interrupt_in_urb,GFP_NOIO ); +if (ret) { +dev_err (&port->dev,"failed to submit interrupt urb: %d\n" , + ret); +return ret; + } + } + +return usb_serial_generic_resume (serial); }static struct usb_serial_driver ch341_device = {
Greg Kroah-Hartman
maintainerPATCH 48/120 USB: serial: ch341: fix open error handling
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit f2950b78547ffb8475297ada6b92bc2d774d5461 upstream.
Make sure to stop the interrupt URB before returning on errors during open.
--- drivers/usb/serial/ch341.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/usb/serial/ch341.c +10 -3
@@ -314,7 +314,7 @@ static int ch341_open(struct tty_struct r =ch341_configure (serial->dev, priv);if (r) - goto out; +return r;if (tty)ch341_set_termios (tty, port,NULL );
@@ -324,12 +324,19 @@ static int ch341_open(struct tty_structif (r) {dev_err (&port->dev,"%s - failed to submit interrupt urb: %d\n" , __func__, r); - goto out; +return r; } r =usb_serial_generic_open (tty, port); +if (r) + goto err_kill_interrupt_urb; + +return 0 ; + +err_kill_interrupt_urb: +usb_kill_urb (port->interrupt_in_urb); -out:return r; +return r; }/* Old_termios contains the original termios settings and
Greg Kroah-Hartman
maintainerPATCH 49/120 USB: serial: ch341: fix control-message error handling
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 2d5a9c72d0c4ac73cf97f4b7814ed6c44b1e49ae upstream.
A short control transfer would currently fail to be detected, something which could lead to stale buffer data being used as valid input.
Check for short transfers, and make sure to log any transfer errors.
Note that this also avoids leaking heap data to user space (TIOCMGET) and the remote device (break control).
--- drivers/usb/serial/ch341.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-)
drivers/usb/serial/ch341.c +21 -11
@@ -99,6 +99,8 @@ static int ch341_control_out(struct usb_ r =usb_control_msg (dev,usb_sndctrlpipe (dev,0 ), request,USB_TYPE_VENDOR |USB_RECIP_DEVICE |USB_DIR_OUT , value, index,NULL ,0 ,DEFAULT_TIMEOUT ); +if (r <0 ) +dev_err (&dev->dev,"failed to send control message: %d\n" , r);return r; }
@@ -116,7 +118,20 @@ static int ch341_control_in(struct usb_d r =usb_control_msg (dev,usb_rcvctrlpipe (dev,0 ), request,USB_TYPE_VENDOR |USB_RECIP_DEVICE |USB_DIR_IN , value, index, buf, bufsize,DEFAULT_TIMEOUT ); -return r; +if (r < bufsize) { +if (r >=0 ) { +dev_err (&dev->dev, +"short control message received (%d < %u)\n" , + r, bufsize); + r = -EIO ; + } + +dev_err (&dev->dev,"failed to receive control message: %d\n" , + r); +return r; + } + +return 0 ; } static int ch341_set_baudrate(struct usb_device *dev,
@@ -158,9 +173,9 @@ static int ch341_set_handshake(struct usstatic int ch341_get_status (struct usb_device *dev,struct ch341_private *priv) { +const unsigned int size =2 ;char *buffer;int r; -const unsigned size =8 ;unsigned long flags; buffer =kmalloc (size,GFP_KERNEL );
@@ -171,14 +186,9 @@ static int ch341_get_status(struct usb_dif (r <0 ) goto out; -/* setup the private status if available */ -if (r ==2 ) { - r =0 ; -spin_lock_irqsave (&priv->lock, flags); - priv->line_status = (~(*buffer)) &CH341_BITS_MODEM_STAT ; -spin_unlock_irqrestore (&priv->lock, flags); - }else - r = -EPROTO ; +spin_lock_irqsave (&priv->lock, flags); + priv->line_status = (~(*buffer)) &CH341_BITS_MODEM_STAT ; +spin_unlock_irqrestore (&priv->lock, flags); out:kfree (buffer);return r;
@@ -188,9 +198,9 @@ out: kfree(buffer);static int ch341_configure (struct usb_device *dev,struct ch341_private *priv) { +const unsigned int size =2 ;char *buffer;int r; -const unsigned size =8 ; buffer =kmalloc (size,GFP_KERNEL );if (!buffer)
Greg Kroah-Hartman
maintainerPATCH 50/120 USB: serial: ch341: fix open and resume after B0
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit a20047f36e2f6a1eea4f1fd261aaa55882369868 upstream.
The private baud_rate variable is used to configure the port at open and reset-resume and must never be set to (and left at) zero or reset-resume and all further open attempts will fail.
--- drivers/usb/serial/ch341.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/serial/ch341.c +1 -2
@@ -361,12 +361,11 @@ static void ch341_set_termios(struct tty baud_rate =tty_get_baud_rate (tty); - priv->baud_rate = baud_rate; -if (baud_rate) {spin_lock_irqsave (&priv->lock, flags); priv->line_control |= (CH341_BIT_DTR |CH341_BIT_RTS );spin_unlock_irqrestore (&priv->lock, flags); + priv->baud_rate = baud_rate;ch341_set_baudrate (port->serial->dev, priv); }else {spin_lock_irqsave (&priv->lock, flags);
Greg Kroah-Hartman
maintainerPATCH 51/120 Input: elants_i2c - avoid divide by 0 errors on bad touchscreen data
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 1c3415a06b1016a596bfe59e0cfee56c773aa958 upstream.
The following crash may be seen if bad data is received from the touchscreen.
[ 2189.425150] elants_i2c i2c-ELAN0001:00: unknown packet ff ff ff ff [ 2189.430738] divide error: 0000 [#1] PREEMPT SMP [ 2189.434679] gsmi: Log Shutdown Reason 0x03 [ 2189.434689] Modules linked in: ip6t_REJECT nf_reject_ipv6 rfcomm evdi
uinput uvcvideo cmac videobuf2_vmalloc videobuf2_memops snd_hda_codec_hdmi i2c_dev videobuf2_core snd_soc_sst_cht_bsw_rt5645 snd_hda_intel snd_intel_sst_acpi btusb btrtl btbcm btintel bluetooth snd_soc_sst_acpi snd_hda_codec snd_intel_sst_core snd_hwdep snd_soc_sst_mfld_platform snd_hda_core snd_soc_rt5645 memconsole_x86_legacy memconsole zram snd_soc_rl6231 fuse ip6table_filter iwlmvm iwlwifi iwl7000_mac80211 cfg80211 iio_trig_sysfs joydev cros_ec_sensors cros_ec_sensors_core industrialio_triggered_buffer kfifo_buf industrialio snd_seq_midi snd_seq_midi_event snd_rawmidi snd_seq snd_seq_device ppp_async ppp_generic slhc tun
[ 2189.434866] CPU: 0 PID: 106 Comm: irq/184-ELAN000 Tainted: G W 3.18.0-13101-g57e8190 #1 [ 2189.434883] Hardware name: GOOGLE Ultima, BIOS Google_Ultima.7287.131.43 07/20/2016 [ 2189.434898] task: ffff88017a0b6d80 ti: ffff88017a2bc000 task.ti: ffff88017a2bc000 [ 2189.434913] RIP: 0010:[<ffffffffbecc48d5>] [<ffffffffbecc48d5>] elants_i2c_irq+0x190/0x200 [ 2189.434937] RSP: 0018:ffff88017a2bfd98 EFLAGS: 00010293 [ 2189.434948] RAX: 0000000000000000 RBX: ffff88017a967828 RCX: ffff88017a9678e8 [ 2189.434962] RDX: 0000000000000000 RSI: 0000000000000246 RDI: 0000000000000000 [ 2189.434975] RBP: ffff88017a2bfdd8 R08: 00000000000003e8 R09: 0000000000000000 [ 2189.434989] R10: 0000000000000000 R11: 000000000044a2bd R12: ffff88017a991800 [ 2189.435001] R13: ffffffffbe8a2a53 R14: ffff88017a0b6d80 R15: ffff88017a0b6d80 [ 2189.435011] FS: 0000000000000000(0000) GS:ffff88017fc00000(0000) knlGS:0000000000000000 [ 2189.435022] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 2189.435030] CR2: 00007f678d94b000 CR3: 000000003f41a000 CR4: 00000000001007f0 [ 2189.435039] Stack: [ 2189.435044] ffff88017a2bfda8 ffff88017a9678e8 646464647a2bfdd8 0000000006e09574 [ 2189.435060] 0000000000000000 ffff88017a088b80 ffff88017a921000 ffffffffbe8a2a53 [ 2189.435074] ffff88017a2bfe08 ffffffffbe8a2a73 ffff88017a0b6d80 0000000006e09574 [ 2189.435089] Call Trace: [ 2189.435101] [<ffffffffbe8a2a53>] ? irq_thread_dtor+0xa9/0xa9 [ 2189.435112] [<ffffffffbe8a2a73>] irq_thread_fn+0x20/0x40 [ 2189.435123] [<ffffffffbe8a2be1>] irq_thread+0x14e/0x222 [ 2189.435135] [<ffffffffbee8cbeb>] ? __schedule+0x3b3/0x57a [ 2189.435145] [<ffffffffbe8a29aa>] ? wake_threads_waitq+0x2d/0x2d [ 2189.435156] [<ffffffffbe8a2a93>] ? irq_thread_fn+0x40/0x40 [ 2189.435168] [<ffffffffbe87c385>] kthread+0x10e/0x116 [ 2189.435178] [<ffffffffbe87c277>] ? __kthread_parkme+0x67/0x67 [ 2189.435189] [<ffffffffbee900ac>] ret_from_fork+0x7c/0xb0 [ 2189.435199] [<ffffffffbe87c277>] ? __kthread_parkme+0x67/0x67 [ 2189.435208] Code: ff ff eb 73 0f b6 bb c1 00 00 00 83 ff 03 7e 13 49 8d 7c 24 20 ba 04 00 00 00 48 c7 c6 8a cd 21 bf eb 4d 0f b6 83 c2 00 00 00 99 <f7> ff 83 f8 37 75 15 48 6b f7 37 4c 8d a3 c4 00 00 00 4c 8d ac [ 2189.435312] RIP [<ffffffffbecc48d5>] elants_i2c_irq+0x190/0x200 [ 2189.435323] RSP <ffff88017a2bfd98> [ 2189.435350] ---[ end trace f4945345a75d96dd ]--- [ 2189.443841] Kernel panic - not syncing: Fatal exception [ 2189.444307] Kernel Offset: 0x3d800000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff) [ 2189.444519] gsmi: Log Shutdown Reason 0x02
The problem was seen with a 3.18 based kernel, but there is no reason to believe that the upstream code is safe.
--- drivers/input/touchscreen/elants_i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/touchscreen/elants_i2c.c +2 -2
@@ -914,9 +914,9 @@ static irqreturn_t elants_i2c_irq(int ircase QUEUE_HEADER_NORMAL : report_count = ts->buf[FW_HDR_COUNT ]; -if (report_count >3 ) { +if (report_count ==0 || report_count >3 ) {dev_err (&client->dev, -"too large report count: %*ph\n" , +"bad report count: %*ph\n" ,HEADER_SIZE , ts->buf);break ; }
Greg Kroah-Hartman
maintainerPATCH 52/120 i2c: print correct device invalid address
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Garry <[email protected]>
commit 6f724fb3039522486fce2e32e4c0fbe238a6ab02 upstream.
In of_i2c_register_device(), when the check for device address validity fails we print the info.addr, which has not been assigned properly.
Fix this by printing the actual invalid address.
--- drivers/i2c/i2c-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/i2c-core.c +1 -1
@@ -1657,7 +1657,7 @@ static struct i2c_client *of_i2c_registeif (i2c_check_addr_validity (addr, info.flags)) {dev_err (&adap->dev,"of_i2c: invalid addr=%x on %s\n" , - info.addr, node->full_name); + addr, node->full_name);return ERR_PTR (-EINVAL ); }
Greg Kroah-Hartman
maintainerPATCH 53/120 i2c: fix kernel memory disclosure in dev interface
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vlad Tsyrklevich <[email protected]>
commit 30f939feaeee23e21391cfc7b484f012eb189c3c upstream.
i2c_smbus_xfer() does not always fill an entire block, allowing kernel stack memory disclosure through the temp variable. Clear it before it's read to.
--- drivers/i2c/i2c-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/i2c-dev.c +1 -1
@@ -331,7 +331,7 @@ static noinline int i2cdev_ioctl_smbus(s unsigned long arg) {struct i2c_smbus_ioctl_data data_arg; -union i2c_smbus_data temp; +union i2c_smbus_data temp = {};int datasize, res; if (copy_from_user(&data_arg,
Greg Kroah-Hartman
maintainerPATCH 54/120 fix a fencepost error in pipe_advance()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit b9dc6f65bc5e232d1c05fe34b5daadc7e8bbf1fb upstream.
The logics in pipe_advance() used to release all buffers past the new position failed in cases when the number of buffers to release was equal to pipe->buffers. If that happened, none of them had been released, leaving pipe full. Worse, it was trivial to trigger and we end up with pipe full of uninitialized pages. IOW, it's an infoleak.
--- lib/iov_iter.c | 54 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 23 deletions(-)
lib/iov_iter.c +31 -23
@@ -678,43 +678,50 @@ size_t iov_iter_copy_from_user_atomic(st }EXPORT_SYMBOL (iov_iter_copy_from_user_atomic); +static inline void pipe_truncate (struct iov_iter *i) +{ +struct pipe_inode_info *pipe = i->pipe; +if (pipe->nrbufs) { +size_t off = i->iov_offset; +int idx = i->idx; +int nrbufs = (idx - pipe->curbuf) & (pipe->buffers -1 ); +if (off) { + pipe->bufs[idx].len = off - pipe->bufs[idx].offset; + idx =next_idx (idx, pipe); + nrbufs++; + } +while (pipe->nrbufs > nrbufs) { +pipe_buf_release (pipe, &pipe->bufs[idx]); + idx =next_idx (idx, pipe); + pipe->nrbufs--; + } + } +} +static void pipe_advance (struct iov_iter *i,size_t size) {struct pipe_inode_info *pipe = i->pipe; -struct pipe_buffer *buf; -int idx = i->idx; -size_t off = i->iov_offset, orig_sz; -if (unlikely (i->count < size)) size = i->count; - orig_sz = size; -if (size) { +struct pipe_buffer *buf; +size_t off = i->iov_offset, left = size; +int idx = i->idx;if (off)/* make it relative to the beginning of buffer */ - size += off - pipe->bufs[idx].offset; + left += off - pipe->bufs[idx].offset;while (1 ) { buf = &pipe->bufs[idx]; -if (size <= buf->len) +if (left <= buf->len)break ; - size -= buf->len; + left -= buf->len; idx =next_idx (idx, pipe); } - buf->len = size; i->idx = idx; - off = i->iov_offset = buf->offset + size; - } -if (off) - idx =next_idx (idx, pipe); -if (pipe->nrbufs) { -int unused = (pipe->curbuf + pipe->nrbufs) & (pipe->buffers -1 ); -/* [curbuf,unused) is in use. Free [idx,unused) */ -while (idx != unused) { -pipe_buf_release (pipe, &pipe->bufs[idx]); - idx =next_idx (idx, pipe); - pipe->nrbufs--; - } + i->iov_offset = buf->offset + left; } - i->count -= orig_sz; + i->count -= size; +/* ... and discard everything past that point */ +pipe_truncate (i); }void iov_iter_advance (struct iov_iter *i,size_t size)
@@ -774,6 +781,7 @@ void iov_iter_pipe(struct iov_iter *i, i size_t count) {BUG_ON (direction !=ITER_PIPE ); +WARN_ON (pipe->nrbufs == pipe->buffers); i->type = direction; i->pipe = pipe; i->idx = (pipe->curbuf + pipe->nrbufs) & (pipe->buffers -1 );
Greg Kroah-Hartman
maintainerPATCH 55/120 xhci: fix deadlock at host remove by running watchdog correctly
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit d6169d04097fd9ddf811e63eae4e5cd71e6666e2 upstream.
If a URB is killed while the host is removed we can end up in a situation where the hub thread takes the roothub device lock, and waits for the URB to be given back by xhci-hcd, blocking the host remove code.
xhci-hcd tries to stop the endpoint and give back the urb, but can't as the host is removed from PCI bus at the same time, preventing the normal way of giving back urb.
Instead we need to rely on the stop command timeout function to give back the urb. This xhci_stop_endpoint_command_watchdog() timeout function used a XHCI_STATE_DYING flag to indicate if the timeout function is already running, but later this flag has been taking into use in other places to mark that xhci is dying.
Remove checks for XHCI_STATE_DYING in xhci_urb_dequeue. We are still checking that reading from pci state does not return 0xffffffff or that host is not halted before trying to stop the endpoint.
This whole area of stopping endpoints, giving back URBs, and the wathdog timeout need rework, this fix focuses on solving a specific deadlock issue that we can then send to stable before any major rework.
--- drivers/usb/host/xhci-ring.c | 11 ----------- drivers/usb/host/xhci.c | 13 ------------- 2 files changed, 24 deletions(-)
drivers/usb/host/xhci-ring.c +0 -11
@@ -917,17 +917,6 @@ void xhci_stop_endpoint_command_watchdogspin_lock_irqsave (&xhci->lock, flags); ep->stop_cmds_pending--; -if (xhci->xhc_state &XHCI_STATE_REMOVING ) { -spin_unlock_irqrestore (&xhci->lock, flags); -return ; - } -if (xhci->xhc_state &XHCI_STATE_DYING ) { -xhci_dbg_trace (xhci, trace_xhci_dbg_cancel_urb, -"Stop EP timer ran, but another timer marked " -"xHCI as DYING, exiting." ); -spin_unlock_irqrestore (&xhci->lock, flags); -return ; - }if (!(ep->stop_cmds_pending ==0 && (ep->ep_state &EP_HALT_PENDING ))) {xhci_dbg_trace (xhci, trace_xhci_dbg_cancel_urb, "Stop EP timer ran, but no command pending, "
drivers/usb/host/xhci.c +0 -13
@@ -1529,19 +1529,6 @@ int xhci_urb_dequeue(struct usb_hcd *hcdxhci_urb_free_priv (urb_priv);return ret; } -if ((xhci->xhc_state &XHCI_STATE_DYING ) || - (xhci->xhc_state &XHCI_STATE_HALTED )) { -xhci_dbg_trace (xhci, trace_xhci_dbg_cancel_urb, -"Ep 0x%x: URB %p to be canceled on " -"non-responsive xHCI host." , - urb->ep->desc.bEndpointAddress, urb); -/* Let the stop endpoint command watchdog timer (which set this -* state) finish cleaning up the endpoint TD lists. We must -* have caught it in the middle of dropping a lock and giving -* back an URB. -*/ - goto done; - } ep_index =xhci_get_endpoint_index (&urb->ep->desc); ep = &xhci->devs[urb->dev->slot_id]->eps[ep_index];
Greg Kroah-Hartman
maintainerPATCH 56/120 btrfs: fix crash when tracepoint arguments are freed by wq callbacks
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Sterba <[email protected]>
commit ac0c7cf8be00f269f82964cf7b144ca3edc5dbc4 upstream.
Enabling btrfs tracepoints leads to instant crash, as reported. The wq callbacks could free the memory and the tracepoints started to dereference the members to get to fs_info.
The proposed fix https://marc.info/?l=linux-btrfs&m=148172436722606&w=2
removed the tracepoints but we could preserve them by passing only the required data in a safe way.
--- fs/btrfs/async-thread.c | 15 +++++++++++---- include/trace/events/btrfs.h | 22 +++++++++++++--------- 2 files changed, 24 insertions(+), 13 deletions(-)
fs/btrfs/async-thread.c +11 -4
@@ -273,6 +273,8 @@ static void run_ordered_work(struct __btunsigned long flags;while (1 ) { +void *wtag; +spin_lock_irqsave (lock, flags);if (list_empty (list))break ;
@@ -299,11 +301,13 @@ static void run_ordered_work(struct __btspin_unlock_irqrestore (lock, flags);/* -* we don't want to call the ordered free functions -* with the lock held though +* We don't want to call the ordered free functions with the +* lock held though. Save the work as tag for the trace event, +* because the callback could free the structure. */ + wtag = work; work->ordered_free (work); -trace_btrfs_all_work_done (work); +trace_btrfs_all_work_done (wq->fs_info, wtag); }spin_unlock_irqrestore (lock, flags); }
@@ -311,6 +315,7 @@ static void run_ordered_work(struct __btstatic void normal_work_helper (struct btrfs_work *work) {struct __btrfs_workqueue *wq; +void *wtag;int need_order =0 ;/*
@@ -324,6 +329,8 @@ static void normal_work_helper(struct btif (work->ordered_func) need_order =1 ; wq = work->wq; +/* Safe for tracepoints in case work gets freed by the callback */ + wtag = work;trace_btrfs_work_sched (work);thresh_exec_hook (wq);
@@ -333,7 +340,7 @@ static void normal_work_helper(struct btrun_ordered_work (wq); }if (!need_order) -trace_btrfs_all_work_done (work); +trace_btrfs_all_work_done (wq->fs_info, wtag); } void btrfs_init_work(struct btrfs_work *work, btrfs_work_func_t uniq_func,
include/trace/events/btrfs.h +13 -9
@@ -1162,22 +1162,26 @@ DECLARE_EVENT_CLASS(btrfs__work, __entry->func, __entry->ordered_func, __entry->ordered_free) ); -/* For situiations that the work is freed */ +/* +* For situiations when the work is freed, we pass fs_info and a tag that that +* matches address of the work structure so it can be paired with the +* scheduling event. +*/ DECLARE_EVENT_CLASS (btrfs__work__done, - TP_PROTO(struct btrfs_work *work), + TP_PROTO(struct btrfs_fs_info *fs_info, void *wtag), -TP_ARGS (work), +TP_ARGS (fs_info, wtag),TP_STRUCT__entry_btrfs ( - __field( void *, work ) + __field( void *, wtag ) ), -TP_fast_assign_btrfs (btrfs_work_owner (work), - __entry->work = work; +TP_fast_assign_btrfs (fs_info, + __entry->wtag = wtag; ), -TP_printk_btrfs ("work->%p" , __entry->work) +TP_printk_btrfs ("work->%p" , __entry->wtag) ); DEFINE_EVENT(btrfs__work, btrfs_work_queued,
@@ -1196,9 +1200,9 @@ DEFINE_EVENT(btrfs__work, btrfs_work_schDEFINE_EVENT (btrfs__work__done, btrfs_all_work_done, - TP_PROTO(struct btrfs_work *work), + TP_PROTO(struct btrfs_fs_info *fs_info, void *wtag), -TP_ARGS (work) +TP_ARGS (fs_info, wtag) ); DEFINE_EVENT(btrfs__work, btrfs_ordered_sched,
Greg Kroah-Hartman
maintainerPATCH 57/120 ASoC: hdmi-codec: use unsigned type to structure members with bit-field
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Sakamoto <[email protected]>
commit 9e4d59ada4d602e78eee9fb5f898ce61fdddb446 upstream.
This is a fix for Linux 4.10-rc1.
In C language specification, a bit-field is interpreted as a signed or unsigned integer type consisting of the specified number of bits.
In GCC manual, the range of a signed bit field of N bits is from -(2^N) / 2 to ((2^N) / 2) - 1
https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.html#Bit-Fields
Therefore, when defined as 1 bit-field with signed type, variables can represents -1 and 0.
The snd-soc-hdmi-codec module includes a structure which has signed type members with bit-fields. Codes of this module assign 0 and 1 to the members. This seems to result in implementation-dependent behaviours.
As of v4.10-rc1 merge window, outside of sound subsystem, this structure is referred by below GPU modules.
- tda998x
- sti-drm
- mediatek-drm-hdmi
- msm
As long as I review their codes relevant to the structure, the structure members are used just for condition statements and printk formats. My proposal of change is a bit intrusive to the printk formats but this may be acceptable.
Totally, it's reasonable to use unsigned type for the structure members. This bug is detected by Sparse, static code analyzer with below warnings.
./include/sound/hdmi-codec.h:39:26: error: dubious one-bit signed bitfield ./include/sound/hdmi-codec.h:40:28: error: dubious one-bit signed bitfield ./include/sound/hdmi-codec.h:41:29: error: dubious one-bit signed bitfield ./include/sound/hdmi-codec.h:42:31: error: dubious one-bit signed bitfield
--- include/sound/hdmi-codec.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
include/sound/hdmi-codec.h +4 -4
@@ -36,10 +36,10 @@ struct hdmi_codec_daifmt {HDMI_AC97 ,HDMI_SPDIF , } fmt; - int bit_clk_inv:1; - int frame_clk_inv:1; - int bit_clk_master:1; - int frame_clk_master:1; + unsigned int bit_clk_inv:1; + unsigned int frame_clk_inv:1; + unsigned int bit_clk_master:1; + unsigned int frame_clk_master:1; };/*
Greg Kroah-Hartman
maintainerPATCH 58/120 Revert "tty: serial: 8250: add CON_CONSDEV to flags"
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
commit 6741f551a0b26479de2532ffa43a366747e6dbf3 upstream.
This commit needs to be reverted because it prevents people from using the serial console as a secondary console with input being directed to tty0.
IOW, if you boot with console=ttyS0 console=tty0 then all kernels prior to this commit will produce output on both ttyS0 and tty0 but input will only be taken from tty0. With this patch the serial console will always be the primary console instead of tty0, potentially preventing people from getting into their machines in emergency situations.
--- drivers/tty/serial/8250/8250_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_core.c +1 -1
@@ -675,7 +675,7 @@ static struct console univ8250_console = .device = uart_console_device, .setup = univ8250_console_setup, .match = univ8250_console_match, - .flags = CON_PRINTBUFFER | CON_ANYTIME | CON_CONSDEV, + .flags = CON_PRINTBUFFER | CON_ANYTIME, .index = -1, .data = &serial8250_reg, };
Greg Kroah-Hartman
maintainerPATCH 60/120 pid: fix lockdep deadlock warning due to ucount_lock
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrei Vagin <[email protected]>
commit add7c65ca426b7a37184dd3d2172394e23d585d6 upstream.
=========================================================
[ INFO: possible irq lock inversion dependency detected ]
4.10.0-rc2-00024-g4aecec9-dirty #118 Tainted: G W
---------------------------------------------------------
swapper/1/0 just changed the state of lock:
(&(&sighand->siglock)->rlock){-.....}, at: [<ffffffffbd0a1bc6>] __lock_task_sighand+0xb6/0x2c0
but this lock took another, HARDIRQ-unsafe lock in the past:
(ucounts_lock){+.+...}
and interrupts could create inverse lock ordering between them.
other info that might help us debug this:
Chain exists of: &(&sighand->siglock)->rlock --> &(&tty->ctrl_lock)->rlock --> ucounts_lock
Possible interrupt unsafe locking scenario:
CPU0 CPU1
---- ----
lock(ucounts_lock);
local_irq_disable();
lock(&(&sighand->siglock)->rlock);
lock(&(&tty->ctrl_lock)->rlock);
<Interrupt>
lock(&(&sighand->siglock)->rlock);*** DEADLOCK ***
This patch removes a dependency between rlock and ucount_lock.
--- kernel/pid_namespace.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
kernel/pid_namespace.c +6 -4
@@ -151,8 +151,12 @@ out:static void delayed_free_pidns (struct rcu_head *p) { -kmem_cache_free (pid_ns_cachep, - container_of(p, struct pid_namespace, rcu)); + struct pid_namespace *ns = container_of(p, struct pid_namespace, rcu); + +dec_pid_namespaces (ns->ucounts); +put_user_ns (ns->user_ns); + +kmem_cache_free (pid_ns_cachep, ns); }static void destroy_pid_namespace (struct pid_namespace *ns)
@@ -162,8 +166,6 @@ static void destroy_pid_namespace(structns_free_inum (&ns->ns);for (i =0 ; i <PIDMAP_ENTRIES ; i++)kfree (ns->pidmap[i].page); -dec_pid_namespaces (ns->ucounts); -put_user_ns (ns->user_ns);call_rcu (&ns->rcu, delayed_free_pidns); }
Greg Kroah-Hartman
maintainerPATCH 61/120 mnt: Protect the mountpoint hashtable with mount_lock
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric W. Biederman <[email protected]>
commit 3895dbf8985f656675b5bde610723a29cbce3fa7 upstream.
Protecting the mountpoint hashtable with namespace_sem was sufficient until a call to umount_mnt was added to mntput_no_expire. At which point it became possible for multiple calls of put_mountpoint on the same hash chain to happen on the same time.
Kristen Johansen <[email protected]> reported:
Quoted 8 lines
This can cause a panic when simultaneous callers of
put_mountpointattempt to free the same mountpoint. This occurs because some callers hold themount_hash_lock, while others hold the namespace lock. Some even hold both.In this submitter's case, the panic manifested itself as a GP fault in
put_mountpoint()when it calledhlist_del()and attempted to dereference a m_hash.pprev that had been poisioned by another thread.
Al Viro observed that the simple fix is to switch from using the namespace_sem to the mount_lock to protect the mountpoint hash table.
I have taken Al's suggested patch moved put_mountpoint in pivot_root (instead of taking mount_lock an additional time), and have replaced new_mountpoint with get_mountpoint a function that does the hash table
lookup and addition under the mount_lock. The introduction of get_mounptoint
ensures that only the mount_lock is needed to manipulate the mountpoint hashtable.
d_set_mounted is modified to only set DCACHE_MOUNTED if it is not already set. This allows get_mountpoint to use the setting of DCACHE_MOUNTED to ensure adding a struct mountpoint for a dentry happens exactly once.
--- fs/dcache.c | 7 ++++-- fs/namespace.c | 64 ++++++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 50 insertions(+), 21 deletions(-)
fs/dcache.c +5 -2
@@ -1330,8 +1330,11 @@ int d_set_mounted(struct dentry *dentry) }spin_lock (&dentry->d_lock);if (!d_unlinked (dentry)) { - dentry->d_flags |=DCACHE_MOUNTED ; - ret =0 ; + ret = -EBUSY ; +if (!d_mountpoint (dentry)) { + dentry->d_flags |=DCACHE_MOUNTED ; + ret =0 ; + } }spin_unlock (&dentry->d_lock); out:
fs/namespace.c +45 -19
116 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 62/120 drivers: char: mem: Fix thinkos in kmem address checks
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robin Murphy <[email protected]>
commit 488debb9971bc7d0edd6d8080ba78ca02a04f6c4 upstream.
When borrowing the pfn_valid() check from mmap_kmem(), somebody managed to get physical and virtual addresses spectacularly muddled up, such that we've ended up with checks for one being the other. Whilst this does indeed prevent out-of-bounds accesses crashing, on most systems it also prevents the more desirable use-case of working at all ever.
Check the *virtual* offset correctly for what it is. Furthermore, do so in the right place - a read or write may span multiple pages, so a single up-front check is insufficient. High memory accesses already have a similar validity check just before the copy_to_user() call, so just make the low memory path fully consistent with that.
--- drivers/char/mem.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/char/mem.c +4 -6
@@ -381,9 +381,6 @@ static ssize_t read_kmem(struct file *fichar *kbuf;/* k-addr because vread() takes vmlist_lock rwlock */ int err =0 ; -if (!pfn_valid (PFN_DOWN (p))) -return -EIO ; - read =0 ;if (p < (unsigned long ) high_memory) { low_count = count;
@@ -412,6 +409,8 @@ static ssize_t read_kmem(struct file *fi* by the kernel or data corruption may occur */ kbuf =xlate_dev_kmem_ptr ((void *)p); +if (!virt_addr_valid (kbuf)) +return -ENXIO ;if (copy_to_user (buf, kbuf, sz))return -EFAULT ;
@@ -482,6 +481,8 @@ static ssize_t do_write_kmem(unsigned lo* corruption may occur. */ ptr =xlate_dev_kmem_ptr ((void *)p); +if (!virt_addr_valid (ptr)) +return -ENXIO ; copied =copy_from_user (ptr, buf, sz);if (copied) {
@@ -512,9 +513,6 @@ static ssize_t write_kmem(struct file *fchar *kbuf;/* k-addr because vwrite() takes vmlist_lock rwlock */ int err =0 ; -if (!pfn_valid (PFN_DOWN (p))) -return -EIO ; -if (p < (unsigned long ) high_memory) { unsigned long to_write = min_t(unsigned long, count, (unsigned long )high_memory - p);
Greg Kroah-Hartman
maintainerPATCH 63/120 dmaengine: omap-dma: Fix dynamic lch_map allocation
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Ujfalusi <[email protected]>
commit 836c3ce2566fb8c1754f8d7c9534cad9bc8a6879 upstream.
The original patch did not done what it was supposed to be doing and even worst it broke legacy boot (OMAP1).
The lch_map size should be the number of available logical channels in sDMA and the od->dma_requests should store the number of available DMA request lines usable in sDMA.
In legacy mode we do not have a way to get the DMA request count, in that case we use OMAP_SDMA_REQUESTS (127), despite the fact that OMAP1510 have only 31 DMA request line.
--- drivers/dma/omap-dma.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)
drivers/dma/omap-dma.c +21 -9
@@ -1339,6 +1339,7 @@ static int omap_dma_probe(struct platforstruct omap_dmadev *od;struct resource *res;int rc, i, irq; +u32 lch_count; od =devm_kzalloc (&pdev->dev,sizeof (*od),GFP_KERNEL );if (!od)
@@ -1381,20 +1382,31 @@ static int omap_dma_probe(struct platforspin_lock_init (&od->lock);spin_lock_init (&od->irq_lock); -if (!pdev->dev.of_node) { - od->dma_requests = od->plat->dma_attr->lch_count; -if (unlikely (!od->dma_requests)) - od->dma_requests =OMAP_SDMA_REQUESTS ; - }else if (of_property_read_u32 (pdev->dev.of_node,"dma-requests" , - &od->dma_requests)) { +/* Number of DMA requests */ + od->dma_requests =OMAP_SDMA_REQUESTS ; +if (pdev->dev.of_node &&of_property_read_u32 (pdev->dev.of_node, +"dma-requests" , + &od->dma_requests)) {dev_info (&pdev->dev,"Missing dma-requests property, using %u.\n" ,OMAP_SDMA_REQUESTS ); - od->dma_requests =OMAP_SDMA_REQUESTS ; } - od->lch_map =devm_kcalloc (&pdev->dev, od->dma_requests, -sizeof (*od->lch_map),GFP_KERNEL ); +/* Number of available logical channels */ +if (!pdev->dev.of_node) { + lch_count = od->plat->dma_attr->lch_count; +if (unlikely (!lch_count)) + lch_count =OMAP_SDMA_CHANNELS ; + }else if (of_property_read_u32 (pdev->dev.of_node,"dma-channels" , + &lch_count)) { +dev_info (&pdev->dev, +"Missing dma-channels property, using %u.\n" , +OMAP_SDMA_CHANNELS ); + lch_count =OMAP_SDMA_CHANNELS ; + } + + od->lch_map =devm_kcalloc (&pdev->dev, lch_count,sizeof (*od->lch_map), +GFP_KERNEL );if (!od->lch_map)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 64/120 virtio_blk: avoid DMA to stack for the sense buffer
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
commit a14d749fcebe97ddf6af6db3d1f6ece85c9ddcb9 upstream.
Most users of BLOCK_PC requests allocate the sense buffer on the stack, so to avoid DMA to the stack copy them to a field in the heap allocated virtblk_req structure. Without that any attempt at SCSI passthrough I/O, including the SG_IO ioctl from userspace will crash the kernel. Note that this includes running tools like hdparm even when the host does not have SCSI passthrough enabled.
--- drivers/block/virtio_blk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/block/virtio_blk.c +3 -1
@@ -56,6 +56,7 @@ struct virtblk_req {struct virtio_blk_outhdr out_hdr;struct virtio_scsi_inhdr in_hdr;u8 status; +u8 sense[SCSI_SENSE_BUFFERSIZE ];struct scatterlist sg[]; };
@@ -102,7 +103,8 @@ static int __virtblk_add_req(struct virt }if (type ==cpu_to_virtio32 (vq->vdev,VIRTIO_BLK_T_SCSI_CMD )) { -sg_init_one (&sense, vbr->req->sense,SCSI_SENSE_BUFFERSIZE ); +memcpy (vbr->sense, vbr->req->sense,SCSI_SENSE_BUFFERSIZE ); +sg_init_one (&sense, vbr->sense,SCSI_SENSE_BUFFERSIZE ); sgs[num_out + num_in++] = &sense;sg_init_one (&inhdr, &vbr->in_hdr,sizeof (vbr->in_hdr)); sgs[num_out + num_in++] = &inhdr;
Greg Kroah-Hartman
maintainerPATCH 65/120 tty/serial: atmel: RS485 half duplex w/DMA: enable RX after TX is done
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Genoud <[email protected]>
commit b389f173aaa1204d6dc1f299082a162eb0491545 upstream.
When using RS485 in half duplex, RX should be enabled when TX is finished, and stopped when TX starts.
Before commit 0058f0871efe7b01c6 ("tty/serial: atmel: fix RS485 half duplex with DMA"), RX was not disabled in atmel_start_tx() if the DMA was used. So, collisions could happened.
But disabling RX in atmel_start_tx() uncovered another bug:
RX was enabled again in the wrong place (in atmel_tx_dma) instead of being enabled when TX is finished (in atmel_complete_tx_dma), so the transmission simply stopped.
This bug was not triggered before commit 0058f0871efe7b01c6 ("tty/serial: atmel: fix RS485 half duplex with DMA") because RX was never disabled before.
Moving atmel_start_rx() in atmel_complete_tx_dma() corrects the problem.
--- drivers/tty/serial/atmel_serial.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/tty/serial/atmel_serial.c +5 -6
@@ -798,6 +798,11 @@ static void atmel_complete_tx_dma(void **/ if (!uart_circ_empty (xmit))atmel_tasklet_schedule (atmel_port, &atmel_port->tasklet_tx); +else if ((port->rs485.flags &SER_RS485_ENABLED ) && + !(port->rs485.flags &SER_RS485_RX_DURING_TX )) { +/* DMA done, stop TX, start RX for RS485 */ +atmel_start_rx (port); + }spin_unlock_irqrestore (&port->lock, flags); }
@@ -900,12 +905,6 @@ static void atmel_tx_dma(struct uart_por desc->callback = atmel_complete_tx_dma; desc->callback_param = atmel_port; atmel_port->cookie_tx =dmaengine_submit (desc); - - }else { -if (port->rs485.flags &SER_RS485_ENABLED ) { -/* DMA done, stop TX, start RX for RS485 */ -atmel_start_rx (port); - } }if (uart_circ_chars_pending (xmit) <WAKEUP_CHARS )
Greg Kroah-Hartman
maintainerPATCH 66/120 tty/serial: atmel_serial: BUG: stop DMA from transmitting in stop_tx
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Genoud <[email protected]>
commit 89d8232411a85b9a6b12fd5da4d07d8a138a8e0c upstream.
If we don't disable the transmitter in atmel_stop_tx, the DMA buffer continues to send data until it is emptied.
This cause problems with the flow control (CTS is asserted and data are still sent).
So, disabling the transmitter in atmel_stop_tx is a sane thing to do.
Tested on at91sam9g35-cm(DMA)
Tested for regressions on sama5d2-xplained(Fifo) and at91sam9g20ek(PDC)
--- drivers/tty/serial/atmel_serial.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/tty/serial/atmel_serial.c +11 -0
@@ -481,6 +481,14 @@ static void atmel_stop_tx(struct uart_po/* disable PDC transmit */ atmel_uart_writel (port,ATMEL_PDC_PTCR ,ATMEL_PDC_TXTDIS ); } + +/* +* Disable the transmitter. +* This is mandatory when DMA is used, otherwise the DMA buffer +* is fully transmitted. +*/ +atmel_uart_writel (port,ATMEL_US_CR ,ATMEL_US_TXDIS ); +/* Disable interrupts */ atmel_uart_writel (port,ATMEL_US_IDR , atmel_port->tx_done_mask);
@@ -513,6 +521,9 @@ static void atmel_start_tx(struct uart_p/* Enable interrupts */ atmel_uart_writel (port,ATMEL_US_IER , atmel_port->tx_done_mask); + +/* re-enable the transmitter */ +atmel_uart_writel (port,ATMEL_US_CR ,ATMEL_US_TXEN ); }/*
Greg Kroah-Hartman
maintainerPATCH 67/120 ibmvscsis: Fix srp_transfer_data fail return code
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bryant G. Ly <[email protected]>
commit 7c9d8d0c41b3e24473ac7648a7fc2d644ccf08ff upstream.
If srp_transfer_data fails within ibmvscsis_write_pending, then the most likely scenario is that the client timed out the op and removed the TCE mapping. Thus it will loop forever retrying the op that is pretty much guaranteed to fail forever. A better return code would be EIO instead of EAGAIN.
--- drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +1 -1
@@ -3702,7 +3702,7 @@ static int ibmvscsis_write_pending(struc 1, 1);if (rc) {pr_err ("srp_transfer_data() failed: %d\n" , rc); -return -EAGAIN ; +return -EIO ; }/* * We now tell TCM to add this WRITE CDB directly into the TCM storage
Greg Kroah-Hartman
maintainerPATCH 68/120 orinoco: Use shash instead of ahash for MIC calculations
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Lutomirski <[email protected]>
commit 570b90fa230b8021f51a67fab2245fe8df6fe37d upstream.
Eric Biggers pointed out that the orinoco driver pointed scatterlists at the stack.
Fix it by switching from ahash to shash. The result should be simpler, faster, and more correct.
kvalo: cherry picked from commit 1fef293b8a9850cfa124a53c1d8878d355010403 as I accidentally applied this patch to wireless-drivers-next when I was supposed to apply this wireless-drivers
--- drivers/net/wireless/intersil/orinoco/mic.c | 44 ++++++++++++++---------- drivers/net/wireless/intersil/orinoco/mic.h | 3 + drivers/net/wireless/intersil/orinoco/orinoco.h | 4 +- 3 files changed, 30 insertions(+), 21 deletions(-)
drivers/net/wireless/intersil/orinoco/mic.c +26 -18
@@ -16,7 +16,7 @@/********************************************************************/ int orinoco_mic_init (struct orinoco_private *priv) { - priv->tx_tfm_mic =crypto_alloc_ahash ("michael_mic" ,0 , + priv->tx_tfm_mic =crypto_alloc_shash ("michael_mic" ,0 ,CRYPTO_ALG_ASYNC );if (IS_ERR (priv->tx_tfm_mic)) { printk(KERN_DEBUG "orinoco_mic_init: could not allocate "
@@ -25,7 +25,7 @@ int orinoco_mic_init(struct orinoco_privreturn -ENOMEM ; } - priv->rx_tfm_mic =crypto_alloc_ahash ("michael_mic" ,0 , + priv->rx_tfm_mic =crypto_alloc_shash ("michael_mic" ,0 ,CRYPTO_ALG_ASYNC );if (IS_ERR (priv->rx_tfm_mic)) { printk(KERN_DEBUG "orinoco_mic_init: could not allocate "
@@ -40,17 +40,16 @@ int orinoco_mic_init(struct orinoco_privvoid orinoco_mic_free (struct orinoco_private *priv) {if (priv->tx_tfm_mic) -crypto_free_ahash (priv->tx_tfm_mic); +crypto_free_shash (priv->tx_tfm_mic);if (priv->rx_tfm_mic) -crypto_free_ahash (priv->rx_tfm_mic); +crypto_free_shash (priv->rx_tfm_mic); } -int orinoco_mic (struct crypto_ahash *tfm_michael,u8 *key, +int orinoco_mic (struct crypto_shash *tfm_michael,u8 *key,u8 *da,u8 *sa,u8 priority,u8 *data,size_t data_len,u8 *mic) { -AHASH_REQUEST_ON_STACK (req, tfm_michael); -struct scatterlist sg[2 ]; +SHASH_DESC_ON_STACK (desc, tfm_michael);u8 hdr[ETH_HLEN +2 ];/* size of header + padding */ int err;
@@ -67,18 +66,27 @@ int orinoco_mic(struct crypto_ahash *tfm hdr[ETH_ALEN *2 +2 ] =0 ; hdr[ETH_ALEN *2 +3 ] =0 ; -/* Use scatter gather to MIC header and data in one go */ -sg_init_table (sg,2 ); -sg_set_buf (&sg[0 ], hdr,sizeof (hdr)); -sg_set_buf (&sg[1 ], data, data_len); + desc->tfm = tfm_michael; + desc->flags =0 ; -if (crypto_ahash_setkey (tfm_michael, key,MIC_KEYLEN )) -return -1 ; + err =crypto_shash_setkey (tfm_michael, key,MIC_KEYLEN ); +if (err) +return err; + + err =crypto_shash_init (desc); +if (err) +return err; + + err =crypto_shash_update (desc, hdr,sizeof (hdr)); +if (err) +return err; + + err =crypto_shash_update (desc, data, data_len); +if (err) +return err; + + err =crypto_shash_final (desc, mic); +shash_desc_zero (desc); -ahash_request_set_tfm (req, tfm_michael); -ahash_request_set_callback (req,0 ,NULL ,NULL ); -ahash_request_set_crypt (req, sg, mic, data_len +sizeof (hdr)); - err =crypto_ahash_digest (req); -ahash_request_zero (req);return err; }
drivers/net/wireless/intersil/orinoco/mic.h +2 -1
@@ -6,6 +6,7 @@#define _ORINOCO_MIC_H_#include <linux/types.h> +#include <crypto/hash.h> #define MICHAEL_MIC_LEN 8
@@ -15,7 +16,7 @@ struct crypto_ahash;int orinoco_mic_init (struct orinoco_private *priv);void orinoco_mic_free (struct orinoco_private *priv); -int orinoco_mic (struct crypto_ahash *tfm_michael,u8 *key, +int orinoco_mic (struct crypto_shash *tfm_michael,u8 *key,u8 *da,u8 *sa,u8 priority,u8 *data,size_t data_len,u8 *mic);
drivers/net/wireless/intersil/orinoco/orinoco.h +2 -2
@@ -152,8 +152,8 @@ struct orinoco_private {u8 *wpa_ie;int wpa_ie_len; -struct crypto_ahash *rx_tfm_mic; -struct crypto_ahash *tx_tfm_mic; +struct crypto_shash *rx_tfm_mic; +struct crypto_shash *tx_tfm_mic; unsigned int wpa_enabled:1; unsigned int tkip_cm_active:1;
Greg Kroah-Hartman
maintainerPATCH 69/120 sysrq: attach sysrq handler correctly for 32-bit kernel
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akinobu Mita <[email protected]>
commit 802c03881f29844af0252b6e22be5d2f65f93fd0 upstream.
The sysrq input handler should be attached to the input device which has a left alt key.
On 32-bit kernels, some input devices which has a left alt key cannot attach sysrq handler. Because the keybit bitmap in struct input_device_id for sysrq is not correctly initialized. KEY_LEFTALT is 56 which is greater than BITS_PER_LONG on 32-bit kernels.
I found this problem when using a matrix keypad device which defines a KEY_LEFTALT (56) but doesn't have a KEY_O (24 == 56%32).
--- drivers/tty/sysrq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/sysrq.c +2 -2
@@ -946,8 +946,8 @@ static const struct input_device_id sysr { .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT, - .evbit = { BIT_MASK(EV_KEY) }, - .keybit = { BIT_MASK(KEY_LEFTALT) }, + .evbit = { [BIT_WORD(EV_KEY)] = BIT_MASK(EV_KEY) }, + .keybit = { [BIT_WORD(KEY_LEFTALT)] = BIT_MASK(KEY_LEFTALT) }, }, { }, };
Greg Kroah-Hartman
maintainerPATCH 70/120 extcon: return error code on failure
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pan Bian <[email protected]>
commit 5b11ebedd6a8bb4271b796e498cd15c0fe1133b6 upstream.
Function get_zeroed_page() returns a NULL pointer if there is no enough memory. In function extcon_sync(), it returns 0 if the call to get_zeroed_page() fails. The return value 0 indicates success in the context, which is incosistent with the execution status. This patch fixes the bug by returning -ENOMEM.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188611
--- drivers/extcon/extcon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/extcon/extcon.c +1 -1
@@ -453,7 +453,7 @@ int extcon_sync(struct extcon_dev *edev,dev_err (&edev->dev,"out of memory in extcon_set_state\n" );kobject_uevent (&edev->dev.kobj,KOBJ_CHANGE ); -return 0 ; +return -ENOMEM ; } length =name_show (&edev->dev,NULL , prop_buf);
Greg Kroah-Hartman
maintainerPATCH 71/120 Clearing FIFOs in RS485 emulation mode causes subsequent transmits to break
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Jedrychowski <[email protected]>
commit 2bed8a8e70729f996af92042d3ad0f11870acc1f upstream.
When in RS485 emulation mode, __do_stop_tx_rs485() calls serial8250_clear_fifos(). This not only clears the FIFOs, but also sets all bits in their control register (UART_FCR) to 0.
One of the effects of this is the disabling of the FIFOs, which turns them into single-byte holding registers. The rest of the driver doesn't know this, which results in the lions share of characters passed into a write call to be dropped.
(I can supply logic analyzer screenshots if necessary)
This fix replaces the serial8250_clear_fifos() call to serial8250_clear_and_reinit_fifos() - this prevents the "dropped characters" issue from manifesting again while retaining the requirement of clearing the RX FIFO after transmission if the SER_RS485_RX_DURING_TX flag is disabled.
--- drivers/tty/serial/8250/8250_port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_port.c +1 -1
@@ -1411,7 +1411,7 @@ static void __do_stop_tx_rs485(struct ua* Enable previously disabled RX interrupts. */ if (!(p->port.rs485.flags &SER_RS485_RX_DURING_TX )) { -serial8250_clear_fifos (p); +serial8250_clear_and_reinit_fifos (p); p->ier |=UART_IER_RLSI |UART_IER_RDI ;serial_port_out (&p->port,UART_IER , p->ier);
Greg Kroah-Hartman
maintainerPATCH 72/120 sysctl: Drop reference added by grab_header in proc_sys_readdir
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhou Chengming <[email protected]>
commit 93362fa47fe98b62e4a34ab408c4a418432e7939 upstream.
Fixes CVE-2016-9191, proc_sys_readdir doesn't drop reference added by grab_header when return from !dir_emit_dots path. It can cause any path called unregister_sysctl_table will wait forever.
The calltrace of CVE-2016-9191:
[ 5535.960522] Call Trace: [ 5535.963265] [<ffffffff817cdaaf>] schedule+0x3f/0xa0 [ 5535.968817] [<ffffffff817d33fb>] schedule_timeout+0x3db/0x6f0 [ 5535.975346] [<ffffffff817cf055>] ? wait_for_completion+0x45/0x130 [ 5535.982256] [<ffffffff817cf0d3>] wait_for_completion+0xc3/0x130 [ 5535.988972] [<ffffffff810d1fd0>] ? wake_up_q+0x80/0x80 [ 5535.994804] [<ffffffff8130de64>] drop_sysctl_table+0xc4/0xe0 [ 5536.001227] [<ffffffff8130de17>] drop_sysctl_table+0x77/0xe0 [ 5536.007648] [<ffffffff8130decd>] unregister_sysctl_table+0x4d/0xa0 [ 5536.014654] [<ffffffff8130deff>] unregister_sysctl_table+0x7f/0xa0 [ 5536.021657] [<ffffffff810f57f5>] unregister_sched_domain_sysctl+0x15/0x40 [ 5536.029344] [<ffffffff810d7704>] partition_sched_domains+0x44/0x450 [ 5536.036447] [<ffffffff817d0761>] ? __mutex_unlock_slowpath+0x111/0x1f0 [ 5536.043844] [<ffffffff81167684>] rebuild_sched_domains_locked+0x64/0xb0 [ 5536.051336] [<ffffffff8116789d>] update_flag+0x11d/0x210 [ 5536.057373] [<ffffffff817cf61f>] ? mutex_lock_nested+0x2df/0x450 [ 5536.064186] [<ffffffff81167acb>] ? cpuset_css_offline+0x1b/0x60 [ 5536.070899] [<ffffffff810fce3d>] ? trace_hardirqs_on+0xd/0x10 [ 5536.077420] [<ffffffff817cf61f>] ? mutex_lock_nested+0x2df/0x450 [ 5536.084234] [<ffffffff8115a9f5>] ? css_killed_work_fn+0x25/0x220 [ 5536.091049] [<ffffffff81167ae5>] cpuset_css_offline+0x35/0x60 [ 5536.097571] [<ffffffff8115aa2c>] css_killed_work_fn+0x5c/0x220 [ 5536.104207] [<ffffffff810bc83f>] process_one_work+0x1df/0x710 [ 5536.110736] [<ffffffff810bc7c0>] ? process_one_work+0x160/0x710 [ 5536.117461] [<ffffffff810bce9b>] worker_thread+0x12b/0x4a0 [ 5536.123697] [<ffffffff810bcd70>] ? process_one_work+0x710/0x710 [ 5536.130426] [<ffffffff810c3f7e>] kthread+0xfe/0x120 [ 5536.135991] [<ffffffff817d4baf>] ret_from_fork+0x1f/0x40 [ 5536.142041] [<ffffffff810c3e80>] ? kthread_create_on_node+0x230/0x230
One cgroup maintainer mentioned that "cgroup is trying to offline a cpuset css, which takes place under cgroup_mutex. The offlining ends up trying to drain active usages of a sysctl table which apprently is not happening."
The real reason is that proc_sys_readdir doesn't drop reference added by grab_header when return from !dir_emit_dots path. So this cpuset offline path will wait here forever.
See here for details: http://www.openwall.com/lists/oss-security/2016/11/04/13
--- fs/proc/proc_sysctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/proc/proc_sysctl.c +2 -1
@@ -709,7 +709,7 @@ static int proc_sys_readdir(struct file ctl_dir = container_of(head, struct ctl_dir, header);if (!dir_emit_dots (file, ctx)) -return 0 ; + goto out; pos =2 ;
@@ -719,6 +719,7 @@ static int proc_sys_readdir(struct filebreak ; } } +out:sysctl_head_finish (head);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 73/120 net/af_iucv: dont use paged skbs for TX on HiperSockets
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julian Wiedmann <[email protected]>
commit dc5367bcc556e97555fc94a32cd1aadbebdff47e upstream.
With commit e53743994e21
("af_iucv: use paged SKBs for big outbound messages"), we transmit paged skbs for both of AF_IUCV's transport modes (IUCV or HiperSockets).
The qeth driver for Layer 3 HiperSockets currently doesn't support NETIF_F_SG, so these skbs would just be linearized again by the stack.
Avoid that overhead by using paged skbs only for IUCV transport.
cc stable, since this also circumvents a significant skb leak when sending large messages (where the skb then needs to be linearized).
--- net/iucv/af_iucv.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
net/iucv/af_iucv.c +14 -11
@@ -1036,7 +1036,8 @@ static int iucv_sock_sendmsg(struct sock {struct sock *sk = sock->sk;struct iucv_sock *iucv =iucv_sk (sk); -size_t headroom, linear; +size_t headroom =0 ; +size_t linear;struct sk_buff *skb;struct iucv_message txmsg = {0 };struct cmsghdr *cmsg;
@@ -1114,18 +1115,20 @@ static int iucv_sock_sendmsg(struct sock* this is fine for SOCK_SEQPACKET (unless we want to support * segmented records using the MSG_EOR flag), but * for SOCK_STREAM we might want to improve it in future */ - headroom = (iucv->transport ==AF_IUCV_TRANS_HIPER ) - ?sizeof (struct af_iucv_trans_hdr ) +ETH_HLEN :0 ; -if (headroom + len <PAGE_SIZE ) { +if (iucv->transport ==AF_IUCV_TRANS_HIPER ) { + headroom =sizeof (struct af_iucv_trans_hdr ) +ETH_HLEN ; linear = len; }else { -/* In nonlinear "classic" iucv skb, -* reserve space for iucv_array -*/ -if (iucv->transport !=AF_IUCV_TRANS_HIPER ) - headroom +=sizeof (struct iucv_array ) * - (MAX_SKB_FRAGS +1 ); - linear =PAGE_SIZE - headroom; +if (len <PAGE_SIZE ) { + linear = len; + }else { +/* In nonlinear "classic" iucv skb, +* reserve space for iucv_array +*/ + headroom =sizeof (struct iucv_array ) * + (MAX_SKB_FRAGS +1 ); + linear =PAGE_SIZE - headroom; + } } skb =sock_alloc_send_pskb (sk, headroom + linear, len - linear, noblock, &err,0 );
Greg Kroah-Hartman
maintainerPATCH 74/120 drm/i915/gen9: Fix PCODE polling timeout in stable backport
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imre Deak <[email protected]>
The backport of2c7d0602c - "Fix PCODE polling during CDCLK change notification" to the 4.9 stable tree used an incorrect timeout value. Fix this up so the backport matches the upstream commit.
--- drivers/gpu/drm/i915/intel_pm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +2 -2
@@ -8015,14 +8015,14 @@ int skl_pcode_request(struct drm_i915_pr* worst case) _and_ PCODE was busy for some reason even after a * (queued) request and @timeout_base_ms delay. As a workaround retry * the poll with preemption disabled to maximize the number of -* requests. Increase the timeout from @timeout_base_ms to 50ms to +* requests. Increase the timeout from @timeout_base_ms to 10ms to * account for interrupts that could reduce the number of these * requests. */ DRM_DEBUG_KMS ("PCODE timeout, retrying with preemption disabled\n" );WARN_ON_ONCE (timeout_base_ms >3 );preempt_disable (); - ret =wait_for_atomic (COND ,50 ); + ret =wait_for_atomic (COND ,10 );preempt_enable (); out:
Greg Kroah-Hartman
maintainerPATCH 75/120 drm: Clean up planes in atomic commit helper failure path
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laurent Pinchart <[email protected]>
commit aebe55c2d4b998741c0847ace1b4af47d73c763b upstream.
If waiting for fences fails for blocking commits, planes must be cleaned up before returning.
--- drivers/gpu/drm/drm_atomic_helper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic_helper.c +3 -1
@@ -1253,8 +1253,10 @@ int drm_atomic_helper_commit(struct drm_if (!nonblock) { ret =drm_atomic_helper_wait_for_fences (dev, state, true); -if (ret) +if (ret) { +drm_atomic_helper_cleanup_planes (dev, state);return ret; + } }/*
Greg Kroah-Hartman
maintainerPATCH 76/120 drm/radeon: update smc firmware selection for SI
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 6458bd4dfd9414cba5804eb9907fe2a824278c34 upstream.
Use the appropriate smc firmware for each chip revision. Using the wrong one can cause stability issues.
--- drivers/gpu/drm/radeon/si.c | 60 ++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 32 deletions(-)
drivers/gpu/drm/radeon/si.c +28 -32
@@ -50,7 +50,6 @@ MODULE_FIRMWARE("radeon/tahiti_ce.bin");MODULE_FIRMWARE ("radeon/tahiti_mc.bin" );MODULE_FIRMWARE ("radeon/tahiti_rlc.bin" );MODULE_FIRMWARE ("radeon/tahiti_smc.bin" ); -MODULE_FIRMWARE ("radeon/tahiti_k_smc.bin" );MODULE_FIRMWARE ("radeon/PITCAIRN_pfp.bin" );MODULE_FIRMWARE ("radeon/PITCAIRN_me.bin" );
@@ -1657,9 +1656,6 @@ static int si_init_microcode(struct radeswitch (rdev->family) {case CHIP_TAHITI : chip_name ="TAHITI" ; -/* XXX: figure out which Tahitis need the new ucode */ -if (0 ) - new_smc = true; new_chip_name ="tahiti" ; pfp_req_size =SI_PFP_UCODE_SIZE *4 ; me_req_size =SI_PM4_UCODE_SIZE *4 ;
@@ -1671,12 +1667,9 @@ static int si_init_microcode(struct radebreak ;case CHIP_PITCAIRN : chip_name ="PITCAIRN" ; -if ((rdev->pdev->revision ==0x81 ) || - (rdev->pdev->device ==0x6810 ) || - (rdev->pdev->device ==0x6811 ) || - (rdev->pdev->device ==0x6816 ) || - (rdev->pdev->device ==0x6817 ) || - (rdev->pdev->device ==0x6806 )) +if ((rdev->pdev->revision ==0x81 ) && + ((rdev->pdev->device ==0x6810 ) || + (rdev->pdev->device ==0x6811 ))) new_smc = true; new_chip_name ="pitcairn" ; pfp_req_size =SI_PFP_UCODE_SIZE *4 ;
@@ -1689,15 +1682,15 @@ static int si_init_microcode(struct radebreak ;case CHIP_VERDE : chip_name ="VERDE" ; -if ((rdev->pdev->revision ==0x81 ) || - (rdev->pdev->revision ==0x83 ) || - (rdev->pdev->revision ==0x87 ) || - (rdev->pdev->device ==0x6820 ) || - (rdev->pdev->device ==0x6821 ) || - (rdev->pdev->device ==0x6822 ) || - (rdev->pdev->device ==0x6823 ) || - (rdev->pdev->device ==0x682A ) || - (rdev->pdev->device ==0x682B )) +if (((rdev->pdev->device ==0x6820 ) && + ((rdev->pdev->revision ==0x81 ) || + (rdev->pdev->revision ==0x83 ))) || + ((rdev->pdev->device ==0x6821 ) && + ((rdev->pdev->revision ==0x83 ) || + (rdev->pdev->revision ==0x87 ))) || + ((rdev->pdev->revision ==0x87 ) && + ((rdev->pdev->device ==0x6823 ) || + (rdev->pdev->device ==0x682b )))) new_smc = true; new_chip_name ="verde" ; pfp_req_size =SI_PFP_UCODE_SIZE *4 ;
@@ -1710,13 +1703,13 @@ static int si_init_microcode(struct radebreak ;case CHIP_OLAND : chip_name ="OLAND" ; -if ((rdev->pdev->revision ==0xC7 ) || - (rdev->pdev->revision ==0x80 ) || - (rdev->pdev->revision ==0x81 ) || - (rdev->pdev->revision ==0x83 ) || - (rdev->pdev->revision ==0x87 ) || - (rdev->pdev->device ==0x6604 ) || - (rdev->pdev->device ==0x6605 )) +if (((rdev->pdev->revision ==0x81 ) && + ((rdev->pdev->device ==0x6600 ) || + (rdev->pdev->device ==0x6604 ) || + (rdev->pdev->device ==0x6605 ) || + (rdev->pdev->device ==0x6610 ))) || + ((rdev->pdev->revision ==0x83 ) && + (rdev->pdev->device ==0x6610 ))) new_smc = true; new_chip_name ="oland" ; pfp_req_size =SI_PFP_UCODE_SIZE *4 ;
@@ -1728,12 +1721,15 @@ static int si_init_microcode(struct radebreak ;case CHIP_HAINAN : chip_name ="HAINAN" ; -if ((rdev->pdev->revision ==0x81 ) || - (rdev->pdev->revision ==0x83 ) || - (rdev->pdev->revision ==0xC3 ) || - (rdev->pdev->device ==0x6664 ) || - (rdev->pdev->device ==0x6665 ) || - (rdev->pdev->device ==0x6667 )) +if (((rdev->pdev->revision ==0x81 ) && + (rdev->pdev->device ==0x6660 )) || + ((rdev->pdev->revision ==0x83 ) && + ((rdev->pdev->device ==0x6660 ) || + (rdev->pdev->device ==0x6663 ) || + (rdev->pdev->device ==0x6665 ) || + (rdev->pdev->device ==0x6667 ))) || + ((rdev->pdev->revision ==0xc3 ) && + (rdev->pdev->device ==0x6665 ))) new_smc = true; new_chip_name ="hainan" ; pfp_req_size =SI_PFP_UCODE_SIZE *4 ;
Greg Kroah-Hartman
maintainerPATCH 77/120 drm/radeon: drop verde dpm quirks
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 8a08403bcb39f5d0e733bcf59a8a74f16b538f6e upstream.
fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=98897
https://bugs.launchpad.net/bugs/1651981
--- drivers/gpu/drm/radeon/si_dpm.c | 13 ------------- 1 file changed, 13 deletions(-)
drivers/gpu/drm/radeon/si_dpm.c +0 -13
@@ -3008,19 +3008,6 @@ static void si_apply_state_adjust_rules( (rdev->pdev->device == 0x6817) || (rdev->pdev->device == 0x6806)) max_mclk =120000 ; - }else if (rdev->family ==CHIP_VERDE ) { -if ((rdev->pdev->revision ==0x81 ) || - (rdev->pdev->revision ==0x83 ) || - (rdev->pdev->revision ==0x87 ) || - (rdev->pdev->device ==0x6820 ) || - (rdev->pdev->device ==0x6821 ) || - (rdev->pdev->device ==0x6822 ) || - (rdev->pdev->device ==0x6823 ) || - (rdev->pdev->device ==0x682A ) || - (rdev->pdev->device ==0x682B )) { - max_sclk =75000 ; - max_mclk =80000 ; - } }else if (rdev->family ==CHIP_OLAND ) { if ((rdev->pdev->revision == 0xC7) || (rdev->pdev->revision == 0x80) ||
Greg Kroah-Hartman
maintainerPATCH 78/120 drm/amdgpu: update si kicker smc firmware
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Flora Cui <[email protected]>
commit 5165484b02f2cbedb5bf3a41ff5e8ae16069016c upstream.
Use the appropriate smc firmware for each chip revision. Using the wrong one can cause stability issues.
--- drivers/gpu/drm/amd/amdgpu/si_dpm.c | 57 +++++++++++++++++------------------- 1 file changed, 28 insertions(+), 29 deletions(-)
drivers/gpu/drm/amd/amdgpu/si_dpm.c +28 -29
@@ -56,7 +56,6 @@#define BIOS_SCRATCH_4 0x5cdMODULE_FIRMWARE ("radeon/tahiti_smc.bin" ); -MODULE_FIRMWARE ("radeon/tahiti_k_smc.bin" );MODULE_FIRMWARE ("radeon/pitcairn_smc.bin" );MODULE_FIRMWARE ("radeon/pitcairn_k_smc.bin" );MODULE_FIRMWARE ("radeon/verde_smc.bin" );
@@ -7685,49 +7684,49 @@ static int si_dpm_init_microcode(struct chip_name ="tahiti" ;break ;case CHIP_PITCAIRN : -if ((adev->pdev->revision ==0x81 ) || - (adev->pdev->device ==0x6810 ) || - (adev->pdev->device ==0x6811 ) || - (adev->pdev->device ==0x6816 ) || - (adev->pdev->device ==0x6817 ) || - (adev->pdev->device ==0x6806 )) +if ((adev->pdev->revision ==0x81 ) && + ((adev->pdev->device ==0x6810 ) || + (adev->pdev->device ==0x6811 ))) chip_name ="pitcairn_k" ;else chip_name ="pitcairn" ;break ;case CHIP_VERDE : -if ((adev->pdev->revision ==0x81 ) || - (adev->pdev->revision ==0x83 ) || - (adev->pdev->revision ==0x87 ) || - (adev->pdev->device ==0x6820 ) || - (adev->pdev->device ==0x6821 ) || - (adev->pdev->device ==0x6822 ) || - (adev->pdev->device ==0x6823 ) || - (adev->pdev->device ==0x682A ) || - (adev->pdev->device ==0x682B )) +if (((adev->pdev->device ==0x6820 ) && + ((adev->pdev->revision ==0x81 ) || + (adev->pdev->revision ==0x83 ))) || + ((adev->pdev->device ==0x6821 ) && + ((adev->pdev->revision ==0x83 ) || + (adev->pdev->revision ==0x87 ))) || + ((adev->pdev->revision ==0x87 ) && + ((adev->pdev->device ==0x6823 ) || + (adev->pdev->device ==0x682b )))) chip_name ="verde_k" ;else chip_name ="verde" ;break ;case CHIP_OLAND : -if ((adev->pdev->revision ==0xC7 ) || - (adev->pdev->revision ==0x80 ) || - (adev->pdev->revision ==0x81 ) || - (adev->pdev->revision ==0x83 ) || - (adev->pdev->revision ==0x87 ) || - (adev->pdev->device ==0x6604 ) || - (adev->pdev->device ==0x6605 )) +if (((adev->pdev->revision ==0x81 ) && + ((adev->pdev->device ==0x6600 ) || + (adev->pdev->device ==0x6604 ) || + (adev->pdev->device ==0x6605 ) || + (adev->pdev->device ==0x6610 ))) || + ((adev->pdev->revision ==0x83 ) && + (adev->pdev->device ==0x6610 ))) chip_name ="oland_k" ;else chip_name ="oland" ;break ;case CHIP_HAINAN : -if ((adev->pdev->revision ==0x81 ) || - (adev->pdev->revision ==0x83 ) || - (adev->pdev->revision ==0xC3 ) || - (adev->pdev->device ==0x6664 ) || - (adev->pdev->device ==0x6665 ) || - (adev->pdev->device ==0x6667 )) +if (((adev->pdev->revision ==0x81 ) && + (adev->pdev->device ==0x6660 )) || + ((adev->pdev->revision ==0x83 ) && + ((adev->pdev->device ==0x6660 ) || + (adev->pdev->device ==0x6663 ) || + (adev->pdev->device ==0x6665 ) || + (adev->pdev->device ==0x6667 ))) || + ((adev->pdev->revision ==0xc3 ) && + (adev->pdev->device ==0x6665 ))) chip_name ="hainan_k" ;else chip_name ="hainan" ;
Greg Kroah-Hartman
maintainerPATCH 79/120 drm/amdgpu: drop verde dpm quirks
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 7192c54a68013f6058b1bb505645fcd07015191c upstream.
Port of radeon change to amdgpu.
--- drivers/gpu/drm/amd/amdgpu/si_dpm.c | 13 ------------- 1 file changed, 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/si_dpm.c +0 -13
@@ -3485,19 +3485,6 @@ static void si_apply_state_adjust_rules( (adev->pdev->device == 0x6817) || (adev->pdev->device == 0x6806)) max_mclk =120000 ; - }else if (adev->asic_type ==CHIP_VERDE ) { -if ((adev->pdev->revision ==0x81 ) || - (adev->pdev->revision ==0x83 ) || - (adev->pdev->revision ==0x87 ) || - (adev->pdev->device ==0x6820 ) || - (adev->pdev->device ==0x6821 ) || - (adev->pdev->device ==0x6822 ) || - (adev->pdev->device ==0x6823 ) || - (adev->pdev->device ==0x682A ) || - (adev->pdev->device ==0x682B )) { - max_sclk =75000 ; - max_mclk =80000 ; - } }else if (adev->asic_type ==CHIP_OLAND ) { if ((adev->pdev->revision == 0xC7) || (adev->pdev->revision == 0x80) ||
Greg Kroah-Hartman
maintainerPATCH 80/120 USB: serial: ch341: fix modem-control and B0 handling
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 030ee7ae52a46a2be52ccc8242c4a330aba8d38e upstream.
The modem-control signals are managed by the tty-layer during open and should not be asserted prematurely when set_termios is called from driver open.
Also make sure that the signals are asserted only when changing speed from B0.
--- drivers/usb/serial/ch341.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/usb/serial/ch341.c +9 -9
@@ -362,24 +362,24 @@ static void ch341_set_termios(struct tty baud_rate =tty_get_baud_rate (tty);if (baud_rate) { -spin_lock_irqsave (&priv->lock, flags); - priv->line_control |= (CH341_BIT_DTR |CH341_BIT_RTS ); -spin_unlock_irqrestore (&priv->lock, flags); priv->baud_rate = baud_rate;ch341_set_baudrate (port->serial->dev, priv); - }else { -spin_lock_irqsave (&priv->lock, flags); - priv->line_control &= ~(CH341_BIT_DTR |CH341_BIT_RTS ); -spin_unlock_irqrestore (&priv->lock, flags); } -ch341_set_handshake (port->serial->dev, priv->line_control); -/* Unimplemented: * (cflag & CSIZE) : data bits [5, 8] * (cflag & PARENB) : parity {NONE, EVEN, ODD} * (cflag & CSTOPB) : stop bits [1, 2] */ + +spin_lock_irqsave (&priv->lock, flags); +if (C_BAUD (tty) ==B0 ) + priv->line_control &= ~(CH341_BIT_DTR |CH341_BIT_RTS ); +else if (old_termios && (old_termios->c_cflag &CBAUD ) ==B0 ) + priv->line_control |= (CH341_BIT_DTR |CH341_BIT_RTS ); +spin_unlock_irqrestore (&priv->lock, flags); + +ch341_set_handshake (port->serial->dev, priv->line_control); }static void ch341_break_ctl (struct tty_struct *tty,int break_state)
Greg Kroah-Hartman
maintainerPATCH 81/120 net/mlx5: Only cancel recovery work when cleaning up device
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Jurgens <[email protected]>
commit 5e44fca5047054f1762813751626b5245e0da022 upstream.
Do not attempt to drain the health workqueue when unloading the device in the recovery flow, this can cause a deadlock when the recovery work tries to cancel itself with sync.
Because the work is no longer unconditionally canceled when unloading, it must be explicitly canceled in the AER flow.
--- drivers/net/ethernet/mellanox/mlx5/core/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/main.c +4 -2
@@ -1158,7 +1158,8 @@ static int mlx5_unload_one(struct mlx5_c {int err =0 ; -mlx5_drain_health_wq (dev); +if (cleanup) +mlx5_drain_health_wq (dev);mutex_lock (&dev->intf_state_mutex);if (test_bit (MLX5_INTERFACE_STATE_DOWN , &dev->intf_state)) {
@@ -1320,9 +1321,10 @@ static pci_ers_result_t mlx5_pci_err_detmlx5_enter_error_state (dev);mlx5_unload_one (dev, priv, false); -/* In case of kernel call save the pci state */ +/* In case of kernel call save the pci state and drain the health wq */ if (state) {pci_save_state (pdev); +mlx5_drain_health_wq (dev);mlx5_pci_disable_device (dev); }
Greg Kroah-Hartman
maintainerPATCH 82/120 i2c: piix4: Avoid race conditions with IMC
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda Delgado <[email protected]>
commit 701dc207bf551d9fe6defa36e84a911e880398c3 upstream.
On AMD's SB800 and upwards, the SMBus is shared with the Integrated Micro Controller (IMC).
The platform provides a hardware semaphore to avoid race conditions among them. (Check page 288 of the SB800-Series Southbridges Register Reference Guide http://support.amd.com/TechDocs/45482.pdf)
Without this patch, many access to the SMBus end with an invalid transaction or even with the bus stalled.
--- drivers/i2c/busses/i2c-piix4.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/i2c/busses/i2c-piix4.c +22 -0
@@ -585,10 +585,29 @@ static s32 piix4_access_sb800(struct i2c u8 command, int size, union i2c_smbus_data *data) { struct i2c_piix4_adapdata *adapdata = i2c_get_adapdata(adap); +unsigned short piix4_smba = adapdata->smba; +int retries =MAX_TIMEOUT ; +int smbslvcnt;u8 smba_en_lo;u8 port;int retval; +/* Request the SMBUS semaphore, avoid conflicts with the IMC */ + smbslvcnt =inb_p (SMBSLVCNT ); +do { +outb_p (smbslvcnt |0x10 ,SMBSLVCNT ); + +/* Check the semaphore status */ + smbslvcnt =inb_p (SMBSLVCNT ); +if (smbslvcnt &0x10 ) +break ; + +usleep_range (1000 ,2000 ); + }while (--retries); +/* SMBus is still owned by the IMC, we give up */ +if (!retries) +return -EBUSY ; +mutex_lock (&piix4_mutex_sb800);outb_p (piix4_port_sel_sb800,SB800_PIIX4_SMB_IDX );
@@ -606,6 +625,9 @@ static s32 piix4_access_sb800(struct i2cmutex_unlock (&piix4_mutex_sb800); +/* Release the semaphore */ +outb_p (smbslvcnt |0x20 ,SMBSLVCNT ); +return retval; }
Greg Kroah-Hartman
maintainerPATCH 83/120 x86/cpu: Fix bootup crashes by sanitizing the argument of the clearcpuid= command-line option
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukasz Odzioba <[email protected]>
commit dd853fd216d1485ed3045ff772079cc8689a9a4a upstream.
A negative number can be specified in the cmdline which will be used as setup_clear_cpu_cap() argument. With that we can clear/set some bit in memory predceeding boot_cpu_data/cpu_caps_cleared which may cause kernel to misbehave. This patch adds lower bound check to setup_disablecpuid().
Boris Petkov reproduced a crash:
[ 1.234575] BUG: unable to handle kernel paging request at ffffffff858bd540 [ 1.236535] IP: memcpy_erms+0x6/0x10
--- arch/x86/kernel/cpu/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/common.c +1 -1
@@ -1275,7 +1275,7 @@ static __init int setup_disablecpuid(cha {int bit; -if (get_option (&arg, &bit) && bit <NCAPINTS *32 ) +if (get_option (&arg, &bit) && bit >=0 && bit <NCAPINTS *32 )setup_clear_cpu_cap (bit);else return 0 ;
Greg Kroah-Hartman
maintainerPATCH 84/120 nvme: apply DELAY_BEFORE_CHK_RDY quirk at probe time too
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guilherme G. Piccoli <[email protected]>
commit b5a10c5f7532b7473776da87e67f8301bbc32693 upstream.
Commit 54adc01055b7 ("nvme/quirk: Add a delay before checking for adapter readiness") introduced a quirk to adapters that cannot read the bit NVME_CSTS_RDY right after register NVME_REG_CC is set; these adapters need a delay or else the action of reading the bit NVME_CSTS_RDY could somehow corrupt adapter's registers state and it never recovers.
When this quirk was added, we checked ctrl->tagset in order to avoid quirking in probe time, supposing we would never require such delay during probe. Well, it was too optimistic; we in fact need this quirk at probe time in some cases, like after a kexec.
In some experiments, after abnormal shutdown of machine (aka power cord unplug), we booted into our bootloader in Power, which is a Linux kernel, and kexec'ed into another distro. If this kexec is too quick, we end up reaching the probe of NVMe adapter in that distro when adapter is in bad state (not fully initialized on our bootloader). What happens next is that nvme_wait_ready() is unable to complete, except if the quirk is enabled.
So, this patch removes the original ctrl->tagset verification in order to enable the quirk even on probe time.
--- drivers/nvme/host/core.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/nvme/host/core.c +1 -6
@@ -1122,12 +1122,7 @@ int nvme_disable_ctrl(struct nvme_ctrl *if (ret)return ret; -/* Checking for ctrl->tagset is a trick to avoid sleeping on module -* load, since we only need the quirk on reset_controller. Notice -* that the HGST device needs this delay only in firmware activation -* procedure; unfortunately we have no (easy) way to verify this. -*/ -if ((ctrl->quirks &NVME_QUIRK_DELAY_BEFORE_CHK_RDY ) && ctrl->tagset) +if (ctrl->quirks &NVME_QUIRK_DELAY_BEFORE_CHK_RDY )msleep (NVME_QUIRK_DELAY_AMOUNT );return nvme_wait_ready (ctrl, cap, false);
Greg Kroah-Hartman
maintainerPATCH 85/120 btrfs: fix locking when we put back a delayed ref thats too new
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Mahoney <[email protected]>
commit d0280996437081dd12ed1e982ac8aeaa62835ec4 upstream.
In __btrfs_run_delayed_refs, when we put back a delayed ref that's too new, we have already dropped the lock on locked_ref when we set ->processing = 0.
This patch keeps the lock to cover that assignment.
--- fs/btrfs/extent-tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/extent-tree.c +1 -1
@@ -2537,11 +2537,11 @@ static noinline int __btrfs_run_delayed_if (ref && ref->seq &&btrfs_check_delayed_seq (fs_info, delayed_refs, ref->seq)) {spin_unlock (&locked_ref->lock); -btrfs_delayed_ref_unlock (locked_ref);spin_lock (&delayed_refs->lock); locked_ref->processing =0 ; delayed_refs->num_heads_ready++;spin_unlock (&delayed_refs->lock); +btrfs_delayed_ref_unlock (locked_ref); locked_ref =NULL ;cond_resched (); count++;
Greg Kroah-Hartman
maintainerPATCH 86/120 btrfs: fix error handling when run_delayed_extent_op fails
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Mahoney <[email protected]>
commit aa7c8da35d1905d80e840d075f07d26ec90144b5 upstream.
In __btrfs_run_delayed_refs, the error path when run_delayed_extent_op fails sets locked_ref->processing = 0 but doesn't re-increment delayed_refs->num_heads_ready. As a result, we end up triggering the WARN_ON in btrfs_select_ref_head.
--- fs/btrfs/extent-tree.c | 3 +++ 1 file changed, 3 insertions(+)
fs/btrfs/extent-tree.c +3 -0
@@ -2587,7 +2587,10 @@ static noinline int __btrfs_run_delayed_*/ if (must_insert_reserved) locked_ref->must_insert_reserved =1 ; +spin_lock (&delayed_refs->lock); locked_ref->processing =0 ; + delayed_refs->num_heads_ready++; +spin_unlock (&delayed_refs->lock);btrfs_debug (fs_info,"run_delayed_extent_op returned %d" , ret);
Greg Kroah-Hartman
maintainerPATCH 87/120 pinctrl: meson: fix gpio request disabling other modes
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neil Armstrong <[email protected]>
commit f24d311f92b516a8aadef5056424ccabb4068e7b upstream.
The pinctrl_gpio_request is called with the "full" gpio number, already containing the base, then meson_pmx_request_gpio is then called with the final pin number.
Remove the base addition when calling meson_pmx_disable_other_groups.
--- drivers/pinctrl/meson/pinctrl-meson.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/meson/pinctrl-meson.c +1 -1
@@ -212,7 +212,7 @@ static int meson_pmx_request_gpio(struct {struct meson_pinctrl *pc =pinctrl_dev_get_drvdata (pcdev); -meson_pmx_disable_other_groups (pc, range->pin_base + offset,-1 ); +meson_pmx_disable_other_groups (pc, offset,-1 );return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 88/120 NFS: fix typo in parameter description
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Yongjun <[email protected]>
commit f36ab161bebe464d33b998294eff29b17a9c8918 upstream.
Fix typo in parameter description.
callback server")
--- fs/nfs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/super.c +1 -1
@@ -2904,7 +2904,7 @@ module_param(max_session_slots, ushort,MODULE_PARM_DESC (max_session_slots,"Maximum number of outstanding NFSv4.1 " "requests the client will negotiate" );module_param (max_session_cb_slots, ushort,0644 ); -MODULE_PARM_DESC (max_session_slots,"Maximum number of parallel NFSv4.1 " +MODULE_PARM_DESC (max_session_cb_slots,"Maximum number of parallel NFSv4.1 " "callbacks the client will process for a given server" );module_param (send_implementation_id, ushort,0644 ); MODULE_PARM_DESC(send_implementation_id,
Greg Kroah-Hartman
maintainerPATCH 89/120 pNFS: Fix race in pnfs_wait_on_layoutreturn
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit ee284e35d8c71bf5d4d807eaff6f67a17134b359 upstream.
We must put the task to sleep while holding the inode->i_lock in order to ensure atomicity with the test for NFS_LAYOUT_RETURN.
--- fs/nfs/pnfs.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
fs/nfs/pnfs.c +3 -5
@@ -1257,13 +1257,11 @@ bool pnfs_wait_on_layoutreturn(struct in* i_lock */ spin_lock (&ino->i_lock); lo = nfsi->layout; -if (lo &&test_bit (NFS_LAYOUT_RETURN , &lo->plh_flags)) +if (lo &&test_bit (NFS_LAYOUT_RETURN , &lo->plh_flags)) { +rpc_sleep_on (&NFS_SERVER (ino)->roc_rpcwaitq, task,NULL ); sleep = true; + }spin_unlock (&ino->i_lock); - -if (sleep) -rpc_sleep_on (&NFS_SERVER (ino)->roc_rpcwaitq, task,NULL ); -return sleep; }
Greg Kroah-Hartman
maintainerPATCH 90/120 NFS: Fix a performance regression in readdir
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 79f687a3de9e3ba2518b4ea33f38ca6cbe9133eb upstream.
Ben Coddington reports that commit 311324ad1713, by adding the function nfs_dir_mapping_need_revalidate() that checks page cache validity on each call to nfs_readdir() causes a performance regression when the directory is being modified.
If the directory is changing while we're iterating through the directory, POSIX does not require us to invalidate the page cache unless the user calls rewinddir(). However, we still do want to ensure that we use readdirplus in order to avoid a load of stat() calls when the user is doing an 'ls -l' workload.
The fix should be to invalidate the page cache immediately when we're setting the NFS_INO_ADVISE_RDPLUS bit.
--- fs/nfs/dir.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)
fs/nfs/dir.c +2 -13
@@ -477,7 +477,7 @@ void nfs_force_use_readdirplus(struct in {if (!list_empty (&NFS_I (dir)->open_files)) {nfs_advise_use_readdirplus (dir); -nfs_zap_mapping (dir, dir->i_mapping); +invalidate_mapping_pages (dir->i_mapping,0 ,-1 ); } }
@@ -886,17 +886,6 @@ int uncached_readdir(nfs_readdir_descrip goto out; } -static bool nfs_dir_mapping_need_revalidate (struct inode *dir) -{ -struct nfs_inode *nfsi =NFS_I (dir); - -if (nfs_attribute_cache_expired (dir)) -return true; -if (nfsi->cache_validity &NFS_INO_INVALID_DATA ) -return true; -return false; -} -/* The file offset position represents the dirent entry number. A last cookie cache takes care of the common case of reading the whole directory.
@@ -928,7 +917,7 @@ static int nfs_readdir(struct file *file desc->decode =NFS_PROTO (inode)->decode_dirent; desc->plus =nfs_use_readdirplus (inode, ctx) ?1 :0 ; -if (ctx->pos ==0 ||nfs_dir_mapping_need_revalidate (inode)) +if (ctx->pos ==0 ||nfs_attribute_cache_expired (inode)) res =nfs_revalidate_mapping (inode, file->f_mapping);if (res <0 ) goto out;
Greg Kroah-Hartman
maintainerPATCH 91/120 NFSv4.1: nfs4_fl_prepare_ds must be careful about reporting success.
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit cfd278c280f997cf2fe4662e0acab0fe465f637b upstream.
Various places assume that if nfs4_fl_prepare_ds() turns a non-NULL 'ds', then ds->ds_clp will also be non-NULL.
This is not necessasrily true in the case when the process received a fatal signal while nfs4_pnfs_ds_connect is waiting in nfs4_wait_ds_connect().
In that case ->ds_clp may not be set, and the devid may not recently have been marked unavailable.
So add a test for ds_clp == NULL and return NULL in that case.
--- fs/nfs/filelayout/filelayoutdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/nfs/filelayout/filelayoutdev.c +2 -1
@@ -283,7 +283,8 @@ nfs4_fl_prepare_ds(struct pnfs_layout_se s->nfs_client->cl_rpcclient->cl_auth->au_flavor); out_test_devid: -if (filelayout_test_devid_unavailable (devid)) +if (ret->ds_clp ==NULL || +filelayout_test_devid_unavailable (devid)) ret =NULL ; out:return ret;
Greg Kroah-Hartman
maintainerPATCH 92/120 i2c: mux: pca954x: fix i2c mux selection caching
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King <[email protected]>
commit 7f638c1cb0a1112dbe0b682a42db30521646686b upstream.
smbus functions return -ve on error, 0 on success. However, __i2c_transfer() have a different return signature - -ve on error, or number of buffers transferred (which may be zero or greater.)
The upshot of this is that the sense of the test is reversed when using the mux on a bus supporting the master_xfer method: we cache the value and never retry if we fail to transfer any buffers, but if we succeed, we clear the cached value.
Fix this by making pca954x_reg_write() return a negative error code for all failure cases.
--- drivers/i2c/muxes/i2c-mux-pca954x.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/i2c/muxes/i2c-mux-pca954x.c +4 -1
@@ -151,6 +151,9 @@ static int pca954x_reg_write(struct i2c_ buf[0 ] = val; msg.buf = buf; ret =__i2c_transfer (adap, &msg,1 ); + +if (ret >=0 && ret !=1 ) + ret = -EREMOTEIO ; }else {union i2c_smbus_data data; ret = adap->algo->smbus_xfer(adap, client->addr,
@@ -179,7 +182,7 @@ static int pca954x_select_chan(struct i2/* Only select the channel if its different from the last channel */ if (data->last_chan != regval) { ret =pca954x_reg_write (muxc->parent, client, regval); - data->last_chan = ret ?0 : regval; + data->last_chan = ret <0 ?0 : regval; }return ret;
Greg Kroah-Hartman
maintainerPATCH 94/120 drm: avoid uninitialized timestamp use in wait_vblank
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit cff52e5fc4cfc978b7df898dc14a0492c7ef0ae8 upstream.
gcc warns about the timestamp in drm_wait_vblank being possibly used without an initialization:
drivers/gpu/drm/drm_irq.c: In function 'drm_crtc_send_vblank_event':drivers/gpu/drm/drm_irq.c:992:24: error: 'now.tv_usec' may be used uninitialized in this function [-Werror=maybe-uninitialized] drivers/gpu/drm/drm_irq.c:1069:17: note: 'now.tv_usec' was declared heredrivers/gpu/drm/drm_irq.c:991:23: error: 'now.tv_sec' may be used uninitialized in this function [-Werror=maybe-uninitialized]
This can happen if drm_vblank_count_and_time() returns 0 in its error path. To sanitize the error case, I'm changing that function to return a zero timestamp when it fails.
--- drivers/gpu/drm/drm_irq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_irq.c +3 -1
@@ -952,8 +952,10 @@ static u32 drm_vblank_count_and_time(stru32 vblank_count;unsigned int seq; -if (WARN_ON (pipe >= dev->num_crtcs)) +if (WARN_ON (pipe >= dev->num_crtcs)) { + *vblanktime = (struct timeval ) {0 };return 0 ; + } do { seq = read_seqbegin(&vblank->seqlock);
Greg Kroah-Hartman
maintainerPATCH 95/120 drm/panel: simple: Check against num_timings when setting preferred for timing
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
commit 230c5b44233ff0543c0b5ccf4ff9400057010fbe upstream.
In the loop on .timings, we should check .num_timings to see if it's the only mode specified, not .num_modes, which should be used with .modes.
--- drivers/gpu/drm/panel/panel-simple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-simple.c +1 -1
@@ -120,7 +120,7 @@ static int panel_simple_get_fixed_modes( mode->type |=DRM_MODE_TYPE_DRIVER ; -if (panel->desc->num_modes ==1 ) +if (panel->desc->num_timings ==1 ) mode->type |=DRM_MODE_TYPE_PREFERRED ;drm_mode_probed_add (connector, mode);
Greg Kroah-Hartman
maintainerPATCH 97/120 drm: Initialise drm_mm.head_node.allocated
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit cc98e6ce6abe1c0103cbd7aff1ee586622a9361e upstream.
commit 202b52b7fbf7 ("drm: Track drm_mm nodes with an interval tree") introduced a requirement that the special drm_mm.head_node was initialised and marked as not being allocated. It is a very special node that has no side but has a hole that represents the drm_mm address space, and holds the list of nodes. Since it is not a real node, it is not part of the node rbtree and we detect this as it being unallocated. This presumed that drm_mm_init() was initialising it to zero. It happens that i915 kzallocs its objects and so it was accidentally setting it, but for generic use we cannot make that assumption.
[ 22.981519] general protection fault: 0000 [#1] SMP [ 22.981521] Modules linked in: test_drm_mm(+) ctr ccm arc4 rt2800usb rt2x00usb rt2800lib rt2x00lib crc_ccitt mac80211 cmac rfcomm bnep snd_hda_codec_realtek snd_hda_codec_hdmi snd_hda_codec_generic snd_hda_intel dcdbas snd_hda_codec x86_pkg_temp_thermal intel_powerclamp btusb snd_hda_core coretemp crct10dif_pclmul cfg80211 btrtl btbcm btintel bluetooth crc32_pclmul ghash_clmulni_intel aesni_intel snd_pcm i2c_hid aes_x86_64 lrw gf128mul glue_helper ablk_helper cryptd snd_timer hid_multitouch snd joydev serio_raw lpc_ich mfd_core i2c_designware_platform i2c_designware_core 8250_dw binfmt_misc soundcore acpi_pad nls_iso8859_1 usbhid hid psmouse ahci libahci [last unloaded: test_drm_mm] [ 22.981544] CPU: 1 PID: 2088 Comm: drm_mm Tainted: G W 4.9.0-rc7+ #234 [ 22.981545] Hardware name: Dell Inc. XPS 13 9343/0310JH, BIOS A07 11/11/2015 [ 22.981546] task: ffff88020c971cc0 task.stack: ffffc90001728000 [ 22.981547] RIP: 0010:[<ffffffff814050f0>] [<ffffffff814050f0>] drm_mm_interval_tree_add_node+0xa0/0xd0 [ 22.981551] RSP: 0018:ffffc9000172ba98 EFLAGS: 00010202 [ 22.981552] RAX: 0f0000c69cf63d80 RBX: ffff88020be00000 RCX: ffff88020be00000 [ 22.981553] RDX: 0000000000000fff RSI: ffffc9000172bc48 RDI: ffffffff810ac4df [ 22.981553] RBP: ffffc9000172bb08 R08: ffffc9000172bc70 R09: 0000000000000fff [ 22.981554] R10: ffffffff810ac4d7 R11: 4dc04d8b4cffffe5 R12: 0000000000001000 [ 22.981555] R13: ffffc9000172bbd0 R14: ffffc9000172bbe0 R15: 0000000002000000 [ 22.981556] FS: 00007f80c9fab740(0000) GS:ffff88021f480000(0000) knlGS:0000000000000000 [ 22.981557] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 22.981558] CR2: 00007f80c9fd5000 CR3: 000000020c191000 CR4: 00000000003406e0 [ 22.981559] Stack: [ 22.981560] ffffffff81405d09 ffff88020be00000 ffffc9000172bbe0 000000000172bb08 [ 22.981562] ffffffffffffffff 0000000000000000 0000000000000000 0000000000000000 [ 22.981563] 0000000002000000 0000000002000000 ffffffffa02f3000 ffff88020be00000 [ 22.981565] Call Trace: [ 22.981568] [<ffffffff81405d09>] ? drm_mm_insert_node_generic+0x229/0x310 [ 22.981570] [<ffffffffa02f3000>] ? 0xffffffffa02f3000 [ 22.981572] [<ffffffffa02903c1>] __subtest_insert_range.constprop.7+0xd1/0x5b0 [test_drm_mm] [ 22.981575] [<ffffffff81081222>] ? default_wake_function+0x12/0x20 [ 22.981576] [<ffffffff81096905>] ? __wake_up_common+0x55/0x90 [ 22.981578] [<ffffffff81085f42>] ? sched_clock_cpu+0x72/0xa0 [ 22.981581] [<ffffffff811308ad>] ? irq_work_queue+0xd/0x80 [ 22.981582] [<ffffffff810abcc4>] ? wake_up_klogd+0x34/0x40 [ 22.981584] [<ffffffff810ac19d>] ? console_unlock+0x4cd/0x530 [ 22.981585] [<ffffffff810ac4d7>] ? vprintk_emit+0x2d7/0x490 [ 22.981587] [<ffffffff810ac82f>] ? vprintk_default+0x1f/0x30 [ 22.981589] [<ffffffff81146e1c>] ? printk+0x4d/0x4f [ 22.981590] [<ffffffffa02f3000>] ? 0xffffffffa02f3000 [ 22.981592] [<ffffffffa02908b5>] subtest_insert_range+0x15/0x80 [test_drm_mm] [ 22.981594] [<ffffffffa02f3088>] test_drm_mm_init+0x88/0x1000 [test_drm_mm] [ 22.981597] [<ffffffff8100043d>] do_one_initcall+0x3d/0x150 [ 22.981600] [<ffffffff8119dfbf>] ? kfree+0x13f/0x180 [ 22.981602] [<ffffffff811471f2>] do_init_module+0x60/0x1f1 [ 22.981606] [<ffffffff810db878>] load_module+0x2228/0x2790 [ 22.981608] [<ffffffff810d8590>] ? __symbol_put+0x40/0x40 [ 22.981612] [<ffffffff811c52b1>] ? kernel_read+0x41/0x60 [ 22.981614] [<ffffffff810dbfb6>] SYSC_finit_module+0x96/0xd0 [ 22.981617] [<ffffffff810dc00e>] SyS_finit_module+0xe/0x10 [ 22.981620] [<ffffffff816e7aa4>] entry_SYSCALL_64_fastpath+0x17/0x98 [ 22.981622] Code: c7 41 30 00 00 00 00 48 89 e5 48 89 3a 48 c7 c2 20 4e 40 81 e8 b2 a1 f0 ff 5d c3 48 8d 56 78 45 31 d2 48 89 d6 eb 25 48 8b 51 58 <48> 39 50 38 73 04 48 89 50 38 4c 8b 58 28 4c 39 59 48 48 8d 50 [ 22.981651] RIP [<ffffffff814050f0>] drm_mm_interval_tree_add_node+0xa0/0xd0 [ 22.981655] RSP <ffffc9000172ba98>
Testcase: igt/drm_mm
--- drivers/gpu/drm/drm_mm.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/drm_mm.c +1 -0
@@ -839,6 +839,7 @@ void drm_mm_init(struct drm_mm * mm, u64/* Clever trick to avoid a special case in the free hole tracking. */ INIT_LIST_HEAD (&mm->head_node.node_list); + mm->head_node.allocated =0 ; mm->head_node.hole_follows =1 ; mm->head_node.scanned_block =0 ; mm->head_node.scanned_prev_free =0 ;
Greg Kroah-Hartman
maintainerPATCH 99/120 remoteproc: st: Fix error return code in st_rproc_probe()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Yongjun <[email protected]>
commit 1d701d3dd8caf6660ff33c3c23a115b4649c5cdb upstream.
Fix to return a negative error code from the st_rproc_state() error handling case instead of 0, as done elsewhere in this function.
--- drivers/remoteproc/st_remoteproc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/remoteproc/st_remoteproc.c +3 -1
@@ -245,8 +245,10 @@ static int st_rproc_probe(struct platfor goto free_rproc; enabled =st_rproc_state (pdev); -if (enabled <0 ) +if (enabled <0 ) { + ret = enabled; goto free_rproc; + }if (enabled) {atomic_inc (&rproc->power);
Greg Kroah-Hartman
maintainerPATCH 100/120 powerpc/64: Simplify adaptation to new ISA v3.00 HPTE format
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Mackerras <[email protected]>
commit 6b243fcfb5f1e16bcf732e6f86a63f8af5b59a9f upstream.
This changes the way that we support the new ISA v3.00 HPTE format. Instead of adapting everything that uses HPTE values to handle either the old format or the new format, depending on which CPU we are on, we now convert explicitly between old and new formats if necessary in the low-level routines that actually access HPTEs in memory. This limits the amount of code that needs to know about the new format and makes the conversions explicit. This is OK because the old format contains all the information that is in the new format.
This also fixes operation under a hypervisor, because the H_ENTER hypercall (and other hypercalls that deal with HPTEs) will continue to require the HPTE value to be supplied in the old format. At present the kernel will not boot in HPT mode on POWER9 under a hypervisor.
This fixes and partially reverts commit 50de596de8be ("powerpc/mm/hash: Add support for Power9 Hash", 2016-04-29).
--- arch/powerpc/include/asm/book3s/64/mmu-hash.h | 47 +++++++++++++++++++++----- arch/powerpc/mm/hash_native_64.c | 30 +++++++++++++--- arch/powerpc/platforms/ps3/htab.c | 2 - arch/powerpc/platforms/pseries/lpar.c | 2 - 4 files changed, 65 insertions(+), 16 deletions(-)
arch/powerpc/include/asm/book3s/64/mmu-hash.h +39 -8
@@ -70,7 +70,9 @@#define HPTE_V_SSIZE_SHIFT 62#define HPTE_V_AVPN_SHIFT 7 +#define HPTE_V_COMMON_BITS ASM_CONST(0x000fffffffffffff)#define HPTE_V_AVPN ASM_CONST(0x3fffffffffffff80) +#define HPTE_V_AVPN_3_0 ASM_CONST(0x000fffffffffff80)#define HPTE_V_AVPN_VAL (x) (((x) & HPTE_V_AVPN) >> HPTE_V_AVPN_SHIFT)#define HPTE_V_COMPARE (x,y) (!(((x) ^ (y)) & 0xffffffffffffff80UL))#define HPTE_V_BOLTED ASM_CONST(0x0000000000000010)
@@ -80,14 +82,16 @@#define HPTE_V_VALID ASM_CONST(0x0000000000000001)/* -* ISA 3.0 have a different HPTE format. +* ISA 3.0 has a different HPTE format. */ #define HPTE_R_3_0_SSIZE_SHIFT 58 +#define HPTE_R_3_0_SSIZE_MASK (3ull << HPTE_R_3_0_SSIZE_SHIFT)#define HPTE_R_PP0 ASM_CONST(0x8000000000000000)#define HPTE_R_TS ASM_CONST(0x4000000000000000)#define HPTE_R_KEY_HI ASM_CONST(0x3000000000000000)#define HPTE_R_RPN_SHIFT 12#define HPTE_R_RPN ASM_CONST(0x0ffffffffffff000) +#define HPTE_R_RPN_3_0 ASM_CONST(0x01fffffffffff000)#define HPTE_R_PP ASM_CONST(0x0000000000000003)#define HPTE_R_PPP ASM_CONST(0x8000000000000003)#define HPTE_R_N ASM_CONST(0x0000000000000004)
@@ -316,12 +320,43 @@ static inline unsigned long hpte_encode_*/ v = (vpn >> (23 -VPN_SHIFT )) & ~(mmu_psize_defs[psize].avpnm); v <<=HPTE_V_AVPN_SHIFT ; -if (!cpu_has_feature (CPU_FTR_ARCH_300 )) - v |= ((unsigned long ) ssize) <<HPTE_V_SSIZE_SHIFT ; + v |= ((unsigned long ) ssize) <<HPTE_V_SSIZE_SHIFT ;return v; }/* +* ISA v3.0 defines a new HPTE format, which differs from the old +* format in having smaller AVPN and ARPN fields, and the B field +* in the second dword instead of the first. +*/ +static inline unsigned long hpte_old_to_new_v (unsigned long v) +{ +/* trim AVPN, drop B */ +return v &HPTE_V_COMMON_BITS ; +} + +static inline unsigned long hpte_old_to_new_r (unsigned long v,unsigned long r) +{ +/* move B field from 1st to 2nd dword, trim ARPN */ +return (r & ~HPTE_R_3_0_SSIZE_MASK ) | + (((v) >>HPTE_V_SSIZE_SHIFT ) <<HPTE_R_3_0_SSIZE_SHIFT ); +} + +static inline unsigned long hpte_new_to_old_v (unsigned long v,unsigned long r) +{ +/* insert B field */ +return (v &HPTE_V_COMMON_BITS ) | + ((r &HPTE_R_3_0_SSIZE_MASK ) << + (HPTE_V_SSIZE_SHIFT -HPTE_R_3_0_SSIZE_SHIFT )); +} + +static inline unsigned long hpte_new_to_old_r (unsigned long r) +{ +/* clear out B field */ +return r & ~HPTE_R_3_0_SSIZE_MASK ; +} + +/* * This function sets the AVPN and L fields of the HPTE appropriately * using the base page size and actual page size. */
@@ -341,12 +376,8 @@ static inline unsigned long hpte_encode_* aligned for the requested page size */ static inline unsigned long hpte_encode_r (unsigned long pa,int base_psize, -int actual_psize,int ssize) +int actual_psize) { - -if (cpu_has_feature (CPU_FTR_ARCH_300 )) - pa |= ((unsigned long ) ssize) <<HPTE_R_3_0_SSIZE_SHIFT ; -/* A 4K page needs no special encoding */ if (actual_psize ==MMU_PAGE_4K )return pa &HPTE_R_RPN ;
arch/powerpc/mm/hash_native_64.c +24 -6
@@ -221,13 +221,18 @@ static long native_hpte_insert(unsignedreturn -1 ; hpte_v =hpte_encode_v (vpn, psize, apsize, ssize) | vflags |HPTE_V_VALID ; - hpte_r =hpte_encode_r (pa, psize, apsize, ssize) | rflags; + hpte_r =hpte_encode_r (pa, psize, apsize) | rflags;if (!(vflags &HPTE_V_BOLTED )) {DBG_LOW (" i=%x hpte_v=%016lx, hpte_r=%016lx\n" , i, hpte_v, hpte_r); } +if (cpu_has_feature (CPU_FTR_ARCH_300 )) { + hpte_r =hpte_old_to_new_r (hpte_v, hpte_r); + hpte_v =hpte_old_to_new_v (hpte_v); + } + hptep->r =cpu_to_be64 (hpte_r);/* Guarantee the second dword is visible before the valid bit */ eieio ();
@@ -295,6 +300,8 @@ static long native_hpte_updatepp(unsigne vpn, want_v & HPTE_V_AVPN, slot, newpp); hpte_v =be64_to_cpu (hptep->v); +if (cpu_has_feature (CPU_FTR_ARCH_300 )) + hpte_v =hpte_new_to_old_v (hpte_v,be64_to_cpu (hptep->r));/* * We need to invalidate the TLB always because hpte_remove doesn't do * a tlb invalidate. If a hash bucket gets full, we "evict" a more/less
@@ -309,6 +316,8 @@ static long native_hpte_updatepp(unsignenative_lock_hpte (hptep);/* recheck with locks held */ hpte_v =be64_to_cpu (hptep->v); +if (cpu_has_feature (CPU_FTR_ARCH_300 )) + hpte_v =hpte_new_to_old_v (hpte_v,be64_to_cpu (hptep->r));if (unlikely (!HPTE_V_COMPARE (hpte_v, want_v) || !(hpte_v &HPTE_V_VALID ))) { ret =-1 ;
@@ -350,6 +359,8 @@ static long native_hpte_find(unsigned lofor (i =0 ; i <HPTES_PER_GROUP ; i++) { hptep = htab_address + slot; hpte_v =be64_to_cpu (hptep->v); +if (cpu_has_feature (CPU_FTR_ARCH_300 )) + hpte_v =hpte_new_to_old_v (hpte_v,be64_to_cpu (hptep->r));if (HPTE_V_COMPARE (hpte_v, want_v) && (hpte_v &HPTE_V_VALID ))/* HPTE matches */
@@ -409,6 +420,8 @@ static void native_hpte_invalidate(unsig want_v =hpte_encode_avpn (vpn, bpsize, ssize);native_lock_hpte (hptep); hpte_v =be64_to_cpu (hptep->v); +if (cpu_has_feature (CPU_FTR_ARCH_300 )) + hpte_v =hpte_new_to_old_v (hpte_v,be64_to_cpu (hptep->r));/* * We need to invalidate the TLB always because hpte_remove doesn't do
@@ -467,6 +480,8 @@ static void native_hugepage_invalidate(u want_v =hpte_encode_avpn (vpn, psize, ssize);native_lock_hpte (hptep); hpte_v =be64_to_cpu (hptep->v); +if (cpu_has_feature (CPU_FTR_ARCH_300 )) + hpte_v =hpte_new_to_old_v (hpte_v,be64_to_cpu (hptep->r));/* Even if we miss, we need to invalidate the TLB */ if (!HPTE_V_COMPARE (hpte_v, want_v) || !(hpte_v &HPTE_V_VALID ))
@@ -504,6 +519,10 @@ static void hpte_decode(struct hash_pte/* Look at the 8 bit LP value */ unsigned int lp = (hpte_r >>LP_SHIFT ) & ((1 <<LP_BITS ) -1 ); +if (cpu_has_feature (CPU_FTR_ARCH_300 )) { + hpte_v =hpte_new_to_old_v (hpte_v, hpte_r); + hpte_r =hpte_new_to_old_r (hpte_r); + }if (!(hpte_v &HPTE_V_LARGE )) { size =MMU_PAGE_4K ; a_size =MMU_PAGE_4K ;
@@ -512,11 +531,7 @@ static void hpte_decode(struct hash_pte a_size = hpte_page_sizes[lp] >>4 ; }/* This works for all page sizes, and for 256M and 1T segments */ -if (cpu_has_feature (CPU_FTR_ARCH_300 )) - *ssize = hpte_r >>HPTE_R_3_0_SSIZE_SHIFT ; -else - *ssize = hpte_v >>HPTE_V_SSIZE_SHIFT ; - + *ssize = hpte_v >>HPTE_V_SSIZE_SHIFT ; shift = mmu_psize_defs[size].shift; avpn = (HPTE_V_AVPN_VAL (hpte_v) & ~mmu_psize_defs[size].avpnm);
@@ -639,6 +654,9 @@ static void native_flush_hash_range(unsi want_v =hpte_encode_avpn (vpn, psize, ssize);native_lock_hpte (hptep); hpte_v =be64_to_cpu (hptep->v); +if (cpu_has_feature (CPU_FTR_ARCH_300 )) + hpte_v =hpte_new_to_old_v (hpte_v, +be64_to_cpu (hptep->r));if (!HPTE_V_COMPARE (hpte_v, want_v) || !(hpte_v &HPTE_V_VALID ))native_unlock_hpte (hptep);
arch/powerpc/platforms/ps3/htab.c +1 -1
@@ -63,7 +63,7 @@ static long ps3_hpte_insert(unsigned lon vflags &= ~HPTE_V_SECONDARY ; hpte_v =hpte_encode_v (vpn, psize, apsize, ssize) | vflags |HPTE_V_VALID ; - hpte_r =hpte_encode_r (ps3_mm_phys_to_lpar (pa), psize, apsize, ssize) | rflags; + hpte_r =hpte_encode_r (ps3_mm_phys_to_lpar (pa), psize, apsize) | rflags;spin_lock_irqsave (&ps3_htab_lock, flags);
arch/powerpc/platforms/pseries/lpar.c +1 -1
@@ -145,7 +145,7 @@ static long pSeries_lpar_hpte_insert(uns hpte_group, vpn, pa, rflags, vflags, psize); hpte_v =hpte_encode_v (vpn, psize, apsize, ssize) | vflags |HPTE_V_VALID ; - hpte_r =hpte_encode_r (pa, psize, apsize, ssize) | rflags; + hpte_r =hpte_encode_r (pa, psize, apsize) | rflags;if (!(vflags &HPTE_V_BOLTED ))pr_devel (" hpte_v=%016lx, hpte_r=%016lx\n" , hpte_v, hpte_r);
Greg Kroah-Hartman
maintainerPATCH 101/120 cpufreq: powernv: Disable preemption while checking CPU throttling state
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Denis Kirjanov <[email protected]>
commit 8a10c06a20ec8097a68fd7a4a1c0e285095b4d2f upstream.
With preemption turned on we can read incorrect throttling state while being switched to CPU on a different chip.
BUG: using smp_processor_id() in preemptible [00000000] code: cat/7343 caller is .powernv_cpufreq_throttle_check+0x2c/0x710 CPU: 13 PID: 7343 Comm: cat Not tainted 4.8.0-rc5-dirty #1 Call Trace: [c0000007d25b75b0] [c000000000971378] .dump_stack+0xe4/0x150 (unreliable) [c0000007d25b7640] [c0000000005162e4] .check_preemption_disabled+0x134/0x150 [c0000007d25b76e0] [c0000000007b63ac] .powernv_cpufreq_throttle_check+0x2c/0x710 [c0000007d25b7790] [c0000000007b6d18] .powernv_cpufreq_target_index+0x288/0x360 [c0000007d25b7870] [c0000000007acee4] .__cpufreq_driver_target+0x394/0x8c0 [c0000007d25b7920] [c0000000007b22ac] .cpufreq_set+0x7c/0xd0 [c0000007d25b79b0] [c0000000007adf50] .store_scaling_setspeed+0x80/0xc0 [c0000007d25b7a40] [c0000000007ae270] .store+0xa0/0x100 [c0000007d25b7ae0] [c0000000003566e8] .sysfs_kf_write+0x88/0xb0 [c0000007d25b7b70] [c0000000003553b8] .kernfs_fop_write+0x178/0x260 [c0000007d25b7c10] [c0000000002ac3cc] .__vfs_write+0x3c/0x1c0 [c0000007d25b7cf0] [c0000000002ad584] .vfs_write+0xc4/0x230 [c0000007d25b7d90] [c0000000002aeef8] .SyS_write+0x58/0x100 [c0000007d25b7e30] [c00000000000bfec] system_call+0x38/0xfc
--- drivers/cpufreq/powernv-cpufreq.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/cpufreq/powernv-cpufreq.c +7 -1
@@ -647,8 +647,14 @@ static int powernv_cpufreq_target_index(if (unlikely (rebooting) && new_index !=get_nominal_index ())return 0 ; -if (!throttled) +if (!throttled) { +/* we don't want to be preempted while +* checking if the CPU frequency has been throttled +*/ +preempt_disable ();powernv_cpufreq_throttle_check (NULL ); +preempt_enable (); + } cur_msec =jiffies_to_msecs (get_jiffies_64 ());
Greg Kroah-Hartman
maintainerPATCH 102/120 regulators: helpers: Fix handling of bypass_val_on in get_bypass_regmap
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <[email protected]>
commit 85b037442e3f0e84296ab1010fd6b057eee18496 upstream.
The handling of bypass_val_on that was added in regulator_get_bypass_regmap is done unconditionally however several drivers don't define a value for bypass_val_on. This results in those drivers reporting bypass being enabled when it is not. In regulator_set_bypass_regmap we use bypass_mask if bypass_val_on is zero. This patch adds similar handling in regulator_get_bypass_regmap.
--- drivers/regulator/helpers.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/regulator/helpers.c +5 -1
@@ -454,13 +454,17 @@ EXPORT_SYMBOL_GPL(regulator_set_bypass_rint regulator_get_bypass_regmap (struct regulator_dev *rdev,bool *enable) {unsigned int val; +unsigned int val_on = rdev->desc->bypass_val_on;int ret; ret =regmap_read (rdev->regmap, rdev->desc->bypass_reg, &val);if (ret !=0 )return ret; - *enable = (val & rdev->desc->bypass_mask) == rdev->desc->bypass_val_on; +if (!val_on) + val_on = rdev->desc->bypass_mask; + + *enable = (val & rdev->desc->bypass_mask) == val_on;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 103/120 ACPI / CPPC: set an error code on probe error path
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 501634759d55a5b56967de6d9465acf02bbc3565 upstream.
We should return -EINVAL (instead of 0) if get_cpu_device() fails.
--- drivers/acpi/cppc_acpi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/acpi/cppc_acpi.c +3 -1
@@ -784,8 +784,10 @@ int acpi_cppc_processor_probe(struct acp/* Add per logical CPU nodes for reading its feedback counters. */ cpu_dev =get_cpu_device (pr->id); -if (!cpu_dev) +if (!cpu_dev) { + ret = -EINVAL ; goto out_free; + } ret =kobject_init_and_add (&cpc_ptr->kobj, &cppc_ktype, &cpu_dev->kobj,"acpi_cppc" );
Greg Kroah-Hartman
maintainerPATCH 104/120 block: Change extern inline to static inline
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tobias Klauser <[email protected]>
commit 9a05e7541c39680d28ecf91892338e074738d5fd upstream.
With compilers which follow the C99 standard (like modern versions of gcc and clang), "extern inline" does the opposite thing from older versions of gcc (emits code for an externally linkable version of the inline function).
"static inline" does the intended behavior in all cases instead.
Description taken from commit 6d91857d4826 ("staging, rtl8192e,
LLVMLinux: Change extern inline to static inline").
This also fixes the following GCC warning when building with CONFIG_PM disabled:
./include/linux/blkdev.h:1143:20: warning: no previous prototype for 'blk_set_runtime_active' [-Wmissing-prototypes]
--- include/linux/blkdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/blkdev.h +1 -1
@@ -1057,7 +1057,7 @@ static inline int blk_pre_runtime_suspenstatic inline void blk_post_runtime_suspend (struct request_queue *q,int err) {}static inline void blk_pre_runtime_resume (struct request_queue *q) {}static inline void blk_post_runtime_resume (struct request_queue *q,int err) {} -extern inline void blk_set_runtime_active (struct request_queue *q) {} +static inline void blk_set_runtime_active (struct request_queue *q) {}#endif /*
Greg Kroah-Hartman
maintainerPATCH 105/120 block: cfq_cpd_alloc() should use @gfp
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit ebc4ff661fbe76781c6b16dfb7b754a5d5073f8e upstream.
cfq_cpd_alloc() which is the cpd_alloc_fn implementation for cfq was incorrectly hard coding GFP_KERNEL instead of using the mask specified through the @gfp parameter. This currently doesn't cause any actual issues because all current callers specify GFP_KERNEL. Fix it.
--- block/cfq-iosched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/cfq-iosched.c +1 -1
@@ -1596,7 +1596,7 @@ static struct blkcg_policy_data *cfq_cpd {struct cfq_group_data *cgd; - cgd =kzalloc (sizeof (*cgd),GFP_KERNEL ); + cgd =kzalloc (sizeof (*cgd), gfp);if (!cgd)return NULL ;return &cgd->cpd;
Greg Kroah-Hartman
maintainerPATCH 106/120 ACPI / APEI: Fix NMI notification handling
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prarit Bhargava <[email protected]>
commit a545715d2dae8d071c5b06af947b07ffa846b288 upstream.
When removing and adding cpu 0 on a system with GHES NMI the following stack trace is seen when re-adding the cpu:
WARNING: CPU: 0 PID: 0 at arch/x86/kernel/apic/apic.c:1349 setup_local_APIC+ Modules linked in: nfsv3 rpcsec_gss_krb5 nfsv4 nfs fscache coretemp intel_ra CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.9.0-rc6+ #2 Call Trace: dump_stack+0x63/0x8e __warn+0xd1/0xf0 warn_slowpath_null+0x1d/0x20 setup_local_APIC+0x275/0x370 apic_ap_setup+0xe/0x20 start_secondary+0x48/0x180 set_init_arg+0x55/0x55 early_idt_handler_array+0x120/0x120 x86_64_start_reservations+0x2a/0x2c x86_64_start_kernel+0x13d/0x14c
During the cpu bringup, wakeup_cpu_via_init_nmi() is called and issues an NMI on CPU 0. The GHES NMI handler, ghes_notify_nmi() runs the ghes_proc_irq_work work queue which ends up setting IRQ_WORK_VECTOR (0xf6). The "faulty" IR line set at arch/x86/kernel/apic/apic.c:1349 is also 0xf6 (specifically APIC IRR for irqs 255 to 224 is 0x400000) which confirms that something has set the IRQ_WORK_VECTOR line prior to the APIC being initialized.
Commit 2383844d4850 ("GHES: Elliminate double-loop in the NMI handler") incorrectly modified the behavior such that the handler returns NMI_HANDLED only if an error was processed, and incorrectly runs the ghes work queue for every NMI.
This patch modifies the ghes_proc_irq_work() to run as it did prior to 2383844d4850 ("GHES: Elliminate double-loop in the NMI handler") by properly returning NMI_HANDLED and only calling the work queue if NMI_HANDLED has been set.
--- drivers/acpi/apei/ghes.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/acpi/apei/ghes.c +4 -3
@@ -852,6 +852,8 @@ static int ghes_notify_nmi(unsigned intif (ghes_read_estatus (ghes,1 )) {ghes_clear_estatus (ghes);continue ; + }else { + ret =NMI_HANDLED ; } sev =ghes_severity (ghes->estatus->error_severity);
@@ -863,12 +865,11 @@ static int ghes_notify_nmi(unsigned int__process_error (ghes);ghes_clear_estatus (ghes); - - ret =NMI_HANDLED ; }#ifdef CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG -irq_work_queue (&ghes_proc_irq_work); +if (ret ==NMI_HANDLED ) +irq_work_queue (&ghes_proc_irq_work);#endif atomic_dec (&ghes_in_nmi);return ret;
Greg Kroah-Hartman
maintainerPATCH 107/120 powercap/intel_rapl: fix and tidy up error handling
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Pan <[email protected]>
commit cb43f81b8489dcb87555e16c17453f0a9fa690f2 upstream.
Commit e1399ba20eee ("powercap / RAPL: handle missing MSRs") added contraint_to_pl() function to return index into an array. But it can potentially return -EINVAL if powercap layer sends an out of range constraint ID. This patch adds sanity check.
Unnecessary RAPL domain pointer check is removed since it must be initialized before calling rapl_unit_xlate().
--- drivers/powercap/intel_rapl.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)
drivers/powercap/intel_rapl.c +24 -1
@@ -442,6 +442,7 @@ static int contraint_to_pl(struct rapl_dreturn i; } } +pr_err ("Cannot find matching power limit for constraint %d\n" , cid);return -EINVAL ; }
@@ -457,6 +458,10 @@ static int set_power_limit(struct powercget_online_cpus (); rd =power_zone_to_rapl_domain (power_zone); id =contraint_to_pl (rd, cid); +if (id <0 ) { + ret = id; + goto set_exit; + } rp = rd->rp;
@@ -496,6 +501,11 @@ static int get_current_power_limit(strucget_online_cpus (); rd =power_zone_to_rapl_domain (power_zone); id =contraint_to_pl (rd, cid); +if (id <0 ) { + ret = id; + goto get_exit; + } +switch (rd->rpl[id].prim_id) {case PL1_ENABLE : prim =POWER_LIMIT1 ;
@@ -512,6 +522,7 @@ static int get_current_power_limit(strucelse *data = val; +get_exit:put_online_cpus ();return ret;
@@ -527,6 +538,10 @@ static int set_time_window(struct powercget_online_cpus (); rd =power_zone_to_rapl_domain (power_zone); id =contraint_to_pl (rd, cid); +if (id <0 ) { + ret = id; + goto set_time_exit; + }switch (rd->rpl[id].prim_id) {case PL1_ENABLE :
@@ -538,6 +553,8 @@ static int set_time_window(struct powercdefault : ret = -EINVAL ; } + +set_time_exit:put_online_cpus ();return ret; }
@@ -552,6 +569,10 @@ static int get_time_window(struct powercget_online_cpus (); rd =power_zone_to_rapl_domain (power_zone); id =contraint_to_pl (rd, cid); +if (id <0 ) { + ret = id; + goto get_time_exit; + }switch (rd->rpl[id].prim_id) {case PL1_ENABLE :
@@ -566,6 +587,8 @@ static int get_time_window(struct powerc }if (!ret) *data = val; + +get_time_exit:put_online_cpus ();return ret;
@@ -707,7 +730,7 @@ static u64 rapl_unit_xlate(struct rapl_dcase ENERGY_UNIT : scale =ENERGY_UNIT_SCALE ;/* per domain unit takes precedence */ -if (rd && rd->domain_energy_unit) +if (rd->domain_energy_unit) units = rd->domain_energy_unit;else units = rp->energy_unit;
Greg Kroah-Hartman
maintainerPATCH 108/120 iw_cxgb4: Fix error return code in c4iw_rdev_open()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Yongjun <[email protected]>
commit 15f7e3c21b76598bc6e5816d2577ce843b2b963f upstream.
Fix to return error code -ENOMEM from the __get_free_page() error handling case instead of 0, as done elsewhere in this function.
--- drivers/infiniband/hw/cxgb4/device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/cxgb4/device.c +3 -1
@@ -828,8 +828,10 @@ static int c4iw_rdev_open(struct c4iw_rd } rdev->status_page = (struct t4_dev_status_page *)__get_free_page (GFP_KERNEL ); -if (!rdev->status_page) +if (!rdev->status_page) { + err = -ENOMEM ; goto destroy_ocqp_pool; + } rdev->status_page->qp_start = rdev->lldi.vr->qp.start; rdev->status_page->qp_size = rdev->lldi.vr->qp.size; rdev->status_page->cq_start = rdev->lldi.vr->cq.start;
Greg Kroah-Hartman
maintainerPATCH 109/120 bq24190_charger: Fix PM runtime use for bq24190_battery_set_property
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Lindgren <[email protected]>
commit 075eb5719d53e8bb4a406ad87e1de99319aa50f0 upstream.
There's a typo, it should do pm_runtime_get_sync, not put.
--- drivers/power/supply/bq24190_charger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/bq24190_charger.c +1 -1
@@ -1141,7 +1141,7 @@ static int bq24190_battery_set_property(dev_dbg (bdi->dev,"prop: %d\n" , psp); -pm_runtime_put_sync (bdi->dev); +pm_runtime_get_sync (bdi->dev);switch (psp) {case POWER_SUPPLY_PROP_ONLINE :
Greg Kroah-Hartman
maintainerPATCH 110/120 power: supply: bq27xxx_battery: Fix register map for BQ27510 and BQ27520
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew F. Davis <[email protected]>
commit 3bee9ea1de687925d116670f036599cbed8b66b0 upstream.
The BQ27510 and BQ27520 use a slightly different register map than the BQ27500, add a new type enum and add these gauges to it.
--- drivers/power/supply/bq27xxx_battery.c | 41 ++++++++++++++++++++++++++++- drivers/power/supply/bq27xxx_battery_i2c.c | 4 +- include/linux/power/bq27xxx_battery.h | 3 +- 3 files changed, 44 insertions(+), 4 deletions(-)
drivers/power/supply/bq27xxx_battery.c +40 -1
@@ -164,6 +164,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX [BQ27XXX_REG_DCAP] = 0x3c, [BQ27XXX_REG_AP ] =INVALID_REG_ADDR , }, + [BQ27510] = { + [BQ27XXX_REG_CTRL ] =0x00 , + [BQ27XXX_REG_TEMP ] =0x06 , + [BQ27XXX_REG_INT_TEMP ] =0x28 , + [BQ27XXX_REG_VOLT ] =0x08 , + [BQ27XXX_REG_AI ] =0x14 , + [BQ27XXX_REG_FLAGS ] =0x0a , + [BQ27XXX_REG_TTE ] =0x16 , + [BQ27XXX_REG_TTF ] =INVALID_REG_ADDR , + [BQ27XXX_REG_TTES ] =0x1a , + [BQ27XXX_REG_TTECP ] =INVALID_REG_ADDR , + [BQ27XXX_REG_NAC ] =0x0c , + [BQ27XXX_REG_FCC ] =0x12 , + [BQ27XXX_REG_CYCT ] =0x1e , + [BQ27XXX_REG_AE ] =INVALID_REG_ADDR , + [BQ27XXX_REG_SOC ] =0x20 , + [BQ27XXX_REG_DCAP ] =0x2e , + [BQ27XXX_REG_AP ] =INVALID_REG_ADDR , + }, [BQ27530 ] = { [BQ27XXX_REG_CTRL ] =0x00 , [BQ27XXX_REG_TEMP ] =0x06 ,
@@ -302,6 +321,24 @@ static enum power_supply_property bq2750 POWER_SUPPLY_PROP_MANUFACTURER, }; +static enum power_supply_property bq27510_battery_props[] = { +POWER_SUPPLY_PROP_STATUS , +POWER_SUPPLY_PROP_PRESENT , +POWER_SUPPLY_PROP_VOLTAGE_NOW , +POWER_SUPPLY_PROP_CURRENT_NOW , +POWER_SUPPLY_PROP_CAPACITY , +POWER_SUPPLY_PROP_CAPACITY_LEVEL , +POWER_SUPPLY_PROP_TEMP , +POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW , +POWER_SUPPLY_PROP_TECHNOLOGY , +POWER_SUPPLY_PROP_CHARGE_FULL , +POWER_SUPPLY_PROP_CHARGE_NOW , +POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN , +POWER_SUPPLY_PROP_CYCLE_COUNT , +POWER_SUPPLY_PROP_HEALTH , +POWER_SUPPLY_PROP_MANUFACTURER , +}; +static enum power_supply_property bq27530_battery_props[] = {POWER_SUPPLY_PROP_STATUS ,POWER_SUPPLY_PROP_PRESENT ,
@@ -385,6 +422,7 @@ static struct {BQ27XXX_PROP (BQ27000 , bq27000_battery_props),BQ27XXX_PROP (BQ27010 , bq27010_battery_props),BQ27XXX_PROP (BQ27500 , bq27500_battery_props), +BQ27XXX_PROP (BQ27510 , bq27510_battery_props),BQ27XXX_PROP (BQ27530 , bq27530_battery_props),BQ27XXX_PROP (BQ27541 , bq27541_battery_props), BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -635,7 +673,8 @@ static int bq27xxx_battery_read_pwr_avg(*/ static bool bq27xxx_battery_overtemp (struct bq27xxx_device_info *di,u16 flags) { -if (di->chip ==BQ27500 || di->chip ==BQ27541 || di->chip ==BQ27545 ) +if (di->chip ==BQ27500 || di->chip ==BQ27510 || + di->chip ==BQ27541 || di->chip ==BQ27545 )return flags & (BQ27XXX_FLAG_OTC |BQ27XXX_FLAG_OTD );if (di->chip ==BQ27530 || di->chip ==BQ27421 )return flags &BQ27XXX_FLAG_OT ;
drivers/power/supply/bq27xxx_battery_i2c.c +2 -2
@@ -149,8 +149,8 @@ static const struct i2c_device_id bq27xx { "bq27200", BQ27000 }, { "bq27210", BQ27010 }, { "bq27500", BQ27500 }, - { "bq27510", BQ27500 }, - { "bq27520", BQ27500 }, + { "bq27510", BQ27510 }, + { "bq27520", BQ27510 }, { "bq27530", BQ27530 }, { "bq27531", BQ27530 }, { "bq27541", BQ27541 },
include/linux/power/bq27xxx_battery.h +2 -1
@@ -4,7 +4,8 @@enum bq27xxx_chip {BQ27000 =1 ,/* bq27000, bq27200 */ BQ27010 ,/* bq27010, bq27210 */ -BQ27500 ,/* bq27500, bq27510, bq27520 */ +BQ27500 ,/* bq27500 */ +BQ27510 ,/* bq27510, bq27520 */ BQ27530 ,/* bq27530, bq27531 */ BQ27541 ,/* bq27541, bq27542, bq27546, bq27742 */ BQ27545 ,/* bq27545 */
Greg Kroah-Hartman
maintainerPATCH 111/120 blk-mq: Always schedule hctx->next_cpu
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabriel Krisman Bertazi <[email protected]>
commit c02ebfdddbafa9a6a0f52fbd715e6bfa229af9d3 upstream.
Commit 0e87e58bf60e ("blk-mq: improve warning for running a queue on the wrong CPU") attempts to avoid triggering the WARN_ON in __blk_mq_run_hw_queue when the expected CPU is dead. Problem is, in the last batch execution before round robin, blk_mq_hctx_next_cpu can schedule a dead CPU and also update next_cpu to the next alive CPU in the mask, which will trigger the WARN_ON despite the previous workaround.
The following patch fixes this scenario by always scheduling the value in hctx->next_cpu. This changes the moment when we round-robin the CPU running the hctx, but it really doesn't matter, since it still executes BLK_MQ_CPU_WORK_BATCH times in a row before switching to another CPU.
--- block/blk-mq.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
block/blk-mq.c +1 -3
@@ -895,7 +895,7 @@ static int blk_mq_hctx_next_cpu(struct breturn WORK_CPU_UNBOUND ;if (--hctx->next_cpu_batch <=0 ) { -int cpu = hctx->next_cpu, next_cpu; +int next_cpu; next_cpu =cpumask_next (hctx->next_cpu, hctx->cpumask);if (next_cpu >= nr_cpu_ids)
@@ -903,8 +903,6 @@ static int blk_mq_hctx_next_cpu(struct b hctx->next_cpu = next_cpu; hctx->next_cpu_batch =BLK_MQ_CPU_WORK_BATCH ; - -return cpu; }return hctx->next_cpu;
Greg Kroah-Hartman
maintainerPATCH 112/120 bus: vexpress-config: fix device reference leak
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit c090959b9dd8c87703e275079aa4b4a824ba3f8e upstream.
Make sure to drop the reference to the parent device taken by class_find_device() after populating the bus.
--- drivers/bus/vexpress-config.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/bus/vexpress-config.c +6 -1
@@ -171,6 +171,7 @@ static int vexpress_config_populate(stru {struct device_node *bridge;struct device *parent; +int ret; bridge =of_parse_phandle (node,"arm,vexpress,config-bridge" ,0 );if (!bridge)
@@ -182,7 +183,11 @@ static int vexpress_config_populate(struif (WARN_ON (!parent))return -ENODEV ; -return of_platform_populate (node,NULL ,NULL , parent); + ret =of_platform_populate (node,NULL ,NULL , parent); + +put_device (parent); + +return ret; }static int __init vexpress_config_init (void )
Greg Kroah-Hartman
maintainerPATCH 113/120 powerpc/mm: Correct process and partition table max size
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suraj Jitindar Singh <[email protected]>
commit 555c16328ae6d75a90e234eac9b51998d68f185b upstream.
Version 3.00 of the ISA states that the PATS (partition table size) field of the PTCR (partition table control register) and the PRTS (process table size) field of the partition table entry must both be less than or equal to 24. However the actual size of the partition and process tables is equal to 2 to the power of 12 plus the PATS and PRTS fields, respectively. This means that the max allowable size of each of these tables is 2^36 or 64GB for both.
Thus when checking the size shift for each we should be checking for values of greater than 36 instead of the current check for shifts larger than 24 and 23.
--- arch/powerpc/mm/pgtable-radix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/mm/pgtable-radix.c +2 -2
@@ -159,7 +159,7 @@ redo:* Allocate Partition table and process table for the * host. */ -BUILD_BUG_ON_MSG ((PRTB_SIZE_SHIFT >23 ),"Process table size too large." ); +BUILD_BUG_ON_MSG ((PRTB_SIZE_SHIFT >36 ),"Process table size too large." ); process_tb =early_alloc_pgtable (1UL <<PRTB_SIZE_SHIFT );/* * Fill in the process table.
@@ -181,7 +181,7 @@ static void __init radix_init_partition_ rts_field =radix__get_tree_size (); -BUILD_BUG_ON_MSG ((PATB_SIZE_SHIFT >24 ),"Partition table size too large." ); +BUILD_BUG_ON_MSG ((PATB_SIZE_SHIFT >36 ),"Partition table size too large." ); partition_tb =early_alloc_pgtable (1UL <<PATB_SIZE_SHIFT ); partition_tb->patb0 =cpu_to_be64 (rts_field |__pa (init_mm.pgd) |RADIX_PGD_INDEX_SIZE |PATB_HR );
Greg Kroah-Hartman
maintainerPATCH 114/120 powerpc/ibmebus: Fix further device reference leaks
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 815a7141c4d1b11610dccb7fcbb38633759824f2 upstream.
Make sure to drop any reference taken by bus_find_device() when creating devices during init and driver registration.
--- arch/powerpc/kernel/ibmebus.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/powerpc/kernel/ibmebus.c +6 -2
@@ -180,6 +180,7 @@ static int ibmebus_create_device(structstatic int ibmebus_create_devices (const struct of_device_id *matches) {struct device_node *root, *child; +struct device *dev;int ret =0 ; root =of_find_node_by_path ("/" );
@@ -188,9 +189,12 @@ static int ibmebus_create_devices(constif (!of_match_node (matches, child))continue ; -if (bus_find_device (&ibmebus_bus_type,NULL , child, - ibmebus_match_node)) + dev =bus_find_device (&ibmebus_bus_type,NULL , child, + ibmebus_match_node); +if (dev) { +put_device (dev);continue ; + } ret =ibmebus_create_device (child);if (ret) {
Greg Kroah-Hartman
maintainerPATCH 115/120 powerpc/ibmebus: Fix device reference leaks in sysfs interface
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit fe0f3168169f7c34c29b0cf0c489f126a7f29643 upstream.
Make sure to drop any reference taken by bus_find_device() in the sysfs callbacks that are used to create and destroy devices based on device-tree entries.
--- arch/powerpc/kernel/ibmebus.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/powerpc/kernel/ibmebus.c +6 -2
@@ -266,6 +266,7 @@ static ssize_t ibmebus_store_probe(struc const char *buf, size_t count) {struct device_node *dn =NULL ; +struct device *dev;char *path;ssize_t rc =0 ;
@@ -273,8 +274,10 @@ static ssize_t ibmebus_store_probe(strucif (!path)return -ENOMEM ; -if (bus_find_device (&ibmebus_bus_type,NULL , path, - ibmebus_match_path)) { + dev =bus_find_device (&ibmebus_bus_type,NULL , path, + ibmebus_match_path); +if (dev) { +put_device (dev);printk (KERN_WARNING "%s: %s has already been probed\n" , __func__, path); rc = -EEXIST ;
@@ -311,6 +314,7 @@ static ssize_t ibmebus_store_remove(struif ((dev =bus_find_device (&ibmebus_bus_type,NULL , path, ibmebus_match_path))) {of_device_unregister (to_platform_device (dev)); +put_device (dev);kfree (path);return count;
Greg Kroah-Hartman
maintainerPATCH 116/120 powerpc/powernv: Dont warn on PE init if unfreeze is unsupported
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell Currey <[email protected]>
commit d4791db527bf397c84c9956c3ece9692ed5322ac upstream.
Whenever a PE is initialised in powernv, opal_pci_eeh_freeze_clear() is called. This is to remove any existing freeze, and has no negative side effects if the PE is already in an unfrozen state. On PHB backends that don't support this operation and return OPAL_UNSUPPORTED, this creates a scary and misleading warning message.
Skip the warning message on init if OPAL_UNSUPPORTED is returned.
As far as I'm aware, this currently only affects NPUs.
--- arch/powerpc/platforms/powernv/pci-ioda.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/powernv/pci-ioda.c +1 -1
@@ -145,7 +145,7 @@ static struct pnv_ioda_pe *pnv_ioda_init*/ rc =opal_pci_eeh_freeze_clear (phb->opal_id, pe_no,OPAL_EEH_ACTION_CLEAR_FREEZE_ALL ); -if (rc !=OPAL_SUCCESS ) +if (rc !=OPAL_SUCCESS && rc !=OPAL_UNSUPPORTED )pr_warn ("%s: Error %lld unfreezing PHB#%d-PE#%d\n" , __func__, rc, phb->hose->global_number, pe_no);
Greg Kroah-Hartman
maintainerPATCH 117/120 arm64: hugetlb: fix the wrong address for several functions
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huang Shijie <[email protected]>
commit 0c2f0afe3582c58efeef93bc57bc07d502132618 upstream.
The libhugetlbfs meets several failures since the following functions do not use the correct address:
huge_ptep_get_and_clear()
huge_ptep_set_access_flags()
huge_ptep_set_wrprotect()
huge_ptep_clear_flush()
This patch fixes the wrong address for them.
--- arch/arm64/mm/hugetlbpage.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/mm/hugetlbpage.c +4 -4
@@ -212,7 +212,7 @@ pte_t huge_ptep_get_and_clear(struct mm_ ncontig =find_num_contig (mm, addr, cpte, *cpte, &pgsize);/* save the 1st pte to return */ pte =ptep_get_and_clear (mm, addr, cpte); -for (i =1 ; i < ncontig; ++i) { +for (i =1 , addr += pgsize; i < ncontig; ++i, addr += pgsize) {/* * If HW_AFDBM is enabled, then the HW could * turn on the dirty bit for any of the page
@@ -250,7 +250,7 @@ int huge_ptep_set_access_flags(struct vm pfn =pte_pfn (*cpte); ncontig =find_num_contig (vma->vm_mm, addr, cpte, *cpte, &pgsize); -for (i =0 ; i < ncontig; ++i, ++cpte) { +for (i =0 ; i < ncontig; ++i, ++cpte, addr += pgsize) { changed = ptep_set_access_flags(vma, addr, cpte, pfn_pte(pfn, hugeprot),
@@ -273,7 +273,7 @@ void huge_ptep_set_wrprotect(struct mm_s cpte =huge_pte_offset (mm, addr); ncontig =find_num_contig (mm, addr, cpte, *cpte, &pgsize); -for (i =0 ; i < ncontig; ++i, ++cpte) +for (i =0 ; i < ncontig; ++i, ++cpte, addr += pgsize)ptep_set_wrprotect (mm, addr, cpte); }else {ptep_set_wrprotect (mm, addr, ptep);
@@ -291,7 +291,7 @@ void huge_ptep_clear_flush(struct vm_are cpte =huge_pte_offset (vma->vm_mm, addr); ncontig =find_num_contig (vma->vm_mm, addr, cpte, *cpte, &pgsize); -for (i =0 ; i < ncontig; ++i, ++cpte) +for (i =0 ; i < ncontig; ++i, ++cpte, addr += pgsize)ptep_clear_flush (vma, addr, cpte); }else {ptep_clear_flush (vma, addr, ptep);
Greg Kroah-Hartman
maintainerPATCH 118/120 arm64: hugetlb: remove the wrong pmd check in find_num_contig()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huang Shijie <[email protected]>
commit 20156ce2365d61beaa6f5a78a7a789044e0e7acc upstream.
The find_num_contig() will return 1 when the pmd is not present. It will cause a kernel dead loop in the following scenaro:
1.) pmd entry is not present.
2.) the page fault occurs:
... hugetlb_fault() --> hugetlb_no_page() --> set_huge_pte_at()
3.) set_huge_pte_at() will only set the first PMD entry, since the
find_num_contig just return 1 in this case. So the PMD entries are all empty except the first one.
4.) when kernel accesses the address mapped by the second PMD entry,
a new page fault occurs:
... hugetlb_fault() --> huge_ptep_set_access_flags()
The second PMD entry is still empty now.
5.) When the kernel returns, the access will cause a page fault again.
The kernel will run like the "4)" above.
We will see a dead loop since here.
The dead loop is caught in the 32M hugetlb page (2M PMD + Contiguous bit).
This patch removes wrong pmd check, and fixes this dead loop.
This patch also removes the redundant checks for PGD/PUD in the find_num_contig().
--- arch/arm64/mm/hugetlbpage.c | 12 ------------ 1 file changed, 12 deletions(-)
arch/arm64/mm/hugetlbpage.c +0 -12
@@ -51,20 +51,8 @@ static int find_num_contig(struct mm_str *pgsize =PAGE_SIZE ;if (!pte_cont (pte))return 1 ; -if (!pgd_present (*pgd)) { -VM_BUG_ON (!pgd_present (*pgd)); -return 1 ; - } pud =pud_offset (pgd, addr); -if (!pud_present (*pud)) { -VM_BUG_ON (!pud_present (*pud)); -return 1 ; - } pmd =pmd_offset (pud, addr); -if (!pmd_present (*pmd)) { -VM_BUG_ON (!pmd_present (*pmd)); -return 1 ; - }if ((pte_t *)pmd == ptep) { *pgsize =PMD_SIZE ;return CONT_PMDS ;
Greg Kroah-Hartman
maintainerPATCH 119/120 arm64: hugetlb: fix the wrong return value for huge_ptep_set_access_flags
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huang Shijie <[email protected]>
commit 69d012345a1a32d3f03957f14d972efccc106a98 upstream.
In current code, the @changed always returns the last one's status for the huge page with the contiguous bit set. This is really not what we want. Even one of the PTEs is changed, we should tell it to the caller.
This patch fixes this issue.
--- arch/arm64/mm/hugetlbpage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/mm/hugetlbpage.c +1 -1
@@ -239,7 +239,7 @@ int huge_ptep_set_access_flags(struct vm ncontig =find_num_contig (vma->vm_mm, addr, cpte, *cpte, &pgsize);for (i =0 ; i < ncontig; ++i, ++cpte, addr += pgsize) { - changed =ptep_set_access_flags (vma, addr, cpte, + changed |=ptep_set_access_flags (vma, addr, cpte,pfn_pte (pfn, hugeprot), dirty);
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.5 release. There are 120 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 Fri Jan 20 10:46:26 UTC 2017. Anything received after that time might be too late.
Build results:
total: 149 pass: 149 fail: 0 Qemu test results: total: 122 pass: 122 fail: 0
Details are available at http://kerneltests.org/builders.
Guenter
Greg Kroah-Hartman
maintainerQuoted 10 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.5 release. There are 120 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 Fri Jan 20 10:46:26 UTC 2017. Anything received after that time might be too late.
Quoted 6 lines
Build results:
total: 149 pass: 149 fail: 0 Qemu test results: total: 122 pass: 122 fail: 0Details are available at http://kerneltests.org/builders.
Great! Thanks for testing both of these and letting me know.
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.5 release. There are 120 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 Fri Jan 20 10:46:26 UTC 2017. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America(Silicon Valley) [email protected]
Greg Kroah-Hartman
maintainerQuoted 15 lines · Shuah Khan
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.5 release. There are 120 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 Fri Jan 20 10:46:26 UTC 2017. 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/v4.x/stable-review/patch-4.9.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.
Quoted 6 lines
Quoted 4 lines
thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
Great! Thanks for testing both of these and letting me know.
greg k-h
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Greg Kroah-Hartman
maintainerQuoted 45 lines · Kevin Hilman
Quoted 43 lines · kernelci.org bot
stable-rc boot: 217 boots: 4 failed, 202 passed with 9 offline, 2 conflicts (v4.9.4-121-ga55293ab8542)
Full Boot Summary: https://kernelci.org/boot/all/job/stable-rc/kernel/v4.9.4-121-ga55293ab8542/
Full Build Summary: https://kernelci.org/build/stable-rc/kernel/v4.9.4-121-ga55293ab8542/Tree: stable-rc
Branch: local/linux-4.9.y
Git Describe: v4.9.4-121-ga55293ab8542
Git Commit:a55293ab8542c08a979e3152d18c298410fdf7e4
Git URL: http://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Tested: 49 unique boards, 15 SoC families, 27 builds out of 206Boot Regressions Detected:
arm:
multi_v7_defconfig: vexpress-v2p-ca15_a7: lab-broonie: new failure (last pass: v4.9.4-116-gfa44cad19956) multi_v7_defconfig+CONFIG_LKDTM=y: vexpress-v2p-ca15-tc1: lab-broonie: new failure (last pass: v4.9.4-116-gfa44cad19956) multi_v7_defconfig+CONFIG_SMP=n: exynos5250-snow: lab-collabora: failing since 8 days (last pass: v4.9.1-117-g8e301c7d4760 - first fail: v4.9.2-207-gf377428ed2cf)Boot Failures Detected:
arm64:
defconfig+CONFIG_RANDOMIZE_BASE=y armada-7040-db: 1 failed labarm:
multi_v7_defconfig+CONFIG_PROVE_LOCKING=y
at91-sama5d4_xplained: 1 failed labmulti_v7_defconfig+CONFIG_SMP=n
exynos5250-snow: 1 failed lab
Quoted 8 lines
Quoted 4 lines
x86:
defconfig+CONFIG_KASAN=y qemu-i386: 1 failed labInterpretation: all is well.
No new issues.
Wonderful, thanks for letting me know.
greg k-h