3.18.4-stable review
Subsystems (3)
Greg Kroah-Hartman
maintainercover 3.18.4-stable review
This is the start of the stable review cycle for the 3.18.4 release. There are 183 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 Tue Jan 27 18:07:34 UTC 2015. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.18.4-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.18.4-rc1
Bandan Das <[email protected]>
KVM: nVMX: Disable unrestricted mode if ept=0
Ville Syrjälä <[email protected]>
drm/i915: Kill check_power_well() calls
Nicholas Bellinger <[email protected]>
vhost-scsi: Add missing virtio-scsi -> TCM attribute conversion
Nicholas Bellinger <[email protected]>
target: Drop arbitrary maximum I/O size limit
Trond Myklebust <[email protected]>
LOCKD: Fix a race when initialising nlmsvc_timeout
Michal Marek <[email protected]>
kbuild: Fix removal of the debian/ directory
Daniel Borkmann <[email protected]>
x86, um: actually mark system call tables readonly
Richard Weinberger <[email protected]>
um: Skip futex_atomic_cmpxchg_inatomic() test
Dan Carpenter <[email protected]>
decompress_bunzip2: off by one in get_next_block()
Lars-Peter Clausen <[email protected]>
iio: ad799x: Fix ad7991/ad7995/ad7999 config setup
Mugunthan V N <[email protected]>
ARM: dts: dra7-evm: fix qspi device tree partition size
Geert Uytterhoeven <[email protected]>
ARM: shmobile: sh73a0 legacy: Set .control_parent for all irqpin instances
Jisheng Zhang <[email protected]>
ARM: dts: berlin: add broken-cd and set bus width for eMMC in Marvell DMP DT
Keerthy <[email protected]>
bus: omap_l3_noc: Correct returning IRQ_HANDLED unconditionally in the irq handler
Keerthy <[email protected]>
bus: omap_l3_noc: Add resume hook to restore context
Lennart Sorensen <[email protected]>
ARM: omap5/dra7xx: Enable booting secondary CPU in HYP mode
Lennart Sorensen <[email protected]>
ARM: omap5/dra7xx: Fix frequency typos
Gary Bisson <[email protected]>
ARM: clk-imx6q: fix video divider for rev T0 1.0
Dmitry Voytik <[email protected]>
ARM: imx6q: drop unnecessary semicolon
Fabio Estevam <[email protected]>
ARM: dts: imx51-babbage: Fix ULPI PHY reset modelling
Fabio Estevam <[email protected]>
ARM: dts: imx25: Fix the SPI1 clocks
Fabio Estevam <[email protected]>
ARM: imx6sx: Set PLL2 as parent of QSPI clocks
Nishanth Menon <[email protected]>
ARM: omap2plus_defconfig: use CONFIG_CPUFREQ_DT
Dmitry Torokhov <[email protected]>
Input: I8042 - add Acer Aspire 7738 to the nomux list
Srihari Vijayaraghavan <[email protected]>
Input: i8042 - reset keyboard to fix Elantech touchpad detection
Sam hung <[email protected]>
Input: elantech - support new ICs types for version 4
Ahmed S. Darwish <[email protected]>
can: kvaser_usb: Don't send a RESET_CHIP for non-existing channels
Ahmed S. Darwish <[email protected]>
can: kvaser_usb: Reset all URB tx contexts upon channel close
Ahmed S. Darwish <[email protected]>
can: kvaser_usb: Don't free packets when tight on URBs
Sebastian Andrzej Siewior <[email protected]>
usb: musb: stuff leak of struct usb_hcd
Alan Stern <[email protected]>
USB: EHCI: fix initialization bug in iso_stream_schedule()
Johan Hovold <[email protected]>
USB: console: fix potential use after free
Johan Hovold <[email protected]>
USB: console: fix uninitialised ldisc semaphore
Songjun Wu <[email protected]>
usb: gadget: udc: atmel: fix possible oops when unloading module
Bo Shen <[email protected]>
usb: gadget: udc: atmel: fix possible IN hang issue
Bo Shen <[email protected]>
usb: gadget: udc: atmel: change setting for DMA
Mario Schuknecht <[email protected]>
usb: gadget: gadgetfs: Free memory allocated by memdup_user()
Johan Hovold <[email protected]>
USB: keyspan: fix null-deref at probe
Reinhard Speyerer <[email protected]>
USB: qcserial/option: make AT URCs work for Sierra Wireless MC73xx
David Peterson <[email protected]>
USB: cp210x: add IDs for CEL USB sticks and MeshWorks devices
Preston Fick <[email protected]>
USB: cp210x: fix ID for production CEL MeshConnect USB Stick
Amit Virdi <[email protected]>
usb: dwc3: gadget: Stop TRB preparation after limit is reached
Amit Virdi <[email protected]>
usb: dwc3: gadget: Fix TRB preparation during SG
Arseny Solokha <[email protected]>
OHCI: add a quirk for ULi M5237 blocking on reset
Johan Hovold <[email protected]>
gpio: sysfs: fix gpio device-attribute leak
Johan Hovold <[email protected]>
gpio: sysfs: fix gpio-chip device-attribute leak
Johan Hovold <[email protected]>
gpio: fix sleep-while-atomic in gpiochip_remove
Johan Hovold <[email protected]>
gpio: fix memory leak and sleep-while-atomic
Johan Hovold <[email protected]>
gpio: fix memory and reference leaks in gpiochip_add error path
Aaron Lu <[email protected]>
gpio: crystalcove: use handle_nested_irq
Hans Holmberg <[email protected]>
gpiolib: of: Correct error handling in of_get_named_gpiod_flags
Johan Hovold <[email protected]>
pinctrl: lantiq: remove bogus of_gpio_chip_add
Jisheng Zhang <[email protected]>
ARM: dts: berlin: correct BG2Q's SM GPIO location.
Tyler Baker <[email protected]>
reset: sunxi: fix spinlock initialization
Hans de Goede <[email protected]>
uas: Add US_FL_NO_ATA_1X for 2 more Seagate disk enclosures
Hans de Goede <[email protected]>
uas: Add US_FL_NO_REPORT_OPCODES for JMicron JMS566 with usb-id 0bc2:a013
Hans de Goede <[email protected]>
uas: Add US_FL_NO_ATA_1X for Seagate devices with usb-id 0bc2:a013
Alexander Usyskin <[email protected]>
mei: clean reset bit before reset
Trond Myklebust <[email protected]>
NFSv4.1: Fix client id trunking on Linux
Steven Rostedt (Red Hat) <[email protected]>
ftrace: Check both notrace and filter for old hash
Steven Rostedt (Red Hat) <[email protected]>
ftrace: Fix updating of filters for shared global_ops filters
Steven Rostedt (Red Hat) <[email protected]>
ftrace/jprobes/x86: Fix conflict between jprobes and function graph tracing
Simon Guinot <[email protected]>
leds: netxbig: fix oops at probe time
Mugunthan V N <[email protected]>
drivers: net: cpsw: fix multicast flush in dual emac mode
Vasu Dev <[email protected]>
i40e: adds FCoE configure option
Eyal Shapira <[email protected]>
iwlwifi: mvm: fix Rx with both chains
Catalin Marinas <[email protected]>
arm64: partially revert "ARM: 8167/1: extend the reserved memory for initrd to be page aligned"
Tim Kryger <[email protected]>
mmc: sdhci: Set SDHCI_POWER_ON with external vmmc
Anton Blanchard <[email protected]>
powernv: Fix OPAL tracepoint code
NeilBrown <[email protected]>
locks: fix NULL-deref in generic_delete_lease
Wei Yang <[email protected]>
vfio-pci: Fix the check on pci device type in vfio_pci_probe()
Hans Verkuil <[email protected]>
vivid: fix CROP_BOUNDS typo for video output
James Hogan <[email protected]>
img-ir/hw: Fix potential deadlock stopping timer
Dylan Rajaratnam <[email protected]>
img-ir/hw: Always read data to clear buffer
Takashi Iwai <[email protected]>
uvcvideo: Fix destruction order in uvc_delete()
Mauro Carvalho Chehab <[email protected]>
sound: Update au0828 quirks table
Mauro Carvalho Chehab <[email protected]>
sound: simplify au0828 quirk table
Sakari Ailus <[email protected]>
smiapp: Take mutex during PLL update in sensor initialisation
Frank Schaefer <[email protected]>
af9005: fix kernel panic on init if compiled without IR
Sakari Ailus <[email protected]>
smiapp-pll: Correct clock debug prints
Tomi Valkeinen <[email protected]>
video/fbdev: fix defio's fsync
Tomi Valkeinen <[email protected]>
video/logo: prevent use of logos after they have been freed
Bjørn Mork <[email protected]>
x86/build: Clean auto-generated processor feature files
Felipe Balbi <[email protected]>
net: ethernet: cpsw: fix hangs with interrupts
Long Li <[email protected]>
storvsc: ring buffer failures may result in I/O freeze
James Bottomley <[email protected]>
serial: fix parisc boot hang
John David Anglin <[email protected]>
parisc: fix out-of-register compiler error in ldcw inline assembler function
zhendong chen <[email protected]>
dm: fix missed error code if .end_io isn't implemented by target_type
Mauro Carvalho Chehab <[email protected]>
bugon.cocci: fix Options at the macro
Jisheng Zhang <[email protected]>
ARM: dts: berlin: fix io clk and add missing core clk for BG2Q sdhci2 host
Boris Brezillon <[email protected]>
clk: at91: keep slow clk enabled to prevent system hang
Jisheng Zhang <[email protected]>
clk: berlin: bg2q: remove non-exist "smemc" gate clock
Heiko Stuebner <[email protected]>
clk: rockchip: fix rk3066 pll lock bit location
Heiko Stuebner <[email protected]>
clk: rockchip: fix rk3288 cpuclk core dividers
Kevin Hao <[email protected]>
Revert "clk: ppc-corenet: Fix Section mismatch warning"
Tomeu Vizoso <[email protected]>
clk: Don't try to use a struct clk* after it could have been freed
Stephen Boyd <[email protected]>
clk: Really fix deadlock with mmap_sem
Krzysztof Kozlowski <[email protected]>
clk: samsung: Fix double add of syscore ops after driver rebind
Alan Stern <[email protected]>
SCSI: fix regression in scsi_send_eh_cmnd()
Tony Battersby <[email protected]>
scsi: fix random memory corruption with scsi-mq + T10 PI
Martin K. Petersen <[email protected]>
scsi: blacklist RSOC for Microsoft iSCSI target devices
Sreekanth Reddy <[email protected]>
Revert "[SCSI] mpt3sas: Remove phys on topology change"
Sreekanth Reddy <[email protected]>
Revert "[SCSI] mpt2sas: Remove phys on topology change."
Ville Syrjälä <[email protected]>
Revert "drm/i915: Preserve VGACNTR bits from the BIOS"
Sagi Grimberg <[email protected]>
iscsi,iser-target: Expose supported protection ops according to t10_pi
Sagi Grimberg <[email protected]>
iser-target: Fix NULL dereference in SW mode DIF
Sagi Grimberg <[email protected]>
iser-target: Allocate PI contexts dynamically
Sagi Grimberg <[email protected]>
iser-target: Fix implicit termination of connections
Sagi Grimberg <[email protected]>
iser-target: Handle ADDR_CHANGE event for listener cm_id
Sagi Grimberg <[email protected]>
iser-target: Fix connected_handler + teardown flow race
Sagi Grimberg <[email protected]>
iser-target: Parallelize CM connection establishment
Sagi Grimberg <[email protected]>
iser-target: Fix flush + disconnect completion handling
Sagi Grimberg <[email protected]>
iscsi,iser-target: Initiate termination only once
Nicholas Bellinger <[email protected]>
iscsi-target: Fail connection on short sendmsg writes
Thomas Gleixner <[email protected]>
genirq: Prevent proc race against freeing of irq descriptors
Max Gurtovoy <[email protected]>
IB/iser: Fix possible SQ overflow
Hannes Reinecke <[email protected]>
tcm_loop: Fix wrong I_T nexus association
Kyle McMartin <[email protected]>
uapi/linux/target_core_user.h: fix headers_install.sh badness
Thomas Gleixner <[email protected]>
tick/powerclamp: Remove tick_nohz_idle abuse
Dominique Leuenberger <[email protected]>
hp_accel: Add support for HP ZBook 15
Hans de Goede <[email protected]>
asus-nb-wmi: Add another wapf=4 quirk
Larry Finger <[email protected]>
rtlwifi: Fix error when accessing unmapped memory in skb
Larry Finger <[email protected]>
rtlwifi: rtl8192ce: Set fw_ready flag
Jouni Malinen <[email protected]>
cfg80211: Fix 160 MHz channels with 80+80 and 160 MHz drivers
Arik Nemtsov <[email protected]>
cfg80211: avoid mem leak on driver hint set
Emmanuel Grumbach <[email protected]>
cfg80211: don't WARN about two consecutive Country IE hint
Luciano Coelho <[email protected]>
nl80211: check matches array length before acessing it
Hans de Goede <[email protected]>
xhci: Add broken-streams quirk for Fresco Logic FL1000G xhci controllers
Mathias Nyman <[email protected]>
xhci: Check if slot is already in default state before moving it there
Ian Munsie <[email protected]>
cxl: Unmap MMIO regions when detaching a context
Ian Munsie <[email protected]>
cxl: Add timeout to process element commands
Ian Munsie <[email protected]>
cxl: Change contexts_lock to a mutex to fix sleep while atomic bug
Vineet Gupta <[email protected]>
ARC: [nsimosci] move peripherals to match model to FPGA
Rob Clark <[email protected]>
drm/irq: BUG_ON() -> WARN_ON()
Ville Syrjälä <[email protected]>
drm/i915: Don't call intel_prepare_page_flip() multiple times on gen2-4
Chris Wilson <[email protected]>
drm/i915: Disable PSMI sleep messages on all rings around context switches
Chris Wilson <[email protected]>
drm/i915: Force the CS stall for invalidate flushes
Chris Wilson <[email protected]>
drm/i915: Invalidate media caches on gen7
Ilia Mirkin <[email protected]>
drm/nv4c/mc: disable msi
Jesse Barnes <[email protected]>
drm/i915: save/restore GMBUS freq across suspend/resume on gen4
Dave Airlie <[email protected]>
drm/i915: resume MST after reading back hw state
Chris Wilson <[email protected]>
drm/i915: Only warn the first time we attempt to mmio whilst suspended
Daniel Vetter <[email protected]>
drm/i915: Disallow pin ioctl completely for kms drivers
Daniel Vetter <[email protected]>
drm/i915: Don't complain about stolen conflicts on gen3
Alex Deucher <[email protected]>
drm/radeon: properly filter DP1.2 4k modes on non-DP1.2 hw
Alex Deucher <[email protected]>
drm/radeon: adjust default bapm settings for KV
Alex Deucher <[email protected]>
drm/radeon: fix sad_count check for dce3
Alex Deucher <[email protected]>
drm/radeon: KV has three PPLLs (v2)
Alex Deucher <[email protected]>
drm/radeon: check the right ring in radeon_evict_flags()
Alex Deucher <[email protected]>
drm/radeon: work around a hw bug in MGCG on CIK
Alex Deucher <[email protected]>
drm/radeon: fix typo in CI dpm disable
Daniel Vetter <[email protected]>
drm/dp-mst: Remove branches before dropping the reference
Dave Airlie <[email protected]>
drm/dp: retry AUX transactions 32 times (v1.1)
Dave Airlie <[email protected]>
drm/fb_helper: move deferred fb checking into restore mode (v2)
Tetsuo Handa <[email protected]>
drm/ttm: Avoid memory allocation from shrinker functions.
Thomas Hellstrom <[email protected]>
drm/vmwgfx: Fix fence event code
Thomas Hellstrom <[email protected]>
drm/vmwgfx: Fix error printout on signals pending
Thomas Hellstrom <[email protected]>
drm/vmwgfx: Don't use memory accounting for kernel-side fence objects
Govindarajulu Varadarajan <[email protected]>
enic: fix rx skb checksum
Jiri Pirko <[email protected]>
team: avoid possible underflow of count_pending value for notify_peers and mcast_rejoin
Eric Dumazet <[email protected]>
alx: fix alx_poll()
Palik, Imre <[email protected]>
xen-netback: fixing the propagation of the transmit shaper timeout
Herbert Xu <[email protected]>
tcp: Do not apply TSO segment limit to non-TSO packets
Maor Gottlieb <[email protected]>
net/mlx4_core: Correcly update the mtt's offset in the MR re-reg flow
Jesse Gross <[email protected]>
net: Generalize ndo_gso_check to ndo_features_check
Jay Vosburgh <[email protected]>
net/core: Handle csum for CHECKSUM_COMPLETE VXLAN forwarding
Thomas Graf <[email protected]>
net: Reset secmark when scrubbing packet
Toshiaki Makita <[email protected]>
net: Fix stacked vlan offload features computation
Nicolas Dichtel <[email protected]>
tcp6: don't move IP6CB before xfrm6_policy_check()
Amir Vadai <[email protected]>
net/mlx4_en: Doorbell is byteswapped in Little Endian archs
Antonio Quartulli <[email protected]>
batman-adv: avoid NULL dereferences and fix if check
Sven Eckelmann <[email protected]>
batman-adv: Unify fragment size calculation
Sven Eckelmann <[email protected]>
batman-adv: Calculate extra tail size based on queued fragments
Prashant Sreedharan <[email protected]>
tg3: tg3_disable_ints using uninitialized mailbox value to disable interrupts
stephen hemminger <[email protected]>
in6: fix conflict with glibc
Jason Wang <[email protected]>
net: drop the packet when fails to do software segmentation or header check
David Vrabel <[email protected]>
xen-netback: support frontends without feature-rx-notify again
Jesse Gross <[email protected]>
geneve: Fix races between socket add and release.
Jesse Gross <[email protected]>
geneve: Remove socket and offload handlers at destruction.
Thomas Graf <[email protected]>
netlink: Don't reorder loads/stores before marking mmap netlink frame as available
David Miller <[email protected]>
netlink: Always copy on mmap TX.
Ido Shamay <[email protected]>
net/mlx4: Cache line CQE/EQE stride fixes
Timo Teräs <[email protected]>
gre: fix the inner mac header in nbma tunnel xmit path
-------------
Diffstat:
Documentation/kernel-parameters.txt | 1 + Makefile | 4 +- arch/arc/boot/dts/nsimosci.dts | 18 +- arch/arm/boot/dts/berlin2q-marvell-dmp.dts | 2 + arch/arm/boot/dts/berlin2q.dtsi | 63 +-- arch/arm/boot/dts/dra7-evm.dts | 10 +- arch/arm/boot/dts/imx25.dtsi | 2 +- arch/arm/boot/dts/imx51-babbage.dts | 22 +- arch/arm/configs/omap2plus_defconfig | 2 +- arch/arm/mach-imx/clk-imx6q.c | 4 +- arch/arm/mach-imx/clk-imx6sx.c | 3 + arch/arm/mach-omap2/common.h | 1 + arch/arm/mach-omap2/omap-headsmp.S | 21 + arch/arm/mach-omap2/omap-smp.c | 13 +- arch/arm/mach-omap2/timer.c | 8 +- arch/arm/mach-shmobile/setup-sh73a0.c | 3 + arch/arm64/mm/init.c | 8 +- arch/parisc/include/asm/ldcw.h | 13 +- arch/powerpc/platforms/powernv/opal-wrappers.S | 1 - arch/um/Kconfig.common | 1 + arch/x86/boot/Makefile | 1 + arch/x86/kernel/cpu/Makefile | 1 + arch/x86/kernel/kprobes/core.c | 20 +- arch/x86/kvm/vmx.c | 4 +- arch/x86/um/sys_call_table_32.c | 2 +- arch/x86/um/sys_call_table_64.c | 2 +- drivers/bus/omap_l3_noc.c | 63 ++- drivers/clk/at91/clk-slow.c | 27 + drivers/clk/berlin/bg2q.c | 1 - drivers/clk/clk-ppc-corenet.c | 2 +- drivers/clk/clk.c | 10 +- drivers/clk/rockchip/clk-rk3188.c | 15 +- drivers/clk/rockchip/clk-rk3288.c | 28 +- drivers/clk/samsung/clk-exynos-audss.c | 4 + drivers/gpio/gpio-crystalcove.c | 2 +- drivers/gpio/gpiolib-of.c | 10 +- drivers/gpio/gpiolib-sysfs.c | 47 +- drivers/gpio/gpiolib.c | 18 +- drivers/gpu/drm/drm_dp_helper.c | 7 +- drivers/gpu/drm/drm_dp_mst_topology.c | 5 +- drivers/gpu/drm/drm_fb_helper.c | 13 +- drivers/gpu/drm/drm_irq.c | 3 +- drivers/gpu/drm/i915/i915_drv.c | 3 +- drivers/gpu/drm/i915/i915_drv.h | 3 +- drivers/gpu/drm/i915/i915_gem.c | 5 +- drivers/gpu/drm/i915/i915_gem_context.c | 48 +- drivers/gpu/drm/i915/i915_gem_stolen.c | 6 +- drivers/gpu/drm/i915/i915_irq.c | 6 +- drivers/gpu/drm/i915/i915_reg.h | 4 + drivers/gpu/drm/i915/i915_suspend.c | 8 + drivers/gpu/drm/i915/intel_display.c | 8 +- drivers/gpu/drm/i915/intel_pm.c | 27 - drivers/gpu/drm/i915/intel_ringbuffer.c | 3 + drivers/gpu/drm/i915/intel_uncore.c | 4 +- drivers/gpu/drm/nouveau/core/subdev/mc/nv4c.c | 8 - drivers/gpu/drm/radeon/atombios_crtc.c | 8 +- drivers/gpu/drm/radeon/atombios_dp.c | 4 + drivers/gpu/drm/radeon/ci_dpm.c | 2 +- drivers/gpu/drm/radeon/cik.c | 3 +- drivers/gpu/drm/radeon/dce3_1_afmt.c | 2 +- drivers/gpu/drm/radeon/kv_dpm.c | 10 +- drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- drivers/gpu/drm/ttm/ttm_page_alloc.c | 26 +- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 25 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 8 +- drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 39 +- drivers/iio/adc/ad799x.c | 15 +- drivers/infiniband/ulp/iser/iscsi_iser.h | 2 + drivers/infiniband/ulp/iser/iser_initiator.c | 6 +- drivers/infiniband/ulp/isert/ib_isert.c | 640 +++++++++++++++-------- drivers/infiniband/ulp/isert/ib_isert.h | 15 +- drivers/input/mouse/elantech.c | 2 + drivers/input/serio/i8042-x86ia64io.h | 39 ++ drivers/input/serio/i8042.c | 14 + drivers/leds/leds-netxbig.c | 12 +- drivers/md/dm.c | 2 +- drivers/media/i2c/smiapp-pll.c | 4 +- drivers/media/i2c/smiapp/smiapp-core.c | 2 + drivers/media/platform/vivid/vivid-vid-out.c | 2 +- drivers/media/rc/img-ir/img-ir-hw.c | 28 +- drivers/media/rc/img-ir/img-ir-hw.h | 3 + drivers/media/usb/au0828/au0828-cards.c | 5 + drivers/media/usb/dvb-usb/af9005.c | 3 + drivers/media/usb/uvc/uvc_driver.c | 6 +- drivers/misc/cxl/context.c | 26 +- drivers/misc/cxl/cxl.h | 9 +- drivers/misc/cxl/file.c | 6 +- drivers/misc/cxl/native.c | 12 +- drivers/misc/cxl/pci.c | 2 +- drivers/misc/cxl/sysfs.c | 10 +- drivers/misc/mei/hw-me.c | 12 + drivers/mmc/host/sdhci.c | 6 + drivers/net/can/usb/kvaser_usb.c | 20 +- drivers/net/ethernet/atheros/alx/main.c | 24 +- drivers/net/ethernet/broadcom/tg3.c | 34 +- drivers/net/ethernet/cisco/enic/enic_main.c | 12 +- drivers/net/ethernet/emulex/benet/be_main.c | 8 +- drivers/net/ethernet/intel/Kconfig | 11 + drivers/net/ethernet/intel/i40e/Makefile | 2 +- drivers/net/ethernet/intel/i40e/i40e_osdep.h | 4 +- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 21 +- drivers/net/ethernet/mellanox/mlx4/en_tx.c | 12 +- drivers/net/ethernet/mellanox/mlx4/fw.c | 4 +- drivers/net/ethernet/mellanox/mlx4/mr.c | 9 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 8 +- drivers/net/ethernet/ti/cpsw.c | 30 +- drivers/net/ethernet/ti/cpsw_ale.c | 10 +- drivers/net/ethernet/ti/cpsw_ale.h | 2 +- drivers/net/team/team.c | 16 +- drivers/net/wireless/iwlwifi/mvm/utils.c | 2 +- drivers/net/wireless/rtlwifi/pci.c | 32 +- drivers/net/wireless/rtlwifi/rtl8192ce/hw.c | 2 + drivers/net/xen-netback/common.h | 4 +- drivers/net/xen-netback/interface.c | 4 +- drivers/net/xen-netback/netback.c | 27 +- drivers/net/xen-netback/xenbus.c | 13 +- drivers/pinctrl/pinctrl-xway.c | 2 - drivers/platform/x86/asus-nb-wmi.c | 9 + drivers/platform/x86/hp_accel.c | 1 + drivers/reset/reset-sunxi.c | 4 + drivers/scsi/mpt2sas/mpt2sas_transport.c | 5 +- drivers/scsi/mpt3sas/mpt3sas_transport.c | 5 +- drivers/scsi/scsi_devinfo.c | 1 + drivers/scsi/scsi_error.c | 4 +- drivers/scsi/scsi_lib.c | 4 +- drivers/scsi/storvsc_drv.c | 7 +- drivers/target/iscsi/iscsi_target_login.c | 10 +- drivers/target/iscsi/iscsi_target_util.c | 26 +- drivers/target/loopback/tcm_loop.c | 66 +-- drivers/target/loopback/tcm_loop.h | 7 +- drivers/target/target_core_device.c | 8 +- drivers/target/target_core_file.c | 11 +- drivers/target/target_core_iblock.c | 2 +- drivers/target/target_core_sbc.c | 15 - drivers/target/target_core_spc.c | 5 +- drivers/thermal/intel_powerclamp.c | 2 - drivers/tty/serial/serial_core.c | 4 +- drivers/usb/dwc3/gadget.c | 6 +- drivers/usb/gadget/legacy/inode.c | 1 + drivers/usb/gadget/udc/atmel_usba_udc.c | 19 +- drivers/usb/host/ehci-sched.c | 8 +- drivers/usb/host/pci-quirks.c | 18 +- drivers/usb/host/xhci-pci.c | 2 + drivers/usb/host/xhci.c | 9 + drivers/usb/musb/musb_host.c | 1 - drivers/usb/serial/console.c | 16 +- drivers/usb/serial/cp210x.c | 4 +- drivers/usb/serial/keyspan.c | 20 +- drivers/usb/serial/option.c | 11 +- drivers/usb/serial/qcserial.c | 1 - drivers/usb/storage/unusual_uas.h | 28 + drivers/vfio/pci/vfio_pci.c | 4 +- drivers/vhost/scsi.c | 24 +- drivers/video/fbdev/core/fb_defio.c | 5 +- drivers/video/logo/logo.c | 17 +- fs/lockd/svc.c | 8 +- fs/locks.c | 2 +- fs/nfs/nfs4client.c | 17 +- fs/proc/stat.c | 2 +- include/linux/kernel_stat.h | 1 + include/linux/netdevice.h | 20 +- include/net/vxlan.h | 28 +- include/uapi/linux/in6.h | 3 +- include/uapi/linux/libc-compat.h | 3 + include/uapi/linux/target_core_user.h | 4 - kernel/irq/internals.h | 4 + kernel/irq/irqdesc.c | 52 ++ kernel/irq/proc.c | 22 +- kernel/time/tick-sched.c | 2 - kernel/trace/ftrace.c | 53 +- lib/decompress_bunzip2.c | 2 +- net/batman-adv/fragmentation.c | 4 +- net/batman-adv/gateway_client.c | 2 +- net/core/dev.c | 37 +- net/core/skbuff.c | 1 + net/ipv4/geneve.c | 30 +- net/ipv4/ip_gre.c | 9 +- net/ipv4/tcp_output.c | 4 +- net/ipv6/tcp_ipv6.c | 45 +- net/netlink/af_netlink.c | 54 +- net/wireless/chan.c | 9 +- net/wireless/nl80211.c | 2 +- net/wireless/reg.c | 12 +- scripts/Makefile.clean | 16 +- scripts/coccinelle/misc/bugon.cocci | 2 +- sound/usb/quirks-table.h | 166 ++---- 186 files changed, 1854 insertions(+), 1095 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 2/183 net/mlx4: Cache line CQE/EQE stride fixes
3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Shamay <[email protected]>
[ Upstream commit c3f2511feac088030055012cc8f64ebd84c87dbc ]
This commit contains 2 fixes for the 128B CQE/EQE stride feaure. Wei found that mlx4_QUERY_HCA function marked the wrong capability in flags (64B CQE/EQE), when CQE/EQE stride feature was enabled. Also added small fix in initial CQE ownership bit assignment, when CQE is size is not default 32B.
--- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 11 +++++++++-- drivers/net/ethernet/mellanox/mlx4/fw.c | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +9 -2
@@ -1569,8 +1569,15 @@ int mlx4_en_start_port(struct net_devicemlx4_en_free_affinity_hint (priv, i); goto cq_err; } -for (j =0 ; j < cq->size; j++) - cq->buf[j].owner_sr_opcode =MLX4_CQE_OWNER_MASK ; + +for (j =0 ; j < cq->size; j++) { +struct mlx4_cqe *cqe =NULL ; + + cqe =mlx4_en_get_cqe (cq->buf, j, priv->cqe_size) + + priv->cqe_factor; + cqe->owner_sr_opcode =MLX4_CQE_OWNER_MASK ; + } + err =mlx4_en_set_cq_moder (priv, cq);if (err) {en_err (priv,"Failed setting cq moderation parameters\n" );
drivers/net/ethernet/mellanox/mlx4/fw.c +2 -2
@@ -1647,8 +1647,8 @@ int mlx4_QUERY_HCA(struct mlx4_dev *dev,/* CX3 is capable of extending CQEs\EQEs to strides larger than 64B */ MLX4_GET (byte_field, outbox,INIT_HCA_EQE_CQE_STRIDE_OFFSET );if (byte_field) { - param->dev_cap_enabled |=MLX4_DEV_CAP_64B_EQE_ENABLED ; - param->dev_cap_enabled |=MLX4_DEV_CAP_64B_CQE_ENABLED ; + param->dev_cap_enabled |=MLX4_DEV_CAP_EQE_STRIDE_ENABLED ; + param->dev_cap_enabled |=MLX4_DEV_CAP_CQE_STRIDE_ENABLED ; param->cqe_size =1 << ((byte_field &MLX4_CQE_SIZE_MASK_STRIDE ) +5 ); param->eqe_size = 1 << (((byte_field &
Greg Kroah-Hartman
maintainerPATCH 3/183 netlink: Always copy on mmap TX.
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Miller <[email protected]>
[ Upstream commit 4682a0358639b29cf69437ed909c6221f8c89847 ]
Checking the file f_count and the nlk->mapped count is not completely sufficient to prevent the mmap'd area contents from changing from under us during netlink mmap sendmsg() operations.
Be careful to sample the header's length field only once, because this could change from under us as well.
--- net/netlink/af_netlink.c | 52 ++++++++++++++--------------------------------- 1 file changed, 16 insertions(+), 36 deletions(-)
net/netlink/af_netlink.c +16 -36
@@ -526,14 +526,14 @@ out:return err; } -static void netlink_frame_flush_dcache (const struct nl_mmap_hdr *hdr) +static void netlink_frame_flush_dcache (const struct nl_mmap_hdr *hdr,unsigned int nm_len) {#if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE ==1 struct page *p_start, *p_end;/* First page is flushed through netlink_{get,set}_status */ p_start =pgvec_to_page (hdr +PAGE_SIZE ); - p_end =pgvec_to_page ((void *)hdr +NL_MMAP_HDRLEN + hdr->nm_len -1 ); + p_end =pgvec_to_page ((void *)hdr +NL_MMAP_HDRLEN + nm_len -1 );while (p_start <= p_end) {flush_dcache_page (p_start); p_start++;
@@ -715,24 +715,16 @@ static int netlink_mmap_sendmsg(struct sstruct nl_mmap_hdr *hdr;struct sk_buff *skb;unsigned int maxlen; -bool excl = true;int err =0 , len =0 ; -/* Netlink messages are validated by the receiver before processing. -* In order to avoid userspace changing the contents of the message -* after validation, the socket and the ring may only be used by a -* single process, otherwise we fall back to copying. -*/ -if (atomic_long_read (&sk->sk_socket->file->f_count) >1 || -atomic_read (&nlk->mapped) >1 ) - excl = false; -mutex_lock (&nlk->pg_vec_lock); ring = &nlk->tx_ring; maxlen = ring->frame_size -NL_MMAP_HDRLEN ; do { + unsigned int nm_len; + hdr = netlink_current_frame(ring, NL_MMAP_STATUS_VALID); if (hdr == NULL) { if (!(msg->msg_flags & MSG_DONTWAIT) &&
@@ -740,35 +732,23 @@ static int netlink_mmap_sendmsg(struct sschedule ();continue ; } -if (hdr->nm_len > maxlen) { + + nm_len =ACCESS_ONCE (hdr->nm_len); +if (nm_len > maxlen) { err = -EINVAL ; goto out; } -netlink_frame_flush_dcache (hdr); +netlink_frame_flush_dcache (hdr, nm_len); -if (likely (dst_portid ==0 && dst_group ==0 && excl)) { - skb =alloc_skb_head (GFP_KERNEL ); -if (skb ==NULL ) { - err = -ENOBUFS ; - goto out; - } -sock_hold (sk); -netlink_ring_setup_skb (skb, sk, ring, hdr); -NETLINK_CB (skb).flags |=NETLINK_SKB_TX ; -__skb_put (skb, hdr->nm_len); -netlink_set_status (hdr,NL_MMAP_STATUS_RESERVED ); -atomic_inc (&ring->pending); - }else { - skb =alloc_skb (hdr->nm_len,GFP_KERNEL ); -if (skb ==NULL ) { - err = -ENOBUFS ; - goto out; - } -__skb_put (skb, hdr->nm_len); -memcpy (skb->data, (void *)hdr +NL_MMAP_HDRLEN , hdr->nm_len); -netlink_set_status (hdr,NL_MMAP_STATUS_UNUSED ); + skb =alloc_skb (nm_len,GFP_KERNEL ); +if (skb ==NULL ) { + err = -ENOBUFS ; + goto out; } +__skb_put (skb, nm_len); +memcpy (skb->data, (void *)hdr +NL_MMAP_HDRLEN , nm_len); +netlink_set_status (hdr,NL_MMAP_STATUS_UNUSED );netlink_increment_head (ring);
@@ -814,7 +794,7 @@ static void netlink_queue_mmaped_skb(str hdr->nm_pid =NETLINK_CB (skb).creds.pid; hdr->nm_uid =from_kuid (sk_user_ns (sk),NETLINK_CB (skb).creds.uid); hdr->nm_gid =from_kgid (sk_user_ns (sk),NETLINK_CB (skb).creds.gid); -netlink_frame_flush_dcache (hdr); +netlink_frame_flush_dcache (hdr, hdr->nm_len);netlink_set_status (hdr,NL_MMAP_STATUS_VALID );NETLINK_CB (skb).flags |=NETLINK_SKB_DELIVERED ;
Greg Kroah-Hartman
maintainerPATCH 4/183 netlink: Dont reorder loads/stores before marking mmap netlink frame as available
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Graf <[email protected]>
[ Upstream commit a18e6a186f53af06937a2c268c72443336f4ab56 ]
Each mmap Netlink frame contains a status field which indicates whether the frame is unused, reserved, contains data or needs to be skipped. Both loads and stores may not be reordeded and must complete before the status field is changed and another CPU might pick up the frame for use. Use an smp_mb() to cover needs of both types of callers to netlink_set_status(), callers which have been reading data frame from the frame, and callers which have been filling or releasing and thus writing to the frame.
- Example code path requiring a smp_rmb():
memcpy(skb->data, (void *)hdr + NL_MMAP_HDRLEN, hdr->nm_len); netlink_set_status(hdr, NL_MMAP_STATUS_UNUSED);
- Example code path requiring a smp_wmb():
hdr->nm_uid = from_kuid(sk_user_ns(sk), NETLINK_CB(skb).creds.uid);
hdr->nm_gid = from_kgid(sk_user_ns(sk), NETLINK_CB(skb).creds.gid);
netlink_frame_flush_dcache(hdr);
netlink_set_status(hdr, NL_MMAP_STATUS_VALID);
--- net/netlink/af_netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netlink/af_netlink.c +1 -1
@@ -551,9 +551,9 @@ static enum nl_mmap_status netlink_get_sstatic void netlink_set_status (struct nl_mmap_hdr *hdr,enum nl_mmap_status status) { +smp_mb (); hdr->nm_status = status;flush_dcache_page (pgvec_to_page (hdr)); -smp_wmb (); } static struct nl_mmap_hdr *
Greg Kroah-Hartman
maintainerPATCH 5/183 geneve: Remove socket and offload handlers at destruction.
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesse Gross <[email protected]>
[ Upstream commit 7ed767f73192d6daf673c6d885cd02d5f280ac1f ]
Sockets aren't currently removed from the the global list when they are destroyed. In addition, offload handlers need to be cleaned up as well.
--- net/ipv4/geneve.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
net/ipv4/geneve.c +17 -0
@@ -165,6 +165,15 @@ static void geneve_notify_add_rx_port(st } } +static void geneve_notify_del_rx_port (struct geneve_sock *gs) +{ +struct sock *sk = gs->sock->sk; +sa_family_t sa_family = sk->sk_family; + +if (sa_family ==AF_INET ) +udp_del_offload (&gs->udp_offloads); +} +/* Callback from net/ipv4/udp.c to receive packets */ static int geneve_udp_encap_recv (struct sock *sk,struct sk_buff *skb) {
@@ -318,9 +327,17 @@ EXPORT_SYMBOL_GPL(geneve_sock_add);void geneve_sock_release (struct geneve_sock *gs) { +struct net *net =sock_net (gs->sock->sk); +struct geneve_net *gn =net_generic (net, geneve_net_id); +if (!atomic_dec_and_test (&gs->refcnt))return ; +spin_lock (&gn->sock_lock); +hlist_del_rcu (&gs->hlist); +geneve_notify_del_rx_port (gs); +spin_unlock (&gn->sock_lock); +queue_work (geneve_wq, &gs->del_work); }EXPORT_SYMBOL_GPL (geneve_sock_release);
Greg Kroah-Hartman
maintainerPATCH 6/183 geneve: Fix races between socket add and release.
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesse Gross <[email protected]>
[ Upstream commit 12069401d895ff84076a50189ca842c0696b84b2 ]
Currently, searching for a socket to add a reference to is not synchronized with deletion of sockets. This can result in use after free if there is another operation that is removing a socket at the same time. Solving this requires both holding the appropriate lock and checking the refcount to ensure that it has not already hit zero.
Inspired by a related (but not exactly the same) issue in the VXLAN driver.
--- net/ipv4/geneve.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
net/ipv4/geneve.c +7 -6
@@ -302,6 +302,7 @@ struct geneve_sock *geneve_sock_add(stru geneve_rcv_t *rcv, void *data, bool no_share, bool ipv6) { +struct geneve_net *gn =net_generic (net, geneve_net_id);struct geneve_sock *gs; gs =geneve_socket_create (net, port, rcv, data, ipv6);
@@ -311,15 +312,15 @@ struct geneve_sock *geneve_sock_add(struif (no_share)/* Return error if sharing is not allowed. */ return ERR_PTR (-EINVAL ); +spin_lock (&gn->sock_lock); gs =geneve_find_sock (net, port); -if (gs) { -if (gs->rcv == rcv) -atomic_inc (&gs->refcnt); -else +if (gs && ((gs->rcv != rcv) || + !atomic_add_unless (&gs->refcnt,1 ,0 ))) gs =ERR_PTR (-EBUSY ); - }else { +spin_unlock (&gn->sock_lock); + +if (!gs) gs =ERR_PTR (-EINVAL ); - }return gs; }
Greg Kroah-Hartman
maintainerPATCH 7/183 xen-netback: support frontends without feature-rx-notify again
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Vrabel <[email protected]>
[ Upstram commit 26c0e102585d5a4d311f5d6eb7f524d288e7f6b7 ]
Commit bc96f648df1bbc2729abbb84513cf4f64273a1f1 (xen-netback: make feature-rx-notify mandatory) incorrectly assumed that there were no frontends in use that did not support this feature. But the frontend driver in MiniOS does not and since this is used by (qemu) stubdoms, these stopped working.
Netback sort of works as-is in this mode except:
- If there are no Rx requests and the internal Rx queue fills, only the drain timeout will wake the thread. The default drain timeout of 10 s would give unacceptable pauses.
- If an Rx stall was detected and the internal Rx queue is drained, then the Rx thread would never wake.
Handle these two cases (when feature-rx-notify is disabled) by:
- Reducing the drain timeout to 30 ms.
- Disabling Rx stall detection.
--- drivers/net/xen-netback/common.h | 4 +++- drivers/net/xen-netback/interface.c | 4 +++- drivers/net/xen-netback/netback.c | 27 ++++++++++++++------------- drivers/net/xen-netback/xenbus.c | 12 +++++++++--- 4 files changed, 29 insertions(+), 18 deletions(-)
drivers/net/xen-netback/common.h +3 -1
@@ -230,6 +230,8 @@ struct xenvif {*/ bool disabled;unsigned long status; +unsigned long drain_timeout; +unsigned long stall_timeout;/* Queues */ struct xenvif_queue *queues;
@@ -328,7 +330,7 @@ irqreturn_t xenvif_interrupt(int irq, voextern bool separate_tx_rx_irq;extern unsigned int rx_drain_timeout_msecs; -extern unsigned int rx_drain_timeout_jiffies; +extern unsigned int rx_stall_timeout_msecs;extern unsigned int xenvif_max_queues;#ifdef CONFIG_DEBUG_FS
drivers/net/xen-netback/interface.c +3 -1
@@ -166,7 +166,7 @@ static int xenvif_start_xmit(struct sk_b goto drop; cb =XENVIF_RX_CB (skb); - cb->expires = jiffies + rx_drain_timeout_jiffies; + cb->expires = jiffies + vif->drain_timeout;xenvif_rx_queue_tail (queue, skb);xenvif_kick_thread (queue);
@@ -414,6 +414,8 @@ struct xenvif *xenvif_alloc(struct devic vif->ip_csum =1 ; vif->dev = dev; vif->disabled = false; + vif->drain_timeout =msecs_to_jiffies (rx_drain_timeout_msecs); + vif->stall_timeout =msecs_to_jiffies (rx_stall_timeout_msecs);/* Start out with no queues. */ vif->queues =NULL ;
drivers/net/xen-netback/netback.c +14 -13
@@ -60,14 +60,12 @@ module_param(separate_tx_rx_irq, bool, 0*/ unsigned int rx_drain_timeout_msecs =10000 ;module_param (rx_drain_timeout_msecs, uint,0444 ); -unsigned int rx_drain_timeout_jiffies;/* The length of time before the frontend is considered unresponsive * because it isn't providing Rx slots. */ -static unsigned int rx_stall_timeout_msecs =60000 ; +unsigned int rx_stall_timeout_msecs =60000 ;module_param (rx_stall_timeout_msecs, uint,0444 ); -static unsigned int rx_stall_timeout_jiffies;unsigned int xenvif_max_queues;module_param_named (max_queues, xenvif_max_queues, uint,0644 );
@@ -2022,7 +2020,7 @@ static bool xenvif_rx_queue_stalled(strureturn !queue->stalled && prod - cons <XEN_NETBK_RX_SLOTS_MAX &&time_after (jiffies, - queue->last_rx_time + rx_stall_timeout_jiffies); + queue->last_rx_time + queue->vif->stall_timeout); }static bool xenvif_rx_queue_ready (struct xenvif_queue *queue)
@@ -2040,8 +2038,9 @@ static bool xenvif_have_rx_work(struct x {return (!skb_queue_empty (&queue->rx_queue) &&xenvif_rx_ring_slots_available (queue,XEN_NETBK_RX_SLOTS_MAX )) - ||xenvif_rx_queue_stalled (queue) - ||xenvif_rx_queue_ready (queue) + || (queue->vif->stall_timeout && + (xenvif_rx_queue_stalled (queue) + ||xenvif_rx_queue_ready (queue))) ||kthread_should_stop () || queue->vif->disabled; }
@@ -2094,6 +2093,9 @@ int xenvif_kthread_guest_rx(void *data)struct xenvif_queue *queue = data;struct xenvif *vif = queue->vif; +if (!vif->stall_timeout) +xenvif_queue_carrier_on (queue); +for (;;) {xenvif_wait_for_rx_work (queue);
@@ -2120,10 +2122,12 @@ int xenvif_kthread_guest_rx(void *data)* while it's probably not responsive, drop the * carrier so packets are dropped earlier. */ -if (xenvif_rx_queue_stalled (queue)) -xenvif_queue_carrier_off (queue); -else if (xenvif_rx_queue_ready (queue)) -xenvif_queue_carrier_on (queue); +if (vif->stall_timeout) { +if (xenvif_rx_queue_stalled (queue)) +xenvif_queue_carrier_off (queue); +else if (xenvif_rx_queue_ready (queue)) +xenvif_queue_carrier_on (queue); + }/* Queued packets may have foreign pages from other * domains. These cannot be queued indefinitely as
@@ -2194,9 +2198,6 @@ static int __init netback_init(void)if (rc) goto failed_init; - rx_drain_timeout_jiffies =msecs_to_jiffies (rx_drain_timeout_msecs); - rx_stall_timeout_jiffies =msecs_to_jiffies (rx_stall_timeout_msecs); -#ifdef CONFIG_DEBUG_FS xen_netback_dbg_root =debugfs_create_dir ("xen-netback" ,NULL );if (IS_ERR_OR_NULL (xen_netback_dbg_root))
drivers/net/xen-netback/xenbus.c +9 -3
@@ -886,9 +886,15 @@ static int read_xenbus_vif_flags(structreturn -EOPNOTSUPP ;if (xenbus_scanf (XBT_NIL , dev->otherend, -"feature-rx-notify" ,"%d" , &val) <0 || val ==0 ) { -xenbus_dev_fatal (dev, -EINVAL ,"feature-rx-notify is mandatory" ); -return -EINVAL ; +"feature-rx-notify" ,"%d" , &val) <0 ) + val =0 ; +if (!val) { +/* - Reduce drain timeout to poll more frequently for +* Rx requests. +* - Disable Rx stall detection. +*/ + be->vif->drain_timeout =msecs_to_jiffies (30 ); + be->vif->stall_timeout =0 ; } if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-sg",
Re: [PATCH 3.18 007/183] xen-netback: support frontends without feature-rx-notify again
David,
No objections. I've been using it in production and have not seen any problems.
-John
Quoted 181 lines · Greg Kroah-Hartman
3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Vrabel <[email protected]>
[ Upstram commit
26c0e102585d5a4d311f5d6eb7f524d288e7f6b7]Commit
bc96f648df1bbc2729abbb84513cf4f64273a1f1(xen-netback: make feature-rx-notify mandatory) incorrectly assumed that there were no frontends in use that did not support this feature. But the frontend driver in MiniOS does not and since this is used by (qemu) stubdoms, these stopped working.Netback sort of works as-is in this mode except:
- If there are no Rx requests and the internal Rx queue fills, only the drain timeout will wake the thread. The default drain timeout of 10 s would give unacceptable pauses.
- If an Rx stall was detected and the internal Rx queue is drained, then the Rx thread would never wake.
Handle these two cases (when feature-rx-notify is disabled) by:
- Reducing the drain timeout to 30 ms.
- Disabling Rx stall detection.
Reported-by John <[email protected]>Tested-by John <[email protected]>Signed-off-by David Vrabel <[email protected]>Reviewed-by Wei Liu <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/net/xen-netback/common.h | 4 +++- drivers/net/xen-netback/interface.c | 4 +++- drivers/net/xen-netback/netback.c | 27 ++++++++++++++------------- drivers/net/xen-netback/xenbus.c | 12 +++++++++--- 4 files changed, 29 insertions(+), 18 deletions(-)drivers/net/xen-netback/common.h +3
-1@@ -230,6 +230,8 @@ struct xenvif {*/ bool disabled;unsigned long status; +unsigned long drain_timeout; +unsigned long stall_timeout;/* Queues */ struct xenvif_queue *queues;@@ -328,7 +330,7 @@ irqreturn_t xenvif_interrupt(int irq, voextern bool separate_tx_rx_irq;extern unsigned int rx_drain_timeout_msecs; -extern unsigned int rx_drain_timeout_jiffies; +extern unsigned int rx_stall_timeout_msecs;extern unsigned int xenvif_max_queues;#ifdef CONFIG_DEBUG_FS drivers/net/xen-netback/interface.c +3
-1@@ -166,7 +166,7 @@ static int xenvif_start_xmit(struct sk_b goto drop; cb =XENVIF_RX_CB (skb); - cb->expires = jiffies + rx_drain_timeout_jiffies; + cb->expires = jiffies + vif->drain_timeout;xenvif_rx_queue_tail (queue, skb);xenvif_kick_thread (queue);@@ -414,6 +414,8 @@ struct xenvif *xenvif_alloc(struct devic vif->ip_csum =1 ; vif->dev = dev; vif->disabled = false; + vif->drain_timeout =msecs_to_jiffies (rx_drain_timeout_msecs); + vif->stall_timeout =msecs_to_jiffies (rx_stall_timeout_msecs);/* Start out with no queues. */ vif->queues =NULL ;drivers/net/xen-netback/netback.c +14
-13@@ -60,14 +60,12 @@ module_param(separate_tx_rx_irq, bool, 0*/ unsigned int rx_drain_timeout_msecs =10000 ;module_param (rx_drain_timeout_msecs, uint,0444 ); -unsigned int rx_drain_timeout_jiffies;/* The length of time before the frontend is considered unresponsive * because it isn't providing Rx slots. */ -static unsigned int rx_stall_timeout_msecs =60000 ; +unsigned int rx_stall_timeout_msecs =60000 ;module_param (rx_stall_timeout_msecs, uint,0444 ); -static unsigned int rx_stall_timeout_jiffies;unsigned int xenvif_max_queues;module_param_named (max_queues, xenvif_max_queues, uint,0644 );@@ -2022,7 +2020,7 @@ static bool xenvif_rx_queue_stalled(strureturn !queue->stalled && prod - cons <XEN_NETBK_RX_SLOTS_MAX &&time_after (jiffies, - queue->last_rx_time + rx_stall_timeout_jiffies); + queue->last_rx_time + queue->vif->stall_timeout); }static bool xenvif_rx_queue_ready (struct xenvif_queue *queue)@@ -2040,8 +2038,9 @@ static bool xenvif_have_rx_work(struct x {return (!skb_queue_empty (&queue->rx_queue) &&xenvif_rx_ring_slots_available (queue,XEN_NETBK_RX_SLOTS_MAX )) - ||xenvif_rx_queue_stalled (queue) - ||xenvif_rx_queue_ready (queue) + || (queue->vif->stall_timeout && + (xenvif_rx_queue_stalled (queue) + ||xenvif_rx_queue_ready (queue))) ||kthread_should_stop () || queue->vif->disabled; }@@ -2094,6 +2093,9 @@ int xenvif_kthread_guest_rx(void *data)struct xenvif_queue *queue = data;struct xenvif *vif = queue->vif; +if (!vif->stall_timeout) +xenvif_queue_carrier_on (queue); +for (;;) {xenvif_wait_for_rx_work (queue);@@ -2120,10 +2122,12 @@ int xenvif_kthread_guest_rx(void *data)* while it's probably not responsive, drop the * carrier so packets are dropped earlier. */ -if (xenvif_rx_queue_stalled (queue)) -xenvif_queue_carrier_off (queue); -else if (xenvif_rx_queue_ready (queue)) -xenvif_queue_carrier_on (queue); +if (vif->stall_timeout) { +if (xenvif_rx_queue_stalled (queue)) +xenvif_queue_carrier_off (queue); +else if (xenvif_rx_queue_ready (queue)) +xenvif_queue_carrier_on (queue); + }/* Queued packets may have foreign pages from other * domains. These cannot be queued indefinitely as @@ -2194,9 +2198,6 @@ static int __init netback_init(void)if (rc) goto failed_init; - rx_drain_timeout_jiffies =msecs_to_jiffies (rx_drain_timeout_msecs); - rx_stall_timeout_jiffies =msecs_to_jiffies (rx_stall_timeout_msecs); -#ifdef CONFIG_DEBUG_FS xen_netback_dbg_root =debugfs_create_dir ("xen-netback" ,NULL );if (IS_ERR_OR_NULL (xen_netback_dbg_root))drivers/net/xen-netback/xenbus.c +9
-3@@ -886,9 +886,15 @@ static int read_xenbus_vif_flags(structreturn -EOPNOTSUPP ;if (xenbus_scanf (XBT_NIL , dev->otherend, -"feature-rx-notify" ,"%d" , &val) <0 || val ==0 ) { -xenbus_dev_fatal (dev, -EINVAL ,"feature-rx-notify is mandatory" ); -return -EINVAL ; +"feature-rx-notify" ,"%d" , &val) <0 ) + val =0 ; +if (!val) { +/* - Reduce drain timeout to poll more frequently for +* Rx requests. +* - Disable Rx stall detection. +*/ + be->vif->drain_timeout =msecs_to_jiffies (30 ); + be->vif->stall_timeout =0 ; } if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-sg",
Greg Kroah-Hartman
maintainerPATCH 8/183 net: drop the packet when fails to do software segmentation or header check
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Wang <[email protected]>
[ Upstream commit af6dabc9c70ae3f307685b1f32f52d60b1bf0527 ]
Commit cecda693a969816bac5e470e1d9c9c0ef5567bca ("net: keep original skb which only needs header checking during software GSO") keeps the original skb for packets that only needs header check, but it doesn't drop the packet if software segmentation or header check were failed.
Fixes cecda693a9 ("net: keep original skb which only needs header checking during software GSO")
--- net/core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/dev.c +1 -1
@@ -2680,7 +2680,7 @@ static struct sk_buff *validate_xmit_skb segs =skb_gso_segment (skb, features);if (IS_ERR (segs)) { - segs =NULL ; + goto out_kfree_skb; }else if (segs) {consume_skb (skb); skb = segs;
Greg Kroah-Hartman
maintainerPATCH 9/183 in6: fix conflict with glibc
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: stephen hemminger <[email protected]>
[ Upstream commit 6d08acd2d32e3e877579315dc3202d7a5f336d98 ]
Resolve conflicts between glibc definition of IPV6 socket options and those defined in Linux headers. Looks like earlier efforts to solve this did not cover all the definitions.
It resolves warnings during iproute2 build.
Please consider for stable as well.
--- include/uapi/linux/in6.h | 3 ++- include/uapi/linux/libc-compat.h | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-)
include/uapi/linux/in6.h +2 -1
@@ -149,7 +149,7 @@ struct in6_flowlabel_req {/* * IPV6 socket options */ - +#if __UAPI_DEF_IPV6_OPTIONS#define IPV6_ADDRFORM 1#define IPV6_2292PKTINFO 2#define IPV6_2292HOPOPTS 3
@@ -196,6 +196,7 @@ struct in6_flowlabel_req {#define IPV6_IPSEC_POLICY 34#define IPV6_XFRM_POLICY 35 +#endif /* * Multicast:
include/uapi/linux/libc-compat.h +3 -0
@@ -69,6 +69,7 @@#define __UAPI_DEF_SOCKADDR_IN6 0#define __UAPI_DEF_IPV6_MREQ 0#define __UAPI_DEF_IPPROTO_V6 0 +#define __UAPI_DEF_IPV6_OPTIONS 0#else
@@ -82,6 +83,7 @@#define __UAPI_DEF_SOCKADDR_IN6 1#define __UAPI_DEF_IPV6_MREQ 1#define __UAPI_DEF_IPPROTO_V6 1 +#define __UAPI_DEF_IPV6_OPTIONS 1#endif /* _NETINET_IN_H */
@@ -103,6 +105,7 @@#define __UAPI_DEF_SOCKADDR_IN6 1#define __UAPI_DEF_IPV6_MREQ 1#define __UAPI_DEF_IPPROTO_V6 1 +#define __UAPI_DEF_IPV6_OPTIONS 1/* Definitions for xattr.h */ #define __UAPI_DEF_XATTR 1
Greg Kroah-Hartman
maintainerPATCH 10/183 tg3: tg3_disable_ints using uninitialized mailbox value to disable interrupts
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prashant Sreedharan <[email protected]>
[ Upstream commit 05b0aa579397b734f127af58e401a30784a1e315 ]
During driver load in tg3_init_one, if the driver detects DMA activity before intializing the chip tg3_halt is called. As part of tg3_halt interrupts are disabled using routine tg3_disable_ints. This routine was using mailbox value which was not initialized (default value is 0). As a result driver was writing 0x00000001 to pci config space register 0, which is the vendor id / device id.
This driver bug was exposed because of the commit a7877b17a667 (PCI: Check only the Vendor ID to identify Configuration Request Retry). Also this issue is only seen in older generation chipsets like 5722 because config space write to offset 0 from driver is possible. The newer generation chips ignore writes to offset 0. Also without commit a7877b17a667, for these older chips when a GRC reset is issued the Bootcode would reprogram the vendor id/device id, which is the reason this bug was masked earlier.
Fixed by initializing the interrupt mailbox registers before calling tg3_halt.
Please queue for -stable.
--- drivers/net/ethernet/broadcom/tg3.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +17 -17
@@ -17789,23 +17789,6 @@ static int tg3_init_one(struct pci_dev * goto err_out_apeunmap; } -/* -* Reset chip in case UNDI or EFI driver did not shutdown -* DMA self test will enable WDMAC and we'll see (spurious) -* pending DMA on the PCI bus at that point. -*/ -if ((tr32 (HOSTCC_MODE ) &HOSTCC_MODE_ENABLE ) || - (tr32 (WDMAC_MODE ) &WDMAC_MODE_ENABLE )) { -tw32 (MEMARB_MODE ,MEMARB_MODE_ENABLE ); -tg3_halt (tp,RESET_KIND_SHUTDOWN ,1 ); - } - - err =tg3_test_dma (tp); -if (err) { -dev_err (&pdev->dev,"DMA engine test failed, aborting\n" ); - goto err_out_apeunmap; - } - intmbx =MAILBOX_INTERRUPT_0 +TG3_64BIT_REG_LOW ; rcvmbx =MAILBOX_RCVRET_CON_IDX_0 +TG3_64BIT_REG_LOW ; sndmbx =MAILBOX_SNDHOST_PROD_IDX_0 +TG3_64BIT_REG_LOW ;
@@ -17850,6 +17833,23 @@ static int tg3_init_one(struct pci_dev * sndmbx +=0xc ; } +/* +* Reset chip in case UNDI or EFI driver did not shutdown +* DMA self test will enable WDMAC and we'll see (spurious) +* pending DMA on the PCI bus at that point. +*/ +if ((tr32 (HOSTCC_MODE ) &HOSTCC_MODE_ENABLE ) || + (tr32 (WDMAC_MODE ) &WDMAC_MODE_ENABLE )) { +tw32 (MEMARB_MODE ,MEMARB_MODE_ENABLE ); +tg3_halt (tp,RESET_KIND_SHUTDOWN ,1 ); + } + + err =tg3_test_dma (tp); +if (err) { +dev_err (&pdev->dev,"DMA engine test failed, aborting\n" ); + goto err_out_apeunmap; + } +tg3_init_coal (tp);pci_set_drvdata (pdev, dev);
Greg Kroah-Hartman
maintainerPATCH 12/183 batman-adv: Unify fragment size calculation
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
[ Upstream commit 0402e444cd199389b7fe47be68a67b817e09e097 ]
The fragmentation code was replaced in 610bfc6bc99bc83680d190ebc69359a05fc7f605 ("batman-adv: Receive fragmented packets and merge") by an implementation which can handle up to 16 fragments of a packet. The packet is prepared for the split in fragments by the function batadv_frag_send_packet and the actual split is done by batadv_frag_create.
Both functions calculate the size of a fragment themself. But their calculation differs because batadv_frag_send_packet also subtracts ETH_HLEN. Therefore, the check in batadv_frag_send_packet "can a full fragment can be created?" may return true even when batadv_frag_create cannot create a full fragment.
The function batadv_frag_create doesn't check the size of the skb before splitting it and therefore might try to create a larger fragment than the remaining buffer. This creates an integer underflow and an invalid len is given to skb_split.
--- net/batman-adv/fragmentation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/fragmentation.c +1 -1
@@ -434,7 +434,7 @@ bool batadv_frag_send_packet(struct sk_b* fragments larger than BATADV_FRAG_MAX_FRAG_SIZE */ mtu =min_t (unsigned, mtu,BATADV_FRAG_MAX_FRAG_SIZE ); - max_fragment_size = (mtu - header_size -ETH_HLEN ); + max_fragment_size = mtu - header_size; max_packet_size = max_fragment_size *BATADV_FRAG_MAX_FRAGMENTS ;/* Don't even try to fragment, if we need more than 16 fragments */
Greg Kroah-Hartman
maintainerPATCH 13/183 batman-adv: avoid NULL dereferences and fix if check
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antonio Quartulli <[email protected]>
[ Upstream commit 0d1644919578db525b9a7b6c8197ce02adbfce26 ]
Gateway having bandwidth_down equal to zero are not accepted at all and so never added to the Gateway list.
For this reason checking the bandwidth_down member in batadv_gw_out_of_range() is useless.
This is probably a copy/paste error and this check was supposed to be "!gw_node" only. Moreover, the way the check is written now may also lead to a NULL dereference.
Fix this by rewriting the if-condition properly.
Introduced by 414254e342a0d58144de40c3da777521ebaeeb07 ("batman-adv: tvlv - gateway download/upload bandwidth container")
--- net/batman-adv/gateway_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/gateway_client.c +1 -1
@@ -810,7 +810,7 @@ bool batadv_gw_out_of_range(struct batad goto out; gw_node =batadv_gw_node_get (bat_priv, orig_dst_node); -if (!gw_node->bandwidth_down ==0 ) +if (!gw_node) goto out;switch (atomic_read (&bat_priv->gw_mode)) {
Greg Kroah-Hartman
maintainerPATCH 14/183 net/mlx4_en: Doorbell is byteswapped in Little Endian archs
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Vadai <[email protected]>
[ Upstream commit 492f5add4be84652bbe13da8a250d60c6856a5c5 ]
iowrite32() will byteswap it's argument on big endian archs. iowrite32be() will byteswap on little endian archs.
Since we don't want to do this unnecessary byteswap on the fast path, doorbell is stored in the NIC's native endianness. Using the right iowrite() according to the arch endianness.
--- drivers/net/ethernet/mellanox/mlx4/en_tx.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx4/en_tx.c +11 -1
@@ -954,7 +954,17 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff tx_desc->ctrl.owner_opcode = op_own;if (send_doorbell) {wmb (); -iowrite32 (ring->doorbell_qpn, +/* Since there is no iowrite*_native() that writes the +* value as is, without byteswapping - using the one +* the doesn't do byteswapping in the relevant arch +* endianness. +*/ +#if defined(__LITTLE_ENDIAN) + iowrite32( +#else + iowrite32be( +#endif + ring->doorbell_qpn, ring->bf.uar->map + MLX4_SEND_DOORBELL); }else { ring->xmit_more++;
Greg Kroah-Hartman
maintainerPATCH 15/183 tcp6: dont move IP6CB before xfrm6_policy_check()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Dichtel <[email protected]>
[ Upstream commit 2dc49d1680b534877fd20cce52557ea542bb06b6 ]
When xfrm6_policy_check() is used, _decode_session6() is called after some intermediate functions. This function uses IP6CB(), thus TCP_SKB_CB() must be prepared after the call of xfrm6_policy_check().
Before this patch, scenarii with IPv6 + TCP + IPsec Transport are broken.
--- net/ipv6/tcp_ipv6.c | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-)
net/ipv6/tcp_ipv6.c +29 -16
@@ -1385,6 +1385,28 @@ ipv6_pktoptions:return 0 ; } +static void tcp_v6_fill_cb (struct sk_buff *skb,const struct ipv6hdr *hdr, +const struct tcphdr *th) +{ +/* This is tricky: we move IP6CB at its correct location into +* TCP_SKB_CB(). It must be done after xfrm6_policy_check(), because +* _decode_session6() uses IP6CB(). +* barrier() makes sure compiler won't play aliasing games. +*/ +memmove (&TCP_SKB_CB (skb)->header.h6,IP6CB (skb), +sizeof (struct inet6_skb_parm )); +barrier (); + +TCP_SKB_CB (skb)->seq =ntohl (th->seq); +TCP_SKB_CB (skb)->end_seq = (TCP_SKB_CB (skb)->seq + th->syn + th->fin + + skb->len - th->doff*4 ); +TCP_SKB_CB (skb)->ack_seq =ntohl (th->ack_seq); +TCP_SKB_CB (skb)->tcp_flags =tcp_flag_byte (th); +TCP_SKB_CB (skb)->tcp_tw_isn =0 ; +TCP_SKB_CB (skb)->ip_dsfield =ipv6_get_dsfield (hdr); +TCP_SKB_CB (skb)->sacked =0 ; +} +static int tcp_v6_rcv (struct sk_buff *skb) {const struct tcphdr *th;
@@ -1416,24 +1438,9 @@ static int tcp_v6_rcv(struct sk_buff *sk th =tcp_hdr (skb); hdr =ipv6_hdr (skb); -/* This is tricky : We move IPCB at its correct location into TCP_SKB_CB() -* barrier() makes sure compiler wont play fool^Waliasing games. -*/ -memmove (&TCP_SKB_CB (skb)->header.h6,IP6CB (skb), -sizeof (struct inet6_skb_parm )); -barrier (); - -TCP_SKB_CB (skb)->seq =ntohl (th->seq); -TCP_SKB_CB (skb)->end_seq = (TCP_SKB_CB (skb)->seq + th->syn + th->fin + - skb->len - th->doff*4 ); -TCP_SKB_CB (skb)->ack_seq =ntohl (th->ack_seq); -TCP_SKB_CB (skb)->tcp_flags =tcp_flag_byte (th); -TCP_SKB_CB (skb)->tcp_tw_isn =0 ; -TCP_SKB_CB (skb)->ip_dsfield =ipv6_get_dsfield (hdr); -TCP_SKB_CB (skb)->sacked =0 ; sk =__inet6_lookup_skb (&tcp_hashinfo, skb, th->source, th->dest, -tcp_v6_iif (skb)); +inet6_iif (skb));if (!sk) goto no_tcp_socket;
@@ -1449,6 +1456,8 @@ process:if (!xfrm6_policy_check (sk,XFRM_POLICY_IN , skb)) goto discard_and_relse; +tcp_v6_fill_cb (skb, hdr, th); +#ifdef CONFIG_TCP_MD5SIG if (tcp_v6_inbound_md5_hash (sk, skb)) goto discard_and_relse;
@@ -1480,6 +1489,8 @@ no_tcp_socket:if (!xfrm6_policy_check (NULL ,XFRM_POLICY_IN , skb)) goto discard_it; +tcp_v6_fill_cb (skb, hdr, th); +if (skb->len < (th->doff<<2 ) ||tcp_checksum_complete (skb)) { csum_error:TCP_INC_STATS_BH (net,TCP_MIB_CSUMERRORS );
@@ -1503,6 +1514,8 @@ do_time_wait: goto discard_it; } +tcp_v6_fill_cb (skb, hdr, th); +if (skb->len < (th->doff<<2 )) {inet_twsk_put (inet_twsk (sk)); goto bad_packet;
Greg Kroah-Hartman
maintainerPATCH 16/183 net: Fix stacked vlan offload features computation
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Toshiaki Makita <[email protected]>
[ Upstream commit 796f2da81bead71ffc91ef70912cd8d1827bf756 ]
When vlan tags are stacked, it is very likely that the outer tag is stored in skb->vlan_tci and skb->protocol shows the inner tag's vlan_proto. Currently netif_skb_features() first looks at skb->protocol even if there is the outer tag in vlan_tci, thus it incorrectly retrieves the protocol encapsulated by the inner vlan instead of the inner vlan protocol. This allows GSO packets to be passed to HW and they end up being corrupted.
--- net/core/dev.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
net/core/dev.c +8 -5
@@ -2573,11 +2573,14 @@ netdev_features_t netif_skb_features(strif (gso_segs > dev->gso_max_segs || gso_segs < dev->gso_min_segs) features &= ~NETIF_F_GSO_MASK ; -if (protocol ==htons (ETH_P_8021Q ) || protocol ==htons (ETH_P_8021AD )) { -struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; - protocol = veh->h_vlan_encapsulated_proto; - }else if (!vlan_tx_tag_present (skb)) { -return harmonize_features (skb, features); +if (!vlan_tx_tag_present (skb)) { +if (unlikely (protocol ==htons (ETH_P_8021Q ) || + protocol ==htons (ETH_P_8021AD ))) { +struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; + protocol = veh->h_vlan_encapsulated_proto; + }else { +return harmonize_features (skb, features); + } } features = netdev_intersect_features(features,
Greg Kroah-Hartman
maintainerPATCH 17/183 net: Reset secmark when scrubbing packet
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Graf <[email protected]>
[ Upstream commit b8fb4e0648a2ab3734140342002f68fb0c7d1602 ]
skb_scrub_packet() is called when a packet switches between a context such as between underlay and overlay, between namespaces, or between L3 subnets.
While we already scrub the packet mark, connection tracking entry, and cached destination, the security mark/context is left intact.
It seems wrong to inherit the security context of a packet when going from overlay to underlay or across forwarding paths.
--- net/core/skbuff.c | 1 + 1 file changed, 1 insertion(+)
net/core/skbuff.c +1 -0
@@ -4040,6 +4040,7 @@ void skb_scrub_packet(struct sk_buff *sk skb->ignore_df =0 ;skb_dst_drop (skb); skb->mark =0 ; +skb_init_secmark (skb);secpath_reset (skb);nf_reset (skb);nf_reset_trace (skb);
Greg Kroah-Hartman
maintainerPATCH 18/183 net/core: Handle csum for CHECKSUM_COMPLETE VXLAN forwarding
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jay Vosburgh <[email protected]>
[ Upstream commit 2c26d34bbcc0b3f30385d5587aa232289e2eed8e ]
When using VXLAN tunnels and a sky2 device, I have experienced checksum failures of the following type:
[ 4297.761899] eth0: hw csum failure [...] [ 4297.765223] Call Trace: [ 4297.765224] <IRQ> [<ffffffff8172f026>] dump_stack+0x46/0x58 [ 4297.765235] [<ffffffff8162ba52>] netdev_rx_csum_fault+0x42/0x50 [ 4297.765238] [<ffffffff8161c1a0>] ? skb_push+0x40/0x40 [ 4297.765240] [<ffffffff8162325c>] __skb_checksum_complete+0xbc/0xd0 [ 4297.765243] [<ffffffff8168c602>] tcp_v4_rcv+0x2e2/0x950 [ 4297.765246] [<ffffffff81666ca0>] ? ip_rcv_finish+0x360/0x360
These are reliably reproduced in a network topology of:
container:eth0 == host(OVS VXLAN on VLAN) == bond0 == eth0 (sky2) -> switch
When VXLAN encapsulated traffic is received from a similarly
configured peer, the above warning is generated in the receive processing of the encapsulated packet. Note that the warning is associated with the container eth0.
The skbs from sky2 have ip_summed set to CHECKSUM_COMPLETE, and
because the packet is an encapsulated Ethernet frame, the checksum generated by the hardware includes the inner protocol and Ethernet headers.
The receive code is careful to update the skb->csum, except in
__dev_forward_skb, as called by dev_forward_skb. __dev_forward_skb calls eth_type_trans, which in turn calls skb_pull_inline(skb, ETH_HLEN) to skip over the Ethernet header, but does not update skb->csum when doing so.
This patch resolves the problem by adding a call toskb_postpull_rcsum to update the skb->csum after the call to eth_type_trans.
--- net/core/dev.c | 1 + 1 file changed, 1 insertion(+)
net/core/dev.c +1 -0
@@ -1697,6 +1697,7 @@ int __dev_forward_skb(struct net_deviceskb_scrub_packet (skb, true); skb->protocol =eth_type_trans (skb, dev); +skb_postpull_rcsum (skb,eth_hdr (skb),ETH_HLEN );return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 19/183 net: Generalize ndo_gso_check to ndo_features_check
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesse Gross <[email protected]>
[ Upstream commit 5f35227ea34bb616c436d9da47fc325866c428f3 ]
GSO isn't the only offload feature with restrictions that potentially can't be expressed with the current features mechanism. Checksum is another although it's a general issue that could in theory apply to anything. Even if it may be possible to implement these restrictions in other ways, it can result in duplicate code or inefficient per-packet behavior.
This generalizes ndo_gso_check so that drivers can remove any features that don't make sense for a given packet, similar to netif_skb_features(). It also converts existing driver restrictions to the new format, completing the work that was done to support tunnel protocols since the issues apply to checksums as well.
By actually removing features from the set that are used to do offloading, it solves another problem with the existing interface. In these cases, GSO would run with the original set of features and not do anything because it appears that segmentation is not required.
--- drivers/net/ethernet/emulex/benet/be_main.c | 8 ++++-- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 10 ++++---- drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 8 ++++-- include/linux/netdevice.h | 20 +++++++++------- include/net/vxlan.h | 28 +++++++++++++++++++---- net/core/dev.c | 23 +++++++++++------- 6 files changed, 65 insertions(+), 32 deletions(-)
drivers/net/ethernet/emulex/benet/be_main.c +5 -3
@@ -4427,9 +4427,11 @@ static void be_del_vxlan_port(struct net be16_to_cpu(port)); } -static bool be_gso_check (struct sk_buff *skb,struct net_device *dev) +static netdev_features_t be_features_check (struct sk_buff *skb, +struct net_device *dev, +netdev_features_t features) { -return vxlan_gso_check (skb); +return vxlan_features_check (skb, features); }#endif
@@ -4460,7 +4462,7 @@ static const struct net_device_ops be_ne#ifdef CONFIG_BE2NET_VXLAN .ndo_add_vxlan_port = be_add_vxlan_port, .ndo_del_vxlan_port = be_del_vxlan_port, - .ndo_gso_check = be_gso_check, + .ndo_features_check = be_features_check,#endif };
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +6 -4
@@ -2363,9 +2363,11 @@ static void mlx4_en_del_vxlan_port(struc queue_work(priv->mdev->workqueue, &priv->vxlan_del_task); } -static bool mlx4_en_gso_check (struct sk_buff *skb,struct net_device *dev) +static netdev_features_t mlx4_en_features_check (struct sk_buff *skb, +struct net_device *dev, +netdev_features_t features) { -return vxlan_gso_check (skb); +return vxlan_features_check (skb, features); }#endif
@@ -2398,7 +2400,7 @@ static const struct net_device_ops mlx4_#ifdef CONFIG_MLX4_EN_VXLAN .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, - .ndo_gso_check = mlx4_en_gso_check, + .ndo_features_check = mlx4_en_features_check,#endif };
@@ -2432,7 +2434,7 @@ static const struct net_device_ops mlx4_#ifdef CONFIG_MLX4_EN_VXLAN .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, - .ndo_gso_check = mlx4_en_gso_check, + .ndo_features_check = mlx4_en_features_check,#endif };
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +5 -3
@@ -504,9 +504,11 @@ static void qlcnic_del_vxlan_port(struct adapter->flags |= QLCNIC_DEL_VXLAN_PORT; } -static bool qlcnic_gso_check (struct sk_buff *skb,struct net_device *dev) +static netdev_features_t qlcnic_features_check (struct sk_buff *skb, +struct net_device *dev, +netdev_features_t features) { -return vxlan_gso_check (skb); +return vxlan_features_check (skb, features); }#endif
@@ -531,7 +533,7 @@ static const struct net_device_ops qlcni#ifdef CONFIG_QLCNIC_VXLAN .ndo_add_vxlan_port = qlcnic_add_vxlan_port, .ndo_del_vxlan_port = qlcnic_del_vxlan_port, - .ndo_gso_check = qlcnic_gso_check, + .ndo_features_check = qlcnic_features_check,#endif #ifdef CONFIG_NET_POLL_CONTROLLER .ndo_poll_controller = qlcnic_poll_controller,
include/linux/netdevice.h +11 -9
@@ -998,12 +998,15 @@ typedef u16 (*select_queue_fallback_t)(s* Callback to use for xmit over the accelerated station. This * is used in place of ndo_start_xmit on accelerated net * devices. -* bool (*ndo_gso_check) (struct sk_buff *skb, -* struct net_device *dev); +* netdev_features_t (*ndo_features_check) (struct sk_buff *skb, +* struct net_device *dev +* netdev_features_t features); * Called by core transmit path to determine if device is capable of -* performing GSO on a packet. The device returns true if it is -* able to GSO the packet, false otherwise. If the return value is -* false the stack will do software GSO. +* performing offload operations on a given packet. This is to give +* the device an opportunity to implement any restrictions that cannot +* be otherwise expressed by feature flags. The check is called with +* the set of features that the stack has calculated and it returns +* those the driver believes to be appropriate. */ struct net_device_ops {int (*ndo_init)(struct net_device *dev);
@@ -1153,8 +1156,9 @@ struct net_device_ops {struct net_device *dev, void *priv);int (*ndo_get_lock_subclass)(struct net_device *dev); -bool (*ndo_gso_check) (struct sk_buff *skb, -struct net_device *dev); +netdev_features_t (*ndo_features_check) (struct sk_buff *skb, +struct net_device *dev, +netdev_features_t features); };/**
@@ -3584,8 +3588,6 @@ static inline bool netif_needs_gso(struc netdev_features_t features) {return skb_is_gso (skb) && (!skb_gso_ok (skb, features) || - (dev->netdev_ops->ndo_gso_check && - !dev->netdev_ops->ndo_gso_check (skb, dev)) ||unlikely ((skb->ip_summed !=CHECKSUM_PARTIAL ) && (skb->ip_summed !=CHECKSUM_UNNECESSARY ))); }
include/net/vxlan.h +24 -4
@@ -1,6 +1,9 @@#ifndef __NET_VXLAN_H#define __NET_VXLAN_H 1 +#include <linux/ip.h> +#include <linux/ipv6.h> +#include <linux/if_vlan.h> #include <linux/skbuff.h> #include <linux/netdevice.h> #include <linux/udp.h>
@@ -51,16 +54,33 @@ int vxlan_xmit_skb(struct vxlan_sock *vs __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, __be16 src_port, __be16 dst_port, __be32 vni, bool xnet); -static inline bool vxlan_gso_check (struct sk_buff *skb) +static inline netdev_features_t vxlan_features_check (struct sk_buff *skb, +netdev_features_t features) { -if ((skb_shinfo (skb)->gso_type &SKB_GSO_UDP_TUNNEL ) && +u8 l4_hdr =0 ; + +if (!skb->encapsulation) +return features; + +switch (vlan_get_protocol (skb)) { +case htons (ETH_P_IP ): + l4_hdr =ip_hdr (skb)->protocol; +break ; +case htons (ETH_P_IPV6 ): + l4_hdr =ipv6_hdr (skb)->nexthdr; +break ; +default : +return features;; + } + +if ((l4_hdr ==IPPROTO_UDP ) && (skb->inner_protocol_type !=ENCAP_TYPE_ETHER || skb->inner_protocol !=htons (ETH_P_TEB ) || (skb_inner_mac_header (skb) -skb_transport_header (skb) !=sizeof (struct udphdr ) +sizeof (struct vxlanhdr )))) -return false; +return features & ~(NETIF_F_ALL_CSUM |NETIF_F_GSO_MASK ); -return true; +return features; }/* IP header + UDP + VXLAN + Ethernet header */
net/core/dev.c +14 -9
@@ -2566,7 +2566,7 @@ static netdev_features_t harmonize_featunetdev_features_t netif_skb_features (struct sk_buff *skb) { -const struct net_device *dev = skb->dev; +struct net_device *dev = skb->dev;netdev_features_t features = dev->features;u16 gso_segs =skb_shinfo (skb)->gso_segs;__be16 protocol = skb->protocol;
@@ -2574,13 +2574,20 @@ netdev_features_t netif_skb_features(strif (gso_segs > dev->gso_max_segs || gso_segs < dev->gso_min_segs) features &= ~NETIF_F_GSO_MASK ; +/* If encapsulation offload request, verify we are testing +* hardware encapsulation features instead of standard +* features for the netdev +*/ +if (skb->encapsulation) + features &= dev->hw_enc_features; +if (!vlan_tx_tag_present (skb)) {if (unlikely (protocol ==htons (ETH_P_8021Q ) || protocol ==htons (ETH_P_8021AD ))) {struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; protocol = veh->h_vlan_encapsulated_proto; }else { -return harmonize_features (skb, features); + goto finalize; } }
@@ -2598,6 +2605,11 @@ netdev_features_t netif_skb_features(strNETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX); +finalize: +if (dev->netdev_ops->ndo_features_check) + features &= dev->netdev_ops->ndo_features_check (skb, dev, + features); +return harmonize_features (skb, features); }EXPORT_SYMBOL (netif_skb_features);
@@ -2672,13 +2684,6 @@ static struct sk_buff *validate_xmit_skbif (unlikely (!skb)) goto out_null; -/* If encapsulation offload request, verify we are testing -* hardware encapsulation features instead of standard -* features for the netdev -*/ -if (skb->encapsulation) - features &= dev->hw_enc_features; -if (netif_needs_gso (dev, skb, features)) {struct sk_buff *segs;
Greg Kroah-Hartman
maintainerPATCH 20/183 net/mlx4_core: Correcly update the mtts offset in the MR re-reg flow
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maor Gottlieb <[email protected]>
[ Upstream commit a51e0df4c1e06afd7aba84496c14238e6b363caa ]
Previously, mlx4_mt_rereg_write filled the MPT's entity_size with the old MTT's page shift, which could result in using an incorrect offset. Fix the initialization to be after we calculate the new MTT offset.
In addition, assign mtt order to -1 after calling mlx4_mtt_cleanup. This is necessary in order to mark the MTT as invalid and avoid freeing it later.
--- drivers/net/ethernet/mellanox/mlx4/mr.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx4/mr.c +5 -4
@@ -590,6 +590,7 @@ EXPORT_SYMBOL_GPL(mlx4_mr_free);void mlx4_mr_rereg_mem_cleanup (struct mlx4_dev *dev,struct mlx4_mr *mr) {mlx4_mtt_cleanup (dev, &mr->mtt); + mr->mtt.order =-1 ; }EXPORT_SYMBOL_GPL (mlx4_mr_rereg_mem_cleanup);
@@ -599,14 +600,14 @@ int mlx4_mr_rereg_mem_write(struct mlx4_ {int err; - mpt_entry->start =cpu_to_be64 (iova); - mpt_entry->length =cpu_to_be64 (size); - mpt_entry->entity_size =cpu_to_be32 (page_shift); - err =mlx4_mtt_init (dev, npages, page_shift, &mr->mtt);if (err)return err; + mpt_entry->start =cpu_to_be64 (mr->iova); + mpt_entry->length =cpu_to_be64 (mr->size); + mpt_entry->entity_size =cpu_to_be32 (mr->mtt.page_shift); + mpt_entry->pd_flags &=cpu_to_be32 (MLX4_MPT_PD_MASK |MLX4_MPT_PD_FLAG_EN_INV ); mpt_entry->flags &= cpu_to_be32(MLX4_MPT_FLAG_FREE |
Greg Kroah-Hartman
maintainerPATCH 21/183 tcp: Do not apply TSO segment limit to non-TSO packets
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
[ Upstream commit 843925f33fcc293d80acf2c5c8a78adf3344d49b ]
Thomas Jarosch reported IPsec TCP stalls when a PMTU event occurs.
In fact the problem was completely unrelated to IPsec. The bug is also reproducible if you just disable TSO/GSO.
The problem is that when the MSS goes down, existing queued packet on the TX queue that have not been transmitted yet all look like TSO packets and get treated as such.
This then triggers a bug where tcp_mss_split_point tells us to generate a zero-sized packet on the TX queue. Once that happens we're screwed because the zero-sized packet can never be removed by ACKs.
Cheers,
--- net/ipv4/tcp_output.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/tcp_output.c +2 -2
@@ -1984,7 +1984,7 @@ static bool tcp_write_xmit(struct sock *if (unlikely (!tcp_snd_wnd_test (tp, skb, mss_now)))break ; -if (tso_segs ==1 ) { +if (tso_segs ==1 || !sk->sk_gso_max_segs) {if (unlikely (!tcp_nagle_test (tp, skb, mss_now, (tcp_skb_is_last (sk, skb) ? nonagle :TCP_NAGLE_PUSH ))))
@@ -2020,7 +2020,7 @@ static bool tcp_write_xmit(struct sock * } limit = mss_now; -if (tso_segs >1 && !tcp_urg_mode (tp)) +if (tso_segs >1 && sk->sk_gso_max_segs && !tcp_urg_mode (tp)) limit = tcp_mss_split_point(sk, skb, mss_now, min_t(unsigned int, cwnd_quota,
Greg Kroah-Hartman
maintainerPATCH 22/183 xen-netback: fixing the propagation of the transmit shaper timeout
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Palik, Imre" <[email protected]>
[ Upstream commit 07ff890daeda31cf23173865edf50bcb03e100c3 ]
Since e9ce7cb6b107 ("xen-netback: Factor queue-specific data into queue struct"), the transimt shaper timeout is always set to 0. The value the user sets via xenbus is never propagated to the transmit shaper.
This patch fixes the issue.
--- drivers/net/xen-netback/xenbus.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/xen-netback/xenbus.c +1 -0
@@ -736,6 +736,7 @@ static void connect(struct backend_info } queue->remaining_credit = credit_bytes; + queue->credit_usec = credit_usec; err =connect_rings (be, queue);if (err) {
Greg Kroah-Hartman
maintainerPATCH 23/183 alx: fix alx_poll()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 7a05dc64e2e4c611d89007b125b20c0d2a4d31a5 ]
Commit d75b1ade567f ("net: less interrupt masking in NAPI") uncovered wrong alx_poll() behavior.
A NAPI poll() handler is supposed to return exactly the budget when/if napi_complete() has not been called.
It is also supposed to return number of frames that were received, so that netdev_budget can have a meaning.
Also, in case of TX pressure, we still have to dequeue received packets : alx_clean_rx_irq() has to be called even if alx_clean_tx_irq(alx) returns false, otherwise device is half duplex.
--- drivers/net/ethernet/atheros/alx/main.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/net/ethernet/atheros/alx/main.c +13 -11
@@ -184,15 +184,16 @@ static void alx_schedule_reset(struct alschedule_work (&alx->reset_wk); } -static bool alx_clean_rx_irq (struct alx_priv *alx,int budget) +static int alx_clean_rx_irq (struct alx_priv *alx,int budget) {struct alx_rx_queue *rxq = &alx->rxq;struct alx_rrd *rrd;struct alx_buffer *rxb;struct sk_buff *skb;u16 length, rfd_cleaned =0 ; +int work =0 ; -while (budget >0 ) { +while (work < budget) { rrd = &rxq->rrd[rxq->rrd_read_idx];if (!(rrd->word3 &cpu_to_le32 (1 <<RRD_UPDATED_SHIFT )))break ;
@@ -203,7 +204,7 @@ static bool alx_clean_rx_irq(struct alx_ ALX_GET_FIELD(le32_to_cpu(rrd->word0), RRD_NOR) != 1) {alx_schedule_reset (alx); -return 0 ; +return work; } rxb = &rxq->bufs[rxq->read_idx];
@@ -243,7 +244,7 @@ static bool alx_clean_rx_irq(struct alx_ }napi_gro_receive (&alx->napi, skb); - budget--; + work++; next_pkt:if (++rxq->read_idx == alx->rx_ringsz)
@@ -258,21 +259,22 @@ next_pkt:if (rfd_cleaned)alx_refill_rx_ring (alx,GFP_ATOMIC ); -return budget >0 ; +return work; }static int alx_poll (struct napi_struct *napi,int budget) { struct alx_priv *alx = container_of(napi, struct alx_priv, napi);struct alx_hw *hw = &alx->hw; -bool complete = true;unsigned long flags; +bool tx_complete; +int work; - complete =alx_clean_tx_irq (alx) && -alx_clean_rx_irq (alx, budget); + tx_complete =alx_clean_tx_irq (alx); + work =alx_clean_rx_irq (alx, budget); -if (!complete) -return 1 ; +if (!tx_complete || work == budget) +return budget;napi_complete (&alx->napi);
@@ -284,7 +286,7 @@ static int alx_poll(struct napi_struct *alx_post_write (hw); -return 0 ; +return work; }static irqreturn_t alx_intr_handle (struct alx_priv *alx,u32 intr)
Greg Kroah-Hartman
maintainerPATCH 24/183 team: avoid possible underflow of count_pending value for notify_peers and mcast_rejoin
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Pirko <[email protected]>
[ Upstream commit b0d11b42785b70e19bc6a3122eead3f7969a7589 ]
This patch is fixing a race condition that may cause setting count_pending to -1, which results in unwanted big bulk of arp messages (in case of "notify peers").
Consider following scenario:
count_pending == 2
CPU0 CPU1
team_notify_peers_work
atomic_dec_and_test (dec count_pending to 1) schedule_delayed_work
team_notify_peers
atomic_add (adding 1 to count_pending)
team_notify_peers_work
atomic_dec_and_test (dec count_pending to 1) schedule_delayed_work
team_notify_peers_work
atomic_dec_and_test (dec count_pending to 0)
schedule_delayed_work
team_notify_peers_work
atomic_dec_and_test (dec count_pending to -1)
Fix this race by using atomic_dec_if_positive - that will prevent count_pending running under 0.
--- drivers/net/team/team.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/net/team/team.c +14 -2
@@ -629,6 +629,7 @@ static int team_change_mode(struct teamstatic void team_notify_peers_work (struct work_struct *work) {struct team *team; +int val; team = container_of(work, struct team, notify_peers.dw.work);
@@ -636,9 +637,14 @@ static void team_notify_peers_work(strucschedule_delayed_work (&team->notify_peers.dw,0 );return ; } + val =atomic_dec_if_positive (&team->notify_peers.count_pending); +if (val <0 ) { +rtnl_unlock (); +return ; + }call_netdevice_notifiers (NETDEV_NOTIFY_PEERS , team->dev);rtnl_unlock (); -if (!atomic_dec_and_test (&team->notify_peers.count_pending)) +if (val)schedule_delayed_work (&team->notify_peers.dw,msecs_to_jiffies (team->notify_peers.interval)); }
@@ -669,6 +675,7 @@ static void team_notify_peers_fini(strucstatic void team_mcast_rejoin_work (struct work_struct *work) {struct team *team; +int val; team = container_of(work, struct team, mcast_rejoin.dw.work);
@@ -676,9 +683,14 @@ static void team_mcast_rejoin_work(strucschedule_delayed_work (&team->mcast_rejoin.dw,0 );return ; } + val =atomic_dec_if_positive (&team->mcast_rejoin.count_pending); +if (val <0 ) { +rtnl_unlock (); +return ; + }call_netdevice_notifiers (NETDEV_RESEND_IGMP , team->dev);rtnl_unlock (); -if (!atomic_dec_and_test (&team->mcast_rejoin.count_pending)) +if (val)schedule_delayed_work (&team->mcast_rejoin.dw,msecs_to_jiffies (team->mcast_rejoin.interval)); }
Greg Kroah-Hartman
maintainerPATCH 25/183 enic: fix rx skb checksum
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Govindarajulu Varadarajan <[email protected]>
[ Upstream commit 17e96834fd35997ca7cdfbf15413bcd5a36ad448 ]
Hardware always provides compliment of IP pseudo checksum. Stack expects whole packet checksum without pseudo checksum if CHECKSUM_COMPLETE is set.
This causes checksum error in nf & ovs.
kernel: qg-19546f09-f2: hw csum failure
kernel: CPU: 9 PID: 0 Comm: swapper/9 Tainted: GF O-------------- 3.10.0-123.8.1.el7.x86_64 #1
kernel: Hardware name: Cisco Systems Inc UCSB-B200-M3/UCSB-B200-M3, BIOS B200M3.2.2.3.0.080820141339 08/08/2014
kernel: ffff881218f40000 df68243feb35e3a8 ffff881237a43ab8 ffffffff815e237b
kernel: ffff881237a43ad0 ffffffff814cd4ca ffff8829ec71eb00 ffff881237a43af0
kernel: ffffffff814c6232 0000000000000286 ffff8829ec71eb00 ffff881237a43b00
kernel: Call Trace:
kernel: <IRQ> [<ffffffff815e237b>] dump_stack+0x19/0x1b
kernel: [<ffffffff814cd4ca>] netdev_rx_csum_fault+0x3a/0x40
kernel: [<ffffffff814c6232>] __skb_checksum_complete_head+0x62/0x70
kernel: [<ffffffff814c6251>] __skb_checksum_complete+0x11/0x20
kernel: [<ffffffff8155a20c>] nf_ip_checksum+0xcc/0x100
kernel: [<ffffffffa049edc7>] icmp_error+0x1f7/0x35c [nf_conntrack_ipv4]
kernel: [<ffffffff814cf419>] ? netif_rx+0xb9/0x1d0
kernel: [<ffffffffa040eb7b>] ? internal_dev_recv+0xdb/0x130 [openvswitch]
kernel: [<ffffffffa04c8330>] nf_conntrack_in+0xf0/0xa80 [nf_conntrack]
kernel: [<ffffffff81509380>] ? inet_del_offload+0x40/0x40
kernel: [<ffffffffa049e302>] ipv4_conntrack_in+0x22/0x30 [nf_conntrack_ipv4]
kernel: [<ffffffff815005ca>] nf_iterate+0xaa/0xc0
kernel: [<ffffffff81509380>] ? inet_del_offload+0x40/0x40
kernel: [<ffffffff81500664>] nf_hook_slow+0x84/0x140
kernel: [<ffffffff81509380>] ? inet_del_offload+0x40/0x40
kernel: [<ffffffff81509dd4>] ip_rcv+0x344/0x380
Hardware verifies IP & tcp/udp header checksum but does not provide payload checksum, use CHECKSUM_UNNECESSARY. Set it only if its valid IP tcp/udp packet.
--- drivers/net/ethernet/cisco/enic/enic_main.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/cisco/enic/enic_main.c +8 -4
@@ -1059,10 +1059,14 @@ static void enic_rq_indicate_buf(struct PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3); } -if ((netdev->features &NETIF_F_RXCSUM ) && !csum_not_calc) { - skb->csum =htons (checksum); - skb->ip_summed =CHECKSUM_COMPLETE ; - } +/* Hardware does not provide whole packet checksum. It only +* provides pseudo checksum. Since hw validates the packet +* checksum but not provide us the checksum value. use +* CHECSUM_UNNECESSARY. +*/ +if ((netdev->features &NETIF_F_RXCSUM ) && tcp_udp_csum_ok && + ipv4_csum_ok) + skb->ip_summed =CHECKSUM_UNNECESSARY ;if (vlan_stripped)__vlan_hwaccel_put_tag (skb,htons (ETH_P_8021Q ), vlan_tci);
Greg Kroah-Hartman
maintainerPATCH 26/183 drm/vmwgfx: Dont use memory accounting for kernel-side fence objects
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Hellstrom <[email protected]>
commit 1f563a6a46544602183e7493b6ef69769d3d76d9 upstream.
Kernel side fence objects are used when unbinding resources and may thus be created as part of a memory reclaim operation. This might trigger recursive memory reclaims and result in the kernel running out of stack space.
So a simple way out is to avoid accounting of these fence objects. In principle this is OK since while user-space can trigger the creation of such objects, it can't really hold on to them. However, their lifetime is quite long, so some form of accounting should perhaps be implemented in the future.
Fixes kernel crashes when running, for example viewperf11 ensight-04 test 3 with low system memory settings.
--- drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c +2 -20
@@ -545,35 +545,19 @@ void vmw_fence_obj_flush(struct vmw_fencstatic void vmw_fence_destroy (struct vmw_fence_obj *fence) { -struct vmw_fence_manager *fman =fman_from_fence (fence); -fence_free (&fence->base); - -/* -* Free kernel space accounting. -*/ -ttm_mem_global_free (vmw_mem_glob (fman->dev_priv), - fman->fence_size); }int vmw_fence_create (struct vmw_fence_manager *fman,uint32_t seqno,struct vmw_fence_obj **p_fence) { -struct ttm_mem_global *mem_glob =vmw_mem_glob (fman->dev_priv);struct vmw_fence_obj *fence;int ret; - ret =ttm_mem_global_alloc (mem_glob, fman->fence_size, - false, false); -if (unlikely (ret !=0 )) -return ret; - fence =kzalloc (sizeof (*fence),GFP_KERNEL ); -if (unlikely (fence ==NULL )) { - ret = -ENOMEM ; - goto out_no_object; - } +if (unlikely (fence ==NULL )) +return -ENOMEM ; ret =vmw_fence_obj_init (fman, fence, seqno, vmw_fence_destroy);
@@ -585,8 +569,6 @@ int vmw_fence_create(struct vmw_fence_ma out_err_init:kfree (fence); -out_no_object: -ttm_mem_global_free (mem_glob, fman->fence_size);return ret; }
Greg Kroah-Hartman
maintainerPATCH 27/183 drm/vmwgfx: Fix error printout on signals pending
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Hellstrom <[email protected]>
commit e338c4c2b620ba4e75fd3576f8142eb93be12ce3 upstream.
The function vmw_master_check() might return -ERESTARTSYS if there is a signal pending, indicating that the IOCTL should be rerun, potentially from user-space. At that point we shouldn't print out an error message since that is not an error condition. In short, avoid bloating the kernel log when a process refuses to die on SIGTERM.
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +6 -2
@@ -1063,8 +1063,12 @@ static long vmw_generic_ioctl(struct fil vmaster =vmw_master_check (dev, file_priv, flags);if (unlikely (IS_ERR (vmaster))) { -DRM_INFO ("IOCTL ERROR %d\n" , nr); -return PTR_ERR (vmaster); + ret =PTR_ERR (vmaster); + +if (ret != -ERESTARTSYS ) +DRM_INFO ("IOCTL ERROR Command %d, Error %ld.\n" , + nr, ret); +return ret; } ret =ioctl_func (filp, cmd, arg);
Greg Kroah-Hartman
maintainerPATCH 28/183 drm/vmwgfx: Fix fence event code
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Hellstrom <[email protected]>
commit 89669e7a7f96be3ee8d9a22a071d7c0d3b4428fc upstream.
The commit "vmwgfx: Rework fence event action" introduced a number of bugs that are fixed with this commit:
a) A forgotten return stateemnt.
b) An if statement with identical branches.
--- drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c +6 -11
@@ -1087,6 +1087,8 @@ static int vmw_event_fence_action_createif (ret !=0 ) goto out_no_queue; +return 0 ; + out_no_queue: event->base.destroy (&event->base); out_no_event:
@@ -1162,17 +1164,10 @@ int vmw_fence_event_ioctl(struct drm_devBUG_ON (fence ==NULL ); -if (arg->flags &DRM_VMW_FE_FLAG_REQ_TIME ) - ret =vmw_event_fence_action_create (file_priv, fence, - arg->flags, - arg->user_data, - true); -else - ret =vmw_event_fence_action_create (file_priv, fence, - arg->flags, - arg->user_data, - true); - + ret =vmw_event_fence_action_create (file_priv, fence, + arg->flags, + arg->user_data, + true);if (unlikely (ret !=0 )) {if (ret != -ERESTARTSYS )DRM_ERROR ("Failed to attach event to fence.\n" );
Greg Kroah-Hartman
maintainerPATCH 29/183 drm/ttm: Avoid memory allocation from shrinker functions.
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
commit 881fdaa5e4cb0d68e52acab0ad4e1820e2bfffa4 upstream.
Quoted 20 lines · Andrew Morton
Quoted 18 lines · On Wed, 12 Nov 2014 13:08:55 +0900 Tetsuo Handa…
Quoted 1 line · Andrew Morton
Poor ttm guys - this is a bit of a trap we set for them.
Commit
a91576d7916f6cce("drm/ttm: Pass GFP flags in order to avoid deadlock.") changed to usesc->gfp_maskrather thanGFP_KERNEL.(quoted diff) +1
-2- pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), - GFP_KERNEL); + pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), gfp);But this bug is caused by
sc->gfp_maskcontaining some flags which are not inGFP_KERNEL, right? Then, I think(quoted diff) +1
-1- pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), gfp); + pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), gfp & GFP_KERNEL);would hide this bug.
Quoted 8 lines
Quoted 1 line
But I think we should use
GFP_ATOMIC(or drop__GFP_WAITflag)Well no -
ttm_page_pool_free()should stop calling kmalloc altogether. Just dostruct page *pages_to_free[16];and rework the code to free 16 pages at a time. Easy.
Well, ttm code wants to process 512 pages at a time for performance. Memory footprint increased by 512 * sizeof(struct page *) buffer is only 4096 bytes. What about using static buffer like below?
----------
Quoted 1 line
Quoted 1 line
From
d3cb5393c9c8099d6b37e769f78c31af1541fe8cMon Sep 17 00:00:00 2001
From: Tetsuo Handa <[email protected]>
Date: Thu, 13 Nov 2014 22:21:54 +0900
Subject: [PATCH 3.18 029/183] drm/ttm: Avoid memory allocation from shrinker functions.
Commit a91576d7916f6cce ("drm/ttm: Pass GFP flags in order to avoid deadlock.") caused BUG_ON() due to sc->gfp_mask containing flags which are not in GFP_KERNEL.
https://bugzilla.kernel.org/show_bug.cgi?id=87891
Changing from sc->gfp_mask to (sc->gfp_mask & GFP_KERNEL) would avoid the BUG_ON(), but avoiding memory allocation from shrinker function is better and reliable fix.
Shrinker function is already serialized by global lock, and clean up function is called after shrinker function is unregistered. Thus, we can use static buffer when called from shrinker function and clean up function.
--- drivers/gpu/drm/ttm/ttm_page_alloc.c | 26 +++++++++++++++----------- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 25 +++++++++++++++---------- 2 files changed, 30 insertions(+), 21 deletions(-)
drivers/gpu/drm/ttm/ttm_page_alloc.c +15 -11
@@ -297,11 +297,12 @@ static void ttm_pool_update_free_locked(* * @pool: to free the pages from * @free_all: If set to true will free all pages in pool -* @gfp: GFP flags. +* @use_static: Safe to use static buffer **/ static int ttm_page_pool_free (struct ttm_page_pool *pool,unsigned nr_free, -gfp_t gfp) +bool use_static) { +static struct page *static_buf[NUM_PAGES_TO_ALLOC ];unsigned long irq_flags;struct page *p;struct page **pages_to_free;
@@ -311,7 +312,11 @@ static int ttm_page_pool_free(struct ttmif (NUM_PAGES_TO_ALLOC < nr_free) npages_to_free =NUM_PAGES_TO_ALLOC ; - pages_to_free =kmalloc (npages_to_free *sizeof (struct page *), gfp); +if (use_static) + pages_to_free = static_buf; +else + pages_to_free =kmalloc (npages_to_free *sizeof (struct page *), +GFP_KERNEL );if (!pages_to_free) {pr_err ("Failed to allocate memory for pool free operation\n" );return 0 ;
@@ -374,7 +379,8 @@ restart:if (freed_pages)ttm_pages_put (pages_to_free, freed_pages); out: -kfree (pages_to_free); +if (pages_to_free != static_buf) +kfree (pages_to_free);return nr_free; }
@@ -383,8 +389,6 @@ out:* * XXX: (dchinner) Deadlock warning! * -* We need to pass sc->gfp_mask to ttm_page_pool_free(). -* * This code is crying out for a shrinker per pool.... */ static unsigned long
@@ -407,8 +411,8 @@ ttm_pool_shrink_scan(struct shrinker *shif (shrink_pages ==0 )break ; pool = &_manager->pools[(i + pool_offset)%NUM_POOLS ]; - shrink_pages =ttm_page_pool_free (pool, nr_free, - sc->gfp_mask); +/* OK to use static buffer since global mutex is held. */ + shrink_pages =ttm_page_pool_free (pool, nr_free, true); freed += nr_free - shrink_pages; }mutex_unlock (&lock);
@@ -710,7 +714,7 @@ static void ttm_put_pages(struct page ** }spin_unlock_irqrestore (&pool->lock, irq_flags);if (npages) -ttm_page_pool_free (pool, npages,GFP_KERNEL ); +ttm_page_pool_free (pool, npages, false); }/*
@@ -849,9 +853,9 @@ void ttm_page_alloc_fini(void)pr_info ("Finalizing pool allocator\n" );ttm_pool_mm_shrink_fini (_manager); +/* OK to use static buffer since global mutex is no longer used. */ for (i =0 ; i <NUM_POOLS ; ++i) -ttm_page_pool_free (&_manager->pools[i],FREE_ALL_PAGES , -GFP_KERNEL ); +ttm_page_pool_free (&_manager->pools[i],FREE_ALL_PAGES , true);kobject_put (&_manager->kobj); _manager =NULL ;
drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +15 -10
@@ -411,11 +411,12 @@ static void ttm_dma_page_put(struct dma_* * @pool: to free the pages from * @nr_free: If set to true will free all pages in pool -* @gfp: GFP flags. +* @use_static: Safe to use static buffer **/ static unsigned ttm_dma_page_pool_free (struct dma_pool *pool,unsigned nr_free, -gfp_t gfp) +bool use_static) { +static struct page *static_buf[NUM_PAGES_TO_ALLOC ];unsigned long irq_flags;struct dma_page *dma_p, *tmp;struct page **pages_to_free;
@@ -432,7 +433,11 @@ static unsigned ttm_dma_page_pool_free(s npages_to_free, nr_free); }#endif - pages_to_free =kmalloc (npages_to_free *sizeof (struct page *), gfp); +if (use_static) + pages_to_free = static_buf; +else + pages_to_free =kmalloc (npages_to_free *sizeof (struct page *), +GFP_KERNEL );if (!pages_to_free) { pr_err("%s: Failed to allocate memory for pool free operation\n",
@@ -502,7 +507,8 @@ restart:if (freed_pages)ttm_dma_pages_put (pool, &d_pages, pages_to_free, freed_pages); out: -kfree (pages_to_free); +if (pages_to_free != static_buf) +kfree (pages_to_free);return nr_free; }
@@ -531,7 +537,8 @@ static void ttm_dma_free_pool(struct devif (pool->type != type)continue ;/* Takes a spinlock.. */ -ttm_dma_page_pool_free (pool,FREE_ALL_PAGES ,GFP_KERNEL ); +/* OK to use static buffer since global mutex is held. */ +ttm_dma_page_pool_free (pool,FREE_ALL_PAGES , true);WARN_ON (((pool->npages_in_use + pool->npages_free) !=0 ));/* This code path is called after _all_ references to the * struct device has been dropped - so nobody should be
@@ -986,7 +993,7 @@ void ttm_dma_unpopulate(struct ttm_dma_t/* shrink pool if necessary (only on !is_cached pools)*/ if (npages) -ttm_dma_page_pool_free (pool, npages,GFP_KERNEL ); +ttm_dma_page_pool_free (pool, npages, false); ttm->state = tt_unpopulated; }EXPORT_SYMBOL_GPL (ttm_dma_unpopulate);
@@ -996,8 +1003,6 @@ EXPORT_SYMBOL_GPL(ttm_dma_unpopulate);* * XXX: (dchinner) Deadlock warning! * -* We need to pass sc->gfp_mask to ttm_dma_page_pool_free(). -* * I'm getting sadder as I hear more pathetical whimpers about needing per-pool * shrinkers */
@@ -1030,8 +1035,8 @@ ttm_dma_pool_shrink_scan(struct shrinkerif (++idx < pool_offset)continue ; nr_free = shrink_pages; - shrink_pages =ttm_dma_page_pool_free (p->pool, nr_free, - sc->gfp_mask); +/* OK to use static buffer since global mutex is held. */ + shrink_pages =ttm_dma_page_pool_free (p->pool, nr_free, true); freed += nr_free - shrink_pages; pr_debug("%s: (%s:%d) Asked to shrink %d, have %d more to go\n",
Greg Kroah-Hartman
maintainerPATCH 30/183 drm/fb_helper: move deferred fb checking into restore mode (v2)
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
commit e2809c7db818df6bbd0edf843e1beb2fbc9d8541 upstream.
On MST systems the monitors don't appear when we set the fb up, but plymouth opens the drm device and holds it open while they come up, when plymouth finishes and lastclose gets called we don't do the delayed fb probe, so the monitor never appears on the console.
Fix this by moving the delayed checking into the mode restore.
v2: Daniel suggested that ->delayed_hotplug is set under the mode_config mutex, so we should check it under that as well, while we are in the area.
--- drivers/gpu/drm/drm_fb_helper.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +9 -4
@@ -347,9 +347,18 @@ bool drm_fb_helper_restore_fbdev_mode_un {struct drm_device *dev = fb_helper->dev;bool ret; +bool do_delayed = false; +drm_modeset_lock_all (dev); ret =restore_fbdev_mode (fb_helper); + + do_delayed = fb_helper->delayed_hotplug; +if (do_delayed) + fb_helper->delayed_hotplug = false;drm_modeset_unlock_all (dev); + +if (do_delayed) +drm_fb_helper_hotplug_event (fb_helper);return ret; }EXPORT_SYMBOL (drm_fb_helper_restore_fbdev_mode_unlocked);
@@ -888,10 +897,6 @@ int drm_fb_helper_set_par(struct fb_infodrm_fb_helper_restore_fbdev_mode_unlocked (fb_helper); -if (fb_helper->delayed_hotplug) { - fb_helper->delayed_hotplug = false; -drm_fb_helper_hotplug_event (fb_helper); - }return 0 ; }EXPORT_SYMBOL (drm_fb_helper_set_par);
Greg Kroah-Hartman
maintainerPATCH 31/183 drm/dp: retry AUX transactions 32 times (v1.1)
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
commit 19a93f042fc241ecdf98543cedfe7c171f8cdf53 upstream.
At least on two MST devices I've tested with, when they are link training downstream, they are totally unable to handle aux ch msgs, so they defer like nuts. I tried 16, it wasn't enough, 32 seems better.
This fixes one Dell 4k monitor and one of the MST hubs.
v1.1: fixup comment (Tom).
--- drivers/gpu/drm/drm_dp_helper.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_dp_helper.c +4 -3
@@ -378,10 +378,11 @@ static int drm_dp_dpcd_access(struct drm/* * The specification doesn't give any recommendation on how often to -* retry native transactions, so retry 7 times like for I2C-over-AUX -* transactions. +* retry native transactions. We used to retry 7 times like for +* aux i2c transactions but real world devices this wasn't +* sufficient, bump to 32 which makes Dell 4k monitors happier. */ -for (retry =0 ; retry <7 ; retry++) { +for (retry =0 ; retry <32 ; retry++) {mutex_lock (&aux->hw_mutex); err = aux->transfer (aux, &msg);
Greg Kroah-Hartman
maintainerPATCH 32/183 drm/dp-mst: Remove branches before dropping the reference
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit 0391359ddf79b52bb7e7bb9ace08e34fb08b0e76 upstream.
When we unplug a dp mst branch we unreference the entire tree from the root towards the leaves. Which is ok, since that's the way the pointers and so also the refcounts go.
But when we drop the reference we must make sure that we remove the branches/ports from the lists/pointers before dropping the reference. Otherwise the get_validated functions will still return it instead of returning NULL (which indicates a potentially on-going unplug).
The mst branch destroy gets this right for ports: First it deletes the port from the ports list, then it unrefs. But the ports destroy function gets it wrong: First it unrefs, then it drops the ref. Which means a zombie mst branch can still be validate with get_validated_mstb_ref when it shouldn't.
Fix this.
This should address a backtrace Dave dug out somewhere on unplug:
[<ffffffffa00cc262>] drm_dp_mst_get_validated_mstb_ref_locked+0x92/0xa0 [drm_kms_helper] [<ffffffffa00cc211>] drm_dp_mst_get_validated_mstb_ref_locked+0x41/0xa0 [drm_kms_helper] [<ffffffffa00cc2aa>] drm_dp_get_validated_mstb_ref+0x3a/0x60 [drm_kms_helper] [<ffffffffa00cc2fb>] drm_dp_payload_send_msg.isra.14+0x2b/0x100 [drm_kms_helper] [<ffffffffa00cc547>] drm_dp_update_payload_part1+0x177/0x360 [drm_kms_helper] [<ffffffffa015c52e>] intel_mst_disable_dp+0x3e/0x80 [i915] [<ffffffffa013d60b>] haswell_crtc_disable+0x1cb/0x340 [i915] [<ffffffffa0136739>] intel_crtc_control+0x49/0x100 [i915] [<ffffffffa0136857>] intel_crtc_update_dpms+0x67/0x80 [i915] [<ffffffffa013fa59>] intel_connector_dpms+0x59/0x70 [i915] [<ffffffffa015c752>] intel_dp_destroy_mst_connector+0x32/0xc0 [i915] [<ffffffffa00cb44b>] drm_dp_destroy_port+0x6b/0xa0 [drm_kms_helper] [<ffffffffa00cb588>] drm_dp_destroy_mst_branch_device+0x108/0x130 [drm_kms_helper] [<ffffffffa00cb3cd>] drm_dp_port_teardown_pdt+0x3d/0x50 [drm_kms_helper] [<ffffffffa00cdb79>] drm_dp_mst_handle_up_req+0x499/0x540 [drm_kms_helper] [<ffffffff810d9ead>] ? trace_hardirqs_on_caller+0x15d/0x200 [<ffffffffa00cdc73>] drm_dp_mst_hpd_irq+0x53/0xa00 [drm_kms_helper] [<ffffffffa00c7dfb>] ? drm_dp_dpcd_read+0x1b/0x20 [drm_kms_helper] [<ffffffffa0153ed8>] ? intel_dp_dpcd_read_wake+0x38/0x70 [i915] [<ffffffffa015a225>] intel_dp_check_mst_status+0xb5/0x250 [i915] [<ffffffffa015ac71>] intel_dp_hpd_pulse+0x181/0x210 [i915] [<ffffffffa01104f6>] i915_digport_work_func+0x96/0x120 [i915]
--- drivers/gpu/drm/drm_dp_mst_topology.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_dp_mst_topology.c +4 -1
@@ -839,6 +839,8 @@ static void drm_dp_put_mst_branch_devicestatic void drm_dp_port_teardown_pdt (struct drm_dp_mst_port *port,int old_pdt) { +struct drm_dp_mst_branch *mstb; +switch (old_pdt) {case DP_PEER_DEVICE_DP_LEGACY_CONV :case DP_PEER_DEVICE_SST_SINK :
@@ -846,8 +848,9 @@ static void drm_dp_port_teardown_pdt(strdrm_dp_mst_unregister_i2c_bus (&port->aux);break ;case DP_PEER_DEVICE_MST_BRANCHING : -drm_dp_put_mst_branch_device (port->mstb); + mstb = port->mstb; port->mstb =NULL ; +drm_dp_put_mst_branch_device (mstb);break ; } }
Greg Kroah-Hartman
maintainerPATCH 33/183 drm/radeon: fix typo in CI dpm disable
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 129acb7c0b682512e89c4f65c33593d50f2f49a9 upstream.
Need to disable DS, not enable it when disabling dpm.
--- drivers/gpu/drm/radeon/ci_dpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/ci_dpm.c +1 -1
@@ -4729,7 +4729,7 @@ void ci_dpm_disable(struct radeon_deviceci_enable_spread_spectrum (rdev, false);ci_enable_auto_throttle_source (rdev,RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL , false);ci_stop_dpm (rdev); -ci_enable_ds_master_switch (rdev, true); +ci_enable_ds_master_switch (rdev, false);ci_enable_ulv (rdev, false);ci_clear_vc (rdev);ci_reset_to_default (rdev);
Greg Kroah-Hartman
maintainerPATCH 34/183 drm/radeon: work around a hw bug in MGCG on CIK
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 4bb62c95a7e781a238b2ab374f34b1bf91e01ddc upstream.
Always need to set bit 0 of RLC_CGTT_MGCG_OVERRIDE to avoid unreliable doorbell updates in some cases.
--- drivers/gpu/drm/radeon/cik.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/radeon/cik.c +2 -1
@@ -6314,6 +6314,7 @@ static void cik_enable_mgcg(struct radeo } orig = data =RREG32 (RLC_CGTT_MGCG_OVERRIDE ); + data |=0x00000001 ; data &=0xfffffffd ;if (orig != data)WREG32 (RLC_CGTT_MGCG_OVERRIDE , data);
@@ -6345,7 +6346,7 @@ static void cik_enable_mgcg(struct radeo } }else { orig = data =RREG32 (RLC_CGTT_MGCG_OVERRIDE ); - data |=0x00000002 ; + data |=0x00000003 ;if (orig != data)WREG32 (RLC_CGTT_MGCG_OVERRIDE , data);
Greg Kroah-Hartman
maintainerPATCH 36/183 drm/radeon: KV has three PPLLs (v2)
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit fbedf1c3fc3a1e9f249c2efe2f4553d8df9d86d3 upstream.
Enable all three in the driver. Early documentation indicated the 3rd one was used for something else, but that is not the case.
v2: handle disable as well
--- drivers/gpu/drm/radeon/atombios_crtc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/atombios_crtc.c +4 -4
@@ -1851,10 +1851,9 @@ static int radeon_atom_pick_pll(struct dreturn pll; }/* otherwise, pick one of the plls */ -if ((rdev->family ==CHIP_KAVERI ) || - (rdev->family ==CHIP_KABINI ) || +if ((rdev->family ==CHIP_KABINI ) || (rdev->family ==CHIP_MULLINS )) { -/* KB/KV/ML has PPLL1 and PPLL2 */ +/* KB/ML has PPLL1 and PPLL2 */ pll_in_use =radeon_get_pll_use_mask (crtc);if (!(pll_in_use & (1 <<ATOM_PPLL2 )))return ATOM_PPLL2 ;
@@ -1863,7 +1862,7 @@ static int radeon_atom_pick_pll(struct dDRM_ERROR ("unable to allocate a PPLL\n" );return ATOM_PPLL_INVALID ; }else { -/* CI has PPLL0, PPLL1, and PPLL2 */ +/* CI/KV has PPLL0, PPLL1, and PPLL2 */ pll_in_use =radeon_get_pll_use_mask (crtc);if (!(pll_in_use & (1 <<ATOM_PPLL2 )))return ATOM_PPLL2 ;
@@ -2154,6 +2153,7 @@ static void atombios_crtc_disable(structcase ATOM_PPLL0 :/* disable the ppll */ if ((rdev->family ==CHIP_ARUBA ) || + (rdev->family ==CHIP_KAVERI ) || (rdev->family ==CHIP_BONAIRE ) || (rdev->family ==CHIP_HAWAII )) atombios_crtc_program_pll(crtc, radeon_crtc->crtc_id, radeon_crtc->pll_id,
Greg Kroah-Hartman
maintainerPATCH 37/183 drm/radeon: fix sad_count check for dce3
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 5665c3ebe5ee8a2c516925461f7214ba59c2e6d7 upstream.
Make it consistent with the sad code for other asics to deal with monitors that don't report sads.
bug:
https://bugzilla.kernel.org/show_bug.cgi?id=89461
--- drivers/gpu/drm/radeon/dce3_1_afmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/dce3_1_afmt.c +1 -1
@@ -103,7 +103,7 @@ static void dce3_2_afmt_write_sad_regs(s } sad_count =drm_edid_to_sad (radeon_connector->edid, &sads); -if (sad_count <0 ) { +if (sad_count <=0 ) {DRM_ERROR ("Couldn't read SADs: %d\n" , sad_count);return ; }
Greg Kroah-Hartman
maintainerPATCH 38/183 drm/radeon: adjust default bapm settings for KV
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 02ae7af53a451a1b0a51022c4693f5b339133e79 upstream.
Enabling bapm seems to cause clocking problems on some KV configurations. Disable it by default for now.
--- drivers/gpu/drm/radeon/kv_dpm.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/radeon/kv_dpm.c +4 -6
@@ -2745,13 +2745,11 @@ int kv_dpm_init(struct radeon_device *rd pi->enable_auto_thermal_throttling = true; pi->disable_nb_ps3_in_battery = false;if (radeon_bapm ==-1 ) { -/* There are stability issues reported on with -* bapm enabled on an asrock system. -*/ -if (rdev->pdev->subsystem_vendor ==0x1849 ) - pi->bapm_enable = false; -else +/* only enable bapm on KB, ML by default */ +if (rdev->family ==CHIP_KABINI || rdev->family ==CHIP_MULLINS ) pi->bapm_enable = true; +else + pi->bapm_enable = false; }else if (radeon_bapm ==0 ) { pi->bapm_enable = false; }else {
Greg Kroah-Hartman
maintainerPATCH 39/183 drm/radeon: properly filter DP1.2 4k modes on non-DP1.2 hw
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 410cce2a6b82299b46ff316c6384e789ce275ecb upstream.
The check was already in place in the dp mode_valid check, but radeon_dp_get_dp_link_clock() never returned the high clock mode_valid was checking for because that function clipped the clock based on the hw capabilities. Add an explicit check in the mode_valid function.
bug:
https://bugs.freedesktop.org/show_bug.cgi?id=87172
--- drivers/gpu/drm/radeon/atombios_dp.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/radeon/atombios_dp.c +4 -0
@@ -492,6 +492,10 @@ int radeon_dp_mode_valid_helper(struct dstruct radeon_connector_atom_dig *dig_connector;int dp_clock; +if ((mode->clock >340000 ) && + (!radeon_connector_is_dp12_capable (connector))) +return MODE_CLOCK_HIGH ; +if (!radeon_connector->con_priv)return MODE_CLOCK_HIGH ; dig_connector = radeon_connector->con_priv;
Greg Kroah-Hartman
maintainerPATCH 40/183 drm/i915: Dont complain about stolen conflicts on gen3
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit 0b6d24c01932db99fc95304235e751e7f7625c41 upstream.
Apparently stuff works that way on those machines.
I agree with Chris' concern that this is a bit risky but imo worth a shot in -next just for fun. Afaics all these machines have the pci resources allocated like that by the BIOS, so I suspect that it's all ok.
This regression goes back to
commit eaba1b8f3379b5d100bd146b9a41d28348bdfd09
Author: Chris Wilson <[email protected]> Date: Thu Jul 4 12:28:35 2013 +0100
drm/i915: Verify that our stolen memory doesn't conflict
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76983
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71031
--- drivers/gpu/drm/i915/i915_gem_stolen.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_stolen.c +5 -1
@@ -137,7 +137,11 @@ static unsigned long i915_stolen_to_phys r =devm_request_mem_region (dev->dev, base +1 , dev_priv->gtt.stolen_size -1 ,"Graphics Stolen Memory" ); -if (r ==NULL ) { +/* +* GEN3 firmware likes to smash pci bridges into the stolen +* range. Apparently this works. +*/ +if (r ==NULL && !IS_GEN3 (dev)) {DRM_ERROR ("conflict detected with stolen region: [0x%08x - 0x%08x]\n" , base, base + (uint32_t )dev_priv->gtt.stolen_size); base =0 ;
Greg Kroah-Hartman
maintainerPATCH 41/183 drm/i915: Disallow pin ioctl completely for kms drivers
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit d472fcc8379c062bd56a3876fc6ef22258f14a91 upstream.
The problem here is that SNA pins batchbuffers to etch out a bit more performance. Iirc it started out as a w/a for i830M (which we've implemented in the kernel since a long time already). The problem is that the pin ioctl wasn't added in
commit d23db88c3ab233daed18709e3a24d6c95344117f
Author: Chris Wilson <[email protected]> Date: Fri May 23 08:48:08 2014 +0200
drm/i915: Prevent negative relocation deltas from wrapping
Fix this by simply disallowing pinning from userspace so that the kernel is in full control of batch placement again. Especially since distros are moving towards running X as non-root, so most users won't even be able to see any benefits.
UMS support is dead now, but we need this minimal patch for backporting. Follow-up patch will remove the pin ioctl code completely.
Note to backporters: You must have both
commit b45305fce5bb1abec263fcff9d81ebecd6306ede
Author: Daniel Vetter <[email protected]> Date: Mon Dec 17 16:21:27 2012 +0100
drm/i915: Implement workaround for broken CS tlb on i830/845
which laned in 3.8 and
commit c4d69da167fa967749aeb70bc0e94a457e5d00c1
Author: Chris Wilson <[email protected]> Date: Mon Sep 8 14:25:41 2014 +0100
drm/i915: Evict CS TLBs between batches
which is also marked cc: stable. Otherwise this could introduce a regression by disabling the userspace w/a without the kernel w/a being fully functional on i830/45.
References: https://bugs.freedesktop.org/show_bug.cgi?id=76554#c116
--- drivers/gpu/drm/i915/i915_gem.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +4 -1
@@ -4193,7 +4193,7 @@ i915_gem_pin_ioctl(struct drm_device *destruct drm_i915_gem_object *obj;int ret; -if (INTEL_INFO (dev)->gen >=6 ) +if (drm_core_check_feature (dev,DRIVER_MODESET ))return -ENODEV ; ret =i915_mutex_lock_interruptible (dev);
@@ -4249,6 +4249,9 @@ i915_gem_unpin_ioctl(struct drm_device *struct drm_i915_gem_object *obj;int ret; +if (drm_core_check_feature (dev,DRIVER_MODESET )) +return -ENODEV ; + ret =i915_mutex_lock_interruptible (dev);if (ret)return ret;
Greg Kroah-Hartman
maintainerPATCH 42/183 drm/i915: Only warn the first time we attempt to mmio whilst suspended
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit 2b387059817fd100cddc5a97118d63e3f3fade74 upstream.
In all likelihood we will do a few hundred errnoneous register operations if we do a single invalid register access whilst the device is suspended. As each instance causes a WARN, this floods the system logs and can make the system unresponsive.
The warning was first introduced in
commit b2ec142cb0101f298f8e091c7d75b1ec5b809b65
Author: Paulo Zanoni <[email protected]> Date: Fri Feb 21 13:52:25 2014 -0300
drm/i915: call assert_device_not_suspended at gen6_force_wake_work
and despite the claims the WARN is still encountered in the wild today.
--- drivers/gpu/drm/i915/intel_uncore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +2 -2
@@ -43,8 +43,8 @@static void assert_device_not_suspended (struct drm_i915_private *dev_priv) { -WARN (HAS_RUNTIME_PM (dev_priv->dev) && dev_priv->pm.suspended, -"Device suspended\n" ); +WARN_ONCE (HAS_RUNTIME_PM (dev_priv->dev) && dev_priv->pm.suspended, +"Device suspended\n" ); }static void __gen6_gt_wait_for_thread_c0 (struct drm_i915_private *dev_priv)
Greg Kroah-Hartman
maintainerPATCH 43/183 drm/i915: resume MST after reading back hw state
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
commit e7d6f7d708290da1b7c92f533444b042c79412e0 upstream.
Otherwise the MST resume paths can hit DPMS paths which hit state checker paths, which hit WARN_ON, because the state checker is inconsistent with the hw.
This fixes a bunch of WARN_ON's on resume after undocking.
--- drivers/gpu/drm/i915/i915_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.c +2 -1
@@ -692,11 +692,12 @@ static int __i915_drm_thaw(struct drm_despin_unlock_irqrestore (&dev_priv->irq_lock, irqflags); } -intel_dp_mst_resume (dev);drm_modeset_lock_all (dev);intel_modeset_setup_hw_state (dev, true);drm_modeset_unlock_all (dev); +intel_dp_mst_resume (dev); +/* * ... but also need to make sure that hotplug processing * doesn't cause havoc. Like in the driver load code we don't
Greg Kroah-Hartman
maintainerPATCH 45/183 drm/nv4c/mc: disable msi
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilia Mirkin <[email protected]>
commit 4761703bd04bbdf56396d264903cc5a1fdcb3c01 upstream.
Several users have, over time, reported issues with MSI on these IGPs. They're old, rarely available, and MSI doesn't provide such huge advantages on them. Just disable.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87361
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74492
--- drivers/gpu/drm/nouveau/core/subdev/mc/nv4c.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/gpu/drm/nouveau/core/subdev/mc/nv4c.c +0 -8
@@ -24,13 +24,6 @@#include "nv04.h" -static void -nv4c_mc_msi_rearm (struct nouveau_mc *pmc) -{ -struct nv04_mc_priv *priv = (void *)pmc; -nv_wr08 (priv,0x088050 ,0xff ); -} -struct nouveau_oclass * nv4c_mc_oclass = &(struct nouveau_mc_oclass ) { .base.handle =NV_SUBDEV (MC ,0x4c ),
@@ -41,5 +34,4 @@ nv4c_mc_oclass = &(struct nouveau_mc_ocl .fini = _nouveau_mc_fini, }, .intr = nv04_mc_intr, - .msi_rearm = nv4c_mc_msi_rearm, }.base;
Greg Kroah-Hartman
maintainerPATCH 51/183 ARC: [nsimosci] move peripherals to match model to FPGA
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vineet Gupta <[email protected]>
commit e8ef060b37c2d3cc5fd0c0edbe4e42ec1cb9768b upstream.
This allows the sdplite/Zebu images to run on OSCI simulation platform
--- arch/arc/boot/dts/nsimosci.dts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
arch/arc/boot/dts/nsimosci.dts +9 -9
@@ -20,7 +20,7 @@ /* this is for console on PGU */ /* bootargs = "console=tty0 consoleblank=0"; */ /* this is for console on serial */ - bootargs = "earlycon=uart8250,mmio32,0xc0000000,115200n8 console=tty0 console=ttyS0,115200n8 consoleblank=0 debug"; + bootargs = "earlycon=uart8250,mmio32,0xf0000000,115200n8 console=tty0 console=ttyS0,115200n8 consoleblank=0 debug"; }; aliases {
@@ -41,9 +41,9 @@ #interrupt-cells = <1>; }; - uart0: serial@c0000000 { + uart0: serial@f0000000 { compatible = "ns8250"; - reg = <0xc0000000 0x2000>; + reg = <0xf0000000 0x2000>; interrupts = <11>; clock-frequency = <3686400>; baud = <115200>;
@@ -52,21 +52,21 @@ no-loopback-test = <1>; }; - pgu0: pgu@c9000000 { + pgu0: pgu@f9000000 { compatible = "snps,arcpgufb"; - reg = <0xc9000000 0x400>; + reg = <0xf9000000 0x400>; }; - ps2: ps2@c9001000 { + ps2: ps2@f9001000 { compatible = "snps,arc_ps2"; - reg = <0xc9000400 0x14>; + reg = <0xf9000400 0x14>; interrupts = <13>; interrupt-names = "arc_ps2_irq"; }; - eth0: ethernet@c0003000 { + eth0: ethernet@f0003000 { compatible = "snps,oscilan"; - reg = <0xc0003000 0x44>; + reg = <0xf0003000 0x44>; interrupts = <7>, <8>; interrupt-names = "rx", "tx"; };
Greg Kroah-Hartman
maintainerPATCH 52/183 cxl: Change contexts_lock to a mutex to fix sleep while atomic bug
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Munsie <[email protected]>
commit ee41d11d53c8fc4968f0816504651541d606cf40 upstream.
We had a known sleep while atomic bug if a CXL device was forcefully unbound while it was in use. This could occur as a result of EEH, or manually induced with something like this while the device was in use:
echo 0000:01:00.0 > /sys/bus/pci/drivers/cxl-pci/unbind
The issue was that in this code path we iterated over each context and forcefully detached it with the contexts_lock spin lock held, however the detach also needed to take the spu_mutex, and call schedule.
This patch changes the contexts_lock to a mutex so that we are not in atomic context while doing the detach, thereby avoiding the sleep while atomic.
Also delete the related TODO comment, which suggested an alternate solution which turned out to not be workable.
--- drivers/misc/cxl/context.c | 15 ++++++++------- drivers/misc/cxl/cxl.h | 2 +- drivers/misc/cxl/native.c | 7 ------- drivers/misc/cxl/pci.c | 2 +- drivers/misc/cxl/sysfs.c | 10 +++++----- 5 files changed, 15 insertions(+), 21 deletions(-)
drivers/misc/cxl/context.c +8 -7
@@ -82,12 +82,12 @@ int cxl_context_init(struct cxl_context* Allocating IDR! We better make sure everything's setup that * dereferences from it. */ +mutex_lock (&afu->contexts_lock);idr_preload (GFP_KERNEL ); -spin_lock (&afu->contexts_lock); i =idr_alloc (&ctx->afu->contexts_idr, ctx,0 , ctx->afu->num_procs,GFP_NOWAIT ); -spin_unlock (&afu->contexts_lock);idr_preload_end (); +mutex_unlock (&afu->contexts_lock);if (i <0 )return i;
@@ -168,21 +168,22 @@ void cxl_context_detach_all(struct cxl_astruct cxl_context *ctx;int tmp; -rcu_read_lock (); -idr_for_each_entry (&afu->contexts_idr, ctx, tmp) +mutex_lock (&afu->contexts_lock); +idr_for_each_entry (&afu->contexts_idr, ctx, tmp) {/* * Anything done in here needs to be setup before the IDR is * created and torn down after the IDR removed */ __detach_context (ctx); -rcu_read_unlock (); + } +mutex_unlock (&afu->contexts_lock); }void cxl_context_free (struct cxl_context *ctx) { -spin_lock (&ctx->afu->contexts_lock); +mutex_lock (&ctx->afu->contexts_lock);idr_remove (&ctx->afu->contexts_idr, ctx->pe); -spin_unlock (&ctx->afu->contexts_lock); +mutex_unlock (&ctx->afu->contexts_lock);synchronize_rcu ();free_page ((u64 )ctx->sstp);
drivers/misc/cxl/cxl.h +1 -1
@@ -349,7 +349,7 @@ struct cxl_afu {struct device *chardev_s, *chardev_m, *chardev_d;struct idr contexts_idr;struct dentry *debugfs; -spinlock_t contexts_lock; +struct mutex contexts_lock;struct mutex spa_mutex;spinlock_t afu_cntl_lock;
drivers/misc/cxl/native.c +0 -7
@@ -610,13 +610,6 @@ static inline int detach_process_native_return 0 ; } -/* -* TODO: handle case when this is called inside a rcu_read_lock() which may -* happen when we unbind the driver (ie. cxl_context_detach_all()) . Terminate -* & remove use a mutex lock and schedule which will not good with lock held. -* May need to write do_process_element_cmd() that handles outstanding page -* faults synchronously. -*/ static inline int detach_process_native_afu_directed (struct cxl_context *ctx) {if (!ctx->pe_inserted)
drivers/misc/cxl/pci.c +1 -1
@@ -502,7 +502,7 @@ static struct cxl_afu *cxl_alloc_afu(str afu->dev.release = cxl_release_afu; afu->slice = slice;idr_init (&afu->contexts_idr); -spin_lock_init (&afu->contexts_lock); +mutex_init (&afu->contexts_lock);spin_lock_init (&afu->afu_cntl_lock);mutex_init (&afu->spa_mutex);
drivers/misc/cxl/sysfs.c +5 -5
@@ -121,7 +121,7 @@ static ssize_t reset_store_afu(struct deint rc;/* Not safe to reset if it is currently in use */ -spin_lock (&afu->contexts_lock); +mutex_lock (&afu->contexts_lock);if (!idr_is_empty (&afu->contexts_idr)) { rc = -EBUSY ; goto err;
@@ -132,7 +132,7 @@ static ssize_t reset_store_afu(struct de rc = count; err: -spin_unlock (&afu->contexts_lock); +mutex_unlock (&afu->contexts_lock);return rc; }
@@ -247,7 +247,7 @@ static ssize_t mode_store(struct deviceint rc = -EBUSY ;/* can't change this if we have a user */ -spin_lock (&afu->contexts_lock); +mutex_lock (&afu->contexts_lock);if (!idr_is_empty (&afu->contexts_idr)) goto err;
@@ -271,7 +271,7 @@ static ssize_t mode_store(struct device afu->current_mode =0 ; afu->num_procs =0 ; -spin_unlock (&afu->contexts_lock); +mutex_unlock (&afu->contexts_lock);if ((rc =_cxl_afu_deactivate_mode (afu, old_mode)))return rc;
@@ -280,7 +280,7 @@ static ssize_t mode_store(struct devicereturn count; err: -spin_unlock (&afu->contexts_lock); +mutex_unlock (&afu->contexts_lock);return rc; }
Greg Kroah-Hartman
maintainerPATCH 53/183 cxl: Add timeout to process element commands
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Munsie <[email protected]>
commit a98e6e9f4e0224d85b4d951edc44af16dfe6094a upstream.
In the event that something goes wrong in the hardware and it is unable to complete a process element comment we would end up polling forever, effectively making the associated process unkillable.
This patch adds a timeout to the process element command code path, so that we will give up if the hardware does not respond in a reasonable time.
--- drivers/misc/cxl/native.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/misc/cxl/native.c +5 -0
@@ -277,6 +277,7 @@ static int do_process_element_cmd(struct u64 cmd, u64 pe_state) {u64 state; +unsigned long timeout = jiffies + (HZ *CXL_TIMEOUT );WARN_ON (!ctx->afu->enabled);
@@ -286,6 +287,10 @@ static int do_process_element_cmd(structsmp_mb ();cxl_p1n_write (ctx->afu, CXL_PSL_LLCMD_An, cmd | ctx->pe);while (1 ) { +if (time_after_eq (jiffies, timeout)) { +dev_warn (&ctx->afu->dev,"WARNING: Process Element Command timed out!\n" ); +return -EBUSY ; + } state =be64_to_cpup (ctx->afu->sw_command_status);if (state == ~0ULL ) {pr_err ("cxl: Error adding process element to AFU\n" );
Greg Kroah-Hartman
maintainerPATCH 54/183 cxl: Unmap MMIO regions when detaching a context
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Munsie <[email protected]>
commit b123429e6a9e8d03aacf888d23262835f0081448 upstream.
If we need to force detach a context (e.g. due to EEH or simply force unbinding the driver) we should prevent the userspace contexts from being able to access the Problem State Area MMIO region further, which they may have mapped with mmap().
This patch unmaps any mapped MMIO regions when detaching a userspace context.
--- drivers/misc/cxl/context.c | 11 ++++++++++- drivers/misc/cxl/cxl.h | 7 ++++++- drivers/misc/cxl/file.c | 6 +++++- 3 files changed, 21 insertions(+), 3 deletions(-)
drivers/misc/cxl/context.c +10 -1
@@ -34,7 +34,8 @@ struct cxl_context *cxl_context_alloc(vo/* * Initialises a CXL context. */ -int cxl_context_init (struct cxl_context *ctx,struct cxl_afu *afu,bool master) +int cxl_context_init (struct cxl_context *ctx,struct cxl_afu *afu,bool master, +struct address_space *mapping) {int i;
@@ -42,6 +43,8 @@ int cxl_context_init(struct cxl_context ctx->afu = afu; ctx->master = master; ctx->pid =NULL ;/* Set in start work ioctl */ +mutex_init (&ctx->mapping_lock); + ctx->mapping = mapping;/* * Allocate the segment table before we put it in the IDR so that we
@@ -147,6 +150,12 @@ static void __detach_context(struct cxl_afu_release_irqs (ctx);flush_work (&ctx->fault_work);/* Only needed for dedicated process */ wake_up_all (&ctx->wq); + +/* Release Problem State Area mapping */ +mutex_lock (&ctx->mapping_lock); +if (ctx->mapping) +unmap_mapping_range (ctx->mapping,0 ,0 ,1 ); +mutex_unlock (&ctx->mapping_lock); }/*
drivers/misc/cxl/cxl.h +6 -1
@@ -390,6 +390,10 @@ struct cxl_context {phys_addr_t psn_phys;u64 psn_size; +/* Used to unmap any mmaps when force detaching */ +struct address_space *mapping; +struct mutex mapping_lock; +spinlock_t sste_lock;/* Protects segment table entries */ struct cxl_sste *sstp;u64 sstp0, sstp1;
@@ -592,7 +596,8 @@ int cxl_alloc_sst(struct cxl_context *ctvoid init_cxl_native (void );struct cxl_context *cxl_context_alloc (void ); -int cxl_context_init (struct cxl_context *ctx,struct cxl_afu *afu,bool master); +int cxl_context_init (struct cxl_context *ctx,struct cxl_afu *afu,bool master, +struct address_space *mapping);void cxl_context_free (struct cxl_context *ctx);int cxl_context_iomap (struct cxl_context *ctx,struct vm_area_struct *vma);
drivers/misc/cxl/file.c +5 -1
@@ -77,7 +77,7 @@ static int __afu_open(struct inode *inod goto err_put_afu; } -if ((rc =cxl_context_init (ctx, afu, master))) +if ((rc =cxl_context_init (ctx, afu, master, inode->i_mapping))) goto err_put_afu;pr_devel ("afu_open pe: %i\n" , ctx->pe);
@@ -113,6 +113,10 @@ static int afu_release(struct inode *ino __func__, ctx->pe);cxl_context_detach (ctx); +mutex_lock (&ctx->mapping_lock); + ctx->mapping =NULL ; +mutex_unlock (&ctx->mapping_lock); +put_device (&ctx->afu->dev);/*
Greg Kroah-Hartman
maintainerPATCH 55/183 xhci: Check if slot is already in default state before moving it there
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit f161ead70fa6a62e432dff6e9dab8e3cfbeabea6 upstream.
Solves xhci error cases with debug messages:xhci_hcd 0000:00:14.0: Setup ERROR: setup context command for slot 1. usb 1-6: hub failed to enable device, error -22
xhci will give a context state error if we try to set a slot in default state to the same default state with a special address device command.
Turns out this happends in several cases:
- retry reading the device rescriptor in hub_port_init()
- usb_reset_device() is called for a slot in default state
- in resume path, usb_port_resume() calls hub_port_init()
The default state is usually reached from most states with a reset device command without any context state errors, but using the address device command with BSA bit set (block set address) only works from the enabled state and will otherwise cause context error.
solve this by checking if we are already in the default state before issuing a address device BSA=1 command.
--- drivers/usb/host/xhci.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/usb/host/xhci.c +9 -0
@@ -3803,6 +3803,15 @@ static int xhci_setup_device(struct usb_return -EINVAL ; } +if (setup ==SETUP_CONTEXT_ONLY ) { + slot_ctx =xhci_get_slot_ctx (xhci, virt_dev->out_ctx); +if (GET_SLOT_STATE (le32_to_cpu (slot_ctx->dev_state)) == +SLOT_STATE_DEFAULT ) { +xhci_dbg (xhci,"Slot already in default state\n" ); +return 0 ; + } + } + command =xhci_alloc_command (xhci, false, false,GFP_KERNEL );if (!command)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 57/183 nl80211: check matches array length before acessing it
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luciano Coelho <[email protected]>
commit f89f46cf3a23d8d7c98f924a461fd931e1331746 upstream.
If the userspace passes a malformed sched scan request (or a net detect wowlan configuration) by adding a NL80211_ATTR_SCHED_SCAN_MATCH attribute without any nested matchsets, a NULL pointer dereference will occur. Fix this by checking that we do have matchsets in our array before trying to access it.
BUG: unable to handle kernel NULL pointer dereference at 0000000000000024 IP: [<ffffffffa002fd69>] nl80211_parse_sched_scan.part.67+0x6e9/0x900 [cfg80211] PGD 865c067 PUD 865b067 PMD 0 Oops: 0002 [#1] SMP Modules linked in: iwlmvm(O) iwlwifi(O) mac80211(O) cfg80211(O) compat(O) [last unloaded: compat] CPU: 2 PID: 2442 Comm: iw Tainted: G O 3.17.2 #31 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 task: ffff880013800790 ti: ffff880008d80000 task.ti: ffff880008d80000 RIP: 0010:[<ffffffffa002fd69>] [<ffffffffa002fd69>] nl80211_parse_sched_scan.part.67+0x6e9/0x900 [cfg80211] RSP: 0018:ffff880008d838d0 EFLAGS: 00010293 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 RDX: 000000000000143c RSI: 0000000000000000 RDI: ffff880008ee8dd0 RBP: ffff880008d83948 R08: 0000000000000002 R09: 0000000000000019 R10: ffff88001d1b3c40 R11: 0000000000000002 R12: ffff880019e85e00 R13: 00000000fffffed4 R14: ffff880009757800 R15: 0000000000001388 FS: 00007fa3b6d13700(0000) GS:ffff88003e200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000024 CR3: 0000000008670000 CR4: 00000000000006e0 Stack: ffff880009757800 ffff880000000001 0000000000000000 ffff880008ee84e0 0000000000000000 ffff880009757800 00000000fffffed4 ffff880008d83948 ffffffff814689c9 ffff880009757800 ffff880008ee8000 0000000000000000 Call Trace: [<ffffffff814689c9>] ? nla_parse+0xb9/0x120 [<ffffffffa00306de>] nl80211_set_wowlan+0x75e/0x960 [cfg80211] [<ffffffff810bf3d5>] ? mark_held_locks+0x75/0xa0 [<ffffffff8161a77b>] genl_family_rcv_msg+0x18b/0x360 [<ffffffff810bf66d>] ? trace_hardirqs_on+0xd/0x10 [<ffffffff8161a9d4>] genl_rcv_msg+0x84/0xc0 [<ffffffff8161a950>] ? genl_family_rcv_msg+0x360/0x360 [<ffffffff81618e79>] netlink_rcv_skb+0xa9/0xd0 [<ffffffff81619458>] genl_rcv+0x28/0x40 [<ffffffff816184a5>] netlink_unicast+0x105/0x180 [<ffffffff8161886f>] netlink_sendmsg+0x34f/0x7a0 [<ffffffff8105a097>] ? kvm_clock_read+0x27/0x40 [<ffffffff815c644d>] sock_sendmsg+0x8d/0xc0 [<ffffffff811a75c9>] ? might_fault+0xb9/0xc0 [<ffffffff811a756e>] ? might_fault+0x5e/0xc0 [<ffffffff815d5d26>] ? verify_iovec+0x56/0xe0 [<ffffffff815c73e0>] ___sys_sendmsg+0x3d0/0x3e0 [<ffffffff810a7be8>] ? sched_clock_cpu+0x98/0xd0 [<ffffffff810611b4>] ? __do_page_fault+0x254/0x580 [<ffffffff810bb39f>] ? up_read+0x1f/0x40 [<ffffffff810611b4>] ? __do_page_fault+0x254/0x580 [<ffffffff812146ed>] ? __fget_light+0x13d/0x160 [<ffffffff815c7b02>] __sys_sendmsg+0x42/0x80 [<ffffffff815c7b52>] SyS_sendmsg+0x12/0x20 [<ffffffff81751f69>] system_call_fastpath+0x16/0x1b
--- net/wireless/nl80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/wireless/nl80211.c +1 -1
@@ -5799,7 +5799,7 @@ static int nl80211_start_sched_scan(stru }/* there was no other matchset, so the RSSI one is alone */ -if (i ==0 ) +if (i ==0 && n_match_sets) request->match_sets[0 ].rssi_thold = default_match_rssi; request->min_rssi_thold =INT_MAX ;
Greg Kroah-Hartman
maintainerPATCH 58/183 cfg80211: dont WARN about two consecutive Country IE hint
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
commit 70dcec5a488a7b81779190ac8089475fe4b8b962 upstream.
This can happen and there is no point in added more detection code lower in the stack. Catching these in one single point (cfg80211) is enough. Stop WARNING about this case.
This fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=89001
--- net/wireless/reg.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
net/wireless/reg.c +2 -5
@@ -1839,11 +1839,8 @@ __reg_process_hint_country_ie(struct wipreturn REG_REQ_IGNORE ;return REG_REQ_ALREADY_SET ; } -/* -* Two consecutive Country IE hints on the same wiphy. -* This should be picked up early by the driver/stack -*/ -if (WARN_ON (regdom_changes (country_ie_request->alpha2))) + +if (regdom_changes (country_ie_request->alpha2))return REG_REQ_OK ;return REG_REQ_ALREADY_SET ; }
Greg Kroah-Hartman
maintainerPATCH 59/183 cfg80211: avoid mem leak on driver hint set
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arik Nemtsov <[email protected]>
commit 34f05f543f02350e920bddb7660ffdd4697aaf60 upstream.
In the already-set and intersect case of a driver-hint, the previous wiphy regdomain was not freed before being reset with a copy of the cfg80211 regdomain.
--- net/wireless/reg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/wireless/reg.c +4 -1
@@ -1760,7 +1760,7 @@ static enum reg_request_treatment reg_process_hint_driver(struct wiphy *wiphy, struct regulatory_request *driver_request) { - const struct ieee80211_regdomain *regd; + const struct ieee80211_regdomain *regd, *tmp;enum reg_request_treatment treatment; treatment =__reg_process_hint_driver (driver_request);
@@ -1780,7 +1780,10 @@ reg_process_hint_driver(struct wiphy *wireg_free_request (driver_request);return REG_REQ_IGNORE ; } + + tmp =get_wiphy_regdom (wiphy);rcu_assign_pointer (wiphy->regd, regd); +rcu_free_regdom (tmp); }
Greg Kroah-Hartman
maintainerPATCH 60/183 cfg80211: Fix 160 MHz channels with 80+80 and 160 MHz drivers
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jouni Malinen <[email protected]>
commit 08f6f147773b23b765b94633a8eaa82e7defcf4c upstream.
The VHT supported channel width field is a two bit integer, not a bitfield. cfg80211_chandef_usable() was interpreting it incorrectly and ended up rejecting 160 MHz channel width if the driver indicated support for both 160 and 80+80 MHz channels.
(however, no real drivers had 160 MHz support it until 3.16)
--- net/wireless/chan.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/wireless/chan.c +6 -3
@@ -602,7 +602,7 @@ bool cfg80211_chandef_usable(struct wiph {struct ieee80211_sta_ht_cap *ht_cap;struct ieee80211_sta_vht_cap *vht_cap; -u32 width, control_freq; +u32 width, control_freq, cap;if (WARN_ON (!cfg80211_chandef_valid (chandef)))return false;
@@ -642,7 +642,8 @@ bool cfg80211_chandef_usable(struct wiphreturn false;break ;case NL80211_CHAN_WIDTH_80P80 : -if (!(vht_cap->cap &IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ )) + cap = vht_cap->cap &IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK ; +if (cap !=IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ )return false;case NL80211_CHAN_WIDTH_80 :if (!vht_cap->vht_supported)
@@ -653,7 +654,9 @@ bool cfg80211_chandef_usable(struct wiphcase NL80211_CHAN_WIDTH_160 :if (!vht_cap->vht_supported)return false; -if (!(vht_cap->cap &IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ )) + cap = vht_cap->cap &IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK ; +if (cap !=IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ && + cap !=IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ )return false; prohibited_flags |=IEEE80211_CHAN_NO_160MHZ ; width =160 ;
Greg Kroah-Hartman
maintainerPATCH 61/183 rtlwifi: rtl8192ce: Set fw_ready flag
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 9a1dce3a059111a7289680f4b8c0ec4f8736b6ee upstream.
The setting of this flag was missed in previous modifications.
--- drivers/net/wireless/rtlwifi/rtl8192ce/hw.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/rtlwifi/rtl8192ce/hw.c +2 -0
@@ -955,6 +955,7 @@ int rtl92ce_hw_init(struct ieee80211_hwlocal_save_flags (flags);local_irq_enable (); + rtlhal->fw_ready = false; rtlpriv->intf_ops->disable_aspm (hw); rtstatus =_rtl92ce_init_mac (hw);if (!rtstatus) {
@@ -971,6 +972,7 @@ int rtl92ce_hw_init(struct ieee80211_hw goto exit; } + rtlhal->fw_ready = true; rtlhal->last_hmeboxnum =0 ;rtl92c_phy_mac_config (hw);/* because last function modify RCR, so we update
Greg Kroah-Hartman
maintainerPATCH 62/183 rtlwifi: Fix error when accessing unmapped memory in skb
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit e9538cf4f90713eca71b1d6a74b4eae1d445c664 upstream.
These drivers use 9100-byte receive buffers, thus allocating an skb requires an O(3) memory allocation. Under heavy memory loads and fragmentation, such a request can fail. Previous versions of the driver have dropped the packet and reused the old buffer; however, the new version introduced a bug in that it released the old buffer before trying to allocate a new one. The previous method is implemented here. The skb is unmapped before any attempt is made to allocate another.
--- drivers/net/wireless/rtlwifi/pci.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-)
drivers/net/wireless/rtlwifi/pci.c +24 -8
@@ -666,7 +666,8 @@ tx_status_ok: }static int _rtl_pci_init_one_rxdesc (struct ieee80211_hw *hw, -u8 *entry,int rxring_idx,int desc_idx) +struct sk_buff *new_skb,u8 *entry, +int rxring_idx,int desc_idx) {struct rtl_priv *rtlpriv =rtl_priv (hw);struct rtl_pci *rtlpci =rtl_pcidev (rtl_pcipriv (hw));
@@ -674,11 +675,15 @@ static int _rtl_pci_init_one_rxdesc(struu8 tmp_one =1 ;struct sk_buff *skb; +if (likely (new_skb)) { + skb = new_skb; + goto remap; + } skb =dev_alloc_skb (rtlpci->rxbuffersize);if (!skb)return 0 ; - rtlpci->rx_ring[rxring_idx].rx_buf[desc_idx] = skb; +remap:/* just set skb->cb to mapping addr for pci_unmap_single use */ *((dma_addr_t *)skb->cb) = pci_map_single(rtlpci->pdev, skb_tail_pointer(skb),
@@ -686,6 +691,7 @@ static int _rtl_pci_init_one_rxdesc(stru bufferaddress = *((dma_addr_t *)skb->cb);if (pci_dma_mapping_error (rtlpci->pdev, bufferaddress))return 0 ; + rtlpci->rx_ring[rxring_idx].rx_buf[desc_idx] = skb;if (rtlpriv->use_new_trx_flow) { rtlpriv->cfg->ops->set_desc(hw, (u8 *)entry, false, HW_DESC_RX_PREPARE,
@@ -781,6 +787,7 @@ static void _rtl_pci_rx_interrupt(struct/*rx pkt */ struct sk_buff *skb = rtlpci->rx_ring[rxring_idx].rx_buf[ rtlpci->rx_ring[rxring_idx].idx]; +struct sk_buff *new_skb;if (rtlpriv->use_new_trx_flow) { rx_remained_cnt =
@@ -807,6 +814,13 @@ static void _rtl_pci_rx_interrupt(structpci_unmap_single (rtlpci->pdev, *((dma_addr_t *)skb->cb), rtlpci->rxbuffersize,PCI_DMA_FROMDEVICE ); +/* get a new skb - if fail, old one will be reused */ + new_skb =dev_alloc_skb (rtlpci->rxbuffersize); +if (unlikely (!new_skb)) { +pr_err ("Allocation of new skb failed in %s\n" , + __func__); + goto no_new; + }if (rtlpriv->use_new_trx_flow) { buffer_desc = &rtlpci->rx_ring[rxring_idx].buffer_desc
@@ -911,14 +925,16 @@ static void _rtl_pci_rx_interrupt(structschedule_work (&rtlpriv->works.lps_change_work); } end: + skb = new_skb; +no_new:if (rtlpriv->use_new_trx_flow) { -_rtl_pci_init_one_rxdesc (hw, (u8 *)buffer_desc, +_rtl_pci_init_one_rxdesc (hw, skb, (u8 *)buffer_desc, rxring_idx, - rtlpci->rx_ring[rxring_idx].idx); + rtlpci->rx_ring[rxring_idx].idx); }else { -_rtl_pci_init_one_rxdesc (hw, (u8 *)pdesc, rxring_idx, +_rtl_pci_init_one_rxdesc (hw, skb, (u8 *)pdesc, + rxring_idx, rtlpci->rx_ring[rxring_idx].idx); -if (rtlpci->rx_ring[rxring_idx].idx == rtlpci->rxringcount -1 ) rtlpriv->cfg->ops->set_desc(hw, (u8 *)pdesc,
@@ -1307,7 +1323,7 @@ static int _rtl_pci_init_rx_ring(struct rtlpci->rx_ring[rxring_idx].idx =0 ;for (i =0 ; i < rtlpci->rxringcount; i++) { entry = &rtlpci->rx_ring[rxring_idx].buffer_desc[i]; -if (!_rtl_pci_init_one_rxdesc (hw, (u8 *)entry, +if (!_rtl_pci_init_one_rxdesc (hw,NULL , (u8 *)entry, rxring_idx, i))return -ENOMEM ; }
@@ -1332,7 +1348,7 @@ static int _rtl_pci_init_rx_ring(structfor (i =0 ; i < rtlpci->rxringcount; i++) { entry = &rtlpci->rx_ring[rxring_idx].desc[i]; -if (!_rtl_pci_init_one_rxdesc (hw, (u8 *)entry, +if (!_rtl_pci_init_one_rxdesc (hw,NULL , (u8 *)entry, rxring_idx, i))return -ENOMEM ; }
Greg Kroah-Hartman
maintainerPATCH 63/183 asus-nb-wmi: Add another wapf=4 quirk
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 841e11ccdf90c29a7778a5d5d553bc716c3d477a upstream.
Wifi on this laptop does not work unless asus-nb-wmi.wapf=4 is specified on the kerne commandline, add a quirk for this.
--- drivers/platform/x86/asus-nb-wmi.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/platform/x86/asus-nb-wmi.c +9 -0
@@ -191,6 +191,15 @@ static const struct dmi_system_id asus_q }, { .callback = dmi_matched, + .ident = "ASUSTeK COMPUTER INC. X551CA", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"ASUSTeK COMPUTER INC." ), + DMI_MATCH(DMI_PRODUCT_NAME, "X551CA"), + }, + .driver_data = &quirk_asus_wapf4, + }, + { + .callback = dmi_matched, .ident = "ASUSTeK COMPUTER INC. X55A", .matches = { DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
Greg Kroah-Hartman
maintainerPATCH 64/183 hp_accel: Add support for HP ZBook 15
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dominique Leuenberger <[email protected]>
commit 6583659e0f92e38079a8dd081e0a1181a0f37747 upstream.
HP ZBook 15 laptop needs a non-standard mapping (x_inverted).
--- drivers/platform/x86/hp_accel.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/hp_accel.c +1 -0
@@ -246,6 +246,7 @@ static const struct dmi_system_id lis3lvAXIS_DMI_MATCH ("HPB64xx" ,"HP ProBook 64" , xy_swap),AXIS_DMI_MATCH ("HPB64xx" ,"HP EliteBook 84" , xy_swap),AXIS_DMI_MATCH ("HPB65xx" ,"HP ProBook 65" , x_inverted), +AXIS_DMI_MATCH ("HPZBook15" ,"HP ZBook 15" , x_inverted), { NULL, }/* Laptop models without axis info (yet): * "NC6910" "HP Compaq 6910"
Greg Kroah-Hartman
maintainerPATCH 65/183 tick/powerclamp: Remove tick_nohz_idle abuse
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit a5fd9733a30d18d7ac23f17080e7e07bb3205b69 upstream.
commit 4dbd27711cd9 "tick: export nohz tick idle symbols for module use" was merged via the thermal tree without an explicit ack from the relevant maintainers.
The exports are abused by the intel powerclamp driver which implements a fake idle state from a sched FIFO task. This causes all kinds of wreckage in the NOHZ core code which rightfully assumes that tick_nohz_idle_enter/exit() are only called from the idle task itself.
Recent changes in the NOHZ core lead to a failure of the powerclamp driver and now people try to hack completely broken and backwards workarounds into the NOHZ core code. This is completely unacceptable and just papers over the real problem. There are way more subtle issues lurking around the corner.
The real solution is to fix the powerclamp driver by rewriting it with a sane concept, but that's beyond the scope of this.
So the only solution for now is to remove the calls into the core NOHZ code from the powerclamp trainwreck along with the exports.
--- drivers/thermal/intel_powerclamp.c | 2 -- kernel/time/tick-sched.c | 2 -- 2 files changed, 4 deletions(-)
drivers/thermal/intel_powerclamp.c +0 -2
@@ -435,7 +435,6 @@ static int clamp_thread(void *arg)* allowed. thus jiffies are updated properly. */ preempt_disable (); -tick_nohz_idle_enter ();/* mwait until target jiffies is reached */ while (time_before (jiffies, target_jiffies)) {unsigned long ecx =1 ;
@@ -451,7 +450,6 @@ static int clamp_thread(void *arg)start_critical_timings ();atomic_inc (&idle_wakeup_counter); } -tick_nohz_idle_exit ();preempt_enable (); }del_timer_sync (&wakeup_timer);
kernel/time/tick-sched.c +0 -2
@@ -847,7 +847,6 @@ void tick_nohz_idle_enter(void)local_irq_enable (); } -EXPORT_SYMBOL_GPL (tick_nohz_idle_enter);/** * tick_nohz_irq_exit - update next tick event from interrupt exit
@@ -974,7 +973,6 @@ void tick_nohz_idle_exit(void)local_irq_enable (); } -EXPORT_SYMBOL_GPL (tick_nohz_idle_exit);static int tick_nohz_reprogram (struct tick_sched *ts,ktime_t now) {
Greg Kroah-Hartman
maintainerPATCH 66/183 uapi/linux/target_core_user.h: fix headers_install.sh badness
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle McMartin <[email protected]>
commit 3875f15207f9ecb3f24a8e91e7ad196899139595 upstream.
scripts/headers_install.sh will transform __packed to __attribute__((packed)), so the #ifndef is not necessary. (and, in fact, it's problematic, because we'll end up with the header
containing:
#ifndef __attribute__((packed))
#define __attribu...
and so forth.)
--- include/uapi/linux/target_core_user.h | 4 ---- 1 file changed, 4 deletions(-)
include/uapi/linux/target_core_user.h +0 -4
@@ -6,10 +6,6 @@#include <linux/types.h> #include <linux/uio.h> -#ifndef __packed -#define __packed __attribute__((packed)) -#endif -#define TCMU_VERSION "1.0"/*
Greg Kroah-Hartman
maintainerPATCH 67/183 tcm_loop: Fix wrong I_T nexus association
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Reinecke <[email protected]>
commit 506787a2c7daed45f0a213674ca706cbc83a9089 upstream.
tcm_loop has the I_T nexus associated with the HBA. This causes commands to become misdirected if the HBA has more than one target portal group; any command is then being sent to the first target portal group instead of the correct one.
The nexus needs to be associated with the target portal group instead.
--- drivers/target/loopback/tcm_loop.c | 66 ++++++++++++------------------------- drivers/target/loopback/tcm_loop.h | 7 --- 2 files changed, 24 insertions(+), 49 deletions(-)
drivers/target/loopback/tcm_loop.c +23 -43
@@ -190,7 +190,7 @@ static void tcm_loop_submission_work(strset_host_byte (sc,DID_TRANSPORT_DISRUPTED ); goto out_done; } - tl_nexus = tl_hba->tl_nexus; + tl_nexus = tl_tpg->tl_nexus;if (!tl_nexus) {scmd_printk (KERN_ERR , sc,"TCM_Loop I_T Nexus" " does not exist\n" );
@@ -270,16 +270,26 @@ static int tcm_loop_queuecommand(struct* to struct scsi_device */ static int tcm_loop_issue_tmr (struct tcm_loop_tpg *tl_tpg, -struct tcm_loop_nexus *tl_nexus,int lun,int task,enum tcm_tmreq_table tmr) {struct se_cmd *se_cmd =NULL ;struct se_session *se_sess;struct se_portal_group *se_tpg; +struct tcm_loop_nexus *tl_nexus;struct tcm_loop_cmd *tl_cmd =NULL ;struct tcm_loop_tmr *tl_tmr =NULL ;int ret =TMR_FUNCTION_FAILED , rc; +/* +* Locate the tl_nexus and se_sess pointers +*/ + tl_nexus = tl_tpg->tl_nexus; +if (!tl_nexus) { +pr_err ("Unable to perform device reset without" +" active I_T Nexus\n" ); +return ret; + } + tl_cmd =kmem_cache_zalloc (tcm_loop_cmd_cache,GFP_KERNEL );if (!tl_cmd) {pr_err ("Unable to allocate memory for tl_cmd\n" );
@@ -295,7 +305,7 @@ static int tcm_loop_issue_tmr(struct tcm se_cmd = &tl_cmd->tl_se_cmd; se_tpg = &tl_tpg->tl_se_tpg; - se_sess = tl_nexus->se_sess; + se_sess = tl_tpg->tl_nexus->se_sess;/* * Initialize struct se_cmd descriptor from target_core_mod infrastructure */
@@ -340,7 +350,6 @@ release:static int tcm_loop_abort_task (struct scsi_cmnd *sc) {struct tcm_loop_hba *tl_hba; -struct tcm_loop_nexus *tl_nexus;struct tcm_loop_tpg *tl_tpg;int ret =FAILED ;
@@ -348,21 +357,8 @@ static int tcm_loop_abort_task(struct sc* Locate the tcm_loop_hba_t pointer */ tl_hba = *(struct tcm_loop_hba **)shost_priv (sc->device->host); -/* -* Locate the tl_nexus and se_sess pointers -*/ - tl_nexus = tl_hba->tl_nexus; -if (!tl_nexus) { -pr_err ("Unable to perform device reset without" -" active I_T Nexus\n" ); -return FAILED ; - } - -/* -* Locate the tl_tpg pointer from TargetID in sc->device->id -*/ tl_tpg = &tl_hba->tl_hba_tpgs[sc->device->id]; - ret =tcm_loop_issue_tmr (tl_tpg, tl_nexus, sc->device->lun, + ret =tcm_loop_issue_tmr (tl_tpg, sc->device->lun, sc->request->tag,TMR_ABORT_TASK );return (ret ==TMR_FUNCTION_COMPLETE ) ?SUCCESS :FAILED ; }
@@ -374,7 +370,6 @@ static int tcm_loop_abort_task(struct scstatic int tcm_loop_device_reset (struct scsi_cmnd *sc) {struct tcm_loop_hba *tl_hba; -struct tcm_loop_nexus *tl_nexus;struct tcm_loop_tpg *tl_tpg;int ret =FAILED ;
@@ -382,20 +377,9 @@ static int tcm_loop_device_reset(struct* Locate the tcm_loop_hba_t pointer */ tl_hba = *(struct tcm_loop_hba **)shost_priv (sc->device->host); -/* -* Locate the tl_nexus and se_sess pointers -*/ - tl_nexus = tl_hba->tl_nexus; -if (!tl_nexus) { -pr_err ("Unable to perform device reset without" -" active I_T Nexus\n" ); -return FAILED ; - } -/* -* Locate the tl_tpg pointer from TargetID in sc->device->id -*/ tl_tpg = &tl_hba->tl_hba_tpgs[sc->device->id]; - ret =tcm_loop_issue_tmr (tl_tpg, tl_nexus, sc->device->lun, + + ret =tcm_loop_issue_tmr (tl_tpg, sc->device->lun,0 ,TMR_LUN_RESET );return (ret ==TMR_FUNCTION_COMPLETE ) ?SUCCESS :FAILED ; }
@@ -1005,8 +989,8 @@ static int tcm_loop_make_nexus(struct tcm_loop_nexus *tl_nexus;int ret = -ENOMEM ; -if (tl_tpg->tl_hba->tl_nexus) { -pr_debug ("tl_tpg->tl_hba->tl_nexus already exists\n" ); +if (tl_tpg->tl_nexus) { +pr_debug ("tl_tpg->tl_nexus already exists\n" );return -EEXIST ; } se_tpg = &tl_tpg->tl_se_tpg;
@@ -1041,7 +1025,7 @@ static int tcm_loop_make_nexus(*/ __transport_register_session (se_tpg, tl_nexus->se_sess->se_node_acl, tl_nexus->se_sess, tl_nexus); - tl_tpg->tl_hba->tl_nexus = tl_nexus; + tl_tpg->tl_nexus = tl_nexus;pr_debug ("TCM_Loop_ConfigFS: Established I_T Nexus to emulated" " %s Initiator Port: %s\n" ,tcm_loop_dump_proto_id (tl_hba), name);
@@ -1057,12 +1041,8 @@ static int tcm_loop_drop_nexus( {struct se_session *se_sess;struct tcm_loop_nexus *tl_nexus; -struct tcm_loop_hba *tl_hba = tpg->tl_hba; -if (!tl_hba) -return -ENODEV ; - - tl_nexus = tl_hba->tl_nexus; + tl_nexus = tpg->tl_nexus;if (!tl_nexus)return -ENODEV ;
@@ -1078,13 +1058,13 @@ static int tcm_loop_drop_nexus( }pr_debug ("TCM_Loop_ConfigFS: Removing I_T Nexus to emulated" -" %s Initiator Port: %s\n" ,tcm_loop_dump_proto_id (tl_hba), +" %s Initiator Port: %s\n" ,tcm_loop_dump_proto_id (tpg->tl_hba), tl_nexus->se_sess->se_node_acl->initiatorname);/* * Release the SCSI I_T Nexus to the emulated SAS Target Port */ transport_deregister_session (tl_nexus->se_sess); - tpg->tl_hba->tl_nexus =NULL ; + tpg->tl_nexus =NULL ;kfree (tl_nexus);return 0 ; }
@@ -1100,7 +1080,7 @@ static ssize_t tcm_loop_tpg_show_nexus(struct tcm_loop_nexus *tl_nexus;ssize_t ret; - tl_nexus = tl_tpg->tl_hba->tl_nexus; + tl_nexus = tl_tpg->tl_nexus;if (!tl_nexus)return -ENODEV ;
drivers/target/loopback/tcm_loop.h +1 -6
@@ -27,11 +27,6 @@ struct tcm_loop_tmr { };struct tcm_loop_nexus { -int it_nexus_active; -/* -* Pointer to Linux/SCSI HBA from linux/include/scsi_host.h -*/ -struct scsi_host *sh;/* * Pointer to TCM session for I_T Nexus */
@@ -51,6 +46,7 @@ struct tcm_loop_tpg {atomic_t tl_tpg_port_count;struct se_portal_group tl_se_tpg;struct tcm_loop_hba *tl_hba; +struct tcm_loop_nexus *tl_nexus; };struct tcm_loop_hba {
@@ -59,7 +55,6 @@ struct tcm_loop_hba {struct se_hba_s *se_hba;struct se_lun *tl_hba_lun;struct se_port *tl_hba_lun_sep; -struct tcm_loop_nexus *tl_nexus;struct device dev;struct Scsi_Host *sh;struct tcm_loop_tpg tl_hba_tpgs[TL_TPGS_PER_HBA ];
Greg Kroah-Hartman
maintainerPATCH 68/183 IB/iser: Fix possible SQ overflow
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Max Gurtovoy <[email protected]>
commit 6ec9d4d2310e8fc54fc638e4454271d1fcaefa95 upstream.
Fix a regression was introduced in commit 6df5a128f0fd ("IB/iser:
Suppress scsi command send completions").
The sig_count was wrongly set to be static variable, thus it is possible that we won't reach to (sig_count % ISER_SIGNAL_BATCH) == 0 condition (due to races) and the send queue will be overflowed.
Instead keep sig_count per connection. We don't need it to be atomic as we are safe under the iscsi session frwd_lock taken by libiscsi on the queuecommand path.
--- drivers/infiniband/ulp/iser/iscsi_iser.h | 2 ++ drivers/infiniband/ulp/iser/iser_initiator.c | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/infiniband/ulp/iser/iscsi_iser.h +2 -0
@@ -432,6 +432,7 @@ struct fast_reg_descriptor {* @cma_id: rdma_cm connection maneger handle * @qp: Connection Queue-pair * @post_recv_buf_count: post receive counter +* @sig_count: send work request signal count * @rx_wr: receive work request for batch posts * @device: reference to iser device * @comp: iser completion context
@@ -452,6 +453,7 @@ struct ib_conn {struct rdma_cm_id *cma_id;struct ib_qp *qp;int post_recv_buf_count; +u8 sig_count;struct ib_recv_wr rx_wr[ISER_MIN_POSTED_RX ];struct iser_device *device;struct iser_comp *comp;
drivers/infiniband/ulp/iser/iser_initiator.c +3 -3
@@ -369,7 +369,7 @@ static int iser_post_rx_bufs(struct iscsreturn 0 ; } -static inline bool iser_signal_comp (int sig_count) +static inline bool iser_signal_comp (u8 sig_count) {return ((sig_count %ISER_SIGNAL_CMD_COUNT ) ==0 ); }
@@ -388,7 +388,7 @@ int iser_send_command(struct iscsi_connstruct iscsi_scsi_req *hdr = (struct iscsi_scsi_req *)task->hdr;struct scsi_cmnd *sc = task->sc;struct iser_tx_desc *tx_desc = &iser_task->desc; -static unsigned sig_count; +u8 sig_count = ++iser_conn->ib_conn.sig_count; edtl =ntohl (hdr->data_length);
@@ -435,7 +435,7 @@ int iser_send_command(struct iscsi_conn iser_task->status =ISER_TASK_STATUS_STARTED ; err =iser_post_send (&iser_conn->ib_conn, tx_desc, -iser_signal_comp (++sig_count)); +iser_signal_comp (sig_count));if (!err)return 0 ;
Greg Kroah-Hartman
maintainerPATCH 69/183 genirq: Prevent proc race against freeing of irq descriptors
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit c291ee622165cb2c8d4e7af63fffd499354a23be upstream.
Since the rework of the sparse interrupt code to actually free the unused interrupt descriptors there exists a race between the /proc interfaces to the irq subsystem and the code which frees the interrupt descriptor.
CPU0 CPU1
show_interrupts() desc = irq_to_desc(X); free_desc(desc) remove_from_radix_tree(); kfree(desc); raw_spinlock_irq(&desc->lock);
/proc/interrupts is the only interface which can actively corrupt kernel memory via the lock access. /proc/stat can only read from freed memory. Extremly hard to trigger, but possible.
The interfaces in /proc/irq/N/ are not affected by this because the removal of the proc file is serialized in procfs against concurrent readers/writers. The removal happens before the descriptor is freed.
For architectures which have CONFIG_SPARSE_IRQ=n this is a non issue as the descriptor is never freed. It's merely cleared out with the irq descriptor lock held. So any concurrent proc access will either see the old correct value or the cleared out ones.
Protect the lookup and access to the irq descriptor in show_interrupts() with the sparse_irq_lock.
Provide kstat_irqs_usr() which is protecting the lookup and access with sparse_irq_lock and switch /proc/stat to use it.
Document the existing kstat_irqs interfaces so it's clear that the caller needs to take care about protection. The users of these interfaces are either not affected due to SPARSE_IRQ=n or already protected against removal.
--- fs/proc/stat.c | 2 - include/linux/kernel_stat.h | 1 kernel/irq/internals.h | 4 +++ kernel/irq/irqdesc.c | 52 ++++++++++++++++++++++++++++++++++++++++++++ kernel/irq/proc.c | 22 +++++++++++++++++- 5 files changed, 79 insertions(+), 2 deletions(-)
fs/proc/stat.c +1 -1
@@ -159,7 +159,7 @@ static int show_stat(struct seq_file *p,/* sum again ? it could be updated? */ for_each_irq_nr (j) -seq_put_decimal_ull (p,' ' ,kstat_irqs (j)); +seq_put_decimal_ull (p,' ' ,kstat_irqs_usr (j));seq_printf (p, "\nctxt %llu\n"
include/linux/kernel_stat.h +1 -0
@@ -68,6 +68,7 @@ static inline unsigned int kstat_softirq* Number of interrupts per specific IRQ source, since bootup */ extern unsigned int kstat_irqs (unsigned int irq); +extern unsigned int kstat_irqs_usr (unsigned int irq);/* * Number of interrupts per cpu, since bootup
kernel/irq/internals.h +4 -0
@@ -78,8 +78,12 @@ extern void unmask_threaded_irq(struct i#ifdef CONFIG_SPARSE_IRQ static inline void irq_mark_irq (unsigned int irq) { } +extern void irq_lock_sparse (void ); +extern void irq_unlock_sparse (void );#else extern void irq_mark_irq (unsigned int irq); +static inline void irq_lock_sparse (void ) { } +static inline void irq_unlock_sparse (void ) { }#endif extern void init_kstat_irqs (struct irq_desc *desc,int node,int nr);
kernel/irq/irqdesc.c +52 -0
79 lines not on this page · raw message
kernel/irq/proc.c +21 -1
@@ -15,6 +15,23 @@#include "internals.h" +/* +* Access rules: +* +* procfs protects read/write of /proc/irq/N/ files against a +* concurrent free of the interrupt descriptor. remove_proc_entry() +* immediately prevents new read/writes to happen and waits for +* already running read/write functions to complete. +* +* We remove the proc entries first and then delete the interrupt +* descriptor from the radix tree and free it. So it is guaranteed +* that irq_to_desc(N) is valid as long as the read/writes are +* permitted by procfs. +* +* The read from /proc/interrupts is a different problem because there +* is no protection. So the lookup and the access to irqdesc +* information must be protected by sparse_irq_lock. +*/ static struct proc_dir_entry *root_irq_dir;#ifdef CONFIG_SMP
@@ -437,9 +454,10 @@ int show_interrupts(struct seq_file *p,seq_putc (p,'\n' ); } +irq_lock_sparse (); desc =irq_to_desc (i);if (!desc) -return 0 ; + goto outsparse;raw_spin_lock_irqsave (&desc->lock, flags);for_each_online_cpu (j)
@@ -479,6 +497,8 @@ int show_interrupts(struct seq_file *p,seq_putc (p,'\n' ); out:raw_spin_unlock_irqrestore (&desc->lock, flags); +outsparse: +irq_unlock_sparse (); return 0; }#endif
Greg Kroah-Hartman
maintainerPATCH 70/183 iscsi-target: Fail connection on short sendmsg writes
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit 6bf6ca7515c1df06f5c03737537f5e0eb191e29e upstream.
This patch changes iscsit_do_tx_data() to fail on short writes when kernel_sendmsg() returns a value different than requested transfer length, returning -EPIPE and thus causing a connection reset to occur.
This avoids a potential bug in the original code where a short write would result in kernel_sendmsg() being called again with the original iovec base + length.
In practice this has not been an issue because iscsit_do_tx_data() is only used for transferring 48 byte headers + 4 byte digests, along with seldom used control payloads from NOPIN + TEXT_RSP + REJECT with less than 32k of data.
So following Al's audit of iovec consumers, go ahead and fail the connection on short writes for now, and remove the bogus logic ahead of his proper upstream fix.
--- drivers/target/iscsi/iscsi_target_util.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-)
drivers/target/iscsi/iscsi_target_util.c +11 -15
@@ -1358,15 +1358,15 @@ static int iscsit_do_tx_data(struct iscsi_conn *conn, struct iscsi_data_count *count) { - int data = count->data_length, total_tx = 0, tx_loop = 0, iov_len; + int ret, iov_len;struct kvec *iov_p;struct msghdr msg;if (!conn || !conn->sock || !conn->conn_ops)return -1 ; -if (data <=0 ) { -pr_err ("Data length is: %d\n" , data); +if (count->data_length <=0 ) { +pr_err ("Data length is: %d\n" , count->data_length);return -1 ; }
@@ -1375,20 +1375,16 @@ static int iscsit_do_tx_data( iov_p = count->iov; iov_len = count->iov_count; -while (total_tx < data) { - tx_loop =kernel_sendmsg (conn->sock, &msg, iov_p, iov_len, - (data - total_tx)); -if (tx_loop <=0 ) { -pr_debug ("tx_loop: %d total_tx %d\n" , - tx_loop, total_tx); -return tx_loop; - } - total_tx += tx_loop; -pr_debug ("tx_loop: %d, total_tx: %d, data: %d\n" , - tx_loop, total_tx, data); + ret =kernel_sendmsg (conn->sock, &msg, iov_p, iov_len, + count->data_length); +if (ret != count->data_length) { +pr_err ("Unexpected ret: %d send data %d\n" , + ret, count->data_length); +return -EPIPE ; } +pr_debug ("ret: %d, sent data: %d\n" , ret, count->data_length); -return total_tx; +return ret; } int rx_data(
Greg Kroah-Hartman
maintainerPATCH 71/183 iscsi,iser-target: Initiate termination only once
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sagi Grimberg <[email protected]>
commit 954f23722b5753305be490330cf2680b7a25f4a3 upstream.
Since commit 0fc4ea701fcf ("Target/iser: Don't put isert_conn inside disconnected handler") we put the conn kref in isert_wait_conn, so we need .wait_conn to be invoked also in the error path.
Introduce call to isert_conn_terminate (called under lock) which transitions the connection state to TERMINATING and calls rdma_disconnect. If the state is already teminating, just bail out back (temination started).
Also, make sure to destroy the connection when getting a connect error event if didn't get to connected (state UP). Same for the handling of REJECTED and UNREACHABLE cma events.
Squashed:
iscsi-target: Add call to wait_conn in establishment error flow
--- drivers/infiniband/ulp/isert/ib_isert.c | 84 ++++++++++++++++++------------ drivers/infiniband/ulp/isert/ib_isert.h | 1 drivers/target/iscsi/iscsi_target_login.c | 3 + 3 files changed, 54 insertions(+), 34 deletions(-)
drivers/infiniband/ulp/isert/ib_isert.c +51 -33
@@ -777,6 +777,33 @@ isert_put_conn(struct isert_conn *isert_kref_put (&isert_conn->conn_kref, isert_release_conn_kref); } +/** +* isert_conn_terminate() - Initiate connection termination +* @isert_conn: isert connection struct +* +* Notes: +* In case the connection state is UP, move state +* to TEMINATING and start teardown sequence (rdma_disconnect). +* +* This routine must be called with conn_mutex held. Thus it is +* safe to call multiple times. +*/ +static void +isert_conn_terminate (struct isert_conn *isert_conn) +{ +int err; + +if (isert_conn->state ==ISER_CONN_UP ) { + isert_conn->state =ISER_CONN_TERMINATING ; +pr_info ("Terminating conn %p state %d\n" , + isert_conn, isert_conn->state); + err =rdma_disconnect (isert_conn->conn_cm_id); +if (err) +pr_warn ("Failed rdma_disconnect isert_conn %p\n" , + isert_conn); + } +} +static void isert_disconnect_work (struct work_struct *work) {
@@ -785,33 +812,15 @@ isert_disconnect_work(struct work_structpr_debug ("isert_disconnect_work(): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n" );mutex_lock (&isert_conn->conn_mutex); -if (isert_conn->state ==ISER_CONN_UP ) - isert_conn->state =ISER_CONN_TERMINATING ; - -if (isert_conn->post_recv_buf_count ==0 && -atomic_read (&isert_conn->post_send_buf_count) ==0 ) { -mutex_unlock (&isert_conn->conn_mutex); - goto wake_up; - } -if (!isert_conn->conn_cm_id) { -mutex_unlock (&isert_conn->conn_mutex); -isert_put_conn (isert_conn); -return ; - } - -if (isert_conn->disconnect) { -/* Send DREQ/DREP towards our initiator */ -rdma_disconnect (isert_conn->conn_cm_id); - } - +isert_conn_terminate (isert_conn);mutex_unlock (&isert_conn->conn_mutex); -wake_up: +pr_info ("conn %p completing conn_wait\n" , isert_conn);complete (&isert_conn->conn_wait); }static int -isert_disconnected_handler (struct rdma_cm_id *cma_id,bool disconnect) +isert_disconnected_handler (struct rdma_cm_id *cma_id) {struct isert_conn *isert_conn;
@@ -824,18 +833,24 @@ isert_disconnected_handler(struct rdma_c isert_conn = (struct isert_conn *)cma_id->context; - isert_conn->disconnect = disconnect;INIT_WORK (&isert_conn->conn_logout_work, isert_disconnect_work);schedule_work (&isert_conn->conn_logout_work);return 0 ; } +static void +isert_connect_error (struct rdma_cm_id *cma_id) +{ +struct isert_conn *isert_conn = (struct isert_conn *)cma_id->context; + +isert_put_conn (isert_conn); +} +static int isert_cma_handler (struct rdma_cm_id *cma_id,struct rdma_cm_event *event) {int ret =0 ; -bool disconnect = false;pr_debug ("isert_cma_handler: event %d status %d conn %p id %p\n" , event->event, event->status, cma_id->context, cma_id);
@@ -853,11 +868,14 @@ isert_cma_handler(struct rdma_cm_id *cmacase RDMA_CM_EVENT_ADDR_CHANGE :/* FALLTHRU */ case RDMA_CM_EVENT_DISCONNECTED :/* FALLTHRU */ case RDMA_CM_EVENT_DEVICE_REMOVAL :/* FALLTHRU */ - disconnect = true;case RDMA_CM_EVENT_TIMEWAIT_EXIT :/* FALLTHRU */ - ret =isert_disconnected_handler (cma_id, disconnect); + ret =isert_disconnected_handler (cma_id);break ; +case RDMA_CM_EVENT_REJECTED :/* FALLTHRU */ +case RDMA_CM_EVENT_UNREACHABLE :/* FALLTHRU */ case RDMA_CM_EVENT_CONNECT_ERROR : +isert_connect_error (cma_id); +break ;default :pr_err ("Unhandled RDMA CMA event: %d\n" , event->event);break ;
@@ -2046,7 +2064,7 @@ isert_cq_rx_comp_err(struct isert_conn *msleep (3000 );mutex_lock (&isert_conn->conn_mutex); - isert_conn->state =ISER_CONN_DOWN ; +isert_conn_terminate (isert_conn);mutex_unlock (&isert_conn->conn_mutex);iscsit_cause_connection_reinstatement (isert_conn->conn,0 );
@@ -3219,10 +3237,6 @@ static void isert_wait_conn(struct iscsipr_debug ("isert_wait_conn: Starting \n" );mutex_lock (&isert_conn->conn_mutex); -if (isert_conn->conn_cm_id && !isert_conn->disconnect) { -pr_debug ("Calling rdma_disconnect from isert_wait_conn\n" ); -rdma_disconnect (isert_conn->conn_cm_id); - }/* * Only wait for conn_wait_comp_err if the isert_conn made it * into full feature phase..
@@ -3231,13 +3245,17 @@ static void isert_wait_conn(struct iscsimutex_unlock (&isert_conn->conn_mutex);return ; } -if (isert_conn->state ==ISER_CONN_UP ) - isert_conn->state =ISER_CONN_TERMINATING ; +isert_conn_terminate (isert_conn);mutex_unlock (&isert_conn->conn_mutex);wait_for_completion (&isert_conn->conn_wait_comp_err); -wait_for_completion (&isert_conn->conn_wait); + +mutex_lock (&isert_conn->conn_mutex); + isert_conn->state =ISER_CONN_DOWN ; +mutex_unlock (&isert_conn->conn_mutex); + +pr_info ("Destroying conn %p\n" , isert_conn);isert_put_conn (isert_conn); }
drivers/infiniband/ulp/isert/ib_isert.h +0 -1
@@ -150,7 +150,6 @@ struct isert_conn {#define ISERT_COMP_BATCH_COUNT 8int conn_comp_batch;struct llist_head conn_comp_llist; -bool disconnect; };#define ISERT_MAX_CQ 64
drivers/target/iscsi/iscsi_target_login.c +3 -0
@@ -1204,6 +1204,9 @@ old_sess_out: conn->sock =NULL ; } +if (conn->conn_transport->iscsit_wait_conn) + conn->conn_transport->iscsit_wait_conn (conn); +if (conn->conn_transport->iscsit_free_conn) conn->conn_transport->iscsit_free_conn (conn);
Greg Kroah-Hartman
maintainerPATCH 72/183 iser-target: Fix flush + disconnect completion handling
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sagi Grimberg <[email protected]>
commit 128e9cc84566a84146baea2335b3824288eed817 upstream.
ISER_CONN_UP state is not sufficient to know if we should wait for completion of flush errors and disconnected_handler event.
Instead, split it to 2 states:
- ISER_CONN_UP: Got to CM connected phase, This state indicates that we need to wait for a CM disconnect event before going to teardown.
- ISER_CONN_FULL_FEATURE: Got to full feature phase after we posted login response, This state indicates that we posted recv buffers and we need to wait for flush completions before going to teardown.
Also avoid deffering disconnected handler to a work, and handle it within disconnected handler. More work here is needed to handle DEVICE_REMOVAL event correctly (cleanup all resources).
Squashed:
iser-target: Don't deffer disconnected handler to a work
--- drivers/infiniband/ulp/isert/ib_isert.c | 52 ++++++++++++++++++-------------- drivers/infiniband/ulp/isert/ib_isert.h | 2 - 2 files changed, 31 insertions(+), 23 deletions(-)
drivers/infiniband/ulp/isert/ib_isert.c +30 -22
@@ -756,6 +756,9 @@ isert_connected_handler(struct rdma_cm_i {struct isert_conn *isert_conn = cma_id->context; +pr_info ("conn %p\n" , isert_conn); + + isert_conn->state =ISER_CONN_UP ;kref_get (&isert_conn->conn_kref); }
@@ -782,8 +785,9 @@ isert_put_conn(struct isert_conn *isert_* @isert_conn: isert connection struct * * Notes: -* In case the connection state is UP, move state +* In case the connection state is FULL_FEATURE, move state * to TEMINATING and start teardown sequence (rdma_disconnect). +* In case the connection state is UP, complete flush as well. * * This routine must be called with conn_mutex held. Thus it is * safe to call multiple times.
@@ -793,32 +797,31 @@ isert_conn_terminate(struct isert_conn * {int err; -if (isert_conn->state ==ISER_CONN_UP ) { - isert_conn->state =ISER_CONN_TERMINATING ; +switch (isert_conn->state) { +case ISER_CONN_TERMINATING : +break ; +case ISER_CONN_UP : +/* +* No flush completions will occur as we didn't +* get to ISER_CONN_FULL_FEATURE yet, complete +* to allow teardown progress. +*/ +complete (&isert_conn->conn_wait_comp_err); +case ISER_CONN_FULL_FEATURE :/* FALLTHRU */ pr_info ("Terminating conn %p state %d\n" , isert_conn, isert_conn->state); + isert_conn->state =ISER_CONN_TERMINATING ; err =rdma_disconnect (isert_conn->conn_cm_id);if (err)pr_warn ("Failed rdma_disconnect isert_conn %p\n" , isert_conn); +break ; +default : +pr_warn ("conn %p teminating in state %d\n" , + isert_conn, isert_conn->state); } } -static void -isert_disconnect_work (struct work_struct *work) -{ -struct isert_conn *isert_conn =container_of (work, - struct isert_conn, conn_logout_work); - -pr_debug ("isert_disconnect_work(): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n" ); -mutex_lock (&isert_conn->conn_mutex); -isert_conn_terminate (isert_conn); -mutex_unlock (&isert_conn->conn_mutex); - -pr_info ("conn %p completing conn_wait\n" , isert_conn); -complete (&isert_conn->conn_wait); -} -static int isert_disconnected_handler (struct rdma_cm_id *cma_id) {
@@ -833,8 +836,12 @@ isert_disconnected_handler(struct rdma_c isert_conn = (struct isert_conn *)cma_id->context; -INIT_WORK (&isert_conn->conn_logout_work, isert_disconnect_work); -schedule_work (&isert_conn->conn_logout_work); +mutex_lock (&isert_conn->conn_mutex); +isert_conn_terminate (isert_conn); +mutex_unlock (&isert_conn->conn_mutex); + +pr_info ("conn %p completing conn_wait\n" , isert_conn); +complete (&isert_conn->conn_wait);return 0 ; }
@@ -1009,7 +1016,7 @@ isert_init_send_wr(struct isert_conn *is* bit for every ISERT_COMP_BATCH_COUNT number of ib_post_send() calls. */ mutex_lock (&isert_conn->conn_mutex); -if (coalesce && isert_conn->state ==ISER_CONN_UP && +if (coalesce && isert_conn->state ==ISER_CONN_FULL_FEATURE && ++isert_conn->conn_comp_batch <ISERT_COMP_BATCH_COUNT ) { tx_desc->llnode_active = true;llist_add (&tx_desc->comp_llnode, &isert_conn->conn_comp_llist);
@@ -1110,7 +1117,8 @@ isert_put_login_tx(struct iscsi_conn *coif (ret)return ret; - isert_conn->state =ISER_CONN_UP ; +/* Now we are in FULL_FEATURE phase */ + isert_conn->state =ISER_CONN_FULL_FEATURE ; goto post_send; }
drivers/infiniband/ulp/isert/ib_isert.h +1 -1
@@ -23,6 +23,7 @@ enum iser_ib_op_code {enum iser_conn_state {ISER_CONN_INIT ,ISER_CONN_UP , +ISER_CONN_FULL_FEATURE ,ISER_CONN_TERMINATING ,ISER_CONN_DOWN , };
@@ -138,7 +139,6 @@ struct isert_conn {struct ib_mr *conn_mr;struct ib_qp *conn_qp;struct isert_device *conn_device; -struct work_struct conn_logout_work;struct mutex conn_mutex;struct completion conn_wait;struct completion conn_wait_comp_err;
Greg Kroah-Hartman
maintainerPATCH 73/183 iser-target: Parallelize CM connection establishment
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sagi Grimberg <[email protected]>
commit 2371e5da8cfe91443339b54444dec6254fdd6dfc upstream.
There is no point in accepting a new CM request only when we are completely done with the last iscsi login. Instead we accept immediately, this will also cause the CM connection to reach connected state and the initiator is allowed to send the first login. We mark that we got the initial login and let iscsi layer pick it up when it gets there.
This reduces the parallel login sequence by a factor of more then 4 (and more for multi-login) and also prevents the initiator (who does all logins in parallel) from giving up on login timeout expiration.
In order to support multiple login requests sequence (CHAP) we call isert_rx_login_req from isert_rx_completion insead of letting isert_get_login_rx call it.
Squashed:
iser-target: Use kref_get_unless_zero in connected_handler
iser-target: Acquire conn_mutex when changing connection state
iser-target: Reject connect request in failure path
--- drivers/infiniband/ulp/isert/ib_isert.c | 84 ++++++++++++++++++++++---------- drivers/infiniband/ulp/isert/ib_isert.h | 2 2 files changed, 62 insertions(+), 24 deletions(-)
drivers/infiniband/ulp/isert/ib_isert.c +60 -24
@@ -54,6 +54,10 @@ isert_reg_rdma(struct iscsi_conn *conn, struct isert_rdma_wr *wr);static int isert_put_response (struct iscsi_conn *conn,struct iscsi_cmd *cmd); +static int +isert_rdma_post_recvl (struct isert_conn *isert_conn); +static int +isert_rdma_accept (struct isert_conn *isert_conn);static void isert_qp_event_callback (struct ib_event *e,void *context)
@@ -590,6 +594,7 @@ isert_connect_request(struct rdma_cm_id isert_conn->state =ISER_CONN_INIT ;INIT_LIST_HEAD (&isert_conn->conn_accept_node);init_completion (&isert_conn->conn_login_comp); +init_completion (&isert_conn->login_req_comp);init_completion (&isert_conn->conn_wait);init_completion (&isert_conn->conn_wait_comp_err);kref_init (&isert_conn->conn_kref);
@@ -681,6 +686,14 @@ isert_connect_request(struct rdma_cm_idif (ret) goto out_conn_dev; + ret =isert_rdma_post_recvl (isert_conn); +if (ret) + goto out_conn_dev; + + ret =isert_rdma_accept (isert_conn); +if (ret) + goto out_conn_dev; +mutex_lock (&isert_np->np_accept_mutex);list_add_tail (&isert_conn->conn_accept_node, &isert_np->np_accept_list);mutex_unlock (&isert_np->np_accept_mutex);
@@ -705,6 +718,7 @@ out_login_buf:kfree (isert_conn->login_buf); out:kfree (isert_conn); +rdma_reject (cma_id,NULL ,0 );return ret; }
@@ -758,8 +772,15 @@ isert_connected_handler(struct rdma_cm_ipr_info ("conn %p\n" , isert_conn); - isert_conn->state =ISER_CONN_UP ; -kref_get (&isert_conn->conn_kref); +if (!kref_get_unless_zero (&isert_conn->conn_kref)) { +pr_warn ("conn %p connect_release is running\n" , isert_conn); +return ; + } + +mutex_lock (&isert_conn->conn_mutex); +if (isert_conn->state !=ISER_CONN_FULL_FEATURE ) + isert_conn->state =ISER_CONN_UP ; +mutex_unlock (&isert_conn->conn_mutex); } static void
@@ -1118,7 +1139,9 @@ isert_put_login_tx(struct iscsi_conn *coreturn ret;/* Now we are in FULL_FEATURE phase */ +mutex_lock (&isert_conn->conn_mutex); isert_conn->state =ISER_CONN_FULL_FEATURE ; +mutex_unlock (&isert_conn->conn_mutex); goto post_send; }
@@ -1135,18 +1158,17 @@ post_send: }static void -isert_rx_login_req (struct iser_rx_desc *rx_desc,int rx_buflen, -struct isert_conn *isert_conn) +isert_rx_login_req (struct isert_conn *isert_conn) { +struct iser_rx_desc *rx_desc = (void *)isert_conn->login_req_buf; +int rx_buflen = isert_conn->login_req_len;struct iscsi_conn *conn = isert_conn->conn;struct iscsi_login *login = conn->conn_login;int size; -if (!login) { -pr_err ("conn->conn_login is NULL\n" ); -dump_stack (); -return ; - } +pr_info ("conn %p\n" , isert_conn); + +WARN_ON_ONCE (!login);if (login->first_request) { struct iscsi_login_req *login_req =
@@ -1509,11 +1531,20 @@ isert_rx_completion(struct iser_rx_desc hdr->opcode, hdr->itt, hdr->flags, (int)(xfer_len - ISER_HEADERS_LEN)); -if ((char *)desc == isert_conn->login_req_buf) -isert_rx_login_req (desc, xfer_len -ISER_HEADERS_LEN , - isert_conn); -else +if ((char *)desc == isert_conn->login_req_buf) { + isert_conn->login_req_len = xfer_len -ISER_HEADERS_LEN ; +if (isert_conn->conn) { +struct iscsi_login *login = isert_conn->conn->conn_login; + +if (login && !login->first_request) +isert_rx_login_req (isert_conn); + } +mutex_lock (&isert_conn->conn_mutex); +complete (&isert_conn->login_req_comp); +mutex_unlock (&isert_conn->conn_mutex); + }else {isert_rx_do_work (desc, isert_conn); + }ib_dma_sync_single_for_device (ib_dev, rx_dma, rx_buflen,DMA_FROM_DEVICE );
@@ -3120,7 +3151,15 @@ isert_get_login_rx(struct iscsi_conn *costruct isert_conn *isert_conn = (struct isert_conn *)conn->context;int ret; -pr_debug ("isert_get_login_rx before conn_login_comp conn: %p\n" , conn); +pr_info ("before login_req comp conn: %p\n" , isert_conn); + ret =wait_for_completion_interruptible (&isert_conn->login_req_comp); +if (ret) { +pr_err ("isert_conn %p interrupted before got login req\n" , + isert_conn); +return ret; + } +reinit_completion (&isert_conn->login_req_comp); +/* * For login requests after the first PDU, isert_rx_login_req() will * kick schedule_delayed_work(&conn->login_work) as the packet is
@@ -3130,11 +3169,15 @@ isert_get_login_rx(struct iscsi_conn *coif (!login->first_request)return 0 ; +isert_rx_login_req (isert_conn); + +pr_info ("before conn_login_comp conn: %p\n" , conn); ret =wait_for_completion_interruptible (&isert_conn->conn_login_comp);if (ret)return ret; -pr_debug ("isert_get_login_rx processing login->req: %p\n" , login->req); +pr_info ("processing login->req: %p\n" , login->req); +return 0 ; }
@@ -3212,17 +3255,10 @@ accept_wait: isert_conn->conn = conn; max_accept =0 ; - ret =isert_rdma_post_recvl (isert_conn); -if (ret) -return ret; - - ret =isert_rdma_accept (isert_conn); -if (ret) -return ret; -isert_set_conn_info (np, conn, isert_conn); -pr_debug ("Processing isert_accept_np: isert_conn: %p\n" , isert_conn); +pr_debug ("Processing isert_conn: %p\n" , isert_conn); +return 0 ; }
drivers/infiniband/ulp/isert/ib_isert.h +2 -0
@@ -126,6 +126,7 @@ struct isert_conn {char *login_req_buf;char *login_rsp_buf;u64 login_req_dma; +int login_req_len;u64 login_rsp_dma;unsigned int conn_rx_desc_head;struct iser_rx_desc *conn_rx_descs;
@@ -133,6 +134,7 @@ struct isert_conn {struct iscsi_conn *conn;struct list_head conn_accept_node;struct completion conn_login_comp; +struct completion login_req_comp;struct iser_tx_desc conn_login_tx_desc;struct rdma_cm_id *conn_cm_id;struct ib_pd *conn_pd;
Greg Kroah-Hartman
maintainerPATCH 74/183 iser-target: Fix connected_handler + teardown flow race
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sagi Grimberg <[email protected]>
commit 19e2090fb246ca21b3e569ead51a6a7a1748eadd upstream.
Take isert_conn pointer from cm_id->qp->qp_context. This will allow us to know that the cm_id context is always the network portal. This will make the cm_id event check (connection or network portal) more reliable.
In order to avoid a NULL dereference in cma_id->qp->qp_context we destroy the qp after we destroy the cm_id (and make the dereference safe). session stablishment/teardown sequences can happen in parallel, we should take into account that connected_handler might race with connection teardown flow.
Also, protect isert_conn->conn_device->active_qps decrement within the error patch during QP creation failure and the normal teardown path in isert_connect_release().
Squashed:
iser-target: Decrement completion context active_qps in error flow
--- drivers/infiniband/ulp/isert/ib_isert.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-)
drivers/infiniband/ulp/isert/ib_isert.c +19 -12
@@ -141,12 +141,18 @@ isert_conn_setup_qp(struct isert_conn *i ret =rdma_create_qp (cma_id, isert_conn->conn_pd, &attr);if (ret) {pr_err ("rdma_create_qp failed for cma_id %d\n" , ret); -return ret; + goto err; } isert_conn->conn_qp = cma_id->qp;pr_debug ("rdma_create_qp() returned success >>>>>>>>>>>>>>>>>>>>>>>>>.\n" );return 0 ; +err: +mutex_lock (&device_list_mutex); + device->cq_active_qps[min_index]--; +mutex_unlock (&device_list_mutex); + +return ret; } static void
@@ -602,7 +608,6 @@ isert_connect_request(struct rdma_cm_idspin_lock_init (&isert_conn->conn_lock);INIT_LIST_HEAD (&isert_conn->conn_fr_pool); - cma_id->context = isert_conn; isert_conn->conn_cm_id = cma_id; isert_conn->login_buf = kzalloc(ISCSI_DEF_MAX_RECV_SEG_LEN +
@@ -734,18 +739,20 @@ isert_connect_release(struct isert_connif (device && device->use_fastreg)isert_conn_free_fastreg_pool (isert_conn); +isert_free_rx_descriptors (isert_conn); +rdma_destroy_id (isert_conn->conn_cm_id); +if (isert_conn->conn_qp) { cq_index = ((struct isert_cq_desc *) isert_conn->conn_qp->recv_cq->cq_context)->cq_index;pr_debug ("isert_connect_release: cq_index: %d\n" , cq_index); +mutex_lock (&device_list_mutex); isert_conn->conn_device->cq_active_qps[cq_index]--; +mutex_unlock (&device_list_mutex); -rdma_destroy_qp (isert_conn->conn_cm_id); +ib_destroy_qp (isert_conn->conn_qp); } -isert_free_rx_descriptors (isert_conn); -rdma_destroy_id (isert_conn->conn_cm_id); -ib_dereg_mr (isert_conn->conn_mr);ib_dealloc_pd (isert_conn->conn_pd);
@@ -768,7 +775,7 @@ isert_connect_release(struct isert_connstatic void isert_connected_handler (struct rdma_cm_id *cma_id) { -struct isert_conn *isert_conn = cma_id->context; +struct isert_conn *isert_conn = cma_id->qp->qp_context;pr_info ("conn %p\n" , isert_conn);
@@ -846,16 +853,16 @@ isert_conn_terminate(struct isert_conn *static int isert_disconnected_handler (struct rdma_cm_id *cma_id) { +struct iscsi_np *np = cma_id->context; +struct isert_np *isert_np = np->np_context;struct isert_conn *isert_conn; -if (!cma_id->qp) { -struct isert_np *isert_np = cma_id->context; - +if (isert_np->np_cm_id == cma_id) { isert_np->np_cm_id =NULL ;return -1 ; } - isert_conn = (struct isert_conn *)cma_id->context; + isert_conn = cma_id->qp->qp_context;mutex_lock (&isert_conn->conn_mutex);isert_conn_terminate (isert_conn);
@@ -870,7 +877,7 @@ isert_disconnected_handler(struct rdma_cstatic void isert_connect_error (struct rdma_cm_id *cma_id) { -struct isert_conn *isert_conn = (struct isert_conn *)cma_id->context; +struct isert_conn *isert_conn = cma_id->qp->qp_context;isert_put_conn (isert_conn); }
Greg Kroah-Hartman
maintainerPATCH 75/183 iser-target: Handle ADDR_CHANGE event for listener cm_id
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sagi Grimberg <[email protected]>
commit ca6c1d82d12d8013fb75ce015900d62b9754623c upstream.
The np listener cm_id will also get ADDR_CHANGE event upcall (in case it is bound to a specific IP). Handle it correctly by creating a new cm_id and implicitly destroy the old one.
Since this is the second event a listener np cm_id may encounter, we move the np cm_id event handling to a routine.
Squashed:
iser-target: Move cma_id setup to a function
--- drivers/infiniband/ulp/isert/ib_isert.c | 107 ++++++++++++++++++++++---------- drivers/infiniband/ulp/isert/ib_isert.h | 1 2 files changed, 77 insertions(+), 31 deletions(-)
drivers/infiniband/ulp/isert/ib_isert.c +76 -31
@@ -58,6 +58,7 @@ static int isert_rdma_post_recvl(struct isert_conn *isert_conn);static int isert_rdma_accept (struct isert_conn *isert_conn); +struct rdma_cm_id *isert_setup_id (struct isert_np *isert_np);static void isert_qp_event_callback (struct ib_event *e,void *context)
@@ -573,8 +574,8 @@ err:static int isert_connect_request (struct rdma_cm_id *cma_id,struct rdma_cm_event *event) { -struct iscsi_np *np = cma_id->context; -struct isert_np *isert_np = np->np_context; +struct isert_np *isert_np = cma_id->context; +struct iscsi_np *np = isert_np->np;struct isert_conn *isert_conn;struct isert_device *device;struct ib_device *ib_dev = cma_id->device;
@@ -851,17 +852,41 @@ isert_conn_terminate(struct isert_conn * }static int -isert_disconnected_handler (struct rdma_cm_id *cma_id) +isert_np_cma_handler (struct isert_np *isert_np, +enum rdma_cm_event_type event) { -struct iscsi_np *np = cma_id->context; -struct isert_np *isert_np = np->np_context; -struct isert_conn *isert_conn; +pr_debug ("isert np %p, handling event %d\n" , isert_np, event); -if (isert_np->np_cm_id == cma_id) { +switch (event) { +case RDMA_CM_EVENT_DEVICE_REMOVAL : isert_np->np_cm_id =NULL ; -return -1 ; +break ; +case RDMA_CM_EVENT_ADDR_CHANGE : + isert_np->np_cm_id =isert_setup_id (isert_np); +if (IS_ERR (isert_np->np_cm_id)) { +pr_err ("isert np %p setup id failed: %ld\n" , + isert_np,PTR_ERR (isert_np->np_cm_id)); + isert_np->np_cm_id =NULL ; + } +break ; +default : +pr_err ("isert np %p Unexpected event %d\n" , + isert_np, event); } +return -1 ; +} + +static int +isert_disconnected_handler (struct rdma_cm_id *cma_id, +enum rdma_cm_event_type event) +{ +struct isert_np *isert_np = cma_id->context; +struct isert_conn *isert_conn; + +if (isert_np->np_cm_id == cma_id) +return isert_np_cma_handler (cma_id->context, event); + isert_conn = cma_id->qp->qp_context;mutex_lock (&isert_conn->conn_mutex);
@@ -904,7 +929,7 @@ isert_cma_handler(struct rdma_cm_id *cmacase RDMA_CM_EVENT_DISCONNECTED :/* FALLTHRU */ case RDMA_CM_EVENT_DEVICE_REMOVAL :/* FALLTHRU */ case RDMA_CM_EVENT_TIMEWAIT_EXIT :/* FALLTHRU */ - ret =isert_disconnected_handler (cma_id); + ret =isert_disconnected_handler (cma_id, event->event);break ;case RDMA_CM_EVENT_REJECTED :/* FALLTHRU */ case RDMA_CM_EVENT_UNREACHABLE :/* FALLTHRU */
@@ -3065,13 +3090,51 @@ isert_response_queue(struct iscsi_conn *return ret; } +struct rdma_cm_id * +isert_setup_id (struct isert_np *isert_np) +{ +struct iscsi_np *np = isert_np->np; +struct rdma_cm_id *id; +struct sockaddr *sa; +int ret; + + sa = (struct sockaddr *)&np->np_sockaddr; +pr_debug ("ksockaddr: %p, sa: %p\n" , &np->np_sockaddr, sa); + + id =rdma_create_id (isert_cma_handler, isert_np, +RDMA_PS_TCP ,IB_QPT_RC ); +if (IS_ERR (id)) { +pr_err ("rdma_create_id() failed: %ld\n" ,PTR_ERR (id)); + ret =PTR_ERR (id); + goto out; + } +pr_debug ("id %p context %p\n" , id, id->context); + + ret =rdma_bind_addr (id, sa); +if (ret) { +pr_err ("rdma_bind_addr() failed: %d\n" , ret); + goto out_id; + } + + ret =rdma_listen (id,ISERT_RDMA_LISTEN_BACKLOG ); +if (ret) { +pr_err ("rdma_listen() failed: %d\n" , ret); + goto out_id; + } + +return id; +out_id: +rdma_destroy_id (id); +out: +return ERR_PTR (ret); +} +static int isert_setup_np (struct iscsi_np *np,struct __kernel_sockaddr_storage *ksockaddr) {struct isert_np *isert_np;struct rdma_cm_id *isert_lid; -struct sockaddr *sa;int ret; isert_np =kzalloc (sizeof (struct isert_np ),GFP_KERNEL );
@@ -3083,9 +3146,8 @@ isert_setup_np(struct iscsi_np *np,mutex_init (&isert_np->np_accept_mutex);INIT_LIST_HEAD (&isert_np->np_accept_list);init_completion (&isert_np->np_login_comp); + isert_np->np = np; - sa = (struct sockaddr *)ksockaddr; -pr_debug ("ksockaddr: %p, sa: %p\n" , ksockaddr, sa);/* * Setup the np->np_sockaddr from the passed sockaddr setup * in iscsi_target_configfs.c code..
@@ -3093,37 +3155,20 @@ isert_setup_np(struct iscsi_np *np,memcpy (&np->np_sockaddr, ksockaddr,sizeof (struct __kernel_sockaddr_storage )); - isert_lid =rdma_create_id (isert_cma_handler, np,RDMA_PS_TCP , -IB_QPT_RC ); + isert_lid =isert_setup_id (isert_np);if (IS_ERR (isert_lid)) { -pr_err ("rdma_create_id() for isert_listen_handler failed: %ld\n" , -PTR_ERR (isert_lid)); ret =PTR_ERR (isert_lid); goto out; } - ret =rdma_bind_addr (isert_lid, sa); -if (ret) { -pr_err ("rdma_bind_addr() for isert_lid failed: %d\n" , ret); - goto out_lid; - } - - ret =rdma_listen (isert_lid,ISERT_RDMA_LISTEN_BACKLOG ); -if (ret) { -pr_err ("rdma_listen() for isert_lid failed: %d\n" , ret); - goto out_lid; - } - isert_np->np_cm_id = isert_lid; np->np_context = isert_np; -pr_debug ("Setup isert_lid->context: %p\n" , isert_lid->context);return 0 ; -out_lid: -rdma_destroy_id (isert_lid); out:kfree (isert_np); +return ret; }
drivers/infiniband/ulp/isert/ib_isert.h +1 -0
@@ -183,6 +183,7 @@ struct isert_device { };struct isert_np { +struct iscsi_np *np;struct semaphore np_sem;struct rdma_cm_id *np_cm_id;struct mutex np_accept_mutex;
Greg Kroah-Hartman
maintainerPATCH 76/183 iser-target: Fix implicit termination of connections
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sagi Grimberg <[email protected]>
commit b02efbfc9a051b41e71fe8f94ddf967260e024a6 upstream.
In situations such as bond failover, The new session establishment implicitly invokes the termination of the old connection.
So, we don't want to wait for the old connection wait_conn to completely terminate before we accept the new connection and post a login response.
The solution is to deffer the comp_wait completion and the conn_put to a work so wait_conn will effectively be non-blocking (flush errors are assumed to come very fast).
We allocate isert_release_wq with WQ_UNBOUND and WQ_UNBOUND_MAX_ACTIVE to spread the concurrency of release works.
--- drivers/infiniband/ulp/isert/ib_isert.c | 42 +++++++++++++++++++++++++------- drivers/infiniband/ulp/isert/ib_isert.h | 1 2 files changed, 35 insertions(+), 8 deletions(-)
drivers/infiniband/ulp/isert/ib_isert.c +34 -8
@@ -41,6 +41,7 @@ static DEFINE_MUTEX(device_list_mutex);static LIST_HEAD (device_list);static struct workqueue_struct *isert_rx_wq;static struct workqueue_struct *isert_comp_wq; +static struct workqueue_struct *isert_release_wq;static void isert_unmap_cmd (struct isert_cmd *isert_cmd,struct isert_conn *isert_conn);
@@ -3326,6 +3327,24 @@ isert_free_np(struct iscsi_np *np)kfree (isert_np); } +static void isert_release_work (struct work_struct *work) +{ +struct isert_conn *isert_conn =container_of (work, + struct isert_conn, + release_work); + +pr_info ("Starting release conn %p\n" , isert_conn); + +wait_for_completion (&isert_conn->conn_wait); + +mutex_lock (&isert_conn->conn_mutex); + isert_conn->state =ISER_CONN_DOWN ; +mutex_unlock (&isert_conn->conn_mutex); + +pr_info ("Destroying conn %p\n" , isert_conn); +isert_put_conn (isert_conn); +} +static void isert_wait_conn (struct iscsi_conn *conn) {struct isert_conn *isert_conn = conn->context;
@@ -3345,14 +3364,9 @@ static void isert_wait_conn(struct iscsimutex_unlock (&isert_conn->conn_mutex);wait_for_completion (&isert_conn->conn_wait_comp_err); -wait_for_completion (&isert_conn->conn_wait); - -mutex_lock (&isert_conn->conn_mutex); - isert_conn->state =ISER_CONN_DOWN ; -mutex_unlock (&isert_conn->conn_mutex); -pr_info ("Destroying conn %p\n" , isert_conn); -isert_put_conn (isert_conn); +INIT_WORK (&isert_conn->release_work, isert_release_work); +queue_work (isert_release_wq, &isert_conn->release_work); }static void isert_free_conn (struct iscsi_conn *conn)
@@ -3400,10 +3414,21 @@ static int __init isert_init(void) goto destroy_rx_wq; } + isert_release_wq =alloc_workqueue ("isert_release_wq" ,WQ_UNBOUND , +WQ_UNBOUND_MAX_ACTIVE ); +if (!isert_release_wq) { +pr_err ("Unable to allocate isert_release_wq\n" ); + ret = -ENOMEM ; + goto destroy_comp_wq; + } +iscsit_register_transport (&iser_target_transport); -pr_debug ("iSER_TARGET[0] - Loaded iser_target_transport\n" ); +pr_info ("iSER_TARGET[0] - Loaded iser_target_transport\n" ); +return 0 ; +destroy_comp_wq: +destroy_workqueue (isert_comp_wq); destroy_rx_wq:destroy_workqueue (isert_rx_wq);return ret;
@@ -3412,6 +3437,7 @@ destroy_rx_wq: static void __exit isert_exit(void) {flush_scheduled_work (); +destroy_workqueue (isert_release_wq);destroy_workqueue (isert_comp_wq);destroy_workqueue (isert_rx_wq);iscsit_unregister_transport (&iser_target_transport);
drivers/infiniband/ulp/isert/ib_isert.h +1 -0
@@ -149,6 +149,7 @@ struct isert_conn {int conn_fr_pool_size;/* lock to protect fastreg pool */ spinlock_t conn_lock; +struct work_struct release_work;#define ISERT_COMP_BATCH_COUNT 8int conn_comp_batch;struct llist_head conn_comp_llist;
Greg Kroah-Hartman
maintainerPATCH 77/183 iser-target: Allocate PI contexts dynamically
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sagi Grimberg <[email protected]>
commit 570db170f37715b7df23c95868169f3d9affa48c upstream.
This patch converts to allocate PI contexts dynamically in order avoid a potentially bogus np->tpg_np and associated NULL pointer dereference in isert_connect_request() during iser-target endpoint shutdown with multiple network portals.
Also, there is really no need to allocate these at connection establishment since it is not guaranteed that all the IOs on that connection will be to a PI formatted device.
We can do it in a lazy fashion so the initial burst will have a transient slow down, but very fast all IOs will allocate a PI context.
Squashed:
iser-target: Centralize PI context handling code
--- drivers/infiniband/ulp/isert/ib_isert.c | 267 ++++++++++++++++++-------------- drivers/infiniband/ulp/isert/ib_isert.h | 7 2 files changed, 158 insertions(+), 116 deletions(-)
drivers/infiniband/ulp/isert/ib_isert.c +151 -116
@@ -96,8 +96,7 @@ isert_query_device(struct ib_device *ib_ }static int -isert_conn_setup_qp (struct isert_conn *isert_conn,struct rdma_cm_id *cma_id, -u8 protection) +isert_conn_setup_qp (struct isert_conn *isert_conn,struct rdma_cm_id *cma_id) {struct isert_device *device = isert_conn->conn_device;struct ib_qp_init_attr attr;
@@ -132,7 +131,7 @@ isert_conn_setup_qp(struct isert_conn *i attr.cap.max_recv_sge =1 ; attr.sq_sig_type =IB_SIGNAL_REQ_WR ; attr.qp_type =IB_QPT_RC ; -if (protection) +if (device->pi_capable) attr.create_flags |=IB_QP_CREATE_SIGNATURE_EN ; pr_debug("isert_conn_setup_qp cma_id->device: %p\n",
@@ -442,8 +441,68 @@ isert_conn_free_fastreg_pool(struct iser }static int +isert_create_pi_ctx (struct fast_reg_descriptor *desc, +struct ib_device *device, +struct ib_pd *pd) +{ +struct ib_mr_init_attr mr_init_attr; +struct pi_context *pi_ctx; +int ret; + + pi_ctx =kzalloc (sizeof (*desc->pi_ctx),GFP_KERNEL ); +if (!pi_ctx) { +pr_err ("Failed to allocate pi context\n" ); +return -ENOMEM ; + } + + pi_ctx->prot_frpl =ib_alloc_fast_reg_page_list (device, +ISCSI_ISER_SG_TABLESIZE ); +if (IS_ERR (pi_ctx->prot_frpl)) { +pr_err ("Failed to allocate prot frpl err=%ld\n" , +PTR_ERR (pi_ctx->prot_frpl)); + ret =PTR_ERR (pi_ctx->prot_frpl); + goto err_pi_ctx; + } + + pi_ctx->prot_mr =ib_alloc_fast_reg_mr (pd,ISCSI_ISER_SG_TABLESIZE ); +if (IS_ERR (pi_ctx->prot_mr)) { +pr_err ("Failed to allocate prot frmr err=%ld\n" , +PTR_ERR (pi_ctx->prot_mr)); + ret =PTR_ERR (pi_ctx->prot_mr); + goto err_prot_frpl; + } + desc->ind |=ISERT_PROT_KEY_VALID ; + +memset (&mr_init_attr,0 ,sizeof (mr_init_attr)); + mr_init_attr.max_reg_descriptors =2 ; + mr_init_attr.flags |=IB_MR_SIGNATURE_EN ; + pi_ctx->sig_mr =ib_create_mr (pd, &mr_init_attr); +if (IS_ERR (pi_ctx->sig_mr)) { +pr_err ("Failed to allocate signature enabled mr err=%ld\n" , +PTR_ERR (pi_ctx->sig_mr)); + ret =PTR_ERR (pi_ctx->sig_mr); + goto err_prot_mr; + } + + desc->pi_ctx = pi_ctx; + desc->ind |=ISERT_SIG_KEY_VALID ; + desc->ind &= ~ISERT_PROTECTED ; + +return 0 ; + +err_prot_mr: +ib_dereg_mr (desc->pi_ctx->prot_mr); +err_prot_frpl: +ib_free_fast_reg_page_list (desc->pi_ctx->prot_frpl); +err_pi_ctx: +kfree (desc->pi_ctx); + +return ret; +} + +static int isert_create_fr_desc (struct ib_device *ib_device,struct ib_pd *pd, -struct fast_reg_descriptor *fr_desc,u8 protection) +struct fast_reg_descriptor *fr_desc) {int ret;
@@ -462,62 +521,12 @@ isert_create_fr_desc(struct ib_device *i ret =PTR_ERR (fr_desc->data_mr); goto err_data_frpl; } -pr_debug ("Create fr_desc %p page_list %p\n" , - fr_desc, fr_desc->data_frpl->page_list); fr_desc->ind |=ISERT_DATA_KEY_VALID ; -if (protection) { -struct ib_mr_init_attr mr_init_attr = {0 }; -struct pi_context *pi_ctx; - - fr_desc->pi_ctx =kzalloc (sizeof (*fr_desc->pi_ctx),GFP_KERNEL ); -if (!fr_desc->pi_ctx) { -pr_err ("Failed to allocate pi context\n" ); - ret = -ENOMEM ; - goto err_data_mr; - } - pi_ctx = fr_desc->pi_ctx; - - pi_ctx->prot_frpl =ib_alloc_fast_reg_page_list (ib_device, -ISCSI_ISER_SG_TABLESIZE ); -if (IS_ERR (pi_ctx->prot_frpl)) { -pr_err ("Failed to allocate prot frpl err=%ld\n" , -PTR_ERR (pi_ctx->prot_frpl)); - ret =PTR_ERR (pi_ctx->prot_frpl); - goto err_pi_ctx; - } - - pi_ctx->prot_mr =ib_alloc_fast_reg_mr (pd,ISCSI_ISER_SG_TABLESIZE ); -if (IS_ERR (pi_ctx->prot_mr)) { -pr_err ("Failed to allocate prot frmr err=%ld\n" , -PTR_ERR (pi_ctx->prot_mr)); - ret =PTR_ERR (pi_ctx->prot_mr); - goto err_prot_frpl; - } - fr_desc->ind |=ISERT_PROT_KEY_VALID ; - - mr_init_attr.max_reg_descriptors =2 ; - mr_init_attr.flags |=IB_MR_SIGNATURE_EN ; - pi_ctx->sig_mr =ib_create_mr (pd, &mr_init_attr); -if (IS_ERR (pi_ctx->sig_mr)) { -pr_err ("Failed to allocate signature enabled mr err=%ld\n" , -PTR_ERR (pi_ctx->sig_mr)); - ret =PTR_ERR (pi_ctx->sig_mr); - goto err_prot_mr; - } - fr_desc->ind |=ISERT_SIG_KEY_VALID ; - } - fr_desc->ind &= ~ISERT_PROTECTED ; +pr_debug ("Created fr_desc %p\n" , fr_desc);return 0 ; -err_prot_mr: -ib_dereg_mr (fr_desc->pi_ctx->prot_mr); -err_prot_frpl: -ib_free_fast_reg_page_list (fr_desc->pi_ctx->prot_frpl); -err_pi_ctx: -kfree (fr_desc->pi_ctx); -err_data_mr: -ib_dereg_mr (fr_desc->data_mr); + err_data_frpl:ib_free_fast_reg_page_list (fr_desc->data_frpl);
@@ -525,7 +534,7 @@ err_data_frpl: }static int -isert_conn_create_fastreg_pool (struct isert_conn *isert_conn,u8 pi_support) +isert_conn_create_fastreg_pool (struct isert_conn *isert_conn) {struct fast_reg_descriptor *fr_desc;struct isert_device *device = isert_conn->conn_device;
@@ -549,8 +558,7 @@ isert_conn_create_fastreg_pool(struct is } ret =isert_create_fr_desc (device->ib_device, - isert_conn->conn_pd, fr_desc, - pi_support); + isert_conn->conn_pd, fr_desc);if (ret) {pr_err ("Failed to create fastreg descriptor err=%d\n" , ret);
@@ -581,7 +589,6 @@ isert_connect_request(struct rdma_cm_idstruct isert_device *device;struct ib_device *ib_dev = cma_id->device;int ret =0 ; -u8 pi_support;spin_lock_bh (&np->np_thread_lock);if (!np->enabled) {
@@ -681,15 +688,7 @@ isert_connect_request(struct rdma_cm_id goto out_mr; } - pi_support = np->tpg_np->tpg->tpg_attrib.t10_pi; -if (pi_support && !device->pi_capable) { -pr_err ("Protection information requested but not supported, " -"rejecting connect request\n" ); - ret =rdma_reject (cma_id,NULL ,0 ); - goto out_mr; - } - - ret =isert_conn_setup_qp (isert_conn, cma_id, pi_support); + ret =isert_conn_setup_qp (isert_conn, cma_id);if (ret) goto out_conn_dev;
@@ -1151,11 +1150,7 @@ isert_put_login_tx(struct iscsi_conn *coif (login->login_complete) {if (!conn->sess->sess_ops->SessionType && isert_conn->conn_device->use_fastreg) { -/* Normal Session and fastreg is used */ -u8 pi_support = login->np->tpg_np->tpg->tpg_attrib.t10_pi; - - ret =isert_conn_create_fastreg_pool (isert_conn, - pi_support); + ret =isert_conn_create_fastreg_pool (isert_conn);if (ret) {pr_err ("Conn: %p failed to create" " fastreg pool\n" , isert_conn);
@@ -2771,10 +2766,10 @@ isert_set_prot_checks(u8 prot_checks) }static int -isert_reg_sig_mr (struct isert_conn *isert_conn,struct se_cmd *se_cmd, -struct fast_reg_descriptor *fr_desc, -struct ib_sge *data_sge,struct ib_sge *prot_sge, -struct ib_sge *sig_sge) +isert_reg_sig_mr (struct isert_conn *isert_conn, +struct se_cmd *se_cmd, +struct isert_rdma_wr *rdma_wr, +struct fast_reg_descriptor *fr_desc) {struct ib_send_wr sig_wr, inv_wr;struct ib_send_wr *bad_wr, *wr =NULL ;
@@ -2804,13 +2799,13 @@ isert_reg_sig_mr(struct isert_conn *isermemset (&sig_wr,0 ,sizeof (sig_wr)); sig_wr.opcode =IB_WR_REG_SIG_MR ; sig_wr.wr_id =ISER_FASTREG_LI_WRID ; - sig_wr.sg_list = data_sge; + sig_wr.sg_list = &rdma_wr->ib_sg[DATA ]; sig_wr.num_sge =1 ; sig_wr.wr.sig_handover.access_flags =IB_ACCESS_LOCAL_WRITE ; sig_wr.wr.sig_handover.sig_attrs = &sig_attrs; sig_wr.wr.sig_handover.sig_mr = pi_ctx->sig_mr;if (se_cmd->t_prot_sg) - sig_wr.wr.sig_handover.prot = prot_sge; + sig_wr.wr.sig_handover.prot = &rdma_wr->ib_sg[PROT ];if (!wr) wr = &sig_wr;
@@ -2824,34 +2819,93 @@ isert_reg_sig_mr(struct isert_conn *iser } fr_desc->ind &= ~ISERT_SIG_KEY_VALID ; - sig_sge->lkey = pi_ctx->sig_mr->lkey; - sig_sge->addr =0 ; - sig_sge->length = se_cmd->data_length; + rdma_wr->ib_sg[SIG ].lkey = pi_ctx->sig_mr->lkey; + rdma_wr->ib_sg[SIG ].addr =0 ; + rdma_wr->ib_sg[SIG ].length = se_cmd->data_length;if (se_cmd->prot_op !=TARGET_PROT_DIN_STRIP && se_cmd->prot_op !=TARGET_PROT_DOUT_INSERT )/* * We have protection guards on the wire * so we need to set a larget transfer */ - sig_sge->length += se_cmd->prot_length; + rdma_wr->ib_sg[SIG ].length += se_cmd->prot_length;pr_debug ("sig_sge: addr: 0x%llx length: %u lkey: %x\n" , - sig_sge->addr, sig_sge->length, - sig_sge->lkey); + rdma_wr->ib_sg[SIG ].addr, rdma_wr->ib_sg[SIG ].length, + rdma_wr->ib_sg[SIG ].lkey); err:return ret; }static int +isert_handle_prot_cmd (struct isert_conn *isert_conn, +struct isert_cmd *isert_cmd, +struct isert_rdma_wr *wr) +{ +struct isert_device *device = isert_conn->conn_device; +struct se_cmd *se_cmd = &isert_cmd->iscsi_cmd->se_cmd; +int ret; + +if (!wr->fr_desc->pi_ctx) { + ret =isert_create_pi_ctx (wr->fr_desc, + device->ib_device, + isert_conn->conn_pd); +if (ret) { +pr_err ("conn %p failed to allocate pi_ctx\n" , + isert_conn); +return ret; + } + } + +if (se_cmd->t_prot_sg) { + ret =isert_map_data_buf (isert_conn, isert_cmd, + se_cmd->t_prot_sg, + se_cmd->t_prot_nents, + se_cmd->prot_length, +0 , wr->iser_ib_op, &wr->prot); +if (ret) { +pr_err ("conn %p failed to map protection buffer\n" , + isert_conn); +return ret; + } + +memset (&wr->ib_sg[PROT ],0 ,sizeof (wr->ib_sg[PROT ])); + ret =isert_fast_reg_mr (isert_conn, wr->fr_desc, &wr->prot, +ISERT_PROT_KEY_VALID , &wr->ib_sg[PROT ]); +if (ret) { +pr_err ("conn %p failed to fast reg mr\n" , + isert_conn); + goto unmap_prot_cmd; + } + } + + ret =isert_reg_sig_mr (isert_conn, se_cmd, wr, wr->fr_desc); +if (ret) { +pr_err ("conn %p failed to fast reg mr\n" , + isert_conn); + goto unmap_prot_cmd; + } + wr->fr_desc->ind |=ISERT_PROTECTED ; + +return 0 ; + +unmap_prot_cmd: +if (se_cmd->t_prot_sg) +isert_unmap_data_buf (isert_conn, &wr->prot); + +return ret; +} + +static int isert_reg_rdma (struct iscsi_conn *conn,struct iscsi_cmd *cmd,struct isert_rdma_wr *wr) {struct se_cmd *se_cmd = &cmd->se_cmd;struct isert_cmd *isert_cmd =iscsit_priv_cmd (cmd);struct isert_conn *isert_conn = conn->context; -struct ib_sge data_sge; -struct ib_send_wr *send_wr;struct fast_reg_descriptor *fr_desc =NULL ; +struct ib_send_wr *send_wr; +struct ib_sge *ib_sg;u32 offset;int ret =0 ;unsigned long flags;
@@ -2876,38 +2930,21 @@ isert_reg_rdma(struct iscsi_conn *conn, } ret =isert_fast_reg_mr (isert_conn, fr_desc, &wr->data, -ISERT_DATA_KEY_VALID , &data_sge); +ISERT_DATA_KEY_VALID , &wr->ib_sg[DATA ]);if (ret) goto unmap_cmd;if (se_cmd->prot_op !=TARGET_PROT_NORMAL ) { -struct ib_sge prot_sge, sig_sge; - -if (se_cmd->t_prot_sg) { - ret =isert_map_data_buf (isert_conn, isert_cmd, - se_cmd->t_prot_sg, - se_cmd->t_prot_nents, - se_cmd->prot_length, -0 , wr->iser_ib_op, &wr->prot); -if (ret) - goto unmap_cmd; - - ret =isert_fast_reg_mr (isert_conn, fr_desc, &wr->prot, -ISERT_PROT_KEY_VALID , &prot_sge); -if (ret) - goto unmap_prot_cmd; - } - - ret =isert_reg_sig_mr (isert_conn, se_cmd, fr_desc, - &data_sge, &prot_sge, &sig_sge); + ret =isert_handle_prot_cmd (isert_conn, isert_cmd, wr);if (ret) - goto unmap_prot_cmd; + goto unmap_cmd; - fr_desc->ind |=ISERT_PROTECTED ; -memcpy (&wr->s_ib_sge, &sig_sge,sizeof (sig_sge)); - }else -memcpy (&wr->s_ib_sge, &data_sge,sizeof (data_sge)); + ib_sg = &wr->ib_sg[SIG ]; + }else { + ib_sg = &wr->ib_sg[DATA ]; + } +memcpy (&wr->s_ib_sge, ib_sg,sizeof (*ib_sg)); wr->ib_sge = &wr->s_ib_sge; wr->send_wr_num =1 ;memset (&wr->s_send_wr,0 ,sizeof (*send_wr));
@@ -2932,9 +2969,7 @@ isert_reg_rdma(struct iscsi_conn *conn, }return 0 ; -unmap_prot_cmd: -if (se_cmd->t_prot_sg) -isert_unmap_data_buf (isert_conn, &wr->prot); + unmap_cmd:if (fr_desc) {spin_lock_irqsave (&isert_conn->conn_lock, flags);
drivers/infiniband/ulp/isert/ib_isert.h +7 -0
@@ -82,6 +82,12 @@ struct isert_data_buf {enum dma_data_direction dma_dir; }; +enum { +DATA =0 , +PROT =1 , +SIG =2 , +}; +struct isert_rdma_wr {struct list_head wr_list;struct isert_cmd *isert_cmd;
@@ -91,6 +97,7 @@ struct isert_rdma_wr {int send_wr_num;struct ib_send_wr *send_wr;struct ib_send_wr s_send_wr; +struct ib_sge ib_sg[3 ];struct isert_data_buf data;struct isert_data_buf prot;struct fast_reg_descriptor *fr_desc;
Greg Kroah-Hartman
maintainerPATCH 78/183 iser-target: Fix NULL dereference in SW mode DIF
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sagi Grimberg <[email protected]>
commit 302cc7c3ca14d21ccdffdebdb61c4fe028f2d5ad upstream.
Fallback to software mode DIF if HCA does not support PI (without crashing obviously). It is still possible to run with backend protection and an unprotected frontend, so looking at the command prot_op is not enough. Check device PI capability on a per-IO basis (isert_prot_cmd inline static) to determine if we need to handle protection information.
Trace:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000010 IP: [<ffffffffa037f8b1>] isert_reg_sig_mr+0x351/0x3b0 [ib_isert] Call Trace: [<ffffffff812b003a>] ? swiotlb_map_sg_attrs+0x7a/0x130 [<ffffffffa038184d>] isert_reg_rdma+0x2fd/0x370 [ib_isert] [<ffffffff8108f2ec>] ? idle_balance+0x6c/0x2c0 [<ffffffffa0382b68>] isert_put_datain+0x68/0x210 [ib_isert] [<ffffffffa02acf5b>] lio_queue_data_in+0x2b/0x30 [iscsi_target_mod] [<ffffffffa02306eb>] target_complete_ok_work+0x21b/0x310 [target_core_mod] [<ffffffff8106ece2>] process_one_work+0x182/0x3b0 [<ffffffff8106fda0>] worker_thread+0x120/0x3c0 [<ffffffff8106fc80>] ? maybe_create_worker+0x190/0x190 [<ffffffff8107594e>] kthread+0xce/0xf0 [<ffffffff81075880>] ? kthread_freezable_should_stop+0x70/0x70 [<ffffffff8159a22c>] ret_from_fork+0x7c/0xb0 [<ffffffff81075880>] ? kthread_freezable_should_stop+0x70/0x70
--- drivers/infiniband/ulp/isert/ib_isert.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/infiniband/ulp/isert/ib_isert.c +13 -6
@@ -61,6 +61,14 @@ static int isert_rdma_accept(struct isert_conn *isert_conn);struct rdma_cm_id *isert_setup_id (struct isert_np *isert_np); +static inline bool +isert_prot_cmd (struct isert_conn *conn,struct se_cmd *cmd) +{ +return (conn->conn_device->pi_capable && + cmd->prot_op !=TARGET_PROT_NORMAL ); +} + +static void isert_qp_event_callback (struct ib_event *e,void *context) {
@@ -2919,8 +2927,7 @@ isert_reg_rdma(struct iscsi_conn *conn,if (ret)return ret; -if (wr->data.dma_nents !=1 || - se_cmd->prot_op !=TARGET_PROT_NORMAL ) { +if (wr->data.dma_nents !=1 ||isert_prot_cmd (isert_conn, se_cmd)) {spin_lock_irqsave (&isert_conn->conn_lock, flags); fr_desc =list_first_entry (&isert_conn->conn_fr_pool, struct fast_reg_descriptor, list);
@@ -2934,7 +2941,7 @@ isert_reg_rdma(struct iscsi_conn *conn,if (ret) goto unmap_cmd; -if (se_cmd->prot_op !=TARGET_PROT_NORMAL ) { +if (isert_prot_cmd (isert_conn, se_cmd)) { ret =isert_handle_prot_cmd (isert_conn, isert_cmd, wr);if (ret) goto unmap_cmd;
@@ -2959,7 +2966,7 @@ isert_reg_rdma(struct iscsi_conn *conn, send_wr->opcode =IB_WR_RDMA_WRITE ; send_wr->wr.rdma.remote_addr = isert_cmd->read_va; send_wr->wr.rdma.rkey = isert_cmd->read_stag; - send_wr->send_flags = se_cmd->prot_op ==TARGET_PROT_NORMAL ? + send_wr->send_flags = !isert_prot_cmd (isert_conn, se_cmd) ?0 :IB_SEND_SIGNALED ; }else { send_wr->opcode =IB_WR_RDMA_READ ;
@@ -3001,7 +3008,7 @@ isert_put_datain(struct iscsi_conn *connreturn rc; } -if (se_cmd->prot_op ==TARGET_PROT_NORMAL ) { +if (!isert_prot_cmd (isert_conn, se_cmd)) {/* * Build isert_conn->tx_desc for iSCSI response PDU and attach */
@@ -3024,7 +3031,7 @@ isert_put_datain(struct iscsi_conn *connatomic_sub (wr->send_wr_num, &isert_conn->post_send_buf_count); } -if (se_cmd->prot_op ==TARGET_PROT_NORMAL ) +if (!isert_prot_cmd (isert_conn, se_cmd))pr_debug ("Cmd: %p posted RDMA_WRITE + Response for iSER Data " "READ\n" , isert_cmd);else
Greg Kroah-Hartman
maintainerPATCH 79/183 iscsi,iser-target: Expose supported protection ops according to t10_pi
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sagi Grimberg <[email protected]>
commit 23a548ee656c8ba6da8cb2412070edcd62e2ac5d upstream.
iSER will report supported protection operations based on the tpg attribute t10_pi settings and HCA PI offload capabilities. If the HCA does not support PI offload or tpg attribute t10_pi is not set, we fall to SW PI mode.
In order to do that, we move iscsit_get_sup_prot_ops after connection tpg assignment.
--- drivers/infiniband/ulp/isert/ib_isert.c | 14 +++++++++++--- drivers/infiniband/ulp/isert/ib_isert.h | 1 + drivers/target/iscsi/iscsi_target_login.c | 7 ++++--- 3 files changed, 16 insertions(+), 6 deletions(-)
drivers/infiniband/ulp/isert/ib_isert.c +11 -3
@@ -64,7 +64,7 @@ struct rdma_cm_id *isert_setup_id(structstatic inline bool isert_prot_cmd (struct isert_conn *conn,struct se_cmd *cmd) { -return (conn->conn_device->pi_capable && +return (conn->pi_support && cmd->prot_op !=TARGET_PROT_NORMAL ); }
@@ -2324,8 +2324,16 @@ isert_get_sup_prot_ops(struct iscsi_connstruct isert_conn *isert_conn = (struct isert_conn *)conn->context;struct isert_device *device = isert_conn->conn_device; -if (device->pi_capable) -return TARGET_PROT_ALL ; +if (conn->tpg->tpg_attrib.t10_pi) { +if (device->pi_capable) { +pr_info ("conn %p PI offload enabled\n" , isert_conn); + isert_conn->pi_support = true; +return TARGET_PROT_ALL ; + } + } + +pr_info ("conn %p PI offload disabled\n" , isert_conn); + isert_conn->pi_support = false;return TARGET_PROT_NORMAL ; }
drivers/infiniband/ulp/isert/ib_isert.h +1 -0
@@ -128,6 +128,7 @@ struct isert_conn {atomic_t post_send_buf_count;u32 responder_resources;u32 initiator_depth; +bool pi_support;u32 max_sge;char *login_buf;char *login_req_buf;
drivers/target/iscsi/iscsi_target_login.c +4 -3
@@ -281,7 +281,6 @@ static int iscsi_login_zero_tsih_s1( {struct iscsi_session *sess =NULL ;struct iscsi_login_req *pdu = (struct iscsi_login_req *)buf; -enum target_prot_op sup_pro_ops;int ret; sess =kzalloc (sizeof (struct iscsi_session ),GFP_KERNEL );
@@ -343,9 +342,8 @@ static int iscsi_login_zero_tsih_s1(kfree (sess);return -ENOMEM ; } - sup_pro_ops = conn->conn_transport->iscsit_get_sup_prot_ops (conn); - sess->se_sess =transport_init_session (sup_pro_ops); + sess->se_sess =transport_init_session (TARGET_PROT_NORMAL );if (IS_ERR (sess->se_sess)) {iscsit_tx_login_rsp (conn,ISCSI_STATUS_CLS_TARGET_ERR ,ISCSI_LOGIN_STATUS_NO_RESOURCES );
@@ -1367,6 +1365,9 @@ static int __iscsi_target_login_thread(s } login->zero_tsih = zero_tsih; + conn->sess->se_sess->sup_prot_ops = + conn->conn_transport->iscsit_get_sup_prot_ops (conn); + tpg = conn->tpg;if (!tpg) {pr_err ("Unable to locate struct iscsi_conn->tpg\n" );
Greg Kroah-Hartman
maintainerPATCH 81/183 Revert "[SCSI] mpt2sas: Remove phys on topology change."
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sreekanth Reddy <[email protected]>
commit 81a89c2d891b78695aa7e4cc0d5a7427785ae078 upstream.
This reverts commit 3520f9c779bed098ca76dd3fb6377264301d57ed ("mpt2sas: Remove phys on topology change")
Reverting the previous mpt2sas drives patch changes, since we will observe below issue
Issue:
Drives connected Enclosure/Expander will unregister with SCSI Transport Layer, if any one remove and add expander cable with in DMD (Device Missing Delay) time period or even any one power-off and power-on the Enclosure with in the DMD period.
--- drivers/scsi/mpt2sas/mpt2sas_transport.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/scsi/mpt2sas/mpt2sas_transport.c +1 -4
@@ -1006,12 +1006,9 @@ mpt2sas_transport_update_links(struct MP &mpt2sas_phy->remote_identify);_transport_add_phy_to_an_existing_port (ioc, sas_node, mpt2sas_phy, mpt2sas_phy->remote_identify.sas_address); - }else { + }else memset (&mpt2sas_phy->remote_identify,0 ,sizeof (struct sas_identify )); -_transport_del_phy_from_an_existing_port (ioc, sas_node, - mpt2sas_phy); - }if (mpt2sas_phy->phy) mpt2sas_phy->phy->negotiated_linkrate =
Greg Kroah-Hartman
maintainerPATCH 82/183 Revert "[SCSI] mpt3sas: Remove phys on topology change"
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sreekanth Reddy <[email protected]>
commit 2311ce4d9c91ed63a46e18f0378f3e406e7e888e upstream.
This reverts commit 963ba22b90a955363644cd397b20226928eab976 ("mpt3sas: Remove phys on topology change")
Reverting the previous mpt3sas drives patch changes, since we will observe below issue
Issue:
Drives connected Enclosure/Expander will unregister with SCSI Transport Layer, if any one remove and add expander cable with in DMD (Device Missing Delay) time period or even any one power-off and power-on the Enclosure with in the DMD period.
--- drivers/scsi/mpt3sas/mpt3sas_transport.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_transport.c +1 -4
@@ -1003,12 +1003,9 @@ mpt3sas_transport_update_links(struct MP &mpt3sas_phy->remote_identify);_transport_add_phy_to_an_existing_port (ioc, sas_node, mpt3sas_phy, mpt3sas_phy->remote_identify.sas_address); - }else { + }else memset (&mpt3sas_phy->remote_identify,0 ,sizeof (struct sas_identify )); -_transport_del_phy_from_an_existing_port (ioc, sas_node, - mpt3sas_phy); - }if (mpt3sas_phy->phy) mpt3sas_phy->phy->negotiated_linkrate =
Greg Kroah-Hartman
maintainerPATCH 83/183 scsi: blacklist RSOC for Microsoft iSCSI target devices
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Martin K. Petersen" <[email protected]>
commit 198a956a11b15b564ac06d1411881e215b587408 upstream.
The Microsoft iSCSI target does not support REPORT SUPPORTED OPERATION CODES. Blacklist these devices so we don't attempt to send the command.
--- drivers/scsi/scsi_devinfo.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/scsi_devinfo.c +1 -0
@@ -211,6 +211,7 @@ static struct { {"Medion", "Flash XL MMC/SD", "2.6D", BLIST_FORCELUN}, {"MegaRAID", "LD", NULL, BLIST_FORCELUN}, {"MICROP", "4110", NULL, BLIST_NOTQ}, + {"MSFT", "Virtual HD", NULL, BLIST_NO_RSOC}, {"MYLEX", "DACARMRB", "*", BLIST_REPORTLUN2}, {"nCipher", "Fastness Crypto", NULL, BLIST_FORCELUN}, {"NAKAMICH", "MJ-4.8S", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
Greg Kroah-Hartman
maintainerPATCH 84/183 scsi: fix random memory corruption with scsi-mq + T10 PI
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Battersby <[email protected]>
commit 120bb3e1e36da9c1ae6b978c825a28b944a5d7c5 upstream.
This fixes random memory corruption triggered when all three of the following are true:
* scsi-mq enabled
* T10 Protection Information (DIF) enabled
* SCSI host with sg_tablesize > SCSI_MAX_SG_SEGMENTS (128)
The symptoms of this bug are unpredictable memory corruption, BUG()s, oopses, lockups, etc., any of which may appear to be completely unrelated to the root cause.
--- drivers/scsi/scsi_lib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/scsi_lib.c +3 -1
@@ -1829,7 +1829,9 @@ static int scsi_mq_prep_fn(struct requesif (scsi_host_get_prot (shost)) { cmd->prot_sdb = (void *)sg + - shost->sg_tablesize *sizeof (struct scatterlist ); + min_t(unsigned int, + shost->sg_tablesize,SCSI_MAX_SG_SEGMENTS ) * +sizeof (struct scatterlist );memset (cmd->prot_sdb,0 ,sizeof (struct scsi_data_buffer )); cmd->prot_sdb->table.sgl =
Greg Kroah-Hartman
maintainerPATCH 86/183 clk: samsung: Fix double add of syscore ops after driver rebind
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit c31844ffdbd4e73a16c66e9d7df8ec290ab4b159 upstream.
During driver unbind the syscore ops were not unregistered which lead to double add on syscore list:
$ echo "3810000.audss-clock-controller" > /sys/bus/platform/drivers/exynos-audss-clk/unbind $ echo "3810000.audss-clock-controller" > /sys/bus/platform/drivers/exynos-audss-clk/bind [ 1463.044061] ------------[ cut here ]------------ [ 1463.047255] WARNING: CPU: 0 PID: 1 at lib/list_debug.c:36 __list_add+0x8c/0xc0() [ 1463.054613] list_add double add: new=c06e52c0, prev=c06e52c0, next=c06d5f84. [ 1463.061625] Modules linked in: [ 1463.064623] CPU: 0 PID: 1 Comm: bash Tainted: G W 3.18.0-rc5-next-20141121-00005-ga8fab06eab42-dirty #1022 [ 1463.075338] [<c0014e2c>] (unwind_backtrace) from [<c0011d80>] (show_stack+0x10/0x14) [ 1463.083046] [<c0011d80>] (show_stack) from [<c048bb70>] (dump_stack+0x70/0xbc) [ 1463.090236] [<c048bb70>] (dump_stack) from [<c00233d4>] (warn_slowpath_common+0x74/0xb0) [ 1463.098295] [<c00233d4>] (warn_slowpath_common) from [<c00234a4>] (warn_slowpath_fmt+0x30/0x40) [ 1463.106962] [<c00234a4>] (warn_slowpath_fmt) from [<c020fe80>] (__list_add+0x8c/0xc0) [ 1463.114760] [<c020fe80>] (__list_add) from [<c0282094>] (register_syscore_ops+0x30/0x3c) [ 1463.122819] [<c0282094>] (register_syscore_ops) from [<c0392f20>] (exynos_audss_clk_probe+0x36c/0x460) [ 1463.132091] [<c0392f20>] (exynos_audss_clk_probe) from [<c0283084>] (platform_drv_probe+0x48/0xa4) [ 1463.141013] [<c0283084>] (platform_drv_probe) from [<c0281a14>] (driver_probe_device+0x13c/0x37c) [ 1463.149852] [<c0281a14>] (driver_probe_device) from [<c0280560>] (bind_store+0x90/0xe0) [ 1463.157822] [<c0280560>] (bind_store) from [<c027fd10>] (drv_attr_store+0x20/0x2c) [ 1463.165363] [<c027fd10>] (drv_attr_store) from [<c0143898>] (sysfs_kf_write+0x4c/0x50) [ 1463.173252] [<c0143898>] (sysfs_kf_write) from [<c0142c80>] (kernfs_fop_write+0xbc/0x198) [ 1463.181395] [<c0142c80>] (kernfs_fop_write) from [<c00e2be0>] (vfs_write+0xa0/0x1a8) [ 1463.189104] [<c00e2be0>] (vfs_write) from [<c00e2f00>] (SyS_write+0x40/0x8c) [ 1463.196122] [<c00e2f00>] (SyS_write) from [<c000f2a0>] (ret_fast_syscall+0x0/0x48) [ 1463.203655] ---[ end trace 08f6710c9bc8d8f3 ]--- [ 1463.208244] exynos-audss-clk 3810000.audss-clock-controller: setup completed
--- drivers/clk/samsung/clk-exynos-audss.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/clk/samsung/clk-exynos-audss.c +4 -0
@@ -210,6 +210,10 @@ static int exynos_audss_clk_remove(struc {int i; +#ifdef CONFIG_PM_SLEEP +unregister_syscore_ops (&exynos_audss_clk_syscore_ops); +#endif +of_clk_del_provider (pdev->dev.of_node);for (i =0 ; i < clk_data.clk_num; i++) {
Greg Kroah-Hartman
maintainerPATCH 87/183 clk: Really fix deadlock with mmap_sem
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Boyd <[email protected]>
commit 89f7e9de59bf3e3cda2e00de12c66db22675a7cf upstream.
Commit 6314b6796e3c (clk: Don't hold prepare_lock across debugfs creation, 2014-09-04) forgot to update one place where we hold the prepare_lock while creating debugfs directories. This means we still have the chance of a deadlock that the commit was trying to fix. Actually fix it by moving the debugfs creation outside the prepare_lock.
--- drivers/clk/clk.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clk/clk.c +3 -2
@@ -240,7 +240,6 @@ static const struct file_operations clk_ .release = single_release, }; -/* caller must hold prepare_lock */ static int clk_debug_create_one (struct clk *clk,struct dentry *pdentry) {struct dentry *d;
@@ -1944,7 +1943,6 @@ int __clk_init(struct device *dev, strucelse clk->rate =0 ; -clk_debug_register (clk);/* * walk the list of orphan clocks and reparent any that are children of * this clock
@@ -1979,6 +1977,9 @@ int __clk_init(struct device *dev, struc out:clk_prepare_unlock (); +if (!ret) +clk_debug_register (clk); +return ret; }
Greg Kroah-Hartman
maintainerPATCH 88/183 clk: Dont try to use a struct clk* after it could have been freed
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomeu Vizoso <[email protected]>
commit 10cdfe54dab034311c8e2fad9ba2dffbe616caa9 upstream.
As __clk_release could call kfree on clk and then we wouldn't have a safe way of getting the module that owns the clock.
--- drivers/clk/clk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/clk/clk.c +4 -1
@@ -2274,14 +2274,17 @@ int __clk_get(struct clk *clk)void __clk_put (struct clk *clk) { +struct module *owner; +if (!clk ||WARN_ON_ONCE (IS_ERR (clk)))return ;clk_prepare_lock (); + owner = clk->owner;kref_put (&clk->ref, __clk_release);clk_prepare_unlock (); -module_put (clk->owner); +module_put (owner); }/*** clk rate change notifiers ***/
Greg Kroah-Hartman
maintainerPATCH 89/183 Revert "clk: ppc-corenet: Fix Section mismatch warning"
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kevin Hao <[email protected]>
commit 176a107b868781c8d6868454aea7d07e0b82d6b8 upstream.
This reverts commit da788acb28386aa896224e784954bb73c99ff26c.
That commit tried to fix the section mismatch warning by moving the ppc_corenet_clk_driver struct to init section. This is definitely wrong because the kernel would free the memories occupied by this struct after boot while this driver is still registered in the driver core. The kernel would panic when accessing this driver struct.
--- drivers/clk/clk-ppc-corenet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-ppc-corenet.c +1 -1
@@ -291,7 +291,7 @@ static const struct of_device_id ppc_clk {} }; -static struct platform_driver ppc_corenet_clk_driver__initdata = { +static struct platform_driver ppc_corenet_clk_driver = { .driver = { .name ="ppc_corenet_clock" , .owner =THIS_MODULE ,
Greg Kroah-Hartman
maintainerPATCH 90/183 clk: rockchip: fix rk3288 cpuclk core dividers
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
commit 9880d4277f6aab6b21404c824f9d9c652ba518ac upstream.
Commit 0e5bdb3f9fa5 (clk: rockchip: switch to using the new cpuclk type for armclk) didn't take into account that the divider used on rk3288 are of the (n+1) type.
The rk3066 and rk3188 socs use more complex divider types making it necessary for the list-elements to be the real register-values to write.
Therefore reduce divider values in the table accordingly so that they really are the values that should be written to the registers and match the dividers actually specified for the rk3288.
--- drivers/clk/rockchip/clk-rk3288.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/clk/rockchip/clk-rk3288.c +14 -14
@@ -142,20 +142,20 @@ struct rockchip_pll_rate_table rk3288_pl }static struct rockchip_cpuclk_rate_table rk3288_cpuclk_rates[]__initdata = { -RK3288_CPUCLK_RATE (1800000000 ,2 ,4 ,2 ,4 ,4 ), -RK3288_CPUCLK_RATE (1704000000 ,2 ,4 ,2 ,4 ,4 ), -RK3288_CPUCLK_RATE (1608000000 ,2 ,4 ,2 ,4 ,4 ), -RK3288_CPUCLK_RATE (1512000000 ,2 ,4 ,2 ,4 ,4 ), -RK3288_CPUCLK_RATE (1416000000 ,2 ,4 ,2 ,4 ,4 ), -RK3288_CPUCLK_RATE (1200000000 ,2 ,4 ,2 ,4 ,4 ), -RK3288_CPUCLK_RATE (1008000000 ,2 ,4 ,2 ,4 ,4 ), -RK3288_CPUCLK_RATE (816000000 ,2 ,4 ,2 ,4 ,4 ), -RK3288_CPUCLK_RATE (696000000 ,2 ,4 ,2 ,4 ,4 ), -RK3288_CPUCLK_RATE (600000000 ,2 ,4 ,2 ,4 ,4 ), -RK3288_CPUCLK_RATE (408000000 ,2 ,4 ,2 ,4 ,4 ), -RK3288_CPUCLK_RATE (312000000 ,2 ,4 ,2 ,4 ,4 ), -RK3288_CPUCLK_RATE (216000000 ,2 ,4 ,2 ,4 ,4 ), -RK3288_CPUCLK_RATE (126000000 ,2 ,4 ,2 ,4 ,4 ), +RK3288_CPUCLK_RATE (1800000000 ,1 ,3 ,1 ,3 ,3 ), +RK3288_CPUCLK_RATE (1704000000 ,1 ,3 ,1 ,3 ,3 ), +RK3288_CPUCLK_RATE (1608000000 ,1 ,3 ,1 ,3 ,3 ), +RK3288_CPUCLK_RATE (1512000000 ,1 ,3 ,1 ,3 ,3 ), +RK3288_CPUCLK_RATE (1416000000 ,1 ,3 ,1 ,3 ,3 ), +RK3288_CPUCLK_RATE (1200000000 ,1 ,3 ,1 ,3 ,3 ), +RK3288_CPUCLK_RATE (1008000000 ,1 ,3 ,1 ,3 ,3 ), +RK3288_CPUCLK_RATE (816000000 ,1 ,3 ,1 ,3 ,3 ), +RK3288_CPUCLK_RATE (696000000 ,1 ,3 ,1 ,3 ,3 ), +RK3288_CPUCLK_RATE (600000000 ,1 ,3 ,1 ,3 ,3 ), +RK3288_CPUCLK_RATE (408000000 ,1 ,3 ,1 ,3 ,3 ), +RK3288_CPUCLK_RATE (312000000 ,1 ,3 ,1 ,3 ,3 ), +RK3288_CPUCLK_RATE (216000000 ,1 ,3 ,1 ,3 ,3 ), +RK3288_CPUCLK_RATE (126000000 ,1 ,3 ,1 ,3 ,3 ), };static const struct rockchip_cpuclk_reg_data rk3288_cpuclk_data = {
Greg Kroah-Hartman
maintainerPATCH 91/183 clk: rockchip: fix rk3066 pll lock bit location
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
commit 12551f0239b50c88352e3292dd7703382addbf5e upstream.
The bit locations indicating the locking status of the plls on rk3066 are shifted by one to the right when compared to the rk3188, bits [7:4] instead of [8:5] on the rk3188, thus indicating the locking state of the wrong pll or a completely different information in case of the gpll.
The recently introduced pll init code exposed that problem on some rk3066 boards when it tried to bring the boot-pll value in line with the value from the rate table.
Fix this by defining separate pll definitions for rk3066 with the correct locking indices.
--- drivers/clk/rockchip/clk-rk3188.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/clk/rockchip/clk-rk3188.c +13 -2
@@ -210,6 +210,17 @@ PNAME(mux_sclk_hsadc_p) = { "hsadc_src"PNAME (mux_mac_p) = {"gpll" ,"dpll" };PNAME (mux_sclk_macref_p) = {"mac_src" ,"ext_rmii" }; +static struct rockchip_pll_clock rk3066_pll_clks[]__initdata = { + [apll] =PLL (pll_rk3066,PLL_APLL ,"apll" , mux_pll_p,0 ,RK2928_PLL_CON (0 ), +RK2928_MODE_CON ,0 ,5 , rk3188_pll_rates), + [dpll] =PLL (pll_rk3066,PLL_DPLL ,"dpll" , mux_pll_p,0 ,RK2928_PLL_CON (4 ), +RK2928_MODE_CON ,4 ,4 ,NULL ), + [cpll] =PLL (pll_rk3066,PLL_CPLL ,"cpll" , mux_pll_p,0 ,RK2928_PLL_CON (8 ), +RK2928_MODE_CON ,8 ,6 , rk3188_pll_rates), + [gpll] =PLL (pll_rk3066,PLL_GPLL ,"gpll" , mux_pll_p,0 ,RK2928_PLL_CON (12 ), +RK2928_MODE_CON ,12 ,7 , rk3188_pll_rates), +}; +static struct rockchip_pll_clock rk3188_pll_clks[]__initdata = { [apll] =PLL (pll_rk3066,PLL_APLL ,"apll" , mux_pll_p,0 ,RK2928_PLL_CON (0 ),RK2928_MODE_CON ,0 ,6 , rk3188_pll_rates),
@@ -742,8 +753,8 @@ static void __init rk3188_common_clk_inistatic void __init rk3066a_clk_init (struct device_node *np) {rk3188_common_clk_init (np); -rockchip_clk_register_plls (rk3188_pll_clks, -ARRAY_SIZE (rk3188_pll_clks), +rockchip_clk_register_plls (rk3066_pll_clks, +ARRAY_SIZE (rk3066_pll_clks),RK3066_GRF_SOC_STATUS );rockchip_clk_register_branches (rk3066a_clk_branches,ARRAY_SIZE (rk3066a_clk_branches));
Greg Kroah-Hartman
maintainerPATCH 92/183 clk: berlin: bg2q: remove non-exist "smemc" gate clock
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jisheng Zhang <[email protected]>
commit b71e8ecd57c8aae5b1815782c47b74ffe3efc09a upstream.
The "smemc" clock is removed on BG2Q SoCs. In fact, bit19 of clkenable register is for nfc. Current code use bit19 for non-exist "smemc" incorrectly, this prevents eMMC from working due to the sdhci's "core" clk is still gated.
--- drivers/clk/berlin/bg2q.c | 1 - 1 file changed, 1 deletion(-)
drivers/clk/berlin/bg2q.c +0 -1
@@ -285,7 +285,6 @@ static const struct berlin2_gate_data bg { "pbridge", "perif", 15, CLK_IGNORE_UNUSED }, { "sdio", "perif", 16, CLK_IGNORE_UNUSED }, { "nfc", "perif", 18 }, - { "smemc", "perif", 19 }, { "pcie", "perif", 22 }, };
Greg Kroah-Hartman
maintainerPATCH 93/183 clk: at91: keep slow clk enabled to prevent system hang
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Brezillon <[email protected]>
commit dca1a4b5ff6e2c25adeff366eb06270dadeab3db upstream.
All slow clk users are not properly claiming it (get + prepare + enable) before using it.
If all users properly claiming this clock release it, the clock is disabled, but faulty users still depends on it, and the system hangs.
This fix prevents the slow clock from being disabled, and should solve the hanging issue, but offending drivers should be patched to properly claim this clock.
--- drivers/clk/at91/clk-slow.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/clk/at91/clk-slow.c +27 -0
@@ -70,6 +70,7 @@ struct clk_sam9x5_slow {#define to_clk_sam9x5_slow (hw) container_of(hw, struct clk_sam9x5_slow, hw) +static struct clk *slow_clk;static int clk_slow_osc_prepare (struct clk_hw *hw) {
@@ -357,6 +358,8 @@ at91_clk_register_sam9x5_slow(void __iom clk =clk_register (NULL , &slowck->hw);if (IS_ERR (clk))kfree (slowck); +else + slow_clk = clk;return clk; }
@@ -433,6 +436,8 @@ at91_clk_register_sam9260_slow(struct at clk =clk_register (NULL , &slowck->hw);if (IS_ERR (clk))kfree (slowck); +else + slow_clk = clk;return clk; }
@@ -465,3 +470,25 @@ void __init of_at91sam9260_clk_slow_setuof_clk_add_provider (np, of_clk_src_simple_get, clk); } + +/* +* FIXME: All slow clk users are not properly claiming it (get + prepare + +* enable) before using it. +* If all users properly claiming this clock decide that they don't need it +* anymore (or are removed), it is disabled while faulty users are still +* requiring it, and the system hangs. +* Prevent this clock from being disabled until all users are properly +* requesting it. +* Once this is done we should remove this function and the slow_clk variable. +*/ +static int __init of_at91_clk_slow_retain (void ) +{ +if (!slow_clk) +return 0 ; + +__clk_get (slow_clk); +clk_prepare_enable (slow_clk); + +return 0 ; +} +arch_initcall (of_at91_clk_slow_retain);
Greg Kroah-Hartman
maintainerPATCH 94/183 ARM: dts: berlin: fix io clk and add missing core clk for BG2Q sdhci2 host
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jisheng Zhang <[email protected]>
commit 96ed6046d3bf1113de3bdbd6dbb7f40e6d0ae0ef upstream.
On BG2Q, the sdhci2 host uses nfcecc for "io" clk and nfc for "core" clk. The shdci2 can't work without this patch due to the "core" clk is gated.
--- arch/arm/boot/dts/berlin2q.dtsi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/boot/dts/berlin2q.dtsi +2 -1
@@ -83,7 +83,8 @@ compatible = "mrvl,pxav3-mmc"; reg = <0xab1000 0x200>; interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&chip CLKID_SDIO1XIN>; + clocks = <&chip CLKID_NFC_ECC>, <&chip CLKID_NFC>; + clock-names = "io", "core"; status = "disabled"; };
Greg Kroah-Hartman
maintainerPATCH 95/183 bugon.cocci: fix Options at the macro
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit 7426977c8efeaedf0a7ca00e1c1a5f52ef6b950f upstream.
The comma after --no-includes makes coccinelle to not run the script:
/usr/bin/spatch -D report --very-quiet --no-show-diff --cocci-file ./scripts/coccinelle/misc/bugon.cocci --no-includes, --include-headers --patch . --dir drivers/media/platform/coda/ -I ./arch/x86/include -I arch/x86/include/generated -I include -I ./arch/x86/include/uapi -I arch/x86/include/generated/uapi -I ./include/uapi -I include/generated/uapi -I ./include/linux/kconfig.h
Usage: spatch.opt --sp-file <SP> <infile> [-o <outfile>] [--iso-file <iso>] [options]
Options are:
--sp-file <file> the semantic patch file -o <file> the output file --in-place do the modification on the file directly --backup-suffix suffix to use when making a backup for inplace
...
At least with Fedora 20 coccinelle package:
coccinelle-1.0.0-0.rc20.1.fc21.x86_64
--- scripts/coccinelle/misc/bugon.cocci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/coccinelle/misc/bugon.cocci +1 -1
@@ -8,7 +8,7 @@ // Confidence: High // Copyright: (C) 2014 Himangi Saraogi. GPLv2. // Comments: -// Options: --no-includes, --include-headers +// Options: --no-includes --include-headers virtual patch virtual context
Greg Kroah-Hartman
maintainerPATCH 96/183 dm: fix missed error code if .end_io isnt implemented by target_type
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: zhendong chen <[email protected]>
commit 5164bece1673cdf04782f8ed3fba70743700f5da upstream.
In bio-based DM's clone_endio(), when target_type doesn't implement .end_io (e.g. linear) r will be always be initialized 0. So if a WRITE SAME bio fails WRITE SAME will not be disabled as intended.
Fix this by initializing r to error, rather than 0, in clone_endio().
--- drivers/md/dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm.c +1 -1
@@ -899,7 +899,7 @@ static void disable_write_same(struct mastatic void clone_endio (struct bio *bio,int error) { -int r =0 ; +int r = error; struct dm_target_io *tio = container_of(bio, struct dm_target_io, clone);struct dm_io *io = tio->io;struct mapped_device *md = tio->io->md;
Greg Kroah-Hartman
maintainerPATCH 97/183 parisc: fix out-of-register compiler error in ldcw inline assembler function
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: John David Anglin <[email protected]>
commit 45db07382a5c78b0c43b3b0002b63757fb60e873 upstream.
The __ldcw macro has a problem when its argument needs to be reloaded from memory. The output memory operand and the input register operand both need to be reloaded using a register in class R1_REGS when generating 64-bit code. This fails because there's only a single register in the class. Instead, use a memory clobber. This also makes the __ldcw macro a compiler memory barrier.
--- arch/parisc/include/asm/ldcw.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
arch/parisc/include/asm/ldcw.h +10 -3
@@ -33,11 +33,18 @@#endif /*!CONFIG_PA20*/ -/* LDCW, the only atomic read-write operation PA-RISC has. *sigh*. */ +/* LDCW, the only atomic read-write operation PA-RISC has. *sigh*. +We don't explicitly expose that "*a" may be written as reload +fails to find a register in class R1_REGS when "a" needs to be +reloaded when generating 64-bit PIC code. Instead, we clobber +memory to indicate to the compiler that the assembly code reads +or writes to items other than those listed in the input and output +operands. This may pessimize the code somewhat but __ldcw is +usually used within code blocks surrounded by memory barriors. */ #define __ldcw (a) ({ \ unsigned __ret; \ - __asm__ __volatile__(__LDCW " 0(%2),%0" \ - : "=r" (__ret), "+m" (*(a)) : "r" (a)); \ + __asm__ __volatile__(__LDCW " 0(%1),%0" \ + : "=r" (__ret) : "r" (a) : "memory"); \ __ret; \ })
Greg Kroah-Hartman
maintainerPATCH 98/183 serial: fix parisc boot hang
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Bottomley <[email protected]>
commit 68ed7e1c3d236e9e1e60ed6cae22f2c1c4ba2952 upstream.
This is a partial revert of 2f2dafe (serial: serial_core.c: printk replacement) which gets us booting again. The real problem seems to be the _emit path in early boot. However, until we can root cause it, we need at least to get boot working.
--- drivers/tty/serial/serial_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/tty/serial/serial_core.c +3 -1
@@ -2102,7 +2102,9 @@ uart_report_port(struct uart_driver *drvbreak ; } -dev_info (port->dev,"%s%d at %s (irq = %d, base_baud = %d) is a %s\n" , +printk (KERN_INFO "%s%s%s%d at %s (irq = %d, base_baud = %d) is a %s\n" , + port->dev ?dev_name (port->dev) :"" , + port->dev ?": " :"" , drv->dev_name, drv->tty_driver->name_base + port->line, address, port->irq, port->uartclk /16 ,uart_type (port));
Greg Kroah-Hartman
maintainerPATCH 99/183 storvsc: ring buffer failures may result in I/O freeze
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Long Li <[email protected]>
commit e86fb5e8ab95f10ec5f2e9430119d5d35020c951 upstream.
When ring buffer returns an error indicating retry, storvsc may not return a proper error code to SCSI when bounce buffer is not used. This has introduced I/O freeze on RAID running atop storvsc devices. This patch fixes it by always returning a proper error code.
--- drivers/scsi/storvsc_drv.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/scsi/storvsc_drv.c +3 -4
@@ -1688,13 +1688,12 @@ static int storvsc_queuecommand(struct Sif (ret == -EAGAIN ) {/* no more space */ -if (cmd_request->bounce_sgl_count) { +if (cmd_request->bounce_sgl_count)destroy_bounce_buffer (cmd_request->bounce_sgl, cmd_request->bounce_sgl_count); - ret =SCSI_MLQUEUE_DEVICE_BUSY ; - goto queue_error; - } + ret =SCSI_MLQUEUE_DEVICE_BUSY ; + goto queue_error; }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 100/183 net: ethernet: cpsw: fix hangs with interrupts
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felipe Balbi <[email protected]>
commit 7ce67a38f799d1fb332f672b117efbadedaa5352 upstream.
The CPSW IP implements pulse-signaled interrupts. Due to that we must write a correct, pre-defined value to the CPDMA_MACEOIVECTOR register so the controller generates a pulse on the correct IRQ line to signal the End Of Interrupt.
The way the driver is written today, all four IRQ lines are requested using the same IRQ handler and, because of that, we could fall into situations where a TX IRQ fires but we tell the controller that we ended an RX IRQ (or vice-versa). This situation triggers an IRQ storm on the reserved IRQ 127 of INTC which will in turn call ack_bad_irq() which will, then, print a ton of:
unexpected IRQ trap at vector 00
In order to fix the problem, we are moving all calls to cpdma_ctlr_eoi() inside the IRQ handler and making sure we *always* write the correct value to the CPDMA_MACEOIVECTOR register. Note that the algorithm assumes that IRQ numbers and value-to-be-written-to-EOI are proportional, meaning that a write of value 0 would trigger an EOI pulse for the RX_THRESHOLD Interrupt and that's the IRQ number sitting in the 0-th index of our irqs_table array.
This, however, is safe at least for current implementations of CPSW so we will refrain from making the check smarter (and, as a side-effect, slower) until we actually have a platform where IRQ lines are swapped.
This patch has been tested for several days with AM335x- and AM437x-based platforms. AM57x was left out because there are still pending patches to enable ethernet in mainline for that platform. A read of the TRM confirms the statement on previous paragraph.
--- drivers/net/ethernet/ti/cpsw.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
drivers/net/ethernet/ti/cpsw.c +8 -11
@@ -757,6 +757,14 @@ requeue:static irqreturn_t cpsw_interrupt (int irq,void *dev_id) {struct cpsw_priv *priv = dev_id; +int value = irq - priv->irqs_table[0 ]; + +/* NOTICE: Ending IRQ here. The trick with the 'value' variable above +* is to make sure we will always write the correct value to the EOI +* register. Namely 0 for RX_THRESH Interrupt, 1 for RX Interrupt, 2 +* for TX Interrupt and 3 for MISC Interrupt. +*/ +cpdma_ctlr_eoi (priv->dma, value);cpsw_intr_disable (priv);if (priv->irq_enabled == true) {
@@ -786,8 +794,6 @@ static int cpsw_poll(struct napi_structint num_tx, num_rx; num_tx =cpdma_chan_process (priv->txch,128 ); -if (num_tx) -cpdma_ctlr_eoi (priv->dma,CPDMA_EOI_TX ); num_rx =cpdma_chan_process (priv->rxch, budget);if (num_rx < budget) {
@@ -795,7 +801,6 @@ static int cpsw_poll(struct napi_structnapi_complete (napi);cpsw_intr_enable (priv); -cpdma_ctlr_eoi (priv->dma,CPDMA_EOI_RX ); prim_cpsw =cpsw_get_slave_priv (priv,0 );if (prim_cpsw->irq_enabled == false) { prim_cpsw->irq_enabled = true;
@@ -1310,8 +1315,6 @@ static int cpsw_ndo_open(struct net_devinapi_enable (&priv->napi);cpdma_ctlr_start (priv->dma);cpsw_intr_enable (priv); -cpdma_ctlr_eoi (priv->dma,CPDMA_EOI_RX ); -cpdma_ctlr_eoi (priv->dma,CPDMA_EOI_TX ); prim_cpsw =cpsw_get_slave_priv (priv,0 );if (prim_cpsw->irq_enabled == false) {
@@ -1578,9 +1581,6 @@ static void cpsw_ndo_tx_timeout(struct ncpdma_chan_start (priv->txch);cpdma_ctlr_int_ctrl (priv->dma, true);cpsw_intr_enable (priv); -cpdma_ctlr_eoi (priv->dma,CPDMA_EOI_RX ); -cpdma_ctlr_eoi (priv->dma,CPDMA_EOI_TX ); - }static int cpsw_ndo_set_mac_address (struct net_device *ndev,void *p)
@@ -1620,9 +1620,6 @@ static void cpsw_ndo_poll_controller(strcpsw_interrupt (ndev->irq, priv);cpdma_ctlr_int_ctrl (priv->dma, true); cpsw_intr_enable(priv); -cpdma_ctlr_eoi (priv->dma,CPDMA_EOI_RX ); - cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX); - }#endif
Greg Kroah-Hartman
maintainerPATCH 102/183 video/logo: prevent use of logos after they have been freed
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
commit 92b004d1aa9f367c372511ca0330f58216b25703 upstream.
If the probe of an fb driver has been deferred due to missing dependencies, and the probe is later ran when a module is loaded, the fbdev framework will try to find a logo to use.
However, the logos are __initdata, and have already been freed. This causes sometimes page faults, if the logo memory is not mapped, sometimes other random crashes as the logo data is invalid, and sometimes nothing, if the fbdev decides to reject the logo (e.g. the random value depicting the logo's height is too big).
This patch adds a late_initcall function to mark the logos as freed. In reality the logos are freed later, and fbdev probe may be ran between this late_initcall and the freeing of the logos. In that case we will miss drawing the logo, even if it would be possible.
--- drivers/video/logo/logo.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/video/logo/logo.c +16 -1
@@ -21,6 +21,21 @@ static bool nologo;module_param (nologo, bool,0 );MODULE_PARM_DESC (nologo,"Disables startup logo" ); +/* +* Logos are located in the initdata, and will be freed in kernel_init. +* Use late_init to mark the logos as freed to prevent any further use. +*/ + +static bool logos_freed; + +static int __init fb_logo_late_init (void ) +{ + logos_freed = true; +return 0 ; +} + +late_initcall (fb_logo_late_init); +/* logo's are marked __initdata. Use __init_refok to tell * modpost that it is intended that this function uses data * marked __initdata.
@@ -29,7 +44,7 @@ const struct linux_logo * __init_refok f {const struct linux_logo *logo =NULL ; -if (nologo) +if (nologo || logos_freed)return NULL ;if (depth >=1 ) {
Greg Kroah-Hartman
maintainerPATCH 103/183 video/fbdev: fix defios fsync
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
commit 30ea9c5218651bc11cbdba7820be78f04e2d83bc upstream.
fb_deferred_io_fsync() returns the value of schedule_delayed_work() as an error code, but schedule_delayed_work() does not return an error. It returns true/false depending on whether the work was already queued.
Fix this by ignoring the return value of schedule_delayed_work().
--- drivers/video/fbdev/core/fb_defio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/video/fbdev/core/fb_defio.c +3 -2
@@ -83,9 +83,10 @@ int fb_deferred_io_fsync(struct file *ficancel_delayed_work_sync (&info->deferred_work);/* Run it immediately */ - err =schedule_delayed_work (&info->deferred_work,0 ); +schedule_delayed_work (&info->deferred_work,0 );mutex_unlock (&inode->i_mutex); -return err; + +return 0 ; }EXPORT_SYMBOL_GPL (fb_deferred_io_fsync);
Greg Kroah-Hartman
maintainerPATCH 104/183 smiapp-pll: Correct clock debug prints
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit bc47150ab93988714d1fab7bc82fe5f505a107ad upstream.
The PLL flags were not used correctly.
--- drivers/media/i2c/smiapp-pll.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/i2c/smiapp-pll.c +2 -2
@@ -67,7 +67,7 @@ static void print_pll(struct device *dev {dev_dbg (dev,"pre_pll_clk_div\t%d\n" , pll->pre_pll_clk_div);dev_dbg (dev,"pll_multiplier \t%d\n" , pll->pll_multiplier); -if (pll->flags !=SMIAPP_PLL_FLAG_NO_OP_CLOCKS ) { +if (!(pll->flags &SMIAPP_PLL_FLAG_NO_OP_CLOCKS )) {dev_dbg (dev,"op_sys_clk_div \t%d\n" , pll->op_sys_clk_div);dev_dbg (dev,"op_pix_clk_div \t%d\n" , pll->op_pix_clk_div); }
@@ -77,7 +77,7 @@ static void print_pll(struct device *devdev_dbg (dev,"ext_clk_freq_hz \t%d\n" , pll->ext_clk_freq_hz);dev_dbg (dev,"pll_ip_clk_freq_hz \t%d\n" , pll->pll_ip_clk_freq_hz);dev_dbg (dev,"pll_op_clk_freq_hz \t%d\n" , pll->pll_op_clk_freq_hz); -if (pll->flags &SMIAPP_PLL_FLAG_NO_OP_CLOCKS ) { +if (!(pll->flags &SMIAPP_PLL_FLAG_NO_OP_CLOCKS )) {dev_dbg (dev,"op_sys_clk_freq_hz \t%d\n" , pll->op_sys_clk_freq_hz); dev_dbg(dev, "op_pix_clk_freq_hz \t%d\n",
Greg Kroah-Hartman
maintainerPATCH 106/183 smiapp: Take mutex during PLL update in sensor initialisation
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit f85698cd296f08218a7750f321e94607da128600 upstream.
The mutex does not serialise anything in this case but avoids a lockdep warning from the control framework.
--- drivers/media/i2c/smiapp/smiapp-core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/i2c/smiapp/smiapp-core.c +2 -0
@@ -2677,7 +2677,9 @@ static int smiapp_registered(struct v4l2 pll->flags |=SMIAPP_PLL_FLAG_NO_OP_CLOCKS ; pll->scale_n = sensor->limits[SMIAPP_LIMIT_SCALER_N_MIN ]; +mutex_lock (&sensor->mutex); rval =smiapp_update_mode (sensor); +mutex_unlock (&sensor->mutex);if (rval) {dev_err (&client->dev,"update mode failed\n" ); goto out_nvm_release;
Greg Kroah-Hartman
maintainerPATCH 107/183 sound: simplify au0828 quirk table
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit 5d1f00a20d2d56ed480e64e938a2391353ee565b upstream.
Add a macro to simplify au0828 quirk table. That makes easier to check it against the USB IDs at drivers/media/usb/au0828/au0828-cards.c.
--- drivers/media/usb/au0828/au0828-cards.c | 5 + sound/usb/quirks-table.h | 158 ++++++-------------------------- 2 files changed, 36 insertions(+), 127 deletions(-)
drivers/media/usb/au0828/au0828-cards.c +5 -0
@@ -36,6 +36,11 @@ static void hvr950q_cs5340_audio(void *pau0828_clear (dev,REG_000 ,0x10 ); } +/* +* WARNING: There's a quirks table at sound/usb/quirks-table.h +* that should also be updated every time a new device with V4L2 support +* is added here. +*/ struct au0828_board au0828_boards[] = { [AU0828_BOARD_UNKNOWN ] = { .name ="Unknown board" ,
sound/usb/quirks-table.h +31 -127
164 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 108/183 sound: Update au0828 quirks table
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit 678fa12fb8e75c6dc1e781a02e3ddbbba7e1a904 upstream.
The au0828 quirks table is currently not in sync with the au0828 media driver.
Syncronize it and put them on the same order as found at au0828 driver, as all the au0828 devices with analog TV need the same quirks.
--- sound/usb/quirks-table.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
sound/usb/quirks-table.h +9 -1
@@ -2827,14 +2827,22 @@ YAMAHA_DEVICE(0x7010, "UB99"), }AU0828_DEVICE (0x2040 ,0x7200 ,"Hauppauge" ,"HVR-950Q" ), +AU0828_DEVICE (0x2040 ,0x7240 ,"Hauppauge" ,"HVR-850" ),AU0828_DEVICE (0x2040 ,0x7210 ,"Hauppauge" ,"HVR-950Q" ),AU0828_DEVICE (0x2040 ,0x7217 ,"Hauppauge" ,"HVR-950Q" ),AU0828_DEVICE (0x2040 ,0x721b ,"Hauppauge" ,"HVR-950Q" ),AU0828_DEVICE (0x2040 ,0x721e ,"Hauppauge" ,"HVR-950Q" ),AU0828_DEVICE (0x2040 ,0x721f ,"Hauppauge" ,"HVR-950Q" ), -AU0828_DEVICE (0x2040 ,0x7240 ,"Hauppauge" ,"HVR-850" ),AU0828_DEVICE (0x2040 ,0x7280 ,"Hauppauge" ,"HVR-950Q" ),AU0828_DEVICE (0x0fd9 ,0x0008 ,"Hauppauge" ,"HVR-950Q" ), +AU0828_DEVICE (0x2040 ,0x7201 ,"Hauppauge" ,"HVR-950Q-MXL" ), +AU0828_DEVICE (0x2040 ,0x7211 ,"Hauppauge" ,"HVR-950Q-MXL" ), +AU0828_DEVICE (0x2040 ,0x7281 ,"Hauppauge" ,"HVR-950Q-MXL" ), +AU0828_DEVICE (0x05e1 ,0x0480 ,"Hauppauge" ,"Woodbury" ), +AU0828_DEVICE (0x2040 ,0x8200 ,"Hauppauge" ,"Woodbury" ), +AU0828_DEVICE (0x2040 ,0x7260 ,"Hauppauge" ,"HVR-950Q" ), +AU0828_DEVICE (0x2040 ,0x7213 ,"Hauppauge" ,"HVR-950Q" ), +AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), /* Digidesign Mbox */ {
Greg Kroah-Hartman
maintainerPATCH 109/183 uvcvideo: Fix destruction order in uvc_delete()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 2228d80dd05a4fc5a410fde847677b8fb3eb23d7 upstream.
We've got a bug report at disconnecting a Webcam, where the kernel spews warnings like below:
WARNING: CPU: 0 PID: 8385 at ../fs/sysfs/group.c:219 sysfs_remove_group+0x87/0x90()
sysfs group c0b2350c not found for kobject 'event3'
CPU: 0 PID: 8385 Comm: queue2:src Not tainted 3.16.2-1.gdcee397-default #1
Hardware name: ASUSTeK Computer INC. A7N8X-E/A7N8X-E, BIOS ASUS A7N8X-E Deluxe ACPI BIOS Rev 1013 11/12/2004
c08d0705 ddc75cbc c0718c5b ddc75ccc c024b654 c08c6d44 ddc75ce8 000020c1
c08d0705 000000db c03d1ec7 c03d1ec7 00000009 00000000 c0b2350c d62c9064
ddc75cd4 c024b6a3 00000009 ddc75ccc c08c6d44 ddc75ce8 ddc75cfc c03d1ec7
Call Trace:
[<c0205ba6>] try_stack_unwind+0x156/0x170
[<c02046f3>] dump_trace+0x53/0x180
[<c0205c06>] show_trace_log_lvl+0x46/0x50
[<c0204871>] show_stack_log_lvl+0x51/0xe0
[<c0205c67>] show_stack+0x27/0x50
[<c0718c5b>] dump_stack+0x3e/0x4e
[<c024b654>] warn_slowpath_common+0x84/0xa0
[<c024b6a3>] warn_slowpath_fmt+0x33/0x40
[<c03d1ec7>] sysfs_remove_group+0x87/0x90
[<c05a2c54>] device_del+0x34/0x180
[<c05e3989>] evdev_disconnect+0x19/0x50
[<c05e06fa>] __input_unregister_device+0x9a/0x140
[<c05e0845>] input_unregister_device+0x45/0x80
[<f854b1d6>] uvc_delete+0x26/0x110 [uvcvideo]
[<f84d66f8>] v4l2_device_release+0x98/0xc0 [videodev]
[<c05a25bb>] device_release+0x2b/0x90
[<c04ad8bf>] kobject_cleanup+0x6f/0x1a0
[<f84d5453>] v4l2_release+0x43/0x70 [videodev]
[<c0372f31>] __fput+0xb1/0x1b0
[<c02650c1>] task_work_run+0x91/0xb0
[<c024d845>] do_exit+0x265/0x910
[<c024df64>] do_group_exit+0x34/0xa0
[<c025a76f>] get_signal_to_deliver+0x17f/0x590
[<c0201b6a>] do_signal+0x3a/0x960
[<c02024f7>] do_notify_resume+0x67/0x90
[<c071ebb5>] work_notifysig+0x30/0x3b
[<b7739e60>] 0xb7739e5f
---[ end trace b1e56095a485b631 ]---The cause is that uvc_status_cleanup() is called after usb_put_*() in uvc_delete(). usb_put_*() removes the sysfs parent and eventually removes the children recursively, so the later device_del() can't find its sysfs. The fix is simply rearrange the call orders in uvc_delete() so that the child is removed before the parent.
Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=897736
--- drivers/media/usb/uvc/uvc_driver.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/usb/uvc/uvc_driver.c +3 -3
@@ -1623,12 +1623,12 @@ static void uvc_delete(struct uvc_device {struct list_head *p, *n; -usb_put_intf (dev->intf); -usb_put_dev (dev->udev); -uvc_status_cleanup (dev);uvc_ctrl_cleanup_device (dev); +usb_put_intf (dev->intf); +usb_put_dev (dev->udev); +if (dev->vdev.dev)v4l2_device_unregister (&dev->vdev);#ifdef CONFIG_MEDIA_CONTROLLER
Greg Kroah-Hartman
maintainerPATCH 110/183 img-ir/hw: Always read data to clear buffer
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dylan Rajaratnam <[email protected]>
commit ea0de4ec5489da0fe738b274effac4f950e93d76 upstream.
A problem was found on Polaris where if the unit it booted via the power button on the infrared remote then the next button press on the remote would return the key code used to power on the unit.
The sequence is:
- The polaris powered off but with the powerdown controller (PDC) block still powered.
- Press power key on remote, IR block receives the key.
- Kernel starts, IR code is in IMG_IR_DATA_x but neither IMG_IR_RXDVAL or IMG_IR_RXDVALD2 are set.
- Wait any amount of time.
- Press any key.
- IMG_IR_RXDVAL or IMG_IR_RXDVALD2 is set but IMG_IR_DATA_x is unchanged since the powerup key data was never read.
This is worked around by always reading the IMG_IR_DATA_x in img_ir_set_decoder(), rather than only when the IMG_IR_RXDVAL or IMG_IR_RXDVALD2 bit is set.
--- drivers/media/rc/img-ir/img-ir-hw.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/media/rc/img-ir/img-ir-hw.c +4 -2
@@ -541,10 +541,12 @@ static void img_ir_set_decoder(struct imif (ir_status & (IMG_IR_RXDVAL |IMG_IR_RXDVALD2 )) { ir_status &= ~(IMG_IR_RXDVAL |IMG_IR_RXDVALD2 );img_ir_write (priv,IMG_IR_STATUS , ir_status); -img_ir_read (priv,IMG_IR_DATA_LW ); -img_ir_read (priv,IMG_IR_DATA_UP ); } +/* always read data to clear buffer if IR wakes the device */ +img_ir_read (priv,IMG_IR_DATA_LW ); +img_ir_read (priv,IMG_IR_DATA_UP ); +/* stop the end timer and switch back to normal mode */ del_timer_sync (&hw->end_timer); hw->mode =IMG_IR_M_NORMAL ;
Greg Kroah-Hartman
maintainerPATCH 111/183 img-ir/hw: Fix potential deadlock stopping timer
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hogan <[email protected]>
commit ac03086067a5524ae9e020ba5712a208c67b2736 upstream.
The end timer is used for switching back from repeat code timings when no repeat codes have been received for a certain amount of time. When the protocol is changed, the end timer is deleted synchronously with del_timer_sync(), however this takes place while holding the main spin lock, and the timer handler also needs to acquire the spin lock.
This opens the possibility of a deadlock on an SMP system if the protocol is changed just as the repeat timer is expiring. One CPU could end up in img_ir_set_decoder() holding the lock and waiting for the end timer to complete, while the other CPU is stuck in the timer handler spinning on the lock held by the first CPU.
Lockdep also spots a possible lock inversion in the same code, since img_ir_set_decoder() acquires the img-ir lock before the timer lock, but the timer handler will try and acquire them the other way around:
=========================================================
[ INFO: possible irq lock inversion dependency detected ] 3.18.0-rc5+ #957 Not tainted
---------------------------------------------------------
swapper/0/0 just changed the state of lock:
(((&hw->end_timer))){+.-...}, at: [<4006ae5c>] _call_timer_fn+0x0/0xfc
but this lock was taken by another, HARDIRQ-safe lock in the past:
(&(&priv->lock)->rlock#2){-.....}
and interrupts could create inverse lock ordering between them.
other info that might help us debug this:
Possible interrupt unsafe locking scenario:
CPU0 CPU1
---- ----
lock(((&hw->end_timer)));
local_irq_disable();
lock(&(&priv->lock)->rlock#2);
lock(((&hw->end_timer)));
<Interrupt>
lock(&(&priv->lock)->rlock#2);*** DEADLOCK ***
This is fixed by releasing the main spin lock while performing the del_timer_sync() call. The timer is prevented from restarting before the lock is reacquired by a new "stopping" flag which img_ir_handle_data() checks before updating the timer.
---------------------------------------------------------
swapper/0/0 just changed the state of lock:
(((&hw->end_timer))){+.-...}, at: [<4006ae5c>] _call_timer_fn+0x0/0xfc
but this lock was taken by another, HARDIRQ-safe lock in the past:
(&(&priv->lock)->rlock#2){-.....}
and interrupts could create inverse lock ordering between them. other info that might help us debug this:
Possible interrupt unsafe locking scenario:
CPU0 CPU1
---- ----
lock(((&hw->end_timer)));
local_irq_disable();
lock(&(&priv->lock)->rlock#2);
lock(((&hw->end_timer)));
<Interrupt>
lock(&(&priv->lock)->rlock#2); *** DEADLOCK ***
This is fixed by releasing the main spin lock while performing the del_timer_sync() call. The timer is prevented from restarting before the lock is reacquired by a new "stopping" flag which img_ir_handle_data() checks before updating the timer.
--- drivers/media/rc/img-ir/img-ir-hw.c | 22 +++++++++++++++++++--- drivers/media/rc/img-ir/img-ir-hw.h | 3 +++ 2 files changed, 22 insertions(+), 3 deletions(-)
drivers/media/rc/img-ir/img-ir-hw.c +19 -3
@@ -530,6 +530,22 @@ static void img_ir_set_decoder(struct imu32 ir_status, irq_en;spin_lock_irq (&priv->lock); +/* +* First record that the protocol is being stopped so that the end timer +* isn't restarted while we're trying to stop it. +*/ + hw->stopping = true; + +/* +* Release the lock to stop the end timer, since the end timer handler +* acquires the lock and we don't want to deadlock waiting for it. +*/ +spin_unlock_irq (&priv->lock); +del_timer_sync (&hw->end_timer); +spin_lock_irq (&priv->lock); + + hw->stopping = false; +/* switch off and disable interrupts */ img_ir_write (priv,IMG_IR_CONTROL ,0 ); irq_en =img_ir_read (priv,IMG_IR_IRQ_ENABLE );
@@ -547,8 +563,7 @@ static void img_ir_set_decoder(struct imimg_ir_read (priv,IMG_IR_DATA_LW );img_ir_read (priv,IMG_IR_DATA_UP ); -/* stop the end timer and switch back to normal mode */ -del_timer_sync (&hw->end_timer); +/* switch back to normal mode */ hw->mode =IMG_IR_M_NORMAL ;/* clear the wakeup scancode filter */
@@ -819,7 +834,8 @@ static void img_ir_handle_data(struct im } -if (dec->repeat) { +/* we mustn't update the end timer while trying to stop it */ +if (dec->repeat && !hw->stopping) {unsigned long interval;img_ir_begin_repeat (priv);
drivers/media/rc/img-ir/img-ir-hw.h +3 -0
@@ -214,6 +214,8 @@ enum img_ir_mode {* @flags: IMG_IR_F_*. * @filters: HW filters (derived from scancode filters). * @mode: Current decode mode. +* @stopping: Indicates that decoder is being taken down and timers +* should not be restarted. * @suspend_irqen: Saved IRQ enable mask over suspend. */ struct img_ir_priv_hw {
@@ -229,6 +231,7 @@ struct img_ir_priv_hw {struct img_ir_filter filters[RC_FILTER_MAX ];enum img_ir_mode mode; +bool stopping;u32 suspend_irqen; };
Greg Kroah-Hartman
maintainerPATCH 112/183 vivid: fix CROP_BOUNDS typo for video output
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
commit bb9ff078860f9d2f79d3a6bea3af9f48354ddb75 upstream.
An error was returned if composing was not supported, instead of if cropping was not supported.
A classic copy-and-paste bug. Found with v4l2-compliance.
--- drivers/media/platform/vivid/vivid-vid-out.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/vivid/vivid-vid-out.c +1 -1
@@ -612,7 +612,7 @@ int vivid_vid_out_g_selection(struct fil sel->r = dev->fmt_out_rect;break ;case V4L2_SEL_TGT_CROP_BOUNDS : -if (!dev->has_compose_out) +if (!dev->has_crop_out)return -EINVAL ; sel->r = vivid_max_rect;break ;
Greg Kroah-Hartman
maintainerPATCH 113/183 vfio-pci: Fix the check on pci device type in vfio_pci_probe()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Yang <[email protected]>
commit 7c2e211f3c95b91912a92a8c6736343690042e2e upstream.
Current vfio-pci just supports normal pci device, so vfio_pci_probe() will return if the pci device is not a normal device. While current code makes a mistake. PCI_HEADER_TYPE is the offset in configuration space of the device type, but we use this value to mask the type value.
This patch fixs this by do the check directly on the pci_dev->hdr_type.
--- drivers/vfio/pci/vfio_pci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/vfio/pci/vfio_pci.c +1 -3
@@ -839,13 +839,11 @@ static const struct vfio_device_ops vfiostatic int vfio_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id) { -u8 type;struct vfio_pci_device *vdev;struct iommu_group *group;int ret; -pci_read_config_byte (pdev,PCI_HEADER_TYPE , &type); -if ((type &PCI_HEADER_TYPE ) !=PCI_HEADER_TYPE_NORMAL ) +if (pdev->hdr_type !=PCI_HEADER_TYPE_NORMAL )return -EINVAL ; group =iommu_group_get (&pdev->dev);
Greg Kroah-Hartman
maintainerPATCH 114/183 locks: fix NULL-deref in generic_delete_lease
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit 52d304eb4eaced9ad04b64ba7cd6ceb5153bbf18 upstream.
commit 0efaa7e82f02fe69c05ad28e905f31fc86e6f08e
locks: generic_delete_lease doesn't need a file_lock at all
moves the call to fl->fl_lmops->lm_change() to a place in the code where fl might be a non-lease lock.
When that happens, fl_lmops is NULL and an Oops ensures.
So add an extra test to restore correct functioning.
--- fs/locks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/locks.c +1 -1
@@ -1702,7 +1702,7 @@ static int generic_delete_lease(struct fbreak ; }trace_generic_delete_lease (inode, fl); -if (fl) +if (fl &&IS_LEASE (fl)) error = fl->fl_lmops->lm_change (before,F_UNLCK , &dispose);spin_unlock (&inode->i_lock);locks_dispose_list (&dispose);
Greg Kroah-Hartman
maintainerPATCH 115/183 powernv: Fix OPAL tracepoint code
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Blanchard <[email protected]>
commit bfe5fda8e7ced129716f5741cf7ed2592a338824 upstream.
Patch c49f63530bb6 ("powernv: Add OPAL tracepoints") has a spurious store to the stack:
ld r12,opal_tracepoint_refcount@toc(r2); \ std r12,32(r1); \
The store was originally used to save the current tracepoint status so the entry and the exit tracepoints were always balanced. In the end I just created a separate path when tracepoints are enabled.
The offset on the stack used for this store is not valid for ABIv2 and it causes strange issues. I noticed it because OPAL console input was broken.
--- arch/powerpc/platforms/powernv/opal-wrappers.S | 1 - 1 file changed, 1 deletion(-)
arch/powerpc/platforms/powernv/opal-wrappers.S +0 -1
@@ -40,7 +40,6 @@ BEGIN_FTR_SECTION; \ b 1f; \ END_FTR_SECTION(0, 1); \ ld r12,opal_tracepoint_refcount@toc(r2); \ - std r12,32(r1); \ cmpdi r12,0; \ bne- LABEL; \ 1:
Greg Kroah-Hartman
maintainerPATCH 116/183 mmc: sdhci: Set SDHCI_POWER_ON with external vmmc
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Kryger <[email protected]>
commit 3cbc6123a93dc91b99b58f7ea37d267fe93e1cad upstream.
Host controllers lacking the required internal vmmc regulator may still follow the spec with regard to the LSB of SDHCI_POWER_CONTROL. Set the SDHCI_POWER_ON bit when vmmc is enabled to encourage the controller to to drive CMD, DAT, SDCLK.
This fixes a regression observed on some Qualcomm and Nvidia boards caused by 5222161 mmc: sdhci: Improve external VDD regulator support.
--- drivers/mmc/host/sdhci.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/mmc/host/sdhci.c +6 -0
@@ -1239,6 +1239,12 @@ static void sdhci_set_power(struct sdhcispin_unlock_irq (&host->lock);mmc_regulator_set_ocr (mmc, mmc->supply.vmmc, vdd);spin_lock_irq (&host->lock); + +if (mode !=MMC_POWER_OFF ) +sdhci_writeb (host,SDHCI_POWER_ON ,SDHCI_POWER_CONTROL ); +else +sdhci_writeb (host,0 ,SDHCI_POWER_CONTROL ); +return ; }
Greg Kroah-Hartman
maintainerPATCH 117/183 arm64: partially revert "ARM: 8167/1: extend the reserved memory for initrd to be page aligned"
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Catalin Marinas <[email protected]>
commit 0145058c3d30b4319d747f64caa16a9cb15f0581 upstream.
This patch partially reverts commit 421520ba98290a73b35b7644e877a48f18e06004 (only the arm64 part). There is no guarantee that the boot-loader places other images like dtb in a different page than initrd start/end, especially when the kernel is built with 64KB pages. When this happens, such pages must not be freed. The free_reserved_area() already takes care of rounding up "start" and rounding down "end" to avoid freeing partially used pages.
--- arch/arm64/mm/init.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
arch/arm64/mm/init.c +1 -7
@@ -333,14 +333,8 @@ static int keep_initrd;void free_initrd_mem (unsigned long start,unsigned long end) { -if (!keep_initrd) { -if (start == initrd_start) - start =round_down (start,PAGE_SIZE ); -if (end == initrd_end) - end =round_up (end,PAGE_SIZE ); - +if (!keep_initrd)free_reserved_area ((void *)start, (void *)end,0 ,"initrd" ); - } }static int __init keepinitrd_setup (char *__unused)
Greg Kroah-Hartman
maintainerPATCH 118/183 iwlwifi: mvm: fix Rx with both chains
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eyal Shapira <[email protected]>
commit c93edc639392df733c7d72db4376a9add775d18a upstream.
commit 5c90422439d6
"iwlwifi: mvm: don't allow diversity if BT Coex / TT forbid it" broke Rx with 2 chains for diversity.
This had an impact on throughput where we're using only a single stream (11a/b/g APs, single stream APs, static SMPS).
drivers/net/wireless/iwlwifi/mvm/utils.c +1 -1
@@ -665,7 +665,7 @@ bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm)if (num_of_ant (mvm->fw->valid_rx_ant) ==1 )return false; -if (!mvm->cfg->rx_with_siso_diversity) +if (mvm->cfg->rx_with_siso_diversity)return false; ieee80211_iterate_active_interfaces_atomic(
Greg Kroah-Hartman
maintainerPATCH 119/183 i40e: adds FCoE configure option
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasu Dev <[email protected]>
commit 776d4e9f5c0229037707f692b386b1f2a5bac054 upstream.
Adds FCoE config option I40E_FCOE, so that FCoE can be enabled as needed but otherwise have it disabled by default.
This also eliminate multiple FCoE config checks, instead now just one config check for CONFIG_I40E_FCOE.
The I40E FCoE was added with 3.17 kernel and therefore this patch shall be applied to stable 3.17 kernel also.
drivers/net/ethernet/intel/Kconfig +11 -0
@@ -281,6 +281,17 @@ config I40E_DCB If unsure, say N. +config I40E_FCOE + bool "Fibre Channel over Ethernet (FCoE)" + default n + depends on I40E && DCB && FCOE + ---help--- + Say Y here if you want to use Fibre Channel over Ethernet (FCoE) + in the driver. This will create new netdev for exclusive FCoE + use with XL710 FCoE offloads enabled. + + If unsure, say N. + config I40EVF tristate "Intel(R) XL710 X710 Virtual Function Ethernet support" depends on PCI_MSI
drivers/net/ethernet/intel/i40e/Makefile +1 -1
@@ -44,4 +44,4 @@ i40e-objs := i40e_main.o \ i40e_virtchnl_pf.o i40e-$(CONFIG_I40E_DCB) += i40e_dcb.o i40e_dcb_nl.o -i40e-$(CONFIG_FCOE:m=y) += i40e_fcoe.o +i40e-$(CONFIG_I40E_FCOE) += i40e_fcoe.o
drivers/net/ethernet/intel/i40e/i40e_osdep.h +2 -2
@@ -78,7 +78,7 @@ do { \ } while (0) typedef enum i40e_status_code i40e_status; -#if defined(CONFIG_FCOE ) || defined(CONFIG_FCOE_MODULE ) +#ifdef CONFIG_I40E_FCOE #define I40E_FCOE -#endif /* CONFIG_FCOE or CONFIG_FCOE_MODULE */ +#endif #endif /* _I40E_OSDEP_H_ */
Greg Kroah-Hartman
maintainerPATCH 120/183 drivers: net: cpsw: fix multicast flush in dual emac mode
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mugunthan V N <[email protected]>
commit 25906052d953d3fbdb7e19480b9de5e6bb949f3f upstream.
Since ALE table is a common resource for both the interfaces in Dual EMAC mode and while bringing up the second interface in cpsw_ndo_set_rx_mode() all the multicast entries added by the first interface is flushed out and only second interface multicast addresses are added. Fixing this by flushing multicast addresses based on dual EMAC port vlans which will not affect the other emac port multicast addresses.
--- drivers/net/ethernet/ti/cpsw.c | 11 +++++++++-- drivers/net/ethernet/ti/cpsw_ale.c | 10 +++++++++- drivers/net/ethernet/ti/cpsw_ale.h | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-)
drivers/net/ethernet/ti/cpsw.c +9 -2
@@ -610,7 +610,7 @@ static void cpsw_set_promiscious(struct/* Clear all mcast from ALE */ cpsw_ale_flush_multicast (ale,ALE_ALL_PORTS << - priv->host_port); + priv->host_port,-1 );/* Flood All Unicast Packets to Host port */ cpsw_ale_control_set (ale,0 ,ALE_P0_UNI_FLOOD ,1 );
@@ -634,6 +634,12 @@ static void cpsw_set_promiscious(structstatic void cpsw_ndo_set_rx_mode (struct net_device *ndev) {struct cpsw_priv *priv =netdev_priv (ndev); +int vid; + +if (priv->data.dual_emac) + vid = priv->slaves[priv->emac_port].port_vlan; +else + vid = priv->data.default_vlan;if (ndev->flags &IFF_PROMISC ) {/* Enable promiscuous mode */
@@ -649,7 +655,8 @@ static void cpsw_ndo_set_rx_mode(structcpsw_ale_set_allmulti (priv->ale, priv->ndev->flags &IFF_ALLMULTI );/* Clear all mcast from ALE */ -cpsw_ale_flush_multicast (priv->ale,ALE_ALL_PORTS << priv->host_port); +cpsw_ale_flush_multicast (priv->ale,ALE_ALL_PORTS << priv->host_port, + vid);if (!netdev_mc_empty (ndev)) {struct netdev_hw_addr *ha;
drivers/net/ethernet/ti/cpsw_ale.c +9 -1
@@ -234,7 +234,7 @@ static void cpsw_ale_flush_mcast(structcpsw_ale_set_entry_type (ale_entry,ALE_TYPE_FREE ); } -int cpsw_ale_flush_multicast (struct cpsw_ale *ale,int port_mask) +int cpsw_ale_flush_multicast (struct cpsw_ale *ale,int port_mask,int vid) {u32 ale_entry[ALE_ENTRY_WORDS ];int ret, idx;
@@ -245,6 +245,14 @@ int cpsw_ale_flush_multicast(struct cpswif (ret !=ALE_TYPE_ADDR && ret !=ALE_TYPE_VLAN_ADDR )continue ; +/* if vid passed is -1 then remove all multicast entry from +* the table irrespective of vlan id, if a valid vlan id is +* passed then remove only multicast added to that vlan id. +* if vlan id doesn't match then move on to next entry. +*/ +if (vid !=-1 &&cpsw_ale_get_vlan_id (ale_entry) != vid) +continue ; +if (cpsw_ale_get_mcast (ale_entry)) {u8 addr[6 ];
drivers/net/ethernet/ti/cpsw_ale.h +1 -1
@@ -92,7 +92,7 @@ void cpsw_ale_stop(struct cpsw_ale *ale)int cpsw_ale_set_ageout (struct cpsw_ale *ale,int ageout);int cpsw_ale_flush (struct cpsw_ale *ale,int port_mask); -int cpsw_ale_flush_multicast (struct cpsw_ale *ale,int port_mask); +int cpsw_ale_flush_multicast (struct cpsw_ale *ale,int port_mask,int vid);int cpsw_ale_add_ucast (struct cpsw_ale *ale,u8 *addr,int port,int flags,u16 vid); int cpsw_ale_del_ucast(struct cpsw_ale *ale, u8 *addr, int port,
Greg Kroah-Hartman
maintainerPATCH 121/183 leds: netxbig: fix oops at probe time
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Simon Guinot <[email protected]>
commit 0c86ac2c50647451d6a70dc900f8bb0ee3d485d9 upstream.
This patch fixes a NULL pointer dereference on led_dat->mode_val. Due to this bug, a kernel oops can be observed at probe time on the LaCie 2Big and 5Big v2 boards:
Unable to handle kernel NULL pointer dereference at virtual address 00000008
[...]
[<c03f244c>] (netxbig_led_probe) from [<c02c8c6c>] (platform_drv_probe+0x4c/0x9c) [<c02c8c6c>] (platform_drv_probe) from [<c02c72d0>] (driver_probe_device+0x98/0x25c) [<c02c72d0>] (driver_probe_device) from [<c02c7520>] (__driver_attach+0x8c/0x90) [<c02c7520>] (__driver_attach) from [<c02c5c24>] (bus_for_each_dev+0x68/0x94) [<c02c5c24>] (bus_for_each_dev) from [<c02c6408>] (bus_add_driver+0x124/0x1dc) [<c02c6408>] (bus_add_driver) from [<c02c7ac0>] (driver_register+0x78/0xf8) [<c02c7ac0>] (driver_register) from [<c000888c>] (do_one_initcall+0x80/0x1cc) [<c000888c>] (do_one_initcall) from [<c0733618>] (kernel_init_freeable+0xe4/0x1b4) [<c0733618>] (kernel_init_freeable) from [<c058db9c>] (kernel_init+0xc/0xec) [<c058db9c>] (kernel_init) from [<c0009850>] (ret_from_fork+0x14/0x24) [...]
This bug was introduced by commit 588a6a99286ae30afb1339d8bc2163517b1b7dd1 ("leds: netxbig: fix attribute-creation race").
drivers/leds/leds-netxbig.c +6 -6
@@ -330,18 +330,18 @@ create_netxbig_led(struct platform_device *pdev, led_dat->sata =0 ; led_dat->cdev.brightness =LED_OFF ; led_dat->cdev.flags |=LED_CORE_SUSPENDRESUME ; -/* -* If available, expose the SATA activity blink capability through -* a "sata" sysfs attribute. -*/ -if (led_dat->mode_val[NETXBIG_LED_SATA ] !=NETXBIG_LED_INVALID_MODE ) - led_dat->cdev.groups = netxbig_led_groups; led_dat->mode_addr = template->mode_addr; led_dat->mode_val = template->mode_val; led_dat->bright_addr = template->bright_addr; led_dat->bright_max = (1 << pdata->gpio_ext->num_data) -1 ; led_dat->timer = pdata->timer; led_dat->num_timer = pdata->num_timer; +/* +* If available, expose the SATA activity blink capability through +* a "sata" sysfs attribute. +*/ +if (led_dat->mode_val[NETXBIG_LED_SATA ] !=NETXBIG_LED_INVALID_MODE ) + led_dat->cdev.groups = netxbig_led_groups;return led_classdev_register (&pdev->dev, &led_dat->cdev); }
Greg Kroah-Hartman
maintainerPATCH 122/183 ftrace/jprobes/x86: Fix conflict between jprobes and function graph tracing
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (Red Hat)" <[email protected]>
commit 237d28db036e411f22c03cfd5b0f6dc2aa9bf3bc upstream.
If the function graph tracer traces a jprobe callback, the system will crash. This can easily be demonstrated by compiling the jprobe sample module that is in the kernel tree, loading it and running the function graph tracer.
# modprobe jprobe_example.ko # echo function_graph > /sys/kernel/debug/tracing/current_tracer # ls
The first two commands end up in a nice crash after the first fork. (do_fork has a jprobe attached to it, so "ls" just triggers that fork)
The problem is caused by the jprobe_return() that all jprobe callbacks must end with. The way jprobes works is that the function a jprobe is attached to has a breakpoint placed at the start of it (or it uses ftrace if fentry is supported). The breakpoint handler (or ftrace callback) will copy the stack frame and change the ip address to return to the jprobe handler instead of the function. The jprobe handler must end with jprobe_return() which swaps the stack and does an int3 (breakpoint). This breakpoint handler will then put back the saved stack frame, simulate the instruction at the beginning of the function it added a breakpoint to, and then continue on.
For function tracing to work, it hijakes the return address from the stack frame, and replaces it with a hook function that will trace the end of the call. This hook function will restore the return address of the function call.
If the function tracer traces the jprobe handler, the hook function for that handler will not be called, and its saved return address will be used for the next function. This will result in a kernel crash.
To solve this, pause function tracing before the jprobe handler is called and unpause it before it returns back to the function it probed.
Some other updates:
Used a variable "saved_sp" to hold kcb->jprobe_saved_sp. This makes the code look a bit cleaner and easier to understand (various tries to fix this bug required this change).
Note, if fentry is being used, jprobes will change the ip address before the function graph tracer runs and it will not be able to trace the function that the jprobe is probing.
--- arch/x86/kernel/kprobes/core.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
arch/x86/kernel/kprobes/core.c +15 -5
@@ -1018,6 +1018,15 @@ int setjmp_pre_handler(struct kprobe *p, regs->flags &= ~X86_EFLAGS_IF ;trace_hardirqs_off (); regs->ip = (unsigned long )(jp->entry); + +/* +* jprobes use jprobe_return() which skips the normal return +* path of the function, and this messes up the accounting of the +* function graph tracer to get messed up. +* +* Pause function graph tracing while performing the jprobe function. +*/ +pause_graph_tracing ();return 1 ; }NOKPROBE_SYMBOL (setjmp_pre_handler);
@@ -1046,24 +1055,25 @@ int longjmp_break_handler(struct kprobestruct kprobe_ctlblk *kcb =get_kprobe_ctlblk ();u8 *addr = (u8 *) (regs->ip -1 ); struct jprobe *jp = container_of(p, struct jprobe, kp); +void *saved_sp = kcb->jprobe_saved_sp;if ((addr > (u8 *) jprobe_return) && (addr < (u8 *) jprobe_return_end)) { -if (stack_addr (regs) != kcb->jprobe_saved_sp) { +if (stack_addr (regs) != saved_sp) {struct pt_regs *saved_regs = &kcb->jprobe_saved_regs;printk (KERN_ERR "current sp %p does not match saved sp %p\n" , -stack_addr (regs), kcb->jprobe_saved_sp); +stack_addr (regs), saved_sp);printk (KERN_ERR "Saved registers for jprobe %p\n" , jp);show_regs (saved_regs);printk (KERN_ERR "Current registers\n" );show_regs (regs);BUG (); } +/* It's OK to start function graph tracing again */ +unpause_graph_tracing (); *regs = kcb->jprobe_saved_regs; -memcpy ((kprobe_opcode_t *)(kcb->jprobe_saved_sp), - kcb->jprobes_stack, -MIN_STACK_SIZE (kcb->jprobe_saved_sp)); +memcpy (saved_sp, kcb->jprobes_stack,MIN_STACK_SIZE (saved_sp));preempt_enable_no_resched ();return 1 ; }
Greg Kroah-Hartman
maintainerPATCH 123/183 ftrace: Fix updating of filters for shared global_ops filters
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (Red Hat)" <[email protected]>
commit 8f86f83709c585742dea5dd7f0d2b79c43f992ec upstream.
As the set_ftrace_filter affects both the function tracer as well as the function graph tracer, the ops that represent each have a shared ftrace_ops_hash structure. This allows both to be updated when the filter files are updated.
But if function graph is enabled and the global_ops (function tracing) ops is not, then it is possible that the filter could be changed without the update happening for the function graph ops. This will cause the changes to not take place and may even cause a ftrace_bug to occur as it could mess with the trampoline accounting.
The solution is to check if the ops uses the shared global_ops filter and if the ops itself is not enabled, to check if there's another ops that is enabled and also shares the global_ops filter. In that case, the modification still needs to be executed.
--- kernel/trace/ftrace.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
kernel/trace/ftrace.c +25 -1
@@ -3786,8 +3786,32 @@ ftrace_match_addr(struct ftrace_hash *hastatic void ftrace_ops_update_code (struct ftrace_ops *ops,struct ftrace_hash *old_hash) { -if (ops->flags &FTRACE_OPS_FL_ENABLED && ftrace_enabled) +struct ftrace_ops *op; + +if (!ftrace_enabled) +return ; + +if (ops->flags &FTRACE_OPS_FL_ENABLED ) {ftrace_run_modify_code (ops,FTRACE_UPDATE_CALLS , old_hash); +return ; + } + +/* +* If this is the shared global_ops filter, then we need to +* check if there is another ops that shares it, is enabled. +* If so, we still need to run the modify code. +*/ +if (ops->func_hash != &global_ops.local_hash) +return ; + +do_for_each_ftrace_op (op, ftrace_ops_list) { +if (op->func_hash == &global_ops.local_hash && + op->flags &FTRACE_OPS_FL_ENABLED ) { +ftrace_run_modify_code (op,FTRACE_UPDATE_CALLS , old_hash); +/* Only need to do this once */ +return ; + } + }while_for_each_ftrace_op (op); } static int
Greg Kroah-Hartman
maintainerPATCH 124/183 ftrace: Check both notrace and filter for old hash
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (Red Hat)" <[email protected]>
commit 7485058eea40783ac142a60c3e799fc66ce72583 upstream.
Using just the filter for checking for trampolines or regs is not enough when updating the code against the records that represent all functions. Both the filter hash and the notrace hash need to be checked.
To trigger this bug (using trace-cmd and perf):
# perf probe -a do_fork # trace-cmd start -B foo -e probe # trace-cmd record -p function_graph -n do_fork sleep 1
The trace-cmd record at the end clears the filter before it disables function_graph tracing and then that causes the accounting of the ftrace function records to become incorrect and causes ftrace to bug.
--- kernel/trace/ftrace.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-)
kernel/trace/ftrace.c +20 -7
@@ -2308,12 +2308,14 @@ static void ftrace_run_update_code(int c }static void ftrace_run_modify_code (struct ftrace_ops *ops,int command, -struct ftrace_hash *old_hash) +struct ftrace_ops_hash *old_hash) { ops->flags |=FTRACE_OPS_FL_MODIFYING ; - ops->old_hash.filter_hash = old_hash; + ops->old_hash.filter_hash = old_hash->filter_hash; + ops->old_hash.notrace_hash = old_hash->notrace_hash;ftrace_run_update_code (command); ops->old_hash.filter_hash =NULL ; + ops->old_hash.notrace_hash =NULL ; ops->flags &= ~FTRACE_OPS_FL_MODIFYING ; }
@@ -3357,7 +3359,7 @@ static struct ftrace_ops trace_probe_opsstatic int ftrace_probe_registered; -static void __enable_ftrace_function_probe (struct ftrace_hash *old_hash) +static void __enable_ftrace_function_probe (struct ftrace_ops_hash *old_hash) {int ret;int i;
@@ -3415,6 +3417,7 @@ int register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops, void *data) { +struct ftrace_ops_hash old_hash_ops;struct ftrace_func_probe *entry;struct ftrace_hash **orig_hash = &trace_probe_ops.func_hash->filter_hash;struct ftrace_hash *old_hash = *orig_hash;
@@ -3436,6 +3439,10 @@ register_ftrace_function_probe(char *glomutex_lock (&trace_probe_ops.func_hash->regex_lock); + old_hash_ops.filter_hash = old_hash; +/* Probes only have filters */ + old_hash_ops.notrace_hash =NULL ; + hash =alloc_and_copy_ftrace_hash (FTRACE_HASH_DEFAULT_BITS , old_hash);if (!hash) { count = -ENOMEM ;
@@ -3496,7 +3503,7 @@ register_ftrace_function_probe(char *glo ret =ftrace_hash_move (&trace_probe_ops,1 , orig_hash, hash); -__enable_ftrace_function_probe (old_hash); +__enable_ftrace_function_probe (&old_hash_ops);if (!ret)free_ftrace_hash_rcu (old_hash);
@@ -3784,7 +3791,7 @@ ftrace_match_addr(struct ftrace_hash *ha }static void ftrace_ops_update_code (struct ftrace_ops *ops, -struct ftrace_hash *old_hash) +struct ftrace_ops_hash *old_hash) {struct ftrace_ops *op;
@@ -3819,6 +3826,7 @@ ftrace_set_hash(struct ftrace_ops *ops, unsigned long ip, int remove, int reset, int enable) { struct ftrace_hash **orig_hash; +struct ftrace_ops_hash old_hash_ops;struct ftrace_hash *old_hash;struct ftrace_hash *hash;int ret;
@@ -3855,9 +3863,11 @@ ftrace_set_hash(struct ftrace_ops *ops,mutex_lock (&ftrace_lock); old_hash = *orig_hash; + old_hash_ops.filter_hash = ops->func_hash->filter_hash; + old_hash_ops.notrace_hash = ops->func_hash->notrace_hash; ret =ftrace_hash_move (ops, enable, orig_hash, hash);if (!ret) { -ftrace_ops_update_code (ops, old_hash); +ftrace_ops_update_code (ops, &old_hash_ops);free_ftrace_hash_rcu (old_hash); }mutex_unlock (&ftrace_lock);
@@ -4066,6 +4076,7 @@ static void __init set_ftrace_early_filtint ftrace_regex_release (struct inode *inode,struct file *file) {struct seq_file *m = (struct seq_file *)file->private_data; +struct ftrace_ops_hash old_hash_ops;struct ftrace_iterator *iter;struct ftrace_hash **orig_hash;struct ftrace_hash *old_hash;
@@ -4099,10 +4110,12 @@ int ftrace_regex_release(struct inode *imutex_lock (&ftrace_lock); old_hash = *orig_hash; + old_hash_ops.filter_hash = iter->ops->func_hash->filter_hash; + old_hash_ops.notrace_hash = iter->ops->func_hash->notrace_hash; ret =ftrace_hash_move (iter->ops, filter_hash, orig_hash, iter->hash);if (!ret) { -ftrace_ops_update_code (iter->ops, old_hash); +ftrace_ops_update_code (iter->ops, &old_hash_ops);free_ftrace_hash_rcu (old_hash); }mutex_unlock (&ftrace_lock);
Greg Kroah-Hartman
maintainerPATCH 125/183 NFSv4.1: Fix client id trunking on Linux
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 1fc0703af3143914a389bfa081c7acb09502ed5d upstream.
Currently, our trunking code will check for session trunking, but will fail to detect client id trunking. This is a problem, because it means that the client will fail to recognise that the two connections represent shared state, even if they do not permit a shared session.
By removing the check for the server minor id, and only checking the major id, we will end up doing the right thing in both cases: we close down the new nfs_client and fall back to using the existing one.
--- fs/nfs/nfs4client.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
fs/nfs/nfs4client.c +8 -9
@@ -572,20 +572,14 @@ static bool nfs4_match_clientids(struct }/* -* Returns true if the server owners match +* Returns true if the server major ids match */ static bool -nfs4_match_serverowners (struct nfs_client *a,struct nfs_client *b) +nfs4_check_clientid_trunking (struct nfs_client *a,struct nfs_client *b) {struct nfs41_server_owner *o1 = a->cl_serverowner;struct nfs41_server_owner *o2 = b->cl_serverowner; -if (o1->minor_id != o2->minor_id) { -dprintk ("NFS: --> %s server owner minor IDs do not match\n" , - __func__); -return false; - } -if (o1->major_id_sz != o2->major_id_sz) goto out_major_mismatch;if (memcmp (o1->major_id, o2->major_id, o1->major_id_sz) !=0 )
@@ -661,7 +655,12 @@ int nfs41_walk_client_list(struct nfs_clif (!nfs4_match_clientids (pos, new))continue ; -if (!nfs4_match_serverowners (pos, new)) +/* +* Note that session trunking is just a special subcase of +* client id trunking. In either case, we want to fall back +* to using the existing nfs_client. +*/ +if (!nfs4_check_clientid_trunking (pos, new))continue ;atomic_inc (&pos->cl_count);
Greg Kroah-Hartman
maintainerPATCH 126/183 mei: clean reset bit before reset
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Usyskin <[email protected]>
commit b13a65ef190e488e2761d65bdd2e1fe8a3a125f5 upstream.
H_RST bit in H_CSR register may be found lit before reset is started, for example if preceding reset flow hasn't completed.
In that case asserting H_RST will be ignored, therefore we need to clean H_RST bit to start a successful reset sequence.
--- drivers/misc/mei/hw-me.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/misc/mei/hw-me.c +12 -0
@@ -234,6 +234,18 @@ static int mei_me_hw_reset(struct mei_destruct mei_me_hw *hw =to_me_hw (dev);u32 hcsr =mei_hcsr_read (hw); +/* H_RST may be found lit before reset is started, +* for example if preceding reset flow hasn't completed. +* In that case asserting H_RST will be ignored, therefore +* we need to clean H_RST bit to start a successful reset sequence. +*/ +if ((hcsr &H_RST ) ==H_RST ) { +dev_warn (dev->dev,"H_RST is set = 0x%08X" , hcsr); + hcsr &= ~H_RST ; +mei_me_reg_write (hw,H_CSR , hcsr); + hcsr =mei_hcsr_read (hw); + } + hcsr |=H_RST |H_IG |H_IS ;if (intr_enable)
Greg Kroah-Hartman
maintainerPATCH 128/183 uas: Add US_FL_NO_REPORT_OPCODES for JMicron JMS566 with usb-id 0bc2:a013
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit c6fa3945c8b5baf62f2e849104ecd6f3a1e5e407 upstream.
Like the JMicron JMS567 enclosures with the JMS566 choke on report-opcodes, so avoid it.
drivers/usb/storage/unusual_uas.h +7 -0
@@ -111,6 +111,13 @@ UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NO_ATA_1X), +/* Reported-by: Takeo Nakayama <[email protected]> */ +UNUSUAL_DEV (0x357d ,0x7788 ,0x0000 ,0x9999 , +"JMicron" , +"JMS566" , +USB_SC_DEVICE ,USB_PR_DEVICE ,NULL , +US_FL_NO_REPORT_OPCODES ), +/* Reported-by: Hans de Goede <[email protected]> */ UNUSUAL_DEV(0x4971, 0x1012, 0x0000, 0x9999, "Hitachi",
Greg Kroah-Hartman
maintainerPATCH 129/183 uas: Add US_FL_NO_ATA_1X for 2 more Seagate disk enclosures
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 3ca8c717429b90f621aed28af029da4c3da378bc upstream.
Just like all previous UAS capable Seagate disk enclosures, these need the US_FL_NO_ATA_1X to not crash when udev probes them.
--- drivers/usb/storage/unusual_uas.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/usb/storage/unusual_uas.h +14 -0
@@ -75,6 +75,13 @@ UNUSUAL_DEV(0x0bc2, 0xa013, 0x0000, 0x99 USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NO_ATA_1X), +/* Reported-by: Hans de Goede <[email protected]> */ +UNUSUAL_DEV (0x0bc2 ,0xa0a4 ,0x0000 ,0x9999 , +"Seagate" , +"Backup Plus Desk" , +USB_SC_DEVICE ,USB_PR_DEVICE ,NULL , +US_FL_NO_ATA_1X ), +/* https://bbs.archlinux.org/viewtopic.php?id=183190 */ UNUSUAL_DEV(0x0bc2, 0xab20, 0x0000, 0x9999, "Seagate",
@@ -89,6 +96,13 @@ UNUSUAL_DEV(0x0bc2, 0xab21, 0x0000, 0x99 USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NO_ATA_1X), +/* Reported-by: G. Richard Bellamy <[email protected]> */ +UNUSUAL_DEV (0x0bc2 ,0xab2a ,0x0000 ,0x9999 , +"Seagate" , +"BUP Fast HDD" , +USB_SC_DEVICE ,USB_PR_DEVICE ,NULL , +US_FL_NO_ATA_1X ), +/* Reported-by: Claudio Bizzarri <[email protected]> */ UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999, "JMicron",
Greg Kroah-Hartman
maintainerPATCH 130/183 reset: sunxi: fix spinlock initialization
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tyler Baker <[email protected]>
commit 41544f9f38f19cb46dc9a8fa37c58677a0300899 upstream.
Call spin_lock_init() before the spinlocks are used, both in early init and probe functions preventing a lockdep splat.
I have been observing lockdep complaining [1] during boot on my a80 optimus [2] when CONFIG_PROVE_LOCKING has been enabled. This patch resolves the splat, and has been tested on a few other sunxi platforms without issue.
[1] http://storage.kernelci.org/next/next-20150107/arm-multi_v7_defconfig+CONFIG_PROVE_LOCKING=y/lab-tbaker/boot-sun9i-a80-optimus.html
[2] http://kernelci.org/boot/?a80-optimus
--- drivers/reset/reset-sunxi.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/reset/reset-sunxi.c +4 -0
@@ -102,6 +102,8 @@ static int sunxi_reset_init(struct devic goto err_alloc; } +spin_lock_init (&data->lock); + data->rcdev.owner =THIS_MODULE ; data->rcdev.nr_resets = size *32 ; data->rcdev.ops = &sunxi_reset_ops;
@@ -157,6 +159,8 @@ static int sunxi_reset_probe(struct platif (IS_ERR (data->membase))return PTR_ERR (data->membase); +spin_lock_init (&data->lock); + data->rcdev.owner =THIS_MODULE ; data->rcdev.nr_resets =resource_size (res) *32 ; data->rcdev.ops = &sunxi_reset_ops;
Greg Kroah-Hartman
maintainerPATCH 131/183 ARM: dts: berlin: correct BG2Qs SM GPIO location.
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jisheng Zhang <[email protected]>
commit 5138d5c562e3bfe30964e20ab46eec9f8b89225d upstream.
The gpio4 and gpio5 are in 0xf7fc0000 apb which is located in the SM domain. This patch moves gpio4 and gpio5 to the correct location. This patch also renames them as the following to match the names we internally used in marvell:
gpio4 -> sm_gpio1 gpio5 -> sm_gpio0 porte -> portf portf -> porte
This also matches what we did for BG2 and BG2CD's SM GPIO.
--- arch/arm/boot/dts/berlin2q.dtsi | 60 ++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 30 deletions(-)
arch/arm/boot/dts/berlin2q.dtsi +30 -30
@@ -315,36 +315,6 @@ interrupt-parent = <&gic>; interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>; }; - - gpio4: gpio@5000 { - compatible = "snps,dw-apb-gpio"; - reg = <0x5000 0x400>; - #address-cells = <1>; - #size-cells = <0>; - - porte: gpio-port@4 { - compatible = "snps,dw-apb-gpio-port"; - gpio-controller; - #gpio-cells = <2>; - snps,nr-gpios = <32>; - reg = <0>; - }; - }; - - gpio5: gpio@c000 { - compatible = "snps,dw-apb-gpio"; - reg = <0xc000 0x400>; - #address-cells = <1>; - #size-cells = <0>; - - portf: gpio-port@5 { - compatible = "snps,dw-apb-gpio-port"; - gpio-controller; - #gpio-cells = <2>; - snps,nr-gpios = <32>; - reg = <0>; - }; - }; }; chip: chip-control@ea0000 {
@@ -373,6 +343,21 @@ ranges = <0 0xfc0000 0x10000>; interrupt-parent = <&sic>; + sm_gpio1: gpio@5000 { + compatible = "snps,dw-apb-gpio"; + reg = <0x5000 0x400>; + #address-cells = <1>; + #size-cells = <0>; + + portf: gpio-port@5 { + compatible = "snps,dw-apb-gpio-port"; + gpio-controller; + #gpio-cells = <2>; + snps,nr-gpios = <32>; + reg = <0>; + }; + }; + i2c2: i2c@7000 { compatible = "snps,designware-i2c"; #address-cells = <1>;
@@ -423,6 +408,21 @@ status = "disabled"; }; + sm_gpio0: gpio@c000 { + compatible = "snps,dw-apb-gpio"; + reg = <0xc000 0x400>; + #address-cells = <1>; + #size-cells = <0>; + + porte: gpio-port@4 { + compatible = "snps,dw-apb-gpio-port"; + gpio-controller; + #gpio-cells = <2>; + snps,nr-gpios = <32>; + reg = <0>; + }; + }; + sysctrl: pin-controller@d000 { compatible = "marvell,berlin2q-system-ctrl"; reg = <0xd000 0x100>;
Greg Kroah-Hartman
maintainerPATCH 132/183 pinctrl: lantiq: remove bogus of_gpio_chip_add
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 41f632fe177bc4822c2e8236fe7c291e6e9eb6f8 upstream.
Remove bogus call to of_gpiochip_add (and of_gpio_chip remove in error path) which is also called when adding the gpio chip.
This prevents adding the same pinctrl range twice.
pinctrl support")
--- drivers/pinctrl/pinctrl-xway.c | 2 -- 1 file changed, 2 deletions(-)
drivers/pinctrl/pinctrl-xway.c +0 -2
@@ -798,10 +798,8 @@ static int pinmux_xway_probe(struct plat/* load the gpio chip */ xway_chip.dev = &pdev->dev; -of_gpiochip_add (&xway_chip); ret =gpiochip_add (&xway_chip);if (ret) { -of_gpiochip_remove (&xway_chip);dev_err (&pdev->dev,"Failed to register gpio chip\n" );return ret; }
Greg Kroah-Hartman
maintainerPATCH 133/183 gpiolib: of: Correct error handling in of_get_named_gpiod_flags
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Holmberg <[email protected]>
commit 7b8792bbdffdff3abda704f89c6a45ea97afdc62 upstream.
of_get_named_gpiod_flags fails with -EPROBE_DEFER in cases where the gpio chip is available and the GPIO translation fails.
This causes drivers to be re-probed erroneusly, and hides the real problem(i.e. the GPIO number being out of range).
--- drivers/gpio/gpiolib-of.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpio/gpiolib-of.c +8 -2
@@ -45,8 +45,14 @@ static int of_gpiochip_find_and_xlate(streturn false; ret = gc->of_xlate (gc, &gg_data->gpiospec, gg_data->flags); -if (ret <0 ) -return false; +if (ret <0 ) { +/* We've found the gpio chip, but the translation failed. +* Return true to stop looking and return the translation +* error via out_gpio +*/ + gg_data->out_gpio =ERR_PTR (ret); +return true; + } gg_data->out_gpio =gpiochip_get_desc (gc, ret);return true;
Greg Kroah-Hartman
maintainerPATCH 134/183 gpio: crystalcove: use handle_nested_irq
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Lu <[email protected]>
commit e733a2fb8cbcff0747108cb529ffb4e4a00465ac upstream.
The CrystalCove GPIO chip has can_sleep set so its demultiplexed irqs will have IRQ_NESTED_THREAD flag set, thus we should use the nested version handle_nested_irq in CrystalCove's irq handler instead of handle_generic_irq, or the following warning will be hit and the functionality is lost:
[ 4089.639554] Hardware name: ASUSTeK COMPUTER INC. T100TA/T100TA, BIOS T100TA.313 08/13/2014 [ 4089.639564] 00000002 00000000 c24fbdf4 c16e0257 c24fbe38 c24fbe28 c105390c c18ec480 [ 4089.639596] c24fbe54 00000048 c18f8e3b 00000295 c10a60fc 00000295 c10a60fc f4464540 [ 4089.639626] f446459c c278ad40 c24fbe40 c1053974 00000009 c24fbe38 c18ec480 c24fbe54 [ 4089.639656] Call Trace: [ 4089.639685] [<c16e0257>] dump_stack+0x41/0x52 [ 4089.639707] [<c105390c>] warn_slowpath_common+0x8c/0xc0 [ 4089.639727] [<c10a60fc>] ? irq_nested_primary_handler+0x2c/0x30 [ 4089.639744] [<c10a60fc>] ? irq_nested_primary_handler+0x2c/0x30 [ 4089.639763] [<c1053974>] warn_slowpath_fmt+0x34/0x40 [ 4089.639781] [<c10a60fc>] irq_nested_primary_handler+0x2c/0x30 [ 4089.639800] [<c10a5c56>] handle_irq_event_percpu+0x76/0x190 [ 4089.639818] [<c1461570>] ? regmap_format_10_14_write+0x30/0x30 [ 4089.639836] [<c1464f4c>] ? _regmap_bus_raw_write+0x4c/0x70 [ 4089.639854] [<c10a5da1>] handle_irq_event+0x31/0x50 [ 4089.639872] [<c10a83eb>] handle_simple_irq+0x4b/0x70 [ 4089.639889] [<c10a5384>] generic_handle_irq+0x24/0x40 [ 4089.639908] [<c1366d87>] crystalcove_gpio_irq_handler+0xa7/0xc0 [ 4089.639927] [<c10a85a7>] handle_nested_irq+0x77/0x190 [ 4089.639947] [<c1469801>] regmap_irq_thread+0x1b1/0x360 [ 4089.639966] [<c10a6ae8>] irq_thread_fn+0x18/0x30 [ 4089.639983] [<c10a6906>] irq_thread+0xf6/0x110 [ 4089.640001] [<c10a6ad0>] ? irq_finalize_oneshot.part.30+0x1b0/0x1b0 [ 4089.640019] [<c10a6b50>] ? irq_forced_thread_fn+0x50/0x50 [ 4089.640037] [<c10a6810>] ? irq_thread_check_affinity+0xc0/0xc0 [ 4089.640054] [<c106f389>] kthread+0xa9/0xc0 [ 4089.640074] [<c16e6401>] ret_from_kernel_thread+0x21/0x30 [ 4089.640091] [<c106f2e0>] ? kthread_create_on_node+0x110/0x110 [ 4089.640105] ---[ end trace dca7946ad31eba7d ]---
--- drivers/gpio/gpio-crystalcove.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-crystalcove.c +1 -1
@@ -272,7 +272,7 @@ static irqreturn_t crystalcove_gpio_irq_for (gpio =0 ; gpio <CRYSTALCOVE_GPIO_NUM ; gpio++) {if (pending &BIT (gpio)) { virq =irq_find_mapping (cg->chip.irqdomain, gpio); -generic_handle_irq (virq); +handle_nested_irq (virq); } }
Greg Kroah-Hartman
maintainerPATCH 135/183 gpio: fix memory and reference leaks in gpiochip_add error path
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 5539b3c938d64a60cb1fc442ac3ce9263d52de0c upstream.
Memory allocated and references taken by of_gpiochip_add and acpi_gpiochip_add were never released on errors in gpiochip_add (e.g. failure to find free gpio range).
has a node pointer")
automatically")
--- drivers/gpio/gpiolib.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/gpio/gpiolib.c +7 -4
@@ -268,6 +268,9 @@ int gpiochip_add(struct gpio_chip *chip)spin_unlock_irqrestore (&gpio_lock, flags); +if (status) + goto fail; +#ifdef CONFIG_PINCTRL INIT_LIST_HEAD (&chip->pin_ranges);#endif
@@ -275,12 +278,12 @@ int gpiochip_add(struct gpio_chip *chip)of_gpiochip_add (chip);acpi_gpiochip_add (chip); -if (status) - goto fail; - status =gpiochip_export (chip); -if (status) +if (status) { +acpi_gpiochip_remove (chip); +of_gpiochip_remove (chip); goto fail; + } pr_debug("%s: registered GPIOs %d to %d on device: %s\n", __func__, chip->base, chip->base + chip->ngpio - 1,
Greg Kroah-Hartman
maintainerPATCH 136/183 gpio: fix memory leak and sleep-while-atomic
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 00acc3dc248063f982cfacfbe5e78c0d6797ffef upstream.
Fix memory leak and sleep-while-atomic in gpiochip_remove.
The memory leak was introduced by afa82fab5e13 ("gpio / ACPI: Move event handling registration to gpiolib irqchip helpers") that moved the release of acpi interrupt resources to gpiochip_irqchip_remove, but by then the resources are no longer accessible as the acpi_gpio_chip has already been freed by acpi_gpiochip_remove.
Note that this also fixes a few potential sleep-while-atomics, which has been around since 1425052097b5 ("gpio: add IRQ chip helpers in gpiolib") when the call to gpiochip_irqchip_remove while holding a spinlock was added (a couple of irq-domain paths can end up grabbing mutexes).
gpiolib irqchip helpers")
--- drivers/gpio/gpiolib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpiolib.c +2 -1
@@ -316,11 +316,12 @@ void gpiochip_remove(struct gpio_chip *cunsigned long flags;unsigned id; +gpiochip_irqchip_remove (chip); +acpi_gpiochip_remove (chip);spin_lock_irqsave (&gpio_lock, flags); -gpiochip_irqchip_remove (chip);gpiochip_remove_pin_ranges (chip);of_gpiochip_remove (chip);
Greg Kroah-Hartman
maintainerPATCH 137/183 gpio: fix sleep-while-atomic in gpiochip_remove
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 6798acaa0138d8b12f1c54402ebcb66fea3deb03 upstream.
Move direct and indirect calls to gpiochip_remove_pin_ranges outside of spin lock as they can end up taking a mutex in pinctrl_remove_gpio_range.
Note that the pin ranges are already added outside of the lock.
--- drivers/gpio/gpiolib.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpiolib.c +1 -3
@@ -319,12 +319,10 @@ void gpiochip_remove(struct gpio_chip *cgpiochip_irqchip_remove (chip);acpi_gpiochip_remove (chip); - -spin_lock_irqsave (&gpio_lock, flags); -gpiochip_remove_pin_ranges (chip);of_gpiochip_remove (chip); +spin_lock_irqsave (&gpio_lock, flags);for (id =0 ; id < chip->ngpio; id++) {if (test_bit (FLAG_REQUESTED , &chip->desc[id].flags))dev_crit (chip->dev,"REMOVING GPIOCHIP WITH GPIOS STILL REQUESTED\n" );
Greg Kroah-Hartman
maintainerPATCH 138/183 gpio: sysfs: fix gpio-chip device-attribute leak
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 121b6a79955a3a3fd7bbb9b8cb88d5b9dad6283d upstream.
The gpio-chip device attributes were never destroyed when the device was removed.
Fix by using device_create_with_groups() to create the device attributes of the chip class device.
Note that this also fixes the attribute-creation race with userspace.
--- drivers/gpio/gpiolib-sysfs.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
drivers/gpio/gpiolib-sysfs.c +8 -11
@@ -400,16 +400,13 @@ static ssize_t chip_ngpio_show(struct de } static DEVICE_ATTR(ngpio, 0444, chip_ngpio_show, NULL); -static const struct attribute *gpiochip_attrs[] = { +static struct attribute *gpiochip_attrs[] = { &dev_attr_base.attr, &dev_attr_label.attr, &dev_attr_ngpio.attr,NULL , }; - -static const struct attribute_group gpiochip_attr_group = { - .attrs = (struct attribute **) gpiochip_attrs, -}; +ATTRIBUTE_GROUPS (gpiochip);/* * /sys/class/gpio/export ... write-only
@@ -750,13 +747,13 @@ int gpiochip_export(struct gpio_chip *ch/* use chip->base for the ID; it's already known to be unique */ mutex_lock (&sysfs_lock); - dev =device_create (&gpio_class, chip->dev,MKDEV (0 ,0 ), chip, -"gpiochip%d" , chip->base); -if (!IS_ERR (dev)) { - status =sysfs_create_group (&dev->kobj, - &gpiochip_attr_group); - }else + dev =device_create_with_groups (&gpio_class, chip->dev,MKDEV (0 ,0 ), + chip, gpiochip_groups, +"gpiochip%d" , chip->base); +if (IS_ERR (dev)) status =PTR_ERR (dev); +else + status =0 ; chip->exported = (status ==0 );mutex_unlock (&sysfs_lock);
Greg Kroah-Hartman
maintainerPATCH 139/183 gpio: sysfs: fix gpio device-attribute leak
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 0915e6feb38de8d3601819992a5bd050201a56fa upstream.
The gpio device attributes were never destroyed when the gpio was unexported (or on export failures).
Use device_create_with_groups() to create the default device attributes of the gpio class device. Note that this also fixes the attribute-creation race with userspace for these attributes.
Remove contingent attributes in export error path and on unexport.
--- drivers/gpio/gpiolib-sysfs.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-)
drivers/gpio/gpiolib-sysfs.c +13 -15
@@ -128,7 +128,7 @@ static ssize_t gpio_value_store(struct dreturn status; } -static const DEVICE_ATTR(value, 0644, +static DEVICE_ATTR(value, 0644, gpio_value_show, gpio_value_store);static irqreturn_t gpio_sysfs_irq (int irq,void *priv)
@@ -353,18 +353,15 @@ static ssize_t gpio_active_low_store(strreturn status ? : size; } -static const DEVICE_ATTR(active_low, 0644, +static DEVICE_ATTR(active_low, 0644, gpio_active_low_show, gpio_active_low_store); -static const struct attribute *gpio_attrs[] = { +static struct attribute *gpio_attrs[] = { &dev_attr_value.attr, &dev_attr_active_low.attr,NULL , }; - -static const struct attribute_group gpio_attr_group = { - .attrs = (struct attribute **) gpio_attrs, -}; +ATTRIBUTE_GROUPS (gpio);/* * /sys/class/gpio/gpiochipN/
@@ -561,18 +558,15 @@ int gpiod_export(struct gpio_desc *desc,if (desc->chip->names && desc->chip->names[offset]) ioname = desc->chip->names[offset]; - dev =device_create (&gpio_class, desc->chip->dev,MKDEV (0 ,0 ), - desc, ioname ? ioname :"gpio%u" , -desc_to_gpio (desc)); + dev =device_create_with_groups (&gpio_class, desc->chip->dev, +MKDEV (0 ,0 ), desc, gpio_groups, + ioname ? ioname :"gpio%u" , +desc_to_gpio (desc));if (IS_ERR (dev)) { status =PTR_ERR (dev); goto fail_unlock; } - status =sysfs_create_group (&dev->kobj, &gpio_attr_group); -if (status) - goto fail_unregister_device; -if (direction_may_change) { status =device_create_file (dev, &dev_attr_direction);if (status)
@@ -583,13 +577,15 @@ int gpiod_export(struct gpio_desc *desc, !test_bit(FLAG_IS_OUT, &desc->flags))) { status =device_create_file (dev, &dev_attr_edge);if (status) - goto fail_unregister_device; + goto fail_remove_attr_direction; }set_bit (FLAG_EXPORT , &desc->flags);mutex_unlock (&sysfs_lock);return 0 ; +fail_remove_attr_direction: +device_remove_file (dev, &dev_attr_direction); fail_unregister_device:device_unregister (dev); fail_unlock:
@@ -723,6 +719,8 @@ void gpiod_unexport(struct gpio_desc *demutex_unlock (&sysfs_lock);if (dev) { +device_remove_file (dev, &dev_attr_edge); +device_remove_file (dev, &dev_attr_direction);device_unregister (dev);put_device (dev); }
Greg Kroah-Hartman
maintainerPATCH 140/183 OHCI: add a quirk for ULi M5237 blocking on reset
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arseny Solokha <[email protected]>
commit 56abcab833fafcfaeb2f5b25e0364c1dec45f53e upstream.
Commit 8dccddbc2368 ("OHCI: final fix for NVIDIA problems (I hope)") introduced into 3.1.9 broke boot on e.g. Freescale P2020DS development board. The code path that was previously specific to NVIDIA controllers had then become taken for all chips.
However, the M5237 installed on the board wedges solid when accessing its base+OHCI_FMINTERVAL register, making it impossible to boot any kernel newer than 3.1.8 on this particular and apparently other similar machines.
Don't readl() and writel() base+OHCI_FMINTERVAL on PCI ID 10b9:5237.
The patch is suitable for the -next tree as well as all maintained kernels up to 3.2 inclusive.
--- drivers/usb/host/pci-quirks.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/usb/host/pci-quirks.c +15 -3
@@ -571,7 +571,8 @@ static void quirk_usb_handoff_ohci(struc {void __iomem *base;u32 control; -u32 fminterval; +u32 fminterval =0 ; +bool no_fminterval = false;int cnt;if (!mmio_resource_enabled (pdev,0 ))
@@ -581,6 +582,13 @@ static void quirk_usb_handoff_ohci(strucif (base ==NULL )return ; +/* +* ULi M5237 OHCI controller locks the whole system when accessing +* the OHCI_FMINTERVAL offset. +*/ +if (pdev->vendor ==PCI_VENDOR_ID_AL && pdev->device ==0x5237 ) + no_fminterval = true; + control =readl (base +OHCI_CONTROL );/* On PA-RISC, PDC can leave IR set incorrectly; ignore it there. */
@@ -619,7 +627,9 @@ static void quirk_usb_handoff_ohci(struc }/* software reset of the controller, preserving HcFmInterval */ - fminterval =readl (base +OHCI_FMINTERVAL ); +if (!no_fminterval) + fminterval =readl (base +OHCI_FMINTERVAL ); +writel (OHCI_HCR , base +OHCI_CMDSTATUS );/* reset requires max 10 us delay */
@@ -628,7 +638,9 @@ static void quirk_usb_handoff_ohci(strucbreak ;udelay (1 ); } -writel (fminterval, base +OHCI_FMINTERVAL ); + +if (!no_fminterval) +writel (fminterval, base +OHCI_FMINTERVAL );/* Now the controller is safely in SUSPEND and nothing can wake it up */ iounmap (base);
Greg Kroah-Hartman
maintainerPATCH 141/183 usb: dwc3: gadget: Fix TRB preparation during SG
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amit Virdi <[email protected]>
commit ec512fb8e5611fed1df2895f90317ce6797d6b32 upstream.
When scatter gather (SG) is used, multiple TRBs are prepared from one DWC3 request (dwc3_request). So while preparing TRBs, the 'last' flag should be set only when it is the last TRB being prepared from the last dwc3_request entry.
The current implementation uses list_is_last to check if the dwc3_request is the last entry from the request_list. However, list_is_last returns false for the last entry too. This is because, while preparing the first TRB from a request, the function dwc3_prepare_one_trb modifies the request's next and prev pointers while moving the URB to req_queued. Hence, list_is_last always returns false no matter what.
The correct way is not to access the modified pointers of dwc3_request but to use list_empty macro instead.
--- drivers/usb/dwc3/gadget.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/dwc3/gadget.c +1 -2
@@ -882,8 +882,7 @@ static void dwc3_prepare_trbs(struct dwcif (i == (request->num_mapped_sgs -1 ) ||sg_is_last (s)) { -if (list_is_last (&req->list, - &dep->request_list)) +if (list_empty (&dep->request_list)) last_one = true; chain = false; }
Greg Kroah-Hartman
maintainerPATCH 142/183 usb: dwc3: gadget: Stop TRB preparation after limit is reached
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amit Virdi <[email protected]>
commit 39e60635a01520e8c8ed3946a28c2b98e6a46f79 upstream.
DWC3 gadget sets up a pool of 32 TRBs for each EP during initialization. This means, the max TRBs that can be submitted for an EP is fixed to 32. Since the request queue for an EP is a linked list, any number of requests can be queued to it by the gadget layer. However, the dwc3 driver must not submit TRBs more than the pool it has created for. This limit wasn't respected when SG was used resulting in submitting more than the max TRBs, eventually leading to non-transfer of the TRBs submitted over the max limit.
Root cause:
When SG is used, there are two loops iterating to prepare TRBs:
- Outer loop over the request_list
- Inner loop over the SG list
The code was missing break to get out of the outer loop.
--- drivers/usb/dwc3/gadget.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/dwc3/gadget.c +3 -0
@@ -900,6 +900,9 @@ static void dwc3_prepare_trbs(struct dwcif (last_one)break ; } + +if (last_one) +break ; }else { dma = req->request.dma; length = req->request.length;
Greg Kroah-Hartman
maintainerPATCH 143/183 USB: cp210x: fix ID for production CEL MeshConnect USB Stick
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Preston Fick <[email protected]>
commit 90441b4dbe90ba0c38111ea89fa093a8c9627801 upstream.
Fixing typo for MeshConnect IDs. The original PID (0x8875) is not in production and is not needed. Instead it has been changed to the official production PID (0x8857).
--- drivers/usb/serial/cp210x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/serial/cp210x.c +1 -1
@@ -120,7 +120,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */ { USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */ { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */ - { USB_DEVICE(0x10C4, 0x8875) }, /* CEL MeshConnect USB Stick */ + { USB_DEVICE(0x10C4, 0x8857) }, /* CEL MeshConnect USB Stick */ { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */
Greg Kroah-Hartman
maintainerPATCH 144/183 USB: cp210x: add IDs for CEL USB sticks and MeshWorks devices
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Peterson <[email protected]>
commit 1ae78a4870989a354028cb17dabf819b595e70e3 upstream.
Added virtual com port VID/PID entries for CEL USB sticks and MeshWorks devices.
--- drivers/usb/serial/cp210x.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/serial/cp210x.c +3 -1
@@ -120,10 +120,12 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */ { USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */ { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */ - { USB_DEVICE(0x10C4, 0x8857) }, /* CEL MeshConnect USB Stick */ + { USB_DEVICE(0x10C4, 0x8856) }, /* CEL EM357 ZigBee USB Stick - LR */ + { USB_DEVICE(0x10C4, 0x8857) }, /* CEL EM357 ZigBee USB Stick */ { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ + { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */ { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */
Greg Kroah-Hartman
maintainerPATCH 145/183 USB: qcserial/option: make AT URCs work for Sierra Wireless MC73xx
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Reinhard Speyerer <[email protected]>
commit d80c0d14183516f184a5ac88e11008ee4c7d2a2e upstream.
As has been discussed in the thread starting with
https://lkml.kernel.org/g/[email protected]
Sierra Wireless MC73xx devices with USB VID/PID 0x1199:0x68c0 require the option_send_setup() code to be used on the USB interface for the AT port to make unsolicited response codes work correctly. Move these devices from the qcserial driver where they have been added by commit 70a3615fc07c2330ed7c1e922f3c44f4a67c0762 ("usb: qcserial: add Sierra Wireless MC73xx") to the option driver and add a MC73xx-specific blacklist to ensure that
1. the sendsetup code is not used for the DIAG/DM and NMEA interfaces
2. the option driver does not attach to the QMI/network interfaces
--- drivers/usb/serial/option.c | 11 ++++++++++- drivers/usb/serial/qcserial.c | 1 - 2 files changed, 10 insertions(+), 2 deletions(-)
drivers/usb/serial/option.c +10 -1
@@ -234,6 +234,8 @@ static void option_instat_callback(struc#define QUALCOMM_VENDOR_ID 0x05C6 +#define SIERRA_VENDOR_ID 0x1199 +#define CMOTECH_VENDOR_ID 0x16d8#define CMOTECH_PRODUCT_6001 0x6001#define CMOTECH_PRODUCT_CMU_300 0x6002
@@ -512,7 +514,7 @@ enum option_blacklist_reason {OPTION_BLACKLIST_RESERVED_IF =2 }; -#define MAX_BL_NUM 8 +#define MAX_BL_NUM 11struct option_blacklist_info {/* bitfield of interface numbers for OPTION_BLACKLIST_SENDSETUP */ const unsigned long sendsetup;
@@ -601,6 +603,11 @@ static const struct option_blacklist_inf .reserved = BIT(1) | BIT(5), }; +static const struct option_blacklist_info sierra_mc73xx_blacklist = { + .sendsetup =BIT (0 ) |BIT (2 ), + .reserved =BIT (8 ) |BIT (10 ) |BIT (11 ), +}; +static const struct usb_device_id option_ids[] = { {USB_DEVICE (OPTION_VENDOR_ID ,OPTION_PRODUCT_COLT ) }, {USB_DEVICE (OPTION_VENDOR_ID ,OPTION_PRODUCT_RICOLA ) },
@@ -1098,6 +1105,8 @@ static const struct usb_device_id option { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ + { USB_DEVICE_INTERFACE_CLASS(SIERRA_VENDOR_ID, 0x68c0, 0xff), + .driver_info = (kernel_ulong_t)&sierra_mc73xx_blacklist }, /* MC73xx */ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003),
drivers/usb/serial/qcserial.c +0 -1
@@ -142,7 +142,6 @@ static const struct usb_device_id id_tab {DEVICE_SWI(0x0f3d, 0x68a2)}, /* Sierra Wireless MC7700 */ {DEVICE_SWI(0x114f, 0x68a2)}, /* Sierra Wireless MC7750 */ {DEVICE_SWI(0x1199, 0x68a2)}, /* Sierra Wireless MC7710 */ - {DEVICE_SWI(0x1199, 0x68c0)}, /* Sierra Wireless MC73xx */ {DEVICE_SWI(0x1199, 0x901c)}, /* Sierra Wireless EM7700 */ {DEVICE_SWI(0x1199, 0x901f)}, /* Sierra Wireless EM7355 */ {DEVICE_SWI(0x1199, 0x9040)}, /* Sierra Wireless Modem */
Greg Kroah-Hartman
maintainerPATCH 146/183 USB: keyspan: fix null-deref at probe
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit b5122236bba8d7ef62153da5b55cc65d0944c61e upstream.
Fix null-pointer dereference during probe if the interface-status completion handler is called before the individual ports have been set up.
memory leaks")
--- drivers/usb/serial/keyspan.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/usb/serial/keyspan.c +15 -5
@@ -410,6 +410,8 @@ static void usa26_instat_callback(struct } port = serial->port[msg->port]; p_priv =usb_get_serial_port_data (port); +if (!p_priv) + goto resubmit;/* Update handshaking pin state information */ old_dcd_state = p_priv->dcd_state;
@@ -420,7 +422,7 @@ static void usa26_instat_callback(structif (old_dcd_state != p_priv->dcd_state)tty_port_tty_hangup (&port->port, true); - +resubmit:/* Resubmit urb so we continue receiving */ err =usb_submit_urb (urb,GFP_ATOMIC );if (err !=0 )
@@ -527,6 +529,8 @@ static void usa28_instat_callback(struct } port = serial->port[msg->port]; p_priv =usb_get_serial_port_data (port); +if (!p_priv) + goto resubmit;/* Update handshaking pin state information */ old_dcd_state = p_priv->dcd_state;
@@ -537,7 +541,7 @@ static void usa28_instat_callback(structif (old_dcd_state != p_priv->dcd_state && old_dcd_state)tty_port_tty_hangup (&port->port, true); - +resubmit:/* Resubmit urb so we continue receiving */ err =usb_submit_urb (urb,GFP_ATOMIC );if (err !=0 )
@@ -607,6 +611,8 @@ static void usa49_instat_callback(struct } port = serial->port[msg->portNumber]; p_priv =usb_get_serial_port_data (port); +if (!p_priv) + goto resubmit;/* Update handshaking pin state information */ old_dcd_state = p_priv->dcd_state;
@@ -617,7 +623,7 @@ static void usa49_instat_callback(structif (old_dcd_state != p_priv->dcd_state && old_dcd_state)tty_port_tty_hangup (&port->port, true); - +resubmit:/* Resubmit urb so we continue receiving */ err =usb_submit_urb (urb,GFP_ATOMIC );if (err !=0 )
@@ -855,6 +861,8 @@ static void usa90_instat_callback(struct port = serial->port[0 ]; p_priv =usb_get_serial_port_data (port); +if (!p_priv) + goto resubmit;/* Update handshaking pin state information */ old_dcd_state = p_priv->dcd_state;
@@ -865,7 +873,7 @@ static void usa90_instat_callback(structif (old_dcd_state != p_priv->dcd_state && old_dcd_state)tty_port_tty_hangup (&port->port, true); - +resubmit:/* Resubmit urb so we continue receiving */ err =usb_submit_urb (urb,GFP_ATOMIC );if (err !=0 )
@@ -926,6 +934,8 @@ static void usa67_instat_callback(struct port = serial->port[msg->port]; p_priv =usb_get_serial_port_data (port); +if (!p_priv) + goto resubmit;/* Update handshaking pin state information */ old_dcd_state = p_priv->dcd_state;
@@ -934,7 +944,7 @@ static void usa67_instat_callback(structif (old_dcd_state != p_priv->dcd_state && old_dcd_state)tty_port_tty_hangup (&port->port, true); - +resubmit:/* Resubmit urb so we continue receiving */ err =usb_submit_urb (urb,GFP_ATOMIC );if (err !=0 )
Greg Kroah-Hartman
maintainerPATCH 147/183 usb: gadget: gadgetfs: Free memory allocated by memdup_user()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Schuknecht <[email protected]>
commit b44be2462dbe3e23f0aedff64de52a1e8e47a1cd upstream.
Commit 3b74c73f8d6f053f422e85fce955b61fb181cfe7 switched over to memdup_user() in ep_write() function and removed kfree (kbuf).memdup_user() function allocates memory which is never freed.
--- drivers/usb/gadget/legacy/inode.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/gadget/legacy/inode.c +1 -0
@@ -449,6 +449,7 @@ ep_write (struct file *fd, const char __ data->name, len, (int) value); free1:mutex_unlock (&data->lock); +kfree (kbuf);return value; }
Greg Kroah-Hartman
maintainerPATCH 148/183 usb: gadget: udc: atmel: change setting for DMA
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bo Shen <[email protected]>
commit f40afdddeb6c54ffd1e2920a5e93e363d6748db6 upstream.
According to the datasheet, when transfer using DMA, the control setting for IN packet only need END_BUF_EN, END_BUF_IE, CH_EN, while for OUT packet, need more two bits END_TR_EN and END_TR_IE to be configured.
--- drivers/usb/gadget/udc/atmel_usba_udc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/gadget/udc/atmel_usba_udc.c +3 -3
@@ -716,10 +716,10 @@ static int queue_dma(struct usba_udc *ud req->using_dma =1 ; req->ctrl =USBA_BF (DMA_BUF_LEN , req->req.length) |USBA_DMA_CH_EN |USBA_DMA_END_BUF_IE - |USBA_DMA_END_TR_EN |USBA_DMA_END_TR_IE ; + |USBA_DMA_END_BUF_EN ; -if (ep->is_in) - req->ctrl |=USBA_DMA_END_BUF_EN ; +if (!ep->is_in) + req->ctrl |=USBA_DMA_END_TR_EN |USBA_DMA_END_TR_IE ;/* * Add this request to the queue and submit for DMA if
Greg Kroah-Hartman
maintainerPATCH 149/183 usb: gadget: udc: atmel: fix possible IN hang issue
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bo Shen <[email protected]>
commit 6785a1034461c2d2c205215f63a50a740896e55b upstream.
When receive data, the RXRDY in status register set by hardware after a new packet has been stored in the endpoint FIFO. When it is copied from FIFO, this bit is cleared which make the FIFO can be accessed again.
In the receive_data() function, this bit RXRDY has been cleared. So, after the receive_data() function return, this bit should not be cleared again, or else it may cause the accessing FIFO corrupt, which will make the data loss.
--- drivers/usb/gadget/udc/atmel_usba_udc.c | 1 - 1 file changed, 1 deletion(-)
drivers/usb/gadget/udc/atmel_usba_udc.c +0 -1
@@ -1572,7 +1572,6 @@ static void usba_ep_irq(struct usba_udcif ((epstatus & epctrl) &USBA_RX_BK_RDY ) {DBG (DBG_BUS ,"%s: RX data ready\n" , ep->ep.name);receive_data (ep); -usba_ep_writel (ep,CLR_STA ,USBA_RX_BK_RDY ); } }
Greg Kroah-Hartman
maintainerPATCH 150/183 usb: gadget: udc: atmel: fix possible oops when unloading module
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Songjun Wu <[email protected]>
commit 5fb694f96e7c19e66b1c55124b98812e32e3efa5 upstream.
When unloading the module 'g_hid.ko', the urb request will be dequeued and the completion routine will be excuted. If there is no urb packet, the urb request will not be added to the endpoint queue and the completion routine pointer in urb request is NULL.
Accessing to this NULL function pointer will cause the Oops issue reported below.
Add the code to check if the urb request is in the endpoint queue or not. If the urb request is not in the endpoint queue, a negative error code will be returned.
Here is the Oops log:
Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = dedf0000 [00000000] *pgd=3ede5831, *pte=00000000, *ppte=00000000 Internal error: Oops: 80000007 [#1] ARM Modules linked in: g_hid(-) usb_f_hid libcomposite CPU: 0 PID: 923 Comm: rmmod Not tainted 3.18.0+ #2 Hardware name: Atmel SAMA5 (Device Tree) task: df6b1100 ti: dedf6000 task.ti: dedf6000 PC is at 0x0 LR is at usb_gadget_giveback_request+0xc/0x10 pc : [<00000000>] lr : [<c02ace88>] psr: 60000093
sp : dedf7eb0 ip : df572634 fp : 00000000
r10: 00000000 r9 : df52e210 r8 : 60000013
r7 : df6a9858 r6 : df52e210 r5 : df6a9858 r4 : df572600 r3 : 00000000 r2 : ffffff98 r1 : df572600 r0 : df6a9868
Flags: nZCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment user
Control: 10c53c7d Table: 3edf0059 DAC: 00000015 Process rmmod (pid: 923, stack limit = 0xdedf6230)
Stack: (0xdedf7eb0 to 0xdedf8000)
7ea0: 00000000 c02adbbc df572580 deced608
7ec0: df572600 df6a9868 df572634 c02aed3c df577c00 c01b8608 00000000 df6be27c
7ee0: 00200200 00100100 bf0162f4 c000e544 dedf6000 00000000 00000000 bf010c00
7f00: bf0162cc bf00159c 00000000 df572980 df52e218 00000001 df5729b8 bf0031d0
[..]
[<c02ace88>] (usb_gadget_giveback_request) from [<c02adbbc>] (request_complete+0x64/0x88) [<c02adbbc>] (request_complete) from [<c02aed3c>] (usba_ep_dequeue+0x70/0x128)
[<c02aed3c>] (usba_ep_dequeue) from [<bf010c00>] (hidg_unbind+0x50/0x7c [usb_f_hid]) [<bf010c00>] (hidg_unbind [usb_f_hid]) from [<bf00159c>] (remove_config.isra.6+0x98/0x9c [libcomposite]) [<bf00159c>] (remove_config.isra.6 [libcomposite]) from [<bf0031d0>] (__composite_unbind+0x34/0x98 [libcomposite]) [<bf0031d0>] (__composite_unbind [libcomposite]) from [<c02acee0>] (usb_gadget_remove_driver+0x50/0x78) [<c02acee0>] (usb_gadget_remove_driver) from [<c02ad570>] (usb_gadget_unregister_driver+0x64/0x94) [<c02ad570>] (usb_gadget_unregister_driver) from [<bf0160c0>] (hidg_cleanup+0x10/0x34 [g_hid]) [<bf0160c0>] (hidg_cleanup [g_hid]) from [<c0056748>] (SyS_delete_module+0x118/0x19c) [<c0056748>] (SyS_delete_module) from [<c000e3c0>] (ret_fast_syscall+0x0/0x30)
Code: bad PC value
--- drivers/usb/gadget/udc/atmel_usba_udc.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/usb/gadget/udc/atmel_usba_udc.c +11 -1
@@ -828,7 +828,7 @@ static int usba_ep_dequeue(struct usb_ep {struct usba_ep *ep =to_usba_ep (_ep);struct usba_udc *udc = ep->udc; -struct usba_request *req =to_usba_req (_req); +struct usba_request *req;unsigned long flags;u32 status;
@@ -837,6 +837,16 @@ static int usba_ep_dequeue(struct usb_epspin_lock_irqsave (&udc->lock, flags); +list_for_each_entry (req, &ep->queue, queue) { +if (&req->req == _req) +break ; + } + +if (&req->req != _req) { +spin_unlock_irqrestore (&udc->lock, flags); +return -EINVAL ; + } +if (req->using_dma) {/* * If this request is currently being transferred,
Greg Kroah-Hartman
maintainerPATCH 151/183 USB: console: fix uninitialised ldisc semaphore
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit d269d4434c72ed0da3a9b1230c30da82c4918c63 upstream.
The USB console currently allocates a temporary fake tty which is used to pass terminal settings to the underlying serial driver.
The tty struct is not fully initialised, something which can lead to a lockdep warning (or worse) if a serial driver tries to acquire a line-discipline reference:
usbserial: USB Serial support registered for pl2303 pl2303 1-2.1:1.0: pl2303 converter detected usb 1-2.1: pl2303 converter now attached to ttyUSB0 INFO: trying to register non-static key. the code is fine but needs lockdep annotation. turning off the locking correctness validator. CPU: 0 PID: 68 Comm: udevd Tainted: G W 3.18.0-rc5 #10 [<c0016f04>] (unwind_backtrace) from [<c0013978>] (show_stack+0x20/0x24) [<c0013978>] (show_stack) from [<c0449794>] (dump_stack+0x24/0x28) [<c0449794>] (dump_stack) from [<c006f730>] (__lock_acquire+0x1e50/0x2004) [<c006f730>] (__lock_acquire) from [<c0070128>] (lock_acquire+0xe4/0x18c) [<c0070128>] (lock_acquire) from [<c027c6f8>] (ldsem_down_read_trylock+0x78/0x90) [<c027c6f8>] (ldsem_down_read_trylock) from [<c027a1cc>] (tty_ldisc_ref+0x24/0x58) [<c027a1cc>] (tty_ldisc_ref) from [<c0340760>] (usb_serial_handle_dcd_change+0x48/0xe8) [<c0340760>] (usb_serial_handle_dcd_change) from [<bf000484>] (pl2303_read_int_callback+0x210/0x220 [pl2303]) [<bf000484>] (pl2303_read_int_callback [pl2303]) from [<c031624c>] (__usb_hcd_giveback_urb+0x80/0x140) [<c031624c>] (__usb_hcd_giveback_urb) from [<c0316fc0>] (usb_giveback_urb_bh+0x98/0xd4) [<c0316fc0>] (usb_giveback_urb_bh) from [<c0042e44>] (tasklet_hi_action+0x9c/0x108) [<c0042e44>] (tasklet_hi_action) from [<c0042380>] (__do_softirq+0x148/0x42c) [<c0042380>] (__do_softirq) from [<c00429cc>] (irq_exit+0xd8/0x114) [<c00429cc>] (irq_exit) from [<c007ae58>] (__handle_domain_irq+0x84/0xdc) [<c007ae58>] (__handle_domain_irq) from [<c000879c>] (omap_intc_handle_irq+0xd8/0xe0) [<c000879c>] (omap_intc_handle_irq) from [<c0014544>] (__irq_svc+0x44/0x7c) Exception stack(0xdf4e7f08 to 0xdf4e7f50) 7f00: debc0b80 df4e7f5c 00000000 00000000 debc0b80 be8da96c 7f20: 00000000 00000128 c000fc84 df4e6000 00000000 df4e7f94 00000004 df4e7f50 7f40: c038ebc0 c038d74c 600f0013 ffffffff [<c0014544>] (__irq_svc) from [<c038d74c>] (___sys_sendmsg.part.29+0x0/0x2e0) [<c038d74c>] (___sys_sendmsg.part.29) from [<c038ec08>] (SyS_sendmsg+0x18/0x1c) [<c038ec08>] (SyS_sendmsg) from [<c000fa00>] (ret_fast_syscall+0x0/0x48) console [ttyUSB0] enabled
--- drivers/usb/serial/console.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/console.c +1 -0
@@ -140,6 +140,7 @@ static int usb_console_setup(struct constty_port_tty_set (&port->port, tty); tty->driver = usb_serial_tty_driver; tty->index = co->index; +init_ldsem (&tty->ldisc_sem);if (tty_init_termios (tty)) { retval = -ENOMEM ; goto free_tty;
Greg Kroah-Hartman
maintainerPATCH 152/183 USB: console: fix potential use after free
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 32a4bf2e81ec378e5925d4e069e0677a6c86a6ad upstream.
Use tty kref to release the fake tty in usb_console_setup to avoid use after free if the underlying serial driver has acquired a reference.
Note that using the tty destructor release_one_tty requires some more state to be initialised.
--- drivers/usb/serial/console.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/usb/serial/console.c +10 -5
@@ -46,6 +46,8 @@ static struct console usbcons;* ------------------------------------------------------------ */ +static const struct tty_operations usb_console_fake_tty_ops = { +};/* * The parsing of the command line works exactly like the
@@ -137,14 +139,17 @@ static int usb_console_setup(struct cons goto reset_open_count; }kref_init (&tty->kref); -tty_port_tty_set (&port->port, tty); tty->driver = usb_serial_tty_driver; tty->index = co->index;init_ldsem (&tty->ldisc_sem); +INIT_LIST_HEAD (&tty->tty_files); +kref_get (&tty->driver->kref); + tty->ops = &usb_console_fake_tty_ops;if (tty_init_termios (tty)) { retval = -ENOMEM ; - goto free_tty; + goto put_tty; } +tty_port_tty_set (&port->port, tty); }/* only call the device specific open if this
@@ -162,7 +167,7 @@ static int usb_console_setup(struct cons serial->type->set_termios (tty, port, &dummy);tty_port_tty_set (&port->port,NULL ); -kfree (tty); +tty_kref_put (tty); }set_bit (ASYNCB_INITIALIZED , &port->port.flags); }
@@ -178,8 +183,8 @@ static int usb_console_setup(struct cons fail:tty_port_tty_set (&port->port,NULL ); - free_tty: -kfree (tty); + put_tty: +tty_kref_put (tty); reset_open_count: port->port.count =0 ;usb_autopm_put_interface (serial->interface);
Greg Kroah-Hartman
maintainerPATCH 153/183 USB: EHCI: fix initialization bug in iso_stream_schedule()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 6d89252a998a695ecb0348fc2d717dc33d90cae9 upstream.
Commit c3ee9b76aa93 (EHCI: improved logic for isochronous scheduling) introduced the idea of using ehci->last_iso_frame as the origin (or base) for the circular calculations involved in modifying the isochronous schedule. However, the new code it added used ehci->last_iso_frame before the value was properly initialized. This patch rectifies the mistake by moving the initialization lines earlier in iso_stream_schedule().
This fixes Bugzilla #72891.
--- drivers/usb/host/ehci-sched.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/host/ehci-sched.c +4 -4
@@ -1581,6 +1581,10 @@ iso_stream_schedule (else next = (now +2 +7 ) & ~0x07 ;/* full frame cache */ +/* If needed, initialize last_iso_frame so that this URB will be seen */ +if (ehci->isoc_count ==0 ) + ehci->last_iso_frame = now >>3 ; +/* * Use ehci->last_iso_frame as the base. There can't be any * TDs scheduled for earlier than that.
@@ -1671,10 +1675,6 @@ iso_stream_schedule ( urb->start_frame = start & (mod -1 );if (!stream->highspeed) urb->start_frame >>=3 ; - -/* Make sure scan_isoc() sees these */ -if (ehci->isoc_count ==0 ) - ehci->last_iso_frame = now >>3 ;return status; fail:
Greg Kroah-Hartman
maintainerPATCH 154/183 usb: musb: stuff leak of struct usb_hcd
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
commit 68693b8ea4e284c46bff919ac62bd9ccdfdbb6ba upstream.
since the split of host+gadget mode in commit 74c2e9360058 ("usb: musb:
factor out hcd initalization") we leak the usb_hcd struct. We call now musb_host_cleanup() which does basically usb_remove_hcd() and also sets the hcd variable to NULL. Doing so makes the finall call to musb_host_free() basically a nop and the usb_hcd remains around for ever without anowner.
This patch drops that NULL assignment for that reason.
--- drivers/usb/musb/musb_host.c | 1 - 1 file changed, 1 deletion(-)
drivers/usb/musb/musb_host.c +0 -1
@@ -2663,7 +2663,6 @@ void musb_host_cleanup(struct musb *musbif (musb->port_mode ==MUSB_PORT_MODE_GADGET )return ;usb_remove_hcd (musb->hcd); - musb->hcd =NULL ; }void musb_host_free (struct musb *musb)
Greg Kroah-Hartman
maintainerPATCH 155/183 can: kvaser_usb: Dont free packets when tight on URBs
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Ahmed S. Darwish" <[email protected]>
commit b442723fcec445fb0ae1104888dd22cd285e0a91 upstream.
Flooding the Kvaser CAN to USB dongle with multiple reads and writes in high frequency caused seemingly-random panics in the kernel.
On further inspection, it seems the driver erroneously freed the to-be-transmitted packet upon getting tight on URBs and returning NETDEV_TX_BUSY, leading to invalid memory writes and double frees at a later point in time.
Note:
Finding no more URBs/transmit-contexts and returning NETDEV_TX_BUSY is a driver bug in and out of itself: it means that our start/stop queue flow control is broken.
This patch only fixes the (buggy) error handling code; the root cause shall be fixed in a later commit.
--- drivers/net/can/usb/kvaser_usb.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/net/can/usb/kvaser_usb.c +4 -6
@@ -1294,12 +1294,14 @@ static netdev_tx_t kvaser_usb_start_xmitif (!urb) {netdev_err (netdev,"No memory left for URBs\n" ); stats->tx_dropped++; - goto nourbmem; +dev_kfree_skb (skb); +return NETDEV_TX_OK ; } buf =kmalloc (sizeof (struct kvaser_msg ),GFP_ATOMIC );if (!buf) { stats->tx_dropped++; +dev_kfree_skb (skb); goto nobufmem; }
@@ -1334,6 +1336,7 @@ static netdev_tx_t kvaser_usb_start_xmit } } +/* This should never happen; it implies a flow control bug */ if (!context) {netdev_warn (netdev,"cannot find free context\n" ); ret =NETDEV_TX_BUSY ;
@@ -1364,9 +1367,6 @@ static netdev_tx_t kvaser_usb_start_xmitif (unlikely (err)) {can_free_echo_skb (netdev, context->echo_index); - skb =NULL ;/* set to NULL to avoid double free in -* dev_kfree_skb(skb) */ -atomic_dec (&priv->active_tx_urbs);usb_unanchor_urb (urb);
@@ -1388,8 +1388,6 @@ releasebuf:kfree (buf); nobufmem:usb_free_urb (urb); -nourbmem: -dev_kfree_skb (skb);return ret; }
Greg Kroah-Hartman
maintainerPATCH 156/183 can: kvaser_usb: Reset all URB tx contexts upon channel close
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Ahmed S. Darwish" <[email protected]>
commit 889b77f7fd2bcc922493d73a4c51d8a851505815 upstream.
Flooding the Kvaser CAN to USB dongle with multiple reads and writes in very high frequency (*), closing the CAN channel while all the transmissions are on (#), opening the device again (@), then sending a small number of packets would make the driver enter an almost infinite loop of:
[....]
[15959.853988] kvaser_usb 4-3:1.0 can0: cannot find free context [15959.853990] kvaser_usb 4-3:1.0 can0: cannot find free context [15959.853991] kvaser_usb 4-3:1.0 can0: cannot find free context [15959.853993] kvaser_usb 4-3:1.0 can0: cannot find free context [15959.853994] kvaser_usb 4-3:1.0 can0: cannot find free context [15959.853995] kvaser_usb 4-3:1.0 can0: cannot find free context
[....]
_dragging the whole system down_ in the process due to the excessive logging output.
Initially, this has caused random panics in the kernel due to a buggy error recovery path. That got fixed in an earlier commit.(%) This patch aims at solving the root cause. -->
16 tx URBs and contexts are allocated per CAN channel per USB device. Such URBs are protected by:
a) A simple atomic counter, up to a value of MAX_TX_URBS (16)
b) A flag in each URB context, stating if it's free
c) The fact that ndo_start_xmit calls are themselves protected by the networking layers higher above
After grabbing one of the tx URBs, if the driver noticed that all of them are now taken, it stops the netif transmission queue. Such queue is worken up again only if an acknowedgment was received from the firmware on one of our earlier-sent frames.
Meanwhile, upon channel close (#), the driver sends a CMD_STOP_CHIP to the firmware, effectively closing all further communication. In the high traffic case, the atomic counter remains at MAX_TX_URBS, and all the URB contexts remain marked as active. While opening the channel again (@), it cannot send any further frames since no more free tx URB contexts are available.
Reset all tx URB contexts upon CAN channel close.
(*) 50 parallel instances of cangen0 -g 0 -ix (#) ifconfig can0 down
(@) ifconfig can0 up
(%) "can: kvaser_usb: Don't free packets when tight on URBs"
--- drivers/net/can/usb/kvaser_usb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/can/usb/kvaser_usb.c +3 -0
@@ -1246,6 +1246,9 @@ static int kvaser_usb_close(struct net_dif (err)netdev_warn (netdev,"Cannot stop device, error %d\n" , err); +/* reset tx contexts */ +kvaser_usb_unlink_tx_urbs (priv); + priv->can.state =CAN_STATE_STOPPED ;close_candev (priv->netdev);
Greg Kroah-Hartman
maintainerPATCH 157/183 can: kvaser_usb: Dont send a RESET_CHIP for non-existing channels
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Ahmed S. Darwish" <[email protected]>
commit 5e7e6e0c9b47a45576c38b4a72d67927a5e049f7 upstream.
Recent Leaf firmware versions (>= 3.1.557) do not allow to send commands for non-existing channels. If a command is sent for a non-existing channel, the firmware crashes.
--- drivers/net/can/usb/kvaser_usb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/can/usb/kvaser_usb.c +4 -3
@@ -1503,6 +1503,10 @@ static int kvaser_usb_init_one(struct usstruct kvaser_usb_net_priv *priv;int i, err; + err =kvaser_usb_send_simple_msg (dev,CMD_RESET_CHIP , channel); +if (err) +return err; + netdev =alloc_candev (sizeof (*priv),MAX_TX_URBS );if (!netdev) {dev_err (&intf->dev,"Cannot alloc candev\n" );
@@ -1607,9 +1611,6 @@ static int kvaser_usb_probe(struct usb_iusb_set_intfdata (intf, dev); -for (i =0 ; i <MAX_NET_DEVICES ; i++) -kvaser_usb_send_simple_msg (dev,CMD_RESET_CHIP , i); - err =kvaser_usb_get_software_info (dev);if (err) { dev_err(&intf->dev,
Greg Kroah-Hartman
maintainerPATCH 158/183 Input: elantech - support new ICs types for version 4
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sam hung <[email protected]>
commit 810aa0918b2b032684c8cad13f73d6ba37ad11c0 upstream.
This change allows the driver to recognize newer Elantech touchpads.
--- drivers/input/mouse/elantech.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/input/mouse/elantech.c +2 -0
@@ -1520,6 +1520,8 @@ static int elantech_set_properties(struccase 7 :case 8 :case 9 : +case 10 : +case 13 : etd->hw_version =4 ;break ;default :
Greg Kroah-Hartman
maintainerPATCH 160/183 Input: I8042 - add Acer Aspire 7738 to the nomux list
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <[email protected]>
commit 9333caeaeae4f831054e0e127a6ed3948b604d3e upstream.
When KBC is in active multiplexing mode the touchpad on this laptop does not work.
--- drivers/input/serio/i8042-x86ia64io.h | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/input/serio/i8042-x86ia64io.h +7 -0
@@ -415,6 +415,13 @@ static const struct dmi_system_id __init }, }, { +/* Acer Aspire 7738 */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Acer" ), + DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7738"), + }, + }, + {/* Gericom Bellagio */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "Gericom"),
Greg Kroah-Hartman
maintainerPATCH 161/183 ARM: omap2plus_defconfig: use CONFIG_CPUFREQ_DT
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nishanth Menon <[email protected]>
commit 40d1746d2eeec5e05956d749cca6364573b472b6 upstream.
CONFIG_GENERIC_CPUFREQ_CPU0 disappeared with commit bbcf071969b20f ("cpufreq: cpu0: rename driver and internals to 'cpufreq_dt'")
Use the renamed CONFIG_CPUFREQ_DT generic driver. It looks like with v3.18-rc1, commit bbcf071969b20f and fdc509b15eb3eb came in via different trees causing the resultant v3.18-rc1 to be non-functional for cpufreq as default supported with omap2plus_defconfig.
--- arch/arm/configs/omap2plus_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/configs/omap2plus_defconfig +1 -1
@@ -68,7 +68,7 @@ CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y CONFIG_CPU_FREQ_GOV_POWERSAVE=y CONFIG_CPU_FREQ_GOV_USERSPACE=y CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -CONFIG_GENERIC_CPUFREQ_CPU0=y +CONFIG_CPUFREQ_DT=y # CONFIG_ARM_OMAP2PLUS_CPUFREQ is not set CONFIG_CPU_IDLE=y CONFIG_BINFMT_MISC=y
Greg Kroah-Hartman
maintainerPATCH 162/183 ARM: imx6sx: Set PLL2 as parent of QSPI clocks
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Estevam <[email protected]>
commit 7c168ed898931f6c3314d696e63cf993378ca192 upstream.
The default qspi2_clk_sel field of register CCM_CS2CDR contains '110' which is marked as 'reserved', so we can't rely on the default value.
Provide a proper parent for QSPI clocks to avoid a kernel oops:
[ 1.037920] Division by zero in kernel. [ 1.041807] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.18.0-rc7-next-20141204-00002-g5aa23e1 #2143 [ 1.050967] Hardware name: Freescale i.MX6 SoloX (Device Tree) [ 1.056853] Backtrace: [ 1.059360] [<80011ea0>] (dump_backtrace) from [<8001203c>] (show_stack+0x18/0x1c) [ 1.066982] r6:00000000 r5:00000000 r4:00000000 r3:00000000 [ 1.072754] [<80012024>] (show_stack) from [<806b7100>] (dump_stack+0x88/0xa4) [ 1.080038] [<806b7078>] (dump_stack) from [<80011d20>] (__div0+0x18/0x20) [ 1.086958] r5:be018500 r4:be017c00 [ 1.090600] [<80011d08>] (__div0) from [<802aa418>] (Ldiv0+0x8/0x10) [ 1.097012] [<80504fbc>] (clk_divider_set_rate) from [<80503ddc>] (clk_change_rate+0x14c/0x17c) [ 1.105759] r7:00000000 r6:00000000 r5:be018500 r4:00000000 [ 1.111516] [<80503c90>] (clk_change_rate) from [<80503ea0>] (clk_set_rate+0x94/0x98) [ 1.119391] r8:be7e0368 r7:00000000 r6:be11a000 r5:be018500 r4:00000000 r3:00000000 [ 1.127290] [<80503e0c>] (clk_set_rate) from [<80410558>] (fsl_qspi_probe+0x23c/0x75c) [ 1.135260] r5:be11a010 r4:be350010 [ 1.138900] [<8041031c>] (fsl_qspi_probe) from [<80385a18>] (platform_drv_probe+0x50/0xac)
--- arch/arm/mach-imx/clk-imx6sx.c | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/mach-imx/clk-imx6sx.c +3 -0
@@ -558,6 +558,9 @@ static void __init imx6sx_clocks_init(stclk_set_parent (clks[IMX6SX_CLK_GPU_CORE_SEL ], clks[IMX6SX_CLK_PLL3_PFD0 ]);clk_set_parent (clks[IMX6SX_CLK_GPU_AXI_SEL ], clks[IMX6SX_CLK_PLL3_PFD0 ]); +clk_set_parent (clks[IMX6SX_CLK_QSPI1_SEL ], clks[IMX6SX_CLK_PLL2_BUS ]); +clk_set_parent (clks[IMX6SX_CLK_QSPI2_SEL ], clks[IMX6SX_CLK_PLL2_BUS ]); +/* Set initial power mode */ imx6q_set_lpm (WAIT_CLOCKED ); }
Greg Kroah-Hartman
maintainerPATCH 163/183 ARM: dts: imx25: Fix the SPI1 clocks
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Estevam <[email protected]>
commit 7a87e9cbc3a2f0ff0955815335e08c9862359130 upstream.
Quoted 1 line
Quoted 1 line
From
Documentation/devicetree/bindings/clock/imx25-clock.txt:
cspi1_ipg 78 cspi2_ipg 79 cspi3_ipg 80
, so fix the SPI1 clocks accordingly to avoid a kernel hang when trying to access SPI1.
--- arch/arm/boot/dts/imx25.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx25.dtsi +1 -1
@@ -162,7 +162,7 @@ #size-cells = <0>; compatible = "fsl,imx25-cspi", "fsl,imx35-cspi"; reg = <0x43fa4000 0x4000>; - clocks = <&clks 62>, <&clks 62>; + clocks = <&clks 78>, <&clks 78>; clock-names = "ipg", "per"; interrupts = <14>; status = "disabled";
Greg Kroah-Hartman
maintainerPATCH 164/183 ARM: dts: imx51-babbage: Fix ULPI PHY reset modelling
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Estevam <[email protected]>
commit 7a9f0604bd56936b2b18f49824e0e392dc7878c3 upstream.
GPIO2_5 is the reset GPIO for the USB3317 ULPI PHY. Instead of modelling it as a regulator, the correct approach is to use the 'reset_gpios' property of the "usb-nop-xceiv" node.
GPIO1_7 is the reset GPIO for the USB2517 USB hub. As we currently don't have dt bindings to describe a HUB reset, let's keep using the regulator approach.
Rename the regulator to 'reg_hub_reset' to better describe its function and bind it with the USB host1 port instead.
USB host support has been introduced by commit 9bf206a9d13be3 ("ARM: dts:
imx51-babbage: Add USB Host1 support"), which landed in 3.16 and it seems that USB has only been functional due to previous bootloader initialization.
With this patch applied we can get USB host to work without relying on the bootloader.
--- arch/arm/boot/dts/imx51-babbage.dts | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-)
arch/arm/boot/dts/imx51-babbage.dts +5 -17
@@ -127,24 +127,12 @@ #address-cells = <1>; #size-cells = <0>; - reg_usbh1_vbus: regulator@0 { - compatible = "regulator-fixed"; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_usbh1reg>; - reg = <0>; - regulator-name = "usbh1_vbus"; - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; - gpio = <&gpio2 5 GPIO_ACTIVE_HIGH>; - enable-active-high; - }; - - reg_usbotg_vbus: regulator@1 { + reg_hub_reset: regulator@0 { compatible = "regulator-fixed"; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usbotgreg>; - reg = <1>; - regulator-name = "usbotg_vbus"; + reg = <0>; + regulator-name = "hub_reset"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; gpio = <&gpio1 7 GPIO_ACTIVE_HIGH>;
@@ -176,6 +164,7 @@ reg = <0>; clocks = <&clks IMX5_CLK_DUMMY>; clock-names = "main_clk"; + reset-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>; }; }; };
@@ -419,7 +408,7 @@ &usbh1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usbh1>; - vbus-supply = <®_usbh1_vbus>; + vbus-supply = <®_hub_reset>; fsl,usbphy = <&usbh1phy>; phy_type = "ulpi"; status = "okay";
@@ -429,7 +418,6 @@ dr_mode = "otg"; disable-over-current; phy_type = "utmi_wide"; - vbus-supply = <®_usbotg_vbus>; status = "okay"; };
Greg Kroah-Hartman
maintainerPATCH 165/183 ARM: imx6q: drop unnecessary semicolon
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Voytik <[email protected]>
commit d2a10a1727b3948019128e83162f22c65859f1fd upstream.
Drop unnecessary semicolon after closing curly bracket.
--- arch/arm/mach-imx/clk-imx6q.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/clk-imx6q.c +1 -1
@@ -145,7 +145,7 @@ static void __init imx6q_clocks_init(str post_div_table[2 ].div =1 ; video_div_table[1 ].div =1 ; video_div_table[2 ].div =1 ; - }; + } clk[IMX6QDL_PLL1_BYPASS_SRC ] =imx_clk_mux ("pll1_bypass_src" , base +0x00 ,14 ,2 , pll_bypass_src_sels,ARRAY_SIZE (pll_bypass_src_sels)); clk[IMX6QDL_PLL2_BYPASS_SRC ] =imx_clk_mux ("pll2_bypass_src" , base +0x30 ,14 ,2 , pll_bypass_src_sels,ARRAY_SIZE (pll_bypass_src_sels));
Greg Kroah-Hartman
maintainerPATCH 166/183 ARM: clk-imx6q: fix video divider for rev T0 1.0
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gary Bisson <[email protected]>
commit 81ef447950bf0955aca46f4a7617d8ce435cf0ce upstream.
The post dividers do not work on i.MX6Q rev T0 1.0 so they must be fixed to 1. As the table index was wrong, a divider a of 4 could still be requested which implied the clock not to be set properly. This is the root cause of the HDMI not working at high resolution on rev T0 1.0 of the SoC.
--- arch/arm/mach-imx/clk-imx6q.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/clk-imx6q.c +1 -1
@@ -144,7 +144,7 @@ static void __init imx6q_clocks_init(str post_div_table[1 ].div =1 ; post_div_table[2 ].div =1 ; video_div_table[1 ].div =1 ; - video_div_table[2 ].div =1 ; + video_div_table[3 ].div =1 ; } clk[IMX6QDL_PLL1_BYPASS_SRC ] =imx_clk_mux ("pll1_bypass_src" , base +0x00 ,14 ,2 , pll_bypass_src_sels,ARRAY_SIZE (pll_bypass_src_sels));
Greg Kroah-Hartman
maintainerPATCH 167/183 ARM: omap5/dra7xx: Fix frequency typos
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lennart Sorensen <[email protected]>
commit 572b24e6d85d98cdc552f07e9fb9870d9460d81b upstream.
The switch statement of the possible list of SYSCLK1 frequencies is missing a 0 in 4 out of the 7 frequencies.
--- arch/arm/mach-omap2/timer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/timer.c +4 -4
@@ -513,11 +513,11 @@ static void __init realtime_counter_init rate =clk_get_rate (sys_clk);/* Numerator/denumerator values refer TRM Realtime Counter section */ switch (rate) { -case 1200000 : +case 12000000 : num =64 ; den =125 ;break ; -case 1300000 : +case 13000000 : num =768 ; den =1625 ;break ;
@@ -529,11 +529,11 @@ static void __init realtime_counter_init num =192 ; den =625 ;break ; -case 2600000 : +case 26000000 : num =384 ; den =1625 ;break ; -case 2700000 : +case 27000000 : num =256 ; den =1125 ;break ;
Greg Kroah-Hartman
maintainerPATCH 168/183 ARM: omap5/dra7xx: Enable booting secondary CPU in HYP mode
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lennart Sorensen <[email protected]>
commit 999f934de195a1506089b52c77429fdba25da688 upstream.
If the boot loader enables HYP mode on the boot CPU, the secondary CPU also needs to call into the ROM to switch to HYP mode before booting. The firmwares on the omap5 and dra7xx unfortunately do not take care of this, so it has to be handled by the kernel.
This patch is based on "[PATCH 2/2] ARM: OMAP5: Add HYP mode entry support for secondary CPUs" by Santosh Shilimkar <[email protected]>, except this version does not require a compile time CONFIG to control if it should enable HYP mode or not, it simply does it based on the mode of the boot CPU, so it works whether the CPU boots in SVC or HYP mode, and should even work as a guest kernel inside kvm if qemu decides to support emulating the omap5 or dra7xx.
--- arch/arm/mach-omap2/common.h | 1 + arch/arm/mach-omap2/omap-headsmp.S | 21 +++++++++++++++++++++ arch/arm/mach-omap2/omap-smp.c | 13 +++++++++++-- 3 files changed, 33 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/common.h +1 -0
@@ -249,6 +249,7 @@ extern void omap4_cpu_die(unsigned int cextern struct smp_operations omap4_smp_ops;extern void omap5_secondary_startup (void ); +extern void omap5_secondary_hyp_startup (void );#endif #if defined(CONFIG_SMP ) && defined(CONFIG_PM )
arch/arm/mach-omap2/omap-headsmp.S +21 -0
@@ -22,6 +22,7 @@ /* Physical address needed since MMU not enabled yet on secondary core */ #define AUX_CORE_BOOT0_PA 0x48281800 +#define API_HYP_ENTRY 0x102 /* * OMAP5 specific entry point for secondary CPU to jump from ROM
@@ -41,6 +42,26 @@ wait: ldr r2, =AUX_CORE_BOOT0_PA @ read b secondary_startup ENDPROC(omap5_secondary_startup) /* + * Same as omap5_secondary_startup except we call into the ROM to + * enable HYP mode first. This is called instead of + * omap5_secondary_startup if the primary CPU was put into HYP mode by + * the boot loader. + */ +ENTRY(omap5_secondary_hyp_startup) +wait_2: ldr r2, =AUX_CORE_BOOT0_PA @ read from AuxCoreBoot0 + ldr r0, [r2] + mov r0, r0, lsr #5 + mrc p15, 0, r4, c0, c0, 5 + and r4, r4, #0x0f + cmp r0, r4 + bne wait_2 + ldr r12, =API_HYP_ENTRY + adr r0, hyp_boot + smc #0 +hyp_boot: + b secondary_startup +ENDPROC(omap5_secondary_hyp_startup) +/* * OMAP4 specific entry point for secondary CPU to jump from ROM * code. This routine also provides a holding flag into which * secondary core is held until we're ready for it to initialise.
arch/arm/mach-omap2/omap-smp.c +11 -2
@@ -22,6 +22,7 @@#include <linux/irqchip/arm-gic.h> #include <asm/smp_scu.h> +#include <asm/virt.h> #include "omap-secure.h" #include "omap-wakeupgen.h"
@@ -227,8 +228,16 @@ static void __init omap4_smp_prepare_cpuif (omap_secure_apis_support ())omap_auxcoreboot_addr (virt_to_phys (startup_addr));else -writel_relaxed (virt_to_phys (omap5_secondary_startup), - base +OMAP_AUX_CORE_BOOT_1 ); +/* +* If the boot CPU is in HYP mode then start secondary +* CPU in HYP mode as well. +*/ +if ((__boot_cpu_mode &MODE_MASK ) ==HYP_MODE ) +writel_relaxed (virt_to_phys (omap5_secondary_hyp_startup), + base +OMAP_AUX_CORE_BOOT_1 ); +else +writel_relaxed (virt_to_phys (omap5_secondary_startup), + base +OMAP_AUX_CORE_BOOT_1 ); }
Greg Kroah-Hartman
maintainerPATCH 169/183 bus: omap_l3_noc: Add resume hook to restore context
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keerthy <[email protected]>
commit 61b43d4e919e8fa5e10c77ee32ba328da07e0264 upstream.
On certain SoCs such as AM437x SoC, L3_noc error registers are maintained in power domain such as per domain which looses context as part of low power state such as RTC+DDR mode. On these platforms when we mask interrupts which we cannot handle, the source of these interrupts still remain on resume, however, the flag mux registers now contain their reset value (unmasked) - this breaks the system with infinite interrupts since we do not these interrupts to take place ever again.
To handle this: restore the masking of interrupts which we have already recorded in the system as ones we cannot handle.
--- drivers/bus/omap_l3_noc.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)
drivers/bus/omap_l3_noc.c +55 -0
@@ -296,11 +296,66 @@ static int omap_l3_probe(struct platformreturn ret; } +#ifdef CONFIG_PM + +/** +* l3_resume_noirq() - resume function for l3_noc +* @dev: pointer to l3_noc device structure +* +* We only have the resume handler only since we +* have already maintained the delta register +* configuration as part of configuring the system +*/ +static int l3_resume_noirq (struct device *dev) +{ +struct omap_l3 *l3 =dev_get_drvdata (dev); +int i; +struct l3_flagmux_data *flag_mux; +void __iomem *base, *mask_regx =NULL ; +u32 mask_val; + +for (i =0 ; i < l3->num_modules; i++) { + base = l3->l3_base[i]; + flag_mux = l3->l3_flagmux[i]; +if (!flag_mux->mask_app_bits && !flag_mux->mask_dbg_bits) +continue ; + + mask_regx = base + flag_mux->offset +L3_FLAGMUX_MASK0 + + (L3_APPLICATION_ERROR <<3 ); + mask_val =readl_relaxed (mask_regx); + mask_val &= ~(flag_mux->mask_app_bits); + +writel_relaxed (mask_val, mask_regx); + mask_regx = base + flag_mux->offset +L3_FLAGMUX_MASK0 + + (L3_DEBUG_ERROR <<3 ); + mask_val =readl_relaxed (mask_regx); + mask_val &= ~(flag_mux->mask_dbg_bits); + +writel_relaxed (mask_val, mask_regx); + } + +/* Dummy read to force OCP barrier */ +if (mask_regx) + (void )readl (mask_regx); + +return 0 ; +} + +static const struct dev_pm_ops l3_dev_pm_ops = { + .resume_noirq = l3_resume_noirq, +}; + +#define L3_DEV_PM_OPS (&l3_dev_pm_ops) +#else +#define L3_DEV_PM_OPS NULL +#endif +static struct platform_driver omap_l3_driver = { .probe = omap_l3_probe, .driver = { .name ="omap_l3_noc" , .owner =THIS_MODULE , + .pm =L3_DEV_PM_OPS , .of_match_table =of_match_ptr (l3_noc_match), }, };
Greg Kroah-Hartman
maintainerPATCH 170/183 bus: omap_l3_noc: Correct returning IRQ_HANDLED unconditionally in the irq handler
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keerthy <[email protected]>
commit c4cf0935a2d8fe6d186bf4253ea3c4b4a8a8a710 upstream.
Correct returning IRQ_HANDLED unconditionally in the irq handler. Return IRQ_NONE for some interrupt which we do not expect to be handled in this handler. This prevents kernel stalling with back to back spurious interrupts.
--- drivers/bus/omap_l3_noc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/bus/omap_l3_noc.c +6 -2
@@ -222,10 +222,14 @@ static irqreturn_t l3_interrupt_handler( }/* Error found so break the for loop */ -break ; +return IRQ_HANDLED ; } } -return IRQ_HANDLED ; + +dev_err (l3->dev,"L3 %s IRQ not handled!!\n" , + inttype ?"debug" :"application" ); + +return IRQ_NONE ; }static const struct of_device_id l3_noc_match[] = {
Greg Kroah-Hartman
maintainerPATCH 171/183 ARM: dts: berlin: add broken-cd and set bus width for eMMC in Marvell DMP DT
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jisheng Zhang <[email protected]>
commit 5adba7c2daaecccf377e7ed5a2996caedd5384f1 upstream.
There's no card detection for the eMMC, so this patch adds the missing broken-cd property. This patch also sets bus width as 8 to add MMC_CAP_8_BIT_DATA in the Host capabilities.
--- arch/arm/boot/dts/berlin2q-marvell-dmp.dts | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/boot/dts/berlin2q-marvell-dmp.dts +2 -0
@@ -30,6 +30,8 @@ }; &sdhci2 { + broken-cd; + bus-width = <8>; non-removable; status = "okay"; };
Greg Kroah-Hartman
maintainerPATCH 172/183 ARM: shmobile: sh73a0 legacy: Set .control_parent for all irqpin instances
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit b0ddb319db3d7a1943445f0de0a45c07a7f3457a upstream.
The sh73a0 INTC can't mask interrupts properly most likely due to a hardware bug. Set the .control_parent flag to delegate masking to the parent interrupt controller, like was already done for irqpin1.
Without this, accessing the three-axis digital accelerometer ADXL345 on kzm9g through /dev/input/event1 causes an interrupt storm, which requires a power-cycle to recover from.
This was inspired by a patch for arch/arm/boot/dts/sh73a0.dtsi from Laurent Pinchart <[email protected]>.
--- arch/arm/mach-shmobile/setup-sh73a0.c | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/mach-shmobile/setup-sh73a0.c +3 -0
@@ -598,6 +598,7 @@ static struct platform_device ipmmu_devistatic struct renesas_intc_irqpin_config irqpin0_platform_data = { .irq_base =irq_pin (0 ),/* IRQ0 -> IRQ7 */ + .control_parent = true, };static struct resource irqpin0_resources[] = {
@@ -659,6 +660,7 @@ static struct platform_device irqpin1_destatic struct renesas_intc_irqpin_config irqpin2_platform_data = { .irq_base =irq_pin (16 ),/* IRQ16 -> IRQ23 */ + .control_parent = true, };static struct resource irqpin2_resources[] = {
@@ -689,6 +691,7 @@ static struct platform_device irqpin2_destatic struct renesas_intc_irqpin_config irqpin3_platform_data = { .irq_base =irq_pin (24 ),/* IRQ24 -> IRQ31 */ + .control_parent = true, };static struct resource irqpin3_resources[] = {