2019-11-22 11:18:44

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 4.14 000/122] 4.14.156-stable review

This is the start of the stable review cycle for the 4.14.156 release.
There are 122 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 Sun, 24 Nov 2019 09:59:19 +0000.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.156-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.14.y
and the diffstat can be found below.

thanks,

greg k-h

-------------
Pseudo-Shortlog of commits:

Greg Kroah-Hartman <[email protected]>
Linux 4.14.156-rc1

Takeshi Saito <[email protected]>
mmc: tmio: fix SCC error handling to avoid false positive CRC error

Michael Ellerman <[email protected]>
powerpc/time: Fix clockevent_decrementer initalisation for PR KVM

Alan Mikhak <[email protected]>
tools: PCI: Fix broken pcitest compilation

Roger Quadros <[email protected]>
ARM: dts: omap5: Fix dual-role mode on Super-Speed port

Ido Schimmel <[email protected]>
mlxsw: spectrum_switchdev: Check notification relevance based on upper device

Huibin Hong <[email protected]>
spi: rockchip: initialize dma_slave_config properly

Felix Fietkau <[email protected]>
mac80211: minstrel: fix sampling/reporting of CCK rates in HT mode

Felix Fietkau <[email protected]>
mac80211: minstrel: fix CCK rate group streams value

Felix Fietkau <[email protected]>
mac80211: minstrel: fix using short preamble CCK rates on HT clients

zhong jiang <[email protected]>
misc: cxl: Fix possible null pointer dereference

Pablo Neira Ayuso <[email protected]>
netfilter: nft_compat: do not dump private area

Nicolin Chen <[email protected]>
hwmon: (ina3221) Fix INA3221_CONFIG_MODE macros

Thierry Reding <[email protected]>
hwmon: (pwm-fan) Silence error on probe deferral

Linus Walleij <[email protected]>
pinctrl: gemini: Fix up TVC clock group

Colin Ian King <[email protected]>
orangefs: rate limit the client not running info message

Timothy E Baldwin <[email protected]>
ARM: 8802/1: Call syscall_trace_exit even when system call skipped

Trent Piepho <[email protected]>
spi: spidev: Fix OF tree warning logic

Linus Walleij <[email protected]>
pinctrl: gemini: Mask and set properly

Hieu Tran Dang <[email protected]>
spi: fsl-lpspi: Prevent FIFO under/overrun by default

Marek Vasut <[email protected]>
gpio: syscon: Fix possible NULL ptr usage

Bjorn Helgaas <[email protected]>
x86/kexec: Correct KEXEC_BACKUP_SRC_END off-by-one error

Colin Ian King <[email protected]>
media: cx231xx: fix potential sign-extension overflow on large shift

Tim Smith <[email protected]>
GFS2: Flush the GFS2 delete workqueue before stopping the kernel threads

Wenwen Wang <[email protected]>
media: isif: fix a NULL pointer dereference bug

He Zhe <[email protected]>
printk: Give error on attempt to set log buffer length to over 2G

Vignesh R <[email protected]>
mfd: ti_am335x_tscadc: Keep ADC interface on if child is wakeup capable

Nathan Chancellor <[email protected]>
backlight: lm3639: Unconditionally call led_classdev_unregister

Borislav Petkov <[email protected]>
proc/vmcore: Fix i386 build error of missing copy_oldmem_page_encrypted()

Vasily Gorbik <[email protected]>
s390/kasan: avoid vdso instrumentation

Rajmohan Mani <[email protected]>
media: dw9714: Fix error handling in probe function

Shenghui Wang <[email protected]>
bcache: recal cached_dev_sectors on detach

Geert Uytterhoeven <[email protected]>
reset: Fix potential use-after-free in __of_reset_control_get()

Dan Carpenter <[email protected]>
fbdev: sbuslib: integer overflow in sbusfb_ioctl_helper()

Dan Carpenter <[email protected]>
fbdev: sbuslib: use checked version of put_user()

Masaharu Hayakawa <[email protected]>
mmc: tmio: Fix SCC error detection

Andy Lutomirski <[email protected]>
x86/fsgsbase/64: Fix ptrace() to read the FS/GS base accurately

Sara Sharon <[email protected]>
iwlwifi: mvm: don't send keys when entering D3

Ronald Tschalär <[email protected]>
ACPI / SBS: Fix rare oops when removing modules

Li RongQing <[email protected]>
xfrm: use correct size to initialise sp->ovec

Radu Solea <[email protected]>
crypto: mxs-dcp - Fix AES issues

Radu Solea <[email protected]>
crypto: mxs-dcp - Fix SHA null hashes and output length

Wolfram Sang <[email protected]>
dmaengine: rcar-dmac: set scatter/gather max segment size

Borislav Petkov <[email protected]>
x86/olpc: Fix build error with CONFIG_MFD_CS5535=m

Lianbo Jiang <[email protected]>
kexec: Allocate decrypted control pages for kdump if SME is enabled

Suman Anna <[email protected]>
remoteproc: Check for NULL firmwares in sysfs interface

Julian Sax <[email protected]>
Input: silead - try firmware reload after unsuccessful resume

Martin Kepplinger <[email protected]>
Input: st1232 - set INPUT_PROP_DIRECT property

Hans Verkuil <[email protected]>
media: cec-gpio: select correct Signal Free Time

Rami Rosen <[email protected]>
dmaengine: ioat: fix prototype of ioat_enumerate_channels

Olga Kornievskaia <[email protected]>
NFSv4.x: fix lock recovery during delegation recall

Florian Fainelli <[email protected]>
i2c: brcmstb: Allow enabling the driver on DSL SoCs

Marek Szyprowski <[email protected]>
clk: samsung: Use clk_hw API for calling clk framework from clk notifiers

Joonyoung Shim <[email protected]>
clk: samsung: exynos5420: Define CLK_SECKEY gate clock only or Exynos5420

Sergey Matyukevich <[email protected]>
qtnfmac: drop error reports for out-of-bounds key indexes

Sergey Matyukevich <[email protected]>
qtnfmac: pass sgi rate info flag to wireless core

Chung-Hsien Hsu <[email protected]>
brcmfmac: fix full timeout waiting for action frame on-channel tx

Chung-Hsien Hsu <[email protected]>
brcmfmac: reduce timeout for action frame scan

Borislav Petkov <[email protected]>
cpu/SMT: State SMT is disabled even with nosmt and without "=force"

Ricardo Ribalda Delgado <[email protected]>
mtd: physmap_of: Release resources on error

Johan Hovold <[email protected]>
USB: serial: cypress_m8: fix interrupt-out transfer length

Cameron Kaiser <[email protected]>
KVM: PPC: Book3S PR: Exiting split hack mode needs to fixup both PC and LR

Michael Pobega <[email protected]>
ALSA: hda/sigmatel - Disable automute for Elo VuPoint

Jacopo Mondi <[email protected]>
media: i2c: adv748x: Support probing a single output

Nathan Chancellor <[email protected]>
media: pxa_camera: Fix check for pdev->dev.of_node

Matthias Reichl <[email protected]>
media: rc: ir-rc6-decoder: enable toggle bit for Kathrein RCU-676 remote

Nathan Chancellor <[email protected]>
ata: ep93xx: Use proper enums for directions

Anton Blanchard <[email protected]>
powerpc/time: Use clockevents_register_device(), fixing an issue with large decrementer

Bob Moore <[email protected]>
ACPICA: Never run _REG on system_memory and system_IO

Nathan Chancellor <[email protected]>
IB/mlx4: Avoid implicit enumerated type conversion

Wei Yongjun <[email protected]>
IB/mthca: Fix error return code in __mthca_init_one()

Radoslaw Tyl <[email protected]>
ixgbe: Fix crash with VFs and flow director on interface flap

Nathan Chancellor <[email protected]>
i40e: Use proper enum in i40e_ndo_set_vf_link_state

Radoslaw Tyl <[email protected]>
ixgbe: Fix ixgbe TX hangs with XDP_TX beyond queue limit

NeilBrown <[email protected]>
md: allow metadata updates while suspending an array - fix

Sergei Shtylyov <[email protected]>
clocksource/drivers/sh_cmt: Fix clocksource width for 32-bit machines

Sergei Shtylyov <[email protected]>
clocksource/drivers/sh_cmt: Fixup for 64-bit machines

Gustavo Pimentel <[email protected]>
tools: PCI: Fix compilation warnings

Chen Yu <[email protected]>
PM / hibernate: Check the success of generating md5 digest before hibernation

Nathan Chancellor <[email protected]>
mtd: rawnand: sh_flctl: Use proper enum for flctl_dma_fifo0_transfer

Tudor Ambarus <[email protected]>
ARM: dts: at91: at91sam9x5cm: fix addressable nand flash size

Tudor Ambarus <[email protected]>
ARM: dts: at91: sama5d4_xplained: fix addressable nand flash size

zhong jiang <[email protected]>
powerpc/xive: Move a dereference below a NULL test

Naveen N. Rao <[email protected]>
powerpc/pseries: Fix how we iterate over the DTL entries

Naveen N. Rao <[email protected]>
powerpc/pseries: Fix DTL buffer registration

Nathan Chancellor <[email protected]>
cxgb4: Use proper enum in IEEE_FAUX_SYNC

Nathan Chancellor <[email protected]>
cxgb4: Use proper enum in cxgb4_dcb_handle_fw_update

Dan Carpenter <[email protected]>
mei: samples: fix a signedness bug in amt_host_if_call()

Chuck Lever <[email protected]>
sunrpc: Fix connect metrics

Nishanth Menon <[email protected]>
clk: keystone: Enable TISCI clocks if K3_ARCH

Gabriel Krisman Bertazi <[email protected]>
ext4: fix build error when DX_DEBUG is defined

Nathan Chancellor <[email protected]>
dmaengine: timb_dma: Use proper enum in td_prep_slave_sg

Nathan Chancellor <[email protected]>
dmaengine: ep93xx: Return proper enum in ep93xx_dma_chan_direction

Alexey Kardashevskiy <[email protected]>
KVM: PPC: Inform the userspace about TCE update failures

Guenter Roeck <[email protected]>
watchdog: w83627hf_wdt: Support NCT6796D, NCT6797D, NCT6798D

Miquel Raynal <[email protected]>
irqchip/irq-mvebu-icu: Fix wrong private data retrieval

Andrew Zaborowski <[email protected]>
nl80211: Fix a GET_KEY reply attribute

Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Check ENBLSLPM before sending ep command

Jia-Ju Bai <[email protected]>
usb: gadget: udc: fotg210-udc: Fix a sleep-in-atomic-context bug in fotg210_get_status()

Simon Wunderlich <[email protected]>
ath9k: fix reporting calculated new FFT upper max

Florian Fainelli <[email protected]>
ata: ahci_brcm: Allow using driver or DSL SoCs

Ben Greear <[email protected]>
ath10k: fix vdev-start timeout on error

Anshuman Khandual <[email protected]>
arm64/numa: Report correct memblock range for the dummy node

Suzuki K Poulose <[email protected]>
kvm: arm/arm64: Fix stage2_flush_memslot for 4 level page table

Robin Murphy <[email protected]>
iommu/io-pgtable-arm: Fix race handling in split_blk_unmap()

Dennis Dalessandro <[email protected]>
IB/hfi1: Ensure ucast_dlid access doesnt exceed bounds

Trond Myklebust <[email protected]>
SUNRPC: Fix priority queue fairness

Philipp Rossak <[email protected]>
ARM: dts: sun8i: h3-h5: ir register size should be the whole memory block

Jaegeuk Kim <[email protected]>
f2fs: return correct errno in f2fs_gc

Yunsheng Lin <[email protected]>
net: hns3: Fix for netdev not up problem when setting mtu

H. Nikolaus Schaller <[email protected]>
ARM: dts: omap5: enable OTG role for DWC3 controller

Vignesh R <[email protected]>
ARM: dts: dra7: Enable workaround for errata i870 in PCIe host mode

YueHaibing <[email protected]>
net: xen-netback: fix return type of ndo_start_xmit function

YueHaibing <[email protected]>
net: ovs: fix return type of ndo_start_xmit function

Daniel Vetter <[email protected]>
fbdev: Ditch fb_edid_add_monspecs

Pavel Tatashin <[email protected]>
arm64: uaccess: Ensure PAN is re-enabled after unhandled uaccess fault

David Hildenbrand <[email protected]>
mm/memory_hotplug: fix updating the node span

David Hildenbrand <[email protected]>
mm/memory_hotplug: don't access uninitialized memmaps in shrink_pgdat_span()

Matthew Wilcox (Oracle) <[email protected]>
idr: Fix idr_get_next race with idr_remove

Dan Carpenter <[email protected]>
net: cdc_ncm: Signedness bug in cdc_ncm_set_dgram_size()

Greg Kroah-Hartman <[email protected]>
Revert "OPP: Protect dev_list with opp_table lock"

Julia Lawall <[email protected]>
tee: optee: add missing of_node_put after of_device_is_available

Leilk Liu <[email protected]>
spi: mediatek: use correct mata->xfer_len when in fifo transfer


-------------

Diffstat:

Makefile | 4 +-
arch/arm/boot/dts/at91-sama5d4_xplained.dts | 2 +-
arch/arm/boot/dts/at91sam9x5cm.dtsi | 2 +-
arch/arm/boot/dts/dra7.dtsi | 2 +
arch/arm/boot/dts/omap5-board-common.dtsi | 5 +
arch/arm/boot/dts/sunxi-h3-h5.dtsi | 2 +-
arch/arm/kernel/entry-common.S | 9 +-
arch/arm64/lib/clear_user.S | 1 +
arch/arm64/lib/copy_from_user.S | 1 +
arch/arm64/lib/copy_in_user.S | 1 +
arch/arm64/lib/copy_to_user.S | 1 +
arch/arm64/mm/numa.c | 2 +-
arch/powerpc/kernel/time.c | 19 ++--
arch/powerpc/kvm/book3s.c | 3 +
arch/powerpc/kvm/book3s_64_vio.c | 8 +-
arch/powerpc/kvm/book3s_64_vio_hv.c | 6 +-
arch/powerpc/platforms/pseries/dtl.c | 4 +-
arch/powerpc/sysdev/xive/common.c | 7 +-
arch/s390/kernel/vdso32/Makefile | 3 +-
arch/s390/kernel/vdso64/Makefile | 3 +-
arch/x86/Kconfig | 3 +-
arch/x86/include/asm/kexec.h | 2 +-
arch/x86/kernel/ptrace.c | 62 ++++++++++--
arch/x86/power/hibernate_64.c | 11 +--
drivers/acpi/acpica/acevents.h | 2 +
drivers/acpi/acpica/aclocal.h | 2 +-
drivers/acpi/acpica/evregion.c | 17 +++-
drivers/acpi/acpica/evrgnini.c | 6 +-
drivers/acpi/acpica/evxfregn.c | 1 -
drivers/acpi/osl.c | 1 +
drivers/acpi/sbshc.c | 2 +
drivers/ata/Kconfig | 3 +-
drivers/ata/pata_ep93xx.c | 8 +-
drivers/base/power/opp/core.c | 21 +---
drivers/base/power/opp/cpu.c | 2 -
drivers/base/power/opp/opp.h | 2 +-
drivers/clk/Makefile | 1 +
drivers/clk/keystone/Kconfig | 2 +-
drivers/clk/samsung/clk-cpu.c | 6 +-
drivers/clk/samsung/clk-cpu.h | 2 +-
drivers/clk/samsung/clk-exynos5420.c | 3 +-
drivers/clocksource/sh_cmt.c | 78 +++++++--------
drivers/crypto/mxs-dcp.c | 80 ++++++++++++---
drivers/dma/ioat/init.c | 7 +-
drivers/dma/sh/rcar-dmac.c | 3 +
drivers/dma/timb_dma.c | 2 +-
drivers/gpio/gpio-syscon.c | 2 +-
drivers/hwmon/ina3221.c | 6 +-
drivers/hwmon/pwm-fan.c | 8 +-
drivers/i2c/busses/Kconfig | 7 +-
drivers/infiniband/hw/mthca/mthca_main.c | 3 +-
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.c | 3 +-
drivers/input/touchscreen/silead.c | 13 +++
drivers/input/touchscreen/st1232.c | 1 +
drivers/iommu/io-pgtable-arm.c | 9 +-
drivers/irqchip/irq-mvebu-icu.c | 2 +-
drivers/md/bcache/super.c | 1 +
drivers/md/md.c | 22 +++--
drivers/media/cec/cec-pin.c | 20 ++++
drivers/media/i2c/adv748x/adv748x-core.c | 25 ++++-
drivers/media/i2c/adv748x/adv748x-csi2.c | 18 ++--
drivers/media/i2c/adv748x/adv748x.h | 2 +
drivers/media/i2c/dw9714.c | 3 +-
drivers/media/platform/davinci/isif.c | 3 +-
drivers/media/platform/pxa_camera.c | 2 +-
drivers/media/rc/ir-rc6-decoder.c | 9 +-
drivers/media/usb/cx231xx/cx231xx-video.c | 2 +-
drivers/mfd/ti_am335x_tscadc.c | 13 +++
drivers/misc/cxl/guest.c | 2 -
drivers/mmc/host/tmio_mmc_core.c | 5 +-
drivers/mtd/maps/physmap_of_core.c | 27 +----
drivers/mtd/nand/sh_flctl.c | 4 +-
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c | 4 +-
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h | 2 +-
.../net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | 8 +-
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 2 +-
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 24 +++--
.../ethernet/mellanox/mlxsw/spectrum_switchdev.c | 9 +-
drivers/net/usb/cdc_ncm.c | 2 +-
drivers/net/wireless/ath/ath10k/core.h | 1 +
drivers/net/wireless/ath/ath10k/mac.c | 2 +-
drivers/net/wireless/ath/ath10k/wmi.c | 19 +++-
drivers/net/wireless/ath/ath10k/wmi.h | 8 +-
drivers/net/wireless/ath/ath9k/common-spectral.c | 2 +-
.../net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 26 +++--
.../net/wireless/broadcom/brcm80211/brcmfmac/p2p.h | 2 +
drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 4 +-
drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 13 ++-
drivers/net/wireless/quantenna/qtnfmac/commands.c | 3 +
drivers/net/xen-netback/interface.c | 3 +-
drivers/pinctrl/pinctrl-gemini.c | 47 +++++++--
drivers/remoteproc/remoteproc_sysfs.c | 5 +
drivers/reset/core.c | 15 +--
drivers/spi/spi-fsl-lpspi.c | 2 +-
drivers/spi/spi-mt65xx.c | 4 +-
drivers/spi/spi-rockchip.c | 3 +
drivers/spi/spidev.c | 8 +-
drivers/tee/optee/core.c | 4 +-
drivers/usb/dwc3/gadget.c | 29 ++++--
drivers/usb/gadget/udc/fotg210-udc.c | 2 +-
drivers/usb/serial/cypress_m8.c | 2 +-
drivers/video/backlight/lm3639_bl.c | 6 +-
drivers/video/fbdev/core/fbmon.c | 95 ------------------
drivers/video/fbdev/core/modedb.c | 57 -----------
drivers/video/fbdev/sbuslib.c | 28 +++---
drivers/watchdog/w83627hf_wdt.c | 8 +-
fs/ext4/namei.c | 2 +-
fs/f2fs/gc.c | 2 +-
fs/gfs2/super.c | 2 +-
fs/nfs/delegation.c | 6 +-
fs/orangefs/orangefs-sysfs.c | 2 +-
fs/proc/vmcore.c | 10 ++
include/linux/fb.h | 3 -
include/linux/platform_data/dma-ep93xx.h | 2 +-
include/linux/sunrpc/sched.h | 2 -
include/rdma/ib_verbs.h | 2 +-
kernel/cpu.c | 1 +
kernel/kexec_core.c | 6 ++
kernel/printk/printk.c | 18 ++--
lib/idr.c | 20 +++-
mm/memory_hotplug.c | 77 ++++-----------
net/mac80211/rc80211_minstrel_ht.c | 20 ++--
net/netfilter/nft_compat.c | 24 ++++-
net/openvswitch/vport-internal_dev.c | 5 +-
net/sunrpc/sched.c | 109 ++++++++++-----------
net/sunrpc/xprt.c | 14 +--
net/sunrpc/xprtrdma/transport.c | 6 +-
net/sunrpc/xprtsock.c | 10 +-
net/wireless/nl80211.c | 2 +-
net/xfrm/xfrm_input.c | 2 +-
samples/mei/mei-amt-version.c | 2 +-
sound/pci/hda/patch_sigmatel.c | 20 ++++
tools/pci/pcitest.c | 7 +-
tools/testing/radix-tree/idr-test.c | 52 ++++++++++
virt/kvm/arm/mmu.c | 3 +-
135 files changed, 857 insertions(+), 649 deletions(-)



2019-11-22 11:18:58

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 4.14 007/122] mm/memory_hotplug: fix updating the node span

From: David Hildenbrand <[email protected]>

commit 656d571193262a11c2daa4012e53e4d645bbce56 upstream.

We recently started updating the node span based on the zone span to
avoid touching uninitialized memmaps.

Currently, we will always detect the node span to start at 0, meaning a
node can easily span too many pages. pgdat_is_empty() will still work
correctly if all zones span no pages. We should skip over all zones
without spanned pages and properly handle the first detected zone that
spans pages.

Unfortunately, in contrast to the zone span (/proc/zoneinfo), the node
span cannot easily be inspected and tested. The node span gives no real
guarantees when an architecture supports memory hotplug, meaning it can
easily contain holes or span pages of different nodes.

The node span is not really used after init on architectures that
support memory hotplug.

E.g., we use it in mm/memory_hotplug.c:try_offline_node() and in
mm/kmemleak.c:kmemleak_scan(). These users seem to be fine.

Link: http://lkml.kernel.org/r/[email protected]
Fixes: 00d6c019b5bc ("mm/memory_hotplug: don't access uninitialized memmaps in shrink_pgdat_span()")
Signed-off-by: David Hildenbrand <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Oscar Salvador <[email protected]>
Cc: Stephen Rothwell <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Pavel Tatashin <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
mm/memory_hotplug.c | 8 ++++++++
1 file changed, 8 insertions(+)

--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -470,6 +470,14 @@ static void update_pgdat_span(struct pgl
zone->spanned_pages;

/* No need to lock the zones, they can't change. */
+ if (!zone->spanned_pages)
+ continue;
+ if (!node_end_pfn) {
+ node_start_pfn = zone->zone_start_pfn;
+ node_end_pfn = zone_end_pfn;
+ continue;
+ }
+
if (zone_end_pfn > node_end_pfn)
node_end_pfn = zone_end_pfn;
if (zone->zone_start_pfn < node_start_pfn)


2019-11-22 11:19:06

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 4.14 025/122] usb: gadget: udc: fotg210-udc: Fix a sleep-in-atomic-context bug in fotg210_get_status()

From: Jia-Ju Bai <[email protected]>

[ Upstream commit 2337a77c1cc86bc4e504ecf3799f947659c86026 ]

The driver may sleep in an interrupt handler.
The function call path (from bottom to top) in Linux-4.17 is:

[FUNC] fotg210_ep_queue(GFP_KERNEL)
drivers/usb/gadget/udc/fotg210-udc.c, 744:
fotg210_ep_queue in fotg210_get_status
drivers/usb/gadget/udc/fotg210-udc.c, 768:
fotg210_get_status in fotg210_setup_packet
drivers/usb/gadget/udc/fotg210-udc.c, 949:
fotg210_setup_packet in fotg210_irq (interrupt handler)

To fix this bug, GFP_KERNEL is replaced with GFP_ATOMIC.
If possible, spin_unlock() and spin_lock() around fotg210_ep_queue()
can be also removed.

This bug is found by my static analysis tool DSAC.

Signed-off-by: Jia-Ju Bai <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
drivers/usb/gadget/udc/fotg210-udc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c
index d17d7052605ba..6866a0be249e4 100644
--- a/drivers/usb/gadget/udc/fotg210-udc.c
+++ b/drivers/usb/gadget/udc/fotg210-udc.c
@@ -744,7 +744,7 @@ static void fotg210_get_status(struct fotg210_udc *fotg210,
fotg210->ep0_req->length = 2;

spin_unlock(&fotg210->lock);
- fotg210_ep_queue(fotg210->gadget.ep0, fotg210->ep0_req, GFP_KERNEL);
+ fotg210_ep_queue(fotg210->gadget.ep0, fotg210->ep0_req, GFP_ATOMIC);
spin_lock(&fotg210->lock);
}

--
2.20.1



2019-11-22 11:19:09

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 4.14 026/122] usb: dwc3: gadget: Check ENBLSLPM before sending ep command

From: Thinh Nguyen <[email protected]>

[ Upstream commit 87dd96111b0bb8e616fcbd74dbf4bb4182f2c596 ]

When operating in USB 2.0 speeds (HS/FS), if GUSB2PHYCFG.ENBLSLPM or
GUSB2PHYCFG.SUSPHY is set, it must be cleared before issuing an endpoint
command.

Current implementation only save and restore GUSB2PHYCFG.SUSPHY
configuration. We must save and clear both GUSB2PHYCFG.ENBLSLPM and
GUSB2PHYCFG.SUSPHY settings. Restore them after the command is
completed.

DWC_usb3 3.30a and DWC_usb31 1.90a programming guide section 3.2.2

Signed-off-by: Thinh Nguyen <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
drivers/usb/dwc3/gadget.c | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 5916340c41621..e96b22d6fa52e 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -277,27 +277,36 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned cmd,
const struct usb_endpoint_descriptor *desc = dep->endpoint.desc;
struct dwc3 *dwc = dep->dwc;
u32 timeout = 1000;
+ u32 saved_config = 0;
u32 reg;

int cmd_status = 0;
- int susphy = false;
int ret = -EINVAL;

/*
- * Synopsys Databook 2.60a states, on section 6.3.2.5.[1-8], that if
- * we're issuing an endpoint command, we must check if
- * GUSB2PHYCFG.SUSPHY bit is set. If it is, then we need to clear it.
+ * When operating in USB 2.0 speeds (HS/FS), if GUSB2PHYCFG.ENBLSLPM or
+ * GUSB2PHYCFG.SUSPHY is set, it must be cleared before issuing an
+ * endpoint command.
*
- * We will also set SUSPHY bit to what it was before returning as stated
- * by the same section on Synopsys databook.
+ * Save and clear both GUSB2PHYCFG.ENBLSLPM and GUSB2PHYCFG.SUSPHY
+ * settings. Restore them after the command is completed.
+ *
+ * DWC_usb3 3.30a and DWC_usb31 1.90a programming guide section 3.2.2
*/
if (dwc->gadget.speed <= USB_SPEED_HIGH) {
reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
if (unlikely(reg & DWC3_GUSB2PHYCFG_SUSPHY)) {
- susphy = true;
+ saved_config |= DWC3_GUSB2PHYCFG_SUSPHY;
reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
- dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
}
+
+ if (reg & DWC3_GUSB2PHYCFG_ENBLSLPM) {
+ saved_config |= DWC3_GUSB2PHYCFG_ENBLSLPM;
+ reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM;
+ }
+
+ if (saved_config)
+ dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
}

if (DWC3_DEPCMD_CMD(cmd) == DWC3_DEPCMD_STARTTRANSFER) {
@@ -395,9 +404,9 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned cmd,
}
}

- if (unlikely(susphy)) {
+ if (saved_config) {
reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
- reg |= DWC3_GUSB2PHYCFG_SUSPHY;
+ reg |= saved_config;
dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
}

--
2.20.1



2019-11-22 11:19:11

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 4.14 003/122] Revert "OPP: Protect dev_list with opp_table lock"

From: Greg Kroah-Hartman <[email protected]>

This reverts commit 714ab224a8db6e8255c61a42613de9349ceb0bba which is
commit 3d2556992a878a2210d3be498416aee39e0c32aa upstream.

Turns out to break the build on the odroid machines, so it needs to be
reverted.

Reported-by: Viresh Kumar <[email protected]>
Reported-by: "kernelci.org bot" <[email protected]>
Cc: Niklas Cassel <[email protected]>
Cc: Sasha Levin <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/base/power/opp/core.c | 21 ++-------------------
drivers/base/power/opp/cpu.c | 2 --
drivers/base/power/opp/opp.h | 2 +-
3 files changed, 3 insertions(+), 22 deletions(-)

--- a/drivers/base/power/opp/core.c
+++ b/drivers/base/power/opp/core.c
@@ -49,14 +49,9 @@ static struct opp_device *_find_opp_dev(
static struct opp_table *_find_opp_table_unlocked(struct device *dev)
{
struct opp_table *opp_table;
- bool found;

list_for_each_entry(opp_table, &opp_tables, node) {
- mutex_lock(&opp_table->lock);
- found = !!_find_opp_dev(dev, opp_table);
- mutex_unlock(&opp_table->lock);
-
- if (found) {
+ if (_find_opp_dev(dev, opp_table)) {
_get_opp_table_kref(opp_table);

return opp_table;
@@ -716,8 +711,6 @@ struct opp_device *_add_opp_dev(const st

/* Initialize opp-dev */
opp_dev->dev = dev;
-
- mutex_lock(&opp_table->lock);
list_add(&opp_dev->node, &opp_table->dev_list);

/* Create debugfs entries for the opp_table */
@@ -725,7 +718,6 @@ struct opp_device *_add_opp_dev(const st
if (ret)
dev_err(dev, "%s: Failed to register opp debugfs (%d)\n",
__func__, ret);
- mutex_unlock(&opp_table->lock);

return opp_dev;
}
@@ -744,7 +736,6 @@ static struct opp_table *_allocate_opp_t
if (!opp_table)
return NULL;

- mutex_init(&opp_table->lock);
INIT_LIST_HEAD(&opp_table->dev_list);

opp_dev = _add_opp_dev(dev, opp_table);
@@ -766,6 +757,7 @@ static struct opp_table *_allocate_opp_t

BLOCKING_INIT_NOTIFIER_HEAD(&opp_table->head);
INIT_LIST_HEAD(&opp_table->opp_list);
+ mutex_init(&opp_table->lock);
kref_init(&opp_table->kref);

/* Secure the device table modification */
@@ -807,10 +799,6 @@ static void _opp_table_kref_release(stru
if (!IS_ERR(opp_table->clk))
clk_put(opp_table->clk);

- /*
- * No need to take opp_table->lock here as we are guaranteed that no
- * references to the OPP table are taken at this point.
- */
opp_dev = list_first_entry(&opp_table->dev_list, struct opp_device,
node);

@@ -1714,9 +1702,6 @@ void _dev_pm_opp_remove_table(struct opp
{
struct dev_pm_opp *opp, *tmp;

- /* Protect dev_list */
- mutex_lock(&opp_table->lock);
-
/* Find if opp_table manages a single device */
if (list_is_singular(&opp_table->dev_list)) {
/* Free static OPPs */
@@ -1727,8 +1712,6 @@ void _dev_pm_opp_remove_table(struct opp
} else {
_remove_opp_dev(_find_opp_dev(dev, opp_table), opp_table);
}
-
- mutex_unlock(&opp_table->lock);
}

void _dev_pm_opp_find_and_remove_table(struct device *dev, bool remove_all)
--- a/drivers/base/power/opp/cpu.c
+++ b/drivers/base/power/opp/cpu.c
@@ -222,10 +222,8 @@ int dev_pm_opp_get_sharing_cpus(struct d
cpumask_clear(cpumask);

if (opp_table->shared_opp == OPP_TABLE_ACCESS_SHARED) {
- mutex_lock(&opp_table->lock);
list_for_each_entry(opp_dev, &opp_table->dev_list, node)
cpumask_set_cpu(opp_dev->dev->id, cpumask);
- mutex_unlock(&opp_table->lock);
} else {
cpumask_set_cpu(cpu_dev->id, cpumask);
}
--- a/drivers/base/power/opp/opp.h
+++ b/drivers/base/power/opp/opp.h
@@ -124,7 +124,7 @@ enum opp_table_access {
* @dev_list: list of devices that share these OPPs
* @opp_list: table of opps
* @kref: for reference count of the table.
- * @lock: mutex protecting the opp_list and dev_list.
+ * @lock: mutex protecting the opp_list.
* @np: struct device_node pointer for opp's DT node.
* @clock_latency_ns_max: Max clock latency in nanoseconds.
* @shared_opp: OPP is shared between multiple devices.


2019-11-22 11:19:13

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 4.14 024/122] ath9k: fix reporting calculated new FFT upper max

From: Simon Wunderlich <[email protected]>

[ Upstream commit 4fb5837ac2bd46a85620b297002c704e9958f64d ]

Since the debug print code is outside of the loop, it shouldn't use the loop
iterator anymore but instead print the found maximum index.

Cc: Nick Kossifidis <[email protected]>
Signed-off-by: Simon Wunderlich <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
drivers/net/wireless/ath/ath9k/common-spectral.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.c b/drivers/net/wireless/ath/ath9k/common-spectral.c
index a41bcbda1d9e8..37d5994eb1ccd 100644
--- a/drivers/net/wireless/ath/ath9k/common-spectral.c
+++ b/drivers/net/wireless/ath/ath9k/common-spectral.c
@@ -411,7 +411,7 @@ ath_cmn_process_ht20_40_fft(struct ath_rx_status *rs,

ath_dbg(common, SPECTRAL_SCAN,
"Calculated new upper max 0x%X at %i\n",
- tmp_mag, i);
+ tmp_mag, fft_sample_40.upper_max_index);
} else
for (i = dc_pos; i < SPECTRAL_HT20_40_NUM_BINS; i++) {
if (fft_sample_40.data[i] == (upper_mag >> max_exp))
--
2.20.1



2019-11-22 11:19:13

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 4.14 049/122] md: allow metadata updates while suspending an array - fix

From: NeilBrown <[email protected]>

[ Upstream commit 059421e041eb461fb2b3e81c9adaec18ef03ca3c ]

Commit 35bfc52187f6 ("md: allow metadata update while suspending.")
added support for allowing md_check_recovery() to still perform
metadata updates while the array is entering the 'suspended' state.
This is needed to allow the processes of entering the state to
complete.

Unfortunately, the patch doesn't really work. The test for
"mddev->suspended" at the start of md_check_recovery() means that the
function doesn't try to do anything at all while entering suspend.

This patch moves the code of updating the metadata while suspending to
*before* the test on mddev->suspended.

Reported-by: Jeff Mahoney <[email protected]>
Fixes: 35bfc52187f6 ("md: allow metadata update while suspending.")
Signed-off-by: NeilBrown <[email protected]>
Signed-off-by: Shaohua Li <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
drivers/md/md.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index e529cef5483a8..b942c74f1ce83 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -8736,6 +8736,18 @@ static void md_start_sync(struct work_struct *ws)
*/
void md_check_recovery(struct mddev *mddev)
{
+ if (test_bit(MD_ALLOW_SB_UPDATE, &mddev->flags) && mddev->sb_flags) {
+ /* Write superblock - thread that called mddev_suspend()
+ * holds reconfig_mutex for us.
+ */
+ set_bit(MD_UPDATING_SB, &mddev->flags);
+ smp_mb__after_atomic();
+ if (test_bit(MD_ALLOW_SB_UPDATE, &mddev->flags))
+ md_update_sb(mddev, 0);
+ clear_bit_unlock(MD_UPDATING_SB, &mddev->flags);
+ wake_up(&mddev->sb_wait);
+ }
+
if (mddev->suspended)
return;

@@ -8896,16 +8908,6 @@ void md_check_recovery(struct mddev *mddev)
unlock:
wake_up(&mddev->sb_wait);
mddev_unlock(mddev);
- } else if (test_bit(MD_ALLOW_SB_UPDATE, &mddev->flags) && mddev->sb_flags) {
- /* Write superblock - thread that called mddev_suspend()
- * holds reconfig_mutex for us.
- */
- set_bit(MD_UPDATING_SB, &mddev->flags);
- smp_mb__after_atomic();
- if (test_bit(MD_ALLOW_SB_UPDATE, &mddev->flags))
- md_update_sb(mddev, 0);
- clear_bit_unlock(MD_UPDATING_SB, &mddev->flags);
- wake_up(&mddev->sb_wait);
}
}
EXPORT_SYMBOL(md_check_recovery);
--
2.20.1



2019-11-22 11:19:15

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 4.14 088/122] mmc: tmio: Fix SCC error detection

From: Masaharu Hayakawa <[email protected]>

[ Upstream commit b85fb0a1c8aeaaa40d08945d51a6656b512173f0 ]

SDR104, HS200 and HS400 need to check for SCC error. If SCC error is
detected, retuning is necessary.

Signed-off-by: Masaharu Hayakawa <[email protected]>
[Niklas: update commit message]
Signed-off-by: Niklas Söderlund <[email protected]>
Reviewed-by: Wolfram Sang <[email protected]>
Tested-by: Wolfram Sang <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
drivers/mmc/host/tmio_mmc_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index 2437fcde915a7..01e51b7945750 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -914,8 +914,8 @@ static void tmio_mmc_finish_request(struct tmio_mmc_host *host)
if (mrq->cmd->error || (mrq->data && mrq->data->error))
tmio_mmc_abort_dma(host);

- if (host->check_scc_error)
- host->check_scc_error(host);
+ if (host->check_scc_error && host->check_scc_error(host))
+ mrq->cmd->error = -EILSEQ;

/* If SET_BLOCK_COUNT, continue with main command */
if (host->mrq && !mrq->cmd->error) {
--
2.20.1



2019-11-22 11:19:22

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 4.14 019/122] iommu/io-pgtable-arm: Fix race handling in split_blk_unmap()

From: Robin Murphy <[email protected]>

[ Upstream commit 85c7a0f1ef624ef58173ef52ea77780257bdfe04 ]

In removing the pagetable-wide lock, we gained the possibility of the
vanishingly unlikely case where we have a race between two concurrent
unmappers splitting the same block entry. The logic to handle this is
fairly straightforward - whoever loses the race frees their partial
next-level table and instead dereferences the winner's newly-installed
entry in order to fall back to a regular unmap, which intentionally
echoes the pre-existing case of recursively splitting a 1GB block down
to 4KB pages by installing a full table of 2MB blocks first.

Unfortunately, the chump who implemented that logic failed to update the
condition check for that fallback, meaning that if said race occurs at
the last level (where the loser's unmap_idx is valid) then the unmap
won't actually happen. Fix that to properly account for both the race
and recursive cases.

Fixes: 2c3d273eabe8 ("iommu/io-pgtable-arm: Support lockless operation")
Signed-off-by: Robin Murphy <[email protected]>
[will: re-jig control flow to avoid duplicate cmpxchg test]
Signed-off-by: Will Deacon <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
drivers/iommu/io-pgtable-arm.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c
index e8018a308868e..17a9225283dd1 100644
--- a/drivers/iommu/io-pgtable-arm.c
+++ b/drivers/iommu/io-pgtable-arm.c
@@ -551,13 +551,12 @@ static int arm_lpae_split_blk_unmap(struct arm_lpae_io_pgtable *data,
return 0;

tablep = iopte_deref(pte, data);
+ } else if (unmap_idx >= 0) {
+ io_pgtable_tlb_add_flush(&data->iop, iova, size, size, true);
+ return size;
}

- if (unmap_idx < 0)
- return __arm_lpae_unmap(data, iova, size, lvl, tablep);
-
- io_pgtable_tlb_add_flush(&data->iop, iova, size, size, true);
- return size;
+ return __arm_lpae_unmap(data, iova, size, lvl, tablep);
}

static int __arm_lpae_unmap(struct arm_lpae_io_pgtable *data,
--
2.20.1



2019-11-22 11:20:00

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 4.14 008/122] arm64: uaccess: Ensure PAN is re-enabled after unhandled uaccess fault

From: Pavel Tatashin <[email protected]>

commit 94bb804e1e6f0a9a77acf20d7c70ea141c6c821e upstream.

A number of our uaccess routines ('__arch_clear_user()' and
'__arch_copy_{in,from,to}_user()') fail to re-enable PAN if they
encounter an unhandled fault whilst accessing userspace.

For CPUs implementing both hardware PAN and UAO, this bug has no effect
when both extensions are in use by the kernel.

For CPUs implementing hardware PAN but not UAO, this means that a kernel
using hardware PAN may execute portions of code with PAN inadvertently
disabled, opening us up to potential security vulnerabilities that rely
on userspace access from within the kernel which would usually be
prevented by this mechanism. In other words, parts of the kernel run the
same way as they would on a CPU without PAN implemented/emulated at all.

For CPUs not implementing hardware PAN and instead relying on software
emulation via 'CONFIG_ARM64_SW_TTBR0_PAN=y', the impact is unfortunately
much worse. Calling 'schedule()' with software PAN disabled means that
the next task will execute in the kernel using the page-table and ASID
of the previous process even after 'switch_mm()', since the actual
hardware switch is deferred until return to userspace. At this point, or
if there is a intermediate call to 'uaccess_enable()', the page-table
and ASID of the new process are installed. Sadly, due to the changes
introduced by KPTI, this is not an atomic operation and there is a very
small window (two instructions) where the CPU is configured with the
page-table of the old task and the ASID of the new task; a speculative
access in this state is disastrous because it would corrupt the TLB
entries for the new task with mappings from the previous address space.

As Pavel explains:

| I was able to reproduce memory corruption problem on Broadcom's SoC
| ARMv8-A like this:
|
| Enable software perf-events with PERF_SAMPLE_CALLCHAIN so userland's
| stack is accessed and copied.
|
| The test program performed the following on every CPU and forking
| many processes:
|
| unsigned long *map = mmap(NULL, PAGE_SIZE, PROT_READ|PROT_WRITE,
| MAP_SHARED | MAP_ANONYMOUS, -1, 0);
| map[0] = getpid();
| sched_yield();
| if (map[0] != getpid()) {
| fprintf(stderr, "Corruption detected!");
| }
| munmap(map, PAGE_SIZE);
|
| From time to time I was getting map[0] to contain pid for a
| different process.

Ensure that PAN is re-enabled when returning after an unhandled user
fault from our uaccess routines.

Cc: Catalin Marinas <[email protected]>
Reviewed-by: Mark Rutland <[email protected]>
Tested-by: Mark Rutland <[email protected]>
Cc: <[email protected]>
Fixes: 338d4f49d6f7 ("arm64: kernel: Add support for Privileged Access Never")
Signed-off-by: Pavel Tatashin <[email protected]>
[will: rewrote commit message]
Signed-off-by: Will Deacon <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
arch/arm64/lib/clear_user.S | 1 +
arch/arm64/lib/copy_from_user.S | 1 +
arch/arm64/lib/copy_in_user.S | 1 +
arch/arm64/lib/copy_to_user.S | 1 +
4 files changed, 4 insertions(+)

--- a/arch/arm64/lib/clear_user.S
+++ b/arch/arm64/lib/clear_user.S
@@ -57,5 +57,6 @@ ENDPROC(__arch_clear_user)
.section .fixup,"ax"
.align 2
9: mov x0, x2 // return the original size
+ uaccess_disable_not_uao x2, x3
ret
.previous
--- a/arch/arm64/lib/copy_from_user.S
+++ b/arch/arm64/lib/copy_from_user.S
@@ -75,5 +75,6 @@ ENDPROC(__arch_copy_from_user)
.section .fixup,"ax"
.align 2
9998: sub x0, end, dst // bytes not copied
+ uaccess_disable_not_uao x3, x4
ret
.previous
--- a/arch/arm64/lib/copy_in_user.S
+++ b/arch/arm64/lib/copy_in_user.S
@@ -77,5 +77,6 @@ ENDPROC(__arch_copy_in_user)
.section .fixup,"ax"
.align 2
9998: sub x0, end, dst // bytes not copied
+ uaccess_disable_not_uao x3, x4
ret
.previous
--- a/arch/arm64/lib/copy_to_user.S
+++ b/arch/arm64/lib/copy_to_user.S
@@ -74,5 +74,6 @@ ENDPROC(__arch_copy_to_user)
.section .fixup,"ax"
.align 2
9998: sub x0, end, dst // bytes not copied
+ uaccess_disable_not_uao x3, x4
ret
.previous


2019-11-22 11:20:00

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 4.14 010/122] net: ovs: fix return type of ndo_start_xmit function

From: YueHaibing <[email protected]>

[ Upstream commit eddf11e18dff0e8671e06ce54e64cfc843303ab9 ]

The method ndo_start_xmit() is defined as returning an 'netdev_tx_t',
which is a typedef for an enum type, so make sure the implementation in
this driver has returns 'netdev_tx_t' value, and change the function
return type to netdev_tx_t.

Found by coccinelle.

Signed-off-by: YueHaibing <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
net/openvswitch/vport-internal_dev.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c
index 1c09ad457d2a9..1083b5e901349 100644
--- a/net/openvswitch/vport-internal_dev.c
+++ b/net/openvswitch/vport-internal_dev.c
@@ -44,7 +44,8 @@ static struct internal_dev *internal_dev_priv(struct net_device *netdev)
}

/* Called with rcu_read_lock_bh. */
-static int internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev)
+static netdev_tx_t
+internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev)
{
int len, err;

@@ -63,7 +64,7 @@ static int internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev)
} else {
netdev->stats.tx_errors++;
}
- return 0;
+ return NETDEV_TX_OK;
}

static int internal_dev_open(struct net_device *netdev)
--
2.20.1



2019-11-22 11:20:05

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 4.14 009/122] fbdev: Ditch fb_edid_add_monspecs

From: Daniel Vetter <[email protected]>

commit 3b8720e63f4a1fc6f422a49ecbaa3b59c86d5aaf upstream.

It's dead code ever since

commit 34280340b1dc74c521e636f45cd728f9abf56ee2
Author: Geert Uytterhoeven <[email protected]>
Date: Fri Dec 4 17:01:43 2015 +0100

fbdev: Remove unused SH-Mobile HDMI driver

Also with this gone we can remove the cea_modes db. This entire thing
is massively incomplete anyway, compared to the CEA parsing that
drm_edid.c does.

Acked-by: Linus Torvalds <[email protected]>
Cc: Tavis Ormandy <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/video/fbdev/core/fbmon.c | 95 --------------------------------------
drivers/video/fbdev/core/modedb.c | 57 ----------------------
include/linux/fb.h | 3 -
3 files changed, 155 deletions(-)

--- a/drivers/video/fbdev/core/fbmon.c
+++ b/drivers/video/fbdev/core/fbmon.c
@@ -997,97 +997,6 @@ void fb_edid_to_monspecs(unsigned char *
DPRINTK("========================================\n");
}

-/**
- * fb_edid_add_monspecs() - add monitor video modes from E-EDID data
- * @edid: 128 byte array with an E-EDID block
- * @spacs: monitor specs to be extended
- */
-void fb_edid_add_monspecs(unsigned char *edid, struct fb_monspecs *specs)
-{
- unsigned char *block;
- struct fb_videomode *m;
- int num = 0, i;
- u8 svd[64], edt[(128 - 4) / DETAILED_TIMING_DESCRIPTION_SIZE];
- u8 pos = 4, svd_n = 0;
-
- if (!edid)
- return;
-
- if (!edid_checksum(edid))
- return;
-
- if (edid[0] != 0x2 ||
- edid[2] < 4 || edid[2] > 128 - DETAILED_TIMING_DESCRIPTION_SIZE)
- return;
-
- DPRINTK(" Short Video Descriptors\n");
-
- while (pos < edid[2]) {
- u8 len = edid[pos] & 0x1f, type = (edid[pos] >> 5) & 7;
- pr_debug("Data block %u of %u bytes\n", type, len);
- if (type == 2) {
- for (i = pos; i < pos + len; i++) {
- u8 idx = edid[pos + i] & 0x7f;
- svd[svd_n++] = idx;
- pr_debug("N%sative mode #%d\n",
- edid[pos + i] & 0x80 ? "" : "on-n", idx);
- }
- } else if (type == 3 && len >= 3) {
- /* Check Vendor Specific Data Block. For HDMI,
- it is always 00-0C-03 for HDMI Licensing, LLC. */
- if (edid[pos + 1] == 3 && edid[pos + 2] == 0xc &&
- edid[pos + 3] == 0)
- specs->misc |= FB_MISC_HDMI;
- }
- pos += len + 1;
- }
-
- block = edid + edid[2];
-
- DPRINTK(" Extended Detailed Timings\n");
-
- for (i = 0; i < (128 - edid[2]) / DETAILED_TIMING_DESCRIPTION_SIZE;
- i++, block += DETAILED_TIMING_DESCRIPTION_SIZE)
- if (PIXEL_CLOCK != 0)
- edt[num++] = block - edid;
-
- /* Yikes, EDID data is totally useless */
- if (!(num + svd_n))
- return;
-
- m = kzalloc((specs->modedb_len + num + svd_n) *
- sizeof(struct fb_videomode), GFP_KERNEL);
-
- if (!m)
- return;
-
- memcpy(m, specs->modedb, specs->modedb_len * sizeof(struct fb_videomode));
-
- for (i = specs->modedb_len; i < specs->modedb_len + num; i++) {
- get_detailed_timing(edid + edt[i - specs->modedb_len], &m[i]);
- if (i == specs->modedb_len)
- m[i].flag |= FB_MODE_IS_FIRST;
- pr_debug("Adding %ux%u@%u\n", m[i].xres, m[i].yres, m[i].refresh);
- }
-
- for (i = specs->modedb_len + num; i < specs->modedb_len + num + svd_n; i++) {
- int idx = svd[i - specs->modedb_len - num];
- if (!idx || idx >= ARRAY_SIZE(cea_modes)) {
- pr_warn("Reserved SVD code %d\n", idx);
- } else if (!cea_modes[idx].xres) {
- pr_warn("Unimplemented SVD code %d\n", idx);
- } else {
- memcpy(&m[i], cea_modes + idx, sizeof(m[i]));
- pr_debug("Adding SVD #%d: %ux%u@%u\n", idx,
- m[i].xres, m[i].yres, m[i].refresh);
- }
- }
-
- kfree(specs->modedb);
- specs->modedb = m;
- specs->modedb_len = specs->modedb_len + num + svd_n;
-}
-
/*
* VESA Generalized Timing Formula (GTF)
*/
@@ -1497,9 +1406,6 @@ int fb_parse_edid(unsigned char *edid, s
void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs)
{
}
-void fb_edid_add_monspecs(unsigned char *edid, struct fb_monspecs *specs)
-{
-}
void fb_destroy_modedb(struct fb_videomode *modedb)
{
}
@@ -1607,7 +1513,6 @@ EXPORT_SYMBOL(fb_firmware_edid);

EXPORT_SYMBOL(fb_parse_edid);
EXPORT_SYMBOL(fb_edid_to_monspecs);
-EXPORT_SYMBOL(fb_edid_add_monspecs);
EXPORT_SYMBOL(fb_get_mode);
EXPORT_SYMBOL(fb_validate_mode);
EXPORT_SYMBOL(fb_destroy_modedb);
--- a/drivers/video/fbdev/core/modedb.c
+++ b/drivers/video/fbdev/core/modedb.c
@@ -289,63 +289,6 @@ static const struct fb_videomode modedb[
};

#ifdef CONFIG_FB_MODE_HELPERS
-const struct fb_videomode cea_modes[65] = {
- /* #1: [email protected]/60Hz */
- [1] = {
- NULL, 60, 640, 480, 39722, 48, 16, 33, 10, 96, 2, 0,
- FB_VMODE_NONINTERLACED, 0,
- },
- /* #3: [email protected]/60Hz */
- [3] = {
- NULL, 60, 720, 480, 37037, 60, 16, 30, 9, 62, 6, 0,
- FB_VMODE_NONINTERLACED, 0,
- },
- /* #5: [email protected]/60Hz */
- [5] = {
- NULL, 60, 1920, 1080, 13763, 148, 88, 15, 2, 44, 5,
- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
- FB_VMODE_INTERLACED, 0,
- },
- /* #7: 720(1440)[email protected]/60Hz */
- [7] = {
- NULL, 60, 1440, 480, 18554/*37108*/, 114, 38, 15, 4, 124, 3, 0,
- FB_VMODE_INTERLACED, 0,
- },
- /* #9: 720(1440)[email protected]/60Hz */
- [9] = {
- NULL, 60, 1440, 240, 18554, 114, 38, 16, 4, 124, 3, 0,
- FB_VMODE_NONINTERLACED, 0,
- },
- /* #18: 720x576pH@50Hz */
- [18] = {
- NULL, 50, 720, 576, 37037, 68, 12, 39, 5, 64, 5, 0,
- FB_VMODE_NONINTERLACED, 0,
- },
- /* #19: 1280x720p@50Hz */
- [19] = {
- NULL, 50, 1280, 720, 13468, 220, 440, 20, 5, 40, 5,
- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
- FB_VMODE_NONINTERLACED, 0,
- },
- /* #20: 1920x1080i@50Hz */
- [20] = {
- NULL, 50, 1920, 1080, 13480, 148, 528, 15, 5, 528, 5,
- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
- FB_VMODE_INTERLACED, 0,
- },
- /* #32: [email protected]/24Hz */
- [32] = {
- NULL, 24, 1920, 1080, 13468, 148, 638, 36, 4, 44, 5,
- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
- FB_VMODE_NONINTERLACED, 0,
- },
- /* #35: (2880)[email protected]/60Hz */
- [35] = {
- NULL, 60, 2880, 480, 9250, 240, 64, 30, 9, 248, 6, 0,
- FB_VMODE_NONINTERLACED, 0,
- },
-};
-
const struct fb_videomode vesa_modes[] = {
/* 0 640x350-85 VESA */
{ NULL, 85, 640, 350, 31746, 96, 32, 60, 32, 64, 3,
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -725,8 +725,6 @@ extern int fb_parse_edid(unsigned char *
extern const unsigned char *fb_firmware_edid(struct device *device);
extern void fb_edid_to_monspecs(unsigned char *edid,
struct fb_monspecs *specs);
-extern void fb_edid_add_monspecs(unsigned char *edid,
- struct fb_monspecs *specs);
extern void fb_destroy_modedb(struct fb_videomode *modedb);
extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb);
extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter);
@@ -800,7 +798,6 @@ struct dmt_videomode {

extern const char *fb_mode_option;
extern const struct fb_videomode vesa_modes[];
-extern const struct fb_videomode cea_modes[65];
extern const struct dmt_videomode dmt_modes[];

struct fb_modelist {


2019-11-22 11:20:08

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 4.14 052/122] ixgbe: Fix crash with VFs and flow director on interface flap

From: Radoslaw Tyl <[email protected]>

[ Upstream commit 5d826d209164b0752c883607be4cdbbcf7cab494 ]

This patch fix crash when we have restore flow director filters after reset
adapter. In ixgbe_fdir_filter_restore() filter->action is outside of the
rx_ring array, as it has a VF identifier in the upper 32 bits.

Signed-off-by: Radoslaw Tyl <[email protected]>
Tested-by: Andrew Bowers <[email protected]>
Signed-off-by: Jeff Kirsher <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index d1472727ef882..4801d96c4fa91 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -5129,6 +5129,7 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter)
struct ixgbe_hw *hw = &adapter->hw;
struct hlist_node *node2;
struct ixgbe_fdir_filter *filter;
+ u64 action;

spin_lock(&adapter->fdir_perfect_lock);

@@ -5137,12 +5138,17 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter)

hlist_for_each_entry_safe(filter, node2,
&adapter->fdir_filter_list, fdir_node) {
+ action = filter->action;
+ if (action != IXGBE_FDIR_DROP_QUEUE && action != 0)
+ action =
+ (action >> ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF) - 1;
+
ixgbe_fdir_write_perfect_filter_82599(hw,
&filter->filter,
filter->sw_idx,
- (filter->action == IXGBE_FDIR_DROP_QUEUE) ?
+ (action == IXGBE_FDIR_DROP_QUEUE) ?
IXGBE_FDIR_DROP_QUEUE :
- adapter->rx_ring[filter->action]->reg_idx);
+ adapter->rx_ring[action]->reg_idx);
}

spin_unlock(&adapter->fdir_perfect_lock);
--
2.20.1



2019-11-22 11:21:13

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 4.14 022/122] ath10k: fix vdev-start timeout on error

From: Ben Greear <[email protected]>

[ Upstream commit 833fd34d743c728afe6d127ef7bee67e7d9199a8 ]

The vdev-start-response message should cause the
completion to fire, even in the error case. Otherwise,
the user still gets no useful information and everything
is blocked until the timeout period.

Add some warning text to print out the invalid status
code to aid debugging, and propagate failure code.

Signed-off-by: Ben Greear <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
drivers/net/wireless/ath/ath10k/core.h | 1 +
drivers/net/wireless/ath/ath10k/mac.c | 2 +-
drivers/net/wireless/ath/ath10k/wmi.c | 19 ++++++++++++++++---
drivers/net/wireless/ath/ath10k/wmi.h | 8 +++++++-
4 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 949ebb3e967bb..be9ec265dfe55 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -881,6 +881,7 @@ struct ath10k {

struct completion install_key_done;

+ int last_wmi_vdev_start_status;
struct completion vdev_setup_done;

struct workqueue_struct *workqueue;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 8c4bb56c262f6..dff34448588f0 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -955,7 +955,7 @@ static inline int ath10k_vdev_setup_sync(struct ath10k *ar)
if (time_left == 0)
return -ETIMEDOUT;

- return 0;
+ return ar->last_wmi_vdev_start_status;
}

static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id)
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 4d6c2986c40dd..25f51ca060934 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -3133,18 +3133,31 @@ void ath10k_wmi_event_vdev_start_resp(struct ath10k *ar, struct sk_buff *skb)
{
struct wmi_vdev_start_ev_arg arg = {};
int ret;
+ u32 status;

ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_START_RESP_EVENTID\n");

+ ar->last_wmi_vdev_start_status = 0;
+
ret = ath10k_wmi_pull_vdev_start(ar, skb, &arg);
if (ret) {
ath10k_warn(ar, "failed to parse vdev start event: %d\n", ret);
- return;
+ ar->last_wmi_vdev_start_status = ret;
+ goto out;
}

- if (WARN_ON(__le32_to_cpu(arg.status)))
- return;
+ status = __le32_to_cpu(arg.status);
+ if (WARN_ON_ONCE(status)) {
+ ath10k_warn(ar, "vdev-start-response reports status error: %d (%s)\n",
+ status, (status == WMI_VDEV_START_CHAN_INVALID) ?
+ "chan-invalid" : "unknown");
+ /* Setup is done one way or another though, so we should still
+ * do the completion, so don't return here.
+ */
+ ar->last_wmi_vdev_start_status = -EINVAL;
+ }

+out:
complete(&ar->vdev_setup_done);
}

diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index d0e05aa437e36..947b74c64fec0 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -6480,11 +6480,17 @@ struct wmi_ch_info_ev_arg {
__le32 rx_frame_count;
};

+/* From 10.4 firmware, not sure all have the same values. */
+enum wmi_vdev_start_status {
+ WMI_VDEV_START_OK = 0,
+ WMI_VDEV_START_CHAN_INVALID,
+};
+
struct wmi_vdev_start_ev_arg {
__le32 vdev_id;
__le32 req_id;
__le32 resp_type; /* %WMI_VDEV_RESP_ */
- __le32 status;
+ __le32 status; /* See wmi_vdev_start_status enum above */
};

struct wmi_peer_kick_ev_arg {
--
2.20.1



2019-11-22 12:28:24

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 4.14 098/122] printk: Give error on attempt to set log buffer length to over 2G

From: He Zhe <[email protected]>

[ Upstream commit e6fe3e5b7d16e8f146a4ae7fe481bc6e97acde1e ]

The current printk() is ready to handle log buffer size up to 2G.
Give an explicit error for users who want to use larger log buffer.

Also fix printk formatting to show the 2G as a positive number.

Link: http://lkml.kernel.org/r/[email protected]
Cc: [email protected]
Cc: [email protected]
Suggested-by: Sergey Senozhatsky <[email protected]>
Signed-off-by: He Zhe <[email protected]>
Reviewed-by: Sergey Senozhatsky <[email protected]>
[pmladek: Fixed to the really safe limit 2GB.]
Signed-off-by: Petr Mladek <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
kernel/printk/printk.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 5aa96098c64d3..5b33c14ab8b25 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -432,6 +432,7 @@ static u32 clear_idx;
/* record buffer */
#define LOG_ALIGN __alignof__(struct printk_log)
#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)
+#define LOG_BUF_LEN_MAX (u32)(1 << 31)
static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN);
static char *log_buf = __log_buf;
static u32 log_buf_len = __LOG_BUF_LEN;
@@ -1032,18 +1033,23 @@ void log_buf_vmcoreinfo_setup(void)
static unsigned long __initdata new_log_buf_len;

/* we practice scaling the ring buffer by powers of 2 */
-static void __init log_buf_len_update(unsigned size)
+static void __init log_buf_len_update(u64 size)
{
+ if (size > (u64)LOG_BUF_LEN_MAX) {
+ size = (u64)LOG_BUF_LEN_MAX;
+ pr_err("log_buf over 2G is not supported.\n");
+ }
+
if (size)
size = roundup_pow_of_two(size);
if (size > log_buf_len)
- new_log_buf_len = size;
+ new_log_buf_len = (unsigned long)size;
}

/* save requested log_buf_len since it's too early to process it */
static int __init log_buf_len_setup(char *str)
{
- unsigned int size;
+ u64 size;

if (!str)
return -EINVAL;
@@ -1113,7 +1119,7 @@ void __init setup_log_buf(int early)
}

if (unlikely(!new_log_buf)) {
- pr_err("log_buf_len: %ld bytes not available\n",
+ pr_err("log_buf_len: %lu bytes not available\n",
new_log_buf_len);
return;
}
@@ -1126,8 +1132,8 @@ void __init setup_log_buf(int early)
memcpy(log_buf, __log_buf, __LOG_BUF_LEN);
logbuf_unlock_irqrestore(flags);

- pr_info("log_buf_len: %d bytes\n", log_buf_len);
- pr_info("early log buf free: %d(%d%%)\n",
+ pr_info("log_buf_len: %u bytes\n", log_buf_len);
+ pr_info("early log buf free: %u(%u%%)\n",
free, (free * 100) / __LOG_BUF_LEN);
}

--
2.20.1



2019-11-22 12:31:51

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 4.14 040/122] powerpc/pseries: Fix how we iterate over the DTL entries

From: Naveen N. Rao <[email protected]>

[ Upstream commit 9258227e9dd1da8feddb07ad9702845546a581c9 ]

When CONFIG_VIRT_CPU_ACCOUNTING_NATIVE is not set, we look up dtl_idx in
the lppaca to determine the number of entries in the buffer. Since
lppaca is in big endian, we need to do an endian conversion before using
this in our calculation to determine the number of entries in the
buffer. Without this, we do not iterate over the existing entries in the
DTL buffer properly.

Fixes: 7c105b63bd98 ("powerpc: Add CONFIG_CPU_LITTLE_ENDIAN kernel config option.")
Signed-off-by: Naveen N. Rao <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
arch/powerpc/platforms/pseries/dtl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/dtl.c b/arch/powerpc/platforms/pseries/dtl.c
index c762689e0eb33..ef6595153642e 100644
--- a/arch/powerpc/platforms/pseries/dtl.c
+++ b/arch/powerpc/platforms/pseries/dtl.c
@@ -184,7 +184,7 @@ static void dtl_stop(struct dtl *dtl)

static u64 dtl_current_index(struct dtl *dtl)
{
- return lppaca_of(dtl->cpu).dtl_idx;
+ return be64_to_cpu(lppaca_of(dtl->cpu).dtl_idx);
}
#endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */

--
2.20.1



2019-11-22 12:32:03

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 4.14 017/122] SUNRPC: Fix priority queue fairness

From: Trond Myklebust <[email protected]>

[ Upstream commit f42f7c283078ce3c1e8368b140e270755b1ae313 ]

Fix up the priority queue to not batch by owner, but by queue, so that
we allow '1 << priority' elements to be dequeued before switching to
the next priority queue.
The owner field is still used to wake up requests in round robin order
by owner to avoid single processes hogging the RPC layer by loading the
queues.

Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
include/linux/sunrpc/sched.h | 2 -
net/sunrpc/sched.c | 109 +++++++++++++++++------------------
2 files changed, 54 insertions(+), 57 deletions(-)

diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index d96e74e114c06..c9548a63d09bb 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -188,7 +188,6 @@ struct rpc_timer {
struct rpc_wait_queue {
spinlock_t lock;
struct list_head tasks[RPC_NR_PRIORITY]; /* task queue for each priority level */
- pid_t owner; /* process id of last task serviced */
unsigned char maxpriority; /* maximum priority (0 if queue is not a priority queue) */
unsigned char priority; /* current priority */
unsigned char nr; /* # tasks remaining for cookie */
@@ -204,7 +203,6 @@ struct rpc_wait_queue {
* from a single cookie. The aim is to improve
* performance of NFS operations such as read/write.
*/
-#define RPC_BATCH_COUNT 16
#define RPC_IS_PRIORITY(q) ((q)->maxpriority > 0)

/*
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index f9db5fe52d367..aff76fb434300 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -99,64 +99,78 @@ __rpc_add_timer(struct rpc_wait_queue *queue, struct rpc_task *task)
list_add(&task->u.tk_wait.timer_list, &queue->timer_list.list);
}

-static void rpc_rotate_queue_owner(struct rpc_wait_queue *queue)
-{
- struct list_head *q = &queue->tasks[queue->priority];
- struct rpc_task *task;
-
- if (!list_empty(q)) {
- task = list_first_entry(q, struct rpc_task, u.tk_wait.list);
- if (task->tk_owner == queue->owner)
- list_move_tail(&task->u.tk_wait.list, q);
- }
-}
-
static void rpc_set_waitqueue_priority(struct rpc_wait_queue *queue, int priority)
{
if (queue->priority != priority) {
- /* Fairness: rotate the list when changing priority */
- rpc_rotate_queue_owner(queue);
queue->priority = priority;
+ queue->nr = 1U << priority;
}
}

-static void rpc_set_waitqueue_owner(struct rpc_wait_queue *queue, pid_t pid)
-{
- queue->owner = pid;
- queue->nr = RPC_BATCH_COUNT;
-}
-
static void rpc_reset_waitqueue_priority(struct rpc_wait_queue *queue)
{
rpc_set_waitqueue_priority(queue, queue->maxpriority);
- rpc_set_waitqueue_owner(queue, 0);
}

/*
- * Add new request to a priority queue.
+ * Add a request to a queue list
*/
-static void __rpc_add_wait_queue_priority(struct rpc_wait_queue *queue,
- struct rpc_task *task,
- unsigned char queue_priority)
+static void
+__rpc_list_enqueue_task(struct list_head *q, struct rpc_task *task)
{
- struct list_head *q;
struct rpc_task *t;

- INIT_LIST_HEAD(&task->u.tk_wait.links);
- if (unlikely(queue_priority > queue->maxpriority))
- queue_priority = queue->maxpriority;
- if (queue_priority > queue->priority)
- rpc_set_waitqueue_priority(queue, queue_priority);
- q = &queue->tasks[queue_priority];
list_for_each_entry(t, q, u.tk_wait.list) {
if (t->tk_owner == task->tk_owner) {
- list_add_tail(&task->u.tk_wait.list, &t->u.tk_wait.links);
+ list_add_tail(&task->u.tk_wait.links,
+ &t->u.tk_wait.links);
+ /* Cache the queue head in task->u.tk_wait.list */
+ task->u.tk_wait.list.next = q;
+ task->u.tk_wait.list.prev = NULL;
return;
}
}
+ INIT_LIST_HEAD(&task->u.tk_wait.links);
list_add_tail(&task->u.tk_wait.list, q);
}

+/*
+ * Remove request from a queue list
+ */
+static void
+__rpc_list_dequeue_task(struct rpc_task *task)
+{
+ struct list_head *q;
+ struct rpc_task *t;
+
+ if (task->u.tk_wait.list.prev == NULL) {
+ list_del(&task->u.tk_wait.links);
+ return;
+ }
+ if (!list_empty(&task->u.tk_wait.links)) {
+ t = list_first_entry(&task->u.tk_wait.links,
+ struct rpc_task,
+ u.tk_wait.links);
+ /* Assume __rpc_list_enqueue_task() cached the queue head */
+ q = t->u.tk_wait.list.next;
+ list_add_tail(&t->u.tk_wait.list, q);
+ list_del(&task->u.tk_wait.links);
+ }
+ list_del(&task->u.tk_wait.list);
+}
+
+/*
+ * Add new request to a priority queue.
+ */
+static void __rpc_add_wait_queue_priority(struct rpc_wait_queue *queue,
+ struct rpc_task *task,
+ unsigned char queue_priority)
+{
+ if (unlikely(queue_priority > queue->maxpriority))
+ queue_priority = queue->maxpriority;
+ __rpc_list_enqueue_task(&queue->tasks[queue_priority], task);
+}
+
/*
* Add new request to wait queue.
*
@@ -194,13 +208,7 @@ static void __rpc_add_wait_queue(struct rpc_wait_queue *queue,
*/
static void __rpc_remove_wait_queue_priority(struct rpc_task *task)
{
- struct rpc_task *t;
-
- if (!list_empty(&task->u.tk_wait.links)) {
- t = list_entry(task->u.tk_wait.links.next, struct rpc_task, u.tk_wait.list);
- list_move(&t->u.tk_wait.list, &task->u.tk_wait.list);
- list_splice_init(&task->u.tk_wait.links, &t->u.tk_wait.links);
- }
+ __rpc_list_dequeue_task(task);
}

/*
@@ -212,7 +220,8 @@ static void __rpc_remove_wait_queue(struct rpc_wait_queue *queue, struct rpc_tas
__rpc_disable_timer(queue, task);
if (RPC_IS_PRIORITY(queue))
__rpc_remove_wait_queue_priority(task);
- list_del(&task->u.tk_wait.list);
+ else
+ list_del(&task->u.tk_wait.list);
queue->qlen--;
dprintk("RPC: %5u removed from queue %p \"%s\"\n",
task->tk_pid, queue, rpc_qname(queue));
@@ -481,17 +490,9 @@ static struct rpc_task *__rpc_find_next_queued_priority(struct rpc_wait_queue *q
* Service a batch of tasks from a single owner.
*/
q = &queue->tasks[queue->priority];
- if (!list_empty(q)) {
- task = list_entry(q->next, struct rpc_task, u.tk_wait.list);
- if (queue->owner == task->tk_owner) {
- if (--queue->nr)
- goto out;
- list_move_tail(&task->u.tk_wait.list, q);
- }
- /*
- * Check if we need to switch queues.
- */
- goto new_owner;
+ if (!list_empty(q) && --queue->nr) {
+ task = list_first_entry(q, struct rpc_task, u.tk_wait.list);
+ goto out;
}

/*
@@ -503,7 +504,7 @@ static struct rpc_task *__rpc_find_next_queued_priority(struct rpc_wait_queue *q
else
q = q - 1;
if (!list_empty(q)) {
- task = list_entry(q->next, struct rpc_task, u.tk_wait.list);
+ task = list_first_entry(q, struct rpc_task, u.tk_wait.list);
goto new_queue;
}
} while (q != &queue->tasks[queue->priority]);
@@ -513,8 +514,6 @@ static struct rpc_task *__rpc_find_next_queued_priority(struct rpc_wait_queue *q

new_queue:
rpc_set_waitqueue_priority(queue, (unsigned int)(q - &queue->tasks[0]));
-new_owner:
- rpc_set_waitqueue_owner(queue, task->tk_owner);
out:
return task;
}
--
2.20.1



2019-11-22 13:40:29

by Jon Hunter

[permalink] [raw]
Subject: Re: [PATCH 4.14 000/122] 4.14.156-stable review


On 22/11/2019 10:27, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.14.156 release.
> There are 122 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 Sun, 24 Nov 2019 09:59:19 +0000.
> Anything received after that time might be too late.
>
> The whole patch series can be found in one patch at:
> https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.156-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.14.y
> and the diffstat can be found below.
>
> thanks,
>
> greg k-h

All tests are passing for Tegra ...

Test results for stable-v4.14:
8 builds: 8 pass, 0 fail
16 boots: 16 pass, 0 fail
24 tests: 24 pass, 0 fail

Linux version: 4.14.156-rc1-gd40687ee9ee0
Boards tested: tegra124-jetson-tk1, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04

Cheers
Jon

--
nvpublic

2019-11-22 18:16:28

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH 4.14 000/122] 4.14.156-stable review

On Fri, Nov 22, 2019 at 11:27:33AM +0100, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.14.156 release.
> There are 122 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 Sun, 24 Nov 2019 09:59:19 +0000.
> Anything received after that time might be too late.
>

Results:
total: 172 pass: 172 fail: 0
Qemu test results:
total: 372 pass: 372 fail: 0

As already reported, there is a new suspicious RCU usage warning
in idr_get_next().

Guenter

2019-11-22 20:34:45

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH 4.14 000/122] 4.14.156-stable review

On 11/22/19 3:27 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.14.156 release.
> There are 122 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 Sun, 24 Nov 2019 09:59:19 +0000.
> Anything received after that time might be too late.
>
> The whole patch series can be found in one patch at:
> https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.156-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.14.y
> and the diffstat can be found below.
>
> thanks,
>
> greg k-h
>

Compiled and booted on my test system. No dmesg regressions.

thanks,
-- Shuah

2019-11-22 23:52:28

by Daniel Díaz

[permalink] [raw]
Subject: Re: [PATCH 4.14 000/122] 4.14.156-stable review

Hello!

On 11/22/19 4:27 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.14.156 release.
> There are 122 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 Sun, 24 Nov 2019 09:59:19 +0000.
> Anything received after that time might be too late.
>
> The whole patch series can be found in one patch at:
> https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.156-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.14.y
> and the diffstat can be found below.
>
> thanks,
>
> greg k-h

Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.

Summary
------------------------------------------------------------------------

kernel: 4.14.156-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.14.y
git commit: d40687ee9ee01c874516a9a510f5d6a56311bd83
git describe: v4.14.155-123-gd40687ee9ee0
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.14-oe/build/v4.14.155-123-gd40687ee9ee0


No regressions (compared to build v4.14.155)

No fixes (compared to build v4.14.155)

Ran 24510 total tests in the following environments and test suites.

Environments
--------------
- dragonboard-410c - arm64
- hi6220-hikey - arm64
- i386
- juno-r2 - arm64
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15 - arm
- x86_64

Test Suites
-----------
* build
* install-android-platform-tools-r2600
* kselftest
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-cpuhotplug-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* perf
* spectre-meltdown-checker-test
* v4l2-compliance
* network-basic-tests
* ltp-open-posix-tests
* kvm-unit-tests
* ssuite
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none


Greetings!

Daniel Díaz
[email protected]


--
Linaro LKFT
https://lkft.linaro.org