5.8.8-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainercover 5.8.8-rc1 review
This is the start of the stable review cycle for the 5.8.8 release. There are 186 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 10 Sep 2020 15:21:57 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.8.8-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.8.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.8.8-rc1
Himadri Pandya <[email protected]>
net: usb: Fix uninit-was-stored issue in asix_read_phy_addr()
Johannes Berg <[email protected]>
cfg80211: regulatory: reject invalid hints
David Howells <[email protected]>
mm/khugepaged.c: fix khugepaged's request size in collapse_file
Muchun Song <[email protected]>
mm/hugetlb: fix a race between hugetlb sysctl handlers
Li Xinhai <[email protected]>
mm/hugetlb: try preferred node first when alloc gigantic page from cma
Alistair Popple <[email protected]>
mm/migrate: fixup setting UFFD_WP flag
Mrinal Pandey <[email protected]>
checkpatch: fix the usage of capture group ( ... )
Sowjanya Komatineni <[email protected]>
sdhci: tegra: Add missing TMCLK for data timeout
Randy Dunlap <[email protected]>
kconfig: streamline_config.pl: check defined(ENV variable) before using it
Wei Li <[email protected]>
perf record: Correct the help info of option "--no-bpf-event"
Jens Axboe <[email protected]>
io_uring: no read/write-retry on -EAGAIN error and O_NONBLOCK marked file
Alistair Popple <[email protected]>
mm/rmap: fixup copying of soft dirty and uffd ptes
Yang Shi <[email protected]>
mm: madvise: fix vma user-after-free
Joerg Roedel <[email protected]>
mm: track page table modifications in __apply_to_page_range()
Eugeniu Rosca <[email protected]>
mm: slub: fix conversion of freelist_corrupted()
Ye Bin <[email protected]>
dm thin metadata: Fix use-after-free in dm_bm_set_read_only
Ye Bin <[email protected]>
dm thin metadata: Avoid returning cmd->bm wild pointer on error
Ye Bin <[email protected]>
dm cache metadata: Avoid returning cmd->bm wild pointer on error
Damien Le Moal <[email protected]>
dm crypt: Initialize crypto wait structures
Mikulas Patocka <[email protected]>
dm integrity: fix error reporting in bitmap mode after creation
Mike Snitzer <[email protected]>
dm mpath: fix racey management of PG initialization
Mikulas Patocka <[email protected]>
dm writecache: handle DAX to partitions on persistent memory correctly
Sandeep Raghuraman <[email protected]>
drm/amdgpu: Specify get_argument function for ci_smu_funcs
Evan Quan <[email protected]>
drm/amd/pm: avoid false alarm due to confusing softwareshutdowntemp setting
Sean Paul <[email protected]>
drm/i915: Fix sha_text population code
Gustavo Pimentel <[email protected]>
dmaengine: dw-edma: Fix scatter-gather address calculation
Tejun Heo <[email protected]>
blk-stat: make q->stats->lock irqsafe
Tejun Heo <[email protected]>
blk-iocost: ioc_pd_free() shouldn't assume irq disabled
He Zhe <[email protected]>
mips/oprofile: Fix fallthrough placement
Tejun Heo <[email protected]>
libata: implement ATA_HORKAGE_MAX_TRIM_128M and apply to Sandisks
Eric Farman <[email protected]>
s390: fix GENERIC_LOCKBREAK dependency typo in Kconfig
Jiufei Xue <[email protected]>
io_uring: fix removing the wrong file in __io_sqe_files_update()
Jiufei Xue <[email protected]>
io_uring: set table->files[i] to NULL when io_sqe_file_register failed
Jens Axboe <[email protected]>
block: ensure bdi->io_pages is always initialized
Ming Lei <[email protected]>
block: allow for_each_bvec to support zero len bvec
Max Staudt <[email protected]>
affs: fix basic permission bits to actually work
Sean Young <[email protected]>
media: rc: uevent sysfs file races with rc_unregister_device()
Sean Young <[email protected]>
media: rc: do not access device via sysfs after rc_unregister_device()
Adrian Hunter <[email protected]>
mmc: sdhci-pci: Fix SDHCI_RESET_ALL for CQHCI for Intel GLK-based controllers
Wenbin Mei <[email protected]>
mmc: dt-bindings: Add resets/reset-names for Mediatek MMC bindings
Wenbin Mei <[email protected]>
mmc: mediatek: add optional module reset property
Wenbin Mei <[email protected]>
arm64: dts: mt7622: add reset node for mmc device
Takashi Iwai <[email protected]>
ALSA: hda/realtek - Improved routing for Thinkpad X1 7th/8th Gen
Adrien Crivelli <[email protected]>
ALSA: hda/realtek: Add quirk for Samsung Galaxy Book Ion NT950XCJ-X716A
Takashi Sakamoto <[email protected]>
ALSA; firewire-tascam: exclude Tascam FE-8 from detection
Dan Crawford <[email protected]>
ALSA: hda - Fix silent audio output and corrupted input on MSI X570-A PRO
Takashi Sakamoto <[email protected]>
ALSA: firewire-digi00x: exclude Avid Adrenaline from detection
Kai Vehmanen <[email protected]>
ALSA: hda/hdmi: always check pin power status in i915 pin fixup
Takashi Iwai <[email protected]>
ALSA: pcm: oss: Remove superfluous WARN_ON() for mulaw sanity check
Joshua Sivec <[email protected]>
ALSA: usb-audio: Add implicit feedback quirk for UR22C
František Kučera <[email protected]>
ALSA: usb-audio: Add basic capture support for Pioneer DJ DJM-250MK2
Tong Zhang <[email protected]>
ALSA: ca0106: fix error code handling
Tiezhu Yang <[email protected]>
Revert "ALSA: hda: Add support for Loongson 7A1000 controller"
Sasha Levin <[email protected]>
x86/mm/32: Bring back vmalloc faulting on x86_32
Max Chou <[email protected]>
Bluetooth: Return NOTIFY_DONE for hci_suspend_notifier
Qu Wenruo <[email protected]>
btrfs: tree-checker: fix the error message for transid error
Marcos Paulo de Souza <[email protected]>
btrfs: block-group: fix free-space bitmap threshold
Josef Bacik <[email protected]>
btrfs: set the lockdep class for log tree extent buffers
Josef Bacik <[email protected]>
btrfs: set the correct lockdep class for new nodes
Josef Bacik <[email protected]>
btrfs: allocate scrub workqueues outside of locks
Josef Bacik <[email protected]>
btrfs: fix potential deadlock in the search ioctl
Josef Bacik <[email protected]>
btrfs: drop path before adding new uuid tree entry
Mike Rapoport <[email protected]>
arc: fix memory initialization for systems with two memory banks
Vineet Gupta <[email protected]>
ARC: perf: don't bail setup if pct irq missing in device-tree
Mikulas Patocka <[email protected]>
xfs: don't update mtime on COW faults
Mikulas Patocka <[email protected]>
ext2: don't update mtime on COW faults
Andy Lutomirski <[email protected]>
x86/debug: Allow a single level of #DB recursion
Peter Zijlstra <[email protected]>
x86/entry: Fix AC assertion
Vamshi K Sthambamkadi <[email protected]>
tracing/kprobes, x86/ptrace: Fix regs argument order for i386
Chris Wilson <[email protected]>
iommu/vt-d: Handle 36bit addressing for x86-32
Jason Gunthorpe <[email protected]>
include/linux/log2.h: add missing () around n in roundup_pow_of_two()
Or Cohen <[email protected]>
net/packet: fix overflow in tpacket_rcv
Suravee Suthikulpanit <[email protected]>
iommu/amd: Use cmpxchg_double() when updating 128-bit IRTE
Suravee Suthikulpanit <[email protected]>
iommu/amd: Restore IRTE.RemapEn bit after programming IRTE
Veera Vegivada <[email protected]>
thermal: qcom-spmi-temp-alarm: Don't suppress negative temp
Tony Lindgren <[email protected]>
thermal: ti-soc-thermal: Fix bogus thermal shutdowns for omap4430
Lu Baolu <[email protected]>
iommu/vt-d: Serialize IOMMU GCMD register modifications
Huang Ying <[email protected]>
x86, fakenuma: Fix invalid starting node ID
Michael Chan <[email protected]>
tg3: Fix soft lockup when tg3_reset_task() fails.
YueHaibing <[email protected]>
perf bench: The do_run_multi_threaded() function must use IS_ERR(perf_session__new())
Jin Yao <[email protected]>
perf stat: Turn off summary for interval mode by default
Namhyung Kim <[email protected]>
perf jevents: Fix suspicious code in fixregex()
Darrick J. Wong <[email protected]>
xfs: fix xfs_bmap_validate_extent_raw when checking attr fork of rt files
Thomas Bogendoerfer <[email protected]>
MIPS: SNI: Fix SCSI interrupt
Huang Pei <[email protected]>
MIPS: add missing MSACSR and upper MSA initialization
Kai-Heng Feng <[email protected]>
drm/radeon: Prefer lower feedback dividers
Dan Murphy <[email protected]>
net: dp83867: Fix WoL SecureOn password
Louis Peens <[email protected]>
nfp: flower: fix ABI mismatch between driver and firmware
Dan Carpenter <[email protected]>
net: gemini: Fix another missing clk_disable_unprepare() in probe
Denis Efremov <[email protected]>
net: bcmgenet: fix mask check in bcmgenet_validate_flow()
Al Viro <[email protected]>
fix regression in "epoll: Keep a reference on files added to the check list"
Shung-Hsi Yu <[email protected]>
net: ethernet: mlx4: Fix memory allocation in mlx4_buddy_init()
Al Grant <[email protected]>
perf tools: Correct SNOOPX field offset
Al Grant <[email protected]>
perf intel-pt: Fix corrupt data after perf inject from
Al Grant <[email protected]>
perf cs-etm: Fix corrupt data after perf inject from
Arnaldo Carvalho de Melo <[email protected]>
perf top/report: Fix infinite loop in the TUI for grouped events
Christoph Hellwig <[email protected]>
block: fix locking in bdev_del_partition
Tiezhu Yang <[email protected]>
MIPS: perf: Fix wrong check condition of Loongson event IDs
Grygorii Strashko <[email protected]>
net: ethernet: ti: am65-cpsw: fix rmii 100Mbit link mode
Potnuri Bharat Teja <[email protected]>
cxgb4: fix thermal zone device registration
Viresh Kumar <[email protected]>
opp: Don't drop reference for an OPP table that was never parsed
Florian Westphal <[email protected]>
netfilter: conntrack: do not auto-delete clash entries on reply
Keith Busch <[email protected]>
nvme: fix controller instance leak
Christophe JAILLET <[email protected]>
nvmet-fc: Fix a missed _irqsave version of spin_lock in 'nvmet_fc_fod_op_done()'
Pablo Neira Ayuso <[email protected]>
netfilter: nfnetlink: nfnetlink_unicast() reports EAGAIN instead of ENOBUFS
Landen Chao <[email protected]>
net: dsa: mt7530: fix advertising unsupported 1000baseT_Half
Jesper Dangaard Brouer <[email protected]>
selftests/bpf: Fix massive output from test_maps
Jacopo Mondi <[email protected]>
media: i2c: imx214: select V4L2_FWNODE
Murali Karicheri <[email protected]>
net: ethernet: ti: cpsw_new: fix error handling in cpsw_ndo_vlan_rx_kill_vid()
Ezequiel Garcia <[email protected]>
media: cedrus: Add missing v4l2_ctrl_request_hdl_put()
Hans Verkuil <[email protected]>
media: vicodec: add missing v4l2_ctrl_request_hdl_put()
Jakub Kicinski <[email protected]>
bnxt: don't enable NAPI until rings are ready
Eric Sandeen <[email protected]>
xfs: fix boundary test in xfs_attr_shortform_verify
Brian Foster <[email protected]>
xfs: finish dfops on every insert range shift iteration
Edwin Peer <[email protected]>
bnxt_en: fix HWRM error when querying VF temperature
Michael Chan <[email protected]>
bnxt_en: Fix possible crash in bnxt_fw_reset_task().
Vasundhara Volam <[email protected]>
bnxt_en: Fix PCI AER error recovery flow
Michael Chan <[email protected]>
bnxt_en: Fix ethtool -S statitics with XDP or TCs enabled.
Vasundhara Volam <[email protected]>
bnxt_en: Check for zero dir entries in NVRAM.
Pavan Chebbi <[email protected]>
bnxt_en: Don't query FW when netif_running() is false.
Murali Karicheri <[email protected]>
net: ethernet: ti: cpsw_new: fix clean up of vlan mc entries for host port
Murali Karicheri <[email protected]>
net: ethernet: ti: cpsw: fix clean up of vlan mc entries for host port
Nicolas Dichtel <[email protected]>
gtp: add GTPA_LINK info to msg sent to userspace
Peter Ujfalusi <[email protected]>
dmaengine: ti: k3-udma: Fix the TR initialization for prep_slave_sg
Marek Szyprowski <[email protected]>
dmaengine: pl330: Fix burst length if burst size is smaller than bus width
Yonghong Song <[email protected]>
bpf: Fix a buffer out-of-bound access when filling raw_tp link_info
Dinghao Liu <[email protected]>
net: arc_emac: Fix memleak in arc_mdio_probe
Yuusuke Ashizuka <[email protected]>
ravb: Fixed to be able to unload modules
Dinghao Liu <[email protected]>
net: systemport: Fix memleak in bcm_sysport_probe
Dinghao Liu <[email protected]>
net: hns: Fix memleak in hns_nic_dev_probe
Florian Westphal <[email protected]>
netfilter: nf_tables: fix destination register zeroing
Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: incorrect enum nft_list_attributes definition
Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: add NFTA_SET_USERDATA if not null
Tiezhu Yang <[email protected]>
perf top: Skip side-band event setup if HAVE_LIBBPF_SUPPORT is not set
David Ahern <[email protected]>
perf sched timehist: Fix use of CPU list with summary option
Raul E Rangel <[email protected]>
mmc: sdhci-acpi: Fix HS400 tuning for AMDI0040
Florian Fainelli <[email protected]>
MIPS: BMIPS: Also call bmips_cpu_setup() for secondary cores
Florian Fainelli <[email protected]>
MIPS: mm: BMIPS5000 has inclusive physical caches
David Howells <[email protected]>
rxrpc: Make rxrpc_kernel_get_srtt() indicate validity
David Howells <[email protected]>
rxrpc: Fix loss of RTT samples due to interposed ACK
David Howells <[email protected]>
rxrpc: Keep the ACK serial in a var in rxrpc_input_ack()
Yu Kuai <[email protected]>
dmaengine: at_hdmac: add missing kfree() call in at_dma_xlate()
Yu Kuai <[email protected]>
dmaengine: at_hdmac: add missing put_device() call in at_dma_xlate()
Yu Kuai <[email protected]>
dmaengine: at_hdmac: check return value of of_find_device_by_node() in at_dma_xlate()
Jussi Kivilinna <[email protected]>
batman-adv: bla: use netif_rx_ni when not in interrupt context
Linus Lüssing <[email protected]>
batman-adv: Fix own OGM check in aggregated OGMs
Sven Eckelmann <[email protected]>
batman-adv: Avoid uninitialized chaddr when handling DHCP
Peter Ujfalusi <[email protected]>
dmaengine: of-dma: Fix of_dma_router_xlate's of_dma_xlate handling
Linus Torvalds <[email protected]>
fsldma: fix very broken 32-bit ppc ioread64 functionality
Simon Leiner <[email protected]>
xen/xenbus: Fix granting of vmalloc'd memory
Dinghao Liu <[email protected]>
drm/amd/display: Fix memleak in amdgpu_dm_mode_config_init
Wayne Lin <[email protected]>
drm/amd/display: Retry AUX write when fail occurs
Brandon Syu <[email protected]>
drm/amd/display: Keep current gain when ABM disable immediately
Samson Tam <[email protected]>
drm/amd/display: Fix passive dongle mistaken as active dongle in EDID emulation
Jaehyun Chung <[email protected]>
drm/amd/display: Revert HDCP disable sequence change
Furquan Shaikh <[email protected]>
drivers: gpu: amd: Initialize amdgpu_dm_backlight_caps object to 0 in amdgpu_dm_update_backlight_caps
Nicholas Kazlauskas <[email protected]>
drm/amd/display: Reject overlay plane configurations in multi-display scenarios
Tong Zhang <[email protected]>
drm/amd/display: should check error using DC_OK
Sven Schnelle <[email protected]>
s390: don't trace preemption in percpu macros
Hou Pu <[email protected]>
nbd: restore default timeout when setting it to zero
Peter Zijlstra <[email protected]>
cpuidle: Fixup IRQ state
Paul Cercueil <[email protected]>
irqchip/ingenic: Leave parent IRQ unmasked on suspend
Tomi Valkeinen <[email protected]>
drm/omap: fix incorrect lock state
Ray Jui <[email protected]>
i2c: iproc: Fix shifting 31 bits
Jeff Layton <[email protected]>
ceph: don't allow setlease on cephfs
Vineeth Pillai <[email protected]>
hv_utils: drain the timesync packets on onchannelcallback
Vineeth Pillai <[email protected]>
hv_utils: return error if host timesysnc update is stale
Bob Peterson <[email protected]>
gfs2: add some much needed cleanup for log flushes that fail
Dmitry Baryshkov <[email protected]>
drm/msm/a6xx: fix gmu start on newer firmware
Ofir Bitton <[email protected]>
habanalabs: check correct vmalloc return code
Ofir Bitton <[email protected]>
habanalabs: validate FW file size
Oded Gabbay <[email protected]>
habanalabs: set max power according to card type
Ofir Bitton <[email protected]>
habanalabs: proper handling of alloc size in coresight
Ofir Bitton <[email protected]>
habanalabs: set clock gating according to mask
Ofir Bitton <[email protected]>
habanalabs: validate packet id during CB parse
Ofir Bitton <[email protected]>
habanalabs: unmap PCI bars upon iATU failure
Rob Clark <[email protected]>
drm/msm: enable vblank during atomic commits
Amit Engel <[email protected]>
nvmet: Disable keep-alive timer when kato is cleared to 0h
Tom Rix <[email protected]>
hwmon: (applesmc) check status earlier.
Krishna Manikandan <[email protected]>
drm/msm: add shutdown support for display platform_driver
John Stultz <[email protected]>
tty: serial: qcom_geni_serial: Drop __init from qcom_geni_console_setup
Rob Clark <[email protected]>
drm/msm/dpu: fix unitialized variable error
Kalyan Thota <[email protected]>
drm/msm/dpu: Fix scale params in plane validation
Kalyan Thota <[email protected]>
drm/msm/dpu: Fix reservation failures in modeset
Sebastian Parschauer <[email protected]>
HID: quirks: Always poll three more Lenovo PixArt mice
Grant Peltier <[email protected]>
hwmon: (pmbus/isl68137) remove READ_TEMPERATURE_1 telemetry for RAA228228
-------------
Diffstat:
Documentation/devicetree/bindings/mmc/mtk-sd.txt | 2 + Documentation/filesystems/affs.rst | 16 ++- Makefile | 4 +- arch/arc/kernel/perf_event.c | 14 +-- arch/arc/mm/init.c | 27 +++-- arch/arm64/boot/dts/mediatek/mt7622.dtsi | 2 + arch/mips/kernel/perf_event_mipsxx.c | 4 +- arch/mips/kernel/smp-bmips.c | 2 + arch/mips/kernel/traps.c | 12 ++ arch/mips/mm/c-r4k.c | 4 + arch/mips/oprofile/op_model_mipsxx.c | 4 +- arch/mips/sni/a20r.c | 4 +- arch/s390/Kconfig | 2 +- arch/s390/include/asm/percpu.h | 28 ++--- arch/x86/entry/common.c | 12 +- arch/x86/include/asm/ptrace.h | 2 +- arch/x86/include/asm/switch_to.h | 23 ++++ arch/x86/kernel/setup_percpu.c | 6 +- arch/x86/kernel/traps.c | 66 +++++----- arch/x86/mm/fault.c | 134 +++++++++++++++++++++ arch/x86/mm/numa_emulation.c | 2 +- arch/x86/mm/pti.c | 8 +- arch/x86/mm/tlb.c | 37 ++++++ block/blk-core.c | 1 + block/blk-iocost.c | 5 +- block/blk-stat.c | 17 ++- block/partitions/core.c | 27 ++--- drivers/ata/libata-core.c | 5 +- drivers/ata/libata-scsi.c | 8 +- drivers/block/nbd.c | 2 + drivers/cpuidle/cpuidle.c | 3 +- drivers/dma/at_hdmac.c | 11 +- drivers/dma/dw-edma/dw-edma-core.c | 11 +- drivers/dma/fsldma.h | 12 +- drivers/dma/of-dma.c | 8 +- drivers/dma/pl330.c | 2 +- drivers/dma/ti/k3-udma.c | 6 +- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 12 +- .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 2 +- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 3 +- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 8 +- drivers/gpu/drm/amd/display/dc/dc_stream.h | 2 +- .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 8 ++ .../gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c | 14 ++- drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c | 2 + drivers/gpu/drm/i915/display/intel_hdcp.c | 26 +++- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 12 +- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 20 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 4 +- drivers/gpu/drm/msm/msm_atomic.c | 36 ++++++ drivers/gpu/drm/msm/msm_drv.c | 8 ++ drivers/gpu/drm/omapdrm/omap_crtc.c | 3 +- drivers/gpu/drm/radeon/radeon_display.c | 2 +- drivers/hid/hid-ids.h | 3 + drivers/hid/hid-quirks.c | 3 + drivers/hv/hv_util.c | 65 +++++++--- drivers/hwmon/applesmc.c | 31 ++--- drivers/hwmon/pmbus/isl68137.c | 7 +- drivers/i2c/busses/i2c-bcm-iproc.c | 4 +- drivers/iommu/Kconfig | 2 +- drivers/iommu/amd/init.c | 21 +++- drivers/iommu/amd/iommu.c | 19 ++- drivers/iommu/intel/iommu.c | 14 +-- drivers/iommu/intel/irq_remapping.c | 10 +- drivers/irqchip/irq-ingenic.c | 2 +- drivers/md/dm-cache-metadata.c | 8 +- drivers/md/dm-crypt.c | 4 +- drivers/md/dm-integrity.c | 12 ++ drivers/md/dm-mpath.c | 22 ++-- drivers/md/dm-thin-metadata.c | 10 +- drivers/md/dm-writecache.c | 12 +- drivers/md/persistent-data/dm-block-manager.c | 14 ++- drivers/media/i2c/Kconfig | 2 +- drivers/media/rc/rc-main.c | 44 ++++--- drivers/media/test-drivers/vicodec/vicodec-core.c | 1 + drivers/misc/habanalabs/device.c | 7 +- drivers/misc/habanalabs/firmware_if.c | 9 ++ drivers/misc/habanalabs/gaudi/gaudi.c | 90 ++++++++++---- drivers/misc/habanalabs/gaudi/gaudiP.h | 3 +- drivers/misc/habanalabs/gaudi/gaudi_coresight.c | 8 +- drivers/misc/habanalabs/goya/goya.c | 31 +++++ drivers/misc/habanalabs/goya/goya_coresight.c | 8 +- drivers/misc/habanalabs/habanalabs.h | 7 +- drivers/misc/habanalabs/memory.c | 9 +- drivers/misc/habanalabs/mmu.c | 2 +- drivers/misc/habanalabs/pci.c | 6 +- drivers/misc/habanalabs/sysfs.c | 7 +- drivers/mmc/host/mtk-sd.c | 13 ++ drivers/mmc/host/sdhci-acpi.c | 67 +++++++++-- drivers/mmc/host/sdhci-pci-core.c | 10 +- drivers/mmc/host/sdhci-tegra.c | 53 +++++++- drivers/net/dsa/mt7530.c | 2 +- drivers/net/ethernet/arc/emac_mdio.c | 1 + drivers/net/ethernet/broadcom/bcmsysport.c | 6 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 36 +++--- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 16 +-- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 2 +- drivers/net/ethernet/broadcom/tg3.c | 17 ++- drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c | 8 +- drivers/net/ethernet/cortina/gemini.c | 34 +++--- drivers/net/ethernet/hisilicon/hns/hns_enet.c | 9 +- drivers/net/ethernet/mellanox/mlx4/mr.c | 2 +- .../ethernet/netronome/nfp/flower/tunnel_conf.c | 2 + drivers/net/ethernet/renesas/ravb_main.c | 110 ++++++++--------- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 2 + drivers/net/ethernet/ti/cpsw.c | 2 +- drivers/net/ethernet/ti/cpsw_new.c | 29 +++-- drivers/net/gtp.c | 1 + drivers/net/phy/dp83867.c | 4 +- drivers/net/usb/asix_common.c | 2 +- drivers/nvme/host/core.c | 2 +- drivers/nvme/target/core.c | 6 + drivers/nvme/target/fc.c | 4 +- drivers/opp/core.c | 22 +++- drivers/opp/opp.h | 2 +- drivers/staging/media/sunxi/cedrus/cedrus.c | 7 +- drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 4 +- .../thermal/ti-soc-thermal/omap4-thermal-data.c | 23 ++-- drivers/thermal/ti-soc-thermal/omap4xxx-bandgap.h | 10 +- drivers/tty/serial/qcom_geni_serial.c | 2 +- drivers/xen/xenbus/xenbus_client.c | 10 +- fs/affs/amigaffs.c | 27 +++++ fs/affs/file.c | 26 +++- fs/afs/fs_probe.c | 4 +- fs/afs/vl_probe.c | 4 +- fs/btrfs/block-group.c | 4 +- fs/btrfs/ctree.c | 6 +- fs/btrfs/extent-tree.c | 2 +- fs/btrfs/extent_io.c | 8 +- fs/btrfs/extent_io.h | 6 +- fs/btrfs/free-space-tree.c | 4 + fs/btrfs/ioctl.c | 27 +++-- fs/btrfs/scrub.c | 122 +++++++++++-------- fs/btrfs/tree-checker.c | 2 +- fs/btrfs/volumes.c | 3 +- fs/ceph/file.c | 1 + fs/eventpoll.c | 6 +- fs/ext2/file.c | 6 +- fs/gfs2/log.c | 31 +++++ fs/gfs2/trans.c | 1 + fs/io_uring.c | 16 ++- fs/xfs/libxfs/xfs_attr_leaf.c | 4 +- fs/xfs/libxfs/xfs_bmap.c | 2 +- fs/xfs/xfs_bmap_util.c | 2 +- fs/xfs/xfs_file.c | 12 +- include/drm/drm_hdcp.h | 3 + include/linux/bvec.h | 9 +- include/linux/libata.h | 1 + include/linux/log2.h | 2 +- include/linux/netfilter/nfnetlink.h | 3 +- include/net/af_rxrpc.h | 2 +- include/net/netfilter/nf_tables.h | 2 + include/trace/events/rxrpc.h | 27 ++++- include/uapi/linux/netfilter/nf_tables.h | 2 +- kernel/bpf/syscall.c | 2 +- mm/hugetlb.c | 49 ++++++-- mm/khugepaged.c | 2 +- mm/madvise.c | 2 +- mm/memory.c | 36 ++++-- mm/migrate.c | 17 ++- mm/rmap.c | 9 +- mm/slub.c | 12 +- net/batman-adv/bat_v_ogm.c | 11 +- net/batman-adv/bridge_loop_avoidance.c | 5 +- net/batman-adv/gateway_client.c | 6 +- net/bluetooth/hci_core.c | 2 +- net/netfilter/nf_conntrack_proto_udp.c | 26 ++-- net/netfilter/nf_tables_api.c | 64 +++++----- net/netfilter/nfnetlink.c | 11 +- net/netfilter/nfnetlink_log.c | 3 +- net/netfilter/nfnetlink_queue.c | 2 +- net/netfilter/nft_flow_offload.c | 2 +- net/netfilter/nft_payload.c | 4 +- net/packet/af_packet.c | 7 +- net/rxrpc/ar-internal.h | 13 +- net/rxrpc/call_object.c | 1 + net/rxrpc/input.c | 123 +++++++++++-------- net/rxrpc/output.c | 82 +++++++++---- net/rxrpc/peer_object.c | 16 ++- net/rxrpc/rtt.c | 3 +- net/wireless/reg.c | 3 + scripts/checkpatch.pl | 4 +- scripts/kconfig/streamline_config.pl | 5 +- sound/core/oss/mulaw.c | 4 +- sound/firewire/digi00x/digi00x.c | 5 + sound/firewire/tascam/tascam.c | 33 ++++- sound/pci/ca0106/ca0106_main.c | 3 +- sound/pci/hda/hda_intel.c | 2 - sound/pci/hda/patch_hdmi.c | 1 + sound/pci/hda/patch_realtek.c | 46 ++++++- sound/usb/pcm.c | 2 + sound/usb/quirks-table.h | 60 +++++++-- sound/usb/quirks.c | 1 + tools/include/uapi/linux/perf_event.h | 2 +- tools/perf/Documentation/perf-stat.txt | 3 + tools/perf/bench/synthesize.c | 4 +- tools/perf/builtin-record.c | 2 +- tools/perf/builtin-sched.c | 6 +- tools/perf/builtin-stat.c | 8 +- tools/perf/builtin-top.c | 2 + tools/perf/pmu-events/jevents.c | 2 +- tools/perf/ui/browsers/hists.c | 3 +- tools/perf/util/cs-etm.c | 9 +- tools/perf/util/intel-pt.c | 9 +- tools/perf/util/stat.h | 1 + tools/testing/selftests/bpf/test_maps.c | 2 + 207 files changed, 2040 insertions(+), 783 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/186 hwmon: (pmbus/isl68137) remove READ_TEMPERATURE_1 telemetry for RAA228228
From: Grant Peltier <[email protected]>
[ Upstream commit 51fb91ed5a6fa855a74731610cd5435d83d6e17f ]
Per the RAA228228 datasheet, READ_TEMPERATURE_1 is not a supported PMBus command.
--- drivers/hwmon/pmbus/isl68137.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/hwmon/pmbus/isl68137.c +6 -1
@@ -67,6 +67,7 @@ enum variants { raa_dmpvr1_2rail, raa_dmpvr2_1rail, raa_dmpvr2_2rail, + raa_dmpvr2_2rail_nontc, raa_dmpvr2_3rail, raa_dmpvr2_hv, };
@@ -241,6 +242,10 @@ static int isl68137_probe(struct i2c_client *client, info->pages =1 ; info->read_word_data = raa_dmpvr2_read_word_data;break ; +case raa_dmpvr2_2rail_nontc: + info->func[0 ] &= ~PMBUS_HAVE_TEMP ; + info->func[1 ] &= ~PMBUS_HAVE_TEMP ; + fallthrough;case raa_dmpvr2_2rail: info->pages =2 ; info->read_word_data = raa_dmpvr2_read_word_data;
@@ -304,7 +309,7 @@ static const struct i2c_device_id raa_dmpvr_id[] = { {"raa228000", raa_dmpvr2_hv}, {"raa228004", raa_dmpvr2_hv}, {"raa228006", raa_dmpvr2_hv}, - {"raa228228", raa_dmpvr2_2rail}, + {"raa228228", raa_dmpvr2_2rail_nontc}, {"raa229001", raa_dmpvr2_2rail}, {"raa229004", raa_dmpvr2_2rail}, {}
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 2/186 HID: quirks: Always poll three more Lenovo PixArt mice
In reply to Greg Kroah-HartmanFrom: Sebastian Parschauer <[email protected]>
[ Upstream commit 627a49975bdc3220f360a8237603a6344ee6a588 ]
The PixArt OEM mice are known for disconnecting every minute in runlevel 1 or 3 if they are not always polled. One Lenovo PixArt mouse is already fixed. Got two references for 17ef:602e and three references for 17ef:6019 misbehaving like this. Got one direct bug report for 17ef:6093 from Wyatt Ward (wyatt8740). So add HID_QUIRK_ALWAYS_POLL for all of them.
--- drivers/hid/hid-ids.h | 3 +++ drivers/hid/hid-quirks.c | 3 +++ 2 files changed, 6 insertions(+)
drivers/hid/hid-ids.h +3 -0
@@ -727,6 +727,9 @@#define USB_DEVICE_ID_LENOVO_TPPRODOCK 0x6067#define USB_DEVICE_ID_LENOVO_X1_COVER 0x6085#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D 0x608d +#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_6019 0x6019 +#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_602E 0x602e +#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_6093 0x6093#define USB_VENDOR_ID_LG 0x1fd2#define USB_DEVICE_ID_LG_MULTITOUCH 0x0064
drivers/hid/hid-quirks.c +3 -0
@@ -105,6 +105,9 @@ static const struct hid_device_id hid_quirks[] = { { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M406XE), HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE_ID2), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D), HID_QUIRK_ALWAYS_POLL }, + { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_6019), HID_QUIRK_ALWAYS_POLL }, + { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_602E), HID_QUIRK_ALWAYS_POLL }, + { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_6093), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C007), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KEYBOARD_G710_PLUS), HID_QUIRK_NOGET },
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 3/186 drm/msm/dpu: Fix reservation failures in modeset
In reply to Greg Kroah-HartmanFrom: Kalyan Thota <[email protected]>
[ Upstream commit ccc862b957c6413b008fbe458034372847992d7f ]
In TEST_ONLY commit, rm global_state will duplicate the object and request for new reservations, once they pass then the new state will be swapped with the old and will be available for the Atomic Commit.
This patch fixes some of missing links in the resource reservation sequence mentioned above.
1) Creation of duplicate state in test_only commit (Rob)
2) Allocate and release the resources on every modeset.
3) Avoid allocation only when active is false.
In a modeset operation, swap state happens well before disable. Hence clearing reservations in disable will cause failures in modeset enable.
Allow reservations to be cleared/allocated before swap, such that only newly committed resources are pushed to HW.
Changes in v1:
- Move the rm release to atomic_check.
- Ensure resource allocation and free happens when active is not changed i.e only when mode is changed.(Rob)
Changes in v2:
- Handle dpu_kms_get_global_state API failure as it may return EDEADLK (swboyd).
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +11 -9
@@ -586,7 +586,10 @@ static int dpu_encoder_virt_atomic_check( dpu_kms =to_dpu_kms (priv->kms); mode = &crtc_state->mode; adj_mode = &crtc_state->adjusted_mode; - global_state =dpu_kms_get_existing_global_state (dpu_kms); + global_state =dpu_kms_get_global_state (crtc_state->state); +if (IS_ERR (global_state)) +return PTR_ERR (global_state); +trace_dpu_enc_atomic_check (DRMID (drm_enc));/*
@@ -621,12 +624,15 @@ static int dpu_encoder_virt_atomic_check(/* Reserve dynamic resources now. */ if (!ret) {/* -* Avoid reserving resources when mode set is pending. Topology -* info may not be available to complete reservation. +* Release and Allocate resources on every modeset +* Dont allocate when active is false. */ if (drm_atomic_crtc_needs_modeset (crtc_state)) { - ret =dpu_rm_reserve (&dpu_kms->rm, global_state, - drm_enc, crtc_state, topology); +dpu_rm_release (global_state, drm_enc); + +if (!crtc_state->active_changed || crtc_state->active) + ret =dpu_rm_reserve (&dpu_kms->rm, global_state, + drm_enc, crtc_state, topology); } }
@@ -1175,7 +1181,6 @@ static void dpu_encoder_virt_disable(struct drm_encoder *drm_enc)struct dpu_encoder_virt *dpu_enc =NULL ;struct msm_drm_private *priv;struct dpu_kms *dpu_kms; -struct dpu_global_state *global_state;int i =0 ;if (!drm_enc) {
@@ -1194,7 +1199,6 @@ static void dpu_encoder_virt_disable(struct drm_encoder *drm_enc) priv = drm_enc->dev->dev_private; dpu_kms =to_dpu_kms (priv->kms); - global_state =dpu_kms_get_existing_global_state (dpu_kms);trace_dpu_enc_disable (DRMID (drm_enc));
@@ -1224,8 +1228,6 @@ static void dpu_encoder_virt_disable(struct drm_encoder *drm_enc)DPU_DEBUG_ENC (dpu_enc,"encoder disabled\n" ); -dpu_rm_release (global_state, drm_enc); -mutex_unlock (&dpu_enc->enc_lock); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 4/186 drm/msm/dpu: Fix scale params in plane validation
In reply to Greg Kroah-HartmanFrom: Kalyan Thota <[email protected]>
[ Upstream commit 4c978caf08aa155bdeadd9e2d4b026d4ce97ebd0 ]
Plane validation uses an API drm_calc_scale which will return src/dst value as a scale ratio.
when viewing the range on a scale the values should fall in as
Upscale ratio < Unity scale < Downscale ratio for src/dst formula
Fix the min and max scale ratios to suit the API accordingly.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +2 -2
@@ -866,9 +866,9 @@ static int dpu_plane_atomic_check(struct drm_plane *plane, crtc_state =drm_atomic_get_new_crtc_state (state->state, state->crtc); - min_scale =FRAC_16_16 (1 , pdpu->pipe_sblk->maxdwnscale); + min_scale =FRAC_16_16 (1 , pdpu->pipe_sblk->maxupscale); ret =drm_atomic_helper_check_plane_state (state, crtc_state, min_scale, - pdpu->pipe_sblk->maxupscale <<16 , + pdpu->pipe_sblk->maxdwnscale <<16 , true, true);if (ret) {DPU_DEBUG_PLANE (pdpu,"Check plane state failed (%d)\n" , ret);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 5/186 drm/msm/dpu: fix unitialized variable error
In reply to Greg Kroah-HartmanFrom: Rob Clark <[email protected]>
[ Upstream commit 35c719da95c0d28560bff7bafeaf07ebb212665e ]
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c:817 dpu_crtc_enable() error: uninitialized symbol 'request_bandwidth'.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +1 -1
@@ -827,7 +827,7 @@ static void dpu_crtc_enable(struct drm_crtc *crtc, {struct dpu_crtc *dpu_crtc;struct drm_encoder *encoder; -bool request_bandwidth; +bool request_bandwidth = false;if (!crtc) {DPU_ERROR ("invalid crtc\n" );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 6/186 tty: serial: qcom_geni_serial: Drop __init from qcom_geni_console_setup
In reply to Greg Kroah-HartmanFrom: John Stultz <[email protected]>
[ Upstream commit 975efc66d4e654207c17f939eb737ac591ac38fe ]
When booting with heavily modularized config, the serial console may not be able to load until after init when modules that satisfy needed dependencies have time to load.
Unfortunately, as qcom_geni_console_setup is marked as __init, the function may have been freed before we get to run it, causing boot time crashes such as:
[ 6.469057] Unable to handle kernel paging request at virtual address ffffffe645d4e6cc [ 6.481623] Mem abort info: [ 6.484466] ESR = 0x86000007 [ 6.487557] EC = 0x21: IABT (current EL), IL = 32 bits [ 6.492929] SET = 0, FnV = 0g [ 6.496016] EA = 0, S1PTW = 0 [ 6.499202] swapper pgtable: 4k pages, 39-bit VAs, pgdp=000000008151e000 [ 6.501286] ufshcd-qcom 1d84000.ufshc: ufshcd_print_pwr_info:[RX, TX]: gear=[3, 3], lane[2, 2], pwr[FAST MODE, FAST MODE], rate = 2 [ 6.505977] [ffffffe645d4e6cc] pgd=000000017df9f003, p4d=000000017df9f003, pud=000000017df9f003, pmd=000000017df9c003, pte=0000000000000000 [ 6.505990] Internal error: Oops: 86000007 [#1] PREEMPT SMP [ 6.505995] Modules linked in: zl10353 zl10039 zl10036 zd1301_demod xc5000 xc4000 ves1x93 ves1820 tuner_xc2028 tuner_simple tuner_types tua9001 tua6100 1 [ 6.506152] isl6405 [ 6.518104] ufshcd-qcom 1d84000.ufshc: ufshcd_find_max_sup_active_icc_level: Regulator capability was not set, actvIccLevel=0 [ 6.530549] horus3a helene fc2580 fc0013 fc0012 fc0011 ec100 e4000 dvb_pll ds3000 drxk drxd drx39xyj dib9000 dib8000 dib7000p dib7000m dib3000mc dibx003 [ 6.624271] CPU: 7 PID: 148 Comm: kworker/7:2 Tainted: G W 5.8.0-mainline-12021-g6defd37ba1cd #3455 [ 6.624273] Hardware name: Thundercomm Dragonboard 845c (DT) [ 6.624290] Workqueue: events deferred_probe_work_func [ 6.624296] pstate: 40c00005 (nZcv daif +PAN +UAO BTYPE=--) [ 6.624307] pc : qcom_geni_console_setup+0x0/0x110 [ 6.624316] lr : try_enable_new_console+0xa0/0x140 [ 6.624318] sp : ffffffc010843a30 [ 6.624320] x29: ffffffc010843a30 x28: ffffffe645c3e7d0 [ 6.624325] x27: ffffff80f8022180 x26: ffffffc010843b28 [ 6.637937] x25: 0000000000000000 x24: ffffffe6462a2000 [ 6.637941] x23: ffffffe646398000 x22: 0000000000000000 [ 6.637945] x21: 0000000000000000 x20: ffffffe6462a5ce8 [ 6.637952] x19: ffffffe646398e38 x18: ffffffffffffffff [ 6.680296] x17: 0000000000000000 x16: ffffffe64492b900 [ 6.680300] x15: ffffffe6461e9d08 x14: 69202930203d2064 [ 6.680305] x13: 7561625f65736162 x12: 202c363331203d20 [ 6.696434] x11: 0000000000000030 x10: 0101010101010101 [ 6.696438] x9 : 4d4d20746120304d x8 : 7f7f7f7f7f7f7f7f [ 6.707249] x7 : feff4c524c787373 x6 : 0000000000008080 [ 6.707253] x5 : 0000000000000000 x4 : 8080000000000000 [ 6.707257] x3 : 0000000000000000 x2 : ffffffe645d4e6cc [ 6.744223] qcom_geni_serial 898000.serial: dev_pm_opp_set_rate: failed to find OPP for freq 102400000 (-34) [ 6.744966] x1 : fffffffefe74e174 x0 : ffffffe6462a5ce8 [ 6.753580] qcom_geni_serial 898000.serial: dev_pm_opp_set_rate: failed to find OPP for freq 102400000 (-34) [ 6.761634] Call trace: [ 6.761639] qcom_geni_console_setup+0x0/0x110 [ 6.761645] register_console+0x29c/0x2f8 [ 6.767981] Bluetooth: hci0: Frame reassembly failed (-84) [ 6.775252] uart_add_one_port+0x438/0x500 [ 6.775258] qcom_geni_serial_probe+0x2c4/0x4a8 [ 6.775266] platform_drv_probe+0x58/0xa8 [ 6.855359] really_probe+0xec/0x398 [ 6.855362] driver_probe_device+0x5c/0xb8 [ 6.855367] __device_attach_driver+0x98/0xb8 [ 7.184945] bus_for_each_drv+0x74/0xd8 [ 7.188825] __device_attach+0xec/0x148 [ 7.192705] device_initial_probe+0x24/0x30 [ 7.196937] bus_probe_device+0x9c/0xa8 [ 7.200816] deferred_probe_work_func+0x7c/0xb8 [ 7.205398] process_one_work+0x20c/0x4b0 [ 7.209456] worker_thread+0x48/0x460 [ 7.213157] kthread+0x14c/0x158 [ 7.216432] ret_from_fork+0x10/0x18 [ 7.220049] Code: bad PC value [ 7.223139] ---[ end trace 73f3b21e251d5a70 ]---
Thus this patch removes the __init avoiding crash in such configs.
--- drivers/tty/serial/qcom_geni_serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/qcom_geni_serial.c +1 -1
@@ -1047,7 +1047,7 @@ static unsigned int qcom_geni_serial_tx_empty(struct uart_port *uport) }#ifdef CONFIG_SERIAL_QCOM_GENI_CONSOLE -static int __init qcom_geni_console_setup (struct console *co,char *options) +static int qcom_geni_console_setup (struct console *co,char *options) {struct uart_port *uport;struct qcom_geni_serial_port *port;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 7/186 drm/msm: add shutdown support for display platform_driver
In reply to Greg Kroah-HartmanFrom: Krishna Manikandan <[email protected]>
[ Upstream commit 9d5cbf5fe46e350715389d89d0c350d83289a102 ]
Define shutdown callback for display drm driver, so as to disable all the CRTCS when shutdown notification is received by the driver.
This change will turn off the timing engine so that no display transactions are requested while mmu translations are getting disabled during reboot sequence.
Changes in v2:
- Remove NULL check from msm_pdev_shutdown (Stephen Boyd)
- Change commit text to reflect when this issue was uncovered (Sai Prakash Ranjan)
--- drivers/gpu/drm/msm/msm_drv.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/msm/msm_drv.c +8 -0
@@ -1328,6 +1328,13 @@ static int msm_pdev_remove(struct platform_device *pdev)return 0 ; } +static void msm_pdev_shutdown (struct platform_device *pdev) +{ +struct drm_device *drm =platform_get_drvdata (pdev); + +drm_atomic_helper_shutdown (drm); +} +static const struct of_device_id dt_match[] = { { .compatible ="qcom,mdp4" , .data = (void *)KMS_MDP4 }, { .compatible ="qcom,mdss" , .data = (void *)KMS_MDP5 },
@@ -1340,6 +1347,7 @@ MODULE_DEVICE_TABLE(of, dt_match);static struct platform_driver msm_platform_driver = { .probe = msm_pdev_probe, .remove = msm_pdev_remove, + .shutdown = msm_pdev_shutdown, .driver = { .name ="msm" , .of_match_table = dt_match,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 8/186 hwmon: (applesmc) check status earlier.
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit cecf7560f00a8419396a2ed0f6e5d245ccb4feac ]
clang static analysis reports this representative problem
applesmc.c:758:10: warning: 1st function call argument is an
uninitialized value
left = be16_to_cpu(*(__be16 *)(buffer + 6)) >> 2;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~buffer is filled by the earlier call
ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, ...
This problem is reported because a goto skips the status check. Other similar problems use data from applesmc_read_key before checking the status. So move the checks to before the use.
--- drivers/hwmon/applesmc.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-)
drivers/hwmon/applesmc.c +16 -15
@@ -753,15 +753,18 @@ static ssize_t applesmc_light_show(struct device *dev, } ret =applesmc_read_key (LIGHT_SENSOR_LEFT_KEY , buffer, data_length); +if (ret) + goto out;/* newer macbooks report a single 10-bit bigendian value */ if (data_length ==10 ) { left =be16_to_cpu (*(__be16 *)(buffer +6 )) >>2 ; goto out; } left = buffer[2 ]; + + ret =applesmc_read_key (LIGHT_SENSOR_RIGHT_KEY , buffer, data_length);if (ret) goto out; - ret =applesmc_read_key (LIGHT_SENSOR_RIGHT_KEY , buffer, data_length); right = buffer[2 ]; out:
@@ -810,12 +813,11 @@ static ssize_t applesmc_show_fan_speed(struct device *dev, to_index(attr)); ret =applesmc_read_key (newkey, buffer,2 ); - speed = ((buffer[0 ] <<8 | buffer[1 ]) >>2 ); -if (ret)return ret; -else -return snprintf (sysfsbuf,PAGE_SIZE ,"%u\n" , speed); + + speed = ((buffer[0 ] <<8 | buffer[1 ]) >>2 ); +return snprintf (sysfsbuf,PAGE_SIZE ,"%u\n" , speed); } static ssize_t applesmc_store_fan_speed(struct device *dev,
@@ -851,12 +853,11 @@ static ssize_t applesmc_show_fan_manual(struct device *dev,u8 buffer[2 ]; ret =applesmc_read_key (FANS_MANUAL , buffer,2 ); - manual = ((buffer[0 ] <<8 | buffer[1 ]) >>to_index (attr)) &0x01 ; -if (ret)return ret; -else -return snprintf (sysfsbuf,PAGE_SIZE ,"%d\n" , manual); + + manual = ((buffer[0 ] <<8 | buffer[1 ]) >>to_index (attr)) &0x01 ; +return snprintf (sysfsbuf,PAGE_SIZE ,"%d\n" , manual); } static ssize_t applesmc_store_fan_manual(struct device *dev,
@@ -872,10 +873,11 @@ static ssize_t applesmc_store_fan_manual(struct device *dev,return -EINVAL ; ret =applesmc_read_key (FANS_MANUAL , buffer,2 ); - val = (buffer[0 ] <<8 | buffer[1 ]);if (ret) goto out; + val = (buffer[0 ] <<8 | buffer[1 ]); +if (input) val = val | (0x01 <<to_index (attr));else
@@ -951,13 +953,12 @@ static ssize_t applesmc_key_count_show(struct device *dev,u32 count; ret =applesmc_read_key (KEY_COUNT_KEY , buffer,4 ); - count = ((u32 )buffer[0 ]<<24 ) + ((u32 )buffer[1 ]<<16 ) + - ((u32 )buffer[2 ]<<8 ) + buffer[3 ]; -if (ret)return ret; -else -return snprintf (sysfsbuf,PAGE_SIZE ,"%d\n" , count); + + count = ((u32 )buffer[0 ]<<24 ) + ((u32 )buffer[1 ]<<16 ) + + ((u32 )buffer[2 ]<<8 ) + buffer[3 ]; +return snprintf (sysfsbuf,PAGE_SIZE ,"%d\n" , count); } static ssize_t applesmc_key_at_index_read_show(struct device *dev,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 9/186 nvmet: Disable keep-alive timer when kato is cleared to 0h
In reply to Greg Kroah-HartmanFrom: Amit Engel <[email protected]>
[ Upstream commit 0d3b6a8d213a30387b5104b2fb25376d18636f23 ]
Based on nvme spec, when keep alive timeout is set to zero the keep-alive timer should be disabled.
--- drivers/nvme/target/core.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/nvme/target/core.c +6 -0
@@ -396,6 +396,9 @@ static void nvmet_keep_alive_timer(struct work_struct *work)static void nvmet_start_keep_alive_timer (struct nvmet_ctrl *ctrl) { +if (unlikely (ctrl->kato ==0 )) +return ; +pr_debug ("ctrl %d start keep-alive timer for %d secs\n" , ctrl->cntlid, ctrl->kato);
@@ -405,6 +408,9 @@ static void nvmet_start_keep_alive_timer(struct nvmet_ctrl *ctrl)static void nvmet_stop_keep_alive_timer (struct nvmet_ctrl *ctrl) { +if (unlikely (ctrl->kato ==0 )) +return ; +pr_debug ("ctrl %d stop keep-alive\n" , ctrl->cntlid);cancel_delayed_work_sync (&ctrl->ka_work);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 10/186 drm/msm: enable vblank during atomic commits
In reply to Greg Kroah-HartmanFrom: Rob Clark <[email protected]>
[ Upstream commit 43906812eaab06423f56af5cca9a9fcdbb4ac454 ]
This has roughly the same effect as drm_atomic_helper_wait_for_vblanks(), basically just ensuring that vblank accounting is enabled so that we get valid timestamp/seqn on pageflip events.
--- drivers/gpu/drm/msm/msm_atomic.c | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
drivers/gpu/drm/msm/msm_atomic.c +36 -0
@@ -27,6 +27,34 @@ int msm_atomic_prepare_fb(struct drm_plane *plane,return msm_framebuffer_prepare (new_state->fb, kms->aspace); } +/* +* Helpers to control vblanks while we flush.. basically just to ensure +* that vblank accounting is switched on, so we get valid seqn/timestamp +* on pageflip events (if requested) +*/ + +static void vblank_get (struct msm_kms *kms,unsigned crtc_mask) +{ +struct drm_crtc *crtc; + +for_each_crtc_mask (kms->dev, crtc, crtc_mask) { +if (!crtc->state->active) +continue ; +drm_crtc_vblank_get (crtc); + } +} + +static void vblank_put (struct msm_kms *kms,unsigned crtc_mask) +{ +struct drm_crtc *crtc; + +for_each_crtc_mask (kms->dev, crtc, crtc_mask) { +if (!crtc->state->active) +continue ; +drm_crtc_vblank_put (crtc); + } +} +static void msm_atomic_async_commit (struct msm_kms *kms,int crtc_idx) {unsigned crtc_mask =BIT (crtc_idx);
@@ -44,6 +72,8 @@ static void msm_atomic_async_commit(struct msm_kms *kms, int crtc_idx) kms->funcs->enable_commit (kms); +vblank_get (kms, crtc_mask); +/* * Flush hardware updates: */
@@ -58,6 +88,8 @@ static void msm_atomic_async_commit(struct msm_kms *kms, int crtc_idx) kms->funcs->wait_flush (kms, crtc_mask);trace_msm_atomic_wait_flush_finish (crtc_mask); +vblank_put (kms, crtc_mask); +mutex_lock (&kms->commit_lock); kms->funcs->complete_commit (kms, crtc_mask);mutex_unlock (&kms->commit_lock);
@@ -221,6 +253,8 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state)*/ kms->pending_crtc_mask &= ~crtc_mask; +vblank_get (kms, crtc_mask); +/* * Flush hardware updates: */
@@ -235,6 +269,8 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state) kms->funcs->wait_flush (kms, crtc_mask);trace_msm_atomic_wait_flush_finish (crtc_mask); +vblank_put (kms, crtc_mask); +mutex_lock (&kms->commit_lock); kms->funcs->complete_commit (kms, crtc_mask);mutex_unlock (&kms->commit_lock);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 11/186 habanalabs: unmap PCI bars upon iATU failure
In reply to Greg Kroah-HartmanFrom: Ofir Bitton <[email protected]>
[ Upstream commit f1aae40e8dbd2655e3b10cae381a1e8292b19d57 ]
In case the driver fails to configure the PCI controller iATU, it needs to unmap the PCI bars before exiting so if the driver is removed, the bars won't be left mapped.
--- drivers/misc/habanalabs/pci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/misc/habanalabs/pci.c +4 -2
@@ -378,15 +378,17 @@ int hl_pci_init(struct hl_device *hdev) rc = hdev->asic_funcs->init_iatu (hdev);if (rc) {dev_err (hdev->dev,"Failed to initialize iATU\n" ); - goto disable_device; + goto unmap_pci_bars; } rc =hl_pci_set_dma_mask (hdev);if (rc) - goto disable_device; + goto unmap_pci_bars;return 0 ; +unmap_pci_bars: +hl_pci_bars_unmap (hdev); disable_device:pci_clear_master (pdev);pci_disable_device (pdev);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 12/186 habanalabs: validate packet id during CB parse
In reply to Greg Kroah-HartmanFrom: Ofir Bitton <[email protected]>
[ Upstream commit bc75be24fa88ef10eecaff2b2a9ada8189e5ab5d ]
During command buffer parsing, driver extracts packet id from user buffer. Driver must validate this packet id, since it is being used in order to extract information from internal structures.
--- drivers/misc/habanalabs/gaudi/gaudi.c | 35 +++++++++++++++++++++++++++ drivers/misc/habanalabs/goya/goya.c | 31 ++++++++++++++++++++++++ 2 files changed, 66 insertions(+)
drivers/misc/habanalabs/gaudi/gaudi.c +35 -0
@@ -154,6 +154,29 @@ static const u16 gaudi_packet_sizes[MAX_PACKET_ID] = { [PACKET_LOAD_AND_EXE ] =sizeof (struct packet_load_and_exe ) }; +static inline bool validate_packet_id (enum packet_id id) +{ +switch (id) { +case PACKET_WREG_32 : +case PACKET_WREG_BULK : +case PACKET_MSG_LONG : +case PACKET_MSG_SHORT : +case PACKET_CP_DMA : +case PACKET_REPEAT : +case PACKET_MSG_PROT : +case PACKET_FENCE : +case PACKET_LIN_DMA : +case PACKET_NOP : +case PACKET_STOP : +case PACKET_ARB_POINT : +case PACKET_WAIT : +case PACKET_LOAD_AND_EXE : +return true; +default : +return false; + } +} +static const char *const gaudi_tpc_interrupts_cause[GAUDI_NUM_OF_TPC_INTR_CAUSE ] = {"tpc_address_exceed_slm" ,
@@ -3859,6 +3882,12 @@ static int gaudi_validate_cb(struct hl_device *hdev, PACKET_HEADER_PACKET_ID_MASK) >> PACKET_HEADER_PACKET_ID_SHIFT); +if (!validate_packet_id (pkt_id)) { +dev_err (hdev->dev,"Invalid packet id %u\n" , pkt_id); + rc = -EINVAL ; +break ; + } + pkt_size = gaudi_packet_sizes[pkt_id]; cb_parsed_length += pkt_size;if (cb_parsed_length > parser->user_cb_size) {
@@ -4082,6 +4111,12 @@ static int gaudi_patch_cb(struct hl_device *hdev, PACKET_HEADER_PACKET_ID_MASK) >> PACKET_HEADER_PACKET_ID_SHIFT); +if (!validate_packet_id (pkt_id)) { +dev_err (hdev->dev,"Invalid packet id %u\n" , pkt_id); + rc = -EINVAL ; +break ; + } + pkt_size = gaudi_packet_sizes[pkt_id]; cb_parsed_length += pkt_size;if (cb_parsed_length > parser->user_cb_size) {
drivers/misc/habanalabs/goya/goya.c +31 -0
@@ -139,6 +139,25 @@ static u16 goya_packet_sizes[MAX_PACKET_ID] = { [PACKET_STOP ] =sizeof (struct packet_stop ) }; +static inline bool validate_packet_id (enum packet_id id) +{ +switch (id) { +case PACKET_WREG_32 : +case PACKET_WREG_BULK : +case PACKET_MSG_LONG : +case PACKET_MSG_SHORT : +case PACKET_CP_DMA : +case PACKET_MSG_PROT : +case PACKET_FENCE : +case PACKET_LIN_DMA : +case PACKET_NOP : +case PACKET_STOP : +return true; +default : +return false; + } +} +static u64 goya_mmu_regs[GOYA_MMU_REGS_NUM ] = { mmDMA_QM_0_GLBL_NON_SECURE_PROPS, mmDMA_QM_1_GLBL_NON_SECURE_PROPS,
@@ -3381,6 +3400,12 @@ static int goya_validate_cb(struct hl_device *hdev, PACKET_HEADER_PACKET_ID_MASK) >> PACKET_HEADER_PACKET_ID_SHIFT); +if (!validate_packet_id (pkt_id)) { +dev_err (hdev->dev,"Invalid packet id %u\n" , pkt_id); + rc = -EINVAL ; +break ; + } + pkt_size = goya_packet_sizes[pkt_id]; cb_parsed_length += pkt_size;if (cb_parsed_length > parser->user_cb_size) {
@@ -3616,6 +3641,12 @@ static int goya_patch_cb(struct hl_device *hdev, PACKET_HEADER_PACKET_ID_MASK) >> PACKET_HEADER_PACKET_ID_SHIFT); +if (!validate_packet_id (pkt_id)) { +dev_err (hdev->dev,"Invalid packet id %u\n" , pkt_id); + rc = -EINVAL ; +break ; + } + pkt_size = goya_packet_sizes[pkt_id]; cb_parsed_length += pkt_size;if (cb_parsed_length > parser->user_cb_size) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 13/186 habanalabs: set clock gating according to mask
In reply to Greg Kroah-HartmanFrom: Ofir Bitton <[email protected]>
[ Upstream commit f44d23b9095abd91dad9f5f3add2a3149833ec83 ]
Once clock gating is set we enable clock gating according to mask, we should also disable clock gating according to relevant bits.
--- drivers/misc/habanalabs/gaudi/gaudi.c | 44 +++++++++++++-------------- 1 file changed, 21 insertions(+), 23 deletions(-)
drivers/misc/habanalabs/gaudi/gaudi.c +21 -23
@@ -2564,6 +2564,7 @@ static void gaudi_set_clock_gating(struct hl_device *hdev) {struct gaudi_device *gaudi = hdev->asic_specific;u32 qman_offset; +bool enable;int i;/* In case we are during debug session, don't enable the clock gate
@@ -2573,46 +2574,43 @@ static void gaudi_set_clock_gating(struct hl_device *hdev)return ;for (i =GAUDI_PCI_DMA_1 , qman_offset =0 ; i <GAUDI_HBM_DMA_1 ; i++) { -if (!(hdev->clock_gating_mask & - (BIT_ULL (gaudi_dma_assignment[i])))) -continue ; + enable = !!(hdev->clock_gating_mask & + (BIT_ULL (gaudi_dma_assignment[i]))); qman_offset = gaudi_dma_assignment[i] *DMA_QMAN_OFFSET ; -WREG32 (mmDMA0_QM_CGM_CFG1 + qman_offset,QMAN_CGM1_PWR_GATE_EN ); +WREG32 (mmDMA0_QM_CGM_CFG1 + qman_offset, + enable ?QMAN_CGM1_PWR_GATE_EN :0 );WREG32 (mmDMA0_QM_CGM_CFG + qman_offset, -QMAN_UPPER_CP_CGM_PWR_GATE_EN ); + enable ?QMAN_UPPER_CP_CGM_PWR_GATE_EN :0 ); }for (i =GAUDI_HBM_DMA_1 ; i <GAUDI_DMA_MAX ; i++) { -if (!(hdev->clock_gating_mask & - (BIT_ULL (gaudi_dma_assignment[i])))) -continue ; + enable = !!(hdev->clock_gating_mask & + (BIT_ULL (gaudi_dma_assignment[i]))); qman_offset = gaudi_dma_assignment[i] *DMA_QMAN_OFFSET ; -WREG32 (mmDMA0_QM_CGM_CFG1 + qman_offset,QMAN_CGM1_PWR_GATE_EN ); +WREG32 (mmDMA0_QM_CGM_CFG1 + qman_offset, + enable ?QMAN_CGM1_PWR_GATE_EN :0 );WREG32 (mmDMA0_QM_CGM_CFG + qman_offset, -QMAN_COMMON_CP_CGM_PWR_GATE_EN ); + enable ?QMAN_COMMON_CP_CGM_PWR_GATE_EN :0 ); } -if (hdev->clock_gating_mask & (BIT_ULL (GAUDI_ENGINE_ID_MME_0 ))) { -WREG32 (mmMME0_QM_CGM_CFG1,QMAN_CGM1_PWR_GATE_EN ); -WREG32 (mmMME0_QM_CGM_CFG,QMAN_COMMON_CP_CGM_PWR_GATE_EN ); - } + enable = !!(hdev->clock_gating_mask & (BIT_ULL (GAUDI_ENGINE_ID_MME_0 ))); +WREG32 (mmMME0_QM_CGM_CFG1, enable ?QMAN_CGM1_PWR_GATE_EN :0 ); +WREG32 (mmMME0_QM_CGM_CFG, enable ?QMAN_COMMON_CP_CGM_PWR_GATE_EN :0 ); -if (hdev->clock_gating_mask & (BIT_ULL (GAUDI_ENGINE_ID_MME_2 ))) { -WREG32 (mmMME2_QM_CGM_CFG1,QMAN_CGM1_PWR_GATE_EN ); -WREG32 (mmMME2_QM_CGM_CFG,QMAN_COMMON_CP_CGM_PWR_GATE_EN ); - } + enable = !!(hdev->clock_gating_mask & (BIT_ULL (GAUDI_ENGINE_ID_MME_2 ))); +WREG32 (mmMME2_QM_CGM_CFG1, enable ?QMAN_CGM1_PWR_GATE_EN :0 ); +WREG32 (mmMME2_QM_CGM_CFG, enable ?QMAN_COMMON_CP_CGM_PWR_GATE_EN :0 );for (i =0 , qman_offset =0 ; i <TPC_NUMBER_OF_ENGINES ; i++) { -if (!(hdev->clock_gating_mask & - (BIT_ULL (GAUDI_ENGINE_ID_TPC_0 + i)))) -continue ; + enable = !!(hdev->clock_gating_mask & + (BIT_ULL (GAUDI_ENGINE_ID_TPC_0 + i)));WREG32 (mmTPC0_QM_CGM_CFG1 + qman_offset, -QMAN_CGM1_PWR_GATE_EN ); + enable ?QMAN_CGM1_PWR_GATE_EN :0 );WREG32 (mmTPC0_QM_CGM_CFG + qman_offset, -QMAN_COMMON_CP_CGM_PWR_GATE_EN ); + enable ?QMAN_COMMON_CP_CGM_PWR_GATE_EN :0 ); qman_offset +=TPC_QMAN_OFFSET ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 14/186 habanalabs: proper handling of alloc size in coresight
In reply to Greg Kroah-HartmanFrom: Ofir Bitton <[email protected]>
[ Upstream commit 36545279f076afeb77104f5ffeab850da3b6d107 ]
Allocation size can go up to 64bit but truncated to 32bit, we should make sure it is not truncated and validate no address overflow.
--- drivers/misc/habanalabs/gaudi/gaudi_coresight.c | 8 +++++++- drivers/misc/habanalabs/goya/goya_coresight.c | 8 +++++++- drivers/misc/habanalabs/habanalabs.h | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-)
drivers/misc/habanalabs/gaudi/gaudi_coresight.c +7 -1
@@ -523,7 +523,7 @@ static int gaudi_config_etf(struct hl_device *hdev, }static bool gaudi_etr_validate_address (struct hl_device *hdev,u64 addr, -u32 size,bool *is_host) +u64 size,bool *is_host) {struct asic_fixed_properties *prop = &hdev->asic_prop;struct gaudi_device *gaudi = hdev->asic_specific;
@@ -535,6 +535,12 @@ static bool gaudi_etr_validate_address(struct hl_device *hdev, u64 addr,return false; } +if (addr > (addr + size)) { +dev_err (hdev->dev, +"ETR buffer size %llu overflow\n" , size); +return false; + } +/* PMMU and HPMMU addresses are equal, check only one of them */ if ((gaudi->hw_cap_initialized &HW_CAP_MMU ) && hl_mem_area_inside_range(addr, size,
drivers/misc/habanalabs/goya/goya_coresight.c +7 -1
@@ -358,11 +358,17 @@ static int goya_config_etf(struct hl_device *hdev, }static int goya_etr_validate_address (struct hl_device *hdev,u64 addr, -u32 size) +u64 size) {struct asic_fixed_properties *prop = &hdev->asic_prop;u64 range_start, range_end; +if (addr > (addr + size)) { +dev_err (hdev->dev, +"ETR buffer size %llu overflow\n" , size); +return false; + } +if (hdev->mmu_enable) { range_start = prop->dmmu.start_addr; range_end = prop->dmmu.end_addr;
drivers/misc/habanalabs/habanalabs.h +1 -1
@@ -1587,7 +1587,7 @@ struct hl_ioctl_desc {* * Return: true if the area is inside the valid range, false otherwise. */ -static inline bool hl_mem_area_inside_range (u64 address,u32 size, +static inline bool hl_mem_area_inside_range (u64 address,u64 size,u64 range_start_address,u64 range_end_address) {u64 end_address = address + size;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 15/186 habanalabs: set max power according to card type
In reply to Greg Kroah-HartmanFrom: Oded Gabbay <[email protected]>
[ Upstream commit 58361aae4b0eed388680a89ac153d27177f40510 ]
In Gaudi, the default max power setting is different between PCI and PMC cards. Therefore, the driver need to set the default after knowing what is the card type.
The current code has a bug where it limits the maximum power of the PMC card to 200W after a reset occurs.
--- drivers/misc/habanalabs/device.c | 7 ++++++- drivers/misc/habanalabs/gaudi/gaudi.c | 11 ++++++++++- drivers/misc/habanalabs/gaudi/gaudiP.h | 3 ++- drivers/misc/habanalabs/habanalabs.h | 5 ++++- drivers/misc/habanalabs/sysfs.c | 7 ++++--- 5 files changed, 26 insertions(+), 7 deletions(-)
drivers/misc/habanalabs/device.c +6 -1
@@ -1027,7 +1027,7 @@ again: goto out_err; } -hl_set_max_power (hdev, hdev->max_power); +hl_set_max_power (hdev); }else { rc = hdev->asic_funcs->soft_reset_late_init (hdev);if (rc) {
@@ -1268,6 +1268,11 @@ int hl_device_init(struct hl_device *hdev, struct class *hclass) goto out_disabled; } +/* Need to call this again because the max power might change, +* depending on card type for certain ASICs +*/ +hl_set_max_power (hdev); +/* * hl_hwmon_init() must be called after device_late_init(), because only * there we get the information from the device about which
drivers/misc/habanalabs/gaudi/gaudi.c +10 -1
@@ -447,7 +447,7 @@ static int gaudi_get_fixed_properties(struct hl_device *hdev) prop->num_of_events =GAUDI_EVENT_SIZE ; prop->tpc_enabled_mask =TPC_ENABLED_MASK ; - prop->max_power_default =MAX_POWER_DEFAULT ; + prop->max_power_default =MAX_POWER_DEFAULT_PCI ; prop->cb_pool_cb_cnt =GAUDI_CB_POOL_CB_CNT ; prop->cb_pool_cb_size =GAUDI_CB_POOL_CB_SIZE ;
@@ -6241,6 +6241,15 @@ static int gaudi_armcp_info_get(struct hl_device *hdev)strncpy (prop->armcp_info.card_name,GAUDI_DEFAULT_CARD_NAME ,CARD_NAME_MAX_LEN ); + hdev->card_type =le32_to_cpu (hdev->asic_prop.armcp_info.card_type); + +if (hdev->card_type == armcp_card_type_pci) + prop->max_power_default =MAX_POWER_DEFAULT_PCI ; +else if (hdev->card_type == armcp_card_type_pmc) + prop->max_power_default =MAX_POWER_DEFAULT_PMC ; + + hdev->max_power = prop->max_power_default; +return 0 ; }
drivers/misc/habanalabs/gaudi/gaudiP.h +2 -1
@@ -41,7 +41,8 @@#define GAUDI_MAX_CLK_FREQ 2200000000ull/* 2200 MHz */ -#define MAX_POWER_DEFAULT 200000/* 200W */ +#define MAX_POWER_DEFAULT_PCI 200000/* 200W */ +#define MAX_POWER_DEFAULT_PMC 350000/* 350W */ #define GAUDI_CPU_TIMEOUT_USEC 15000000/* 15s */
drivers/misc/habanalabs/habanalabs.h +4 -1
@@ -1408,6 +1408,8 @@ struct hl_device_idle_busy_ts {* details. * @in_reset: is device in reset flow. * @curr_pll_profile: current PLL profile. +* @card_type: Various ASICs have several card types. This indicates the card +* type of the current device. * @cs_active_cnt: number of active command submissions on this device (active * means already in H/W queues) * @major: habanalabs kernel driver major.
@@ -1503,6 +1505,7 @@ struct hl_device {u64 clock_gating_mask;atomic_t in_reset;enum hl_pll_frequency curr_pll_profile; +enum armcp_card_types card_type;int cs_active_cnt;u32 major;u32 high_pll;
@@ -1792,7 +1795,7 @@ int hl_get_pwm_info(struct hl_device *hdev,void hl_set_pwm_info (struct hl_device *hdev,int sensor_index,u32 attr,long value);u64 hl_get_max_power (struct hl_device *hdev); -void hl_set_max_power (struct hl_device *hdev,u64 value); +void hl_set_max_power (struct hl_device *hdev);int hl_set_voltage (struct hl_device *hdev,int sensor_index,u32 attr,long value); int hl_set_current(struct hl_device *hdev,
drivers/misc/habanalabs/sysfs.c +4 -3
@@ -81,7 +81,7 @@ u64 hl_get_max_power(struct hl_device *hdev)return result; } -void hl_set_max_power (struct hl_device *hdev,u64 value) +void hl_set_max_power (struct hl_device *hdev) {struct armcp_packet pkt;int rc;
@@ -90,7 +90,7 @@ void hl_set_max_power(struct hl_device *hdev, u64 value) pkt.ctl =cpu_to_le32 (ARMCP_PACKET_MAX_POWER_SET <<ARMCP_PKT_CTL_OPCODE_SHIFT ); - pkt.value =cpu_to_le64 (value); + pkt.value =cpu_to_le64 (hdev->max_power); rc = hdev->asic_funcs->send_cpu_message (hdev, (u32 *) &pkt,sizeof (pkt),0 ,NULL );
@@ -316,7 +316,7 @@ static ssize_t max_power_store(struct device *dev, } hdev->max_power = value; -hl_set_max_power (hdev, value); +hl_set_max_power (hdev); out:return count;
@@ -419,6 +419,7 @@ int hl_sysfs_init(struct hl_device *hdev) hdev->pm_mng_profile =PM_AUTO ; else hdev->pm_mng_profile = PM_MANUAL; + hdev->max_power = hdev->asic_prop.max_power_default; hdev->asic_funcs->add_device_attr (hdev, &hl_dev_clks_attr_group);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 16/186 habanalabs: validate FW file size
In reply to Greg Kroah-HartmanFrom: Ofir Bitton <[email protected]>
[ Upstream commit bce382a8bb080ed5f2f3a06754526dc58b91cca2 ]
We must validate FW size in order not to corrupt memory in case a malicious FW file will be present in system.
--- drivers/misc/habanalabs/firmware_if.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/misc/habanalabs/firmware_if.c +9 -0
@@ -13,6 +13,7 @@#include <linux/io-64-nonatomic-lo-hi.h> #include <linux/slab.h> +#define FW_FILE_MAX_SIZE 0x1400000/* maximum size of 20MB */ /** * hl_fw_load_fw_to_device() - Load F/W code to device's memory. * @hdev: pointer to hl_device structure.
@@ -45,6 +46,14 @@ int hl_fw_load_fw_to_device(struct hl_device *hdev, const char *fw_name,dev_dbg (hdev->dev,"%s firmware size == %zu\n" , fw_name, fw_size); +if (fw_size >FW_FILE_MAX_SIZE ) { +dev_err (hdev->dev, +"FW file size %zu exceeds maximum of %u bytes\n" , + fw_size,FW_FILE_MAX_SIZE ); + rc = -EINVAL ; + goto out; + } + fw_data = (const u64 *) fw->data;memcpy_toio (dst, fw_data, fw_size);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 17/186 habanalabs: check correct vmalloc return code
In reply to Greg Kroah-HartmanFrom: Ofir Bitton <[email protected]>
[ Upstream commit 0839152f8c1efc1cc2d515d1ff1e253ca9402ad3 ]
vmalloc can return different return code than NULL and a valid pointer. We must validate it in order to dereference a non valid pointer.
--- drivers/misc/habanalabs/memory.c | 9 +++++++-- drivers/misc/habanalabs/mmu.c | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-)
drivers/misc/habanalabs/memory.c +7 -2
@@ -66,6 +66,11 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args, num_pgs = (args->alloc.mem_size + (page_size -1 )) >> page_shift; total_size = num_pgs << page_shift; +if (!total_size) { +dev_err (hdev->dev,"Cannot allocate 0 bytes\n" ); +return -EINVAL ; + } + contiguous = args->flags &HL_MEM_CONTIGUOUS ;if (contiguous) {
@@ -93,7 +98,7 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args, phys_pg_pack->contiguous = contiguous; phys_pg_pack->pages =kvmalloc_array (num_pgs,sizeof (u64),GFP_KERNEL ); -if (!phys_pg_pack->pages) { +if (ZERO_OR_NULL_PTR (phys_pg_pack->pages)) { rc = -ENOMEM ; goto pages_arr_err; }
@@ -683,7 +688,7 @@ static int init_phys_pg_pack_from_userptr(struct hl_ctx *ctx, phys_pg_pack->pages =kvmalloc_array (total_npages,sizeof (u64),GFP_KERNEL ); -if (!phys_pg_pack->pages) { +if (ZERO_OR_NULL_PTR (phys_pg_pack->pages)) { rc = -ENOMEM ; goto page_pack_arr_mem_err; }
drivers/misc/habanalabs/mmu.c +1 -1
@@ -450,7 +450,7 @@ int hl_mmu_init(struct hl_device *hdev) hdev->mmu_shadow_hop0 =kvmalloc_array (prop->max_asid, prop->mmu_hop_table_size,GFP_KERNEL | __GFP_ZERO); -if (!hdev->mmu_shadow_hop0) { +if (ZERO_OR_NULL_PTR (hdev->mmu_shadow_hop0)) { rc = -ENOMEM ; goto err_pool_add; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 18/186 drm/msm/a6xx: fix gmu start on newer firmware
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit f5749d6181fa7df5ae741788e5d96f593d3a60b6 ]
New Qualcomm firmware has changed a way it reports back the 'started' event. Support new register values.
--- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/adreno/a6xx_gmu.c +11 -1
@@ -207,6 +207,16 @@ static int a6xx_gmu_start(struct a6xx_gmu *gmu) {int ret;u32 val; +u32 mask, reset_val; + + val =gmu_read (gmu,REG_A6XX_GMU_CM3_DTCM_START +0xff8 ); +if (val <=0x20010004 ) { + mask =0xffffffff ; + reset_val =0xbabeface ; + }else { + mask =0x1ff ; + reset_val =0x100 ; + }gmu_write (gmu,REG_A6XX_GMU_CM3_SYSRESET ,1 );
@@ -218,7 +228,7 @@ static int a6xx_gmu_start(struct a6xx_gmu *gmu)gmu_write (gmu,REG_A6XX_GMU_CM3_SYSRESET ,0 ); ret =gmu_poll_timeout (gmu,REG_A6XX_GMU_CM3_FW_INIT_RESULT , val, - val ==0xbabeface ,100 ,10000 ); + (val & mask) == reset_val,100 ,10000 );if (ret)DRM_DEV_ERROR (gmu->dev,"GMU firmware initialization timed out\n" );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 19/186 gfs2: add some much needed cleanup for log flushes that fail
In reply to Greg Kroah-HartmanFrom: Bob Peterson <[email protected]>
[ Upstream commit 462582b99b6079a6fbcdfc65bac49f5c2a27cfff ]
When a log flush fails due to io errors, it signals the failure but does not clean up after itself very well. This is because buffers are added to the transaction tr_buf and tr_databuf queue, but the io error causes gfs2_log_flush to bypass the "after_commit" functions responsible for dequeueing the bd elements. If the bd elements are added to the ail list before the error, function ail_drain takes care of dequeueing them. But if they haven't gotten that far, the elements are forgotten and make the transactions unable to be freed.
This patch introduces new function trans_drain which drains the bd elements from the transaction so they can be freed properly.
--- fs/gfs2/log.c | 31 +++++++++++++++++++++++++++++++ fs/gfs2/trans.c | 1 + 2 files changed, 32 insertions(+)
fs/gfs2/log.c +31 -0
@@ -901,6 +901,36 @@ static void empty_ail1_list(struct gfs2_sbd *sdp) } } +/** +* drain_bd - drain the buf and databuf queue for a failed transaction +* @tr: the transaction to drain +* +* When this is called, we're taking an error exit for a log write that failed +* but since we bypassed the after_commit functions, we need to remove the +* items from the buf and databuf queue. +*/ +static void trans_drain (struct gfs2_trans *tr) +{ +struct gfs2_bufdata *bd; +struct list_head *head; + +if (!tr) +return ; + + head = &tr->tr_buf; +while (!list_empty (head)) { + bd = list_first_entry(head, struct gfs2_bufdata, bd_list); +list_del_init (&bd->bd_list); +kmem_cache_free (gfs2_bufdata_cachep, bd); + } + head = &tr->tr_databuf; +while (!list_empty (head)) { + bd = list_first_entry(head, struct gfs2_bufdata, bd_list); +list_del_init (&bd->bd_list); +kmem_cache_free (gfs2_bufdata_cachep, bd); + } +} +/** * gfs2_log_flush - flush incore transaction(s) * @sdp: the filesystem
@@ -1005,6 +1035,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags) out:if (gfs2_withdrawn (sdp)) { +trans_drain (tr);/** * If the tr_list is empty, we're withdrawing during a log * flush that targets a transaction, but the transaction was
fs/gfs2/trans.c +1 -0
@@ -52,6 +52,7 @@ int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks, tr->tr_reserved +=gfs2_struct2blk (sdp, revokes);INIT_LIST_HEAD (&tr->tr_databuf);INIT_LIST_HEAD (&tr->tr_buf); +INIT_LIST_HEAD (&tr->tr_list);INIT_LIST_HEAD (&tr->tr_ail1_list);INIT_LIST_HEAD (&tr->tr_ail2_list);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 20/186 hv_utils: return error if host timesysnc update is stale
In reply to Greg Kroah-HartmanFrom: Vineeth Pillai <[email protected]>
[ Upstream commit 90b125f4cd2697f949f5877df723a0b710693dd0 ]
If for any reason, host timesync messages were not processed by the guest, hv_ptp_gettime() returns a stale value and the caller (clock_gettime, PTP ioctl etc) has no means to know this now. Return an error so that the caller knows about this.
--- drivers/hv/hv_util.c | 46 +++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 11 deletions(-)
drivers/hv/hv_util.c +35 -11
@@ -282,26 +282,52 @@ static struct {spinlock_t lock; } host_ts; -static struct timespec64 hv_get_adj_host_time (void ) +static inline u64 reftime_to_ns (u64 reftime) { -struct timespec64 ts; -u64 newtime, reftime; +return (reftime -WLTIMEDELTA ) *100 ; +} + +/* +* Hard coded threshold for host timesync delay: 600 seconds +*/ +static const u64 HOST_TIMESYNC_DELAY_THRESH =600 * (u64 )NSEC_PER_SEC ; + +static int hv_get_adj_host_time (struct timespec64 *ts) +{ +u64 newtime, reftime, timediff_adj;unsigned long flags; +int ret =0 ;spin_lock_irqsave (&host_ts.lock, flags); reftime =hv_read_reference_counter (); - newtime = host_ts.host_time + (reftime - host_ts.ref_time); - ts =ns_to_timespec64 ((newtime -WLTIMEDELTA ) *100 ); + +/* +* We need to let the caller know that last update from host +* is older than the max allowable threshold. clock_gettime() +* and PTP ioctl do not have a documented error that we could +* return for this specific case. Use ESTALE to report this. +*/ + timediff_adj = reftime - host_ts.ref_time; +if (timediff_adj *100 >HOST_TIMESYNC_DELAY_THRESH ) { +pr_warn_once ("TIMESYNC IC: Stale time stamp, %llu nsecs old\n" , + (timediff_adj *100 )); + ret = -ESTALE ; + } + + newtime = host_ts.host_time + timediff_adj; + *ts =ns_to_timespec64 (reftime_to_ns (newtime));spin_unlock_irqrestore (&host_ts.lock, flags); -return ts; +return ret; }static void hv_set_host_time (struct work_struct *work) { -struct timespec64 ts =hv_get_adj_host_time (); -do_settimeofday64 (&ts); +struct timespec64 ts; + +if (!hv_get_adj_host_time (&ts)) +do_settimeofday64 (&ts); }/*
@@ -622,9 +648,7 @@ static int hv_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)static int hv_ptp_gettime (struct ptp_clock_info *info,struct timespec64 *ts) { - *ts =hv_get_adj_host_time (); - -return 0 ; +return hv_get_adj_host_time (ts); }static struct ptp_clock_info ptp_hyperv_info = {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 21/186 hv_utils: drain the timesync packets on onchannelcallback
In reply to Greg Kroah-HartmanFrom: Vineeth Pillai <[email protected]>
[ Upstream commit b46b4a8a57c377b72a98c7930a9f6969d2d4784e ]
There could be instances where a system stall prevents the timesync packets to be consumed. And this might lead to more than one packet pending in the ring buffer. Current code empties one packet per callback and it might be a stale one. So drain all the packets from ring buffer on each callback.
--- drivers/hv/hv_util.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/hv/hv_util.c +16 -3
@@ -387,10 +387,23 @@ static void timesync_onchannelcallback(void *context)struct ictimesync_ref_data *refdata;u8 *time_txf_buf = util_timesynch.recv_buffer; -vmbus_recvpacket (channel, time_txf_buf, -HV_HYP_PAGE_SIZE , &recvlen, &requestid); +/* +* Drain the ring buffer and use the last packet to update +* host_ts +*/ +while (1 ) { +int ret =vmbus_recvpacket (channel, time_txf_buf, +HV_HYP_PAGE_SIZE , &recvlen, + &requestid); +if (ret) { +pr_warn_once ("TimeSync IC pkt recv failed (Err: %d)\n" , + ret); +break ; + } + +if (!recvlen) +break ; -if (recvlen >0 ) { icmsghdrp = (struct icmsg_hdr *)&time_txf_buf[sizeof (struct vmbuspipe_hdr )];
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 22/186 ceph: dont allow setlease on cephfs
In reply to Greg Kroah-HartmanFrom: Jeff Layton <[email protected]>
[ Upstream commit 496ceaf12432b3d136dcdec48424312e71359ea7 ]
Leases don't currently work correctly on kcephfs, as they are not broken when caps are revoked. They could eventually be implemented similarly to how we did them in libcephfs, but for now don't allow them.
[ idryomov: no need for simple_nosetlease() in ceph_dir_fops and
ceph_snapdir_fops ]
--- fs/ceph/file.c | 1 + 1 file changed, 1 insertion(+)
fs/ceph/file.c +1 -0
@@ -2507,6 +2507,7 @@ const struct file_operations ceph_file_fops = { .mmap = ceph_mmap, .fsync = ceph_fsync, .lock = ceph_lock, + .setlease = simple_nosetlease, .flock = ceph_flock, .splice_read = generic_file_splice_read, .splice_write = iter_file_splice_write,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 23/186 i2c: iproc: Fix shifting 31 bits
In reply to Greg Kroah-HartmanFrom: Ray Jui <[email protected]>
[ Upstream commit 0204081128d582965e9e39ca83ee6e4f7d27142b ]
Fix undefined behaviour in the iProc I2C driver by using 'BIT' marcro.
--- drivers/i2c/busses/i2c-bcm-iproc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-bcm-iproc.c +2 -2
@@ -720,7 +720,7 @@ static int bcm_iproc_i2c_xfer_internal(struct bcm_iproc_i2c_dev *iproc_i2c,/* mark the last byte */ if (!process_call && (i == msg->len -1 )) - val |=1 <<M_TX_WR_STATUS_SHIFT ; + val |=BIT (M_TX_WR_STATUS_SHIFT );iproc_i2c_wr_reg (iproc_i2c,M_TX_OFFSET , val); }
@@ -738,7 +738,7 @@ static int bcm_iproc_i2c_xfer_internal(struct bcm_iproc_i2c_dev *iproc_i2c,*/ addr =i2c_8bit_addr_from_msg (msg);/* mark it the last byte out */ - val = addr | (1 <<M_TX_WR_STATUS_SHIFT ); + val = addr |BIT (M_TX_WR_STATUS_SHIFT );iproc_i2c_wr_reg (iproc_i2c,M_TX_OFFSET , val); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 24/186 drm/omap: fix incorrect lock state
In reply to Greg Kroah-HartmanFrom: Tomi Valkeinen <[email protected]>
[ Upstream commit 7fd5b25499bcec157dd4de9a713425efcf4571cd ]
After commit 92cc68e35863c1c61c449efa2b2daef6e9926048 ("drm/vblank: Use spin_(un)lock_irq() in drm_crtc_vblank_on()") omapdrm locking is broken:
WARNING: inconsistent lock state
5.8.0-rc2-00483-g92cc68e35863 #13 Tainted: G W
--------------------------------
inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.
swapper/0/0 [HC1[1]:SC0[0]:HE0:SE1] takes:ea98222c (&dev->event_lock#2){?.+.}-{2:2}, at: drm_handle_vblank+0x4c/0x520 [drm] {HARDIRQ-ON-W} state was registered at:
trace_hardirqs_on+0x9c/0x1ec _raw_spin_unlock_irq+0x20/0x58 omap_crtc_atomic_enable+0x54/0xa0 [omapdrm] drm_atomic_helper_commit_modeset_enables+0x218/0x270 [drm_kms_helper] omap_atomic_commit_tail+0x48/0xc4 [omapdrm] commit_tail+0x9c/0x190 [drm_kms_helper] drm_atomic_helper_commit+0x154/0x188 [drm_kms_helper] drm_client_modeset_commit_atomic+0x228/0x268 [drm] drm_client_modeset_commit_locked+0x60/0x1d0 [drm] drm_client_modeset_commit+0x24/0x40 [drm] drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa8 [drm_kms_helper] drm_fb_helper_set_par+0x2c/0x5c [drm_kms_helper] drm_fb_helper_hotplug_event.part.0+0xa0/0xbc [drm_kms_helper] drm_kms_helper_hotplug_event+0x24/0x30 [drm_kms_helper] output_poll_execute+0x1a8/0x1c0 [drm_kms_helper] process_one_work+0x268/0x800 worker_thread+0x30/0x4e0 kthread+0x164/0x190 ret_from_fork+0x14/0x20
The reason for this is that omapdrm calls drm_crtc_vblank_on() while holding event_lock taken with spin_lock_irq().
It is not clear why drm_crtc_vblank_on() and drm_crtc_vblank_get() are called while holding event_lock. I don't see any problem with moving those calls outside the lock, which is what this patch does.
--- drivers/gpu/drm/omapdrm/omap_crtc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/omapdrm/omap_crtc.c +2 -1
@@ -451,11 +451,12 @@ static void omap_crtc_atomic_enable(struct drm_crtc *crtc,if (omap_state->manually_updated)return ; -spin_lock_irq (&crtc->dev->event_lock);drm_crtc_vblank_on (crtc); + ret =drm_crtc_vblank_get (crtc);WARN_ON (ret !=0 ); +spin_lock_irq (&crtc->dev->event_lock);omap_crtc_arm_event (crtc);spin_unlock_irq (&crtc->dev->event_lock); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 25/186 irqchip/ingenic: Leave parent IRQ unmasked on suspend
In reply to Greg Kroah-HartmanFrom: Paul Cercueil <[email protected]>
[ Upstream commit 821fc9e261f3af235752f46e59084467cfd440c4 ]
All the wakeup sources we possibly want will go through the interrupt controller, so the parent IRQ must not be masked during suspend, or there won't be any way to wake up the system.
--- drivers/irqchip/irq-ingenic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-ingenic.c +1 -1
@@ -125,7 +125,7 @@ static int __init ingenic_intc_of_init(struct device_node *node,irq_reg_writel (gc,IRQ_MSK (32 ),JZ_REG_INTC_SET_MASK ); } -if (request_irq (parent_irq, intc_cascade,0 , +if (request_irq (parent_irq, intc_cascade,IRQF_NO_SUSPEND ,"SoC intc cascade interrupt" ,NULL ))pr_err ("Failed to register SoC intc cascade interrupt\n" );return 0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 26/186 cpuidle: Fixup IRQ state
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit 49d9c5936314e44d314c605c39cce0fd947f9c3a ]
Match the pattern elsewhere in this file.
--- drivers/cpuidle/cpuidle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/cpuidle/cpuidle.c +2 -1
@@ -153,7 +153,8 @@ static void enter_s2idle_proper(struct cpuidle_driver *drv,*/ stop_critical_timings (); drv->states[index].enter_s2idle (dev, drv, index); -WARN_ON (!irqs_disabled ()); +if (WARN_ON_ONCE (!irqs_disabled ())) +local_irq_disable ();/* * timekeeping_resume() that will be called by tick_unfreeze() for the * first CPU executing it calls functions containing RCU read-side
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 27/186 nbd: restore default timeout when setting it to zero
In reply to Greg Kroah-HartmanFrom: Hou Pu <[email protected]>
[ Upstream commit acb19e17c5134dd78668c429ecba5b481f038e6a ]
If we configured io timeout of nbd0 to 100s. Later after we finished using it, we configured nbd0 again and set the io timeout to 0. We expect it would timeout after 30 seconds and keep retry. But in fact we could not change the timeout when we set it to 0. the timeout is still the original 100s.
So change the timeout to default 30s when we set it to zero. It also behaves same as commit 2da22da57348 ("nbd: fix zero cmd timeout handling v2").
It becomes more important if we were reconfigure a nbd device and the io timeout it set to zero. Because it could take 30s to detect the new socket and thus io could be completed more quickly compared to 100s.
--- drivers/block/nbd.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/block/nbd.c +2 -0
@@ -1360,6 +1360,8 @@ static void nbd_set_cmd_timeout(struct nbd_device *nbd, u64 timeout) nbd->tag_set.timeout = timeout *HZ ;if (timeout)blk_queue_rq_timeout (nbd->disk->queue, timeout *HZ ); +else +blk_queue_rq_timeout (nbd->disk->queue,30 *HZ ); }/* Must be called with config_lock held */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 28/186 s390: dont trace preemption in percpu macros
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
[ Upstream commit 1196f12a2c960951d02262af25af0bb1775ebcc2 ]
Since commit a21ee6055c30 ("lockdep: Change hardirq{s_enabled,_context} to per-cpu variables") the lockdep code itself uses percpu variables. This leads to recursions because the percpu macros are calling preempt_enable() which might call trace_preempt_on().
--- arch/s390/include/asm/percpu.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
arch/s390/include/asm/percpu.h +14 -14
@@ -29,7 +29,7 @@typedef typeof (pcp)pcp_op_T__ ; \pcp_op_T__ old__, new__, prev__; \pcp_op_T__ *ptr__; \ -preempt_disable (); \ +preempt_disable_notrace (); \ ptr__ =raw_cpu_ptr (&(pcp)); \ prev__ = *ptr__; \ do { \
@@ -37,7 +37,7 @@ new__ = old__ op (val); \ prev__ =cmpxchg (ptr__, old__, new__); \ }while (prev__ != old__); \ -preempt_enable (); \ +preempt_enable_notrace (); \ new__; \ })
@@ -68,7 +68,7 @@typedef typeof (pcp)pcp_op_T__ ; \pcp_op_T__ val__ = (val); \pcp_op_T__ old__, *ptr__; \ -preempt_disable (); \ +preempt_disable_notrace (); \ ptr__ =raw_cpu_ptr (&(pcp)); \if (__builtin_constant_p (val__) && \ ((szcast )val__ >-129 ) && ((szcast )val__ <128 )) { \
@@ -84,7 +84,7 @@ : [val__] "d" (val__) \ : "cc"); \ } \ -preempt_enable (); \ +preempt_enable_notrace (); \ }#define this_cpu_add_4 (pcp, val) arch_this_cpu_add(pcp, val, "laa", "asi", int)
@@ -95,14 +95,14 @@typedef typeof (pcp)pcp_op_T__ ; \pcp_op_T__ val__ = (val); \pcp_op_T__ old__, *ptr__; \ -preempt_disable (); \ +preempt_disable_notrace (); \ ptr__ =raw_cpu_ptr (&(pcp)); \ asmvolatile ( \ op" %[old__],%[val__],%[ptr__]\n" \ : [old__]"=d" (old__), [ptr__]"+Q" (*ptr__) \ : [val__]"d" (val__) \ :"cc" ); \ -preempt_enable (); \ +preempt_enable_notrace (); \ old__ + val__; \ })
@@ -114,14 +114,14 @@typedef typeof (pcp)pcp_op_T__ ; \pcp_op_T__ val__ = (val); \pcp_op_T__ old__, *ptr__; \ -preempt_disable (); \ +preempt_disable_notrace (); \ ptr__ =raw_cpu_ptr (&(pcp)); \ asmvolatile ( \ op" %[old__],%[val__],%[ptr__]\n" \ : [old__]"=d" (old__), [ptr__]"+Q" (*ptr__) \ : [val__]"d" (val__) \ :"cc" ); \ -preempt_enable (); \ +preempt_enable_notrace (); \ }#define this_cpu_and_4 (pcp, val) arch_this_cpu_to_op(pcp, val, "lan")
@@ -136,10 +136,10 @@typedef typeof (pcp)pcp_op_T__ ; \pcp_op_T__ ret__; \pcp_op_T__ *ptr__; \ -preempt_disable (); \ +preempt_disable_notrace (); \ ptr__ =raw_cpu_ptr (&(pcp)); \ ret__ =cmpxchg (ptr__, oval, nval); \ -preempt_enable (); \ +preempt_enable_notrace (); \ ret__; \ })
@@ -152,10 +152,10 @@ ({ \typeof (pcp) *ptr__; \typeof (pcp) ret__; \ -preempt_disable (); \ +preempt_disable_notrace (); \ ptr__ =raw_cpu_ptr (&(pcp)); \ ret__ =xchg (ptr__, nval); \ -preempt_enable (); \ +preempt_enable_notrace (); \ ret__; \ })
@@ -171,11 +171,11 @@typeof (pcp1) *p1__; \typeof (pcp2) *p2__; \int ret__; \ -preempt_disable (); \ +preempt_disable_notrace (); \ p1__ =raw_cpu_ptr (&(pcp1)); \ p2__ =raw_cpu_ptr (&(pcp2)); \ ret__ =__cmpxchg_double (p1__, p2__, o1__, o2__, n1__, n2__); \ -preempt_enable (); \ +preempt_enable_notrace (); \ ret__; \ })
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 29/186 drm/amd/display: should check error using DC_OK
In reply to Greg Kroah-HartmanFrom: Tong Zhang <[email protected]>
[ Upstream commit ed9ab229fea24cbcab17f484297dc8344afb7ea9 ]
core_link_read_dpcd returns only DC_OK(1) and DC_ERROR_UNEXPECTED(-1), the caller should check error using DC_OK instead of checking against 0
--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +4 -4
@@ -4346,9 +4346,9 @@ bool dc_link_get_backlight_level_nits(struct dc_link *link, link->connector_signal != SIGNAL_TYPE_DISPLAY_PORT))return false; -if (!core_link_read_dpcd (link,DP_SOURCE_BACKLIGHT_CURRENT_PEAK , +if (core_link_read_dpcd (link,DP_SOURCE_BACKLIGHT_CURRENT_PEAK , dpcd_backlight_get.raw, -sizeof (union dpcd_source_backlight_get ))) +sizeof (union dpcd_source_backlight_get )) !=DC_OK )return false; *backlight_millinits_avg =
@@ -4387,9 +4387,9 @@ bool dc_link_read_default_bl_aux(struct dc_link *link, uint32_t *backlight_milli link->connector_signal != SIGNAL_TYPE_DISPLAY_PORT))return false; -if (!core_link_read_dpcd (link,DP_SOURCE_BACKLIGHT_LEVEL , +if (core_link_read_dpcd (link,DP_SOURCE_BACKLIGHT_LEVEL , (uint8_t *) backlight_millinits, -sizeof (uint32_t ))) +sizeof (uint32_t )) !=DC_OK )return false;return true;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 30/186 drm/amd/display: Reject overlay plane configurations in multi-display scenarios
In reply to Greg Kroah-HartmanFrom: Nicholas Kazlauskas <[email protected]>
[ Upstream commit 168f09cdadbd547c2b202246ef9a8183da725f13 ]
[Why]
These aren't stable on some platform configurations when driving multiple displays, especially on higher resolution.
In particular the delay in asserting p-state and validating from x86 outweights any power or performance benefit from the hardware composition.
Under some configurations this will manifest itself as extreme stutter or unresponsiveness especially when combined with cursor movement.
[How]
Disable these for now. Exposing overlays to userspace doesn't guarantee that they'll be able to use them in any and all configurations and it's part of the DRM contract to have userspace gracefully handle validation failures when they occur.
Valdiation occurs as part of DC and this in particular affects RV, so disable this in dcn10_global_validation.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +8 -0
@@ -1213,6 +1213,7 @@ static enum dc_status dcn10_validate_global(struct dc *dc, struct dc_state *contbool video_large = false;bool desktop_large = false;bool dcc_disabled = false; +bool mpo_enabled = false;for (i =0 ; i < context->stream_count; i++) {if (context->stream_status[i].plane_count ==0 )
@@ -1221,6 +1222,9 @@ static enum dc_status dcn10_validate_global(struct dc *dc, struct dc_state *contif (context->stream_status[i].plane_count >2 )return DC_FAIL_UNSUPPORTED_1 ; +if (context->stream_status[i].plane_count >1 ) + mpo_enabled = true; +for (j =0 ; j < context->stream_status[i].plane_count; j++) {struct dc_plane_state *plane = context->stream_status[i].plane_states[j];
@@ -1244,6 +1248,10 @@ static enum dc_status dcn10_validate_global(struct dc *dc, struct dc_state *cont } } +/* Disable MPO in multi-display configurations. */ +if (context->stream_count >1 && mpo_enabled) +return DC_FAIL_UNSUPPORTED_1 ; +/* * Workaround: On DCN10 there is UMC issue that causes underflow when * playing 4k video on 4k desktop with video downscaled and single channel
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 31/186 drivers: gpu: amd: Initialize amdgpu_dm_backlight_caps object to 0 in amdgpu_dm_update_backlight_caps
In reply to Greg Kroah-HartmanFrom: Furquan Shaikh <[email protected]>
[ Upstream commit 5896585512e5156482335e902f7c7393b940da51 ]
In amdgpu_dm_update_backlight_caps(), there is a local amdgpu_dm_backlight_caps object that is filled in by amdgpu_acpi_get_backlight_caps(). However, this object is uninitialized before the call and hence the subsequent check for aux_support can fail since it is not initialized by amdgpu_acpi_get_backlight_caps() as well. This change initializes this local amdgpu_dm_backlight_caps object to 0.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -0
@@ -2844,6 +2844,8 @@ static void amdgpu_dm_update_backlight_caps(struct amdgpu_display_manager *dm)#if defined(CONFIG_ACPI )struct amdgpu_dm_backlight_caps caps; +memset (&caps,0 ,sizeof (caps)); +if (dm->backlight_caps.caps_valid)return ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 32/186 drm/amd/display: Revert HDCP disable sequence change
In reply to Greg Kroah-HartmanFrom: Jaehyun Chung <[email protected]>
[ Upstream commit b61f05622ace5b9498ae279cdfd1c9f0c1ce3f75 ]
[Why]
Revert HDCP disable sequence change that blanks stream before disabling HDCP. PSP and HW teams are currently investigating the root cause of why HDCP cannot be disabled before stream blank, which is expected to work without issues.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1 -1
@@ -3265,10 +3265,10 @@ void core_link_disable_stream(struct pipe_ctx *pipe_ctx)core_link_set_avmute (pipe_ctx, true); } - dc->hwss.blank_stream (pipe_ctx);#if defined(CONFIG_DRM_AMD_DC_HDCP )update_psp_stream_config (pipe_ctx, true);#endif + dc->hwss.blank_stream (pipe_ctx);if (pipe_ctx->stream->signal ==SIGNAL_TYPE_DISPLAY_PORT_MST )deallocate_mst_payload (pipe_ctx);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 33/186 drm/amd/display: Fix passive dongle mistaken as active dongle in EDID emulation
In reply to Greg Kroah-HartmanFrom: Samson Tam <[email protected]>
[ Upstream commit efbde23a3b0164cef27fd394e7d548f46af5b51d ]
[Why]dongle_type is set during dongle connection but for passive dongles, dongle_type is not set. If user starts with an active dongle and then switches to a passive dongle, it will still report as an active dongle. Trying to emulate the wrong connecter type results in display not lighting up.
[How]
Set dpcd_caps.dongle_type for passive dongles in detect_dp().
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1 -0
@@ -767,6 +767,7 @@ static bool detect_dp(struct dc_link *link, sink_caps->signal =dp_passive_dongle_detection (link->ddc, sink_caps, audio_support); + link->dpcd_caps.dongle_type = sink_caps->dongle_type; }return true;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 34/186 drm/amd/display: Keep current gain when ABM disable immediately
In reply to Greg Kroah-HartmanFrom: Brandon Syu <[email protected]>
[ Upstream commit cba4b52e431e5de3d8012281cfe194f1c39a9052 ]
[Why]
When system enters s3/s0i3, backlight PWM would set user level.
[How]
ABM disable function add keep current gain to avoid it.
--- drivers/gpu/drm/amd/display/dc/dc_stream.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc_stream.h +1 -1
@@ -222,7 +222,7 @@ struct dc_stream_state {union stream_update_flags update_flags; }; -#define ABM_LEVEL_IMMEDIATE_DISABLE 0xFFFFFFFF +#define ABM_LEVEL_IMMEDIATE_DISABLE 255struct dc_stream_update {struct dc_stream_state *stream;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 35/186 drm/amd/display: Retry AUX write when fail occurs
In reply to Greg Kroah-HartmanFrom: Wayne Lin <[email protected]>
[ Upstream commit ef67d792a2fc578319399f605fbec2f99ecc06ea ]
[Why]
In dm_dp_aux_transfer() now, we forget to handle AUX_WR fail cases. We suppose every write wil get done successfully and hence some AUX commands might not sent out indeed.
[How]
Check if AUX_WR success. If not, retry it.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +1 -1
@@ -67,7 +67,7 @@ static ssize_t dm_dp_aux_transfer(struct drm_dp_aux *aux, result =dc_link_aux_transfer_raw (TO_DM_AUX (aux)->ddc_service, &payload, &operation_result); -if (payload.write) +if (payload.write && result >=0 ) result = msg->size;if (result <0 )
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 36/186 drm/amd/display: Fix memleak in amdgpu_dm_mode_config_init
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit b67a468a4ccef593cd8df6a02ba3d167b77f0c81 ]
When amdgpu_display_modeset_create_props() fails, state and state->context should be freed to prevent memleak. It's the same when amdgpu_dm_audio_init() fails.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +8 -2
@@ -2822,12 +2822,18 @@ static int amdgpu_dm_mode_config_init(struct amdgpu_device *adev) &dm_atomic_state_funcs); r =amdgpu_display_modeset_create_props (adev); -if (r) +if (r) { +dc_release_state (state->context); +kfree (state);return r; + } r =amdgpu_dm_audio_init (adev); -if (r) +if (r) { +dc_release_state (state->context); +kfree (state);return r; + }return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 37/186 xen/xenbus: Fix granting of vmallocd memory
In reply to Greg Kroah-HartmanFrom: Simon Leiner <[email protected]>
[ Upstream commit d742db70033c745e410523e00522ee0cfe2aa416 ]
On some architectures (like ARM), virt_to_gfn cannot be used for vmalloc'd memory because of its reliance on virt_to_phys. This patch introduces a check for vmalloc'd addresses and obtains the PFN using vmalloc_to_pfn in that case.
--- drivers/xen/xenbus/xenbus_client.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/xen/xenbus/xenbus_client.c +8 -2
@@ -379,8 +379,14 @@ int xenbus_grant_ring(struct xenbus_device *dev, void *vaddr,int i, j;for (i =0 ; i < nr_pages; i++) { - err =gnttab_grant_foreign_access (dev->otherend_id, -virt_to_gfn (vaddr),0 ); +unsigned long gfn; + +if (is_vmalloc_addr (vaddr)) + gfn =pfn_to_gfn (vmalloc_to_pfn (vaddr)); +else + gfn =virt_to_gfn (vaddr); + + err =gnttab_grant_foreign_access (dev->otherend_id, gfn,0 );if (err <0 ) {xenbus_dev_fatal (dev, err,"granting access to ring page" );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 38/186 fsldma: fix very broken 32-bit ppc ioread64 functionality
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
[ Upstream commit 0a4c56c80f90797e9b9f8426c6aae4c0cf1c9785 ]
Commit ef91bb196b0d ("kernel.h: Silence sparse warning in lower_32_bits") caused new warnings to show in the fsldma driver, but that commit was not to blame: it only exposed some very incorrect code that tried to take the low 32 bits of an address.
That made no sense for multiple reasons, the most notable one being that that code was intentionally limited to only 32-bit ppc builds, so "only low 32 bits of an address" was completely nonsensical. There were no high bits to mask off to begin with.
But even more importantly fropm a correctness standpoint, turning the address into an integer then caused the subsequent address arithmetic to be completely wrong too, and the "+1" actually incremented the address by one, rather than by four.
Which again was incorrect, since the code was reading two 32-bit values and trying to make a 64-bit end result of it all. Surprisingly, the iowrite64() did not suffer from the same odd and incorrect model.
This code has never worked, but it's questionable whether anybody cared:
of the two users that actually read the 64-bit value (by way of some C preprocessor hackery and eventually the 'get_cdar()' inline function), one of them explicitly ignored the value, and the other one might just happen to work despite the incorrect value being read.
This patch at least makes it not fail the build any more, and makes the logic superficially sane. Whether it makes any difference to the code _working_ or not shall remain a mystery.
--- drivers/dma/fsldma.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/dma/fsldma.h +6 -6
@@ -205,10 +205,10 @@ struct fsldma_chan {#else static u64 fsl_ioread64 (const u64 __iomem *addr) { -u32 fsl_addr =lower_32_bits (addr); -u64 fsl_addr_hi = (u64 )in_le32 ((u32 *)(fsl_addr +1 )) <<32 ; +u32 val_lo =in_le32 ((u32 __iomem *)addr); +u32 val_hi =in_le32 ((u32 __iomem *)addr +1 ); -return fsl_addr_hi |in_le32 ((u32 *)fsl_addr); +return ((u64 )val_hi <<32 ) + val_lo; }static void fsl_iowrite64 (u64 val,u64 __iomem *addr)
@@ -219,10 +219,10 @@ static void fsl_iowrite64(u64 val, u64 __iomem *addr)static u64 fsl_ioread64be (const u64 __iomem *addr) { -u32 fsl_addr =lower_32_bits (addr); -u64 fsl_addr_hi = (u64 )in_be32 ((u32 *)fsl_addr) <<32 ; +u32 val_hi =in_be32 ((u32 __iomem *)addr); +u32 val_lo =in_be32 ((u32 __iomem *)addr +1 ); -return fsl_addr_hi |in_be32 ((u32 *)(fsl_addr +1 )); +return ((u64 )val_hi <<32 ) + val_lo; }static void fsl_iowrite64be (u64 val,u64 __iomem *addr)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 39/186 dmaengine: of-dma: Fix of_dma_router_xlates of_dma_xlate handling
In reply to Greg Kroah-HartmanFrom: Peter Ujfalusi <[email protected]>
[ Upstream commit 5b2aa9f918f6837ae943557f8cec02c34fcf80e7 ]
of_dma_xlate callback can return ERR_PTR as well NULL in case of failure.
If error code is returned (not NULL) then the route should be released and the router should not be registered for the channel.
--- drivers/dma/of-dma.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/dma/of-dma.c +4 -4
@@ -71,12 +71,12 @@ static struct dma_chan *of_dma_router_xlate(struct of_phandle_args *dma_spec,return NULL ; chan = ofdma_target->of_dma_xlate (&dma_spec_target, ofdma_target); -if (chan) { - chan->router = ofdma->dma_router; - chan->route_data = route_data; - }else { +if (IS_ERR_OR_NULL (chan)) { ofdma->dma_router->route_free (ofdma->dma_router->dev, route_data); + }else { + chan->router = ofdma->dma_router; + chan->route_data = route_data; }/*
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 40/186 batman-adv: Avoid uninitialized chaddr when handling DHCP
In reply to Greg Kroah-HartmanFrom: Sven Eckelmann <[email protected]>
[ Upstream commit 303216e76dcab6049c9d42390b1032f0649a8206 ]
The gateway client code can try to optimize the delivery of DHCP packets to avoid broadcasting them through the whole mesh. But also transmissions to the client can be optimized by looking up the destination via the chaddr of the DHCP packet.
But the chaddr is currently only done when chaddr is fully inside the non-paged area of the skbuff. Otherwise it will not be initialized and the unoptimized path should have been taken.
But the implementation didn't handle this correctly. It didn't retrieve the correct chaddr but still tried to perform the TT lookup with this uninitialized memory.
--- net/batman-adv/gateway_client.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/batman-adv/gateway_client.c +4 -2
@@ -703,8 +703,10 @@ batadv_gw_dhcp_recipient_get(struct sk_buff *skb, unsigned int *header_len, chaddr_offset = *header_len +BATADV_DHCP_CHADDR_OFFSET ;/* store the client address if the message is going to a client */ -if (ret ==BATADV_DHCP_TO_CLIENT && -pskb_may_pull (skb, chaddr_offset +ETH_ALEN )) { +if (ret ==BATADV_DHCP_TO_CLIENT ) { +if (!pskb_may_pull (skb, chaddr_offset +ETH_ALEN )) +return BATADV_DHCP_NO ; +/* check if the DHCP packet carries an Ethernet DHCP */ p = skb->data + *header_len +BATADV_DHCP_HTYPE_OFFSET ;if (*p !=BATADV_DHCP_HTYPE_ETHERNET )
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 41/186 batman-adv: Fix own OGM check in aggregated OGMs
In reply to Greg Kroah-HartmanFrom: Linus Lüssing <[email protected]>
[ Upstream commit d8bf0c01642275c7dca1e5d02c34e4199c200b1f ]
The own OGM check is currently misplaced and can lead to the following issues:
For one thing we might receive an aggregated OGM from a neighbor node which has our own OGM in the first place. We would then not only skip our own OGM but erroneously also any other, following OGM in the aggregate.
For another, we might receive an OGM aggregate which has our own OGM in a place other then the first one. Then we would wrongly not skip this OGM, leading to populating the orginator and gateway table with ourself.
--- net/batman-adv/bat_v_ogm.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
net/batman-adv/bat_v_ogm.c +6 -5
@@ -874,6 +874,12 @@ static void batadv_v_ogm_process(const struct sk_buff *skb, int ogm_offset,ntohl (ogm_packet->seqno), ogm_throughput, ogm_packet->ttl, ogm_packet->version, ntohs(ogm_packet->tvlv_len)); +if (batadv_is_my_mac (bat_priv, ogm_packet->orig)) { +batadv_dbg (BATADV_DBG_BATMAN , bat_priv, +"Drop packet: originator packet from ourself\n" ); +return ; + } +/* If the throughput metric is 0, immediately drop the packet. No need * to create orig_node / neigh_node for an unusable route. */
@@ -1001,11 +1007,6 @@ int batadv_v_ogm_packet_recv(struct sk_buff *skb,if (batadv_is_my_mac (bat_priv, ethhdr->h_source)) goto free_skb; - ogm_packet = (struct batadv_ogm2_packet *)skb->data; - -if (batadv_is_my_mac (bat_priv, ogm_packet->orig)) - goto free_skb; -batadv_inc_counter (bat_priv,BATADV_CNT_MGMT_RX );batadv_add_counter (bat_priv,BATADV_CNT_MGMT_RX_BYTES , skb->len +ETH_HLEN );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 42/186 batman-adv: bla: use netif_rx_ni when not in interrupt context
In reply to Greg Kroah-HartmanFrom: Jussi Kivilinna <[email protected]>
[ Upstream commit 279e89b2281af3b1a9f04906e157992c19c9f163 ]
batadv_bla_send_claim() gets called from worker thread context through batadv_bla_periodic_work(), thus netif_rx_ni needs to be used in that case. This fixes "NOHZ: local_softirq_pending 08" log messages seen when batman-adv is enabled.
--- net/batman-adv/bridge_loop_avoidance.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/batman-adv/bridge_loop_avoidance.c +4 -1
@@ -437,7 +437,10 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, u8 *mac,batadv_add_counter (bat_priv,BATADV_CNT_RX_BYTES , skb->len +ETH_HLEN ); -netif_rx (skb); +if (in_interrupt ()) +netif_rx (skb); +else +netif_rx_ni (skb); out:if (primary_if)batadv_hardif_put (primary_if);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 43/186 dmaengine: at_hdmac: check return value of of_find_device_by_node() in at_dma_xlate()
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit 0cef8e2c5a07d482ec907249dbd6687e8697677f ]
The reurn value of of_find_device_by_node() is not checked, thus null pointer dereference will be triggered if of_find_device_by_node() failed.
--- drivers/dma/at_hdmac.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/dma/at_hdmac.c +2 -0
@@ -1650,6 +1650,8 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec,return NULL ; dmac_pdev =of_find_device_by_node (dma_spec->np); +if (!dmac_pdev) +return NULL ;dma_cap_zero (mask);dma_cap_set (DMA_SLAVE , mask);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 44/186 dmaengine: at_hdmac: add missing put_device() call in at_dma_xlate()
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit 3832b78b3ec2cf51e07102f9b4480e343459b20f ]
If of_find_device_by_node() succeed, at_dma_xlate() doesn't have a corresponding put_device(). Thus add put_device() to fix the exception handling for this function implementation.
--- drivers/dma/at_hdmac.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/dma/at_hdmac.c +6 -2
@@ -1657,8 +1657,10 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec,dma_cap_set (DMA_SLAVE , mask); atslave =kmalloc (sizeof (*atslave),GFP_KERNEL ); -if (!atslave) +if (!atslave) { +put_device (&dmac_pdev->dev);return NULL ; + } atslave->cfg =ATC_DST_H2SEL_HW |ATC_SRC_H2SEL_HW ;/*
@@ -1687,8 +1689,10 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec, atslave->dma_dev = &dmac_pdev->dev; chan =dma_request_channel (mask, at_dma_filter, atslave); -if (!chan) +if (!chan) { +put_device (&dmac_pdev->dev);return NULL ; + } atchan =to_at_dma_chan (chan); atchan->per_if = dma_spec->args[0 ] &0xff ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 45/186 dmaengine: at_hdmac: add missing kfree() call in at_dma_xlate()
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit e097eb7473d9e70da9e03276f61cd392ccb9d79f ]
If memory allocation for 'atslave' succeed, at_dma_xlate() doesn't have a corresponding kfree() in exception handling. Thus add kfree() for this function implementation.
--- drivers/dma/at_hdmac.c | 1 + 1 file changed, 1 insertion(+)
drivers/dma/at_hdmac.c +1 -0
@@ -1691,6 +1691,7 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec, chan =dma_request_channel (mask, at_dma_filter, atslave);if (!chan) {put_device (&dmac_pdev->dev); +kfree (atslave);return NULL ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 46/186 rxrpc: Keep the ACK serial in a var in rxrpc_input_ack()
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 68528d937dcd675e79973061c1a314db598162d1 ]
Keep the ACK serial number in a variable in rxrpc_input_ack() as it's used frequently.
--- net/rxrpc/input.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
net/rxrpc/input.c +11 -10
@@ -843,7 +843,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)struct rxrpc_ackinfo info;u8 acks[RXRPC_MAXACKS ]; } buf; -rxrpc_serial_t acked_serial; +rxrpc_serial_t ack_serial, acked_serial;rxrpc_seq_t first_soft_ack, hard_ack, prev_pkt;int nr_acks, offset, ioffset;
@@ -856,6 +856,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) } offset +=sizeof (buf.ack); + ack_serial = sp->hdr.serial; acked_serial =ntohl (buf.ack.serial); first_soft_ack =ntohl (buf.ack.firstPacket); prev_pkt =ntohl (buf.ack.previousPacket);
@@ -864,31 +865,31 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) summary.ack_reason = (buf.ack.reason <RXRPC_ACK__INVALID ? buf.ack.reason :RXRPC_ACK__INVALID ); -trace_rxrpc_rx_ack (call, sp->hdr.serial, acked_serial, +trace_rxrpc_rx_ack (call, ack_serial, acked_serial, first_soft_ack, prev_pkt, summary.ack_reason, nr_acks);if (buf.ack.reason ==RXRPC_ACK_PING_RESPONSE )rxrpc_input_ping_response (call, skb->tstamp, acked_serial, - sp->hdr.serial); + ack_serial);if (buf.ack.reason ==RXRPC_ACK_REQUESTED )rxrpc_input_requested_ack (call, skb->tstamp, acked_serial, - sp->hdr.serial); + ack_serial);if (buf.ack.reason ==RXRPC_ACK_PING ) { -_proto ("Rx ACK %%%u PING Request" , sp->hdr.serial); +_proto ("Rx ACK %%%u PING Request" , ack_serial);rxrpc_propose_ACK (call,RXRPC_ACK_PING_RESPONSE , - sp->hdr.serial, true, true, + ack_serial, true, true, rxrpc_propose_ack_respond_to_ping); }else if (sp->hdr.flags &RXRPC_REQUEST_ACK ) {rxrpc_propose_ACK (call,RXRPC_ACK_REQUESTED , - sp->hdr.serial, true, true, + ack_serial, true, true, rxrpc_propose_ack_respond_to_ack); }/* Discard any out-of-order or duplicate ACKs (outside lock). */ if (!rxrpc_is_ack_valid (call, first_soft_ack, prev_pkt)) { -trace_rxrpc_rx_discard_ack (call->debug_id, sp->hdr.serial, +trace_rxrpc_rx_discard_ack (call->debug_id, ack_serial, first_soft_ack, call->ackr_first_seq, prev_pkt, call->ackr_prev_seq);return ;
@@ -904,7 +905,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)/* Discard any out-of-order or duplicate ACKs (inside lock). */ if (!rxrpc_is_ack_valid (call, first_soft_ack, prev_pkt)) { -trace_rxrpc_rx_discard_ack (call->debug_id, sp->hdr.serial, +trace_rxrpc_rx_discard_ack (call->debug_id, ack_serial, first_soft_ack, call->ackr_first_seq, prev_pkt, call->ackr_prev_seq); goto out;
@@ -964,7 +965,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) RXRPC_TX_ANNO_LAST && summary.nr_acks == call->tx_top - hard_ack && rxrpc_is_client_call(call)) -rxrpc_propose_ACK (call,RXRPC_ACK_PING , sp->hdr.serial, +rxrpc_propose_ACK (call,RXRPC_ACK_PING , ack_serial, false, true, rxrpc_propose_ack_ping_for_lost_reply);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 47/186 rxrpc: Fix loss of RTT samples due to interposed ACK
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 4700c4d80b7bb171f6996016ef121e1508860b42 ]
The Rx protocol has a mechanism to help generate RTT samples that works by a client transmitting a REQUESTED-type ACK when it receives a DATA packet that has the REQUEST_ACK flag set.
The peer, however, may interpose other ACKs before transmitting the REQUESTED-ACK, as can be seen in the following trace excerpt:
rxrpc_tx_data: c=00000044 DATA d0b5ece8:00000001 00000001 q=00000001 fl=07
rxrpc_rx_ack: c=00000044 00000001 PNG r=00000000 f=00000002 p=00000000 n=0
rxrpc_rx_ack: c=00000044 00000002 REQ r=00000001 f=00000002 p=00000001 n=0
...
DATA packet 1 (q=xx) has REQUEST_ACK set (bit 1 of fl=xx). The incoming ping (labelled PNG) hard-acks the request DATA packet (f=xx exceeds the sequence number of the DATA packet), causing it to be discarded from the Tx ring. The ACK that was requested (labelled REQ, r=xx references the serial of the DATA packet) comes after the ping, but the sk_buff holding the timestamp has gone and the RTT sample is lost.
This is particularly noticeable on RPC calls used to probe the service offered by the peer. A lot of peers end up with an unknown RTT because we only ever sent a single RPC. This confuses the server rotation algorithm.
Fix this by caching the information about the outgoing packet in RTT calculations in the rxrpc_call struct rather than looking in the Tx ring.
A four-deep buffer is maintained and both REQUEST_ACK-flagged DATA and PING-ACK transmissions are recorded in there. When the appropriate response ACK is received, the buffer is checked for a match and, if found, an RTT sample is recorded.
If a received ACK refers to a packet with a later serial number than an entry in the cache, that entry is presumed lost and the entry is made available to record a new transmission.
ACKs types other than REQUESTED-type and PING-type cause any matching sample to be cancelled as they don't necessarily represent a useful measurement.
If there's no space in the buffer on ping/data transmission, the sample base is discarded.
--- include/trace/events/rxrpc.h | 27 +++++++-- net/rxrpc/ar-internal.h | 13 +++-- net/rxrpc/call_object.c | 1 + net/rxrpc/input.c | 104 ++++++++++++++++++++--------------- net/rxrpc/output.c | 82 ++++++++++++++++++++------- net/rxrpc/rtt.c | 3 +- 6 files changed, 154 insertions(+), 76 deletions(-)
include/trace/events/rxrpc.h +22 -5
@@ -138,11 +138,16 @@ enum rxrpc_recvmsg_trace { };enum rxrpc_rtt_tx_trace { + rxrpc_rtt_tx_cancel, rxrpc_rtt_tx_data, + rxrpc_rtt_tx_no_slot, rxrpc_rtt_tx_ping, };enum rxrpc_rtt_rx_trace { + rxrpc_rtt_rx_cancel, + rxrpc_rtt_rx_lost, + rxrpc_rtt_rx_obsolete, rxrpc_rtt_rx_ping_response, rxrpc_rtt_rx_requested_ack, };
@@ -339,10 +344,15 @@ enum rxrpc_tx_point { E_(rxrpc_recvmsg_wait, "WAIT")#define rxrpc_rtt_tx_traces \ + EM(rxrpc_rtt_tx_cancel, "CNCE") \ EM(rxrpc_rtt_tx_data, "DATA") \ + EM(rxrpc_rtt_tx_no_slot, "FULL") \ E_(rxrpc_rtt_tx_ping, "PING")#define rxrpc_rtt_rx_traces \ + EM(rxrpc_rtt_rx_cancel, "CNCL") \ + EM(rxrpc_rtt_rx_obsolete, "OBSL") \ + EM(rxrpc_rtt_rx_lost, "LOST") \ EM(rxrpc_rtt_rx_ping_response, "PONG") \ E_(rxrpc_rtt_rx_requested_ack, "RACK")
@@ -1087,38 +1097,43 @@ TRACE_EVENT(rxrpc_recvmsg,TRACE_EVENT (rxrpc_rtt_tx, TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_tx_trace why, - rxrpc_serial_t send_serial), + int slot, rxrpc_serial_t send_serial), -TP_ARGS (call, why, send_serial), +TP_ARGS (call, why, slot, send_serial),TP_STRUCT__entry ( __field(unsigned int, call ) __field(enum rxrpc_rtt_tx_trace, why ) + __field(int, slot )__field (rxrpc_serial_t, send_serial ) ),TP_fast_assign ( __entry->call = call->debug_id; __entry->why = why; + __entry->slot = slot; __entry->send_serial = send_serial; ), -TP_printk ("c=%08x %s sr=%08x" , +TP_printk ("c=%08x [%d] %s sr=%08x" , __entry->call, + __entry->slot,__print_symbolic (__entry->why, rxrpc_rtt_tx_traces), __entry->send_serial) ); TRACE_EVENT(rxrpc_rtt_rx, TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why, + int slot, rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial, u32 rtt, u32 rto), - TP_ARGS(call, why, send_serial, resp_serial, rtt, rto), + TP_ARGS(call, why, slot, send_serial, resp_serial, rtt, rto), TP_STRUCT__entry( __field(unsigned int, call ) __field(enum rxrpc_rtt_rx_trace, why ) + __field(int, slot ) __field(rxrpc_serial_t, send_serial ) __field(rxrpc_serial_t, resp_serial ) __field(u32, rtt )
@@ -1128,14 +1143,16 @@ TRACE_EVENT(rxrpc_rtt_rx,TP_fast_assign ( __entry->call = call->debug_id; __entry->why = why; + __entry->slot = slot; __entry->send_serial = send_serial; __entry->resp_serial = resp_serial; __entry->rtt = rtt; __entry->rto = rto; ), - TP_printk("c=%08x %s sr=%08x rr=%08x rtt=%u rto=%u", + TP_printk("c=%08x [%d] %s sr=%08x rr=%08x rtt=%u rto=%u", __entry->call, + __entry->slot, __print_symbolic(__entry->why, rxrpc_rtt_rx_traces), __entry->send_serial, __entry->resp_serial,
net/rxrpc/ar-internal.h +8 -5
@@ -488,7 +488,6 @@ enum rxrpc_call_flag {RXRPC_CALL_RX_LAST ,/* Received the last packet (at rxtx_top) */ RXRPC_CALL_TX_LAST ,/* Last packet in Tx buffer (at rxtx_top) */ RXRPC_CALL_SEND_PING ,/* A ping will need to be sent */ -RXRPC_CALL_PINGING ,/* Ping in process */ RXRPC_CALL_RETRANS_TIMEOUT ,/* Retransmission due to timeout occurred */ RXRPC_CALL_BEGAN_RX_TIMER ,/* We began the expect_rx_by timer */ RXRPC_CALL_RX_HEARD, /* The peer responded at least once to this call */
@@ -673,9 +672,13 @@ struct rxrpc_call {rxrpc_seq_t ackr_consumed;/* Highest packet shown consumed */ rxrpc_seq_t ackr_seen;/* Highest packet shown seen */ -/* ping management */ -rxrpc_serial_t ping_serial;/* Last ping sent */ -ktime_t ping_time;/* Time last ping sent */ +/* RTT management */ +rxrpc_serial_t rtt_serial[4 ];/* Serial number of DATA or PING sent */ +ktime_t rtt_sent_at[4 ];/* Time packet sent */ +unsigned long rtt_avail;/* Mask of available slots in bits 0-3, +* Mask of pending samples in 8-11 */ +#define RXRPC_CALL_RTT_AVAIL_MASK 0xf +#define RXRPC_CALL_RTT_PEND_SHIFT 8/* transmission-phase ACK management */ ktime_t acks_latest_ts;/* Timestamp of latest ACK received */
@@ -1037,7 +1040,7 @@ static inline bool __rxrpc_abort_eproto(struct rxrpc_call *call,/* * rtt.c */ -void rxrpc_peer_add_rtt (struct rxrpc_call *,enum rxrpc_rtt_rx_trace , +void rxrpc_peer_add_rtt (struct rxrpc_call *,enum rxrpc_rtt_rx_trace ,int ,rxrpc_serial_t ,rxrpc_serial_t ,ktime_t ,ktime_t );unsigned long rxrpc_get_rto_backoff (struct rxrpc_peer *,bool );void rxrpc_peer_init_rtt (struct rxrpc_peer *);
net/rxrpc/call_object.c +1 -0
@@ -153,6 +153,7 @@ struct rxrpc_call *rxrpc_alloc_call(struct rxrpc_sock *rx, gfp_t gfp, call->cong_ssthresh =RXRPC_RXTX_BUFF_SIZE -1 ; call->rxnet = rxnet; + call->rtt_avail =RXRPC_CALL_RTT_AVAIL_MASK ;atomic_inc (&rxnet->nr_calls);return call;
net/rxrpc/input.c +60 -44
135 lines not on this page · raw message
net/rxrpc/output.c +61 -21
150 lines not on this page · raw message
net/rxrpc/rtt.c +2 -1
@@ -146,6 +146,7 @@ static void rxrpc_ack_update_rtt(struct rxrpc_peer *peer, long rtt_us)* exclusive access to the peer RTT data. */ void rxrpc_peer_add_rtt (struct rxrpc_call *call,enum rxrpc_rtt_rx_trace why, +int rtt_slot,rxrpc_serial_t send_serial,rxrpc_serial_t resp_serial,ktime_t send_time,ktime_t resp_time) {
@@ -162,7 +163,7 @@ void rxrpc_peer_add_rtt(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why, peer->rtt_count++;spin_unlock (&peer->rtt_input_lock); -trace_rxrpc_rtt_rx (call, why, send_serial, resp_serial, +trace_rxrpc_rtt_rx (call, why, rtt_slot, send_serial, resp_serial, peer->srtt_us >>3 , peer->rto_j); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 48/186 rxrpc: Make rxrpc_kernel_get_srtt() indicate validity
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 1d4adfaf65746203861c72d9d78de349eb97d528 ]
Fix rxrpc_kernel_get_srtt() to indicate the validity of the returned smoothed RTT. If we haven't had any valid samples yet, the SRTT isn't useful.
--- fs/afs/fs_probe.c | 4 ++-- fs/afs/vl_probe.c | 4 ++-- include/net/af_rxrpc.h | 2 +- net/rxrpc/peer_object.c | 16 +++++++++++++--- 4 files changed, 18 insertions(+), 8 deletions(-)
fs/afs/fs_probe.c +2 -2
@@ -161,8 +161,8 @@ responded: } } - rtt_us =rxrpc_kernel_get_srtt (call->net->socket, call->rxcall); -if (rtt_us < server->probe.rtt) { +if (rxrpc_kernel_get_srtt (call->net->socket, call->rxcall, &rtt_us) && + rtt_us < server->probe.rtt) { server->probe.rtt = rtt_us; server->rtt = rtt_us; alist->preferred = index;
fs/afs/vl_probe.c +2 -2
@@ -92,8 +92,8 @@ responded: } } - rtt_us =rxrpc_kernel_get_srtt (call->net->socket, call->rxcall); -if (rtt_us < server->probe.rtt) { +if (rxrpc_kernel_get_srtt (call->net->socket, call->rxcall, &rtt_us) && + rtt_us < server->probe.rtt) { server->probe.rtt = rtt_us; alist->preferred = index; have_result = true;
include/net/af_rxrpc.h +1 -1
@@ -59,7 +59,7 @@ bool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *,void rxrpc_kernel_end_call (struct socket *,struct rxrpc_call *);void rxrpc_kernel_get_peer (struct socket *,struct rxrpc_call *,struct sockaddr_rxrpc *); -u32 rxrpc_kernel_get_srtt (struct socket *,struct rxrpc_call *); +bool rxrpc_kernel_get_srtt (struct socket *,struct rxrpc_call *,u32 *);int rxrpc_kernel_charge_accept (struct socket *,rxrpc_notify_rx_t ,rxrpc_user_attach_call_t ,unsigned long ,gfp_t ,unsigned int );
net/rxrpc/peer_object.c +13 -3
@@ -502,11 +502,21 @@ EXPORT_SYMBOL(rxrpc_kernel_get_peer);* rxrpc_kernel_get_srtt - Get a call's peer smoothed RTT * @sock: The socket on which the call is in progress. * @call: The call to query +* @_srtt: Where to store the SRTT value. * -* Get the call's peer smoothed RTT. +* Get the call's peer smoothed RTT in uS. */ -u32 rxrpc_kernel_get_srtt (struct socket *sock,struct rxrpc_call *call) +bool rxrpc_kernel_get_srtt (struct socket *sock,struct rxrpc_call *call, +u32 *_srtt) { -return call->peer->srtt_us >>3 ; +struct rxrpc_peer *peer = call->peer; + +if (peer->rtt_count ==0 ) { + *_srtt =1000000 ;/* 1S */ +return false; + } + + *_srtt = call->peer->srtt_us >>3 ; +return true; }EXPORT_SYMBOL (rxrpc_kernel_get_srtt);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 49/186 MIPS: mm: BMIPS5000 has inclusive physical caches
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
[ Upstream commit dbfc95f98f0158958d1f1e6bf06d74be38dbd821 ]
When the BMIPS generic cpu-feature-overrides.h file was introduced, cpu_has_inclusive_caches/MIPS_CPU_INCLUSIVE_CACHES was not set for BMIPS5000 CPUs. Correct this when we have initialized the MIPS secondary cache successfully.
--- arch/mips/mm/c-r4k.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/mips/mm/c-r4k.c +4 -0
@@ -1712,7 +1712,11 @@ static void setup_scache(void)printk ("MIPS secondary cache %ldkB, %s, linesize %d bytes.\n" , scache_size >>10 , way_string[c->scache.ways], c->scache.linesz); + +if (current_cpu_type () ==CPU_BMIPS5000 ) + c->options |= MIPS_CPU_INCLUSIVE_CACHES; } +#else if (!(c->scache.flags &MIPS_CACHE_NOT_PRESENT ))panic ("Dunno how to handle MIPS32 / MIPS64 second level cache" );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 50/186 MIPS: BMIPS: Also call bmips_cpu_setup() for secondary cores
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
[ Upstream commit e14f633b66902615cf7faa5d032b45ab8b6fb158 ]
The initialization done by bmips_cpu_setup() typically affects both threads of a given core, on 7435 which supports 2 cores and 2 threads, logical CPU number 2 and 3 would not run this initialization.
--- arch/mips/kernel/smp-bmips.c | 2 ++ 1 file changed, 2 insertions(+)
arch/mips/kernel/smp-bmips.c +2 -0
@@ -239,6 +239,8 @@ static int bmips_boot_secondary(int cpu, struct task_struct *idle)*/ static void bmips_init_secondary (void ) { +bmips_cpu_setup (); +switch (current_cpu_type ()) {case CPU_BMIPS4350 :case CPU_BMIPS4380 :
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 51/186 mmc: sdhci-acpi: Fix HS400 tuning for AMDI0040
In reply to Greg Kroah-HartmanFrom: Raul E Rangel <[email protected]>
[ Upstream commit 61d7437ed13906984c44697970ee792ac6271a31 ]
The AMD eMMC Controller can only use the tuned clock while in HS200 and HS400 mode. If we switch to a different mode, we need to disable the tuned clock. If we have previously performed tuning and switch back to HS200 or HS400, we can re-enable the tuned clock.
Previously the tuned clock was not getting disabled when switching to DDR52 which is part of the HS400 tuning sequence.
--- drivers/mmc/host/sdhci-acpi.c | 67 +++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 10 deletions(-)
drivers/mmc/host/sdhci-acpi.c +57 -10
@@ -535,6 +535,11 @@ static const struct sdhci_acpi_slot sdhci_acpi_slot_qcom_sd = { .caps = MMC_CAP_NONREMOVABLE, }; +struct amd_sdhci_host { +bool tuned_clock; +bool dll_enabled; +}; +/* AMD sdhci reset dll register. */ #define SDHCI_AMD_RESET_DLL_REGISTER 0x908
@@ -554,26 +559,66 @@ static void sdhci_acpi_amd_hs400_dll(struct sdhci_host *host) }/* -* For AMD Platform it is required to disable the tuning -* bit first controller to bring to HS Mode from HS200 -* mode, later enable to tune to HS400 mode. +* The initialization sequence for HS400 is: +* HS->HS200->Perform Tuning->HS->HS400 +* +* The re-tuning sequence is: +* HS400->DDR52->HS->HS200->Perform Tuning->HS->HS400 +* +* The AMD eMMC Controller can only use the tuned clock while in HS200 and HS400 +* mode. If we switch to a different mode, we need to disable the tuned clock. +* If we have previously performed tuning and switch back to HS200 or +* HS400, we can re-enable the tuned clock. +* */ static void amd_set_ios (struct mmc_host *mmc,struct mmc_ios *ios) {struct sdhci_host *host =mmc_priv (mmc); +struct sdhci_acpi_host *acpi_host =sdhci_priv (host); +struct amd_sdhci_host *amd_host =sdhci_acpi_priv (acpi_host);unsigned int old_timing = host->timing; +u16 val;sdhci_set_ios (mmc, ios); -if (old_timing ==MMC_TIMING_MMC_HS200 && - ios->timing ==MMC_TIMING_MMC_HS ) -sdhci_writew (host,0x9 ,SDHCI_HOST_CONTROL2 ); -if (old_timing !=MMC_TIMING_MMC_HS400 && - ios->timing ==MMC_TIMING_MMC_HS400 ) { -sdhci_writew (host,0x80 ,SDHCI_HOST_CONTROL2 ); -sdhci_acpi_amd_hs400_dll (host); + +if (old_timing != host->timing && amd_host->tuned_clock) { +if (host->timing ==MMC_TIMING_MMC_HS400 || + host->timing ==MMC_TIMING_MMC_HS200 ) { + val =sdhci_readw (host,SDHCI_HOST_CONTROL2 ); + val |=SDHCI_CTRL_TUNED_CLK ; +sdhci_writew (host, val,SDHCI_HOST_CONTROL2 ); + }else { + val =sdhci_readw (host,SDHCI_HOST_CONTROL2 ); + val &= ~SDHCI_CTRL_TUNED_CLK ; +sdhci_writew (host, val,SDHCI_HOST_CONTROL2 ); + } + +/* DLL is only required for HS400 */ +if (host->timing ==MMC_TIMING_MMC_HS400 && + !amd_host->dll_enabled) { +sdhci_acpi_amd_hs400_dll (host); + amd_host->dll_enabled = true; + } } } +static int amd_sdhci_execute_tuning (struct mmc_host *mmc,u32 opcode) +{ +int err; +struct sdhci_host *host =mmc_priv (mmc); +struct sdhci_acpi_host *acpi_host =sdhci_priv (host); +struct amd_sdhci_host *amd_host =sdhci_acpi_priv (acpi_host); + + amd_host->tuned_clock = false; + + err =sdhci_execute_tuning (mmc, opcode); + +if (!err && !host->tuning_err) + amd_host->tuned_clock = true; + +return err; +} +static const struct sdhci_ops sdhci_acpi_ops_amd = { .set_clock = sdhci_set_clock, .set_bus_width = sdhci_set_bus_width,
@@ -601,6 +646,7 @@ static int sdhci_acpi_emmc_amd_probe_slot(struct platform_device *pdev, host->mmc_host_ops.select_drive_strength = amd_select_drive_strength; host->mmc_host_ops.set_ios = amd_set_ios; + host->mmc_host_ops.execute_tuning = amd_sdhci_execute_tuning;return 0 ; }
@@ -612,6 +658,7 @@ static const struct sdhci_acpi_slot sdhci_acpi_slot_amd_emmc = { SDHCI_QUIRK_32BIT_ADMA_SIZE, .quirks2 = SDHCI_QUIRK2_BROKEN_64_BIT_DMA, .probe_slot = sdhci_acpi_emmc_amd_probe_slot, + .priv_size = sizeof(struct amd_sdhci_host), };struct sdhci_acpi_uid_slot {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 52/186 perf sched timehist: Fix use of CPU list with summary option
In reply to Greg Kroah-HartmanFrom: David Ahern <[email protected]>
[ Upstream commit a74eaf1605d42391c2357a70e94e5a2c7780fea9 ]
Do not update thread stats or show idle summary unless CPU is in the list of interest.
--- tools/perf/builtin-sched.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/builtin-sched.c +5 -1
@@ -2575,7 +2575,8 @@ static int timehist_sched_change_event(struct perf_tool *tool, }if (!sched->idle_hist || thread->tid ==0 ) { -timehist_update_runtime_stats (tr, t, tprev); +if (!cpu_list ||test_bit (sample->cpu, cpu_bitmap)) +timehist_update_runtime_stats (tr, t, tprev);if (sched->idle_hist) {struct idle_thread_runtime *itr = (void *)tr;
@@ -2848,6 +2849,9 @@ static void timehist_print_summary(struct perf_sched *sched,printf ("\nIdle stats:\n" );for (i =0 ; i < idle_max_cpu; ++i) { +if (cpu_list && !test_bit (i, cpu_bitmap)) +continue ; + t = idle_threads[i];if (!t)continue ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 53/186 perf top: Skip side-band event setup if HAVE_LIBBPF_SUPPORT is not set
In reply to Greg Kroah-HartmanFrom: Tiezhu Yang <[email protected]>
[ Upstream commit 0c5f1acc2a14416bf30023f373558d369afdbfc8 ]
When I execute 'perf top' without HAVE_LIBBPF_SUPPORT, there exists the following segmentation fault, skip the side-band event setup to fix it, this is similar with commit 1101c872c8c7 ("perf record: Skip side-band event setup if HAVE_LIBBPF_SUPPORT is not set").
[yangtiezhu@linux perf]$ ./perf top <SNIP>
perf: Segmentation fault
Obtained 6 stack frames. ./perf(sighandler_dump_stack+0x5c) [0x12011b604] [0xffffffc010] ./perf(perf_mmap__read_init+0x3e) [0x1201feeae] ./perf() [0x1200d715c] /lib64/libpthread.so.0(+0xab9c) [0xffee10ab9c] /lib64/libc.so.6(+0x128f4c) [0xffedc08f4c] Segmentation fault
[yangtiezhu@linux perf]$
I use git bisect to find commit b38d85ef49cf ("perf bpf: Decouple creating the evlist from adding the SB event") is the first bad commit, so also add the Fixes tag.
Committer testing:
First build perf explicitely disabling libbpf:
$ make NO_LIBBPF=1 O=/tmp/build/perf -C tools/perf install-bin && perf test python
Now make sure it isn't linked:
$ perf -vv | grep -w bpf
bpf: [ OFF ] # HAVE_LIBBPF_SUPPORT
$
$ nm ~/bin/perf | grep libbpf
$And now try to run 'perf top':
# perf top perf: Segmentation fault -------- backtrace -------- perf[0x5bcd6d] /lib64/libc.so.6(+0x3ca6f)[0x7fd0f5a66a6f] perf(perf_mmap__read_init+0x1e)[0x5e1afe] perf[0x4cc468] /lib64/libpthread.so.0(+0x9431)[0x7fd0f645a431] /lib64/libc.so.6(clone+0x42)[0x7fd0f5b2b912] #
Applying this patch fixes the issue.
--- tools/perf/builtin-top.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/builtin-top.c +2 -0
@@ -1746,6 +1746,7 @@ int cmd_top(int argc, const char **argv) goto out_delete_evlist; } +#ifdef HAVE_LIBBPF_SUPPORT if (!top.record_opts.no_bpf_event) { top.sb_evlist =evlist__new ();
@@ -1759,6 +1760,7 @@ int cmd_top(int argc, const char **argv) goto out_delete_evlist; } } +#endif if (perf_evlist__start_sb_thread (top.sb_evlist, target)) {pr_debug ("Couldn't start the BPF side band thread:\nBPF programs starting from now on won't be annotatable\n" );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 54/186 netfilter: nf_tables: add NFTA_SET_USERDATA if not null
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 6f03bf43ee05b31d3822def2a80f11b3591c55b3 ]
Kernel sends an empty NFTA_SET_USERDATA attribute with no value if userspace adds a set with no NFTA_SET_USERDATA attribute.
--- net/netfilter/nf_tables_api.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/nf_tables_api.c +2 -1
@@ -3643,7 +3643,8 @@ static int nf_tables_fill_set(struct sk_buff *skb, const struct nft_ctx *ctx, goto nla_put_failure; } -if (nla_put (skb,NFTA_SET_USERDATA , set->udlen, set->udata)) +if (set->udata && +nla_put (skb,NFTA_SET_USERDATA , set->udlen, set->udata)) goto nla_put_failure; nest =nla_nest_start_noflag (skb,NFTA_SET_DESC );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 55/186 netfilter: nf_tables: incorrect enum nft_list_attributes definition
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit da9125df854ea48a6240c66e8a67be06e2c12c03 ]
This should be NFTA_LIST_UNSPEC instead of NFTA_LIST_UNPEC, all other similar attribute definitions are postfixed with _UNSPEC.
--- include/uapi/linux/netfilter/nf_tables.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/netfilter/nf_tables.h +1 -1
@@ -133,7 +133,7 @@ enum nf_tables_msg_types {* @NFTA_LIST_ELEM: list element (NLA_NESTED) */ enum nft_list_attributes { -NFTA_LIST_UNPEC , +NFTA_LIST_UNSPEC ,NFTA_LIST_ELEM , __NFTA_LIST_MAX };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 56/186 netfilter: nf_tables: fix destination register zeroing
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit 1e105e6afa6c3d32bfb52c00ffa393894a525c27 ]
Following bug was reported via irc:
nft list ruleset
set knock_candidates_ipv4 {
type ipv4_addr . inet_service
size 65535
elements = { 127.0.0.1 . 123,
127.0.0.1 . 123 }
} ..
udp dport 123 add @knock_candidates_ipv4 { ip saddr . 123 } udp dport 123 add @knock_candidates_ipv4 { ip saddr . udp dport }
It should not have been possible to add a duplicate set entry.
After some debugging it turned out that the problem is the immediate value (123) in the second-to-last rule.
Concatenations use 32bit registers, i.e. the elements are 8 bytes each, not 6 and it turns out the kernel inserted
inet firewall @knock_candidates_ipv4
element 0100007f ffff7b00 : 0 [end]
element 0100007f 00007b00 : 0 [end]Note the non-zero upper bits of the first element. It turns out that nft_immediate doesn't zero the destination register, but this is needed when the length isn't a multiple of 4.
Furthermore, the zeroing in nft_payload is broken. We can't use [len / 4] = 0 -- if len is a multiple of 4, index is off by one.
Skip zeroing in this case and use a conditional instead of (len -1) / 4.
--- include/net/netfilter/nf_tables.h | 2 ++ net/netfilter/nft_payload.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-)
include/net/netfilter/nf_tables.h +2 -0
@@ -143,6 +143,8 @@ static inline u64 nft_reg_load64(const u32 *sreg)static inline void nft_data_copy (u32 *dst,const struct nft_data *src,unsigned int len) { +if (len %NFT_REG32_SIZE ) + dst[len /NFT_REG32_SIZE ] =0 ;memcpy (dst, src, len); }
net/netfilter/nft_payload.c +3 -1
@@ -87,7 +87,9 @@ void nft_payload_eval(const struct nft_expr *expr,u32 *dest = ®s->data[priv->dreg];int offset; - dest[priv->len /NFT_REG32_SIZE ] =0 ; +if (priv->len %NFT_REG32_SIZE ) + dest[priv->len /NFT_REG32_SIZE ] =0 ; +switch (priv->base) {case NFT_PAYLOAD_LL_HEADER :if (!skb_mac_header_was_set (skb))
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 57/186 net: hns: Fix memleak in hns_nic_dev_probe
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit 100e3345c6e719d2291e1efd5de311cc24bb9c0b ]
hns_nic_dev_probe allocates ndev, but not free it on two error handling paths, which may lead to memleak.
--- drivers/net/ethernet/hisilicon/hns/hns_enet.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/ethernet/hisilicon/hns/hns_enet.c +6 -3
@@ -2282,8 +2282,10 @@ static int hns_nic_dev_probe(struct platform_device *pdev) priv->enet_ver =AE_VERSION_1 ; else if (acpi_dev_found(hns_enet_acpi_match[1].id)) priv->enet_ver = AE_VERSION_2; - else - return -ENXIO; + else { + ret = -ENXIO ; + goto out_read_prop_fail; + }/* try to find port-idx-in-ae first */ ret = acpi_node_get_property_reference(dev->fwnode,
@@ -2299,7 +2301,8 @@ static int hns_nic_dev_probe(struct platform_device *pdev) priv->fwnode = args.fwnode; }else {dev_err (dev,"cannot read cfg data from OF or acpi\n" ); -return -ENXIO ; + ret = -ENXIO ; + goto out_read_prop_fail; } ret =device_property_read_u32 (dev,"port-idx-in-ae" , &port_id);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 58/186 net: systemport: Fix memleak in bcm_sysport_probe
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit 7ef1fc57301f3cef7201497aa27e89ccb91737fe ]
When devm_kcalloc() fails, dev should be freed just like what we've done in the subsequent error paths.
--- drivers/net/ethernet/broadcom/bcmsysport.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bcmsysport.c +4 -2
@@ -2462,8 +2462,10 @@ static int bcm_sysport_probe(struct platform_device *pdev) priv->tx_rings =devm_kcalloc (&pdev->dev, txq,sizeof (struct bcm_sysport_tx_ring ),GFP_KERNEL ); -if (!priv->tx_rings) -return -ENOMEM ; +if (!priv->tx_rings) { + ret = -ENOMEM ; + goto err_free_netdev; + } priv->is_lite = params->is_lite; priv->num_rx_desc_words = params->num_rx_desc_words;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 59/186 ravb: Fixed to be able to unload modules
In reply to Greg Kroah-HartmanFrom: Yuusuke Ashizuka <[email protected]>
[ Upstream commit 1838d6c62f57836639bd3d83e7855e0ee4f6defc ]
When this driver is built as a module, I cannot rmmod it after insmoding it.
This is because that this driver calls ravb_mdio_init() at the time of probe, and module->refcnt is incremented by alloc_mdio_bitbang() called after that.
Therefore, even if ifup is not performed, the driver is in use and rmmod cannot be performed.
$ lsmod Module Size Used by ravb 40960 1 $ rmmod ravb rmmod: ERROR: Module ravb is in use
Call ravb_mdio_init() at open and free_mdio_bitbang() at close, thereby rmmod is possible in the ifdown state.
--- drivers/net/ethernet/renesas/ravb_main.c | 110 +++++++++++------------ 1 file changed, 55 insertions(+), 55 deletions(-)
drivers/net/ethernet/renesas/ravb_main.c +55 -55
@@ -1342,6 +1342,51 @@ static inline int ravb_hook_irq(unsigned int irq, irq_handler_t handler,return error; } +/* MDIO bus init function */ +static int ravb_mdio_init (struct ravb_private *priv) +{ +struct platform_device *pdev = priv->pdev; +struct device *dev = &pdev->dev; +int error; + +/* Bitbang init */ + priv->mdiobb.ops = &bb_ops; + +/* MII controller setting */ + priv->mii_bus =alloc_mdio_bitbang (&priv->mdiobb); +if (!priv->mii_bus) +return -ENOMEM ; + +/* Hook up MII support for ethtool */ + priv->mii_bus->name ="ravb_mii" ; + priv->mii_bus->parent = dev; +snprintf (priv->mii_bus->id,MII_BUS_ID_SIZE ,"%s-%x" , + pdev->name, pdev->id); + +/* Register MDIO bus */ + error =of_mdiobus_register (priv->mii_bus, dev->of_node); +if (error) + goto out_free_bus; + +return 0 ; + +out_free_bus: +free_mdio_bitbang (priv->mii_bus); +return error; +} + +/* MDIO bus release function */ +static int ravb_mdio_release (struct ravb_private *priv) +{ +/* Unregister mdio bus */ +mdiobus_unregister (priv->mii_bus); + +/* Free bitbang info */ +free_mdio_bitbang (priv->mii_bus); + +return 0 ; +} +/* Network device open function for Ethernet AVB */ static int ravb_open (struct net_device *ndev) {
@@ -1350,6 +1395,13 @@ static int ravb_open(struct net_device *ndev)struct device *dev = &pdev->dev;int error; +/* MDIO bus init */ + error =ravb_mdio_init (priv); +if (error) { +netdev_err (ndev,"failed to initialize MDIO\n" ); +return error; + } +napi_enable (&priv->napi[RAVB_BE ]);napi_enable (&priv->napi[RAVB_NC ]);
@@ -1427,6 +1479,7 @@ out_free_irq: out_napi_off:napi_disable (&priv->napi[RAVB_NC ]);napi_disable (&priv->napi[RAVB_BE ]); +ravb_mdio_release (priv);return error; }
@@ -1736,6 +1789,8 @@ static int ravb_close(struct net_device *ndev)ravb_ring_free (ndev,RAVB_BE );ravb_ring_free (ndev,RAVB_NC ); +ravb_mdio_release (priv); +return 0 ; }
@@ -1887,51 +1942,6 @@ static const struct net_device_ops ravb_netdev_ops = { .ndo_set_features = ravb_set_features, }; -/* MDIO bus init function */ -static int ravb_mdio_init (struct ravb_private *priv) -{ -struct platform_device *pdev = priv->pdev; -struct device *dev = &pdev->dev; -int error; - -/* Bitbang init */ - priv->mdiobb.ops = &bb_ops; - -/* MII controller setting */ - priv->mii_bus =alloc_mdio_bitbang (&priv->mdiobb); -if (!priv->mii_bus) -return -ENOMEM ; - -/* Hook up MII support for ethtool */ - priv->mii_bus->name ="ravb_mii" ; - priv->mii_bus->parent = dev; -snprintf (priv->mii_bus->id,MII_BUS_ID_SIZE ,"%s-%x" , - pdev->name, pdev->id); - -/* Register MDIO bus */ - error =of_mdiobus_register (priv->mii_bus, dev->of_node); -if (error) - goto out_free_bus; - -return 0 ; - -out_free_bus: -free_mdio_bitbang (priv->mii_bus); -return error; -} - -/* MDIO bus release function */ -static int ravb_mdio_release (struct ravb_private *priv) -{ -/* Unregister mdio bus */ -mdiobus_unregister (priv->mii_bus); - -/* Free bitbang info */ -free_mdio_bitbang (priv->mii_bus); - -return 0 ; -} -static const struct of_device_id ravb_match_table[] = { { .compatible ="renesas,etheravb-r8a7790" , .data = (void *)RCAR_GEN2 }, { .compatible ="renesas,etheravb-r8a7794" , .data = (void *)RCAR_GEN2 },
@@ -2174,13 +2184,6 @@ static int ravb_probe(struct platform_device *pdev)eth_hw_addr_random (ndev); } -/* MDIO bus init */ - error =ravb_mdio_init (priv); -if (error) { -dev_err (&pdev->dev,"failed to initialize MDIO\n" ); - goto out_dma_free; - } -netif_napi_add (ndev, &priv->napi[RAVB_BE ], ravb_poll,64 );netif_napi_add (ndev, &priv->napi[RAVB_NC ], ravb_poll,64 );
@@ -2202,8 +2205,6 @@ static int ravb_probe(struct platform_device *pdev) out_napi_del:netif_napi_del (&priv->napi[RAVB_NC ]);netif_napi_del (&priv->napi[RAVB_BE ]); -ravb_mdio_release (priv); -out_dma_free:dma_free_coherent (ndev->dev.parent, priv->desc_bat_size, priv->desc_bat, priv->desc_bat_dma);
@@ -2235,7 +2236,6 @@ static int ravb_remove(struct platform_device *pdev)unregister_netdev (ndev);netif_napi_del (&priv->napi[RAVB_NC ]);netif_napi_del (&priv->napi[RAVB_BE ]); -ravb_mdio_release (priv);pm_runtime_disable (&pdev->dev);free_netdev (ndev);platform_set_drvdata (pdev,NULL );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 60/186 net: arc_emac: Fix memleak in arc_mdio_probe
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit e2d79cd8875fa8c3cc7defa98a8cc99a1ed0c62f ]
When devm_gpiod_get_optional() fails, bus should be freed just like when of_mdiobus_register() fails.
--- drivers/net/ethernet/arc/emac_mdio.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/arc/emac_mdio.c +1 -0
@@ -153,6 +153,7 @@ int arc_mdio_probe(struct arc_emac_priv *priv)if (IS_ERR (data->reset_gpio)) { error =PTR_ERR (data->reset_gpio);dev_err (priv->dev,"Failed to request gpio: %d\n" , error); +mdiobus_free (bus);return error; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 61/186 bpf: Fix a buffer out-of-bound access when filling raw_tp link_info
In reply to Greg Kroah-HartmanFrom: Yonghong Song <[email protected]>
[ Upstream commit b474959d5afda6e341a02c85f9595d85d39189ae ]
Commit f2e10bff16a0 ("bpf: Add support for BPF_OBJ_GET_INFO_BY_FD for bpf_link") added link query for raw_tp. One of fields in link_info is to
fill a user buffer with tp_name. The Scurrent checking only declares "ulen && !ubuf" as invalid. So "!ulen && ubuf" will be valid. Later on, we do "copy_to_user(ubuf, tp_name, ulen - 1)" which may overwrite user memory incorrectly.
This patch fixed the problem by disallowing "!ulen && ubuf" case as well.
--- kernel/bpf/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/syscall.c +1 -1
@@ -2629,7 +2629,7 @@ static int bpf_raw_tp_link_fill_link_info(const struct bpf_link *link,u32 ulen = info->raw_tracepoint.tp_name_len;size_t tp_len =strlen (tp_name); -if (ulen && !ubuf) +if (!ulen ^ !ubuf)return -EINVAL ; info->raw_tracepoint.tp_name_len = tp_len +1 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 62/186 dmaengine: pl330: Fix burst length if burst size is smaller than bus width
In reply to Greg Kroah-HartmanFrom: Marek Szyprowski <[email protected]>
[ Upstream commit 0661cef675d37e2c4b66a996389ebeae8568e49e ]
Move the burst len fixup after setting the generic value for it. This finally enables the fixup introduced by commit 137bd11090d8 ("dmaengine:
pl330: Align DMA memcpy operations to MFIFO width"), which otherwise was overwritten by the generic value.
--- drivers/dma/pl330.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/pl330.c +1 -1
@@ -2788,6 +2788,7 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst,while (burst != (1 << desc->rqcfg.brst_size)) desc->rqcfg.brst_size++; + desc->rqcfg.brst_len =get_burst_len (desc, len);/* * If burst size is smaller than bus width then make sure we only * transfer one at a time to avoid a burst stradling an MFIFO entry.
@@ -2795,7 +2796,6 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst,if (desc->rqcfg.brst_size *8 < pl330->pcfg.data_bus_width) desc->rqcfg.brst_len =1 ; - desc->rqcfg.brst_len =get_burst_len (desc, len); desc->bytes_requested = len; desc->txd.flags = flags;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 63/186 dmaengine: ti: k3-udma: Fix the TR initialization for prep_slave_sg
In reply to Greg Kroah-HartmanFrom: Peter Ujfalusi <[email protected]>
[ Upstream commit 33ebffa105990c43bf336cabe26c77384f59fe70 ]
The TR which needs to be initialized for the next sg entry is indexed by tr_idx and not by the running i counter.
In case any sub element in the SG needs more than one TR, the code would corrupt an already configured TR.
--- drivers/dma/ti/k3-udma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/dma/ti/k3-udma.c +3 -3
@@ -2109,9 +2109,9 @@ udma_prep_slave_sg_tr(struct udma_chan *uc, struct scatterlist *sgl,return NULL ; } -cppi5_tr_init (&tr_req[i].flags,CPPI5_TR_TYPE1 , false, false, -CPPI5_TR_EVENT_SIZE_COMPLETION ,0 ); -cppi5_tr_csf_set (&tr_req[i].flags,CPPI5_TR_CSF_SUPR_EVT ); +cppi5_tr_init (&tr_req[tr_idx].flags,CPPI5_TR_TYPE1 , false, + false,CPPI5_TR_EVENT_SIZE_COMPLETION ,0 ); +cppi5_tr_csf_set (&tr_req[tr_idx].flags,CPPI5_TR_CSF_SUPR_EVT ); tr_req[tr_idx].addr = sg_addr; tr_req[tr_idx].icnt0 = tr0_cnt0;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 64/186 gtp: add GTPA_LINK info to msg sent to userspace
In reply to Greg Kroah-HartmanFrom: Nicolas Dichtel <[email protected]>
[ Upstream commit b274e47d9e3f4dcd4ad4028a316ec22dc4533ac7 ]
During a dump, this attribute is essential, it enables the userspace to know on which interface the context is linked to.
--- drivers/net/gtp.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/gtp.c +1 -0
@@ -1179,6 +1179,7 @@ static int gtp_genl_fill_info(struct sk_buff *skb, u32 snd_portid, u32 snd_seq, goto nlmsg_failure;if (nla_put_u32 (skb,GTPA_VERSION , pctx->gtp_version) || +nla_put_u32 (skb,GTPA_LINK , pctx->dev->ifindex) ||nla_put_be32 (skb,GTPA_PEER_ADDRESS , pctx->peer_addr_ip4.s_addr) ||nla_put_be32 (skb,GTPA_MS_ADDRESS , pctx->ms_addr_ip4.s_addr)) goto nla_put_failure;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 65/186 net: ethernet: ti: cpsw: fix clean up of vlan mc entries for host port
In reply to Greg Kroah-HartmanFrom: Murali Karicheri <[email protected]>
[ Upstream commit 99d469fc64d06f0c81c0fe2a1c01645a67e0cbf0 ]
To flush the vid + mc entries from ALE, which is required when a VLAN interface is removed, driver needs to call cpsw_ale_flush_multicast() with ALE_PORT_HOST for port mask as these entries are added only for host port. Without this, these entries remain in the ALE table even after removing the VLAN interface. cpsw_ale_flush_multicast() calls cpsw_ale_flush_mcast which expects a port mask to do the job.
--- drivers/net/ethernet/ti/cpsw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ti/cpsw.c +1 -1
@@ -1116,7 +1116,7 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev, HOST_PORT_NUM, ALE_VLAN, vid); ret |=cpsw_ale_del_mcast (cpsw->ale, priv->ndev->broadcast,0 ,ALE_VLAN , vid); - ret |=cpsw_ale_flush_multicast (cpsw->ale,0 , vid); + ret |=cpsw_ale_flush_multicast (cpsw->ale,ALE_PORT_HOST , vid); err:pm_runtime_put (cpsw->dev);return ret;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 66/186 net: ethernet: ti: cpsw_new: fix clean up of vlan mc entries for host port
In reply to Greg Kroah-HartmanFrom: Murali Karicheri <[email protected]>
[ Upstream commit 2c6500e82e5190b038f0b79f85a20da55bdd4b86 ]
To flush the vid + mc entries from ALE, which is required when a VLAN interface is removed, driver needs to call cpsw_ale_flush_multicast() with ALE_PORT_HOST for port mask as these entries are added only for host port. Without this, these entries remain in the ALE table even after removing the VLAN interface. cpsw_ale_flush_multicast() calls cpsw_ale_flush_mcast which expects a port mask to do the job.
--- drivers/net/ethernet/ti/cpsw_new.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ti/cpsw_new.c +1 -1
@@ -1044,7 +1044,7 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev, HOST_PORT_NUM, ALE_VLAN, vid);cpsw_ale_del_mcast (cpsw->ale, priv->ndev->broadcast,0 ,ALE_VLAN , vid); -cpsw_ale_flush_multicast (cpsw->ale,0 , vid); +cpsw_ale_flush_multicast (cpsw->ale,ALE_PORT_HOST , vid); err:pm_runtime_put (cpsw->dev);return ret;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 67/186 bnxt_en: Dont query FW when netif_running() is false.
In reply to Greg Kroah-HartmanFrom: Pavan Chebbi <[email protected]>
[ Upstream commit c1c2d77408022a398a1a7c51cf20488c922629de ]
In rare conditions like two stage OS installation, the ethtool's get_channels function may be called when the device is in D3 state, leading to uncorrectable PCI error. Check netif_running() first before making any query to FW which involves writing to BAR.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +1 -1
@@ -847,7 +847,7 @@ static void bnxt_get_channels(struct net_device *dev,int max_tx_sch_inputs;/* Get the most up-to-date max_tx_sch_inputs. */ -if (BNXT_NEW_RM (bp)) +if (netif_running (dev) &&BNXT_NEW_RM (bp))bnxt_hwrm_func_resc_qcaps (bp, false); max_tx_sch_inputs = hw_resc->max_tx_sch_inputs;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 68/186 bnxt_en: Check for zero dir entries in NVRAM.
In reply to Greg Kroah-HartmanFrom: Vasundhara Volam <[email protected]>
[ Upstream commit dbbfa96ad920c50d58bcaefa57f5f33ceef9d00e ]
If firmware goes into unstable state, HWRM_NVM_GET_DIR_INFO firmware command may return zero dir entries. Return error in such case to avoid zero length dma buffer request.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +3 -0
@@ -2270,6 +2270,9 @@ static int bnxt_get_nvram_directory(struct net_device *dev, u32 len, u8 *data)if (rc !=0 )return rc; +if (!dir_entries || !entry_length) +return -EIO ; +/* Insert 2 bytes of directory info (count and size of entries) */ if (len <2 )return -EINVAL ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 69/186 bnxt_en: Fix ethtool -S statitics with XDP or TCs enabled.
In reply to Greg Kroah-HartmanFrom: Michael Chan <[email protected]>
[ Upstream commit 7de651490c27ebc5edb5c7224c368bd0cd5b3862 ]
We are returning the wrong count for ETH_SS_STATS in get_sset_count() when XDP or TCs are enabled. In a recent commit, we got rid of irrelevant counters when the ring is RX only or TX only, but we did not make the proper adjustments for the count. As a result, when we have XDP or TCs enabled, we are returning an excess count because some of the rings are TX only. This causes ethtool -S to display extra counters with no counter names.
Fix bnxt_get_num_ring_stats() by not assuming that all rings will always have RX and TX counters in combined mode.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +2 -9
@@ -494,20 +494,13 @@ static int bnxt_get_num_tpa_ring_stats(struct bnxt *bp)static int bnxt_get_num_ring_stats (struct bnxt *bp) {int rx, tx, cmn; -bool sh = false; - -if (bp->flags &BNXT_FLAG_SHARED_RINGS ) - sh = true; rx =NUM_RING_RX_HW_STATS +NUM_RING_RX_SW_STATS +bnxt_get_num_tpa_ring_stats (bp); tx =NUM_RING_TX_HW_STATS ; cmn =NUM_RING_CMN_SW_STATS ; -if (sh) -return (rx + tx + cmn) * bp->cp_nr_rings; -else -return rx * bp->rx_nr_rings + tx * bp->tx_nr_rings + - cmn * bp->cp_nr_rings; +return rx * bp->rx_nr_rings + tx * bp->tx_nr_rings + + cmn * bp->cp_nr_rings; }static int bnxt_get_num_stats (struct bnxt *bp)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 70/186 bnxt_en: Fix PCI AER error recovery flow
In reply to Greg Kroah-HartmanFrom: Vasundhara Volam <[email protected]>
[ Upstream commit df3875ec550396974b1d8a518bd120d034738236 ]
When a PCI error is detected the PCI state could be corrupt, save the PCI state after initialization and restore it after the slot reset.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +3 -0
@@ -12065,6 +12065,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) (long)pci_resource_start(pdev, 0), dev->dev_addr);pcie_print_link_status (pdev); +pci_save_state (pdev);return 0 ; init_err_cleanup:
@@ -12260,6 +12261,8 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev) "Cannot re-enable PCI device after reset.\n"); }else {pci_set_master (pdev); +pci_restore_state (pdev); +pci_save_state (pdev); err =bnxt_hwrm_func_reset (bp);if (!err) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 71/186 bnxt_en: Fix possible crash in bnxt_fw_reset_task().
In reply to Greg Kroah-HartmanFrom: Michael Chan <[email protected]>
[ Upstream commit b148bb238c02f0c7797efed026e9bba5892d2172 ]
bnxt_fw_reset_task() is run from a delayed workqueue. The current code is not cancelling the workqueue in the driver's .remove() method and it can potentially crash if the device is removed with the workqueue still pending.
The fix is to clear the BNXT_STATE_IN_FW_RESET flag and then cancel the delayed workqueue in bnxt_remove_one(). bnxt_queue_fw_reset_work() also needs to check that this flag is set before scheduling. This will guarantee that no rescheduling will be done after it is cancelled.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +8 -2
@@ -1141,6 +1141,9 @@ static int bnxt_discard_rx(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,static void bnxt_queue_fw_reset_work (struct bnxt *bp,unsigned long delay) { +if (!(test_bit (BNXT_STATE_IN_FW_RESET , &bp->state))) +return ; +if (BNXT_PF (bp))queue_delayed_work (bnxt_pf_wq, &bp->fw_reset_task, delay);else
@@ -1157,10 +1160,12 @@ static void bnxt_queue_sp_work(struct bnxt *bp)static void bnxt_cancel_sp_work (struct bnxt *bp) { -if (BNXT_PF (bp)) +if (BNXT_PF (bp)) {flush_workqueue (bnxt_pf_wq); -else + }else {cancel_work_sync (&bp->sp_task); +cancel_delayed_work_sync (&bp->fw_reset_task); + } }static void bnxt_sched_reset (struct bnxt *bp,struct bnxt_rx_ring_info *rxr)
@@ -11501,6 +11506,7 @@ static void bnxt_remove_one(struct pci_dev *pdev)unregister_netdev (dev);bnxt_dl_unregister (bp);bnxt_shutdown_tc (bp); +clear_bit (BNXT_STATE_IN_FW_RESET , &bp->state);bnxt_cancel_sp_work (bp); bp->sp_event =0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 72/186 bnxt_en: fix HWRM error when querying VF temperature
In reply to Greg Kroah-HartmanFrom: Edwin Peer <[email protected]>
[ Upstream commit 12cce90b934bf2b0ed9c339b4d5503e69954351a ]
Firmware returns RESOURCE_ACCESS_DENIED for HWRM_TEMP_MONITORY_QUERY for VFs. This produces unpleasing error messages in the log when temp1_input is queried via the hwmon sysfs interface from a VF.
The error is harmless and expected, so silence it and return unknown as the value. Since the device temperature is not particularly sensitive information, provide flexibility to change this policy in future by silencing the error rather than avoiding the HWRM call entirely for VFs.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +7 -4
@@ -8992,16 +8992,19 @@ static ssize_t bnxt_show_temp(struct device *dev,struct hwrm_temp_monitor_query_input req = {0 };struct hwrm_temp_monitor_query_output *resp;struct bnxt *bp =dev_get_drvdata (dev); -u32 temp =0 ; +u32 len =0 ; resp = bp->hwrm_cmd_resp_addr;bnxt_hwrm_cmd_hdr_init (bp, &req,HWRM_TEMP_MONITOR_QUERY ,-1 ,-1 );mutex_lock (&bp->hwrm_cmd_lock); -if (!_hwrm_send_message (bp, &req,sizeof (req),HWRM_CMD_TIMEOUT )) - temp = resp->temp *1000 ;/* display millidegree */ +if (!_hwrm_send_message_silent (bp, &req,sizeof (req),HWRM_CMD_TIMEOUT )) + len =sprintf (buf,"%u\n" , resp->temp *1000 );/* display millidegree */ mutex_unlock (&bp->hwrm_cmd_lock); -return sprintf (buf,"%u\n" , temp); +if (len) +return len; + +return sprintf (buf,"unknown\n" ); } static SENSOR_DEVICE_ATTR(temp1_input, 0444, bnxt_show_temp, NULL, 0);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 73/186 xfs: finish dfops on every insert range shift iteration
In reply to Greg Kroah-HartmanFrom: Brian Foster <[email protected]>
[ Upstream commit 9c516e0e4554e8f26ab73d46cbc789d7d8db664d ]
The recent change to make insert range an atomic operation used the incorrect transaction rolling mechanism. The explicit transaction roll does not finish deferred operations. This means that intents for rmapbt updates caused by extent shifts are not logged until the final transaction commits. Thus if a crash occurs during an insert range, log recovery might leave the rmapbt in an inconsistent state. This was discovered by repeated runs of generic/455.
Update insert range to finish dfops on every shift iteration. This is similar to collapse range and ensures that intents are logged with the transactions that make associated changes.
--- fs/xfs/xfs_bmap_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_bmap_util.c +1 -1
@@ -1165,7 +1165,7 @@ xfs_insert_file_space( goto out_trans_cancel; do { - error = xfs_trans_roll_inode(&tp, ip); + error = xfs_defer_finish(&tp); if (error) goto out_trans_cancel;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 74/186 xfs: fix boundary test in xfs_attr_shortform_verify
In reply to Greg Kroah-HartmanFrom: Eric Sandeen <[email protected]>
[ Upstream commit f4020438fab05364018c91f7e02ebdd192085933 ]
The boundary test for the fixed-offset parts of xfs_attr_sf_entry in xfs_attr_shortform_verify is off by one, because the variable array at the end is defined as nameval[1] not nameval[].
Hence we need to subtract 1 from the calculation.
This can be shown by:
# touch file # setfattr -n root.a file
and verifications will fail when it's written to disk.
This only matters for a last attribute which has a single-byte name and no value, otherwise the combination of namelen & valuelen will push endp further out and this test won't fail.
--- fs/xfs/libxfs/xfs_attr_leaf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/xfs/libxfs/xfs_attr_leaf.c +3 -1
@@ -996,8 +996,10 @@ xfs_attr_shortform_verify(* struct xfs_attr_sf_entry has a variable length. * Check the fixed-offset parts of the structure are * within the data buffer. +* xfs_attr_sf_entry is defined with a 1-byte variable +* array at the end, so we must subtract that off. */ -if (((char *)sfep +sizeof (*sfep)) >= endp) +if (((char *)sfep +sizeof (*sfep) -1 ) >= endp)return __this_address;/* Don't allow names with known bad length. */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 75/186 bnxt: dont enable NAPI until rings are ready
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 96ecdcc992eb7f468b2cf829b0f5408a1fad4668 ]
Netpoll can try to poll napi as soon as napi_enable() is called. It crashes trying to access a doorbell which is still NULL:
BUG: kernel NULL pointer dereference, address: 0000000000000000 CPU: 59 PID: 6039 Comm: ethtool Kdump: loaded Tainted: G S 5.9.0-rc1-00469-g5fd99b5d9950-dirty #26 RIP: 0010:bnxt_poll+0x121/0x1c0 Code: c4 20 44 89 e0 5b 5d 41 5c 41 5d 41 5e 41 5f c3 41 8b 86 a0 01 00 00 41 23 85 18 01 00 00 49 8b 96 a8 01 00 00 0d 00 00 00 24 <89> 02 41 f6 45 77 02 74 cb 49 8b ae d8 01 00 00 31 c0 c7 44 24 1a netpoll_poll_dev+0xbd/0x1a0 __netpoll_send_skb+0x1b2/0x210 netpoll_send_udp+0x2c9/0x406 write_ext_msg+0x1d7/0x1f0 console_unlock+0x23c/0x520 vprintk_emit+0xe0/0x1d0 printk+0x58/0x6f x86_vector_activate.cold+0xf/0x46 __irq_domain_activate_irq+0x50/0x80 __irq_domain_activate_irq+0x32/0x80 __irq_domain_activate_irq+0x32/0x80 irq_domain_activate_irq+0x25/0x40 __setup_irq+0x2d2/0x700 request_threaded_irq+0xfb/0x160 __bnxt_open_nic+0x3b1/0x750 bnxt_open_nic+0x19/0x30 ethtool_set_channels+0x1ac/0x220 dev_ethtool+0x11ba/0x2240 dev_ioctl+0x1cf/0x390 sock_do_ioctl+0x95/0x130
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +4 -8
@@ -9186,15 +9186,15 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) } } -bnxt_enable_napi (bp); -bnxt_debug_dev_init (bp); - rc =bnxt_init_nic (bp, irq_re_init);if (rc) {netdev_err (bp->dev,"bnxt_init_nic err: %x\n" , rc); - goto open_err; + goto open_err_irq; } +bnxt_enable_napi (bp); +bnxt_debug_dev_init (bp); +if (link_re_init) {mutex_lock (&bp->link_lock); rc =bnxt_update_phy_setting (bp);
@@ -9225,10 +9225,6 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)bnxt_vf_reps_open (bp);return 0 ; -open_err: -bnxt_debug_dev_exit (bp); -bnxt_disable_napi (bp); - open_err_irq:bnxt_del_napi (bp);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 76/186 media: vicodec: add missing v4l2_ctrl_request_hdl_put()
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
[ Upstream commit 2e7c8fb8942773f412fe12f3b63e8bb92c18ab3f ]
The check for a required control in the request was missing a call to v4l2_ctrl_request_hdl_put(), so the control request object was never released.
--- drivers/media/test-drivers/vicodec/vicodec-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/test-drivers/vicodec/vicodec-core.c +1 -0
@@ -1994,6 +1994,7 @@ static int vicodec_request_validate(struct media_request *req) } ctrl =v4l2_ctrl_request_hdl_ctrl_find (hdl, vicodec_ctrl_stateless_state.id); +v4l2_ctrl_request_hdl_put (hdl);if (!ctrl) {v4l2_info (&ctx->dev->v4l2_dev,"Missing required codec control\n" );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 77/186 media: cedrus: Add missing v4l2_ctrl_request_hdl_put()
In reply to Greg Kroah-HartmanFrom: Ezequiel Garcia <[email protected]>
[ Upstream commit b30063976f29fc221a99d18d37d22ca035068aa9 ]
The check for a required control in the request was missing a call to v4l2_ctrl_request_hdl_put() in the error path. Fix it.
--- drivers/staging/media/sunxi/cedrus/cedrus.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/staging/media/sunxi/cedrus/cedrus.c +6 -1
@@ -199,6 +199,7 @@ static int cedrus_request_validate(struct media_request *req)struct v4l2_ctrl *ctrl_test;unsigned int count;unsigned int i; +int ret =0 ;list_for_each_entry (obj, &req->objects, list) {struct vb2_buffer *vb;
@@ -243,12 +244,16 @@ static int cedrus_request_validate(struct media_request *req)if (!ctrl_test) {v4l2_info (&ctx->dev->v4l2_dev,"Missing required codec control\n" ); -return -ENOENT ; + ret = -ENOENT ; +break ; } }v4l2_ctrl_request_hdl_put (hdl); +if (ret) +return ret; +return vb2_request_validate (req); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 78/186 net: ethernet: ti: cpsw_new: fix error handling in cpsw_ndo_vlan_rx_kill_vid()
In reply to Greg Kroah-HartmanFrom: Murali Karicheri <[email protected]>
[ Upstream commit af8ea111134624855710a0ef5543b871d49b0162 ]
This patch fixes a bunch of issues in cpsw_ndo_vlan_rx_kill_vid()
- pm_runtime_get_sync() returns non zero value. This results in non zero value return to caller which will be interpreted as error. So overwrite ret with zero.
- If VID matches with port VLAN VID, then set error code.
- Currently when VLAN interface is deleted, all of the VLAN mc addresses are removed from ALE table, however the return values from ale function calls are not checked. These functions can return error code -ENOENT. But that shouldn't happen in a normal case. So add error print to catch the situations so that these can be investigated and addressed. return zero in these cases as these are not real error case, but only serve to catch ALE table update related issues and help address the same in the driver.
--- drivers/net/ethernet/ti/cpsw_new.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
drivers/net/ethernet/ti/cpsw_new.c +21 -6
@@ -1032,19 +1032,34 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev,return ret; } +/* reset the return code as pm_runtime_get_sync() can return +* non zero values as well. +*/ + ret =0 ;for (i =0 ; i < cpsw->data.slaves; i++) {if (cpsw->slaves[i].ndev && - vid == cpsw->slaves[i].port_vlan) + vid == cpsw->slaves[i].port_vlan) { + ret = -EINVAL ; goto err; + } }dev_dbg (priv->dev,"removing vlanid %d from vlan filter\n" , vid); -cpsw_ale_del_vlan (cpsw->ale, vid,0 ); -cpsw_ale_del_ucast (cpsw->ale, priv->mac_addr, -HOST_PORT_NUM ,ALE_VLAN , vid); -cpsw_ale_del_mcast (cpsw->ale, priv->ndev->broadcast, -0 ,ALE_VLAN , vid); + ret =cpsw_ale_del_vlan (cpsw->ale, vid,0 ); +if (ret) +dev_err (priv->dev,"cpsw_ale_del_vlan() failed: ret %d\n" , ret); + ret =cpsw_ale_del_ucast (cpsw->ale, priv->mac_addr, +HOST_PORT_NUM ,ALE_VLAN , vid); +if (ret) +dev_err (priv->dev,"cpsw_ale_del_ucast() failed: ret %d\n" , + ret); + ret =cpsw_ale_del_mcast (cpsw->ale, priv->ndev->broadcast, +0 ,ALE_VLAN , vid); +if (ret) +dev_err (priv->dev,"cpsw_ale_del_mcast failed. ret %d\n" , + ret);cpsw_ale_flush_multicast (cpsw->ale,ALE_PORT_HOST , vid); + ret =0 ; err:pm_runtime_put (cpsw->dev);return ret;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 79/186 media: i2c: imx214: select V4L2_FWNODE
In reply to Greg Kroah-HartmanFrom: Jacopo Mondi <[email protected]>
[ Upstream commit bca82e3557ee1fbfbdacb09033a2d81ac76c86eb ]
After the recent conversion of the media build infrastructure to select V4L2 components instead of depending on their presence, which took place in:32a363d0b0b14 ("media: Kconfig files: use select for V4L2 subdevs and MC")
imx214 stands out as being the (only?) media I2C driver that still depends on a V4L2 core symbol instead of selecting it.
This confuses the build system which claims it has detected a circular dependency when other drivers select the same symbol as the imx214 driver does.
drivers/media/i2c/Kconfig:728:error: recursive dependency detected!drivers/media/i2c/Kconfig:728: symbol VIDEO_IMX214 depends on V4L2_FWNODEdrivers/media/v4l2-core/Kconfig:71: symbol V4L2_FWNODE is selected by VIDEO_BCM2835_UNICAMdrivers/media/platform/bcm2835/Kconfig:3: symbol VIDEO_BCM2835_UNICAM depends on VIDEO_V4L2_SUBDEV_APIdrivers/media/v4l2-core/Kconfig:19: symbol VIDEO_V4L2_SUBDEV_API depends on MEDIA_CONTROLLERdrivers/media/Kconfig:168: symbol MEDIA_CONTROLLER is selected by VIDEO_IMX214
Fix this by making the imx214 driver select V4L2_FWNODE instead of depending on it and align it with all the other drivers.
--- drivers/media/i2c/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/Kconfig +1 -1
@@ -728,7 +728,7 @@ config VIDEO_HI556 config VIDEO_IMX214 tristate "Sony IMX214 sensor support" depends on GPIOLIB && I2C && VIDEO_V4L2 - depends on V4L2_FWNODE + select V4L2_FWNODE select MEDIA_CONTROLLER select VIDEO_V4L2_SUBDEV_API select REGMAP_I2C
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 80/186 selftests/bpf: Fix massive output from test_maps
In reply to Greg Kroah-HartmanFrom: Jesper Dangaard Brouer <[email protected]>
[ Upstream commit fa4505675e093e895b7ec49a76d44f6b5ad9602e ]
When stdout output from the selftests tool 'test_maps' gets redirected into e.g file or pipe, then the output lines increase a lot (from 21 to 33949 lines). This is caused by the printf that happens before the fork() call, and there are user-space buffered printf data that seems to be duplicated into the forked process.
To fix this fflush() stdout before the fork loop in __run_parallel().
--- tools/testing/selftests/bpf/test_maps.c | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/bpf/test_maps.c +2 -0
@@ -1274,6 +1274,8 @@ static void __run_parallel(unsigned int tasks,pid_t pid[tasks];int i; +fflush (stdout); +for (i =0 ; i < tasks; i++) { pid[i] =fork ();if (pid[i] ==0 ) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 81/186 net: dsa: mt7530: fix advertising unsupported 1000baseT_Half
In reply to Greg Kroah-HartmanFrom: Landen Chao <[email protected]>
[ Upstream commit f272285f6abb9178d029375599626baf3d5f4e8a ]
Remove 1000baseT_Half to advertise correct hardware capability in phylink_validate() callback function.
--- drivers/net/dsa/mt7530.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/mt7530.c +1 -1
@@ -1501,7 +1501,7 @@ unsupported: phylink_set(mask, 100baseT_Full);if (state->interface !=PHY_INTERFACE_MODE_MII ) { - phylink_set(mask, 1000baseT_Half); +/* This switch only supports 1G full-duplex. */ phylink_set(mask, 1000baseT_Full);if (port ==5 ) phylink_set(mask, 1000baseX_Full);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 82/186 netfilter: nfnetlink: nfnetlink_unicast() reports EAGAIN instead of ENOBUFS
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit ee921183557af39c1a0475f982d43b0fcac25e2e ]
Frontend callback reports EAGAIN to nfnetlink to retry a command, this is used to signal that module autoloading is required. Unfortunately, nlmsg_unicast() reports EAGAIN in case the receiver socket buffer gets full, so it enters a busy-loop.
This patch updates nfnetlink_unicast() to turn EAGAIN into ENOBUFS and to use nlmsg_unicast(). Remove the flags field in nfnetlink_unicast() since this is always MSG_DONTWAIT in the existing code which is exactly what nlmsg_unicast() passes to netlink_unicast() as parameter.
--- include/linux/netfilter/nfnetlink.h | 3 +- net/netfilter/nf_tables_api.c | 61 ++++++++++++++--------------- net/netfilter/nfnetlink.c | 11 ++++-- net/netfilter/nfnetlink_log.c | 3 +- net/netfilter/nfnetlink_queue.c | 2 +- 5 files changed, 40 insertions(+), 40 deletions(-)
include/linux/netfilter/nfnetlink.h +1 -2
@@ -43,8 +43,7 @@ int nfnetlink_has_listeners(struct net *net, unsigned int group);int nfnetlink_send (struct sk_buff *skb,struct net *net,u32 portid,unsigned int group,int echo,gfp_t flags);int nfnetlink_set_err (struct net *net,u32 portid,u32 group,int error); -int nfnetlink_unicast (struct sk_buff *skb,struct net *net,u32 portid, -int flags); +int nfnetlink_unicast (struct sk_buff *skb,struct net *net,u32 portid);static inline u16 nfnl_msg_type (u8 subsys,u8 msg_type) {
net/netfilter/nf_tables_api.c +29 -32
127 lines not on this page · raw message
net/netfilter/nfnetlink.c +8 -3
@@ -149,10 +149,15 @@ int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error) }EXPORT_SYMBOL_GPL (nfnetlink_set_err); -int nfnetlink_unicast (struct sk_buff *skb,struct net *net,u32 portid, -int flags) +int nfnetlink_unicast (struct sk_buff *skb,struct net *net,u32 portid) { -return netlink_unicast (net->nfnl, skb, portid, flags); +int err; + + err =nlmsg_unicast (net->nfnl, skb, portid); +if (err == -EAGAIN ) + err = -ENOBUFS ; + +return err; }EXPORT_SYMBOL_GPL (nfnetlink_unicast);
net/netfilter/nfnetlink_log.c +1 -2
@@ -356,8 +356,7 @@ __nfulnl_send(struct nfulnl_instance *inst) goto out; } } -nfnetlink_unicast (inst->skb, inst->net, inst->peer_portid, -MSG_DONTWAIT ); +nfnetlink_unicast (inst->skb, inst->net, inst->peer_portid); out: inst->qlen =0 ; inst->skb =NULL ;
net/netfilter/nfnetlink_queue.c +1 -1
@@ -681,7 +681,7 @@ __nfqnl_enqueue_packet(struct net *net, struct nfqnl_instance *queue, *packet_id_ptr =htonl (entry->id);/* nfnetlink_unicast will either free the nskb or add it to a socket */ - err =nfnetlink_unicast (nskb, net, queue->peer_portid,MSG_DONTWAIT ); + err =nfnetlink_unicast (nskb, net, queue->peer_portid);if (err <0 ) {if (queue->flags &NFQA_CFG_F_FAIL_OPEN ) { failopen =1 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 83/186 nvmet-fc: Fix a missed _irqsave version of spin_lock in nvmet_fc_fod_op_done()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 70e37988db94aba607d5491a94f80ba08e399b6b ]
The way 'spin_lock()' and 'spin_lock_irqsave()' are used is not consistent in this function.
Use 'spin_lock_irqsave()' also here, as there is no guarantee that interruptions are disabled at that point, according to surrounding code.
--- drivers/nvme/target/fc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/target/fc.c +2 -2
@@ -2362,9 +2362,9 @@ nvmet_fc_fod_op_done(struct nvmet_fc_fcp_iod *fod)return ;if (fcpreq->fcp_error || fcpreq->transferred_length != fcpreq->transfer_length) { -spin_lock (&fod->flock); +spin_lock_irqsave (&fod->flock, flags); fod->abort = true; -spin_unlock (&fod->flock); +spin_unlock_irqrestore (&fod->flock, flags);nvmet_req_complete (&fod->req,NVME_SC_INTERNAL );return ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 84/186 nvme: fix controller instance leak
In reply to Greg Kroah-HartmanFrom: Keith Busch <[email protected]>
[ Upstream commit 192f6c29bb28bfd0a17e6ad331d09f1ec84143d0 ]
If the driver has to unbind from the controller for an early failure before the subsystem has been set up, there won't be a subsystem holding the controller's instance, so the controller needs to free its own instance in this case.
--- drivers/nvme/host/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/core.c +1 -1
@@ -4148,7 +4148,7 @@ static void nvme_free_ctrl(struct device *dev) container_of(dev, struct nvme_ctrl, ctrl_device);struct nvme_subsystem *subsys = ctrl->subsys; -if (subsys && ctrl->instance != subsys->instance) +if (!subsys || ctrl->instance != subsys->instance)ida_simple_remove (&nvme_instance_ida, ctrl->instance);kfree (ctrl->effects);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 85/186 netfilter: conntrack: do not auto-delete clash entries on reply
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit c46172147ebbeb70094db48d76ab7945d96c638b ]
Its possible that we have more than one packet with the same ct tuple simultaneously, e.g. when an application emits n packets on same UDP socket from multiple threads.
NAT rules might be applied to those packets. With the right set of rules, n packets will be mapped to m destinations, where at least two packets end up with the same destination.
When this happens, the existing clash resolution may merge the skb that is processed after the first has been received with the identical tuple already in hash table.
However, its possible that this identical tuple is a NAT_CLASH tuple. In that case the second skb will be sent, but no reply can be received since the reply that is processed first removes the NAT_CLASH tuple.
Do not auto-delete, this gives a 1 second window for replies to be passed back to originator.
Packets that are coming later (udp stream case) will not be affected:
they match the original ct entry, not a NAT_CLASH one.
Also prevent NAT_CLASH entries from getting offloaded.
--- net/netfilter/nf_conntrack_proto_udp.c | 26 ++++++++++---------------- net/netfilter/nft_flow_offload.c | 2 +- 2 files changed, 11 insertions(+), 17 deletions(-)
net/netfilter/nf_conntrack_proto_udp.c +10 -16
@@ -81,18 +81,6 @@ static bool udp_error(struct sk_buff *skb,return false; } -static void nf_conntrack_udp_refresh_unreplied (struct nf_conn *ct, -struct sk_buff *skb, -enum ip_conntrack_info ctinfo, -u32 extra_jiffies) -{ -if (unlikely (ctinfo ==IP_CT_ESTABLISHED_REPLY && - ct->status &IPS_NAT_CLASH )) -nf_ct_kill (ct); -else -nf_ct_refresh_acct (ct, ctinfo, skb, extra_jiffies); -} -/* Returns verdict for packet, and may modify conntracktype */ int nf_conntrack_udp_packet(struct nf_conn *ct, struct sk_buff *skb,
@@ -124,12 +112,15 @@ int nf_conntrack_udp_packet(struct nf_conn *ct,nf_ct_refresh_acct (ct, ctinfo, skb, extra); +/* never set ASSURED for IPS_NAT_CLASH, they time out soon */ +if (unlikely ((ct->status &IPS_NAT_CLASH ))) +return NF_ACCEPT ; +/* Also, more likely to be important, and not a probe */ if (!test_and_set_bit (IPS_ASSURED_BIT , &ct->status))nf_conntrack_event_cache (IPCT_ASSURED , ct); }else { -nf_conntrack_udp_refresh_unreplied (ct, skb, ctinfo, - timeouts[UDP_CT_UNREPLIED ]); +nf_ct_refresh_acct (ct, ctinfo, skb, timeouts[UDP_CT_UNREPLIED ]); }return NF_ACCEPT ; }
@@ -206,12 +197,15 @@ int nf_conntrack_udplite_packet(struct nf_conn *ct,if (test_bit (IPS_SEEN_REPLY_BIT , &ct->status)) {nf_ct_refresh_acct (ct, ctinfo, skb, timeouts[UDP_CT_REPLIED ]); + +if (unlikely ((ct->status &IPS_NAT_CLASH ))) +return NF_ACCEPT ; +/* Also, more likely to be important, and not a probe */ if (!test_and_set_bit (IPS_ASSURED_BIT , &ct->status))nf_conntrack_event_cache (IPCT_ASSURED , ct); }else { -nf_conntrack_udp_refresh_unreplied (ct, skb, ctinfo, - timeouts[UDP_CT_UNREPLIED ]); +nf_ct_refresh_acct (ct, ctinfo, skb, timeouts[UDP_CT_UNREPLIED ]); }return NF_ACCEPT ; }
net/netfilter/nft_flow_offload.c +1 -1
@@ -102,7 +102,7 @@ static void nft_flow_offload_eval(const struct nft_expr *expr, }if (nf_ct_ext_exist (ct,NF_CT_EXT_HELPER ) || - ct->status &IPS_SEQ_ADJUST ) + ct->status & (IPS_SEQ_ADJUST |IPS_NAT_CLASH )) goto out;if (!nf_ct_is_confirmed (ct))
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 86/186 opp: Dont drop reference for an OPP table that was never parsed
In reply to Greg Kroah-HartmanFrom: Viresh Kumar <[email protected]>
[ Upstream commit 922ff0759a16299e24cacfc981ac07914d8f1826 ]
dev_pm_opp_remove_table() should drop a reference to the OPP table only if the DT OPP table was parsed earlier with a call to dev_pm_opp_of_add_table() earlier. Else it may end up dropping the reference to the OPP table, which was added as a result of other calls like dev_pm_opp_set_clkname(). And would hence result in undesirable behavior later on when caller would try to free the resource again.
--- drivers/opp/core.c | 22 ++++++++++++++++------ drivers/opp/opp.h | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-)
drivers/opp/core.c +16 -6
@@ -1265,13 +1265,19 @@ void dev_pm_opp_remove(struct device *dev, unsigned long freq) }EXPORT_SYMBOL_GPL (dev_pm_opp_remove); -void _opp_remove_all_static (struct opp_table *opp_table) +bool _opp_remove_all_static (struct opp_table *opp_table) {struct dev_pm_opp *opp, *tmp; +bool ret = true;mutex_lock (&opp_table->lock); -if (!opp_table->parsed_static_opps || --opp_table->parsed_static_opps) +if (!opp_table->parsed_static_opps) { + ret = false; + goto unlock; + } + +if (--opp_table->parsed_static_opps) goto unlock;list_for_each_entry_safe (opp, tmp, &opp_table->opp_list, node) {
@@ -1281,6 +1287,8 @@ void _opp_remove_all_static(struct opp_table *opp_table) unlock:mutex_unlock (&opp_table->lock); + +return ret; }/**
@@ -2382,13 +2390,15 @@ void _dev_pm_opp_find_and_remove_table(struct device *dev)return ; } -_opp_remove_all_static (opp_table); +/* +* Drop the extra reference only if the OPP table was successfully added +* with dev_pm_opp_of_add_table() earlier. +**/ +if (_opp_remove_all_static (opp_table)) +dev_pm_opp_put_opp_table (opp_table);/* Drop reference taken by _find_opp_table() */ dev_pm_opp_put_opp_table (opp_table); - -/* Drop reference taken while the OPP table was added */ -dev_pm_opp_put_opp_table (opp_table); }/**
drivers/opp/opp.h +1 -1
@@ -212,7 +212,7 @@ struct opp_table {/* Routines internal to opp core */ void dev_pm_opp_get (struct dev_pm_opp *opp); -void _opp_remove_all_static (struct opp_table *opp_table); +bool _opp_remove_all_static (struct opp_table *opp_table);void _get_opp_table_kref (struct opp_table *opp_table);int _get_opp_count (struct opp_table *opp_table);struct opp_table *_find_opp_table (struct device *dev);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 87/186 cxgb4: fix thermal zone device registration
In reply to Greg Kroah-HartmanFrom: Potnuri Bharat Teja <[email protected]>
[ Upstream commit 6b6382a857d824c0866056d5736bbcb597a922ed ]
When multiple adapters are present in the system, pci hot-removing second adapter leads to the following warning as both the adapters registered thermal zone device with same thermal zone name/type. Therefore, use unique thermal zone name during thermal zone device initialization. Also mark thermal zone dev NULL once unregistered.
[ 414.370143] ------------[ cut here ]------------ [ 414.370944] sysfs group 'power' not found for kobject 'hwmon0' [ 414.371747] WARNING: CPU: 9 PID: 2661 at fs/sysfs/group.c:281 sysfs_remove_group+0x76/0x80 [ 414.382550] CPU: 9 PID: 2661 Comm: bash Not tainted 5.8.0-rc6+ #33 [ 414.383593] Hardware name: Supermicro X10SRA-F/X10SRA-F, BIOS 2.0a 06/23/2016 [ 414.384669] RIP: 0010:sysfs_remove_group+0x76/0x80 [ 414.385738] Code: 48 89 df 5b 5d 41 5c e9 d8 b5 ff ff 48 89 df e8 60 b0 ff ff eb cb 49 8b 14 24 48 8b 75 00 48 c7 c7 90 ae 13 bb e8 6a 27 d0 ff <0f> 0b 5b 5d 41 5c c3 0f 1f 00 0f 1f 44 00 00 48 85 f6 74 31 41 54 [ 414.388404] RSP: 0018:ffffa22bc080fcb0 EFLAGS: 00010286 [ 414.389638] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 [ 414.390829] RDX: 0000000000000001 RSI: ffff8ee2de3e9510 RDI: ffff8ee2de3e9510 [ 414.392064] RBP: ffffffffbaef2ee0 R08: 0000000000000000 R09: 0000000000000000 [ 414.393224] R10: 0000000000000000 R11: 000000002b30006c R12: ffff8ee260720008 [ 414.394388] R13: ffff8ee25e0a40e8 R14: ffffa22bc080ff08 R15: ffff8ee2c3be5020 [ 414.395661] FS: 00007fd2a7171740(0000) GS:ffff8ee2de200000(0000) knlGS:0000000000000000 [ 414.396825] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 414.398011] CR2: 00007f178ffe5020 CR3: 000000084c5cc003 CR4: 00000000003606e0 [ 414.399172] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 414.400352] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 414.401473] Call Trace: [ 414.402685] device_del+0x89/0x400 [ 414.403819] device_unregister+0x16/0x60 [ 414.405024] hwmon_device_unregister+0x44/0xa0 [ 414.406112] thermal_remove_hwmon_sysfs+0x196/0x200 [ 414.407256] thermal_zone_device_unregister+0x1b5/0x1f0 [ 414.408415] cxgb4_thermal_remove+0x3c/0x4f [cxgb4] [ 414.409668] remove_one+0x212/0x290 [cxgb4] [ 414.410875] pci_device_remove+0x36/0xb0 [ 414.412004] device_release_driver_internal+0xe2/0x1c0 [ 414.413276] pci_stop_bus_device+0x64/0x90 [ 414.414433] pci_stop_and_remove_bus_device_locked+0x16/0x30 [ 414.415609] remove_store+0x75/0x90 [ 414.416790] kernfs_fop_write+0x114/0x1b0 [ 414.417930] vfs_write+0xcf/0x210 [ 414.419059] ksys_write+0xa7/0xe0 [ 414.420120] do_syscall_64+0x4c/0xa0 [ 414.421278] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 414.422335] RIP: 0033:0x7fd2a686afd0 [ 414.423396] Code: Bad RIP value. [ 414.424549] RSP: 002b:00007fffc1446148 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 [ 414.425638] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007fd2a686afd0 [ 414.426830] RDX: 0000000000000002 RSI: 00007fd2a7196000 RDI: 0000000000000001 [ 414.427927] RBP: 00007fd2a7196000 R08: 000000000000000a R09: 00007fd2a7171740 [ 414.428923] R10: 00007fd2a7171740 R11: 0000000000000246 R12: 00007fd2a6b43400 [ 414.430082] R13: 0000000000000002 R14: 0000000000000001 R15: 0000000000000000 [ 414.431027] irq event stamp: 76300 [ 414.435678] ---[ end trace 13865acb4d5ab00f ]---
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c +6 -2
@@ -62,6 +62,7 @@ static struct thermal_zone_device_ops cxgb4_thermal_ops = {int cxgb4_thermal_init (struct adapter *adap) {struct ch_thermal *ch_thermal = &adap->ch_thermal; +char ch_tz_name[THERMAL_NAME_LENGTH ];int num_trip =CXGB4_NUM_TRIPS ;u32 param, val;int ret;
@@ -82,7 +83,8 @@ int cxgb4_thermal_init(struct adapter *adap) ch_thermal->trip_type =THERMAL_TRIP_CRITICAL ; } - ch_thermal->tzdev =thermal_zone_device_register ("cxgb4" , num_trip, +snprintf (ch_tz_name,sizeof (ch_tz_name),"cxgb4_%s" , adap->name); + ch_thermal->tzdev =thermal_zone_device_register (ch_tz_name, num_trip,0 , adap, &cxgb4_thermal_ops,NULL ,0 ,0 );
@@ -97,7 +99,9 @@ int cxgb4_thermal_init(struct adapter *adap)int cxgb4_thermal_remove (struct adapter *adap) { -if (adap->ch_thermal.tzdev) +if (adap->ch_thermal.tzdev) {thermal_zone_device_unregister (adap->ch_thermal.tzdev); + adap->ch_thermal.tzdev =NULL ; + }return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 88/186 net: ethernet: ti: am65-cpsw: fix rmii 100Mbit link mode
In reply to Greg Kroah-HartmanFrom: Grygorii Strashko <[email protected]>
[ Upstream commit c2f89219f559502c9292d79f695bab9dcec532d1 ]
In RMII link mode it's required to set bit 15 IFCTL_A in MAC_SL MAC_CONTROL register to enable support for 100Mbit link speed.
--- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/ti/am65-cpsw-nuss.c +2 -0
@@ -172,6 +172,8 @@ void am65_cpsw_nuss_adjust_link(struct net_device *ndev)if (phy->speed ==10 &&phy_interface_is_rgmii (phy))/* Can be used with in band mode only */ mac_control |=CPSW_SL_CTL_EXT_EN ; +if (phy->speed ==100 && phy->interface ==PHY_INTERFACE_MODE_RMII ) + mac_control |=CPSW_SL_CTL_IFCTL_A ;if (phy->duplex) mac_control |=CPSW_SL_CTL_FULLDUPLEX ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 89/186 MIPS: perf: Fix wrong check condition of Loongson event IDs
In reply to Greg Kroah-HartmanFrom: Tiezhu Yang <[email protected]>
[ Upstream commit a231995700c392c0807da95deea231b23fc51a3c ]
According to the user's manual chapter 8.2.1 of Loongson 3A2000 CPU [1] and 3A3000 CPU [2], we should take some event IDs such as 274, 358, 359 and 360 as valid in the check condition, otherwise they are recognized as "not supported", fix it.
[1] http://www.loongson.cn/uploadfile/cpu/3A2000/Loongson3A2000_user2.pdf
[2] http://www.loongson.cn/uploadfile/cpu/3A3000/Loongson3A3000_3B3000user2.pdf
--- arch/mips/kernel/perf_event_mipsxx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/kernel/perf_event_mipsxx.c +2 -2
@@ -1898,8 +1898,8 @@ static const struct mips_perf_event *mipsxx_pmu_map_raw_event(u64 config) (base_id >=64 && base_id <90 ) || (base_id >=128 && base_id <164 ) || (base_id >=192 && base_id <200 ) || - (base_id >=256 && base_id <274 ) || - (base_id >=320 && base_id <358 ) || + (base_id >=256 && base_id <275 ) || + (base_id >=320 && base_id <361 ) || (base_id >= 384 && base_id < 574)) break;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 90/186 block: fix locking in bdev_del_partition
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 08fc1ab6d748ab1a690fd483f41e2938984ce353 ]
We need to hold the whole device bd_mutex to protect against other thread concurrently deleting out partition before we get to it, and thus causing a use after free.
--- block/partitions/core.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-)
block/partitions/core.c +13 -14
@@ -524,19 +524,20 @@ int bdev_add_partition(struct block_device *bdev, int partno,int bdev_del_partition (struct block_device *bdev,int partno) {struct block_device *bdevp; -struct hd_struct *part; -int ret =0 ; - - part =disk_get_part (bdev->bd_disk, partno); -if (!part) -return -ENXIO ; +struct hd_struct *part =NULL ; +int ret; - ret = -ENOMEM ; - bdevp =bdget (part_devt (part)); + bdevp =bdget_disk (bdev->bd_disk, partno);if (!bdevp) - goto out_put_part; +return -ENOMEM ;mutex_lock (&bdevp->bd_mutex); +mutex_lock_nested (&bdev->bd_mutex,1 ); + + ret = -ENXIO ; + part =disk_get_part (bdev->bd_disk, partno); +if (!part) + goto out_unlock; ret = -EBUSY ;if (bdevp->bd_openers)
@@ -545,16 +546,14 @@ int bdev_del_partition(struct block_device *bdev, int partno)sync_blockdev (bdevp);invalidate_bdev (bdevp); -mutex_lock_nested (&bdev->bd_mutex,1 );delete_partition (bdev->bd_disk, part); -mutex_unlock (&bdev->bd_mutex); - ret =0 ; out_unlock: +mutex_unlock (&bdev->bd_mutex);mutex_unlock (&bdevp->bd_mutex);bdput (bdevp); -out_put_part: -disk_put_part (part); +if (part) +disk_put_part (part);return ret; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 91/186 perf top/report: Fix infinite loop in the TUI for grouped events
In reply to Greg Kroah-HartmanFrom: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit d4ccbacb9c217fefb4332a9af81b785690cf1053 ]
For a while we need to have a dummy event for doing things like receiving PERF_RECORD_COMM, PERF_RECORD_EXEC, etc for threads being created and dying while we synthesize the pre-existing ones at tool start.
This 'dummy' event is needed for keeping track of thread lifetime events early in the session but are uninteresting otherwise, i.e. no need to have it in a initial events menu for the non-grouped case, i.e. for:
# perf top -e cycles,instructions
or even for plain:
# perf top
When 'cycles' and that 'dummy' event are in place.
The code to remove that 'dummy' event ended up creating an endless loop for the grouped case, i.e.:
# perf top -e '{cycles,instructions}'Fix it.
--- tools/perf/ui/browsers/hists.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/ui/browsers/hists.c +2 -1
@@ -3629,8 +3629,8 @@ int perf_evlist__tui_browse_hists(struct evlist *evlist, const char *help, {int nr_entries = evlist->core.nr_entries; -single_entry:if (perf_evlist__single_entry (evlist)) { +single_entry: {struct evsel *first =evlist__first (evlist); return perf_evsel__hists_browse(first, nr_entries, help,
@@ -3638,6 +3638,7 @@ single_entry: env, warn_lost_event, annotation_opts); } + }if (symbol_conf.event_group) {struct evsel *pos;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 92/186 perf cs-etm: Fix corrupt data after perf inject from
In reply to Greg Kroah-HartmanFrom: Al Grant <[email protected]>
[ Upstream commit f5f8e7e55fbdb4fdddec73518e23c48083108fbb ]
Commit 42bbabed09ce6208 ("perf tools: Add hw_idx in struct branch_stack") changed the format of branch stacks in perf samples. When samples use this new format, a flag must be set in the corresponding event.
Synthesized branch stacks generated from CoreSight ETM trace were using the new format, but not setting the event attribute, leading to consumers seeing corrupt data. This patch fixes the issue by setting the event attribute to indicate use of the new format.
--- tools/perf/util/cs-etm.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
tools/perf/util/cs-etm.c +8 -1
@@ -1344,8 +1344,15 @@ static int cs_etm__synth_events(struct cs_etm_auxtrace *etm, attr.sample_type &= ~(u64 )PERF_SAMPLE_ADDR ; } -if (etm->synth_opts.last_branch) +if (etm->synth_opts.last_branch) { attr.sample_type |=PERF_SAMPLE_BRANCH_STACK ; +/* +* We don't use the hardware index, but the sample generation +* code uses the new format branch_stack with this field, +* so the event attributes must indicate that it's present. +*/ + attr.branch_sample_type |=PERF_SAMPLE_BRANCH_HW_INDEX ; + }if (etm->synth_opts.instructions) { attr.config =PERF_COUNT_HW_INSTRUCTIONS ;
Signature · 9 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 93/186 perf intel-pt: Fix corrupt data after perf inject from
In reply to Greg Kroah-HartmanFrom: Al Grant <[email protected]>
[ Upstream commit a347306fbec5dcaf7c276777b11d530eab6a4526 ]
Commit 42bbabed09ce6208 ("perf tools: Add hw_idx in struct branch_stack") changed the format of branch stacks in perf samples. When samples use this new format, a flag must be set in the corresponding event.
Synthesized branch stacks generated from Intel PT were using the new format, but not setting the event attribute, leading to consumers seeing corrupt data. This patch fixes the issue by setting the event attribute to indicate use of the new format.
--- tools/perf/util/intel-pt.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
tools/perf/util/intel-pt.c +8 -1
@@ -2913,8 +2913,15 @@ static int intel_pt_synth_events(struct intel_pt *pt,if (pt->synth_opts.callchain) attr.sample_type |=PERF_SAMPLE_CALLCHAIN ; -if (pt->synth_opts.last_branch) +if (pt->synth_opts.last_branch) { attr.sample_type |=PERF_SAMPLE_BRANCH_STACK ; +/* +* We don't use the hardware index, but the sample generation +* code uses the new format branch_stack with this field, +* so the event attributes must indicate that it's present. +*/ + attr.branch_sample_type |=PERF_SAMPLE_BRANCH_HW_INDEX ; + }if (pt->synth_opts.instructions) { attr.config =PERF_COUNT_HW_INSTRUCTIONS ;
Signature · 9 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 94/186 perf tools: Correct SNOOPX field offset
In reply to Greg Kroah-HartmanFrom: Al Grant <[email protected]>
[ Upstream commit 39c0a53b114d0317e5c4e76b631f41d133af5cb0 ]
perf_event.h has macros that define the field offsets in the data_src bitmask in perf records. The SNOOPX and REMOTE offsets were both 37.
These are distinct fields, and the bitfield layout in perf_mem_data_src confirms that SNOOPX should be at offset 38.
Committer notes:
This was extracted from a larger patch that also contained kernel changes.
--- tools/include/uapi/linux/perf_event.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/include/uapi/linux/perf_event.h +1 -1
@@ -1155,7 +1155,7 @@ union perf_mem_data_src {#define PERF_MEM_SNOOPX_FWD 0x01/* forward */ /* 1 free */ -#define PERF_MEM_SNOOPX_SHIFT 37 +#define PERF_MEM_SNOOPX_SHIFT 38/* locked instruction */ #define PERF_MEM_LOCK_NA 0x01/* not available */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 95/186 net: ethernet: mlx4: Fix memory allocation in mlx4_buddy_init()
In reply to Greg Kroah-HartmanFrom: Shung-Hsi Yu <[email protected]>
[ Upstream commit cbedcb044e9cc4e14bbe6658111224bb923094f4 ]
On machines with much memory (> 2 TByte) and log_mtts_per_seg == 0, a max_order of 31 will be passed to mlx_buddy_init(), which results in s = BITS_TO_LONGS(1 << 31) becoming a negative value, leading to kvmalloc_array() failure when it is converted to size_t.
mlx4_core 0000:b1:00.0: Failed to initialize memory region table, aborting
mlx4_core: probe of 0000:b1:00.0 failed with error -12
Fix this issue by changing the left shifting operand from a signed literal to an unsigned one.
--- drivers/net/ethernet/mellanox/mlx4/mr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx4/mr.c +1 -1
@@ -114,7 +114,7 @@ static int mlx4_buddy_init(struct mlx4_buddy *buddy, int max_order) goto err_out;for (i =0 ; i <= buddy->max_order; ++i) { - s =BITS_TO_LONGS (1 << (buddy->max_order - i)); + s =BITS_TO_LONGS (1UL << (buddy->max_order - i)); buddy->bits[i] =kvmalloc_array (s,sizeof (long ),GFP_KERNEL | __GFP_ZERO);if (!buddy->bits[i]) goto err_out_free;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 96/186 fix regression in "epoll: Keep a reference on files added to the check list"
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
[ Upstream commit 77f4689de17c0887775bb77896f4cc11a39bf848 ]
epoll_loop_check_proc() can run into a file already committed to destruction; we can't grab a reference on those and don't need to add them to the set for reverse path check anyway.
--- fs/eventpoll.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/eventpoll.c +3 -3
@@ -1995,9 +1995,9 @@ static int ep_loop_check_proc(void *priv, void *cookie, int call_nests)* during ep_insert(). */ if (list_empty (&epi->ffd.file->f_tfile_llink)) { -get_file (epi->ffd.file); -list_add (&epi->ffd.file->f_tfile_llink, - &tfile_check_list); +if (get_file_rcu (epi->ffd.file)) +list_add (&epi->ffd.file->f_tfile_llink, + &tfile_check_list); } } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 97/186 net: bcmgenet: fix mask check in bcmgenet_validate_flow()
In reply to Greg Kroah-HartmanFrom: Denis Efremov <[email protected]>
[ Upstream commit 1996cf46e4673a25ef2478eb266714f409a98221 ]
VALIDATE_MASK(eth_mask->h_source) is checked twice in a row in bcmgenet_validate_flow(). Add VALIDATE_MASK(eth_mask->h_dest) instead.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +1 -1
@@ -1364,7 +1364,7 @@ static int bcmgenet_validate_flow(struct net_device *dev,case ETHER_FLOW : eth_mask = &cmd->fs.m_u.ether_spec;/* don't allow mask which isn't valid */ -if (VALIDATE_MASK (eth_mask->h_source) || +if (VALIDATE_MASK (eth_mask->h_dest) ||VALIDATE_MASK (eth_mask->h_source) ||VALIDATE_MASK (eth_mask->h_proto)) {netdev_err (dev,"rxnfc: Unsupported mask\n" );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 98/186 net: gemini: Fix another missing clk_disable_unprepare() in probe
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit eb0f3bc463d59d86402f19c59aa44e82dc3fab6d ]
We recently added some calls to clk_disable_unprepare() but we missed the last error path if register_netdev() fails.
I made a couple cleanups so we avoid mistakes like this in the future. First I reversed the "if (!ret)" condition and pulled the code in one indent level. Also, the "port->netdev = NULL;" is not required because "port" isn't used again outside this function so I deleted that line.
--- drivers/net/ethernet/cortina/gemini.c | 34 +++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-)
drivers/net/ethernet/cortina/gemini.c +17 -17
@@ -2446,8 +2446,8 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) port->reset =devm_reset_control_get_exclusive (dev,NULL );if (IS_ERR (port->reset)) {dev_err (dev,"no reset\n" ); -clk_disable_unprepare (port->pclk); -return PTR_ERR (port->reset); + ret =PTR_ERR (port->reset); + goto unprepare; }reset_control_reset (port->reset);usleep_range (100 ,500 );
@@ -2502,25 +2502,25 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)IRQF_SHARED , port_names[port->id], port); -if (ret) { -clk_disable_unprepare (port->pclk); -return ret; - } +if (ret) + goto unprepare; ret =register_netdev (netdev); -if (!ret) { +if (ret) + goto unprepare; + +netdev_info (netdev, +"irq %d, DMA @ 0x%pap, GMAC @ 0x%pap\n" , + port->irq, &dmares->start, + &gmacres->start); + ret =gmac_setup_phy (netdev); +if (ret)netdev_info (netdev, -"irq %d, DMA @ 0x%pap, GMAC @ 0x%pap\n" , - port->irq, &dmares->start, - &gmacres->start); - ret =gmac_setup_phy (netdev); -if (ret) -netdev_info (netdev, -"PHY init failed, deferring to ifup time\n" ); -return 0 ; - } +"PHY init failed, deferring to ifup time\n" ); +return 0 ; - port->netdev =NULL ; +unprepare: +clk_disable_unprepare (port->pclk);return ret; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 99/186 nfp: flower: fix ABI mismatch between driver and firmware
In reply to Greg Kroah-HartmanFrom: Louis Peens <[email protected]>
[ Upstream commit f614e536704d37326b0975da9cc33dd61d28c378 ]
Fix an issue where the driver wrongly detected ipv6 neighbour updates from the NFP as corrupt. Add a reserved field on the kernel side so it is similar to the ipv4 version of the struct and has space for the extra bytes from the card.
--- drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c +2 -0
@@ -61,6 +61,7 @@ struct nfp_tun_active_tuns {* @flags: options part of the request * @tun_info.ipv6: dest IPv6 address of active route * @tun_info.egress_port: port the encapsulated packet egressed +* @tun_info.extra: reserved for future use * @tun_info: tunnels that have sent traffic in reported period */ struct nfp_tun_active_tuns_v6 {
@@ -70,6 +71,7 @@ struct nfp_tun_active_tuns_v6 {struct route_ip_info_v6 {struct in6_addr ipv6;__be32 egress_port; +__be32 extra[2 ]; } tun_info[]; };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 100/186 net: dp83867: Fix WoL SecureOn password
In reply to Greg Kroah-HartmanFrom: Dan Murphy <[email protected]>
[ Upstream commit 8b4a11c67da538504d60ae917ffe5254f59b1248 ]
Fix the registers being written to as the values were being over written when writing the same registers.
--- drivers/net/phy/dp83867.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/phy/dp83867.c +2 -2
@@ -215,9 +215,9 @@ static int dp83867_set_wol(struct phy_device *phydev,if (wol->wolopts &WAKE_MAGICSECURE ) {phy_write_mmd (phydev,DP83867_DEVADDR ,DP83867_RXFSOP1 , (wol->sopass[1 ] <<8 ) | wol->sopass[0 ]); -phy_write_mmd (phydev,DP83867_DEVADDR ,DP83867_RXFSOP1 , +phy_write_mmd (phydev,DP83867_DEVADDR ,DP83867_RXFSOP2 , (wol->sopass[3 ] <<8 ) | wol->sopass[2 ]); -phy_write_mmd (phydev,DP83867_DEVADDR ,DP83867_RXFSOP1 , +phy_write_mmd (phydev,DP83867_DEVADDR ,DP83867_RXFSOP3 , (wol->sopass[5 ] <<8 ) | wol->sopass[4 ]); val_rxcfg |=DP83867_WOL_SEC_EN ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 101/186 drm/radeon: Prefer lower feedback dividers
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit fc8c70526bd30733ea8667adb8b8ffebea30a8ed ]
Commit 2e26ccb119bd ("drm/radeon: prefer lower reference dividers") fixed screen flicker for HP Compaq nx9420 but breaks other laptops like Asus X50SL.
Turns out we also need to favor lower feedback dividers.
Users confirmed this change fixes the regression and doesn't regress the original fix.
--- drivers/gpu/drm/radeon/radeon_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_display.c +1 -1
@@ -933,7 +933,7 @@ static void avivo_get_fb_ref_div(unsigned nom, unsigned den, unsigned post_div,/* get matching reference and feedback divider */ *ref_div =min (max (den/post_div,1u ), ref_div_max); - *fb_div =DIV_ROUND_CLOSEST (nom * *ref_div * post_div, den); + *fb_div =max (nom * *ref_div * post_div / den,1u );/* limit fb divider to its maximum */ if (*fb_div > fb_div_max) {
Signature · 1 line
2.25.1
Re: [PATCH 5.8 101/186] drm/radeon: Prefer lower feedback dividers
Hi Greg,
please drop that patch. It turned out to break a lot of different setups and we are going to revert it now.
Thanks,
Christian.
Am 08.09.20 um 17:24 schrieb Greg Kroah-Hartman:
Quoted 37 lines
From: Kai-Heng Feng <[email protected]>
[ Upstream commit
fc8c70526bd30733ea8667adb8b8ffebea30a8ed]Commit
2e26ccb119bd("drm/radeon: prefer lower reference dividers") fixed screen flicker for HP Compaq nx9420 but breaks other laptops like Asus X50SL.Turns out we also need to favor lower feedback dividers.
Users confirmed this change fixes the regression and doesn't regress the original fix.
Fixes 2e26ccb119bd ("drm/radeon: prefer lower reference dividers")Reviewed-by Christian König <[email protected]>Signed-off-by Kai-Heng Feng <[email protected]>Signed-off-by Alex Deucher <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- drivers/gpu/drm/radeon/radeon_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/radeon/radeon_display.c +1
-1@@ -933,7 +933,7 @@ static void avivo_get_fb_ref_div(unsigned nom, unsigned den, unsigned post_div,/* get matching reference and feedback divider */ *ref_div =min (max (den/post_div,1u ), ref_div_max); - *fb_div =DIV_ROUND_CLOSEST (nom * *ref_div * post_div, den); + *fb_div =max (nom * *ref_div * post_div / den,1u );/* limit fb divider to its maximum */ if (*fb_div > fb_div_max) {
Greg Kroah-Hartman
maintainerRe: [PATCH 5.8 101/186] drm/radeon: Prefer lower feedback dividers
Quoted 4 lines · Christian König
Hi Greg,
please drop that patch. It turned out to break a lot of different setups and we are going to revert it now.
Ok, now dropped from all trees, thanks.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 102/186 MIPS: add missing MSACSR and upper MSA initialization
In reply to Greg Kroah-HartmanFrom: Huang Pei <[email protected]>
[ Upstream commit bb06748207cfb1502d11b90325eba7f8c44c9f02 ]
In cc97ab235f3f ("MIPS: Simplify FP context initialization), init_fp_ctx just initialize the fp/msa context, and own_fp_inatomic just restore FCSR and 64bit FP regs from it, but miss MSACSR and upper MSA regs for MSA, so MSACSR and MSA upper regs's value from previous task on current cpu can leak into current task and cause unpredictable behavior when MSA context not initialized.
--- arch/mips/kernel/traps.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/mips/kernel/traps.c +12 -0
@@ -1286,6 +1286,18 @@ static int enable_restore_fp_context(int msa) err =own_fpu_inatomic (1 );if (msa && !err) {enable_msa (); +/* +* with MSA enabled, userspace can see MSACSR +* and MSA regs, but the values in them are from +* other task before current task, restore them +* from saved fp/msa context +*/ +write_msa_csr (current->thread.fpu.msacsr); +/* +* own_fpu_inatomic(1) just restore low 64bit, +* fix the high 64bit +*/ +init_msa_upper ();set_thread_flag (TIF_USEDMSA );set_thread_flag (TIF_MSA_CTX_LIVE ); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 103/186 MIPS: SNI: Fix SCSI interrupt
In reply to Greg Kroah-HartmanFrom: Thomas Bogendoerfer <[email protected]>
[ Upstream commit baf5cb30fbd1c22f6aa03c081794c2ee0f5be4da ]
On RM400(a20r) machines ISA and SCSI interrupts share the same interrupt line. Commit 49e6e07e3c80 ("MIPS: pass non-NULL dev_id on shared request_irq()") accidently dropped the IRQF_SHARED bit, which breaks registering SCSI interrupt. Put back IRQF_SHARED and add dev_id for ISA interrupt.
--- arch/mips/sni/a20r.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/sni/a20r.c +2 -2
@@ -222,8 +222,8 @@ void __init sni_a20r_irq_init(void)irq_set_chip_and_handler (i, &a20r_irq_type, handle_level_irq); sni_hwint = a20r_hwint;change_c0_status (ST0_IM ,IE_IRQ0 ); -if (request_irq (SNI_A20R_IRQ_BASE +3 , sni_isa_irq_handler,0 ,"ISA" , -NULL )) +if (request_irq (SNI_A20R_IRQ_BASE +3 , sni_isa_irq_handler, +IRQF_SHARED ,"ISA" , sni_isa_irq_handler))pr_err ("Failed to register ISA interrupt\n" ); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 104/186 xfs: fix xfs_bmap_validate_extent_raw when checking attr fork of rt files
In reply to Greg Kroah-HartmanFrom: Darrick J. Wong <[email protected]>
[ Upstream commit d0c20d38af135b2b4b90aa59df7878ef0c8fbef4 ]
The realtime flag only applies to the data fork, so don't use the realtime block number checks on the attr fork of a realtime file.
--- fs/xfs/libxfs/xfs_bmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/libxfs/xfs_bmap.c +1 -1
@@ -6222,7 +6222,7 @@ xfs_bmap_validate_extent( isrt =XFS_IS_REALTIME_INODE (ip); endfsb = irec->br_startblock + irec->br_blockcount -1 ; -if (isrt) { +if (isrt && whichfork ==XFS_DATA_FORK ) {if (!xfs_verify_rtbno (mp, irec->br_startblock))return __this_address;if (!xfs_verify_rtbno (mp, endfsb))
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 105/186 perf jevents: Fix suspicious code in fixregex()
In reply to Greg Kroah-HartmanFrom: Namhyung Kim <[email protected]>
[ Upstream commit e62458e3940eb3dfb009481850e140fbee183b04 ]
The new string should have enough space for the original string and the back slashes IMHO.
--- tools/perf/pmu-events/jevents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/pmu-events/jevents.c +1 -1
@@ -137,7 +137,7 @@ static char *fixregex(char *s)return s;/* allocate space for a new string */ - fixed = (char *)malloc (len +1 ); + fixed = (char *)malloc (len + esc_count +1 );if (!fixed)return NULL ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 106/186 perf stat: Turn off summary for interval mode by default
In reply to Greg Kroah-HartmanFrom: Jin Yao <[email protected]>
[ Upstream commit ee6a961432e75393bd69bf70ba70bad90396fa82 ]
There's a risk that outputting interval mode summaries by default breaks CSV consumers. It already broke pmu-tools/toplev.
So now we turn off the summary by default but we create a new option '--summary' to enable the summary. This is active even when not using CSV mode.
Before:
root@kbl-ppc:~# perf stat -I1000 --interval-count 2
# time counts unit events
1.000265904 8,005.73 msec cpu-clock # 8.006 CPUs utilized
1.000265904 601 context-switches # 0.075 K/sec
1.000265904 10 cpu-migrations # 0.001 K/sec
1.000265904 0 page-faults # 0.000 K/sec
1.000265904 66,746,521 cycles # 0.008 GHz
1.000265904 71,874,398 instructions # 1.08 insn per cycle
1.000265904 13,356,781 branches # 1.668 M/sec
1.000265904 298,756 branch-misses # 2.24% of all branches
2.001857667 8,012.52 msec cpu-clock # 8.013 CPUs utilized
2.001857667 164 context-switches # 0.020 K/sec
2.001857667 10 cpu-migrations # 0.001 K/sec
2.001857667 2 page-faults # 0.000 K/sec
2.001857667 5,822,188 cycles # 0.001 GHz
2.001857667 2,186,170 instructions # 0.38 insn per cycle
2.001857667 442,378 branches # 0.055 M/sec
2.001857667 44,750 branch-misses # 10.12% of all branchesPerformance counter stats for 'system wide':
16,018.25 msec cpu-clock # 7.993 CPUs utilized
765 context-switches # 0.048 K/sec
20 cpu-migrations # 0.001 K/sec
2 page-faults # 0.000 K/sec
72,568,709 cycles # 0.005 GHz
74,060,568 instructions # 1.02 insn per cycle
13,799,159 branches # 0.861 M/sec
343,506 branch-misses # 2.49% of all branches2.004118489 seconds time elapsed
After:
root@kbl-ppc:~# perf stat -I1000 --interval-count 2
# time counts unit events
1.001336393 8,013.28 msec cpu-clock # 8.013 CPUs utilized
1.001336393 82 context-switches # 0.010 K/sec
1.001336393 8 cpu-migrations # 0.001 K/sec
1.001336393 0 page-faults # 0.000 K/sec
1.001336393 4,199,121 cycles # 0.001 GHz
1.001336393 1,373,991 instructions # 0.33 insn per cycle
1.001336393 270,681 branches # 0.034 M/sec
1.001336393 31,659 branch-misses # 11.70% of all branches
2.003905006 8,020.52 msec cpu-clock # 8.021 CPUs utilized
2.003905006 184 context-switches # 0.023 K/sec
2.003905006 8 cpu-migrations # 0.001 K/sec
2.003905006 2 page-faults # 0.000 K/sec
2.003905006 5,446,190 cycles # 0.001 GHz
2.003905006 2,312,547 instructions # 0.42 insn per cycle
2.003905006 451,691 branches # 0.056 M/sec
2.003905006 37,925 branch-misses # 8.40% of all branches root@kbl-ppc:~# perf stat -I1000 --interval-count 2 --summary
# time counts unit events
1.001313128 8,013.20 msec cpu-clock # 8.013 CPUs utilized
1.001313128 83 context-switches # 0.010 K/sec
1.001313128 8 cpu-migrations # 0.001 K/sec
1.001313128 0 page-faults # 0.000 K/sec
1.001313128 4,470,950 cycles # 0.001 GHz
1.001313128 1,440,045 instructions # 0.32 insn per cycle
1.001313128 283,222 branches # 0.035 M/sec
1.001313128 33,576 branch-misses # 11.86% of all branches
2.003857385 8,020.34 msec cpu-clock # 8.020 CPUs utilized
2.003857385 154 context-switches # 0.019 K/sec
2.003857385 8 cpu-migrations # 0.001 K/sec
2.003857385 2 page-faults # 0.000 K/sec
2.003857385 4,515,676 cycles # 0.001 GHz
2.003857385 2,180,449 instructions # 0.48 insn per cycle
2.003857385 435,254 branches # 0.054 M/sec
2.003857385 31,179 branch-misses # 7.16% of all branchesPerformance counter stats for 'system wide':
16,033.53 msec cpu-clock # 7.992 CPUs utilized
237 context-switches # 0.015 K/sec
16 cpu-migrations # 0.001 K/sec
2 page-faults # 0.000 K/sec
8,986,626 cycles # 0.001 GHz
3,620,494 instructions # 0.40 insn per cycle
718,476 branches # 0.045 M/sec
64,755 branch-misses # 9.01% of all branches2.006124542 seconds time elapsed
--- tools/perf/Documentation/perf-stat.txt | 3 +++ tools/perf/builtin-stat.c | 8 +++++--- tools/perf/util/stat.h | 1 + 3 files changed, 9 insertions(+), 3 deletions(-)
tools/perf/Documentation/perf-stat.txt +3 -0
@@ -380,6 +380,9 @@ counts for all hardware threads in a core but show the sum counts per hardware thread. This is essentially a replacement for the any bit and convenient for post processing. +--summary:: +Print summary for interval mode (-I). + EXAMPLES --------
tools/perf/builtin-stat.c +5 -3
@@ -402,7 +402,7 @@ static void read_counters(struct timespec *rs) {struct evsel *counter; -if (!stat_config.summary && (read_affinity_counters (rs) <0 )) +if (!stat_config.stop_read_counter && (read_affinity_counters (rs) <0 ))return ;evlist__for_each_entry (evsel_list, counter) {
@@ -826,9 +826,9 @@ try_again_reset:if (stat_config.walltime_run_table) stat_config.walltime_run[run_idx] = t1 - t0; -if (interval) { +if (interval && stat_config.summary) { stat_config.interval =0 ; - stat_config.summary = true; + stat_config.stop_read_counter = true;init_stats (&walltime_nsecs_stats);update_stats (&walltime_nsecs_stats, t1 - t0);
@@ -1066,6 +1066,8 @@ static struct option stat_options[] = {"Use with 'percore' event qualifier to show the event " "counts of one hardware thread by sum up total hardware " "threads of same physical core"), +OPT_BOOLEAN (0 ,"summary" , &stat_config.summary, +"print summary for interval mode" ), #ifdef HAVE_LIBPFM OPT_CALLBACK(0, "pfm-events", &evsel_list, "event", "libpfm4 event selector. use 'perf list' to list available events",
tools/perf/util/stat.h +1 -0
@@ -113,6 +113,7 @@ struct perf_stat_config {bool summary;bool metric_no_group;bool metric_no_merge; +bool stop_read_counter;FILE *output;unsigned int interval;unsigned int timeout;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 107/186 perf bench: The do_run_multi_threaded() function must use IS_ERR(perf_session__new())
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit e4d71f79cf5c10fa8bc6f5d3bebea570c9c438f1 ]
In case of error, the function perf_session__new() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR()
Committer notes:
This wasn't compiling due to an extraneous '{' not matched by a '}', fix it.
--- tools/perf/bench/synthesize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/bench/synthesize.c +2 -2
@@ -162,8 +162,8 @@ static int do_run_multi_threaded(struct target *target,init_stats (&event_stats);for (i =0 ; i < multi_iterations; i++) { session =perf_session__new (NULL , false,NULL ); -if (!session) -return -ENOMEM ; +if (IS_ERR (session)) +return PTR_ERR (session);atomic_set (&event_count,0 );gettimeofday (&start,NULL );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 108/186 tg3: Fix soft lockup when tg3_reset_task() fails.
In reply to Greg Kroah-HartmanFrom: Michael Chan <[email protected]>
[ Upstream commit 556699341efa98243e08e34401b3f601da91f5a3 ]
If tg3_reset_task() fails, the device state is left in an inconsistent state with IFF_RUNNING still set but NAPI state not enabled. A subsequent operation, such as ifdown or AER error can cause it to soft lock up when it tries to disable NAPI state.
Fix it by bringing down the device to !IFF_RUNNING state when tg3_reset_task() fails. tg3_reset_task() running from workqueue will now call tg3_close() when the reset fails. We need to modify tg3_reset_task_cancel() slightly to avoid tg3_close() calling cancel_work_sync() to cancel tg3_reset_task(). Otherwise cancel_work_sync() will wait forever for tg3_reset_task() to finish.
--- drivers/net/ethernet/broadcom/tg3.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +13 -4
@@ -7221,8 +7221,8 @@ static inline void tg3_reset_task_schedule(struct tg3 *tp)static inline void tg3_reset_task_cancel (struct tg3 *tp) { -cancel_work_sync (&tp->reset_task); -tg3_flag_clear (tp,RESET_TASK_PENDING ); +if (test_and_clear_bit (TG3_FLAG_RESET_TASK_PENDING , tp->tg3_flags)) +cancel_work_sync (&tp->reset_task);tg3_flag_clear (tp,TX_RECOVERY_PENDING ); }
@@ -11209,18 +11209,27 @@ static void tg3_reset_task(struct work_struct *work)tg3_halt (tp,RESET_KIND_SHUTDOWN ,0 ); err =tg3_init_hw (tp, true); -if (err) +if (err) { +tg3_full_unlock (tp); + tp->irq_sync =0 ; +tg3_napi_enable (tp); +/* Clear this flag so that tg3_reset_task_cancel() will not +* call cancel_work_sync() and wait forever. +*/ +tg3_flag_clear (tp,RESET_TASK_PENDING ); +dev_close (tp->dev); goto out; + }tg3_netif_start (tp); -out:tg3_full_unlock (tp);if (!err)tg3_phy_start (tp);tg3_flag_clear (tp,RESET_TASK_PENDING ); +out:rtnl_unlock (); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 109/186 x86, fakenuma: Fix invalid starting node ID
In reply to Greg Kroah-HartmanFrom: Huang Ying <[email protected]>
[ Upstream commit ccae0f36d500aef727f98acd8d0601e6b262a513 ]
Commit:
cc9aec03e58f ("x86/numa_emulation: Introduce uniform split capability")
uses "-1" as the starting node ID, which causes the strange kernel log as follows, when "numa=fake=32G" is added to the kernel command line:
Faking node -1 at [mem 0x0000000000000000-0x0000000893ffffff] (35136MB)
Faking node 0 at [mem 0x0000001840000000-0x000000203fffffff] (32768MB)
Faking node 1 at [mem 0x0000000894000000-0x000000183fffffff] (64192MB)
Faking node 2 at [mem 0x0000002040000000-0x000000283fffffff] (32768MB)
Faking node 3 at [mem 0x0000002840000000-0x000000303fffffff] (32768MB)And finally the kernel crashes:
BUG: Bad page state in process swapper pfn:00011
page:(____ptrval____) refcount:0 mapcount:1 mapping:(____ptrval____) index:0x55cd7e44b270 pfn:0x11
failed to read mapping contents, not a valid kernel address?
flags: 0x5(locked|uptodate)
raw: 0000000000000005 000055cd7e44af30 000055cd7e44af50 0000000100000006
raw: 000055cd7e44b270 000055cd7e44b290 0000000000000000 000055cd7e44b510
page dumped because: page still charged to cgroup
page->mem_cgroup:000055cd7e44b510
Modules linked in:
CPU: 0 PID: 0 Comm: swapper Not tainted 5.9.0-rc2 #1
Hardware name: Intel Corporation S2600WFT/S2600WFT, BIOS SE5C620.86B.02.01.0008.031920191559 03/19/2019
Call Trace:
dump_stack+0x57/0x80
bad_page.cold+0x63/0x94
__free_pages_ok+0x33f/0x360
memblock_free_all+0x127/0x195
mem_init+0x23/0x1f5
start_kernel+0x219/0x4f5
secondary_startup_64+0xb6/0xc0Fix this bug via using 0 as the starting node ID. This restores the original behavior before cc9aec03e58f.
[ mingo: Massaged the changelog. ]
--- arch/x86/mm/numa_emulation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/mm/numa_emulation.c +1 -1
@@ -321,7 +321,7 @@ static int __init split_nodes_size_interleave(struct numa_meminfo *ei, u64 addr, u64 max_addr, u64 size) { return split_nodes_size_interleave_uniform(ei, pi, addr, max_addr, size, - 0, NULL, NUMA_NO_NODE); + 0, NULL, 0); }static int __init setup_emu2phys_nid (int *dfl_phys_nid)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 110/186 iommu/vt-d: Serialize IOMMU GCMD register modifications
In reply to Greg Kroah-HartmanFrom: Lu Baolu <[email protected]>
[ Upstream commit 6e4e9ec65078093165463c13d4eb92b3e8d7b2e8 ]
The VT-d spec requires (10.4.4 Global Command Register, GCMD_REG General Description) that:
If multiple control fields in this register need to be modified, software must serialize the modifications through multiple writes to this register.
However, in irq_remapping.c, modifications of IRE and CFI are done in one write. We need to do two separate writes with STS checking after each. It also checks the status register before writing command register to avoid unnecessary register write.
--- drivers/iommu/intel/irq_remapping.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/iommu/intel/irq_remapping.c +8 -2
@@ -507,12 +507,18 @@ static void iommu_enable_irq_remapping(struct intel_iommu *iommu)/* Enable interrupt-remapping */ iommu->gcmd |=DMA_GCMD_IRE ; - iommu->gcmd &= ~DMA_GCMD_CFI ;/* Block compatibility-format MSIs */ writel (iommu->gcmd, iommu->reg +DMAR_GCMD_REG ); -IOMMU_WAIT_OP (iommu,DMAR_GSTS_REG , readl, (sts &DMA_GSTS_IRES ), sts); +/* Block compatibility-format MSIs */ +if (sts &DMA_GSTS_CFIS ) { + iommu->gcmd &= ~DMA_GCMD_CFI ; +writel (iommu->gcmd, iommu->reg +DMAR_GCMD_REG ); +IOMMU_WAIT_OP (iommu,DMAR_GSTS_REG , + readl, !(sts &DMA_GSTS_CFIS ), sts); + } +/* * With CFI clear in the Global Command register, we should be * protected from dangerous (i.e. compatibility) interrupts
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 111/186 thermal: ti-soc-thermal: Fix bogus thermal shutdowns for omap4430
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 30d24faba0532d6972df79a1bf060601994b5873 ]
We can sometimes get bogus thermal shutdowns on omap4430 at least with droid4 running idle with a battery charger connected:
thermal thermal_zone0: critical temperature reached (143 C), shutting down
Dumping out the register values shows we can occasionally get a 0x7f value that is outside the TRM listed values in the ADC conversion table. And then we get a normal value when reading again after that. Reading the register multiple times does not seem help avoiding the bogus values as they stay until the next sample is ready.
Looking at the TRM chapter "18.4.10.2.3 ADC Codes Versus Temperature", we should have values from 13 to 107 listed with a total of 95 values. But looking at the omap4430_adc_to_temp array, the values are off, and the end values are missing. And it seems that the 4430 ADC table is similar to omap3630 rather than omap4460.
Let's fix the issue by using values based on the omap3630 table and just ignoring invalid values. Compared to the 4430 TRM, the omap3630 table has the missing values added while the TRM table only shows every second value.
Note that sometimes the ADC register values within the valid table can also be way off for about 1 out of 10 values. But it seems that those just show about 25 C too low values rather than too high values. So those do not cause a bogus thermal shutdown.
--- .../ti-soc-thermal/omap4-thermal-data.c | 23 ++++++++++--------- .../thermal/ti-soc-thermal/omap4xxx-bandgap.h | 10 +++++--- 2 files changed, 19 insertions(+), 14 deletions(-)
drivers/thermal/ti-soc-thermal/omap4-thermal-data.c +12 -11
@@ -37,20 +37,21 @@ static struct temp_sensor_data omap4430_mpu_temp_sensor_data = {/* * Temperature values in milli degree celsius -* ADC code values from 530 to 923 +* ADC code values from 13 to 107, see TRM +* "18.4.10.2.3 ADC Codes Versus Temperature". */ static const int omap4430_adc_to_temp[OMAP4430_ADC_END_VALUE -OMAP4430_ADC_START_VALUE +1 ] = { --38000 ,-35000 ,-34000 ,-32000 ,-30000 ,-28000 ,-26000 ,-24000 ,-22000 , --20000 ,-18000 ,-17000 ,-15000 ,-13000 ,-12000 ,-10000 ,-8000 ,-6000 , --5000 ,-3000 ,-1000 ,0 ,2000 ,3000 ,5000 ,6000 ,8000 ,10000 ,12000 , -13000 ,15000 ,17000 ,19000 ,21000 ,23000 ,25000 ,27000 ,28000 ,30000 , -32000 ,33000 ,35000 ,37000 ,38000 ,40000 ,42000 ,43000 ,45000 ,47000 , -48000 ,50000 ,52000 ,53000 ,55000 ,57000 ,58000 ,60000 ,62000 ,64000 , -66000 ,68000 ,70000 ,71000 ,73000 ,75000 ,77000 ,78000 ,80000 ,82000 , -83000 ,85000 ,87000 ,88000 ,90000 ,92000 ,93000 ,95000 ,97000 ,98000 , -100000 ,102000 ,103000 ,105000 ,107000 ,109000 ,111000 ,113000 ,115000 , -117000 ,118000 ,120000 ,122000 ,123000 , +-40000 ,-38000 ,-35000 ,-34000 ,-32000 ,-30000 ,-28000 ,-26000 ,-24000 , +-22000 ,-20000 ,-18500 ,-17000 ,-15000 ,-13500 ,-12000 ,-10000 ,-8000 , +-6500 ,-5000 ,-3500 ,-1500 ,0 ,2000 ,3500 ,5000 ,6500 ,8500 ,10000 , +12000 ,13500 ,15000 ,17000 ,19000 ,21000 ,23000 ,25000 ,27000 ,28500 , +30000 ,32000 ,33500 ,35000 ,37000 ,38500 ,40000 ,42000 ,43500 ,45000 , +47000 ,48500 ,50000 ,52000 ,53500 ,55000 ,57000 ,58500 ,60000 ,62000 , +64000 ,66000 ,68000 ,70000 ,71500 ,73500 ,75000 ,77000 ,78500 ,80000 , +82000 ,83500 ,85000 ,87000 ,88500 ,90000 ,92000 ,93500 ,95000 ,97000 , +98500 ,100000 ,102000 ,103500 ,105000 ,107000 ,109000 ,111000 ,113000 , +115000 ,117000 ,118500 ,120000 ,122000 ,123500 ,125000 , };/* OMAP4430 data */
drivers/thermal/ti-soc-thermal/omap4xxx-bandgap.h +7 -3
@@ -53,9 +53,13 @@* and thresholds for OMAP4430. */ -/* ADC conversion table limits */ -#define OMAP4430_ADC_START_VALUE 0 -#define OMAP4430_ADC_END_VALUE 127 +/* +* ADC conversion table limits. Ignore values outside the TRM listed +* range to avoid bogus thermal shutdowns. See omap4430 TRM chapter +* "18.4.10.2.3 ADC Codes Versus Temperature". +*/ +#define OMAP4430_ADC_START_VALUE 13 +#define OMAP4430_ADC_END_VALUE 107/* bandgap clock limits (no control on 4430) */ #define OMAP4430_MAX_FREQ 32768#define OMAP4430_MIN_FREQ 32768
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 112/186 thermal: qcom-spmi-temp-alarm: Dont suppress negative temp
In reply to Greg Kroah-HartmanFrom: Veera Vegivada <[email protected]>
[ Upstream commit 0ffdab6f2dea9e23ec33230de24e492ff0b186d9 ]
Currently driver is suppressing the negative temperature readings from the vadc. Consumers of the thermal zones need to read the negative temperature too. Don't suppress the readings.
--- drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thermal/qcom/qcom-spmi-temp-alarm.c +2 -2
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0-only /* -* Copyright (c) 2011-2015, 2017, The Linux Foundation. All rights reserved. +* Copyright (c) 2011-2015, 2017, 2020, The Linux Foundation. All rights reserved. */ #include <linux/bitops.h>
@@ -191,7 +191,7 @@ static int qpnp_tm_get_temp(void *data, int *temp) chip->temp = mili_celsius; } - *temp = chip->temp <0 ?0 : chip->temp; + *temp = chip->temp;return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 113/186 iommu/amd: Restore IRTE.RemapEn bit after programming IRTE
In reply to Greg Kroah-HartmanFrom: Suravee Suthikulpanit <[email protected]>
[ Upstream commit 26e495f341075c09023ba16dee9a7f37a021e745 ]
Currently, the RemapEn (valid) bit is accidentally cleared when programming IRTE w/ guestMode=0. It should be restored to the prior state.
--- drivers/iommu/amd/iommu.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/iommu/amd/iommu.c +2 -0
@@ -3841,6 +3841,7 @@ int amd_iommu_deactivate_guest_mode(void *data)struct amd_ir_data *ir_data = (struct amd_ir_data *)data;struct irte_ga *entry = (struct irte_ga *) ir_data->entry;struct irq_cfg *cfg = ir_data->cfg; +u64 valid = entry->lo.fields_remap.valid;if (!AMD_IOMMU_GUEST_IR_VAPIC (amd_iommu_guest_ir) || !entry || !entry->lo.fields_vapic.guest_mode)
@@ -3849,6 +3850,7 @@ int amd_iommu_deactivate_guest_mode(void *data) entry->lo.val =0 ; entry->hi.val =0 ; + entry->lo.fields_remap.valid = valid; entry->lo.fields_remap.dm = apic->irq_dest_mode; entry->lo.fields_remap.int_type = apic->irq_delivery_mode; entry->hi.fields.vector = cfg->vector;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 114/186 iommu/amd: Use cmpxchg_double() when updating 128-bit IRTE
In reply to Greg Kroah-HartmanFrom: Suravee Suthikulpanit <[email protected]>
[ Upstream commit e52d58d54a321d4fe9d0ecdabe4f8774449f0d6e ]
When using 128-bit interrupt-remapping table entry (IRTE) (a.k.a GA mode), current driver disables interrupt remapping when it updates the IRTE so that the upper and lower 64-bit values can be updated safely.
However, this creates a small window, where the interrupt could arrive and result in IO_PAGE_FAULT (for interrupt) as shown below.
IOMMU Driver Device IRQ
============ ===========
irte.RemapEn=0
...
change IRTE IRQ from device ==> IO_PAGE_FAULT !!
...irte.RemapEn=1
This scenario has been observed when changing irq affinity on a system running I/O-intensive workload, in which the destination APIC ID in the IRTE is updated.
Instead, use cmpxchg_double() to update the 128-bit IRTE at once without disabling the interrupt remapping. However, this means several features, which require GA (128-bit IRTE) support will also be affected if cmpxchg16b is not supported (which is unprecedented for AMD processors w/ IOMMU).
--- drivers/iommu/Kconfig | 2 +- drivers/iommu/amd/init.c | 21 +++++++++++++++++++-- drivers/iommu/amd/iommu.c | 17 +++++++++++++---- 3 files changed, 33 insertions(+), 7 deletions(-)
drivers/iommu/Kconfig +1 -1
@@ -143,7 +143,7 @@ config AMD_IOMMU select IOMMU_API select IOMMU_IOVA select IOMMU_DMA - depends on X86_64 && PCI && ACPI + depends on X86_64 && PCI && ACPI && HAVE_CMPXCHG_DOUBLE help With this option you can enable support for AMD IOMMU hardware in your system. An IOMMU is a hardware component which provides
drivers/iommu/amd/init.c +19 -2
@@ -1518,7 +1518,14 @@ static int __init init_iommu_one(struct amd_iommu *iommu, struct ivhd_header *h) iommu->mmio_phys_end =MMIO_REG_END_OFFSET ; else iommu->mmio_phys_end = MMIO_CNTR_CONF_OFFSET; -if (((h->efr_attr & (0x1 <<IOMMU_FEAT_GASUP_SHIFT )) ==0 )) + +/* +* Note: GA (128-bit IRTE) mode requires cmpxchg16b supports. +* GAM also requires GA mode. Therefore, we need to +* check cmpxchg16b support before enabling it. +*/ +if (!boot_cpu_has (X86_FEATURE_CX16 ) || + ((h->efr_attr & (0x1 <<IOMMU_FEAT_GASUP_SHIFT )) ==0 )) amd_iommu_guest_ir =AMD_IOMMU_GUEST_IR_LEGACY ;break ;case 0x11 :
@@ -1527,8 +1534,18 @@ static int __init init_iommu_one(struct amd_iommu *iommu, struct ivhd_header *h) iommu->mmio_phys_end =MMIO_REG_END_OFFSET ; else iommu->mmio_phys_end = MMIO_CNTR_CONF_OFFSET; -if (((h->efr_reg & (0x1 <<IOMMU_EFR_GASUP_SHIFT )) ==0 )) + +/* +* Note: GA (128-bit IRTE) mode requires cmpxchg16b supports. +* XT, GAM also requires GA mode. Therefore, we need to +* check cmpxchg16b support before enabling them. +*/ +if (!boot_cpu_has (X86_FEATURE_CX16 ) || + ((h->efr_reg & (0x1 <<IOMMU_EFR_GASUP_SHIFT )) ==0 )) { amd_iommu_guest_ir =AMD_IOMMU_GUEST_IR_LEGACY ; +break ; + } +/* * Note: Since iommu_update_intcapxt() leverages * the IOMMU MMIO access to MSI capability block registers
drivers/iommu/amd/iommu.c +13 -4
@@ -3283,6 +3283,7 @@ out:static int modify_irte_ga (u16 devid,int index,struct irte_ga *irte,struct amd_ir_data *data) { +bool ret;struct irq_remap_table *table;struct amd_iommu *iommu;unsigned long flags;
@@ -3300,10 +3301,18 @@ static int modify_irte_ga(u16 devid, int index, struct irte_ga *irte, entry = (struct irte_ga *)table->table; entry = &entry[index]; - entry->lo.fields_remap.valid =0 ; - entry->hi.val = irte->hi.val; - entry->lo.val = irte->lo.val; - entry->lo.fields_remap.valid =1 ; + + ret =cmpxchg_double (&entry->lo.val, &entry->hi.val, + entry->lo.val, entry->hi.val, + irte->lo.val, irte->hi.val); +/* +* We use cmpxchg16 to atomically update the 128-bit IRTE, +* and it cannot be updated by the hardware or other processors +* behind us, so the return value of cmpxchg16 should be the +* same as the old value. +*/ +WARN_ON (!ret); +if (data) data->ref = entry;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 115/186 net/packet: fix overflow in tpacket_rcv
In reply to Greg Kroah-HartmanFrom: Or Cohen <[email protected]>
[ Upstream commit acf69c946233259ab4d64f8869d4037a198c7f06 ]
Using tp_reserve to calculate netoff can overflow as tp_reserve is unsigned int and netoff is unsigned short.
This may lead to macoff receving a smaller value then sizeof(struct virtio_net_hdr), and if po->has_vnet_hdr is set, an out-of-bounds write will occur when calling virtio_net_hdr_from_skb.
The bug is fixed by converting netoff to unsigned int and checking if it exceeds USHRT_MAX.
This addresses CVE-2020-14386
--- net/packet/af_packet.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/packet/af_packet.c +6 -1
@@ -2170,7 +2170,8 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,int skb_len = skb->len;unsigned int snaplen, res;unsigned long status =TP_STATUS_USER ; -unsigned short macoff, netoff, hdrlen; +unsigned short macoff, hdrlen; +unsigned int netoff;struct sk_buff *copy_skb =NULL ;struct timespec64 ts;__u32 ts_status;
@@ -2239,6 +2240,10 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, } macoff = netoff - maclen; } +if (netoff >USHRT_MAX ) { +atomic_inc (&po->tp_drops); + goto drop_n_restore; + }if (po->tp_version <=TPACKET_V2 ) {if (macoff + snaplen > po->rx_ring.frame_size) { if (po->copy_thresh &&
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 116/186 include/linux/log2.h: add missing () around n in roundup_pow_of_two()
In reply to Greg Kroah-HartmanFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit 428fc0aff4e59399ec719ffcc1f7a5d29a4ee476 ]
Otherwise gcc generates warnings if the expression is complicated.
--- include/linux/log2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/log2.h +1 -1
@@ -173,7 +173,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n)#define roundup_pow_of_two (n) \ ( \ __builtin_constant_p(n) ? ( \ - (n == 1) ? 1 : \ + ((n) == 1) ? 1 : \ (1UL << (ilog2((n) - 1) + 1)) \ ) : \ __roundup_pow_of_two(n) \
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 117/186 iommu/vt-d: Handle 36bit addressing for x86-32
In reply to Greg Kroah-HartmanFrom: Chris Wilson <[email protected]>
commit 29aaebbca4abc4cceb38738483051abefafb6950 upstream.
Beware that the address size for x86-32 may exceed unsigned long.
[ 0.368971] UBSAN: shift-out-of-bounds in drivers/iommu/intel/iommu.c:128:14 [ 0.369055] shift exponent 36 is too large for 32-bit type 'long unsigned int'
If we don't handle the wide addresses, the pages are mismapped and the device read/writes go astray, detected as DMAR faults and leading to device failure. The behaviour changed (from working to broken) in commit fa954e683178 ("iommu/vt-d: Delegate the dma domain to upper layer"), but the error looks older.
--- drivers/iommu/intel/iommu.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/iommu/intel/iommu.c +7 -7
@@ -123,29 +123,29 @@ static inline unsigned int level_to_offsreturn (level -1 ) *LEVEL_STRIDE ; } -static inline int pfn_level_offset (unsigned long pfn,int level) +static inline int pfn_level_offset (u64 pfn,int level) {return (pfn >>level_to_offset_bits (level)) &LEVEL_MASK ; } -static inline unsigned long level_mask (int level) +static inline u64 level_mask (int level) { -return -1UL <<level_to_offset_bits (level); +return -1ULL <<level_to_offset_bits (level); } -static inline unsigned long level_size (int level) +static inline u64 level_size (int level) { -return 1UL <<level_to_offset_bits (level); +return 1ULL <<level_to_offset_bits (level); } -static inline unsigned long align_to_level (unsigned long pfn,int level) +static inline u64 align_to_level (u64 pfn,int level) {return (pfn +level_size (level) -1 ) &level_mask (level); }static inline unsigned long lvl_to_nr_pages (unsigned int lvl) { -return 1 <<min_t (int, (lvl -1 ) *LEVEL_STRIDE ,MAX_AGAW_PFN_WIDTH ); +return 1UL <<min_t (int, (lvl -1 ) *LEVEL_STRIDE ,MAX_AGAW_PFN_WIDTH ); }/* VT-d pages must always be _smaller_ than MM pages. Otherwise things
Greg Kroah-Hartman
maintainerPATCH 118/186 tracing/kprobes, x86/ptrace: Fix regs argument order for i386
In reply to Greg Kroah-HartmanFrom: Vamshi K Sthambamkadi <[email protected]>
commit 2356bb4b8221d7dc8c7beb810418122ed90254c9 upstream.
On i386, the order of parameters passed on regs is eax,edx,and ecx (as per regparm(3) calling conventions).
Change the mapping in regs_get_kernel_argument(), so that arg1=ax arg2=dx, and arg3=cx.
Running the selftests testcase kprobes_args_use.tc shows the result as passed.
--- arch/x86/include/asm/ptrace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/ptrace.h +1 -1
@@ -322,8 +322,8 @@ static inline unsigned long regs_get_kerstatic const unsigned int argument_offs[] = { #ifdef __i386__ offsetof(struct pt_regs , ax), - offsetof(struct pt_regs , cx), offsetof(struct pt_regs , dx), + offsetof(struct pt_regs , cx), #define NR_REG_ARGUMENTS 3 #else offsetof(struct pt_regs, di),
Greg Kroah-Hartman
maintainerPATCH 119/186 x86/entry: Fix AC assertion
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
commit 662a0221893a3d58aa72719671844264306f6e4b upstream.
The WARN added in commit 3c73b81a9164 ("x86/entry, selftests: Further improve user entry sanity checks") unconditionally triggers on a IVB machine because it does not support SMAP.
For !SMAP hardware the CLAC/STAC instructions are patched out and thus if userspace sets AC, it is still have set after entry.
--- arch/x86/entry/common.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
arch/x86/entry/common.c +10 -2
@@ -55,8 +55,16 @@ static noinstr void check_user_regs(stru* state, not the interrupt state as imagined by Xen. */ unsigned long flags =native_save_fl (); -WARN_ON_ONCE (flags & (X86_EFLAGS_AC |X86_EFLAGS_DF | -X86_EFLAGS_NT )); +unsigned long mask =X86_EFLAGS_DF |X86_EFLAGS_NT ; + +/* +* For !SMAP hardware we patch out CLAC on entry. +*/ +if (boot_cpu_has (X86_FEATURE_SMAP ) || + (IS_ENABLED (CONFIG_64_BIT ) &&boot_cpu_has (X86_FEATURE_XENPV ))) + mask |=X86_EFLAGS_AC ; + +WARN_ON_ONCE (flags & mask);/* We think we came from user mode. Make sure pt_regs agrees. */ WARN_ON_ONCE (!user_mode (regs));
Greg Kroah-Hartman
maintainerPATCH 120/186 x86/debug: Allow a single level of #DB recursion
In reply to Greg Kroah-HartmanFrom: Andy Lutomirski <[email protected]>
commit d5c678aed5eddb944b8e7ce451b107b39245962d upstream.
Trying to clear DR7 around a #DB from usermode malfunctions if the tasks schedules when delivering SIGTRAP.
Rather than trying to define a special no-recursion region, just allow a single level of recursion. The same mechanism is used for NMI, and it hasn't caused any problems yet.
--- arch/x86/kernel/traps.c | 66 +++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 34 deletions(-)
arch/x86/kernel/traps.c +32 -34
@@ -733,20 +733,9 @@ static bool is_sysenter_singlestep(struc#endif } -static __always_inline void debug_enter(unsigned long *dr6, unsigned long *dr7) +static __always_inline unsigned long debug_read_clear_dr6 (void ) { -/* -* Disable breakpoints during exception handling; recursive exceptions -* are exceedingly 'fun'. -* -* Since this function is NOKPROBE, and that also applies to -* HW_BREAKPOINT_X, we can't hit a breakpoint before this (XXX except a -* HW_BREAKPOINT_W on our stack) -* -* Entry text is excluded for HW_BP_X and cpu_entry_area, which -* includes the entry stack is excluded for everything. -*/ - *dr7 =local_db_save (); +unsigned long dr6;/* * The Intel SDM says:
@@ -759,15 +748,12 @@ static __always_inline void debug_enter(* * Keep it simple: clear DR6 immediately. */ -get_debugreg (*dr6,6 ); +get_debugreg (dr6,6 );set_debugreg (0 ,6 );/* Filter out all the reserved bits which are preset to 1 */ - *dr6 &= ~DR6_RESERVED ; -} + dr6 &= ~DR6_RESERVED ; -static __always_inline void debug_exit(unsigned long dr7) -{ -local_db_restore (dr7); +return dr6; }/*
@@ -867,6 +853,19 @@ out: static __always_inline void exc_debug_kernel(struct pt_regs *regs,unsigned long dr6) { +/* +* Disable breakpoints during exception handling; recursive exceptions +* are exceedingly 'fun'. +* +* Since this function is NOKPROBE, and that also applies to +* HW_BREAKPOINT_X, we can't hit a breakpoint before this (XXX except a +* HW_BREAKPOINT_W on our stack) +* +* Entry text is excluded for HW_BP_X and cpu_entry_area, which +* includes the entry stack is excluded for everything. +*/ +unsigned long dr7 =local_db_save (); +nmi_enter ();instrumentation_begin ();trace_hardirqs_off_finish ();
@@ -890,6 +889,8 @@ static __always_inline void exc_debug_ketrace_hardirqs_on_prepare ();instrumentation_end ();nmi_exit (); + +local_db_restore (dr7); } static __always_inline void exc_debug_user(struct pt_regs *regs,
@@ -901,6 +902,15 @@ static __always_inline void exc_debug_us*/ WARN_ON_ONCE (!user_mode (regs)); +/* +* NB: We can't easily clear DR7 here because +* idtentry_exit_to_usermode() can invoke ptrace, schedule, access +* user memory, etc. This means that a recursive #DB is possible. If +* this happens, that #DB will hit exc_debug_kernel() and clear DR7. +* Since we're not on the IST stack right now, everything will be +* fine. +*/ +idtentry_enter_user (regs);instrumentation_begin ();
@@ -913,36 +923,24 @@ static __always_inline void exc_debug_us/* IST stack entry */ DEFINE_IDTENTRY_DEBUG (exc_debug) { -unsigned long dr6, dr7; - -debug_enter (&dr6, &dr7); -exc_debug_kernel (regs, dr6); -debug_exit (dr7); +exc_debug_kernel (regs,debug_read_clear_dr6 ()); }/* User entry, runs on regular task stack */ DEFINE_IDTENTRY_DEBUG_USER (exc_debug) { -unsigned long dr6, dr7; - -debug_enter (&dr6, &dr7); -exc_debug_user (regs, dr6); -debug_exit (dr7); +exc_debug_user (regs,debug_read_clear_dr6 ()); }#else /* 32 bit does not have separate entry points. */ DEFINE_IDTENTRY_RAW (exc_debug) { -unsigned long dr6, dr7; - -debug_enter (&dr6, &dr7); +unsigned long dr6 =debug_read_clear_dr6 ();if (user_mode (regs))exc_debug_user (regs, dr6);else exc_debug_kernel (regs, dr6); - -debug_exit (dr7); }#endif
Greg Kroah-Hartman
maintainerPATCH 121/186 ext2: dont update mtime on COW faults
In reply to Greg Kroah-HartmanFrom: Mikulas Patocka <[email protected]>
commit 1ef6ea0efe8e68d0299dad44c39dc6ad9e5d1f39 upstream.
When running in a dax mode, if the user maps a page with MAP_PRIVATE and PROT_WRITE, the ext2 filesystem would incorrectly update ctime and mtime when the user hits a COW fault.
This breaks building of the Linux kernel. How to reproduce:
1. extract the Linux kernel tree on dax-mounted ext2 filesystem
2. run make clean
3. run make -j12
4. run make -j12
at step 4, make would incorrectly rebuild the whole kernel (although it was already built in step 3).
The reason for the breakage is that almost all object files depend on objtool. When we run objtool, it takes COW page fault on its .data section, and these faults will incorrectly update the timestamp of the objtool binary. The updated timestamp causes make to rebuild the whole tree.
--- fs/ext2/file.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/ext2/file.c +4 -2
@@ -93,8 +93,10 @@ static vm_fault_t ext2_dax_fault(structstruct inode *inode =file_inode (vmf->vma->vm_file);struct ext2_inode_info *ei =EXT2_I (inode);vm_fault_t ret; +bool write = (vmf->flags &FAULT_FLAG_WRITE ) && + (vmf->vma->vm_flags &VM_SHARED ); -if (vmf->flags &FAULT_FLAG_WRITE ) { +if (write) {sb_start_pagefault (inode->i_sb);file_update_time (vmf->vma->vm_file); }
@@ -103,7 +105,7 @@ static vm_fault_t ext2_dax_fault(struct ret =dax_iomap_fault (vmf,PE_SIZE_PTE ,NULL ,NULL , &ext2_iomap_ops);up_read (&ei->dax_sem); -if (vmf->flags &FAULT_FLAG_WRITE ) +if (write)sb_end_pagefault (inode->i_sb);return ret; }
Greg Kroah-Hartman
maintainerPATCH 122/186 xfs: dont update mtime on COW faults
In reply to Greg Kroah-HartmanFrom: Mikulas Patocka <[email protected]>
commit b17164e258e3888d376a7434415013175d637377 upstream.
When running in a dax mode, if the user maps a page with MAP_PRIVATE and PROT_WRITE, the xfs filesystem would incorrectly update ctime and mtime when the user hits a COW fault.
This breaks building of the Linux kernel. How to reproduce:
1. extract the Linux kernel tree on dax-mounted xfs filesystem
2. run make clean
3. run make -j12
4. run make -j12
at step 4, make would incorrectly rebuild the whole kernel (although it was already built in step 3).
The reason for the breakage is that almost all object files depend on objtool. When we run objtool, it takes COW page fault on its .data section, and these faults will incorrectly update the timestamp of the objtool binary. The updated timestamp causes make to rebuild the whole tree.
--- fs/xfs/xfs_file.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
fs/xfs/xfs_file.c +10 -2
@@ -1220,6 +1220,14 @@ __xfs_filemap_fault(return ret; } +static inline bool +xfs_is_write_fault ( +struct vm_fault *vmf) +{ +return (vmf->flags &FAULT_FLAG_WRITE ) && + (vmf->vma->vm_flags &VM_SHARED ); +} +static vm_fault_t xfs_filemap_fault (struct vm_fault *vmf)
@@ -1227,7 +1235,7 @@ xfs_filemap_fault(/* DAX can shortcut the normal fault path on write faults! */ return __xfs_filemap_fault (vmf,PE_SIZE_PTE ,IS_DAX (file_inode (vmf->vma->vm_file)) && - (vmf->flags &FAULT_FLAG_WRITE )); +xfs_is_write_fault (vmf)); } static vm_fault_t
@@ -1240,7 +1248,7 @@ xfs_filemap_huge_fault(/* DAX can shortcut the normal fault path on write faults! */ return __xfs_filemap_fault (vmf, pe_size, - (vmf->flags &FAULT_FLAG_WRITE )); +xfs_is_write_fault (vmf)); } static vm_fault_t
Greg Kroah-Hartman
maintainerPATCH 123/186 ARC: perf: dont bail setup if pct irq missing in device-tree
In reply to Greg Kroah-HartmanFrom: Vineet Gupta <[email protected]>
commit feb92d7d3813456c11dce215b3421801a78a8986 upstream.
Current code inadventely bails if hardware supports sampling/overflow interrupts, but the irq is missing from device tree.
| | # perf stat -e cycles,instructions,major-faults,minor-faults ../hackbench | Running with 10 groups 400 process | Time: 0.921 | | Performance counter stats for '../hackbench': | | <not supported> cycles | <not supported> instructions | 0 major-faults | 8679 minor-faults
This need not be as we can still do simple counting based perf stat. This unborks perf on HSDK-4xD
--- arch/arc/kernel/perf_event.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
arch/arc/kernel/perf_event.c +4 -10
@@ -562,7 +562,7 @@ static int arc_pmu_device_probe(struct p {struct arc_reg_pct_build pct_bcr;struct arc_reg_cc_build cc_bcr; -int i, has_interrupts; +int i, has_interrupts, irq;int counter_size;/* in bits */ union cc_name {
@@ -637,13 +637,7 @@ static int arc_pmu_device_probe(struct p .attr_groups = arc_pmu->attr_groups, }; -if (has_interrupts) { -int irq =platform_get_irq (pdev,0 ); - -if (irq <0 ) { -pr_err ("Cannot get IRQ number for the platform\n" ); -return -ENODEV ; - } +if (has_interrupts && (irq =platform_get_irq (pdev,0 ) >=0 )) { arc_pmu->irq = irq;
@@ -652,9 +646,9 @@ static int arc_pmu_device_probe(struct p this_cpu_ptr(&arc_pmu_cpu));on_each_cpu (arc_cpu_pmu_irq_init, &irq,1 ); - - }else + }else { arc_pmu->pmu.capabilities |=PERF_PMU_CAP_NO_INTERRUPT ; + }/* * perf parser doesn't really like '-' symbol in events name, so let's
Greg Kroah-Hartman
maintainerPATCH 124/186 arc: fix memory initialization for systems with two memory banks
In reply to Greg Kroah-HartmanFrom: Mike Rapoport <[email protected]>
commit 4af22ded0ecf23adea1b26ea264c53f9f1cfc310 upstream.
Rework of memory map initialization broke initialization of ARC systems with two memory banks. Before these changes, memblock was not aware of nodes configuration and the memory map was always allocated from the "lowmem" bank. After the addition of node information to memblock, the core mm attempts to allocate the memory map for the "highmem" bank from its node. The access to this memory using __va() fails because it can be only accessed using kmap.
Anther problem that was uncovered is that {min,max}_high_pfn are calculated from u64 high_mem_start variable which prevents truncation to 32-bit physical address and the PFN values are above the node and zone boundaries.
Use phys_addr_t type for high_mem_start and high_mem_size to ensure correspondence between PFNs and highmem zone boundaries and reserve the entire highmem bank until mem_init() to avoid accesses to it before highmem is enabled.
To test this:
1. Enable HIGHMEM in ARC config
2. Enable 2 memory banks in haps_hs.dts (uncomment the 2nd bank)
--- arch/arc/mm/init.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-)
arch/arc/mm/init.c +16 -11
@@ -27,8 +27,8 @@ static unsigned long low_mem_sz;#ifdef CONFIG_HIGHMEM static unsigned long min_high_pfn, max_high_pfn; -static u64 high_mem_start; -static u64 high_mem_sz; +static phys_addr_t high_mem_start; +static phys_addr_t high_mem_sz;#endif #ifdef CONFIG_DISCONTIGMEM
@@ -70,6 +70,7 @@ void __init early_init_dt_add_memory_arc high_mem_sz = size; in_use =1 ;memblock_add_node (base, size,1 ); +memblock_reserve (base, size);#endif }
@@ -158,7 +159,7 @@ void __init setup_arch_memory(void) min_high_pfn =PFN_DOWN (high_mem_start); max_high_pfn =PFN_DOWN (high_mem_start + high_mem_sz); - max_zone_pfn[ZONE_HIGHMEM ] = max_high_pfn; + max_zone_pfn[ZONE_HIGHMEM ] = min_low_pfn; high_memory = (void *)(min_high_pfn <<PAGE_SHIFT );kmap_init ();
@@ -167,22 +168,26 @@ void __init setup_arch_memory(void)free_area_init (max_zone_pfn); } -/* -* mem_init - initializes memory -* -* Frees up bootmem -* Calculates and displays memory available/used -*/ -void __init mem_init (void ) +static void __init highmem_init (void ) {#ifdef CONFIG_HIGHMEM unsigned long tmp; -reset_all_zones_managed_pages (); +memblock_free (high_mem_start, high_mem_sz);for (tmp = min_high_pfn; tmp < max_high_pfn; tmp++)free_highmem_page (pfn_to_page (tmp));#endif +} +/* +* mem_init - initializes memory +* +* Frees up bootmem +* Calculates and displays memory available/used +*/ +void __init mem_init (void ) +{memblock_free_all (); +highmem_init ();mem_init_print_info (NULL ); }
Greg Kroah-Hartman
maintainerPATCH 125/186 btrfs: drop path before adding new uuid tree entry
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit 9771a5cf937129307d9f58922d60484d58ababe7 upstream.
With the conversion of the tree locks to rwsem I got the following lockdep splat:
======================================================
WARNING: possible circular locking dependency detected 5.8.0-rc7-00167-g0d7ba0c5b375-dirty #925 Not tainted
------------------------------------------------------
btrfs-uuid/7955 is trying to acquire lock:
ffff88bfbafec0f8 (btrfs-root-00){++++}-{3:3}, at: __btrfs_tree_read_lock+0x39/0x180
but task is already holding lock:
ffff88bfbafef2a8 (btrfs-uuid-00){++++}-{3:3}, at: __btrfs_tree_read_lock+0x39/0x180
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (btrfs-uuid-00){++++}-{3:3}:
down_read_nested+0x3e/0x140 __btrfs_tree_read_lock+0x39/0x180 __btrfs_read_lock_root_node+0x3a/0x50 btrfs_search_slot+0x4bd/0x990 btrfs_uuid_tree_add+0x89/0x2d0 btrfs_uuid_scan_kthread+0x330/0x390 kthread+0x133/0x150 ret_from_fork+0x1f/0x30
-> #0 (btrfs-root-00){++++}-{3:3}:
__lock_acquire+0x1272/0x2310 lock_acquire+0x9e/0x360 down_read_nested+0x3e/0x140 __btrfs_tree_read_lock+0x39/0x180 __btrfs_read_lock_root_node+0x3a/0x50 btrfs_search_slot+0x4bd/0x990 btrfs_find_root+0x45/0x1b0 btrfs_read_tree_root+0x61/0x100 btrfs_get_root_ref.part.50+0x143/0x630 btrfs_uuid_tree_iterate+0x207/0x314 btrfs_uuid_rescan_kthread+0x12/0x50 kthread+0x133/0x150 ret_from_fork+0x1f/0x30
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(btrfs-uuid-00);
lock(btrfs-root-00);
lock(btrfs-uuid-00);
lock(btrfs-root-00);*** DEADLOCK ***
1 lock held by btrfs-uuid/7955:
#0: ffff88bfbafef2a8 (btrfs-uuid-00){++++}-{3:3}, at: __btrfs_tree_read_lock+0x39/0x180
stack backtrace: CPU: 73 PID: 7955 Comm: btrfs-uuid Kdump: loaded Not tainted 5.8.0-rc7-00167-g0d7ba0c5b375-dirty #925 Hardware name: Quanta Tioga Pass Single Side 01-0030993006/Tioga Pass Single Side, BIOS F08_3A18 12/20/2018 Call Trace: dump_stack+0x78/0xa0 check_noncircular+0x165/0x180 __lock_acquire+0x1272/0x2310 lock_acquire+0x9e/0x360 ? __btrfs_tree_read_lock+0x39/0x180 ? btrfs_root_node+0x1c/0x1d0 down_read_nested+0x3e/0x140 ? __btrfs_tree_read_lock+0x39/0x180 __btrfs_tree_read_lock+0x39/0x180 __btrfs_read_lock_root_node+0x3a/0x50 btrfs_search_slot+0x4bd/0x990 btrfs_find_root+0x45/0x1b0 btrfs_read_tree_root+0x61/0x100 btrfs_get_root_ref.part.50+0x143/0x630 btrfs_uuid_tree_iterate+0x207/0x314 ? btree_readpage+0x20/0x20 btrfs_uuid_rescan_kthread+0x12/0x50 kthread+0x133/0x150 ? kthread_create_on_node+0x60/0x60 ret_from_fork+0x1f/0x30
This problem exists because we have two different rescan threads, btrfs_uuid_scan_kthread which creates the uuid tree, and btrfs_uuid_tree_iterate that goes through and updates or deletes any out of date roots. The problem is they both do things in different order. btrfs_uuid_scan_kthread() reads the tree_root, and then inserts entries into the uuid_root. btrfs_uuid_tree_iterate() scans the uuid_root, but then does a btrfs_get_fs_root() which can read from the tree_root.
It's actually easy enough to not be holding the path in btrfs_uuid_scan_kthread() when we add a uuid entry, as we already drop it further down and re-start the search when we loop. So simply move the path release before we add our entry to the uuid tree.
This also fixes a problem where we're holding a path open after we do btrfs_end_transaction(), which has it's own problems.
--- fs/btrfs/volumes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/volumes.c +2 -1
@@ -4462,6 +4462,7 @@ int btrfs_uuid_scan_kthread(void *data) goto skip; } update_tree: +btrfs_release_path (path);if (!btrfs_is_empty_uuid (root_item.uuid)) { ret = btrfs_uuid_tree_add(trans, root_item.uuid, BTRFS_UUID_KEY_SUBVOL,
@@ -4486,6 +4487,7 @@ update_tree: } skip: +btrfs_release_path (path);if (trans) { ret =btrfs_end_transaction (trans); trans =NULL ;
@@ -4493,7 +4495,6 @@ skip:break ; } -btrfs_release_path (path);if (key.offset < (u64)-1 ) { key.offset++; }else if (key.type <BTRFS_ROOT_ITEM_KEY ) {
Greg Kroah-Hartman
maintainerPATCH 126/186 btrfs: fix potential deadlock in the search ioctl
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit a48b73eca4ceb9b8a4b97f290a065335dbcd8a04 upstream.
With the conversion of the tree locks to rwsem I got the following lockdep splat:
======================================================
WARNING: possible circular locking dependency detected 5.8.0-rc7-00165-g04ec4da5f45f-dirty #922 Not tainted
------------------------------------------------------
compsize/11122 is trying to acquire lock:
ffff889fabca8768 (&mm->mmap_lock#2){++++}-{3:3}, at: __might_fault+0x3e/0x90
but task is already holding lock:
ffff889fe720fe40 (btrfs-fs-00){++++}-{3:3}, at: __btrfs_tree_read_lock+0x39/0x180
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (btrfs-fs-00){++++}-{3:3}:
down_write_nested+0x3b/0x70 __btrfs_tree_lock+0x24/0x120 btrfs_search_slot+0x756/0x990 btrfs_lookup_inode+0x3a/0xb4 __btrfs_update_delayed_inode+0x93/0x270 btrfs_async_run_delayed_root+0x168/0x230 btrfs_work_helper+0xd4/0x570 process_one_work+0x2ad/0x5f0 worker_thread+0x3a/0x3d0 kthread+0x133/0x150 ret_from_fork+0x1f/0x30
-> #1 (&delayed_node->mutex){+.+.}-{3:3}:
__mutex_lock+0x9f/0x930 btrfs_delayed_update_inode+0x50/0x440 btrfs_update_inode+0x8a/0xf0 btrfs_dirty_inode+0x5b/0xd0 touch_atime+0xa1/0xd0 btrfs_file_mmap+0x3f/0x60 mmap_region+0x3a4/0x640 do_mmap+0x376/0x580 vm_mmap_pgoff+0xd5/0x120 ksys_mmap_pgoff+0x193/0x230 do_syscall_64+0x50/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xa9
-> #0 (&mm->mmap_lock#2){++++}-{3:3}:
__lock_acquire+0x1272/0x2310 lock_acquire+0x9e/0x360 __might_fault+0x68/0x90 _copy_to_user+0x1e/0x80 copy_to_sk.isra.32+0x121/0x300 search_ioctl+0x106/0x200 btrfs_ioctl_tree_search_v2+0x7b/0xf0 btrfs_ioctl+0x106f/0x30a0 ksys_ioctl+0x83/0xc0 __x64_sys_ioctl+0x16/0x20 do_syscall_64+0x50/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xa9
other info that might help us debug this:
Chain exists of:
&mm->mmap_lock#2 --> &delayed_node->mutex --> btrfs-fs-00
Possible unsafe locking scenario: CPU0 CPU1
---- ----
lock(btrfs-fs-00);
lock(&delayed_node->mutex);
lock(btrfs-fs-00);
lock(&mm->mmap_lock#2);*** DEADLOCK ***
1 lock held by compsize/11122:
#0: ffff889fe720fe40 (btrfs-fs-00){++++}-{3:3}, at: __btrfs_tree_read_lock+0x39/0x180
stack backtrace: CPU: 17 PID: 11122 Comm: compsize Kdump: loaded Not tainted 5.8.0-rc7-00165-g04ec4da5f45f-dirty #922 Hardware name: Quanta Tioga Pass Single Side 01-0030993006/Tioga Pass Single Side, BIOS F08_3A18 12/20/2018 Call Trace: dump_stack+0x78/0xa0 check_noncircular+0x165/0x180 __lock_acquire+0x1272/0x2310 lock_acquire+0x9e/0x360 ? __might_fault+0x3e/0x90 ? find_held_lock+0x72/0x90 __might_fault+0x68/0x90 ? __might_fault+0x3e/0x90 _copy_to_user+0x1e/0x80 copy_to_sk.isra.32+0x121/0x300 ? btrfs_search_forward+0x2a6/0x360 search_ioctl+0x106/0x200 btrfs_ioctl_tree_search_v2+0x7b/0xf0 btrfs_ioctl+0x106f/0x30a0 ? __do_sys_newfstat+0x5a/0x70 ? ksys_ioctl+0x83/0xc0 ksys_ioctl+0x83/0xc0 __x64_sys_ioctl+0x16/0x20 do_syscall_64+0x50/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xa9
The problem is we're doing a copy_to_user() while holding tree locks, which can deadlock if we have to do a page fault for the copy_to_user(). This exists even without my locking changes, so it needs to be fixed. Rework the search ioctl to do the pre-fault and then copy_to_user_nofault for the copying.
--- fs/btrfs/extent_io.c | 8 ++++---- fs/btrfs/extent_io.h | 6 +++--- fs/btrfs/ioctl.c | 27 ++++++++++++++++++++------- 3 files changed, 27 insertions(+), 14 deletions(-)
fs/btrfs/extent_io.c +4 -4
@@ -5640,9 +5640,9 @@ void read_extent_buffer(const struct ext } } -int read_extent_buffer_to_user (const struct extent_buffer *eb, -void __user *dstv, -unsigned long start,unsigned long len) +int read_extent_buffer_to_user_nofault (const struct extent_buffer *eb, +void __user *dstv, +unsigned long start,unsigned long len) {size_t cur;size_t offset;
@@ -5662,7 +5662,7 @@ int read_extent_buffer_to_user(const str cur =min (len, (PAGE_SIZE - offset)); kaddr =page_address (page); -if (copy_to_user (dst, kaddr + offset, cur)) { +if (copy_to_user_nofault (dst, kaddr + offset, cur)) { ret = -EFAULT ;break ; }
fs/btrfs/extent_io.h +3 -3
@@ -241,9 +241,9 @@ int memcmp_extent_buffer(const struct exvoid read_extent_buffer (const struct extent_buffer *eb,void *dst,unsigned long start,unsigned long len); -int read_extent_buffer_to_user (const struct extent_buffer *eb, -void __user *dst,unsigned long start, -unsigned long len); +int read_extent_buffer_to_user_nofault (const struct extent_buffer *eb, +void __user *dst,unsigned long start, +unsigned long len);void write_extent_buffer_fsid (const struct extent_buffer *eb,const void *src);void write_extent_buffer_chunk_tree_uuid (const struct extent_buffer *eb,const void *src);
fs/btrfs/ioctl.c +20 -7
@@ -2086,9 +2086,14 @@ static noinline int copy_to_sk(struct bt sh.len = item_len; sh.transid = found_transid; -/* copy search result header */ -if (copy_to_user (ubuf + *sk_offset, &sh,sizeof (sh))) { - ret = -EFAULT ; +/* +* Copy search result header. If we fault then loop again so we +* can fault in the pages and -EFAULT there if there's a +* problem. Otherwise we'll fault and then copy the buffer in +* properly this next time through +*/ +if (copy_to_user_nofault (ubuf + *sk_offset, &sh,sizeof (sh))) { + ret =0 ; goto out; }
@@ -2096,10 +2101,14 @@ static noinline int copy_to_sk(struct btif (item_len) {char __user *up = ubuf + *sk_offset; -/* copy the item */ -if (read_extent_buffer_to_user (leaf, up, - item_off, item_len)) { - ret = -EFAULT ; +/* +* Copy the item, same behavior as above, but reset the +* * sk_offset so we copy the full thing again. +*/ +if (read_extent_buffer_to_user_nofault (leaf, up, + item_off, item_len)) { + ret =0 ; + *sk_offset -=sizeof (sh); goto out; }
@@ -2184,6 +2193,10 @@ static noinline int search_ioctl(struct key.offset = sk->min_offset;while (1 ) { + ret =fault_in_pages_writeable (ubuf, *buf_size - sk_offset); +if (ret) +break ; + ret =btrfs_search_forward (root, &key, path, sk->min_transid);if (ret !=0 ) {if (ret >0 )
Greg Kroah-Hartman
maintainerPATCH 127/186 btrfs: allocate scrub workqueues outside of locks
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit e89c4a9c8e6ce3a84cab4f342687d3fbbb1234eb upstream.
I got the following lockdep splat while testing:
======================================================
WARNING: possible circular locking dependency detected 5.8.0-rc7-00172-g021118712e59 #932 Not tainted
------------------------------------------------------
btrfs/229626 is trying to acquire lock:
ffffffff828513f0 (cpu_hotplug_lock){++++}-{0:0}, at: alloc_workqueue+0x378/0x450
but task is already holding lock:
ffff889dd3889518 (&fs_info->scrub_lock){+.+.}-{3:3}, at: btrfs_scrub_dev+0x11c/0x630
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #7 (&fs_info->scrub_lock){+.+.}-{3:3}:
__mutex_lock+0x9f/0x930 btrfs_scrub_dev+0x11c/0x630 btrfs_dev_replace_by_ioctl.cold.21+0x10a/0x1d4 btrfs_ioctl+0x2799/0x30a0 ksys_ioctl+0x83/0xc0 __x64_sys_ioctl+0x16/0x20 do_syscall_64+0x50/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xa9
-> #6 (&fs_devs->device_list_mutex){+.+.}-{3:3}:
__mutex_lock+0x9f/0x930 btrfs_run_dev_stats+0x49/0x480 commit_cowonly_roots+0xb5/0x2a0 btrfs_commit_transaction+0x516/0xa60 sync_filesystem+0x6b/0x90 generic_shutdown_super+0x22/0x100 kill_anon_super+0xe/0x30 btrfs_kill_super+0x12/0x20 deactivate_locked_super+0x29/0x60 cleanup_mnt+0xb8/0x140 task_work_run+0x6d/0xb0 __prepare_exit_to_usermode+0x1cc/0x1e0 do_syscall_64+0x5c/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xa9
-> #5 (&fs_info->tree_log_mutex){+.+.}-{3:3}:
__mutex_lock+0x9f/0x930 btrfs_commit_transaction+0x4bb/0xa60 sync_filesystem+0x6b/0x90 generic_shutdown_super+0x22/0x100 kill_anon_super+0xe/0x30 btrfs_kill_super+0x12/0x20 deactivate_locked_super+0x29/0x60 cleanup_mnt+0xb8/0x140 task_work_run+0x6d/0xb0 __prepare_exit_to_usermode+0x1cc/0x1e0 do_syscall_64+0x5c/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xa9
-> #4 (&fs_info->reloc_mutex){+.+.}-{3:3}:
__mutex_lock+0x9f/0x930 btrfs_record_root_in_trans+0x43/0x70 start_transaction+0xd1/0x5d0 btrfs_dirty_inode+0x42/0xd0 touch_atime+0xa1/0xd0 btrfs_file_mmap+0x3f/0x60 mmap_region+0x3a4/0x640 do_mmap+0x376/0x580 vm_mmap_pgoff+0xd5/0x120 ksys_mmap_pgoff+0x193/0x230 do_syscall_64+0x50/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xa9
-> #3 (&mm->mmap_lock#2){++++}-{3:3}:
__might_fault+0x68/0x90 _copy_to_user+0x1e/0x80 perf_read+0x141/0x2c0 vfs_read+0xad/0x1b0 ksys_read+0x5f/0xe0 do_syscall_64+0x50/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xa9
-> #2 (&cpuctx_mutex){+.+.}-{3:3}:
__mutex_lock+0x9f/0x930 perf_event_init_cpu+0x88/0x150 perf_event_init+0x1db/0x20b start_kernel+0x3ae/0x53c secondary_startup_64+0xa4/0xb0
-> #1 (pmus_lock){+.+.}-{3:3}:
__mutex_lock+0x9f/0x930 perf_event_init_cpu+0x4f/0x150 cpuhp_invoke_callback+0xb1/0x900 _cpu_up.constprop.26+0x9f/0x130 cpu_up+0x7b/0xc0 bringup_nonboot_cpus+0x4f/0x60 smp_init+0x26/0x71 kernel_init_freeable+0x110/0x258 kernel_init+0xa/0x103 ret_from_fork+0x1f/0x30
-> #0 (cpu_hotplug_lock){++++}-{0:0}:
__lock_acquire+0x1272/0x2310 lock_acquire+0x9e/0x360 cpus_read_lock+0x39/0xb0 alloc_workqueue+0x378/0x450 __btrfs_alloc_workqueue+0x15d/0x200 btrfs_alloc_workqueue+0x51/0x160 scrub_workers_get+0x5a/0x170 btrfs_scrub_dev+0x18c/0x630 btrfs_dev_replace_by_ioctl.cold.21+0x10a/0x1d4 btrfs_ioctl+0x2799/0x30a0 ksys_ioctl+0x83/0xc0 __x64_sys_ioctl+0x16/0x20 do_syscall_64+0x50/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xa9
other info that might help us debug this:
Chain exists of:
cpu_hotplug_lock --> &fs_devs->device_list_mutex --> &fs_info->scrub_lock
Possible unsafe locking scenario: CPU0 CPU1
---- ----
lock(&fs_info->scrub_lock);
lock(&fs_devs->device_list_mutex);
lock(&fs_info->scrub_lock);
lock(cpu_hotplug_lock);*** DEADLOCK ***
2 locks held by btrfs/229626:
#0: ffff88bfe8bb86e0 (&fs_devs->device_list_mutex){+.+.}-{3:3}, at: btrfs_scrub_dev+0xbd/0x630 #1: ffff889dd3889518 (&fs_info->scrub_lock){+.+.}-{3:3}, at: btrfs_scrub_dev+0x11c/0x630
stack backtrace: CPU: 15 PID: 229626 Comm: btrfs Kdump: loaded Not tainted 5.8.0-rc7-00172-g021118712e59 #932 Hardware name: Quanta Tioga Pass Single Side 01-0030993006/Tioga Pass Single Side, BIOS F08_3A18 12/20/2018 Call Trace: dump_stack+0x78/0xa0 check_noncircular+0x165/0x180 __lock_acquire+0x1272/0x2310 lock_acquire+0x9e/0x360 ? alloc_workqueue+0x378/0x450 cpus_read_lock+0x39/0xb0 ? alloc_workqueue+0x378/0x450 alloc_workqueue+0x378/0x450 ? rcu_read_lock_sched_held+0x52/0x80 __btrfs_alloc_workqueue+0x15d/0x200 btrfs_alloc_workqueue+0x51/0x160 scrub_workers_get+0x5a/0x170 btrfs_scrub_dev+0x18c/0x630 ? start_transaction+0xd1/0x5d0 btrfs_dev_replace_by_ioctl.cold.21+0x10a/0x1d4 btrfs_ioctl+0x2799/0x30a0 ? do_sigaction+0x102/0x250 ? lockdep_hardirqs_on_prepare+0xca/0x160 ? _raw_spin_unlock_irq+0x24/0x30 ? trace_hardirqs_on+0x1c/0xe0 ? _raw_spin_unlock_irq+0x24/0x30 ? do_sigaction+0x102/0x250 ? ksys_ioctl+0x83/0xc0 ksys_ioctl+0x83/0xc0 __x64_sys_ioctl+0x16/0x20 do_syscall_64+0x50/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xa9
This happens because we're allocating the scrub workqueues under the scrub and device list mutex, which brings in a whole host of other dependencies.
Because the work queue allocation is done with GFP_KERNEL, it can trigger reclaim, which can lead to a transaction commit, which in turns needs the device_list_mutex, it can lead to a deadlock. A different problem for which this fix is a solution.
Fix this by moving the actual allocation outside of the scrub lock, and then only take the lock once we're ready to actually assign them to the fs_info. We'll now have to cleanup the workqueues in a few more places, so I've added a helper to do the refcount dance to safely free the workqueues.
--- fs/btrfs/scrub.c | 122 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 70 insertions(+), 52 deletions(-)
fs/btrfs/scrub.c +70 -52
@@ -3783,50 +3783,84 @@ static noinline_for_stack int scrub_supereturn 0 ; } +static void scrub_workers_put (struct btrfs_fs_info *fs_info) +{ +if (refcount_dec_and_mutex_lock (&fs_info->scrub_workers_refcnt, + &fs_info->scrub_lock)) { +struct btrfs_workqueue *scrub_workers =NULL ; +struct btrfs_workqueue *scrub_wr_comp =NULL ; +struct btrfs_workqueue *scrub_parity =NULL ; + + scrub_workers = fs_info->scrub_workers; + scrub_wr_comp = fs_info->scrub_wr_completion_workers; + scrub_parity = fs_info->scrub_parity_workers; + + fs_info->scrub_workers =NULL ; + fs_info->scrub_wr_completion_workers =NULL ; + fs_info->scrub_parity_workers =NULL ; +mutex_unlock (&fs_info->scrub_lock); + +btrfs_destroy_workqueue (scrub_workers); +btrfs_destroy_workqueue (scrub_wr_comp); +btrfs_destroy_workqueue (scrub_parity); + } +} +/* * get a reference count on fs_info->scrub_workers. start worker if necessary */ static noinline_for_stack int scrub_workers_get(struct btrfs_fs_info *fs_info,int is_dev_replace) { +struct btrfs_workqueue *scrub_workers =NULL ; +struct btrfs_workqueue *scrub_wr_comp =NULL ; +struct btrfs_workqueue *scrub_parity =NULL ;unsigned int flags =WQ_FREEZABLE |WQ_UNBOUND ;int max_active = fs_info->thread_pool_size; +int ret = -ENOMEM ; -lockdep_assert_held (&fs_info->scrub_lock); +if (refcount_inc_not_zero (&fs_info->scrub_workers_refcnt)) +return 0 ; -if (refcount_read (&fs_info->scrub_workers_refcnt) ==0 ) { -ASSERT (fs_info->scrub_workers ==NULL ); - fs_info->scrub_workers =btrfs_alloc_workqueue (fs_info,"scrub" , - flags, is_dev_replace ?1 : max_active,4 ); -if (!fs_info->scrub_workers) - goto fail_scrub_workers; - -ASSERT (fs_info->scrub_wr_completion_workers ==NULL ); - fs_info->scrub_wr_completion_workers = -btrfs_alloc_workqueue (fs_info,"scrubwrc" , flags, - max_active,2 ); -if (!fs_info->scrub_wr_completion_workers) - goto fail_scrub_wr_completion_workers; + scrub_workers =btrfs_alloc_workqueue (fs_info,"scrub" , flags, + is_dev_replace ?1 : max_active,4 ); +if (!scrub_workers) + goto fail_scrub_workers; -ASSERT (fs_info->scrub_parity_workers ==NULL ); - fs_info->scrub_parity_workers = -btrfs_alloc_workqueue (fs_info,"scrubparity" , flags, + scrub_wr_comp =btrfs_alloc_workqueue (fs_info,"scrubwrc" , flags, max_active,2 ); -if (!fs_info->scrub_parity_workers) - goto fail_scrub_parity_workers; +if (!scrub_wr_comp) + goto fail_scrub_wr_completion_workers; + scrub_parity =btrfs_alloc_workqueue (fs_info,"scrubparity" , flags, + max_active,2 ); +if (!scrub_parity) + goto fail_scrub_parity_workers; + +mutex_lock (&fs_info->scrub_lock); +if (refcount_read (&fs_info->scrub_workers_refcnt) ==0 ) { +ASSERT (fs_info->scrub_workers ==NULL && + fs_info->scrub_wr_completion_workers ==NULL && + fs_info->scrub_parity_workers ==NULL ); + fs_info->scrub_workers = scrub_workers; + fs_info->scrub_wr_completion_workers = scrub_wr_comp; + fs_info->scrub_parity_workers = scrub_parity;refcount_set (&fs_info->scrub_workers_refcnt,1 ); - }else { -refcount_inc (&fs_info->scrub_workers_refcnt); +mutex_unlock (&fs_info->scrub_lock); +return 0 ; } -return 0 ; +/* Other thread raced in and created the workers for us */ +refcount_inc (&fs_info->scrub_workers_refcnt); +mutex_unlock (&fs_info->scrub_lock); + ret =0 ; +btrfs_destroy_workqueue (scrub_parity); fail_scrub_parity_workers: -btrfs_destroy_workqueue (fs_info->scrub_wr_completion_workers); +btrfs_destroy_workqueue (scrub_wr_comp); fail_scrub_wr_completion_workers: -btrfs_destroy_workqueue (fs_info->scrub_workers); +btrfs_destroy_workqueue (scrub_workers); fail_scrub_workers: -return -ENOMEM ; +return ret; } int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
@@ -3837,9 +3871,6 @@ int btrfs_scrub_dev(struct btrfs_fs_infoint ret;struct btrfs_device *dev;unsigned int nofs_flag; -struct btrfs_workqueue *scrub_workers =NULL ; -struct btrfs_workqueue *scrub_wr_comp =NULL ; -struct btrfs_workqueue *scrub_parity =NULL ;if (btrfs_fs_closing (fs_info))return -EAGAIN ;
@@ -3886,13 +3917,17 @@ int btrfs_scrub_dev(struct btrfs_fs_infoif (IS_ERR (sctx))return PTR_ERR (sctx); + ret =scrub_workers_get (fs_info, is_dev_replace); +if (ret) + goto out_free_ctx; +mutex_lock (&fs_info->fs_devices->device_list_mutex); dev =btrfs_find_device (fs_info->fs_devices, devid,NULL ,NULL , true);if (!dev || (test_bit (BTRFS_DEV_STATE_MISSING , &dev->dev_state) && !is_dev_replace)) {mutex_unlock (&fs_info->fs_devices->device_list_mutex); ret = -ENODEV ; - goto out_free_ctx; + goto out; } if (!is_dev_replace && !readonly &&
@@ -3901,7 +3936,7 @@ int btrfs_scrub_dev(struct btrfs_fs_infobtrfs_err_in_rcu (fs_info,"scrub: device %s is not writable" ,rcu_str_deref (dev->name)); ret = -EROFS ; - goto out_free_ctx; + goto out; }mutex_lock (&fs_info->scrub_lock);
@@ -3910,7 +3945,7 @@ int btrfs_scrub_dev(struct btrfs_fs_infomutex_unlock (&fs_info->scrub_lock);mutex_unlock (&fs_info->fs_devices->device_list_mutex); ret = -EIO ; - goto out_free_ctx; + goto out; }down_read (&fs_info->dev_replace.rwsem);
@@ -3921,17 +3956,10 @@ int btrfs_scrub_dev(struct btrfs_fs_infomutex_unlock (&fs_info->scrub_lock);mutex_unlock (&fs_info->fs_devices->device_list_mutex); ret = -EINPROGRESS ; - goto out_free_ctx; + goto out; }up_read (&fs_info->dev_replace.rwsem); - ret =scrub_workers_get (fs_info, is_dev_replace); -if (ret) { -mutex_unlock (&fs_info->scrub_lock); -mutex_unlock (&fs_info->fs_devices->device_list_mutex); - goto out_free_ctx; - } - sctx->readonly = readonly; dev->scrub_ctx = sctx;mutex_unlock (&fs_info->fs_devices->device_list_mutex);
@@ -3984,24 +4012,14 @@ int btrfs_scrub_dev(struct btrfs_fs_infomutex_lock (&fs_info->scrub_lock); dev->scrub_ctx =NULL ; -if (refcount_dec_and_test (&fs_info->scrub_workers_refcnt)) { - scrub_workers = fs_info->scrub_workers; - scrub_wr_comp = fs_info->scrub_wr_completion_workers; - scrub_parity = fs_info->scrub_parity_workers; - - fs_info->scrub_workers =NULL ; - fs_info->scrub_wr_completion_workers =NULL ; - fs_info->scrub_parity_workers =NULL ; - }mutex_unlock (&fs_info->scrub_lock); -btrfs_destroy_workqueue (scrub_workers); -btrfs_destroy_workqueue (scrub_wr_comp); -btrfs_destroy_workqueue (scrub_parity); +scrub_workers_put (fs_info);scrub_put_ctx (sctx);return ret; - +out: +scrub_workers_put (fs_info); out_free_ctx:scrub_free_ctx (sctx);
Greg Kroah-Hartman
maintainerPATCH 128/186 btrfs: set the correct lockdep class for new nodes
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit ad24466588ab7d7c879053c5afd919b0c555fec0 upstream.
When flipping over to the rw_semaphore I noticed I'd get a lockdep splat in replace_path(), which is weird because we're swapping the reloc root with the actual target root. Turns out this is because we're using the root->root_key.objectid as the root id for the newly allocated tree block when setting the lockdep class, however we need to be using the actual owner of this new block, which is saved in owner.
The affected path is through btrfs_copy_root as all other callers of btrfs_alloc_tree_block (which calls init_new_buffer) have root_objectid == root->root_key.objectid .
--- fs/btrfs/extent-tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/extent-tree.c +1 -1
@@ -4527,7 +4527,7 @@ btrfs_init_new_buffer(struct btrfs_transreturn ERR_PTR (-EUCLEAN ); } -btrfs_set_buffer_lockdep_class (root->root_key.objectid, buf, level); +btrfs_set_buffer_lockdep_class (owner, buf, level);btrfs_tree_lock (buf);btrfs_clean_tree_block (buf);clear_bit (EXTENT_BUFFER_STALE , &buf->bflags);
Greg Kroah-Hartman
maintainerPATCH 129/186 btrfs: set the lockdep class for log tree extent buffers
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit d3beaa253fd6fa40b8b18a216398e6e5376a9d21 upstream.
These are special extent buffers that get rewound in order to lookup the state of the tree at a specific point in time. As such they do not go through the normal initialization paths that set their lockdep class, so handle them appropriately when they are created and before they are locked.
--- fs/btrfs/ctree.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/btrfs/ctree.c +5 -1
@@ -1297,6 +1297,8 @@ tree_mod_log_rewind(struct btrfs_fs_infobtrfs_tree_read_unlock_blocking (eb);free_extent_buffer (eb); +btrfs_set_buffer_lockdep_class (btrfs_header_owner (eb_rewin), + eb_rewin,btrfs_header_level (eb_rewin));btrfs_tree_read_lock (eb_rewin);__tree_mod_log_rewind (fs_info, eb_rewin, time_seq, tm); WARN_ON(btrfs_header_nritems(eb_rewin) >
@@ -1370,7 +1372,6 @@ get_old_root(struct btrfs_root *root, u6if (!eb)return NULL ; -btrfs_tree_read_lock (eb);if (old_root) {btrfs_set_header_bytenr (eb, eb->start);btrfs_set_header_backref_rev (eb,BTRFS_MIXED_BACKREF_REV );
@@ -1378,6 +1379,9 @@ get_old_root(struct btrfs_root *root, u6btrfs_set_header_level (eb, old_root->level);btrfs_set_header_generation (eb, old_generation); } +btrfs_set_buffer_lockdep_class (btrfs_header_owner (eb), eb, +btrfs_header_level (eb)); +btrfs_tree_read_lock (eb);if (tm)__tree_mod_log_rewind (fs_info, eb, time_seq, tm);else
Greg Kroah-Hartman
maintainerPATCH 130/186 btrfs: block-group: fix free-space bitmap threshold
In reply to Greg Kroah-HartmanFrom: Marcos Paulo de Souza <[email protected]>
commit e3e39c72b99f93bbd0420d38c858e7c4a061bb63 upstream.
[BUG]
After commit 9afc66498a0b ("btrfs: block-group: refactor how we read one block group item"), cache->length is being assigned after calling btrfs_create_block_group_cache. This causes a problem since set_free_space_tree_thresholds calculates the free-space threshold to decide if the free-space tree should convert from extents to bitmaps.
The current code calls set_free_space_tree_thresholds with cache->length being 0, which then makes cache->bitmap_high_thresh zero. This implies the system will always use bitmap instead of extents, which is not desired if the block group is not fragmented.
This behavior can be seen by a test that expects to repair systems with FREE_SPACE_EXTENT and FREE_SPACE_BITMAP, but the current code only created FREE_SPACE_BITMAP.
[FIX]
Call set_free_space_tree_thresholds after setting cache->length. There is now a WARN_ON in set_free_space_tree_thresholds to help preventing the same mistake to happen again in the future.
--- fs/btrfs/block-group.c | 4 +++- fs/btrfs/free-space-tree.c | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-)
fs/btrfs/block-group.c +3 -1
@@ -1814,7 +1814,6 @@ static struct btrfs_block_group *btrfs_c cache->fs_info = fs_info; cache->full_stripe_len =btrfs_full_stripe_len (fs_info, start); -set_free_space_tree_thresholds (cache); cache->discard_index =BTRFS_DISCARD_INDEX_UNUSED ;
@@ -1928,6 +1927,8 @@ static int read_one_block_group(struct bif (ret <0 ) goto error; +set_free_space_tree_thresholds (cache); +if (need_clear) {/* * When we mount with old space cache, we need to
@@ -2148,6 +2149,7 @@ int btrfs_make_block_group(struct btrfs_return -ENOMEM ; cache->length = size; +set_free_space_tree_thresholds (cache); cache->used = bytes_used; cache->flags = type; cache->last_byte_to_unpin = (u64)-1 ;
fs/btrfs/free-space-tree.c +4 -0
@@ -22,6 +22,10 @@ void set_free_space_tree_thresholds(strusize_t bitmap_size;u64 num_bitmaps, total_bitmap_size; +if (WARN_ON (cache->length ==0 )) +btrfs_warn (cache->fs_info,"block group %llu length is zero" , + cache->start); +/* * We convert to bitmaps when the disk space required for using extents * exceeds that required for using bitmaps.
Greg Kroah-Hartman
maintainerPATCH 131/186 btrfs: tree-checker: fix the error message for transid error
In reply to Greg Kroah-HartmanFrom: Qu Wenruo <[email protected]>
commit f96d6960abbc52e26ad124e69e6815283d3e1674 upstream.
The error message for inode transid is the same as for inode generation, which makes us unable to detect the real problem.
--- fs/btrfs/tree-checker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/tree-checker.c +1 -1
@@ -984,7 +984,7 @@ static int check_inode_item(struct exten/* Note for ROOT_TREE_DIR_ITEM, mkfs could set its transid 0 */ if (btrfs_inode_transid (leaf, iitem) > super_gen +1 ) {inode_item_err (leaf, slot, -"invalid inode generation: has %llu expect [0, %llu]" , +"invalid inode transid: has %llu expect [0, %llu]" ,btrfs_inode_transid (leaf, iitem), super_gen +1 );return -EUCLEAN ; }
Greg Kroah-Hartman
maintainerPATCH 132/186 Bluetooth: Return NOTIFY_DONE for hci_suspend_notifier
In reply to Greg Kroah-HartmanFrom: Max Chou <[email protected]>
[ Upstream commit 24b065727ceba53cc5bec0e725672417154df24f ]
The original return is NOTIFY_STOP, but notifier_call_chain would stop the future call for register_pm_notifier even registered on other Kernel modules with the same priority which value is zero.
--- net/bluetooth/hci_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/hci_core.c +1 -1
@@ -3370,7 +3370,7 @@ static int hci_suspend_notifier(struct notifier_block *nb, unsigned long action,bt_dev_err (hdev,"Suspend notifier action (%lu) failed: %d" , action, ret); -return NOTIFY_STOP ; +return NOTIFY_DONE ; }/* Alloc HCI device */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 133/186 x86/mm/32: Bring back vmalloc faulting on x86_32
In reply to Greg Kroah-Hartman[ Upstream commit 4819e15f740ec884a50bdc431d7f1e7638b6f7d9 ]
One can not simply remove vmalloc faulting on x86-32. Upstream
commit: 7f0a002b5a21 ("x86/mm: remove vmalloc faulting")removed it on x86 alltogether because previously the arch_sync_kernel_mappings() interface was introduced. This interface added synchronization of vmalloc/ioremap page-table updates to all page-tables in the system at creation time and was thought to make vmalloc faulting obsolete.
But that assumption was incredibly naive.
It turned out that there is a race window between the time the vmalloc or ioremap code establishes a mapping and the time it synchronizes this change to other page-tables in the system.
During this race window another CPU or thread can establish a vmalloc mapping which uses the same intermediate page-table entries (e.g. PMD or PUD) and does no synchronization in the end, because it found all necessary mappings already present in the kernel reference page-table.
But when these intermediate page-table entries are not yet synchronized, the other CPU or thread will continue with a vmalloc address that is not yet mapped in the page-table it currently uses, causing an unhandled page fault and oops like below:
BUG: unable to handle page fault for address: fe80c000 #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page *pde = 33183067 *pte = a8648163 Oops: 0002 [#1] SMP CPU: 1 PID: 13514 Comm: cve-2017-17053 Tainted: G ... Call Trace: ldt_dup_context+0x66/0x80 dup_mm+0x2b3/0x480 copy_process+0x133b/0x15c0 _do_fork+0x94/0x3e0 __ia32_sys_clone+0x67/0x80 __do_fast_syscall_32+0x3f/0x70 do_fast_syscall_32+0x29/0x60 do_SYSENTER_32+0x15/0x20 entry_SYSENTER_32+0x9f/0xf2 EIP: 0xb7eef549
So the arch_sync_kernel_mappings() interface is racy, but removing it would mean to re-introduce the vmalloc_sync_all() interface, which is even more awful. Keep arch_sync_kernel_mappings() in place and catch the race condition in the page-fault handler instead.
Do a partial revert of above commit to get vmalloc faulting on x86-32 back in place.
--- arch/x86/include/asm/switch_to.h | 23 ++++++ arch/x86/kernel/setup_percpu.c | 6 +- arch/x86/mm/fault.c | 134 +++++++++++++++++++++++++++++++ arch/x86/mm/pti.c | 8 +- arch/x86/mm/tlb.c | 37 +++++++++ 5 files changed, 204 insertions(+), 4 deletions(-)
arch/x86/include/asm/switch_to.h +23 -0
@@ -12,6 +12,27 @@ struct task_struct *__switch_to_asm(struct task_struct *prev, __visible struct task_struct *__switch_to(struct task_struct *prev,struct task_struct *next); +/* This runs runs on the previous thread's stack. */ +static inline void prepare_switch_to (struct task_struct *next) +{ +#ifdef CONFIG_VMAP_STACK +/* +* If we switch to a stack that has a top-level paging entry +* that is not present in the current mm, the resulting #PF will +* will be promoted to a double-fault and we'll panic. Probe +* the new stack now so that vmalloc_fault can fix up the page +* tables if needed. This can only happen if we use a stack +* in vmap space. +* +* We assume that the stack is aligned so that it never spans +* more than one top-level paging entry. +* +* To minimize cache pollution, just follow the stack pointer. +*/ +READ_ONCE (*(unsigned char *)next->thread.sp); +#endif +} + asmlinkage void ret_from_fork(void);/*
@@ -46,6 +67,8 @@ struct fork_frame {#define switch_to (prev, next, last) \ do { \ + prepare_switch_to(next); \ + \ ((last) = __switch_to_asm((prev), (next))); \ } while (0)
arch/x86/kernel/setup_percpu.c +3 -3
@@ -287,9 +287,9 @@ void __init setup_per_cpu_areas(void)/* * Sync back kernel address range again. We already did this in * setup_arch(), but percpu data also needs to be available in -* the smpboot asm and arch_sync_kernel_mappings() doesn't sync to -* swapper_pg_dir on 32-bit. The per-cpu mappings need to be available -* there too. +* the smpboot asm. We can't reliably pick up percpu mappings +* using vmalloc_fault(), because exception dispatch needs +* percpu data. * * FIXME: Can the later sync in setup_cpu_entry_areas() replace * this call?
arch/x86/mm/fault.c +134 -0
152 lines not on this page · raw message
arch/x86/mm/pti.c +7 -1
@@ -447,7 +447,13 @@ static void __init pti_clone_user_shared(void)* the sp1 and sp2 slots. * * This is done for all possible CPUs during boot to ensure -* that it's propagated to all mms. +* that it's propagated to all mms. If we were to add one of +* these mappings during CPU hotplug, we would need to take +* some measure to make sure that every mm that subsequently +* ran on that CPU would have the relevant PGD entry in its +* pagetables. The usual vmalloc_fault() mechanism would not +* work for page faults taken in entry_SYSCALL_64 before RSP +* is set up. */ unsigned long va = (unsigned long )&per_cpu (cpu_tss_rw, cpu);
arch/x86/mm/tlb.c +37 -0
@@ -317,6 +317,34 @@ void switch_mm(struct mm_struct *prev, struct mm_struct *next,local_irq_restore (flags); } +static void sync_current_stack_to_mm (struct mm_struct *mm) +{ +unsigned long sp = current_stack_pointer; +pgd_t *pgd =pgd_offset (mm, sp); + +if (pgtable_l5_enabled ()) { +if (unlikely (pgd_none (*pgd))) { +pgd_t *pgd_ref =pgd_offset_k (sp); + +set_pgd (pgd, *pgd_ref); + } + }else { +/* +* "pgd" is faked. The top level entries are "p4d"s, so sync +* the p4d. This compiles to approximately the same code as +* the 5-level case. +*/ +p4d_t *p4d =p4d_offset (pgd, sp); + +if (unlikely (p4d_none (*p4d))) { +pgd_t *pgd_ref =pgd_offset_k (sp); +p4d_t *p4d_ref =p4d_offset (pgd_ref, sp); + +set_p4d (p4d, *p4d_ref); + } + } +} +static inline unsigned long mm_mangle_tif_spec_ib (struct task_struct *next) {unsigned long next_tif =task_thread_info (next)->flags;
@@ -525,6 +553,15 @@ void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next,*/ cond_ibpb (tsk); +if (IS_ENABLED (CONFIG_VMAP_STACK )) { +/* +* If our current stack is in vmalloc space and isn't +* mapped in the new pgd, we'll double-fault. Forcibly +* map it. +*/ +sync_current_stack_to_mm (next); + } +/* * Stop remote flushes for the previous mm. * Skip kernel threads; we never send init_mm TLB flushing IPIs,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 134/186 Revert "ALSA: hda: Add support for Loongson 7A1000 controller"
In reply to Greg Kroah-HartmanFrom: Tiezhu Yang <[email protected]>
commit eed8f88b109aa927fbf0d0c80ff9f8d00444ca7f upstream.
This reverts commit 61eee4a7fc40 ("ALSA: hda: Add support for Loongson 7A1000 controller") to fix the following error on the Loongson LS7A platform:
rcu: INFO: rcu_preempt self-detected stall on CPU <SNIP> NMI backtrace for cpu 0 CPU: 0 PID: 68 Comm: kworker/0:2 Not tainted 5.8.0+ #3 Hardware name: , BIOS Workqueue: events azx_probe_work [snd_hda_intel] <SNIP> Call Trace: [<ffffffff80211a64>] show_stack+0x9c/0x130 [<ffffffff8065a740>] dump_stack+0xb0/0xf0 [<ffffffff80665774>] nmi_cpu_backtrace+0x134/0x140 [<ffffffff80665910>] nmi_trigger_cpumask_backtrace+0x190/0x200 [<ffffffff802b1abc>] rcu_dump_cpu_stacks+0x12c/0x190 [<ffffffff802b08cc>] rcu_sched_clock_irq+0xa2c/0xfc8 [<ffffffff802b91d4>] update_process_times+0x2c/0xb8 [<ffffffff802cad80>] tick_sched_timer+0x40/0xb8 [<ffffffff802ba5f0>] __hrtimer_run_queues+0x118/0x1d0 [<ffffffff802bab74>] hrtimer_interrupt+0x12c/0x2d8 [<ffffffff8021547c>] c0_compare_interrupt+0x74/0xa0 [<ffffffff80296bd0>] __handle_irq_event_percpu+0xa8/0x198 [<ffffffff80296cf0>] handle_irq_event_percpu+0x30/0x90 [<ffffffff8029d958>] handle_percpu_irq+0x88/0xb8 [<ffffffff80296124>] generic_handle_irq+0x44/0x60 [<ffffffff80b3cfd0>] do_IRQ+0x18/0x28 [<ffffffff8067ace4>] plat_irq_dispatch+0x64/0x100 [<ffffffff80209a20>] handle_int+0x140/0x14c [<ffffffff802402e8>] irq_exit+0xf8/0x100
Because AZX_DRIVER_GENERIC can not work well for Loongson LS7A HDA controller, it needs some workarounds which are not merged into the upstream kernel at this time, so it should revert this patch now.
--- sound/pci/hda/hda_intel.c | 2 -- 1 file changed, 2 deletions(-)
sound/pci/hda/hda_intel.c +0 -2
@@ -2747,8 +2747,6 @@ static const struct pci_device_id azx_id .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_HDMI },/* Zhaoxin */ { PCI_DEVICE(0x1d17, 0x3288), .driver_data = AZX_DRIVER_ZHAOXIN }, - /* Loongson */ - { PCI_DEVICE(0x0014, 0x7a07), .driver_data = AZX_DRIVER_GENERIC }, { 0, } };MODULE_DEVICE_TABLE (pci, azx_ids);
Greg Kroah-Hartman
maintainerPATCH 135/186 ALSA: ca0106: fix error code handling
In reply to Greg Kroah-HartmanFrom: Tong Zhang <[email protected]>
commit ee0761d1d8222bcc5c86bf10849dc86cf008557c upstream.
snd_ca0106_spi_write() returns 1 on error, snd_ca0106_pcm_power_dac() is returning the error code directly, and the caller is expecting an negative error code
--- sound/pci/ca0106/ca0106_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/ca0106/ca0106_main.c +2 -1
@@ -537,7 +537,8 @@ static int snd_ca0106_pcm_power_dac(struelse /* Power down */ chip->spi_dac_reg[reg] |= bit; -return snd_ca0106_spi_write (chip, chip->spi_dac_reg[reg]); +if (snd_ca0106_spi_write (chip, chip->spi_dac_reg[reg]) !=0 ) +return -ENXIO ; }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 136/186 ALSA: usb-audio: Add basic capture support for Pioneer DJ DJM-250MK2
In reply to Greg Kroah-HartmanFrom: František Kučera <[email protected]>
commit 14335d8b9e1a2bf006f9d969a103f9731cabb210 upstream.
This patch extends support for DJM-250MK2 and allows recording. However, DVS is not possible yet (see the comment in code).
--- sound/usb/pcm.c | 1 sound/usb/quirks-table.h | 60 +++++++++++++++++++++++++++++++++++++++++------ sound/usb/quirks.c | 1 3 files changed, 55 insertions(+), 7 deletions(-)
sound/usb/pcm.c +1 -0
@@ -374,6 +374,7 @@ static int set_sync_ep_implicit_fb_quirk ifnum =2 ; goto add_sync_ep_from_ifnum;case USB_ID (0x2b73 ,0x000a ):/* Pioneer DJ DJM-900NXS2 */ +case USB_ID (0x2b73 ,0x0017 ):/* Pioneer DJ DJM-250MK2 */ ep =0x82 ; ifnum =0 ; goto add_sync_ep_from_ifnum;
sound/usb/quirks-table.h +53 -7
73 lines not on this page · raw message
sound/usb/quirks.c +1 -0
@@ -1493,6 +1493,7 @@ void snd_usb_set_format_quirk(struct sndset_format_emu_quirk (subs, fmt);break ;case USB_ID (0x2b73 ,0x000a ):/* Pioneer DJ DJM-900NXS2 */ +case USB_ID (0x2b73 ,0x0017 ):/* Pioneer DJ DJM-250MK2 */ pioneer_djm_set_format_quirk (subs);break ;case USB_ID (0x534d ,0x2109 ):/* MacroSilicon MS2109 */
Greg Kroah-Hartman
maintainerPATCH 137/186 ALSA: usb-audio: Add implicit feedback quirk for UR22C
In reply to Greg Kroah-HartmanFrom: Joshua Sivec <[email protected]>
commit 7c5b892e0871655fea3294ffac6fa3cc3400b60d upstream.
This uses the same quirk as the Motu and SSL2 devices. Tested on the UR22C.
Fixes bug 208851.
--- sound/usb/pcm.c | 1 + 1 file changed, 1 insertion(+)
sound/usb/pcm.c +1 -0
@@ -369,6 +369,7 @@ static int set_sync_ep_implicit_fb_quirkcase USB_ID (0x07fd ,0x0008 ):/* MOTU M Series */ case USB_ID (0x31e9 ,0x0001 ):/* Solid State Logic SSL2 */ case USB_ID (0x31e9 ,0x0002 ):/* Solid State Logic SSL2+ */ +case USB_ID (0x0499 ,0x172f ):/* Steinberg UR22C */ case USB_ID (0x0d9a ,0x00df ):/* RTX6001 */ ep =0x81 ; ifnum =2 ;
Greg Kroah-Hartman
maintainerPATCH 138/186 ALSA: pcm: oss: Remove superfluous WARN_ON() for mulaw sanity check
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 949a1ebe8cea7b342085cb6a4946b498306b9493 upstream.
The PCM OSS mulaw plugin has a check of the format of the counter part whether it's a linear format. The check is with snd_BUG_ON() that emits WARN_ON() when the debug config is set, and it confuses syzkaller as if it were a serious issue. Let's drop snd_BUG_ON() for avoiding that.
While we're at it, correct the error code to a more suitable, EINVAL.
--- sound/core/oss/mulaw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/core/oss/mulaw.c +2 -2
@@ -329,8 +329,8 @@ int snd_pcm_plugin_build_mulaw(struct snsnd_BUG ();return -EINVAL ; } -if (snd_BUG_ON (!snd_pcm_format_linear (format->format))) -return -ENXIO ; +if (!snd_pcm_format_linear (format->format)) +return -EINVAL ; err = snd_pcm_plugin_build(plug, "Mu-Law<->linear conversion", src_format, dst_format,
Greg Kroah-Hartman
maintainerPATCH 139/186 ALSA: hda/hdmi: always check pin power status in i915 pin fixup
In reply to Greg Kroah-HartmanFrom: Kai Vehmanen <[email protected]>
commit 858e0ad9301d1270c02b5aca97537d2d6ee9dd68 upstream.
When system is suspended with active audio playback to HDMI/DP, two alternative sequences can happen at resume:
a) monitor is detected first and ALSA prepare follows normal stream setup sequence, or
b) ALSA prepare is called first, but monitor is not yet detected, so PCM is restarted without a pin,
In case of (b), on i915 systems, haswell_verify_D0() is not called at resume and the pin power state may be incorrect. Result is lack of audio after resume with no error reported back to user-space.
Fix the problem by always verifying converter and pin state in the i915_pin_cvt_fixup().
--- sound/pci/hda/patch_hdmi.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_hdmi.c +1 -0
@@ -2737,6 +2737,7 @@ static void i915_pin_cvt_fixup(struct hd hda_nid_t cvt_nid) {if (per_pin) { +haswell_verify_D0 (codec, per_pin->cvt_nid, per_pin->pin_nid);snd_hda_set_dev_select (codec, per_pin->pin_nid, per_pin->dev_id);intel_verify_pin_cvt_connect (codec, per_pin);
Greg Kroah-Hartman
maintainerPATCH 140/186 ALSA: firewire-digi00x: exclude Avid Adrenaline from detection
In reply to Greg Kroah-HartmanFrom: Takashi Sakamoto <[email protected]>
commit acd46a6b6de88569654567810acad2b0a0a25cea upstream.
Avid Adrenaline is reported that ALSA firewire-digi00x driver is bound to. However, as long as he investigated, the design of this model is hardly similar to the one of Digi 00x family. It's better to exclude the model from modalias of ALSA firewire-digi00x driver.
This commit changes device entries so that the model is excluded.
$ python3 crpp < ~/git/am-config-rom/misc/avid-adrenaline.img
ROM header and bus information block
-----------------------------------------------------------------
400 04203a9c bus_info_length 4, crc_length 32, crc 15004
404 31333934 bus_name "1394"
408 e064a002 irmc 1, cmc 1, isc 1, bmc 0, cyc_clk_acc 100, max_rec 10 (2048)
40c 00a07e01 company_id 00a07e |
410 00085257 device_id 0100085257 | EUI-64 00a07e0100085257 root directory
-----------------------------------------------------------------
414 0005d08c directory_length 5, crc 53388
418 0300a07e vendor
41c 8100000c --> descriptor leaf at 44c
420 0c008380 node capabilities
424 8d000002 --> eui-64 leaf at 42c
428 d1000004 --> unit directory at 438 eui-64 leaf at 42c
-----------------------------------------------------------------
42c 0002410f leaf_length 2, crc 16655
430 00a07e01 company_id 00a07e |
434 00085257 device_id 0100085257 | EUI-64 00a07e0100085257 unit directory at 438
-----------------------------------------------------------------
438 0004d6c9 directory_length 4, crc 54985 43c 1200a02d specifier id: 1394 TA 440 13014001 version: Vender Unique and AV/C 444 17000001 model 448 81000009 --> descriptor leaf at 46c
descriptor leaf at 44c
-----------------------------------------------------------------
44c 00077205 leaf_length 7, crc 29189 450 00000000 textual descriptor 454 00000000 minimal ASCII 458 41766964 "Avid" 45c 20546563 " Tec" 460 686e6f6c "hnol" 464 6f677900 "ogy" 468 00000000
descriptor leaf at 46c
-----------------------------------------------------------------
46c 000599a5 leaf_length 5, crc 39333 470 00000000 textual descriptor 474 00000000 minimal ASCII 478 41647265 "Adre" 47c 6e616c69 "nali" 480 6e650000 "ne"
--- sound/firewire/digi00x/digi00x.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/firewire/digi00x/digi00x.c +5 -0
@@ -14,6 +14,7 @@ MODULE_LICENSE("GPL v2");#define VENDOR_DIGIDESIGN 0x00a07e#define MODEL_CONSOLE 0x000001#define MODEL_RACK 0x000002 +#define SPEC_VERSION 0x000001static int name_card (struct snd_dg00x *dg00x) {
@@ -175,14 +176,18 @@ static const struct ieee1394_device_id s/* Both of 002/003 use the same ID. */ { .match_flags = IEEE1394_MATCH_VENDOR_ID | + IEEE1394_MATCH_VERSION | IEEE1394_MATCH_MODEL_ID, .vendor_id = VENDOR_DIGIDESIGN, + .version = SPEC_VERSION, .model_id = MODEL_CONSOLE, }, { .match_flags = IEEE1394_MATCH_VENDOR_ID | + IEEE1394_MATCH_VERSION | IEEE1394_MATCH_MODEL_ID, .vendor_id = VENDOR_DIGIDESIGN, + .version = SPEC_VERSION, .model_id = MODEL_RACK, }, {}
Greg Kroah-Hartman
maintainerPATCH 141/186 ALSA: hda - Fix silent audio output and corrupted input on MSI X570-A PRO
In reply to Greg Kroah-HartmanFrom: Dan Crawford <[email protected]>
commit 15cbff3fbbc631952c346744f862fb294504b5e2 upstream.
Following Christian Lachner's patch for Gigabyte X570-based motherboards, also patch the MSI X570-A PRO motherboard; the ALC1220 codec requires the same workaround for Clevo laptops to enforce the DAC/mixer connection path. Set up a quirk entry for that.
I suspect most if all X570 motherboards will require similar patches.
[ The entries reordered in the SSID order -- tiwai ]
Related buglink: https://bugzilla.kernel.org/show_bug.cgi?id=205275
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -2467,6 +2467,7 @@ static const struct snd_pci_quirk alc882SND_PCI_QUIRK (0x1462 ,0x1276 ,"MSI-GL73" ,ALC1220_FIXUP_CLEVO_P950 ),SND_PCI_QUIRK (0x1462 ,0x1293 ,"MSI-GP65" ,ALC1220_FIXUP_CLEVO_P950 ),SND_PCI_QUIRK (0x1462 ,0x7350 ,"MSI-7350" ,ALC889_FIXUP_CD ), +SND_PCI_QUIRK (0x1462 ,0x9c37 ,"MSI X570-A PRO" ,ALC1220_FIXUP_CLEVO_P950 ),SND_PCI_QUIRK (0x1462 ,0xda57 ,"MSI Z270-Gaming" ,ALC1220_FIXUP_GB_DUAL_CODECS ),SND_PCI_QUIRK_VENDOR (0x1462 ,"MSI" ,ALC882_FIXUP_GPIO3 ), SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
Greg Kroah-Hartman
maintainerPATCH 142/186 ALSA; firewire-tascam: exclude Tascam FE-8 from detection
In reply to Greg Kroah-HartmanFrom: Takashi Sakamoto <[email protected]>
commit 0bd8bce897b6697bbc286b8ba473aa0705fe394b upstream.
Tascam FE-8 is known to support communication by asynchronous transaction only. The support can be implemented in userspace application and snd-firewire-ctl-services project has the support. However, ALSA firewire-tascam driver is bound to the model.
This commit changes device entries so that the model is excluded. In a commit 53b3ffee7885 ("ALSA: firewire-tascam: change device probing processing"), I addressed to the concern that version field in configuration differs depending on installed firmware. However, as long as I checked, the version number is fixed. It's safe to return version number back to modalias.
--- sound/firewire/tascam/tascam.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-)
sound/firewire/tascam/tascam.c +29 -4
@@ -39,9 +39,6 @@ static const struct snd_tscm_spec model_ .midi_capture_ports = 2, .midi_playback_ports = 4, }, -// This kernel module doesn't support FE-8 because the most of features -// can be implemented in userspace without any specific support of this -// module. };static int identify_model (struct snd_tscm *tscm)
@@ -211,11 +208,39 @@ static void snd_tscm_remove(struct fw_un }static const struct ieee1394_device_id snd_tscm_id_table[] = { +// Tascam, FW-1884. + { + .match_flags =IEEE1394_MATCH_VENDOR_ID | +IEEE1394_MATCH_SPECIFIER_ID | +IEEE1394_MATCH_VERSION , + .vendor_id =0x00022e , + .specifier_id =0x00022e , + .version =0x800000 , + }, +// Tascam, FE-8 (.version = 0x800001) +// This kernel module doesn't support FE-8 because the most of features +// can be implemented in userspace without any specific support of this +// module. +// +// .version = 0x800002 is unknown. +// +// Tascam, FW-1082. + { + .match_flags =IEEE1394_MATCH_VENDOR_ID | +IEEE1394_MATCH_SPECIFIER_ID | +IEEE1394_MATCH_VERSION , + .vendor_id =0x00022e , + .specifier_id =0x00022e , + .version =0x800003 , + }, +// Tascam, FW-1804. { .match_flags =IEEE1394_MATCH_VENDOR_ID | -IEEE1394_MATCH_SPECIFIER_ID , +IEEE1394_MATCH_SPECIFIER_ID | +IEEE1394_MATCH_VERSION , .vendor_id =0x00022e , .specifier_id =0x00022e , + .version =0x800004 , }, {} };
Greg Kroah-Hartman
maintainerPATCH 143/186 ALSA: hda/realtek: Add quirk for Samsung Galaxy Book Ion NT950XCJ-X716A
In reply to Greg Kroah-HartmanFrom: Adrien Crivelli <[email protected]>
commit 8bcea6cb2cbc1f749e574954569323dec5e2920e upstream.
The Galaxy Book Ion NT950XCJ-X716A (15 inches) uses the same ALC298 codec as other Samsung laptops which have the no headphone sound bug. I confirmed on my own hardware that this fixes the bug.
This also correct the model name for the 13 inches version. It was incorrectly referenced as NT950XCJ-X716A in commit e17f02d05. But it should have been NP930XCJ-K01US.
--- sound/pci/hda/patch_realtek.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/hda/patch_realtek.c +2 -1
@@ -7708,7 +7708,8 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x144d ,0xc169 ,"Samsung Notebook 9 Pen (NP930SBE-K01US)" ,ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET ),SND_PCI_QUIRK (0x144d ,0xc176 ,"Samsung Notebook 9 Pro (NP930MBE-K04US)" ,ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET ),SND_PCI_QUIRK (0x144d ,0xc189 ,"Samsung Galaxy Flex Book (NT950QCG-X716)" ,ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET ), -SND_PCI_QUIRK (0x144d ,0xc18a ,"Samsung Galaxy Book Ion (NT950XCJ-X716A)" ,ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET ), +SND_PCI_QUIRK (0x144d ,0xc18a ,"Samsung Galaxy Book Ion (NP930XCJ-K01US)" ,ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET ), +SND_PCI_QUIRK (0x144d ,0xc830 ,"Samsung Galaxy Book Ion (NT950XCJ-X716A)" ,ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET ),SND_PCI_QUIRK (0x144d ,0xc740 ,"Samsung Ativ book 8 (NP870Z5G)" ,ALC269_FIXUP_ATIV_BOOK_8 ),SND_PCI_QUIRK (0x144d ,0xc812 ,"Samsung Notebook Pen S (NT950SBE-X58)" ,ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET ), SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
Greg Kroah-Hartman
maintainerPATCH 144/186 ALSA: hda/realtek - Improved routing for Thinkpad X1 7th/8th Gen
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 6a6660d049f88b89fd9a4b9db3581b245f7782fa upstream.
There've been quite a few regression reports about the lowered volume (reduced to ca 65% from the previous level) on Lenovo Thinkpad X1 after the commit d2cd795c4ece ("ALSA: hda - fixup for the bass speaker on Lenovo Carbon X1 7th gen"). Although the commit itself does the right thing from HD-audio POV in order to have a volume control for bass speakers, it seems that the machine has some secret recipe under the hood.
Through experiments, Benjamin Poirier found out that the following routing gives the best result:
* DAC1 (NID 0x02) -> Speaker pin (NID 0x14)
* DAC2 (NID 0x03) -> Shared by both Bass Speaker pin (NID 0x17) &
Headphone pin (0x21)
* DAC3 (NID 0x06) -> Unused
DAC1 seems to have some equalizer internally applied, and you'd get again the output in a bad quality if you connect this to the headphone pin. Hence the headphone is connected to DAC2, which is now shared with the bass speaker pin. DAC3 has no volume amp, hence it's not connected at all.
For achieving the routing above, this patch introduced a couple of workarounds:
* The connection list of bass speaker pin (NID 0x17) is reduced not to include DAC3 (NID 0x06)
* Pass preferred_pairs array to specify the fixed connection
Here, both workarounds are needed because the generic parser prefers the individual DAC assignment over others.
When the routing above is applied, the generic parser creates the two volume controls "Front" and "Bass Speaker". Since we have only two DACs for three output pins, those are not fully controlling each output individually, and it would confuse PulseAudio. For avoiding the pitfall, in this patch, we rename those volume controls to some unique ones ("DAC1" and "DAC2"). Then PulseAudio ignore them and concentrate only on the still good-working "Master" volume control. If a user still wants to control each DAC volume, they can still change manually via "DAC1" and "DAC2" volume controls.
--- sound/pci/hda/patch_realtek.c | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-)
sound/pci/hda/patch_realtek.c +41 -1
@@ -5880,6 +5880,39 @@ static void alc275_fixup_gpio4_off(struc } } +/* Quirk for Thinkpad X1 7th and 8th Gen +* The following fixed routing needed +* DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly +* DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC +* DAC3 (NID 0x06) -> Unused, due to the lack of volume amp +*/ +static void alc285_fixup_thinkpad_x1_gen7 (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +static const hda_nid_t conn[] = {0x02 ,0x03 };/* exclude 0x06 */ +static const hda_nid_t preferred_pairs[] = { +0x14 ,0x02 ,0x17 ,0x03 ,0x21 ,0x03 ,0 + }; +struct alc_spec *spec = codec->spec; + +switch (action) { +case HDA_FIXUP_ACT_PRE_PROBE : +snd_hda_override_conn_list (codec,0x17 ,ARRAY_SIZE (conn), conn); + spec->gen.preferred_dacs = preferred_pairs; +break ; +case HDA_FIXUP_ACT_BUILD : +/* The generic parser creates somewhat unintuitive volume ctls +* with the fixed routing above, and the shared DAC2 may be +* confusing for PA. +* Rename those to unique names so that PA doesn't touch them +* and use only Master volume. +*/ +rename_ctl (codec,"Front Playback Volume" ,"DAC1 Playback Volume" ); +rename_ctl (codec,"Bass Speaker Playback Volume" ,"DAC2 Playback Volume" ); +break ; + } +} +static void alc233_alc662_fixup_lenovo_dual_codecs (struct hda_codec *codec,const struct hda_fixup *fix,int action)
@@ -6148,6 +6181,7 @@ enum {ALC289_FIXUP_DUAL_SPK ,ALC294_FIXUP_SPK2_TO_DAC1 ,ALC294_FIXUP_ASUS_DUAL_SPK , +ALC285_FIXUP_THINKPAD_X1_GEN7 ,ALC285_FIXUP_THINKPAD_HEADSET_JACK ,ALC294_FIXUP_ASUS_HPE , ALC294_FIXUP_ASUS_COEF_1B,
@@ -7293,11 +7327,17 @@ static const struct hda_fixup alc269_fix .chained = true, .chain_id =ALC294_FIXUP_SPK2_TO_DAC1 }, + [ALC285_FIXUP_THINKPAD_X1_GEN7] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc285_fixup_thinkpad_x1_gen7, + .chained = true, + .chain_id =ALC269_FIXUP_THINKPAD_ACPI + }, [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = { .type = HDA_FIXUP_FUNC, .v.func = alc_fixup_headset_jack, .chained = true, - .chain_id =ALC285_FIXUP_SPEAKER2_TO_DAC1 + .chain_id =ALC285_FIXUP_THINKPAD_X1_GEN7 }, [ALC294_FIXUP_ASUS_HPE] = { .type = HDA_FIXUP_VERBS,
Greg Kroah-Hartman
maintainerPATCH 145/186 arm64: dts: mt7622: add reset node for mmc device
In reply to Greg Kroah-HartmanFrom: Wenbin Mei <[email protected]>
commit d6f6cbeee4e5ee6976792851e0461c19f1ede864 upstream.
This commit adds reset node for mmc device.
--- arch/arm64/boot/dts/mediatek/mt7622.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/mediatek/mt7622.dtsi +2 -0
@@ -686,6 +686,8 @@ clocks = <&pericfg CLK_PERI_MSDC30_0_PD>, <&topckgen CLK_TOP_MSDC50_0_SEL>; clock-names = "source", "hclk"; + resets = <&pericfg MT7622_PERI_MSDC0_SW_RST>; + reset-names = "hrst"; status = "disabled"; };
Greg Kroah-Hartman
maintainerPATCH 146/186 mmc: mediatek: add optional module reset property
In reply to Greg Kroah-HartmanFrom: Wenbin Mei <[email protected]>
commit 855d388df217989fbf1f18c781ae6490dbb48e86 upstream.
This patch fixs eMMC-Access on mt7622/Bpi-64. Before we got these Errors on mounting eMMC ion R64:
[ 48.664925] blk_update_request: I/O error, dev mmcblk0, sector 204800 op 0x1:(WRITE) flags 0x800 phys_seg 1 prio class 0 [ 48.676019] Buffer I/O error on dev mmcblk0p1, logical block 0, lost sync page write
This patch adds a optional reset management for msdc. Sometimes the bootloader does not bring msdc register to default state, so need reset the msdc controller.
--- drivers/mmc/host/mtk-sd.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/mmc/host/mtk-sd.c +13 -0
@@ -22,6 +22,7 @@#include <linux/slab.h> #include <linux/spinlock.h> #include <linux/interrupt.h> +#include <linux/reset.h> #include <linux/mmc/card.h> #include <linux/mmc/core.h>
@@ -414,6 +415,7 @@ struct msdc_host {struct pinctrl_state *pins_uhs;struct delayed_work req_timeout;int irq;/* host interrupt */ +struct reset_control *reset;struct clk *src_clk;/* msdc source clock */ struct clk *h_clk;/* msdc h_clk */
@@ -1516,6 +1518,12 @@ static void msdc_init_hw(struct msdc_hosu32 val;u32 tune_reg = host->dev_comp->pad_tune_reg; +if (host->reset) { +reset_control_assert (host->reset); +usleep_range (10 ,50 ); +reset_control_deassert (host->reset); + } +/* Configure to MMC/SD mode, clock free running */ sdr_set_bits (host->base +MSDC_CFG ,MSDC_CFG_MODE |MSDC_CFG_CKPDN );
@@ -2273,6 +2281,11 @@ static int msdc_drv_probe(struct platforif (IS_ERR (host->src_clk_cg)) host->src_clk_cg =NULL ; + host->reset =devm_reset_control_get_optional_exclusive (&pdev->dev, +"hrst" ); +if (IS_ERR (host->reset)) +return PTR_ERR (host->reset); + host->irq =platform_get_irq (pdev,0 );if (host->irq <0 ) { ret = -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 147/186 mmc: dt-bindings: Add resets/reset-names for Mediatek MMC bindings
In reply to Greg Kroah-HartmanFrom: Wenbin Mei <[email protected]>
commit 65557383191de46611dd3d6b639cbcfbade43c4a upstream.
Add description for resets/reset-names.
--- Documentation/devicetree/bindings/mmc/mtk-sd.txt | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/mmc/mtk-sd.txt +2 -0
@@ -49,6 +49,8 @@ Optional properties: error caused by stop clock(fifo full) Valid range = [0:0x7]. if not present, default value is 0. applied to compatible "mediatek,mt2701-mmc". +- resets: Phandle and reset specifier pair to softreset line of MSDC IP. +- reset-names: Should be "hrst". Examples: mmc0: mmc@11230000 {
Greg Kroah-Hartman
maintainerPATCH 148/186 mmc: sdhci-pci: Fix SDHCI_RESET_ALL for CQHCI for Intel GLK-based controllers
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
commit df57d73276b863af1debc48546b0e59e44998a55 upstream.
For Intel controllers, SDHCI_RESET_ALL resets also CQHCI registers. Normally, SDHCI_RESET_ALL is not used while CQHCI is enabled, but that can happen on the error path. e.g. if mmc_cqe_recovery() fails, mmc_blk_reset() is called which, for a eMMC that does not support HW Reset, will cycle the bus power and the driver will perform SDHCI_RESET_ALL.
So whenever performing SDHCI_RESET_ALL ensure CQHCI is deactivated. That will force the driver to reinitialize CQHCI when it is next used.
A similar change was done already for sdhci-msm, and other drivers using CQHCI might benefit from a similar change, if they also have CQHCI reset by SDHCI_RESET_ALL.
--- drivers/mmc/host/sdhci-pci-core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-pci-core.c +9 -1
@@ -232,6 +232,14 @@ static void sdhci_pci_dumpregs(struct mmsdhci_dumpregs (mmc_priv (mmc)); } +static void sdhci_cqhci_reset (struct sdhci_host *host,u8 mask) +{ +if ((host->mmc->caps2 &MMC_CAP2_CQE ) && (mask &SDHCI_RESET_ALL ) && + host->mmc->cqe_private) +cqhci_deactivate (host->mmc); +sdhci_reset (host, mask); +} +/*****************************************************************************\ * * * Hardware specific quirk handling *
@@ -718,7 +726,7 @@ static const struct sdhci_ops sdhci_inte .set_power = sdhci_intel_set_power, .enable_dma = sdhci_pci_enable_dma, .set_bus_width = sdhci_set_bus_width, - .reset = sdhci_reset, + .reset = sdhci_cqhci_reset, .set_uhs_signaling = sdhci_set_uhs_signaling, .hw_reset = sdhci_pci_hw_reset, .irq = sdhci_cqhci_irq,
Greg Kroah-Hartman
maintainerPATCH 149/186 media: rc: do not access device via sysfs after rc_unregister_device()
In reply to Greg Kroah-HartmanFrom: Sean Young <[email protected]>
commit a2e2d73fa28136598e84db9d021091f1b98cbb1a upstream.
Device drivers do not expect to have change_protocol or wakeup re-programming to be accesed after rc_unregister_device(). This can cause the device driver to access deallocated resources.
--- drivers/media/rc/rc-main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/media/rc/rc-main.c +12 -0
@@ -1292,6 +1292,10 @@ static ssize_t store_protocols(struct de }mutex_lock (&dev->lock); +if (!dev->registered) { +mutex_unlock (&dev->lock); +return -ENODEV ; + } old_protocols = *current_protocols; new_protocols = old_protocols;
@@ -1430,6 +1434,10 @@ static ssize_t store_filter(struct devicreturn -EINVAL ;mutex_lock (&dev->lock); +if (!dev->registered) { +mutex_unlock (&dev->lock); +return -ENODEV ; + } new_filter = *filter;if (fattr->mask)
@@ -1544,6 +1552,10 @@ static ssize_t store_wakeup_protocols(stint i;mutex_lock (&dev->lock); +if (!dev->registered) { +mutex_unlock (&dev->lock); +return -ENODEV ; + } allowed = dev->allowed_wakeup_protocols;
Greg Kroah-Hartman
maintainerPATCH 150/186 media: rc: uevent sysfs file races with rc_unregister_device()
In reply to Greg Kroah-HartmanFrom: Sean Young <[email protected]>
commit 4f0835d6677dc69263f90f976524cb92b257d9f4 upstream.
Only report uevent file contents if device still registered, else we might read freed memory.
--- drivers/media/rc/rc-main.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/media/rc/rc-main.c +16 -16
@@ -1613,25 +1613,25 @@ static void rc_dev_release(struct devicekfree (dev); } -#define ADD_HOTPLUG_VAR(fmt, val...) \ - do { \ - int err = add_uevent_var(env, fmt, val); \ - if (err) \ - return err; \ - } while (0) -static int rc_dev_uevent (struct device *device,struct kobj_uevent_env *env) {struct rc_dev *dev =to_rc_dev (device); +int ret =0 ; -if (dev->rc_map.name) -ADD_HOTPLUG_VAR ("NAME=%s" , dev->rc_map.name); -if (dev->driver_name) -ADD_HOTPLUG_VAR ("DRV_NAME=%s" , dev->driver_name); -if (dev->device_name) -ADD_HOTPLUG_VAR ("DEV_NAME=%s" , dev->device_name); +mutex_lock (&dev->lock); -return 0 ; +if (!dev->registered) + ret = -ENODEV ; +if (ret ==0 && dev->rc_map.name) + ret =add_uevent_var (env,"NAME=%s" , dev->rc_map.name); +if (ret ==0 && dev->driver_name) + ret =add_uevent_var (env,"DRV_NAME=%s" , dev->driver_name); +if (ret ==0 && dev->device_name) + ret =add_uevent_var (env,"DEV_NAME=%s" , dev->device_name); + +mutex_unlock (&dev->lock); + +return ret; }/*
@@ -2023,14 +2023,14 @@ void rc_unregister_device(struct rc_devdel_timer_sync (&dev->timer_keyup);del_timer_sync (&dev->timer_repeat); -rc_free_rx_device (dev); -mutex_lock (&dev->lock);if (dev->users && dev->close) dev->close (dev); dev->registered = false;mutex_unlock (&dev->lock); +rc_free_rx_device (dev); +/* * lirc device should be freed with dev->registered = false, so * that userspace polling will get notified.
Greg Kroah-Hartman
maintainerPATCH 151/186 affs: fix basic permission bits to actually work
In reply to Greg Kroah-HartmanFrom: Max Staudt <[email protected]>
commit d3a84a8d0dde4e26bc084b36ffcbdc5932ac85e2 upstream.
The basic permission bits (protection bits in AmigaOS) have been broken in Linux' AFFS - it would only set bits, but never delete them. Also, contrary to the documentation, the Archived bit was not handled.
Let's fix this for good, and set the bits such that Linux and classic AmigaOS can coexist in the most peaceful manner.
Also, update the documentation to represent the current state of things.
--- Documentation/filesystems/affs.rst | 16 ++++++++++------ fs/affs/amigaffs.c | 27 +++++++++++++++++++++++++++ fs/affs/file.c | 26 +++++++++++++++++++++++++- 3 files changed, 62 insertions(+), 7 deletions(-)
Documentation/filesystems/affs.rst +10 -6
@@ -110,13 +110,15 @@ The Amiga protection flags RWEDRWEDHSPAR - R maps to r for user, group and others. On directories, R implies x. - - If both W and D are allowed, w will be set. + - W maps to w. - E maps to x. - - H and P are always retained and ignored under Linux. + - D is ignored. - - A is always reset when a file is written to. + - H, S and P are always retained and ignored under Linux. + + - A is cleared when a file is written to. User id and group id will be used unless set[gu]id are given as mount options. Since most of the Amiga file systems are single user systems
@@ -128,11 +130,13 @@ Linux -> Amiga: The Linux rwxrwxrwx file mode is handled as follows: - - r permission will set R for user, group and others. + - r permission will allow R for user, group and others. + + - w permission will allow W for user, group and others. - - w permission will set W and D for user, group and others. + - x permission of the user will allow E for plain files. - - x permission of the user will set E for plain files. + - D will be allowed for user, group and others. - All other flags (suid, sgid, ...) are ignored and will not be retained.
fs/affs/amigaffs.c +27 -0
@@ -420,24 +420,51 @@ affs_mode_to_prot(struct inode *inode)u32 prot =AFFS_I (inode)->i_protect;umode_t mode = inode->i_mode; +/* +* First, clear all RWED bits for owner, group, other. +* Then, recalculate them afresh. +* +* We'll always clear the delete-inhibit bit for the owner, as that is +* the classic single-user mode AmigaOS protection bit and we need to +* stay compatible with all scenarios. +* +* Since multi-user AmigaOS is an extension, we'll only set the +* delete-allow bit if any of the other bits in the same user class +* (group/other) are used. +*/ + prot &= ~(FIBF_NOEXECUTE |FIBF_NOREAD + |FIBF_NOWRITE |FIBF_NODELETE + |FIBF_GRP_EXECUTE |FIBF_GRP_READ + |FIBF_GRP_WRITE |FIBF_GRP_DELETE + |FIBF_OTR_EXECUTE |FIBF_OTR_READ + |FIBF_OTR_WRITE |FIBF_OTR_DELETE ); + +/* Classic single-user AmigaOS flags. These are inverted. */ if (!(mode &0100 )) prot |=FIBF_NOEXECUTE ;if (!(mode &0400 )) prot |=FIBF_NOREAD ;if (!(mode &0200 )) prot |=FIBF_NOWRITE ; + +/* Multi-user extended flags. Not inverted. */ if (mode &0010 ) prot |=FIBF_GRP_EXECUTE ;if (mode &0040 ) prot |=FIBF_GRP_READ ;if (mode &0020 ) prot |=FIBF_GRP_WRITE ; +if (mode &0070 ) + prot |=FIBF_GRP_DELETE ; +if (mode &0001 ) prot |=FIBF_OTR_EXECUTE ;if (mode &0004 ) prot |=FIBF_OTR_READ ;if (mode &0002 ) prot |=FIBF_OTR_WRITE ; +if (mode &0007 ) + prot |=FIBF_OTR_DELETE ;AFFS_I (inode)->i_protect = prot; }
fs/affs/file.c +25 -1
@@ -428,6 +428,24 @@ static int affs_write_begin(struct filereturn ret; } +static int affs_write_end (struct file *file,struct address_space *mapping, +loff_t pos,unsigned int len,unsigned int copied, +struct page *page,void *fsdata) +{ +struct inode *inode = mapping->host; +int ret; + + ret =generic_write_end (file, mapping, pos, len, copied, page, fsdata); + +/* Clear Archived bit on file writes, as AmigaOS would do */ +if (AFFS_I (inode)->i_protect &FIBF_ARCHIVED ) { +AFFS_I (inode)->i_protect &= ~FIBF_ARCHIVED ; +mark_inode_dirty (inode); + } + +return ret; +} +static sector_t _affs_bmap (struct address_space *mapping,sector_t block) {return generic_block_bmap (mapping,block,affs_get_block);
@@ -437,7 +455,7 @@ const struct address_space_operations af .readpage = affs_readpage, .writepage = affs_writepage, .write_begin = affs_write_begin, - .write_end = generic_write_end, + .write_end = affs_write_end, .direct_IO = affs_direct_IO, .bmap = _affs_bmap };
@@ -794,6 +812,12 @@ done:if (tmp > inode->i_size) inode->i_size =AFFS_I (inode)->mmu_private = tmp; +/* Clear Archived bit on file writes, as AmigaOS would do */ +if (AFFS_I (inode)->i_protect &FIBF_ARCHIVED ) { +AFFS_I (inode)->i_protect &= ~FIBF_ARCHIVED ; +mark_inode_dirty (inode); + } + err_first_bh:unlock_page (page);put_page (page);
Greg Kroah-Hartman
maintainerPATCH 152/186 block: allow for_each_bvec to support zero len bvec
In reply to Greg Kroah-HartmanFrom: Ming Lei <[email protected]>
commit 7e24969022cbd61ddc586f14824fc205661bb124 upstream.
Block layer usually doesn't support or allow zero-length bvec. Since commit 1bdc76aea115 ("iov_iter: use bvec iterator to implement iterate_bvec()"), iterate_bvec() switches to bvec iterator. However, Al mentioned that 'Zero-length segments are not disallowed' in iov_iter.
Fixes for_each_bvec() so that it can move on after seeing one zero length bvec.
--- include/linux/bvec.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
include/linux/bvec.h +8 -1
@@ -117,11 +117,18 @@ static inline bool bvec_iter_advance(conreturn true; } +static inline void bvec_iter_skip_zero_bvec (struct bvec_iter *iter) +{ + iter->bi_bvec_done =0 ; + iter->bi_idx++; +} +#define for_each_bvec (bvl, bio_vec, iter, start) \ for (iter = (start); \ (iter).bi_size && \ ((bvl = bvec_iter_bvec((bio_vec), (iter))), 1); \ - bvec_iter_advance((bio_vec), &(iter), (bvl).bv_len)) + (bvl).bv_len ? (void)bvec_iter_advance((bio_vec), &(iter), \ + (bvl).bv_len) : bvec_iter_skip_zero_bvec(&(iter)))/* for iterating one bio from start to end */ #define BVEC_ITER_ALL_INIT (struct bvec_iter) \
Greg Kroah-Hartman
maintainerPATCH 153/186 block: ensure bdi->io_pages is always initialized
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
commit de1b0ee490eafdf65fac9eef9925391a8369f2dc upstream.
If a driver leaves the limit settings as the defaults, then we don't initialize bdi->io_pages. This means that file systems may need to work around bdi->io_pages == 0, which is somewhat messy.
Initialize the default value just like we do for ->ra_pages.
--- block/blk-core.c | 1 + 1 file changed, 1 insertion(+)
block/blk-core.c +1 -0
@@ -526,6 +526,7 @@ struct request_queue *__blk_alloc_queue( goto fail_stats; q->backing_dev_info->ra_pages =VM_READAHEAD_PAGES ; + q->backing_dev_info->io_pages =VM_READAHEAD_PAGES ; q->backing_dev_info->capabilities =BDI_CAP_CGROUP_WRITEBACK ; q->node = node_id;
Greg Kroah-Hartman
maintainerPATCH 154/186 io_uring: set table->files[i] to NULL when io_sqe_file_register failed
In reply to Greg Kroah-HartmanFrom: Jiufei Xue <[email protected]>
commit 95d1c8e5f801e959a89181a2548a3efa60a1a6ce upstream.
While io_sqe_file_register() failed in __io_sqe_files_update(), table->files[i] still point to the original file which may freed soon, and that will trigger use-after-free problems.
--- fs/io_uring.c | 1 + 1 file changed, 1 insertion(+)
fs/io_uring.c +1 -0
@@ -6957,6 +6957,7 @@ static int __io_sqe_files_update(struct table->files[index] = file; err =io_sqe_file_register (ctx, file, i);if (err) { + table->files[index] =NULL ;fput (file);break ; }
Greg Kroah-Hartman
maintainerPATCH 155/186 io_uring: fix removing the wrong file in __io_sqe_files_update()
In reply to Greg Kroah-HartmanFrom: Jiufei Xue <[email protected]>
commit 98dfd5024a2e9e170b85c07078e2d89f20a5dfbd upstream.
Index here is already the position of the file in fixed_file_table, we should not use io_file_from_index() again to get it. Otherwise, the wrong file which still in use may be released unexpectedly.
--- fs/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/io_uring.c +1 -1
@@ -6928,7 +6928,7 @@ static int __io_sqe_files_update(struct table = &ctx->file_data->table[i >>IORING_FILE_TABLE_SHIFT ]; index = i &IORING_FILE_TABLE_MASK ;if (table->files[index]) { - file =io_file_from_index (ctx, index); + file = table->files[index]; err =io_queue_file_removal (data, file);if (err)break ;
Greg Kroah-Hartman
maintainerPATCH 156/186 s390: fix GENERIC_LOCKBREAK dependency typo in Kconfig
In reply to Greg Kroah-HartmanFrom: Eric Farman <[email protected]>
commit 114b9df419bf5db097b322ebb03fcf2f502f9380 upstream.
Commit fa686453053b ("sched/rt, s390: Use CONFIG_PREEMPTION") changed a bunch of uses of CONFIG_PREEMPT to _PREEMPTION. Except in the Kconfig it used two T's. That's the only place in the system where that spelling exists, so let's fix that.
--- arch/s390/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/Kconfig +1 -1
@@ -30,7 +30,7 @@ config GENERIC_BUG_RELATIVE_POINTERS def_bool y config GENERIC_LOCKBREAK - def_bool y if PREEMPTTION + def_bool y if PREEMPTION config PGSTE def_bool y if KVM
Greg Kroah-Hartman
maintainerPATCH 157/186 libata: implement ATA_HORKAGE_MAX_TRIM_128M and apply to Sandisks
In reply to Greg Kroah-HartmanFrom: Tejun Heo <[email protected]>
commit 3b5455636fe26ea21b4189d135a424a6da016418 upstream.
All three generations of Sandisk SSDs lock up hard intermittently. Experiments showed that disabling NCQ lowered the failure rate significantly and the kernel has been disabling NCQ for some models of SD7's and 8's, which is obviously undesirable.
Karthik worked with Sandisk to root cause the hard lockups to trim commands larger than 128M. This patch implements ATA_HORKAGE_MAX_TRIM_128M which limits max trim size to 128M and applies it to all three generations of Sandisk SSDs.
--- drivers/ata/libata-core.c | 5 ++--- drivers/ata/libata-scsi.c | 8 +++++++- include/linux/libata.h | 1 + 3 files changed, 10 insertions(+), 4 deletions(-)
drivers/ata/libata-core.c +2 -3
@@ -3868,9 +3868,8 @@ static const struct ata_blacklist_entry/* https://bugzilla.kernel.org/show_bug.cgi?id=15573 */ { "C300-CTFDDAC128MAG", "0001", ATA_HORKAGE_NONCQ, }, - /* Some Sandisk SSDs lock up hard with NCQ enabled. Reported on - SD7SN6S256G and SD8SN8U256G */ - { "SanDisk SD[78]SN*G", NULL, ATA_HORKAGE_NONCQ, }, + /* Sandisk SD7/8/9s lock up hard on large trims */ + { "SanDisk SD[789]*", NULL, ATA_HORKAGE_MAX_TRIM_128M, }, /* devices which puke on READ_NATIVE_MAX */ { "HDS724040KLSA80", "KFAOA20N", ATA_HORKAGE_BROKEN_HPA, },
drivers/ata/libata-scsi.c +7 -1
@@ -2080,6 +2080,7 @@ static unsigned int ata_scsiop_inq_89(ststatic unsigned int ata_scsiop_inq_b0 (struct ata_scsi_args *args,u8 *rbuf) { +struct ata_device *dev = args->dev;u16 min_io_sectors; rbuf[1 ] =0xb0 ;
@@ -2105,7 +2106,12 @@ static unsigned int ata_scsiop_inq_b0(st* with the unmap bit set. */ if (ata_id_has_trim (args->id)) { -put_unaligned_be64 (65535 *ATA_MAX_TRIM_RNUM , &rbuf[36 ]); +u64 max_blocks =65535 *ATA_MAX_TRIM_RNUM ; + +if (dev->horkage &ATA_HORKAGE_MAX_TRIM_128M ) + max_blocks =128 << (20 -SECTOR_SHIFT ); + +put_unaligned_be64 (max_blocks, &rbuf[36 ]);put_unaligned_be32 (1 , &rbuf[28 ]); }
include/linux/libata.h +1 -0
@@ -421,6 +421,7 @@ enum {ATA_HORKAGE_NO_DMA_LOG = (1 <<23 ),/* don't use DMA for log read */ ATA_HORKAGE_NOTRIM = (1 <<24 ),/* don't use TRIM */ ATA_HORKAGE_MAX_SEC_1024 = (1 <<25 ),/* Limit max sects to 1024 */ + ATA_HORKAGE_MAX_TRIM_128M = (1 << 26), /* Limit max trim size to 128M *//* DMA mask for user DMA control: User visible values; DO NOT renumber */
Greg Kroah-Hartman
maintainerPATCH 158/186 mips/oprofile: Fix fallthrough placement
In reply to Greg Kroah-HartmanFrom: He Zhe <[email protected]>
commit 91dbd73a1739039fa7e9fe5c0169f2817a7f7670 upstream.
We want neither
"include/linux/compiler_attributes.h:201:41: warning: statement will never be executed [-Wswitch-unreachable]
201 | # define fallthrough __attribute__((__fallthrough__))
| ^~~~~~~~~~~~~
"
nor
"include/linux/compiler_attributes.h:201:41: warning: attribute 'fallthrough' not preceding a case label or default label
201 | # define fallthrough __attribute__((__fallthrough__))
| ^~~~~~~~~~~~~
"
It's not worth adding one more macro. Let's simply place the fallthrough in between the expansions.
--- arch/mips/oprofile/op_model_mipsxx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/mips/oprofile/op_model_mipsxx.c +3 -1
@@ -245,7 +245,6 @@ static int mipsxx_perfcount_handler(voidswitch (counters) {#define HANDLE_COUNTER (n) \ - fallthrough; \ case n + 1: \ control = r_c0_perfctrl ## n(); \ counter = r_c0_perfcntr ## n(); \
@@ -256,8 +255,11 @@ static int mipsxx_perfcount_handler(void handled =IRQ_HANDLED ; \ } HANDLE_COUNTER(3) + fallthrough; HANDLE_COUNTER(2) + fallthrough; HANDLE_COUNTER(1) + fallthrough; HANDLE_COUNTER(0) }
Greg Kroah-Hartman
maintainerPATCH 159/186 blk-iocost: ioc_pd_free() shouldnt assume irq disabled
In reply to Greg Kroah-HartmanFrom: Tejun Heo <[email protected]>
commit 5aeac7c4b16069aae49005f0a8d4526baa83341b upstream.
ioc_pd_free() grabs irq-safe ioc->lock without ensuring that irq is disabled when it can be called with irq disabled or enabled. This has a small chance of causing A-A deadlocks and triggers lockdep splats. Use irqsave operations instead.
--- block/blk-iocost.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
block/blk-iocost.c +3 -2
@@ -2094,14 +2094,15 @@ static void ioc_pd_free(struct blkg_poli {struct ioc_gq *iocg =pd_to_iocg (pd);struct ioc *ioc = iocg->ioc; +unsigned long flags;if (ioc) { -spin_lock (&ioc->lock); +spin_lock_irqsave (&ioc->lock, flags);if (!list_empty (&iocg->active_list)) {propagate_active_weight (iocg,0 ,0 );list_del_init (&iocg->active_list); } -spin_unlock (&ioc->lock); +spin_unlock_irqrestore (&ioc->lock, flags);hrtimer_cancel (&iocg->waitq_timer);hrtimer_cancel (&iocg->delay_timer);
Greg Kroah-Hartman
maintainerPATCH 160/186 blk-stat: make q->stats->lock irqsafe
In reply to Greg Kroah-HartmanFrom: Tejun Heo <[email protected]>
commit e11d80a849e010f78243bb6f6af7dccef3a71a90 upstream.
blk-iocost calls blk_stat_enable_accounting() while holding an irqsafe lock which triggers a lockdep splat because q->stats->lock isn't irqsafe. Let's make it irqsafe.
--- block/blk-stat.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
block/blk-stat.c +11 -6
@@ -137,6 +137,7 @@ void blk_stat_add_callback(struct reques struct blk_stat_callback *cb) {unsigned int bucket; +unsigned long flags;int cpu;for_each_possible_cpu (cpu) {
@@ -147,20 +148,22 @@ void blk_stat_add_callback(struct requesblk_rq_stat_init (&cpu_stat[bucket]); } -spin_lock (&q->stats->lock); +spin_lock_irqsave (&q->stats->lock, flags);list_add_tail_rcu (&cb->list, &q->stats->callbacks);blk_queue_flag_set (QUEUE_FLAG_STATS , q); -spin_unlock (&q->stats->lock); +spin_unlock_irqrestore (&q->stats->lock, flags); }void blk_stat_remove_callback (struct request_queue *q,struct blk_stat_callback *cb) { -spin_lock (&q->stats->lock); +unsigned long flags; + +spin_lock_irqsave (&q->stats->lock, flags);list_del_rcu (&cb->list);if (list_empty (&q->stats->callbacks) && !q->stats->enable_accounting)blk_queue_flag_clear (QUEUE_FLAG_STATS , q); -spin_unlock (&q->stats->lock); +spin_unlock_irqrestore (&q->stats->lock, flags);del_timer_sync (&cb->timer); }
@@ -183,10 +186,12 @@ void blk_stat_free_callback(struct blk_svoid blk_stat_enable_accounting (struct request_queue *q) { -spin_lock (&q->stats->lock); +unsigned long flags; + +spin_lock_irqsave (&q->stats->lock, flags); q->stats->enable_accounting = true;blk_queue_flag_set (QUEUE_FLAG_STATS , q); -spin_unlock (&q->stats->lock); +spin_unlock_irqrestore (&q->stats->lock, flags); }EXPORT_SYMBOL_GPL (blk_stat_enable_accounting);
Greg Kroah-Hartman
maintainerPATCH 161/186 dmaengine: dw-edma: Fix scatter-gather address calculation
In reply to Greg Kroah-HartmanFrom: Gustavo Pimentel <[email protected]>
commit 05655541c9503bfd01af4e6cbd7f5a29ac748e6c upstream.
Fix the source and destination physical address calculation of a peripheral device on scatter-gather implementation.
This issue manifested during tests using a 64 bits architecture system. The abnormal behavior wasn't visible before due to all previous tests were done using 32 bits architecture system, that masked his effect.
--- drivers/dma/dw-edma/dw-edma-core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/dma/dw-edma/dw-edma-core.c +6 -5
@@ -405,7 +405,7 @@ dw_edma_device_transfer(struct dw_edma_tif (xfer->cyclic) { burst->dar = xfer->xfer.cyclic.paddr; }else { - burst->dar =sg_dma_address (sg); + burst->dar = dst_addr;/* Unlike the typical assumption by other * drivers/IPs the peripheral memory isn't * a FIFO memory, in this case, it's a
@@ -413,14 +413,13 @@ dw_edma_device_transfer(struct dw_edma_t* and destination addresses are increased * by the same portion (data length) */ - src_addr +=sg_dma_len (sg); } }else { burst->dar = dst_addr;if (xfer->cyclic) { burst->sar = xfer->xfer.cyclic.paddr; }else { - burst->sar =sg_dma_address (sg); + burst->sar = src_addr;/* Unlike the typical assumption by other * drivers/IPs the peripheral memory isn't * a FIFO memory, in this case, it's a
@@ -428,12 +427,14 @@ dw_edma_device_transfer(struct dw_edma_t* and destination addresses are increased * by the same portion (data length) */ - dst_addr +=sg_dma_len (sg); } } -if (!xfer->cyclic) +if (!xfer->cyclic) { + src_addr +=sg_dma_len (sg); + dst_addr +=sg_dma_len (sg); sg =sg_next (sg); + } }return vchan_tx_prep (&chan->vc, &desc->vd, xfer->flags);
Greg Kroah-Hartman
maintainerPATCH 162/186 drm/i915: Fix sha_text population code
In reply to Greg Kroah-HartmanFrom: Sean Paul <[email protected]>
commit 9ab57658a608f879469ffa22b723c4539c05a58f upstream.
This patch fixes a few bugs:
1- We weren't taking into account sha_leftovers when adding multiple
ksvs to sha_text. As such, we were or'ing the end of ksv[j - 1] with the beginning of ksv[j]
2- In the sha_leftovers == 2 and sha_leftovers == 3 case, bstatus was
being placed on the wrong half of sha_text, overlapping the leftover ksv value
3- In the sha_leftovers == 2 case, we need to manually terminate the
byte stream with 0x80 since the hardware doesn't have enough room to add it after writing M0
The upside is that all of the HDCP supported HDMI repeaters I could find on Amazon just strip HDCP anyways, so it turns out to be _really_ hard to hit any of these cases without an MST hub, which is not (yet) supported. Oh, and the sha_leftovers == 1 case works perfectly!
--- drivers/gpu/drm/i915/display/intel_hdcp.c | 26 ++++++++++++++++++++------ include/drm/drm_hdcp.h | 3 +++ 2 files changed, 23 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/display/intel_hdcp.c +20 -6
@@ -336,8 +336,10 @@ int intel_hdcp_validate_v_prime(struct i/* Fill up the empty slots in sha_text and write it out */ sha_empty =sizeof (sha_text) - sha_leftovers; -for (j =0 ; j < sha_empty; j++) - sha_text |= ksv[j] << ((sizeof (sha_text) - j -1 ) *8 ); +for (j =0 ; j < sha_empty; j++) { +u8 off = ((sizeof (sha_text) - j -1 - sha_leftovers) *8 ); + sha_text |= ksv[j] << off; + } ret =intel_write_sha_text (dev_priv, sha_text);if (ret <0 )
@@ -435,7 +437,7 @@ int intel_hdcp_validate_v_prime(struct i/* Write 32 bits of text */ intel_de_write (dev_priv,HDCP_REP_CTL , rep_ctl |HDCP_SHA1_TEXT_32 ); - sha_text |= bstatus[0 ] <<24 | bstatus[1 ] <<16 ; + sha_text |= bstatus[0 ] <<8 | bstatus[1 ]; ret =intel_write_sha_text (dev_priv, sha_text);if (ret <0 )return ret;
@@ -450,17 +452,29 @@ int intel_hdcp_validate_v_prime(struct ireturn ret; sha_idx +=sizeof (sha_text); } + +/* +* Terminate the SHA-1 stream by hand. For the other leftover +* cases this is appended by the hardware. +*/ +intel_de_write (dev_priv,HDCP_REP_CTL , + rep_ctl |HDCP_SHA1_TEXT_32 ); + sha_text =DRM_HDCP_SHA1_TERMINATOR <<24 ; + ret =intel_write_sha_text (dev_priv, sha_text); +if (ret <0 ) +return ret; + sha_idx +=sizeof (sha_text); }else if (sha_leftovers ==3 ) { -/* Write 32 bits of text */ +/* Write 32 bits of text (filled from LSB) */ intel_de_write (dev_priv,HDCP_REP_CTL , rep_ctl |HDCP_SHA1_TEXT_32 ); - sha_text |= bstatus[0 ] <<24 ; + sha_text |= bstatus[0 ]; ret =intel_write_sha_text (dev_priv, sha_text);if (ret <0 )return ret; sha_idx +=sizeof (sha_text); -/* Write 8 bits of text, 24 bits of M0 */ +/* Write 8 bits of text (filled from LSB), 24 bits of M0 */ intel_de_write (dev_priv,HDCP_REP_CTL , rep_ctl |HDCP_SHA1_TEXT_8 ); ret =intel_write_sha_text (dev_priv, bstatus[1 ]);
include/drm/drm_hdcp.h +3 -0
@@ -29,6 +29,9 @@/* Slave address for the HDCP registers in the receiver */ #define DRM_HDCP_DDC_ADDR 0x3A +/* Value to use at the end of the SHA-1 bytestream used for repeaters */ +#define DRM_HDCP_SHA1_TERMINATOR 0x80 +/* HDCP register offsets for HDMI/DVI devices */ #define DRM_HDCP_DDC_BKSV 0x00#define DRM_HDCP_DDC_RI_PRIME 0x08
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Greg Kroah-Hartman
maintainerPATCH 163/186 drm/amd/pm: avoid false alarm due to confusing softwareshutdowntemp setting
In reply to Greg Kroah-HartmanFrom: Evan Quan <[email protected]>
commit 971df65cbf32da9bc9af52c1196ca504dd316086 upstream.
Normally softwareshutdowntemp should be greater than Thotspotlimit. However, on some VEGA10 ASIC, the softwareshutdowntemp is 91C while Thotspotlimit is 105C. This seems not right and may trigger some false alarms.
--- drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c +12 -2
@@ -374,8 +374,18 @@ static int vega10_thermal_set_temperatur/* compare them in unit celsius degree */ if (low < range->min /PP_TEMPERATURE_UNITS_PER_CENTIGRADES ) low = range->min /PP_TEMPERATURE_UNITS_PER_CENTIGRADES ; -if (high > tdp_table->usSoftwareShutdownTemp) - high = tdp_table->usSoftwareShutdownTemp; + +/* +* As a common sense, usSoftwareShutdownTemp should be bigger +* than ThotspotLimit. For any invalid usSoftwareShutdownTemp, +* we will just use the max possible setting VEGA10_THERMAL_MAXIMUM_ALERT_TEMP +* to avoid false alarms. +*/ +if ((tdp_table->usSoftwareShutdownTemp > + range->hotspot_crit_max /PP_TEMPERATURE_UNITS_PER_CENTIGRADES )) { +if (high > tdp_table->usSoftwareShutdownTemp) + high = tdp_table->usSoftwareShutdownTemp; + }if (low > high)return -EINVAL ;