6.5.10-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainercover 6.5.10-rc1 review
This is the start of the stable review cycle for the 6.5.10 release. There are 112 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, 02 Nov 2023 16:58:38 +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/v6.x/stable-review/patch-6.5.10-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-6.5.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 6.5.10-rc1
Karol Wachowski <[email protected]>
accel/ivpu/37xx: Fix missing VPUIP interrupts
SeongJae Park <[email protected]>
mm/damon/sysfs: check DAMOS regions update progress from before_terminate()
David Lazar <[email protected]>
platform/x86: Add s2idle quirk for more Lenovo laptops
Dan Carpenter <[email protected]>
clk: stm32: Fix a signedness issue in clk_stm32_composite_determine_rate()
Maxime Ripard <[email protected]>
clk: socfpga: gate: Account for the divider in determine_rate
Alessandro Carminati <[email protected]>
clk: Sanitize possible_parent_show to Handle Return Value of of_clk_get_parent_name
Al Viro <[email protected]>
sparc32: fix a braino in fault handling in csum_and_copy_..._user()
Peter Zijlstra <[email protected]>
perf/core: Fix potential NULL deref
Tony Luck <[email protected]>
x86/cpu: Add model number for Intel Arrow Lake mobile processor
Thomas Gleixner <[email protected]>
x86/i8259: Skip probing when ACPI/MADT advertises PCAT compatibility
Thomas Gleixner <[email protected]>
x86/tsc: Defer marking TSC unstable to a worker
Peng Fan <[email protected]>
nvmem: imx: correct nregs for i.MX6UL
Peng Fan <[email protected]>
nvmem: imx: correct nregs for i.MX6SLL
Peng Fan <[email protected]>
nvmem: imx: correct nregs for i.MX6ULL
Ekansh Gupta <[email protected]>
misc: fastrpc: Unmap only if buffer is unmapped from DSP
Ekansh Gupta <[email protected]>
misc: fastrpc: Clean buffers on remote invocation failures
Ekansh Gupta <[email protected]>
misc: fastrpc: Free DMA handles for RPC calls with no arguments
Ekansh Gupta <[email protected]>
misc: fastrpc: Reset metadata buffer to avoid incorrect free
Yujie Liu <[email protected]>
tracing/kprobes: Fix the description of variable length arguments
Andrii Nakryiko <[email protected]>
tracing/kprobes: Fix symbol counting logic by looking at modules as well
Jian Zhang <[email protected]>
i2c: aspeed: Fix i2c bus hang in slave read
Alain Volmat <[email protected]>
i2c: stm32f7: Fix PEC handling in case of SMBUS transfers
Herve Codina <[email protected]>
i2c: muxes: i2c-demux-pinctrl: Use of_get_i2c_adapter_by_node()
Herve Codina <[email protected]>
i2c: muxes: i2c-mux-gpmux: Use of_get_i2c_adapter_by_node()
Herve Codina <[email protected]>
i2c: muxes: i2c-mux-pinctrl: Use of_get_i2c_adapter_by_node()
Robert Hancock <[email protected]>
iio: adc: xilinx-xadc: Correct temperature offset/scale for UltraScale
Robert Hancock <[email protected]>
iio: adc: xilinx-xadc: Don't clobber preset voltage/temperature thresholds
Marek Szyprowski <[email protected]>
iio: exynos-adc: request second interupt only when touchscreen mode is used
Linus Walleij <[email protected]>
iio: afe: rescale: Accept only offset channels
Jens Axboe <[email protected]>
io_uring/fdinfo: lock SQ thread while retrieving thread cpu/pid
Haibo Li <[email protected]>
kasan: print the original fault addr when access invalid shadow
Khazhismel Kumykov <[email protected]>
blk-throttle: check for overflow in calculate_bytes_allowed
Damien Le Moal <[email protected]>
scsi: sd: Introduce manage_shutdown device flag
Michal Schmidt <[email protected]>
iavf: in iavf_down, disable queues when removing the driver
Matt Roper <[email protected]>
drm/i915/mcr: Hold GT forcewake during steering operations
Sui Jingfeng <[email protected]>
drm/logicvc: Kconfig: select REGMAP and REGMAP_MMIO
Vlad Buslov <[email protected]>
net/sched: act_ct: additional checks for outdated flows
Pablo Neira Ayuso <[email protected]>
netfilter: flowtable: GC pushes back packets to classic path
Ivan Vecera <[email protected]>
i40e: Fix wrong check for I40E_TXR_FLAGS_WB_ON_ITR
Umesh Nerlige Ramappa <[email protected]>
drm/i915/perf: Determine context valid in OA reports
Pablo Neira Ayuso <[email protected]>
gtp: fix fragmentation needed check with gso
Pablo Neira Ayuso <[email protected]>
gtp: uapi: fix GTPA_MAX
Moritz Wanzenböck <[email protected]>
net/handshake: fix file ref count in handshake_nl_accept_doit()
Avraham Stern <[email protected]>
wifi: mac80211: don't drop all unprotected public action frames
Johannes Berg <[email protected]>
wifi: cfg80211: fix assoc response warning on failed links
Ben Greear <[email protected]>
wifi: cfg80211: pass correct pointer to rdev_inform_bss()
Fred Chen <[email protected]>
tcp: fix wrong RTO timeout when received SACK reneging
Douglas Anderson <[email protected]>
r8152: Release firmware if we have an error in probe
Douglas Anderson <[email protected]>
r8152: Cancel hw_phy_work if we have an error in probe
Douglas Anderson <[email protected]>
r8152: Run the unload routine if we have errors during probe
Douglas Anderson <[email protected]>
r8152: Increase USB control msg timeout to 5000ms as per spec
Shigeru Yoshida <[email protected]>
net: usb: smsc95xx: Fix uninit-value access in smsc95xx_read_reg
Christophe JAILLET <[email protected]>
net: ieee802154: adf7242: Fix some potential buffer overflow in adf7242_stats_show()
Dell Jin <[email protected]>
net: ethernet: adi: adin1110: Fix uninitialized variable
Sasha Neftin <[email protected]>
igc: Fix ambiguity in the ethtool advertising
Eric Dumazet <[email protected]>
neighbour: fix various data-races
Eric Dumazet <[email protected]>
net: do not leave an empty skb in write queue
Mateusz Palczewski <[email protected]>
igb: Fix potential memory leak in igb_add_ethtool_nfc_entry
Kunwu Chan <[email protected]>
treewide: Spelling fix in comment
Ivan Vecera <[email protected]>
i40e: Fix I40E_FLAG_VF_VLAN_PRUNING value
Michal Schmidt <[email protected]>
iavf: initialize waitqueues before starting watchdog_task
Mirsad Goran Todorovac <[email protected]>
r8169: fix the KCSAN reported data race in rtl_rx while reading desc->opts1
Mirsad Goran Todorovac <[email protected]>
r8169: fix the KCSAN reported data-race in rtl_tx while reading TxDescArray[entry].opts1
Mirsad Goran Todorovac <[email protected]>
r8169: fix the KCSAN reported data-race in rtl_tx() while reading tp->cur_tx
Tony Lindgren <[email protected]>
clk: ti: Fix missing omap5 mcbsp functional clock and aliases
Tony Lindgren <[email protected]>
clk: ti: Fix missing omap4 mcbsp functional clock and aliases
Hao Ge <[email protected]>
firmware/imx-dsp: Fix use_after_free in imx_dsp_setup_channels()
Randy Dunlap <[email protected]>
ARM: OMAP: timer32K: fix all kernel-doc warnings
Filipe Manana <[email protected]>
btrfs: fix unwritten extent buffer after snapshotting a new subvolume
Qu Wenruo <[email protected]>
btrfs: remove v0 extent handling
Lukasz Majczak <[email protected]>
drm/dp_mst: Fix NULL deref in get_mst_branch_device_by_guid_helper()
Mario Limonciello <[email protected]>
drm/amd: Disable ASPM for VI w/ all Intel systems
Umesh Nerlige Ramappa <[email protected]>
drm/i915/pmu: Check if pmu is closed before stopping event
Jacek Lawrynowicz <[email protected]>
accel/ivpu: Don't enter d0i3 during FLR
Alex Bee <[email protected]>
ARM: dts: rockchip: Fix timer clocks for RK3128
Alex Bee <[email protected]>
ARM: dts: rockchip: Add missing quirk for RK3128's dma engine
Alex Bee <[email protected]>
ARM: dts: rockchip: Add missing arm timer interrupt for RK3128
Alex Bee <[email protected]>
ARM: dts: rockchip: Fix i2c0 register address for RK3128
Janusz Krzysztofik <[email protected]>
ARM: OMAP1: ams-delta: Fix MODEM initialization failure
Dragos Tatulea <[email protected]>
vdpa/mlx5: Fix double release of debugfs entry
Shawn.Shao <[email protected]>
vdpa_sim_blk: Fix the potential leak of mgmt_dev
Al Viro <[email protected]>
nfsd: lock_rename() needs both directories to live on the same fs
Liam R. Howlett <[email protected]>
maple_tree: add GFP_KERNEL to allocations in mas_expected_entries()
Rik van Riel <[email protected]>
hugetlbfs: extend hugetlb_vma_lock to private VMAs
Liam R. Howlett <[email protected]>
mm/mempolicy: fix set_mempolicy_home_node() previous VMA pointer
Samasth Norway Ananda <[email protected]>
selftests/mm: include mman header to access MREMAP_DONTUNMAP identifier
Gregory Price <[email protected]>
mm/migrate: fix do_pages_move for compat pointers
Kemeng Shi <[email protected]>
mm/page_alloc: correct start page when guard page debug is enabled
Rik van Riel <[email protected]>
hugetlbfs: clear resv_map pointer if mmap fails
Sebastian Ott <[email protected]>
mm: fix vm_brk_flags() to not bail out while holding lock
Tirthendu Sarkar <[email protected]>
i40e: sync next_to_clean and next_to_process for programming status desc
Christopher Obbard <[email protected]>
arm64: dts: rockchip: Fix i2s0 pin conflict on ROCK Pi 4 boards
Christopher Obbard <[email protected]>
arm64: dts: rockchip: Add i2s0-2ch-bus-bclk-off pins to RK3399
Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: sa8775p: correct PMIC GPIO label in gpio-ranges
Jakob Unterwurzacher <[email protected]>
arm64: dts: rockchip: set codec system-clock-fixed on px30-ringneck-haikou
Ermin Sunj <[email protected]>
arm64: dts: rockchip: use codec as clock master on px30-ringneck-haikou
Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: msm8996-xiaomi: fix missing clock populate
Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: apq8096-db820c: fix missing clock populate
Eric Auger <[email protected]>
vhost: Allow null msg.size on VHOST_IOTLB_INVALIDATE
Alexandru Matei <[email protected]>
vsock/virtio: initialize the_virtio_vsock before using VQs
Xuan Zhuo <[email protected]>
virtio_pci: fix the common cfg map size
zhenwei pi <[email protected]>
virtio-crypto: handle config changed by work queue
Maximilian Heyne <[email protected]>
virtio-mmio: fix memory leak of vm_dev
Gavin Shan <[email protected]>
virtio_balloon: Fix endless deflation and inflation on arm64
Paulo Alcantara <[email protected]>
smb: client: prevent new fids from being removed by laundromat
Paulo Alcantara <[email protected]>
smb: client: make laundromat a delayed worker
Paulo Alcantara <[email protected]>
smb: client: do not start laundromat thread on nohandlecache
Steve French <[email protected]>
smb3: do not start laundromat thread when dir leases disabled
Steve French <[email protected]>
smb3: allow controlling maximum number of cached directories
Steve French <[email protected]>
smb3: allow controlling length of time directory entries are cached with dir leases
Dragos Tatulea <[email protected]>
vdpa/mlx5: Fix firmware error on creation of 1k VQs
Alexandre Ghiti <[email protected]>
riscv: fix set_huge_pte_at() for NAPOT mappings when a swap entry is set
-------------
Diffstat:
Makefile | 4 +- arch/arm/boot/dts/rockchip/rk3128.dtsi | 18 +-- arch/arm/boot/dts/ti/omap/omap4-l4-abe.dtsi | 6 + arch/arm/boot/dts/ti/omap/omap4-l4.dtsi | 2 + arch/arm/boot/dts/ti/omap/omap5-l4-abe.dtsi | 6 + arch/arm/mach-omap1/board-ams-delta.c | 60 +++----- arch/arm/mach-omap1/timer32k.c | 14 +- arch/arm64/boot/dts/qcom/apq8096-db820c.dts | 32 ++--- .../arm64/boot/dts/qcom/msm8996-xiaomi-common.dtsi | 32 ++--- arch/arm64/boot/dts/qcom/msm8996-xiaomi-gemini.dts | 18 ++- arch/arm64/boot/dts/qcom/sa8775p-pmics.dtsi | 2 +- .../boot/dts/rockchip/px30-ringneck-haikou.dts | 10 +- arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi | 1 + arch/arm64/boot/dts/rockchip/rk3399.dtsi | 10 ++ arch/riscv/mm/hugetlbpage.c | 19 ++- arch/sparc/lib/checksum_32.S | 2 +- arch/x86/include/asm/i8259.h | 2 + arch/x86/include/asm/intel-family.h | 2 + arch/x86/kernel/acpi/boot.c | 3 + arch/x86/kernel/i8259.c | 38 +++-- arch/x86/kernel/tsc_sync.c | 10 +- block/blk-throttle.c | 6 + drivers/accel/ivpu/ivpu_drv.c | 11 +- drivers/accel/ivpu/ivpu_drv.h | 1 + drivers/accel/ivpu/ivpu_hw.h | 8 ++ drivers/accel/ivpu/ivpu_hw_mtl.c | 12 +- drivers/accel/ivpu/ivpu_pm.c | 3 +- drivers/ata/libata-scsi.c | 5 +- drivers/clk/clk.c | 21 +-- drivers/clk/socfpga/clk-gate.c | 27 +++- drivers/clk/stm32/clk-stm32-core.c | 2 +- drivers/clk/ti/clk-44xx.c | 5 + drivers/clk/ti/clk-54xx.c | 4 + drivers/crypto/virtio/virtio_crypto_common.h | 3 + drivers/crypto/virtio/virtio_crypto_core.c | 14 +- drivers/firewire/sbp2.c | 1 + drivers/firmware/imx/imx-dsp.c | 2 +- drivers/gpu/drm/amd/amdgpu/vi.c | 2 +- drivers/gpu/drm/display/drm_dp_mst_topology.c | 6 +- drivers/gpu/drm/i915/gt/intel_gt_mcr.c | 24 +++- drivers/gpu/drm/i915/i915_perf.c | 4 +- drivers/gpu/drm/i915/i915_pmu.c | 9 ++ drivers/gpu/drm/logicvc/Kconfig | 2 + drivers/i2c/busses/i2c-aspeed.c | 3 +- drivers/i2c/busses/i2c-stm32f7.c | 9 +- drivers/i2c/muxes/i2c-demux-pinctrl.c | 2 +- drivers/i2c/muxes/i2c-mux-gpmux.c | 2 +- drivers/i2c/muxes/i2c-mux-pinctrl.c | 2 +- drivers/iio/adc/exynos_adc.c | 24 ++-- drivers/iio/adc/xilinx-xadc-core.c | 39 ++---- drivers/iio/adc/xilinx-xadc.h | 2 + drivers/iio/afe/iio-rescale.c | 19 ++- drivers/misc/fastrpc.c | 34 ++--- drivers/net/ethernet/adi/adin1110.c | 2 +- drivers/net/ethernet/intel/i40e/i40e.h | 2 +- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 11 +- drivers/net/ethernet/intel/iavf/iavf_main.c | 7 +- drivers/net/ethernet/intel/igb/igb_ethtool.c | 6 +- drivers/net/ethernet/intel/igc/igc_ethtool.c | 35 +++-- drivers/net/ethernet/realtek/r8169_main.c | 6 +- drivers/net/ethernet/toshiba/ps3_gelic_wireless.c | 2 +- drivers/net/gtp.c | 5 +- drivers/net/ieee802154/adf7242.c | 5 +- drivers/net/usb/r8152.c | 11 +- drivers/net/usb/smsc95xx.c | 4 +- drivers/nvmem/imx-ocotp.c | 6 +- drivers/platform/x86/amd/pmc-quirks.c | 73 ++++++++++ drivers/scsi/sd.c | 39 +++++- drivers/vdpa/mlx5/net/debug.c | 5 +- drivers/vdpa/mlx5/net/mlx5_vnet.c | 70 +++++++-- drivers/vdpa/mlx5/net/mlx5_vnet.h | 11 +- drivers/vdpa/vdpa_sim/vdpa_sim_blk.c | 5 +- drivers/vhost/vhost.c | 4 +- drivers/virtio/virtio_balloon.c | 6 +- drivers/virtio/virtio_mmio.c | 19 ++- drivers/virtio/virtio_pci_modern_dev.c | 2 +- fs/btrfs/backref.c | 39 +++--- fs/btrfs/backref.h | 3 +- fs/btrfs/ctree.c | 21 ++- fs/btrfs/ctree.h | 3 +- fs/btrfs/extent-tree.c | 35 +++-- fs/btrfs/messages.c | 6 - fs/btrfs/messages.h | 2 - fs/btrfs/print-tree.c | 10 +- fs/btrfs/relocation.c | 18 +-- fs/nfsd/vfs.c | 12 +- fs/smb/client/cached_dir.c | 156 +++++++++++---------- fs/smb/client/cached_dir.h | 4 +- fs/smb/client/cifsfs.c | 12 ++ fs/smb/client/cifsglob.h | 4 +- fs/smb/client/cifsproto.h | 2 +- fs/smb/client/connect.c | 19 ++- fs/smb/client/fs_context.c | 11 +- fs/smb/client/fs_context.h | 4 +- fs/smb/client/misc.c | 14 +- fs/smb/client/smb2pdu.c | 2 +- include/linux/hugetlb.h | 6 + include/linux/ieee80211.h | 29 ++++ include/linux/kasan.h | 6 +- include/net/netfilter/nf_flow_table.h | 1 + include/scsi/scsi_device.h | 20 ++- include/trace/events/btrfs.h | 1 - include/uapi/linux/btrfs_tree.h | 6 +- include/uapi/linux/gtp.h | 2 +- io_uring/fdinfo.c | 18 ++- kernel/events/core.c | 3 +- kernel/trace/trace_kprobe.c | 28 +++- lib/maple_tree.c | 2 +- lib/test_maple_tree.c | 35 +++-- mm/damon/sysfs.c | 7 +- mm/hugetlb.c | 48 ++++++- mm/kasan/report.c | 4 +- mm/mempolicy.c | 4 +- mm/migrate.c | 14 +- mm/mmap.c | 6 +- mm/page_alloc.c | 2 +- net/core/neighbour.c | 67 ++++----- net/handshake/netlink.c | 30 +--- net/ipv4/tcp.c | 8 +- net/ipv4/tcp_input.c | 9 +- net/mac80211/rx.c | 3 +- net/netfilter/nf_flow_table_core.c | 14 +- net/sched/act_ct.c | 9 ++ net/vmw_vsock/virtio_transport.c | 18 ++- net/wireless/mlme.c | 3 +- net/wireless/scan.c | 2 +- tools/include/linux/rwsem.h | 40 ++++++ tools/testing/selftests/mm/mremap_dontunmap.c | 1 + 128 files changed, 1175 insertions(+), 583 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/112 riscv: fix set_huge_pte_at() for NAPOT mappings when a swap entry is set
6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Ghiti <[email protected]>
[ Upstream commit 1de195dd0e05d9cba43dec16f83d4ee32af94dd2 ]
We used to determine the number of page table entries to set for a NAPOT hugepage by using the pte value which actually fails when the pte to set is a swap entry.
So take advantage of a recent fix for arm64 reported in [1] which introduces the size of the mapping as an argument of set_huge_pte_at(): we can then use this size to compute the number of page table entries to set for a NAPOT region.
--- arch/riscv/mm/hugetlbpage.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
arch/riscv/mm/hugetlbpage.c +13 -6
@@ -182,15 +182,22 @@ void set_huge_pte_at(struct mm_struct *mm, pte_t *ptep, pte_t pte) { +unsigned long hugepage_shift;int i, pte_num; -if (!pte_napot (pte)) { -set_pte_at (mm, addr, ptep, pte); -return ; - } +if (sz >=PGDIR_SIZE ) + hugepage_shift =PGDIR_SHIFT ; +else if (sz >=P4D_SIZE ) + hugepage_shift =P4D_SHIFT ; +else if (sz >=PUD_SIZE ) + hugepage_shift =PUD_SHIFT ; +else if (sz >=PMD_SIZE ) + hugepage_shift =PMD_SHIFT ; +else + hugepage_shift =PAGE_SHIFT ; - pte_num =napot_pte_num (napot_cont_order (pte)); -for (i =0 ; i < pte_num; i++, ptep++, addr +=PAGE_SIZE ) + pte_num = sz >> hugepage_shift; +for (i =0 ; i < pte_num; i++, ptep++, addr += (1 << hugepage_shift))set_pte_at (mm, addr, ptep, pte); }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 2/112 vdpa/mlx5: Fix firmware error on creation of 1k VQs
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dragos Tatulea <[email protected]>
[ Upstream commit abb0dcf9938c93f765abf8cb45567cadef0af6b2 ]
A firmware error is triggered when configuring a 9k MTU on the PF after
switching to switchdev mode and then using a vdpa device with larger
(1k) rings:mlx5_cmd_out_err: CREATE_GENERAL_OBJECT(0xa00) op_mod(0xd) failed, status bad resource(0x5), syndrome (0xf6db90), err(-22)
This is due to the fact that the hw VQ size parameters are computed based on the umem_1/2/3_buffer_param_a/b capabilities and all device capabilities are read only when the driver is moved to switchdev mode.
The problematic configuration flow looks like this:
1) Create VF
2) Unbind VF
3) Switch PF to switchdev mode.
4) Bind VF
5) Set PF MTU to 9k
6) create vDPA device
7) Start VM with vDPA device and 1K queue size
Note that setting the MTU before step 3) doesn't trigger this issue.
This patch reads the forementioned umem parameters at the latest point possible before the VQs of the device are created.
v2:
- Allocate output with kmalloc to reduce stack frame size.
- Removed stable from cc.
Message-Id: <[email protected]>
--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 63 ++++++++++++++++++++++++++----- drivers/vdpa/mlx5/net/mlx5_vnet.h | 9 +++++ 2 files changed, 63 insertions(+), 9 deletions(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +54 -9
@@ -625,30 +625,70 @@ static void cq_destroy(struct mlx5_vdpa_net *ndev, u16 idx)mlx5_db_free (ndev->mvdev.mdev, &vcq->db); } +static int read_umem_params (struct mlx5_vdpa_net *ndev) +{ +u32 in[MLX5_ST_SZ_DW (query_hca_cap_in)] = {}; +u16 opmod = (MLX5_CAP_VDPA_EMULATION <<1 ) | (HCA_CAP_OPMOD_GET_CUR &0x01 ); +struct mlx5_core_dev *mdev = ndev->mvdev.mdev; +int out_size; +void *caps; +void *out; +int err; + + out_size =MLX5_ST_SZ_BYTES (query_hca_cap_out); + out =kzalloc (out_size,GFP_KERNEL ); +if (!out) +return -ENOMEM ; + +MLX5_SET (query_hca_cap_in, in, opcode,MLX5_CMD_OP_QUERY_HCA_CAP ); +MLX5_SET (query_hca_cap_in, in, op_mod, opmod); + err =mlx5_cmd_exec_inout (mdev, query_hca_cap, in, out); +if (err) { +mlx5_vdpa_warn (&ndev->mvdev, +"Failed reading vdpa umem capabilities with err %d\n" , err); + goto out; + } + + caps =MLX5_ADDR_OF (query_hca_cap_out, out, capability); + + ndev->umem_1_buffer_param_a =MLX5_GET (virtio_emulation_cap, caps, umem_1_buffer_param_a); + ndev->umem_1_buffer_param_b =MLX5_GET (virtio_emulation_cap, caps, umem_1_buffer_param_b); + + ndev->umem_2_buffer_param_a =MLX5_GET (virtio_emulation_cap, caps, umem_2_buffer_param_a); + ndev->umem_2_buffer_param_b =MLX5_GET (virtio_emulation_cap, caps, umem_2_buffer_param_b); + + ndev->umem_3_buffer_param_a =MLX5_GET (virtio_emulation_cap, caps, umem_3_buffer_param_a); + ndev->umem_3_buffer_param_b =MLX5_GET (virtio_emulation_cap, caps, umem_3_buffer_param_b); + +out: +kfree (out); +return 0 ; +} +static void set_umem_size (struct mlx5_vdpa_net *ndev,struct mlx5_vdpa_virtqueue *mvq,int num,struct mlx5_vdpa_umem **umemp) { -struct mlx5_core_dev *mdev = ndev->mvdev.mdev; -int p_a; -int p_b; +u32 p_a; +u32 p_b;switch (num) {case 1 : - p_a =MLX5_CAP_DEV_VDPA_EMULATION (mdev, umem_1_buffer_param_a); - p_b =MLX5_CAP_DEV_VDPA_EMULATION (mdev, umem_1_buffer_param_b); + p_a = ndev->umem_1_buffer_param_a; + p_b = ndev->umem_1_buffer_param_b; *umemp = &mvq->umem1;break ;case 2 : - p_a =MLX5_CAP_DEV_VDPA_EMULATION (mdev, umem_2_buffer_param_a); - p_b =MLX5_CAP_DEV_VDPA_EMULATION (mdev, umem_2_buffer_param_b); + p_a = ndev->umem_2_buffer_param_a; + p_b = ndev->umem_2_buffer_param_b; *umemp = &mvq->umem2;break ;case 3 : - p_a =MLX5_CAP_DEV_VDPA_EMULATION (mdev, umem_3_buffer_param_a); - p_b =MLX5_CAP_DEV_VDPA_EMULATION (mdev, umem_3_buffer_param_b); + p_a = ndev->umem_3_buffer_param_a; + p_b = ndev->umem_3_buffer_param_b; *umemp = &mvq->umem3;break ; } + (*umemp)->size = p_a * mvq->num_ent + p_b; }
@@ -2679,6 +2719,11 @@ static int setup_driver(struct mlx5_vdpa_dev *mvdev) goto out; }mlx5_vdpa_add_debugfs (ndev); + + err =read_umem_params (ndev); +if (err) + goto err_setup; + err =setup_virtqueues (mvdev);if (err) {mlx5_vdpa_warn (mvdev,"setup_virtqueues\n" );
drivers/vdpa/mlx5/net/mlx5_vnet.h +9 -0
@@ -65,6 +65,15 @@ struct mlx5_vdpa_net {struct hlist_head macvlan_hash[MLX5V_MACVLAN_SIZE ];struct mlx5_vdpa_irq_pool irqp;struct dentry *debugfs; + +u32 umem_1_buffer_param_a; +u32 umem_1_buffer_param_b; + +u32 umem_2_buffer_param_a; +u32 umem_2_buffer_param_b; + +u32 umem_3_buffer_param_a; +u32 umem_3_buffer_param_b; };struct mlx5_vdpa_counter {
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 3/112 smb3: allow controlling length of time directory entries are cached with dir leases
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
[ Upstream commit 238b351d0935df568ecb3dc5aef25971778f0f7c ]
Currently with directory leases we cache directory contents for a fixed period of time (default 30 seconds) but for many workloads this is too short. Allow configuring the maximum amount of time directory entries are cached when a directory lease is held on that directory. Add module load parm "max_dir_cache"
For example to set the timeout to 10 minutes you would do:
echo 600 > /sys/module/cifs/parameters/dir_cache_timeout
or to disable caching directory contents:
echo 0 > /sys/module/cifs/parameters/dir_cache_timeout
--- fs/smb/client/cached_dir.c | 4 ++-- fs/smb/client/cifsfs.c | 10 ++++++++++ fs/smb/client/cifsglob.h | 1 + 3 files changed, 13 insertions(+), 2 deletions(-)
fs/smb/client/cached_dir.c +2 -2
@@ -145,7 +145,7 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,const char *npath;if (tcon ==NULL || tcon->cfids ==NULL || tcon->nohandlecache || -is_smb1_server (tcon->ses->server)) +is_smb1_server (tcon->ses->server) || (dir_cache_timeout ==0 ))return -EOPNOTSUPP ; ses = tcon->ses;
@@ -582,7 +582,7 @@ cifs_cfids_laundromat_thread(void *p)return 0 ;spin_lock (&cfids->cfid_list_lock);list_for_each_entry_safe (cfid, q, &cfids->entries, entry) { -if (time_after (jiffies, cfid->time +HZ *30 )) { +if (time_after (jiffies, cfid->time +HZ * dir_cache_timeout)) {list_del (&cfid->entry);list_add (&cfid->entry, &entry); cfids->num_entries--;
fs/smb/client/cifsfs.c +10 -0
@@ -117,6 +117,10 @@ module_param(cifs_max_pending, uint, 0444);MODULE_PARM_DESC (cifs_max_pending,"Simultaneous requests to server for " "CIFS/SMB1 dialect (N/A for SMB3) " "Default: 32767 Range: 2 to 32767." ); +unsigned int dir_cache_timeout =30 ; +module_param (dir_cache_timeout, uint,0644 ); +MODULE_PARM_DESC (dir_cache_timeout,"Number of seconds to cache directory contents for which we have a lease. Default: 30 " +"Range: 1 to 65000 seconds, 0 to disable caching dir contents" );#ifdef CONFIG_CIFS_STATS2 unsigned int slow_rsp_threshold =1 ;module_param (slow_rsp_threshold, uint,0644 );
@@ -1679,6 +1683,12 @@ init_cifs(void) CIFS_MAX_REQ); } +/* Limit max to about 18 hours, and setting to zero disables directory entry caching */ +if (dir_cache_timeout >65000 ) { + dir_cache_timeout =65000 ; +cifs_dbg (VFS ,"dir_cache_timeout set to max of 65000 seconds\n" ); + } + cifsiod_wq =alloc_workqueue ("cifsiod" ,WQ_FREEZABLE |WQ_MEM_RECLAIM ,0 );if (!cifsiod_wq) { rc = -ENOMEM ;
fs/smb/client/cifsglob.h +1 -0
@@ -1987,6 +1987,7 @@ extern unsigned int CIFSMaxBufSize; /* max size not including hdr */extern unsigned int cifs_min_rcv;/* min size of big ntwrk buf pool */ extern unsigned int cifs_min_small;/* min size of small buf pool */ extern unsigned int cifs_max_pending;/* MAX requests at once to server*/ +extern unsigned int dir_cache_timeout;/* max time for directory lease caching of dir */ extern bool disable_legacy_dialects;/* forbid vers=1.0 and vers=2.0 mounts */ extern atomic_t mid_count;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 4/112 smb3: allow controlling maximum number of cached directories
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
[ Upstream commit 6a50d71d0ffff6791737eb502b27f74fb87d0cae ]
Allow adjusting the maximum number of cached directories per share (defaults to 16) via mount parm "max_cached_dirs"
--- fs/smb/client/cached_dir.c | 7 ++++--- fs/smb/client/cached_dir.h | 2 +- fs/smb/client/cifsfs.c | 2 ++ fs/smb/client/cifsglob.h | 1 + fs/smb/client/connect.c | 1 + fs/smb/client/fs_context.c | 11 ++++++++++- fs/smb/client/fs_context.h | 4 +++- 7 files changed, 22 insertions(+), 6 deletions(-)
fs/smb/client/cached_dir.c +4 -3
@@ -18,7 +18,8 @@ static void smb2_close_cached_fid(struct kref *ref);static struct cached_fid *find_or_create_cached_dir (struct cached_fids *cfids,const char *path, -bool lookup_only) +bool lookup_only, +__u32 max_cached_dirs) {struct cached_fid *cfid;
@@ -43,7 +44,7 @@ static struct cached_fid *find_or_create_cached_dir(struct cached_fids *cfids,spin_unlock (&cfids->cfid_list_lock);return NULL ; } -if (cfids->num_entries >=MAX_CACHED_FIDS ) { +if (cfids->num_entries >= max_cached_dirs) {spin_unlock (&cfids->cfid_list_lock);return NULL ; }
@@ -162,7 +163,7 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,if (!utf16_path)return -ENOMEM ; - cfid =find_or_create_cached_dir (cfids, path, lookup_only); + cfid =find_or_create_cached_dir (cfids, path, lookup_only, tcon->max_cached_dirs);if (cfid ==NULL ) {kfree (utf16_path);return -ENOENT ;
fs/smb/client/cached_dir.h +1 -1
@@ -49,7 +49,7 @@ struct cached_fid {struct cached_dirents dirents; }; -#define MAX_CACHED_FIDS 16 +/* default MAX_CACHED_FIDS is 16 */ struct cached_fids {/* Must be held when: * - accessing the cfids->entries list
fs/smb/client/cifsfs.c +2 -0
@@ -699,6 +699,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root)seq_printf (s,",snapshot=%llu" , tcon->snapshot_time);if (tcon->handle_timeout)seq_printf (s,",handletimeout=%u" , tcon->handle_timeout); +if (tcon->max_cached_dirs !=MAX_CACHED_FIDS ) +seq_printf (s,",max_cached_dirs=%u" , tcon->max_cached_dirs);/* * Display file and directory attribute timeout in seconds.
fs/smb/client/cifsglob.h +1 -0
@@ -1192,6 +1192,7 @@ struct cifs_tcon {__u32 max_chunks;__u32 max_bytes_chunk;__u32 max_bytes_copy; +__u32 max_cached_dirs;#ifdef CONFIG_CIFS_FSCACHE u64 resource_id;/* server resource id */ struct fscache_volume *fscache;/* cookie for share */
fs/smb/client/connect.c +1 -0
@@ -2657,6 +2657,7 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) tcon->retry = ctx->retry; tcon->nocase = ctx->nocase; tcon->broken_sparse_sup = ctx->no_sparse; + tcon->max_cached_dirs = ctx->max_cached_dirs;if (ses->server->capabilities &SMB2_GLOBAL_CAP_DIRECTORY_LEASING ) tcon->nohandlecache = ctx->nohandlecache;else
fs/smb/client/fs_context.c +10 -1
@@ -150,6 +150,7 @@ const struct fs_parameter_spec smb3_fs_parameters[] = {fsparam_u32 ("closetimeo" , Opt_closetimeo),fsparam_u32 ("echo_interval" , Opt_echo_interval),fsparam_u32 ("max_credits" , Opt_max_credits), +fsparam_u32 ("max_cached_dirs" , Opt_max_cached_dirs),fsparam_u32 ("handletimeout" , Opt_handletimeout),fsparam_u64 ("snapshot" , Opt_snapshot), fsparam_u32("max_channels", Opt_max_channels),
@@ -1165,6 +1166,14 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,if (result.uint_32 >1 ) ctx->multichannel = true;break ; +case Opt_max_cached_dirs: +if (result.uint_32 <1 ) { +cifs_errorf (fc,"%s: Invalid max_cached_dirs, needs to be 1 or more\n" , + __func__); + goto cifs_parse_mount_err; + } + ctx->max_cached_dirs = result.uint_32; +break ;case Opt_handletimeout: ctx->handle_timeout = result.uint_32;if (ctx->handle_timeout >SMB3_MAX_HANDLE_TIMEOUT ) {
@@ -1593,7 +1602,7 @@ int smb3_init_fs_context(struct fs_context *fc) ctx->acregmax =CIFS_DEF_ACTIMEO ; ctx->acdirmax =CIFS_DEF_ACTIMEO ; ctx->closetimeo =SMB3_DEF_DCLOSETIMEO ; - + ctx->max_cached_dirs =MAX_CACHED_FIDS ;/* Most clients set timeout to 0, allows server to use its default */ ctx->handle_timeout =0 ;/* See MS-SMB2 spec section 2.2.14.2.12 */
fs/smb/client/fs_context.h +3 -1
@@ -128,6 +128,7 @@ enum cifs_param { Opt_closetimeo, Opt_echo_interval, Opt_max_credits, + Opt_max_cached_dirs, Opt_snapshot, Opt_max_channels, Opt_handletimeout,
@@ -261,6 +262,7 @@ struct smb3_fs_context {__u32 handle_timeout;/* persistent and durable handle timeout in ms */ unsigned int max_credits;/* smb3 max_credits 10 < credits < 60000 */ unsigned int max_channels; +unsigned int max_cached_dirs;__u16 compression;/* compression algorithm 0xFFFF default 0=disabled */ bool rootfs:1; /* if it's a SMB root file system */ bool witness:1; /* use witness protocol */
@@ -287,7 +289,7 @@ extern void smb3_update_mnt_flags(struct cifs_sb_info *cifs_sb);*/ #define SMB3_MAX_DCLOSETIMEO (1 << 30)#define SMB3_DEF_DCLOSETIMEO (1 * HZ)/* even 1 sec enough to help eg open/write/close/open/read */ - +#define MAX_CACHED_FIDS 16extern char *cifs_sanitize_prepath (char *prepath,gfp_t gfp);#endif
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 5/112 smb3: do not start laundromat thread when dir leases disabled
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
When no directory lease support, or for IPC shares where directories can not be opened, do not start an unneeded laundromat thread for that mount (it wastes resources).
--- fs/smb/client/cached_dir.c | 6 ++++++ fs/smb/client/cifsglob.h | 2 +- fs/smb/client/cifsproto.h | 2 +- fs/smb/client/connect.c | 8 ++++++-- fs/smb/client/misc.c | 14 +++++++++----- fs/smb/client/smb2pdu.c | 2 +- 6 files changed, 24 insertions(+), 10 deletions(-)
fs/smb/client/cached_dir.c +6 -0
@@ -452,6 +452,9 @@ void invalidate_all_cached_dirs(struct cifs_tcon *tcon)struct cached_fid *cfid, *q;LIST_HEAD (entry); +if (cfids ==NULL ) +return ; +spin_lock (&cfids->cfid_list_lock);list_for_each_entry_safe (cfid, q, &cfids->entries, entry) {list_move (&cfid->entry, &entry);
@@ -651,6 +654,9 @@ void free_cached_dirs(struct cached_fids *cfids)struct cached_fid *cfid, *q;LIST_HEAD (entry); +if (cfids ==NULL ) +return ; +if (cfids->laundromat) {kthread_stop (cfids->laundromat); cfids->laundromat =NULL ;
fs/smb/client/cifsglob.h +1 -1
@@ -1914,7 +1914,7 @@ require use of the stronger protocol */* cifsInodeInfo->lock_sem cifsInodeInfo->llist cifs_init_once * ->can_cache_brlcks * cifsInodeInfo->deferred_lock cifsInodeInfo->deferred_closes cifsInodeInfo_alloc -* cached_fid->fid_mutex cifs_tcon->crfid tconInfoAlloc +* cached_fid->fid_mutex cifs_tcon->crfid tcon_info_alloc * cifsFileInfo->fh_mutex cifsFileInfo cifs_new_fileinfo * cifsFileInfo->file_info_lock cifsFileInfo->count cifs_new_fileinfo * ->invalidHandle initiate_cifs_search
fs/smb/client/cifsproto.h +1 -1
@@ -513,7 +513,7 @@ extern int CIFSSMBLogoff(const unsigned int xid, struct cifs_ses *ses);extern struct cifs_ses *sesInfoAlloc (void );extern void sesInfoFree (struct cifs_ses *); -extern struct cifs_tcon *tconInfoAlloc (void ); +extern struct cifs_tcon *tcon_info_alloc (bool dir_leases_enabled);extern void tconInfoFree (struct cifs_tcon *); extern int cifs_sign_rqst(struct smb_rqst *rqst, struct TCP_Server_Info *server,
fs/smb/client/connect.c +6 -2
@@ -1882,7 +1882,8 @@ cifs_setup_ipc(struct cifs_ses *ses, struct smb3_fs_context *ctx) } } - tcon =tconInfoAlloc (); +/* no need to setup directory caching on IPC share, so pass in false */ + tcon =tcon_info_alloc (false);if (tcon ==NULL )return -ENOMEM ;
@@ -2492,7 +2493,10 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) goto out_fail; } - tcon =tconInfoAlloc (); +if (ses->server->capabilities &SMB2_GLOBAL_CAP_DIRECTORY_LEASING ) + tcon =tcon_info_alloc (true); +else + tcon =tcon_info_alloc (false);if (tcon ==NULL ) { rc = -ENOMEM ; goto out_fail;
fs/smb/client/misc.c +9 -5
@@ -113,18 +113,22 @@ sesInfoFree(struct cifs_ses *buf_to_free) }struct cifs_tcon * -tconInfoAlloc (void ) +tcon_info_alloc (bool dir_leases_enabled) {struct cifs_tcon *ret_buf; ret_buf =kzalloc (sizeof (*ret_buf),GFP_KERNEL );if (!ret_buf)return NULL ; - ret_buf->cfids =init_cached_dirs (); -if (!ret_buf->cfids) { -kfree (ret_buf); -return NULL ; + +if (dir_leases_enabled == true) { + ret_buf->cfids =init_cached_dirs (); +if (!ret_buf->cfids) { +kfree (ret_buf); +return NULL ; + } } +/* else ret_buf->cfids is already set to NULL above */ atomic_inc (&tconInfoAllocCount); ret_buf->status =TID_NEW ;
fs/smb/client/smb2pdu.c +1 -1
@@ -3871,7 +3871,7 @@ void smb2_reconnect_server(struct work_struct *work) goto done;/* allocate a dummy tcon struct used for reconnect */ - tcon =tconInfoAlloc (); + tcon =tcon_info_alloc (false);if (!tcon) { resched = true;list_for_each_entry_safe (ses, ses2, &tmp_ses_list, rlist) {
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 6/112 smb: client: do not start laundromat thread on nohandlecache
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <[email protected]>
[ Upstream commit 3b8bb3171571f92eda863e5f78b063604c61f72a ]
Honor 'nohandlecache' mount option by not starting laundromat thread even when SMB server supports directory leases. Do not waste system resources by having laundromat thread running with no directory caching at all.
--- fs/smb/client/connect.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
fs/smb/client/connect.c +8 -8
@@ -2474,8 +2474,9 @@ cifs_put_tcon(struct cifs_tcon *tcon)static struct cifs_tcon *cifs_get_tcon (struct cifs_ses *ses,struct smb3_fs_context *ctx) { -int rc, xid;struct cifs_tcon *tcon; +bool nohandlecache; +int rc, xid; tcon =cifs_find_tcon (ses, ctx);if (tcon) {
@@ -2493,14 +2494,17 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) goto out_fail; } -if (ses->server->capabilities &SMB2_GLOBAL_CAP_DIRECTORY_LEASING ) - tcon =tcon_info_alloc (true); +if (ses->server->dialect >=SMB20_PROT_ID && + (ses->server->capabilities &SMB2_GLOBAL_CAP_DIRECTORY_LEASING )) + nohandlecache = ctx->nohandlecache;else - tcon =tcon_info_alloc (false); + nohandlecache = true; + tcon =tcon_info_alloc (!nohandlecache);if (tcon ==NULL ) { rc = -ENOMEM ; goto out_fail; } + tcon->nohandlecache = nohandlecache;if (ctx->snapshot_time) {if (ses->server->vals->protocol_id ==0 ) {
@@ -2662,10 +2666,6 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) tcon->nocase = ctx->nocase; tcon->broken_sparse_sup = ctx->no_sparse; tcon->max_cached_dirs = ctx->max_cached_dirs; -if (ses->server->capabilities &SMB2_GLOBAL_CAP_DIRECTORY_LEASING ) - tcon->nohandlecache = ctx->nohandlecache; -else - tcon->nohandlecache = true; tcon->nodelete = ctx->nodelete; tcon->local_lease = ctx->local_lease;INIT_LIST_HEAD (&tcon->pending_opens);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 7/112 smb: client: make laundromat a delayed worker
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <[email protected]>
[ Upstream commit e95f3f74465072c2545d8e65a3c3a96e37129cf8 ]
By having laundromat kthread processing cached directories on every second turned out to be overkill, especially when having multiple SMB mounts.
Relax it by using a delayed worker instead that gets scheduled on every @dir_cache_timeout (default=30) seconds per tcon.
This also fixes the 1s delay when tearing down tcon.
--- fs/smb/client/cached_dir.c | 89 +++++++++++++++----------------------- fs/smb/client/cached_dir.h | 2 +- 2 files changed, 36 insertions(+), 55 deletions(-)
fs/smb/client/cached_dir.c +35 -54
@@ -15,6 +15,7 @@static struct cached_fid *init_cached_dir (const char *path);static void free_cached_dir (struct cached_fid *cfid);static void smb2_close_cached_fid (struct kref *ref); +static void cfids_laundromat_worker (struct work_struct *work); static struct cached_fid *find_or_create_cached_dir(struct cached_fids *cfids, const char *path,
@@ -572,53 +573,46 @@ static void free_cached_dir(struct cached_fid *cfid)kfree (cfid); } -static int -cifs_cfids_laundromat_thread (void *p) +static void cfids_laundromat_worker (struct work_struct *work) { -struct cached_fids *cfids = p; +struct cached_fids *cfids;struct cached_fid *cfid, *q; -struct list_head entry; +LIST_HEAD (entry); -while (!kthread_should_stop ()) { -ssleep (1 ); -INIT_LIST_HEAD (&entry); -if (kthread_should_stop ()) -return 0 ; -spin_lock (&cfids->cfid_list_lock); -list_for_each_entry_safe (cfid, q, &cfids->entries, entry) { -if (time_after (jiffies, cfid->time +HZ * dir_cache_timeout)) { -list_del (&cfid->entry); -list_add (&cfid->entry, &entry); - cfids->num_entries--; - } + cfids = container_of(work, struct cached_fids, laundromat_work.work); + +spin_lock (&cfids->cfid_list_lock); +list_for_each_entry_safe (cfid, q, &cfids->entries, entry) { +if (time_after (jiffies, cfid->time +HZ * dir_cache_timeout)) { +list_move (&cfid->entry, &entry); + cfids->num_entries--; } -spin_unlock (&cfids->cfid_list_lock); + } +spin_unlock (&cfids->cfid_list_lock); -list_for_each_entry_safe (cfid, q, &entry, entry) { - cfid->on_list = false; -list_del (&cfid->entry); +list_for_each_entry_safe (cfid, q, &entry, entry) { + cfid->on_list = false; +list_del (&cfid->entry); +/* +* Cancel and wait for the work to finish in case we are racing +* with it. +*/ +cancel_work_sync (&cfid->lease_break); +if (cfid->has_lease) {/* -* Cancel, and wait for the work to finish in -* case we are racing with it. +* Our lease has not yet been cancelled from the server +* so we need to drop the reference. */ -cancel_work_sync (&cfid->lease_break); -if (cfid->has_lease) { -/* -* We lease has not yet been cancelled from -* the server so we need to drop the reference. -*/ -spin_lock (&cfids->cfid_list_lock); - cfid->has_lease = false; -spin_unlock (&cfids->cfid_list_lock); -kref_put (&cfid->refcount, smb2_close_cached_fid); - } +spin_lock (&cfids->cfid_list_lock); + cfid->has_lease = false; +spin_unlock (&cfids->cfid_list_lock); +kref_put (&cfid->refcount, smb2_close_cached_fid); } } - -return 0 ; +queue_delayed_work (cifsiod_wq, &cfids->laundromat_work, + dir_cache_timeout *HZ ); } -struct cached_fids *init_cached_dirs (void ) {struct cached_fids *cfids;
@@ -629,19 +623,10 @@ struct cached_fids *init_cached_dirs(void)spin_lock_init (&cfids->cfid_list_lock);INIT_LIST_HEAD (&cfids->entries); -/* -* since we're in a cifs function already, we know that -* this will succeed. No need for try_module_get(). -*/ -__module_get (THIS_MODULE ); - cfids->laundromat =kthread_run (cifs_cfids_laundromat_thread, - cfids,"cifsd-cfid-laundromat" ); -if (IS_ERR (cfids->laundromat)) { -cifs_dbg (VFS ,"Failed to start cfids laundromat thread.\n" ); -kfree (cfids); -module_put (THIS_MODULE ); -return NULL ; - } +INIT_DELAYED_WORK (&cfids->laundromat_work, cfids_laundromat_worker); +queue_delayed_work (cifsiod_wq, &cfids->laundromat_work, + dir_cache_timeout *HZ ); +return cfids; }
@@ -657,11 +642,7 @@ void free_cached_dirs(struct cached_fids *cfids)if (cfids ==NULL )return ; -if (cfids->laundromat) { -kthread_stop (cfids->laundromat); - cfids->laundromat =NULL ; -module_put (THIS_MODULE ); - } +cancel_delayed_work_sync (&cfids->laundromat_work);spin_lock (&cfids->cfid_list_lock);list_for_each_entry_safe (cfid, q, &cfids->entries, entry) {
fs/smb/client/cached_dir.h +1 -1
@@ -57,7 +57,7 @@ struct cached_fids {spinlock_t cfid_list_lock;int num_entries;struct list_head entries; -struct task_struct *laundromat; +struct delayed_work laundromat_work; };extern struct cached_fids *init_cached_dirs (void );
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 8/112 smb: client: prevent new fids from being removed by laundromat
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <[email protected]>
[ Upstream commit 81ba10959970d15c388bf29866b01b62f387e6a3 ]
Check if @cfid->time is set in laundromat so we guarantee that only fully cached fids will be selected for removal. While we're at it, add missing locks to protect access of @cfid fields in order to avoid races with open_cached_dir() and cfids_laundromat_worker(), respectively.
--- fs/smb/client/cached_dir.c | 56 ++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 21 deletions(-)
fs/smb/client/cached_dir.c +35 -21
@@ -170,15 +170,18 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,return -ENOENT ; }/* -* At this point we either have a lease already and we can just -* return it. If not we are guaranteed to be the only thread accessing -* this cfid. +* Return cached fid if it has a lease. Otherwise, it is either a new +* entry or laundromat worker removed it from @cfids->entries. Caller +* will put last reference if the latter. */ +spin_lock (&cfids->cfid_list_lock);if (cfid->has_lease) { +spin_unlock (&cfids->cfid_list_lock); *ret_cfid = cfid;kfree (utf16_path);return 0 ; } +spin_unlock (&cfids->cfid_list_lock);/* * Skip any prefix paths in @path as lookup_positive_unlocked() ends up
@@ -295,9 +298,11 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon, goto oshr_free; } } +spin_lock (&cfids->cfid_list_lock); cfid->dentry = dentry; cfid->time = jiffies; cfid->has_lease = true; +spin_unlock (&cfids->cfid_list_lock); oshr_free:kfree (utf16_path);
@@ -306,24 +311,28 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,free_rsp_buf (resp_buftype[0 ], rsp_iov[0 ].iov_base);free_rsp_buf (resp_buftype[1 ], rsp_iov[1 ].iov_base);spin_lock (&cfids->cfid_list_lock); -if (rc && !cfid->has_lease) { -if (cfid->on_list) { -list_del (&cfid->entry); - cfid->on_list = false; - cfids->num_entries--; +if (!cfid->has_lease) { +if (rc) { +if (cfid->on_list) { +list_del (&cfid->entry); + cfid->on_list = false; + cfids->num_entries--; + } + rc = -ENOENT ; + }else { +/* +* We are guaranteed to have two references at this +* point. One for the caller and one for a potential +* lease. Release the Lease-ref so that the directory +* will be closed when the caller closes the cached +* handle. +*/ +spin_unlock (&cfids->cfid_list_lock); +kref_put (&cfid->refcount, smb2_close_cached_fid); + goto out; } - rc = -ENOENT ; }spin_unlock (&cfids->cfid_list_lock); -if (!rc && !cfid->has_lease) { -/* -* We are guaranteed to have two references at this point. -* One for the caller and one for a potential lease. -* Release the Lease-ref so that the directory will be closed -* when the caller closes the cached handle. -*/ -kref_put (&cfid->refcount, smb2_close_cached_fid); - }if (rc) {if (cfid->is_open) SMB2_close(0, cfid->tcon, cfid->fid.persistent_fid,
@@ -331,7 +340,7 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,free_cached_dir (cfid); cfid =NULL ; } - +out:if (rc ==0 ) { *ret_cfid = cfid;atomic_inc (&tcon->num_remote_opens);
@@ -583,15 +592,18 @@ static void cfids_laundromat_worker(struct work_struct *work)spin_lock (&cfids->cfid_list_lock);list_for_each_entry_safe (cfid, q, &cfids->entries, entry) { -if (time_after (jiffies, cfid->time +HZ * dir_cache_timeout)) { +if (cfid->time && +time_after (jiffies, cfid->time +HZ * dir_cache_timeout)) { + cfid->on_list = false;list_move (&cfid->entry, &entry); cfids->num_entries--; +/* To prevent race with smb2_cached_lease_break() */ +kref_get (&cfid->refcount); } }spin_unlock (&cfids->cfid_list_lock);list_for_each_entry_safe (cfid, q, &entry, entry) { - cfid->on_list = false;list_del (&cfid->entry);/* * Cancel and wait for the work to finish in case we are racing
@@ -608,6 +620,8 @@ static void cfids_laundromat_worker(struct work_struct *work)spin_unlock (&cfids->cfid_list_lock);kref_put (&cfid->refcount, smb2_close_cached_fid); } +/* Drop the extra reference opened above */ +kref_put (&cfid->refcount, smb2_close_cached_fid); }queue_delayed_work (cifsiod_wq, &cfids->laundromat_work, dir_cache_timeout *HZ );
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 9/112 virtio_balloon: Fix endless deflation and inflation on arm64
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gavin Shan <[email protected]>
commit 07622bd415639e9709579f400afd19e7e9866e5e upstream.
The deflation request to the target, which isn't unaligned to the guest page size causes endless deflation and inflation actions. For example, we receive the flooding QMP events for the changes on memory balloon's size after a deflation request to the unaligned target is sent for the ARM64 guest, where we have 64KB base page size.
/home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \
-accel kvm -machine virt,gic-version=host -cpu host \
-smp maxcpus=8,cpus=8,sockets=2,clusters=2,cores=2,threads=1 \
-m 1024M,slots=16,maxmem=64G \
-object memory-backend-ram,id=mem0,size=512M \
-object memory-backend-ram,id=mem1,size=512M \
-numa node,nodeid=0,memdev=mem0,cpus=0-3 \
-numa node,nodeid=1,memdev=mem1,cpus=4-7 \
: \
-device virtio-balloon-pci,id=balloon0,bus=pcie.10
{ "execute" : "balloon", "arguments": { "value" : 1073672192 } }
{"return": {}}
{"timestamp": {"seconds": 1693272173, "microseconds": 88667}, \
"event": "BALLOON_CHANGE", "data": {"actual": 1073610752}}
{"timestamp": {"seconds": 1693272174, "microseconds": 89704}, \
"event": "BALLOON_CHANGE", "data": {"actual": 1073610752}}
{"timestamp": {"seconds": 1693272175, "microseconds": 90819}, \
"event": "BALLOON_CHANGE", "data": {"actual": 1073610752}}
{"timestamp": {"seconds": 1693272176, "microseconds": 91961}, \
"event": "BALLOON_CHANGE", "data": {"actual": 1073610752}}
{"timestamp": {"seconds": 1693272177, "microseconds": 93040}, \
"event": "BALLOON_CHANGE", "data": {"actual": 1073676288}}
{"timestamp": {"seconds": 1693272178, "microseconds": 94117}, \
"event": "BALLOON_CHANGE", "data": {"actual": 1073676288}}
{"timestamp": {"seconds": 1693272179, "microseconds": 95337}, \
"event": "BALLOON_CHANGE", "data": {"actual": 1073610752}}
{"timestamp": {"seconds": 1693272180, "microseconds": 96615}, \
"event": "BALLOON_CHANGE", "data": {"actual": 1073676288}}
{"timestamp": {"seconds": 1693272181, "microseconds": 97626}, \
"event": "BALLOON_CHANGE", "data": {"actual": 1073610752}}
{"timestamp": {"seconds": 1693272182, "microseconds": 98693}, \
"event": "BALLOON_CHANGE", "data": {"actual": 1073676288}}
{"timestamp": {"seconds": 1693272183, "microseconds": 99698}, \
"event": "BALLOON_CHANGE", "data": {"actual": 1073610752}}
{"timestamp": {"seconds": 1693272184, "microseconds": 100727}, \
"event": "BALLOON_CHANGE", "data": {"actual": 1073610752}}
{"timestamp": {"seconds": 1693272185, "microseconds": 90430}, \
"event": "BALLOON_CHANGE", "data": {"actual": 1073610752}}
{"timestamp": {"seconds": 1693272186, "microseconds": 102999}, \
"event": "BALLOON_CHANGE", "data": {"actual": 1073676288}}
:
<The similar QMP events repeat>Fix it by aligning the target up to the guest page size, 64KB in this specific case. With this applied, no flooding QMP events are observed and the memory balloon's size can be stablizied to 0x3ffe0000 soon after the deflation request is sent.
{ "execute" : "balloon", "arguments": { "value" : 1073672192 } }
{"return": {}}
{"timestamp": {"seconds": 1693273328, "microseconds": 793075}, \
"event": "BALLOON_CHANGE", "data": {"actual": 1073610752}}
{ "execute" : "query-balloon" }
{"return": {"actual": 1073610752}}Message-Id: <[email protected]>
--- drivers/virtio/virtio_balloon.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/virtio/virtio_balloon.c +5 -1
@@ -395,7 +395,11 @@ static inline s64 towards_target(struct virtio_cread_le(vb->vdev, struct virtio_balloon_config, num_pages, &num_pages); - target = num_pages; +/* +* Aligned up to guest page size to avoid inflating and deflating +* balloon endlessly. +*/ + target =ALIGN (num_pages,VIRTIO_BALLOON_PAGES_PER_PAGE );return target - vb->num_pages; }
Greg Kroah-Hartman
maintainerPATCH 10/112 virtio-mmio: fix memory leak of vm_dev
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maximilian Heyne <[email protected]>
commit fab7f259227b8f70aa6d54e1de1a1f5f4729041c upstream.
With the recent removal of vm_dev from devres its memory is only freed via the callback virtio_mmio_release_dev. However, this only takes effect after device_add is called by register_virtio_device. Until then it's an unmanaged resource and must be explicitly freed on error exit.
This bug was discovered and resolved using Coverity Static Analysis Security Testing (SAST) by Synopsys, Inc.
Message-Id: <[email protected]>
--- drivers/virtio/virtio_mmio.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/virtio/virtio_mmio.c +14 -5
@@ -631,14 +631,17 @@ static int virtio_mmio_probe(struct platspin_lock_init (&vm_dev->lock); vm_dev->base =devm_platform_ioremap_resource (pdev,0 ); -if (IS_ERR (vm_dev->base)) -return PTR_ERR (vm_dev->base); +if (IS_ERR (vm_dev->base)) { + rc =PTR_ERR (vm_dev->base); + goto free_vm_dev; + }/* Check magic value */ magic =readl (vm_dev->base +VIRTIO_MMIO_MAGIC_VALUE );if (magic != ('v' |'i' <<8 |'r' <<16 |'t' <<24 )) {dev_warn (&pdev->dev,"Wrong magic value 0x%08lx!\n" , magic); -return -ENODEV ; + rc = -ENODEV ; + goto free_vm_dev; }/* Check device version */
@@ -646,7 +649,8 @@ static int virtio_mmio_probe(struct platif (vm_dev->version <1 || vm_dev->version >2 ) {dev_err (&pdev->dev,"Version %ld not supported!\n" , vm_dev->version); -return -ENXIO ; + rc = -ENXIO ; + goto free_vm_dev; } vm_dev->vdev.id.device =readl (vm_dev->base +VIRTIO_MMIO_DEVICE_ID );
@@ -655,7 +659,8 @@ static int virtio_mmio_probe(struct plat* virtio-mmio device with an ID 0 is a (dummy) placeholder * with no function. End probing now with no error reported. */ -return -ENODEV ; + rc = -ENODEV ; + goto free_vm_dev; } vm_dev->vdev.id.vendor =readl (vm_dev->base +VIRTIO_MMIO_VENDOR_ID );
@@ -685,6 +690,10 @@ static int virtio_mmio_probe(struct platput_device (&vm_dev->vdev.dev);return rc; + +free_vm_dev: +kfree (vm_dev); +return rc; }static int virtio_mmio_remove (struct platform_device *pdev)
Greg Kroah-Hartman
maintainerPATCH 11/112 virtio-crypto: handle config changed by work queue
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: zhenwei pi <[email protected]>
commit fa2e6947aa8844f25f5bad0d8cd1a541d9bc83eb upstream.
MST pointed out: config change callback is also handled incorrectly in this driver, it takes a mutex from interrupt context.
Handle config changed by work queue instead.
Message-Id: <[email protected]>
--- drivers/crypto/virtio/virtio_crypto_common.h | 3 +++ drivers/crypto/virtio/virtio_crypto_core.c | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-)
drivers/crypto/virtio/virtio_crypto_common.h +3 -0
@@ -35,6 +35,9 @@ struct virtio_crypto {struct virtqueue *ctrl_vq;struct data_queue *data_vq; +/* Work struct for config space updates */ +struct work_struct config_work; +/* To protect the vq operations for the controlq */ spinlock_t ctrl_lock;
drivers/crypto/virtio/virtio_crypto_core.c +13 -1
@@ -335,6 +335,14 @@ static void virtcrypto_del_vqs(struct vivirtcrypto_free_queues (vcrypto); } +static void vcrypto_config_changed_work (struct work_struct *work) +{ +struct virtio_crypto *vcrypto = + container_of(work, struct virtio_crypto, config_work); + +virtcrypto_update_status (vcrypto); +} +static int virtcrypto_probe (struct virtio_device *vdev) {int err = -EFAULT ;
@@ -454,6 +462,8 @@ static int virtcrypto_probe(struct virtiif (err) goto free_engines; +INIT_WORK (&vcrypto->config_work, vcrypto_config_changed_work); +return 0 ; free_engines:
@@ -490,6 +500,7 @@ static void virtcrypto_remove(struct virdev_info (&vdev->dev,"Start virtcrypto_remove.\n" ); +flush_work (&vcrypto->config_work);if (virtcrypto_dev_started (vcrypto))virtcrypto_dev_stop (vcrypto);virtio_reset_device (vdev);
@@ -504,7 +515,7 @@ static void virtcrypto_config_changed(st {struct virtio_crypto *vcrypto = vdev->priv; -virtcrypto_update_status (vcrypto); +schedule_work (&vcrypto->config_work); }#ifdef CONFIG_PM_SLEEP
@@ -512,6 +523,7 @@ static int virtcrypto_freeze(struct virt {struct virtio_crypto *vcrypto = vdev->priv; +flush_work (&vcrypto->config_work);virtio_reset_device (vdev);virtcrypto_free_unused_reqs (vcrypto);if (virtcrypto_dev_started (vcrypto))
Greg Kroah-Hartman
maintainerPATCH 12/112 virtio_pci: fix the common cfg map size
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xuan Zhuo <[email protected]>
commit 061b39fdfe7fd98946e67637213bcbb10a318cca upstream.
The function vp_modern_map_capability() takes the size parameter, which corresponds to the size of virtio_pci_common_cfg. As a result, this indicates the size of memory area to map.
Now the size is the size of virtio_pci_common_cfg, but some feature(such as the _F_RING_RESET) needs the virtio_pci_modern_common_cfg, so this commit changes the size to the size of virtio_pci_modern_common_cfg.
Message-Id: <[email protected]>
--- drivers/virtio/virtio_pci_modern_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virtio/virtio_pci_modern_dev.c +1 -1
@@ -291,7 +291,7 @@ int vp_modern_probe(struct virtio_pci_mo err = -EINVAL ; mdev->common =vp_modern_map_capability (mdev, common,sizeof (struct virtio_pci_common_cfg ),4 , -0 ,sizeof (struct virtio_pci_common_cfg ), +0 ,sizeof (struct virtio_pci_modern_common_cfg ),NULL ,NULL );if (!mdev->common) goto err_map_common;
Greg Kroah-Hartman
maintainerPATCH 13/112 vsock/virtio: initialize the_virtio_vsock before using VQs
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandru Matei <[email protected]>
commit 53b08c4985158430fd6d035fb49443bada535210 upstream.
Once VQs are filled with empty buffers and we kick the host, it can send connection requests. If the_virtio_vsock is not initialized before, replies are silently dropped and do not reach the host.
virtio_transport_send_pkt() can queue packets once the_virtio_vsock is set, but they won't be processed until vsock->tx_run is set to true. We queue vsock->send_pkt_work when initialization finishes to send those packets queued earlier.
--- net/vmw_vsock/virtio_transport.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
net/vmw_vsock/virtio_transport.c +17 -1
@@ -555,6 +555,11 @@ static int virtio_vsock_vqs_init(structvirtio_device_ready (vdev); +return 0 ; +} + +static void virtio_vsock_vqs_start (struct virtio_vsock *vsock) +{mutex_lock (&vsock->tx_lock); vsock->tx_run = true;mutex_unlock (&vsock->tx_lock);
@@ -569,7 +574,16 @@ static int virtio_vsock_vqs_init(struct vsock->event_run = true;mutex_unlock (&vsock->event_lock); -return 0 ; +/* virtio_transport_send_pkt() can queue packets once +* the_virtio_vsock is set, but they won't be processed until +* vsock->tx_run is set to true. We queue vsock->send_pkt_work +* when initialization finishes to send those packets queued +* earlier. +* We don't need to queue the other workers (rx, event) because +* as long as we don't fill the queues with empty buffers, the +* host can't send us any notification. +*/ +queue_work (virtio_vsock_workqueue, &vsock->send_pkt_work); }static void virtio_vsock_vqs_del (struct virtio_vsock *vsock)
@@ -664,6 +678,7 @@ static int virtio_vsock_probe(struct vir goto out;rcu_assign_pointer (the_virtio_vsock, vsock); +virtio_vsock_vqs_start (vsock);mutex_unlock (&the_virtio_vsock_mutex);
@@ -736,6 +751,7 @@ static int virtio_vsock_restore(struct v goto out;rcu_assign_pointer (the_virtio_vsock, vsock); +virtio_vsock_vqs_start (vsock); out:mutex_unlock (&the_virtio_vsock_mutex);
Greg Kroah-Hartman
maintainerPATCH 14/112 vhost: Allow null msg.size on VHOST_IOTLB_INVALIDATE
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Auger <[email protected]>
commit ca50ec377c2e94b0a9f8735de2856cd0f13beab4 upstream.
Commit e2ae38cf3d91 ("vhost: fix hung thread due to erroneous iotlb entries") Forbade vhost iotlb msg with null size to prevent entries with size = start = 0 and last = ULONG_MAX to end up in the iotlb.
Then commit 95932ab2ea07 ("vhost: allow batching hint without size") only applied the check for VHOST_IOTLB_UPDATE and VHOST_IOTLB_INVALIDATE message types to fix a regression observed with batching hit.
Still, the introduction of that check introduced a regression for some users attempting to invalidate the whole ULONG_MAX range by setting the size to 0. This is the case with qemu/smmuv3/vhost integration which does not work anymore. It Looks safe to partially revert the original commit and allow VHOST_IOTLB_INVALIDATE messages with null size. vhost_iotlb_del_range() will compute a correct end iova. Same for vhost_vdpa_iotlb_unmap().
Message-Id: <[email protected]>
--- drivers/vhost/vhost.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/vhost/vhost.c +1 -3
@@ -1458,9 +1458,7 @@ ssize_t vhost_chr_write_iter(struct vhos goto done; } -if ((msg.type ==VHOST_IOTLB_UPDATE || - msg.type ==VHOST_IOTLB_INVALIDATE ) && - msg.size ==0 ) { +if (msg.type ==VHOST_IOTLB_UPDATE && msg.size ==0 ) { ret = -EINVAL ; goto done; }
Greg Kroah-Hartman
maintainerPATCH 15/112 arm64: dts: qcom: apq8096-db820c: fix missing clock populate
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 2ca3e844e3f978c0dbc95072dbf379abfc4a27db upstream.
Commit 704e26678c8d ("arm64: dts: qcom: apq8096-db820c: drop simple-bus from clocks") removed "simple-bus" compatible from "clocks" node, but one of the clocks - divclk1 - is a gpio-gate-clock, which does not have CLK_OF_DECLARE. This means it will not be instantiated if placed in some subnode. Move the clocks to the root node, so regular devices will be populated.
--- arch/arm64/boot/dts/qcom/apq8096-db820c.dts | 32 ++++++++++----------- 1 file changed, 15 insertions(+), 17 deletions(-)
arch/arm64/boot/dts/qcom/apq8096-db820c.dts +15 -17
@@ -62,25 +62,23 @@ chosen { stdout-path = "serial0:115200n8"; }; - clocks { - divclk4: divclk4 { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <32768>; - clock-output-names = "divclk4"; + div1_mclk: divclk1 { + compatible = "gpio-gate-clock"; + pinctrl-0 = <&audio_mclk>; + pinctrl-names = "default"; + clocks = <&rpmcc RPM_SMD_DIV_CLK1>; + #clock-cells = <0>; + enable-gpios = <&pm8994_gpios 15 0>; + }; - pinctrl-names = "default"; - pinctrl-0 = <&divclk4_pin_a>; - }; + divclk4: divclk4 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <32768>; + clock-output-names = "divclk4"; - div1_mclk: divclk1 { - compatible = "gpio-gate-clock"; - pinctrl-0 = <&audio_mclk>; - pinctrl-names = "default"; - clocks = <&rpmcc RPM_SMD_DIV_CLK1>; - #clock-cells = <0>; - enable-gpios = <&pm8994_gpios 15 0>; - }; + pinctrl-names = "default"; + pinctrl-0 = <&divclk4_pin_a>; }; gpio-keys {
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 16/112 arm64: dts: qcom: msm8996-xiaomi: fix missing clock populate
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 725f593692ceedeab639b661298955b6f9ba8ec3 upstream.
Commit 338958e30c68 ("arm64: dts: qcom: msm8996-xiaomi: drop simple-bus from clocks") removed "simple-bus" compatible from "clocks" node, but one of the clocks - divclk1 - is a gpio-gate-clock, which does not have CLK_OF_DECLARE. This means it will not be instantiated if placed in some subnode. Move the clocks to the root node, so regular devices will be populated.
--- .../boot/dts/qcom/msm8996-xiaomi-common.dtsi | 32 +++++++++---------- .../boot/dts/qcom/msm8996-xiaomi-gemini.dts | 18 +++++------ 2 files changed, 23 insertions(+), 27 deletions(-)
arch/arm64/boot/dts/qcom/msm8996-xiaomi-common.dtsi +15 -17
@@ -11,26 +11,24 @@ #include <dt-bindings/pinctrl/qcom,pmic-gpio.h> / { - clocks { - divclk1_cdc: divclk1 { - compatible = "gpio-gate-clock"; - clocks = <&rpmcc RPM_SMD_DIV_CLK1>; - #clock-cells = <0>; - enable-gpios = <&pm8994_gpios 15 GPIO_ACTIVE_HIGH>; + divclk1_cdc: divclk1 { + compatible = "gpio-gate-clock"; + clocks = <&rpmcc RPM_SMD_DIV_CLK1>; + #clock-cells = <0>; + enable-gpios = <&pm8994_gpios 15 GPIO_ACTIVE_HIGH>; - pinctrl-names = "default"; - pinctrl-0 = <&divclk1_default>; - }; + pinctrl-names = "default"; + pinctrl-0 = <&divclk1_default>; + }; - divclk4: divclk4 { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <32768>; - clock-output-names = "divclk4"; + divclk4: divclk4 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <32768>; + clock-output-names = "divclk4"; - pinctrl-names = "default"; - pinctrl-0 = <&divclk4_pin_a>; - }; + pinctrl-names = "default"; + pinctrl-0 = <&divclk4_pin_a>; }; gpio-keys {
arch/arm64/boot/dts/qcom/msm8996-xiaomi-gemini.dts +8 -10
@@ -20,16 +20,14 @@ / { qcom,pmic-id = <0x20009 0x2000a 0x00 0x00>; qcom,board-id = <31 0>; - clocks { - divclk2_haptics: divclk2 { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <32768>; - clock-output-names = "divclk2"; - - pinctrl-names = "default"; - pinctrl-0 = <&divclk2_pin_a>; - }; + divclk2_haptics: divclk2 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <32768>; + clock-output-names = "divclk2"; + + pinctrl-names = "default"; + pinctrl-0 = <&divclk2_pin_a>; }; };
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 17/112 arm64: dts: rockchip: use codec as clock master on px30-ringneck-haikou
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ermin Sunj <[email protected]>
commit 84fa1865edbb3800f3344e2a5bc73c187adf42d0 upstream.
If the codec is not the clock master, the MCLK needs to be synchronous to both I2S_SCL ans I2S_LRCLK. We do not have that on Haikou, causing distorted audio.
Before:
Running an audio test script on Ringneck, 1kHz output sine wave is not stable and shows distortion.
After:
10h audio test script loop failed only one time.
That is 0.00014% failure rate.
--- arch/arm64/boot/dts/rockchip/px30-ringneck-haikou.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/rockchip/px30-ringneck-haikou.dts +3 -3
@@ -68,15 +68,15 @@ i2s0-sound { simple-audio-card,format = "i2s"; simple-audio-card,name = "Haikou,I2S-codec"; simple-audio-card,mclk-fs = <512>; + simple-audio-card,frame-master = <&sgtl5000_codec>; + simple-audio-card,bitclock-master = <&sgtl5000_codec>; - simple-audio-card,codec { + sgtl5000_codec: simple-audio-card,codec { clocks = <&sgtl5000_clk>; sound-dai = <&sgtl5000>; }; simple-audio-card,cpu { - bitclock-master; - frame-master; sound-dai = <&i2s0_8ch>; }; };
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 18/112 arm64: dts: rockchip: set codec system-clock-fixed on px30-ringneck-haikou
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakob Unterwurzacher <[email protected]>
commit 1e585cd0aad3d491938230318d6d479f09589fd8 upstream.
Having sgtl5000_clk defines as "fixed-clock" is not enough to prevent the dai subsystem from overwriting the frequency via sgtl5000_set_dai_sysclk.
Setting system-clock-fixed does the job, and now a 1kHz sine wave comes out as actually 1kHz, no matter the sample rate of the source.
Testcase: These should sound the same:
speaker-test -r 48000 -t sine -f 1000
speaker-test -r 24000 -t sine -f 1000
Also remove the clock link here as having it in sgtl5000 and sgtl5000_codec causes duplicate clock unprepares with associated backtrace.
--- arch/arm64/boot/dts/rockchip/px30-ringneck-haikou.dts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/px30-ringneck-haikou.dts +3 -1
@@ -72,8 +72,10 @@ i2s0-sound { simple-audio-card,bitclock-master = <&sgtl5000_codec>; sgtl5000_codec: simple-audio-card,codec { - clocks = <&sgtl5000_clk>; sound-dai = <&sgtl5000>; + // Prevent the dai subsystem from overwriting the clock + // frequency. We are using a fixed-frequency oscillator. + system-clock-fixed; }; simple-audio-card,cpu {
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 19/112 arm64: dts: qcom: sa8775p: correct PMIC GPIO label in gpio-ranges
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit f822899c28572a854f2c746da5ed707d752458ab upstream.
There are several PMICs with GPIO nodes and one of the nodes referenced other's in gpio-ranges which could result in deferred-probes like:
qcom-spmi-gpio c440000.spmi:pmic@2:gpio@8800: can't add gpio chip
--- arch/arm64/boot/dts/qcom/sa8775p-pmics.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sa8775p-pmics.dtsi +1 -1
@@ -173,7 +173,7 @@ pmm8654au_1_gpios: gpio@8800 { compatible = "qcom,pmm8654au-gpio", "qcom,spmi-gpio"; reg = <0x8800>; gpio-controller; - gpio-ranges = <&pmm8654au_2_gpios 0 0 12>; + gpio-ranges = <&pmm8654au_1_gpios 0 0 12>; #gpio-cells = <2>; interrupt-controller; #interrupt-cells = <2>;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 20/112 arm64: dts: rockchip: Add i2s0-2ch-bus-bclk-off pins to RK3399
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christopher Obbard <[email protected]>
commit 3975e72b164dc8347a28dd0d5f11b346af534635 upstream.
Commit 0efaf8078393 ("arm64: dts: rockchip: add i2s0-2ch-bus pins on rk3399") introduced a pinctl for i2s0 in two-channel mode. Commit 91419ae0420f ("arm64: dts: rockchip: use BCLK to GPIO switch on rk3399") modified i2s0 to switch the corresponding pins off when idle.
Although an idle pinctrl node was added for i2s0 in 8-channel mode, a similar idle pinctrl node for i2s0 in 2-channel mode was not added. Add it.
--- arch/arm64/boot/dts/rockchip/rk3399.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399.dtsi +10 -0
@@ -2430,6 +2430,16 @@ <4 RK_PA0 1 &pcfg_pull_none>; }; + i2s0_2ch_bus_bclk_off: i2s0-2ch-bus-bclk-off { + rockchip,pins = + <3 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>, + <3 RK_PD1 1 &pcfg_pull_none>, + <3 RK_PD2 1 &pcfg_pull_none>, + <3 RK_PD3 1 &pcfg_pull_none>, + <3 RK_PD7 1 &pcfg_pull_none>, + <4 RK_PA0 1 &pcfg_pull_none>; + }; + i2s0_8ch_bus: i2s0-8ch-bus { rockchip,pins = <3 RK_PD0 1 &pcfg_pull_none>,
Greg Kroah-Hartman
maintainerPATCH 21/112 arm64: dts: rockchip: Fix i2s0 pin conflict on ROCK Pi 4 boards
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christopher Obbard <[email protected]>
commit 8cd79b729e746cb167f1563d015a93fc0a079899 upstream.
Commit 91419ae0420f ("arm64: dts: rockchip: use BCLK to GPIO switch on rk3399") modified i2s0 to switch the corresponding pins off when idle. For the ROCK Pi 4 boards, this means that i2s0 has the following pinctrl setting:
pinctrl-names = "bclk_on", "bclk_off";
pinctrl-0 = <&i2s0_2ch_bus>;
pinctrl-1 = <&i2s0_8ch_bus_bclk_off>;Due to this change, i2s0 fails to probe on my Radxa ROCK 4SE and ROCK Pi 4B boards:
rockchip-pinctrl pinctrl: pin gpio3-29 already requested by leds; cannot claim for ff880000.i2s rockchip-pinctrl pinctrl: pin-125 (ff880000.i2s) status -22
rockchip-pinctrl pinctrl: could not request pin 125 (gpio3-29) from group i2s0-8ch-bus-bclk-off on device rockchip-pinctrl rockchip-i2s ff880000.i2s: Error applying setting, reverse things back
rockchip-i2s ff880000.i2s: bclk disable failed -22
A pin requested for i2s0_8ch_bus_bclk_off has already been requested by user_led2, so whichever driver probes first will have the pin allocated.
The hardware uses 2-channel i2s so fix this error by setting pinctl-1 to i2s0_2ch_bus_bclk_off which doesn't contain the pin allocated to user_led2.
I checked the schematics for all Radxa boards based on ROCK Pi 4 and this change is compatible with all boards.
--- arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi +1 -0
@@ -493,6 +493,7 @@ &i2s0 { pinctrl-0 = <&i2s0_2ch_bus>; + pinctrl-1 = <&i2s0_2ch_bus_bclk_off>; rockchip,capture-channels = <2>; rockchip,playback-channels = <2>; status = "okay";
Greg Kroah-Hartman
maintainerPATCH 22/112 i40e: sync next_to_clean and next_to_process for programming status desc
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tirthendu Sarkar <[email protected]>
commit 068d8b75c1aee153193522211ace6c13c21cd16b upstream.
When a programming status desc is encountered on the rx_ring, next_to_process is bumped along with cleaned_count but next_to_clean is not. This causes I40E_DESC_UNUSED() macro to misbehave resulting in overwriting whole ring with new buffers.
Update next_to_clean to point to next_to_process on seeing a programming status desc if not in the middle of handling a multi-frag packet. Also, bump cleaned_count only for such case as otherwise next_to_clean buffer may be returned to hardware on reaching clean_threshold.
Reported by: Solomon Peachy <[email protected]>
Tested by: Indrek Järve <[email protected]>
--- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +8 -1
@@ -2544,7 +2544,14 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget, rx_buffer =i40e_rx_bi (rx_ring, ntp);i40e_inc_ntp (rx_ring);i40e_reuse_rx_page (rx_ring, rx_buffer); - cleaned_count++; +/* Update ntc and bump cleaned count if not in the +* middle of mb packet. +*/ +if (rx_ring->next_to_clean == ntp) { + rx_ring->next_to_clean = + rx_ring->next_to_process; + cleaned_count++; + }continue ; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 23/112 mm: fix vm_brk_flags() to not bail out while holding lock
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Ott <[email protected]>
commit e0f81ab1e4f42ffece6440dc78f583eb352b9a71 upstream.
Calling vm_brk_flags() with flags set other than VM_EXEC will exit the function without releasing the mmap_write_lock.
Just do the sanity check before the lock is acquired. This doesn't fix an actual issue since no caller sets a flag other than VM_EXEC.
--- mm/mmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
mm/mmap.c +3 -3
@@ -3136,13 +3136,13 @@ int vm_brk_flags(unsigned long addr, unsif (!len)return 0 ; -if (mmap_write_lock_killable (mm)) -return -EINTR ; -/* Until we need other flags, refuse anything except VM_EXEC. */ if ((flags & (~VM_EXEC )) !=0 )return -EINVAL ; +if (mmap_write_lock_killable (mm)) +return -EINTR ; + ret =check_brk_limits (addr, len);if (ret) goto limits_failed;
Greg Kroah-Hartman
maintainerPATCH 24/112 hugetlbfs: clear resv_map pointer if mmap fails
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rik van Riel <[email protected]>
commit 92fe9dcbe4e109a7ce6bab3e452210a35b0ab493 upstream.
Patch series "hugetlbfs: close race between MADV_DONTNEED and page fault", v7.
Malloc libraries, like jemalloc and tcalloc, take decisions on when to call madvise independently from the code in the main application.
This sometimes results in the application page faulting on an address, right after the malloc library has shot down the backing memory with MADV_DONTNEED.
Usually this is harmless, because we always have some 4kB pages sitting around to satisfy a page fault. However, with hugetlbfs systems often allocate only the exact number of huge pages that the application wants.
Due to TLB batching, hugetlbfs MADV_DONTNEED will free pages outside of any lock taken on the page fault path, which can open up the following race condition:
CPU 1 CPU 2
MADV_DONTNEED
unmap page
shoot down TLB entry
page fault
fail to allocate a huge page killed with SIGBUS
free page
Fix that race by extending the hugetlb_vma_lock locking scheme to also cover private hugetlb mappings (with resv_map), and pulling the locking from __unmap_hugepage_final_range into helper functions called from zap_page_range_single. This ensures page faults stay locked out of the MADV_DONTNEED VMA until the huge pages have actually been freed.
This patch (of 3):
Hugetlbfs leaves a dangling pointer in the VMA if mmap fails. This has not been a problem so far, but other code in this patch series tries to follow that pointer.
--- mm/hugetlb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
mm/hugetlb.c +4 -3
@@ -1132,8 +1132,7 @@ static void set_vma_resv_map(struct vm_aVM_BUG_ON_VMA (!is_vm_hugetlb_page (vma), vma);VM_BUG_ON_VMA (vma->vm_flags &VM_MAYSHARE , vma); -set_vma_private_data (vma, (get_vma_private_data (vma) & -HPAGE_RESV_MASK ) | (unsigned long )map); +set_vma_private_data (vma, (unsigned long )map); }static void set_vma_resv_flags (struct vm_area_struct *vma,unsigned long flags)
@@ -7015,8 +7014,10 @@ out_err:*/ if (chg >=0 && add <0 )region_abort (resv_map, from, to, regions_needed); -if (vma &&is_vma_resv_set (vma,HPAGE_RESV_OWNER )) +if (vma &&is_vma_resv_set (vma,HPAGE_RESV_OWNER )) {kref_put (&resv_map->refs, resv_map_release); +set_vma_resv_map (vma,NULL ); + }return false; }
Greg Kroah-Hartman
maintainerPATCH 25/112 mm/page_alloc: correct start page when guard page debug is enabled
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kemeng Shi <[email protected]>
commit 61e21cf2d2c3cc5e60e8d0a62a77e250fccda62c upstream.
When guard page debug is enabled and set_page_guard returns success, we miss to forward page to point to start of next split range and we will do split unexpectedly in page range without target page. Move start page update before set_page_guard to fix this.
As we split to wrong target page, then splited pages are not able to merge back to original order when target page is put back and splited pages except target page is not usable. To be specific:
Consider target page is the third page in buddy page with order 2. | buddy-2 | Page | Target | Page |
After break down to target page, we will only set first page to Guard because of bug.
| Guard | Page | Target | Page |
When we try put_page_back_buddy with target page, the buddy page of target if neither guard nor buddy, Then it's not able to construct original page with order 2
| Guard | Page | buddy-0 | Page |
All pages except target page is not in free list and is not usable.
--- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page_alloc.c +1 -1
@@ -6528,6 +6528,7 @@ static void break_down_buddy_pages(struc next_page = page; current_buddy = page + size; } + page = next_page;if (set_page_guard (zone, current_buddy, high, migratetype))continue ;
@@ -6535,7 +6536,6 @@ static void break_down_buddy_pages(strucif (current_buddy != target) {add_to_free_list (current_buddy, zone, high, migratetype);set_buddy_order (current_buddy, high); - page = next_page; } } }
Greg Kroah-Hartman
maintainerPATCH 26/112 mm/migrate: fix do_pages_move for compat pointers
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory Price <[email protected]>
commit 229e2253766c7cdfe024f1fe280020cc4711087c upstream.
do_pages_move does not handle compat pointers for the page list. correctly. Add in_compat_syscall check and appropriate get_user fetch when iterating the page list.
It makes the syscall in compat mode (32-bit userspace, 64-bit kernel) work the same way as the native 32-bit syscall again, restoring the behavior before my broken commit 5b1b561ba73c ("mm: simplify compat_sys_move_pages").
More specifically, my patch moved the parsing of the 'pages' array from the main entry point into do_pages_stat(), which left the syscall working correctly for the 'stat' operation (nodes = NULL), while the 'move' operation (nodes != NULL) is now missing the conversion and interprets 'pages' as an array of 64-bit pointers instead of the intended 32-bit userspace pointers.
It is possible that nobody noticed this bug because the few applications that actually call move_pages are unlikely to run in compat mode because of their large memory requirements, but this clearly fixes a user-visible regression and should have been caught by ltp.
--- mm/migrate.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
mm/migrate.c +12 -2
@@ -2160,6 +2160,7 @@ static int do_pages_move(struct mm_strucconst int __user *nodes, int __user *status, int flags) { + compat_uptr_t __user *compat_pages = (void __user *)pages;int current_node =NUMA_NO_NODE ;LIST_HEAD (pagelist);int start, i;
@@ -2172,8 +2173,17 @@ static int do_pages_move(struct mm_strucint node; err = -EFAULT ; -if (get_user (p, pages + i)) - goto out_flush; +if (in_compat_syscall ()) { +compat_uptr_t cp; + +if (get_user (cp, compat_pages + i)) + goto out_flush; + + p =compat_ptr (cp); + }else { +if (get_user (p, pages + i)) + goto out_flush; + }if (get_user (node, nodes + i)) goto out_flush;
Greg Kroah-Hartman
maintainerPATCH 27/112 selftests/mm: include mman header to access MREMAP_DONTUNMAP identifier
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samasth Norway Ananda <[email protected]>
commit e2de156b0d918b5ebe975577d25f9ef92379a756 upstream.
Definition for MREMAP_DONTUNMAP is not present in glibc older than 2.32 thus throwing an undeclared error when running make on mm. Including linux/mman.h solves the build error for people having older glibc.
--- tools/testing/selftests/mm/mremap_dontunmap.c | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/mm/mremap_dontunmap.c +1 -0
@@ -7,6 +7,7 @@*/ #define _GNU_SOURCE#include <sys/mman.h> +#include <linux/mman.h> #include <errno.h> #include <stdio.h> #include <stdlib.h>
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 28/112 mm/mempolicy: fix set_mempolicy_home_node() previous VMA pointer
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liam R. Howlett <[email protected]>
commit 51f625377561e5b167da2db5aafb7ee268f691c5 upstream.
The two users of mbind_range() are expecting that mbind_range() will update the pointer to the previous VMA, or return an error. However, set_mempolicy_home_node() does not call mbind_range() if there is no VMA policy. The fix is to update the pointer to the previous VMA prior to continuing iterating the VMAs when there is no policy.
Users may experience a WARN_ON() during VMA policy updates when updating a range of VMAs on the home node.
--- mm/mempolicy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
mm/mempolicy.c +3 -1
@@ -1543,8 +1543,10 @@ SYSCALL_DEFINE4(set_mempolicy_home_node,* the home node for vmas we already updated before. */ old =vma_policy (vma); -if (!old) +if (!old) { + prev = vma;continue ; + }if (old->mode !=MPOL_BIND && old->mode !=MPOL_PREFERRED_MANY ) { err = -EOPNOTSUPP ;break ;
Greg Kroah-Hartman
maintainerPATCH 29/112 hugetlbfs: extend hugetlb_vma_lock to private VMAs
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rik van Riel <[email protected]>
commit bf4916922c60f43efaa329744b3eef539aa6a2b2 upstream.
Extend the locking scheme used to protect shared hugetlb mappings from truncate vs page fault races, in order to protect private hugetlb mappings (with resv_map) against MADV_DONTNEED.
Add a read-write semaphore to the resv_map data structure, and use that from the hugetlb_vma_(un)lock_* functions, in preparation for closing the race between MADV_DONTNEED and page faults.
--- include/linux/hugetlb.h | 6 ++++++ mm/hugetlb.c | 41 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 43 insertions(+), 4 deletions(-)
include/linux/hugetlb.h +6 -0
@@ -58,6 +58,7 @@ struct resv_map {long adds_in_progress;struct list_head region_cache;long region_cache_count; +struct rw_semaphore rw_sema;#ifdef CONFIG_CGROUP_HUGETLB /* * On private mappings, the counter to uncharge reservations is stored
@@ -1245,6 +1246,11 @@ static inline bool __vma_shareable_lock(return (vma->vm_flags &VM_MAYSHARE ) && vma->vm_private_data; } +static inline bool __vma_private_lock (struct vm_area_struct *vma) +{ +return (!(vma->vm_flags &VM_MAYSHARE )) && vma->vm_private_data; +} +/* * Safe version of huge_pte_offset() to check the locks. See comments * above huge_pte_offset().
mm/hugetlb.c +37 -4
96 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 30/112 maple_tree: add GFP_KERNEL to allocations in mas_expected_entries()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liam R. Howlett <[email protected]>
commit 099d7439ce03d0e7bc8f0c3d7878b562f3a48d3d upstream.
Users complained about OOM errors during fork without triggering compaction. This can be fixed by modifying the flags used in mas_expected_entries() so that the compaction will be triggered in low memory situations. Since mas_expected_entries() is only used during fork, the extra argument does not need to be passed through.
Additionally, the two test_maple_tree test cases and one benchmark test were altered to use the correct locking type so that allocations would not trigger sleeping and thus fail. Testing was completed with lockdep atomic sleep detection.
The additional locking change requires rwsem support additions to the tools/ directory through the use of pthreads pthread_rwlock_t. With this change test_maple_tree works in userspace, as a module, and in-kernel.
Users may notice that the system gave up early on attempting to start new processes instead of attempting to reclaim memory.
--- lib/maple_tree.c | 2 +- lib/test_maple_tree.c | 35 ++++++++++++++++++++++++----------- tools/include/linux/rwsem.h | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 12 deletions(-) create mode 100644 tools/include/linux/rwsem.h
lib/maple_tree.c +1 -1
@@ -5729,7 +5729,7 @@ int mas_expected_entries(struct ma_state/* Internal nodes */ nr_nodes +=DIV_ROUND_UP (nr_nodes, nonleaf_cap);/* Add working room for split (2 nodes) + new parents */ -mas_node_count (mas, nr_nodes +3 ); +mas_node_count_gfp (mas, nr_nodes +3 ,GFP_KERNEL );/* Detect if allocations run out */ mas->mas_flags |=MA_STATE_PREALLOC ;
lib/test_maple_tree.c +24 -11
@@ -9,6 +9,7 @@#include <linux/maple_tree.h> #include <linux/module.h> +#include <linux/rwsem.h> #define MTREE_ALLOC_MAX 0x2000000000000Ul#define CONFIG_MAPLE_SEARCH
@@ -1714,17 +1715,21 @@ static noinline void __init check_forkinvoid *val;MA_STATE (mas, mt,0 ,0 );MA_STATE (newmas, mt,0 ,0 ); +struct rw_semaphore newmt_lock; + +init_rwsem (&newmt_lock);for (i =0 ; i <= nr_entries; i++)mtree_store_range (mt, i*10 , i*10 +5 ,xa_mk_value (i),GFP_KERNEL );mt_set_non_kernel (99999 ); -mt_init_flags (&newmt,MT_FLAGS_ALLOC_RANGE ); +mt_init_flags (&newmt,MT_FLAGS_ALLOC_RANGE |MT_FLAGS_LOCK_EXTERN ); +mt_set_external_lock (&newmt, &newmt_lock); newmas.tree = &newmt;mas_reset (&newmas);mas_reset (&mas); -mas_lock (&newmas); +down_write (&newmt_lock); mas.index =0 ; mas.last =0 ;if (mas_expected_entries (&newmas, nr_entries)) {
@@ -1739,10 +1744,10 @@ static noinline void __init check_forkin }rcu_read_unlock ();mas_destroy (&newmas); -mas_unlock (&newmas);mt_validate (&newmt);mt_set_non_kernel (0 ); -mtree_destroy (&newmt); +__mt_destroy (&newmt); +up_write (&newmt_lock); } static noinline void __init check_iteration(struct maple_tree *mt)
@@ -1853,6 +1858,10 @@ static noinline void __init bench_forkinvoid *val;MA_STATE (mas, mt,0 ,0 );MA_STATE (newmas, mt,0 ,0 ); +struct rw_semaphore newmt_lock; + +init_rwsem (&newmt_lock); +mt_set_external_lock (&newmt, &newmt_lock);for (i =0 ; i <= nr_entries; i++) mtree_store_range(mt, i*10, i*10 + 5,
@@ -1867,7 +1876,7 @@ static noinline void __init bench_forkin mas.index =0 ; mas.last =0 ;rcu_read_lock (); -mas_lock (&newmas); +down_write (&newmt_lock);if (mas_expected_entries (&newmas, nr_entries)) {printk ("OOM!" );BUG_ON (1 );
@@ -1878,11 +1887,11 @@ static noinline void __init bench_forkin mas_store(&newmas, val); }mas_destroy (&newmas); -mas_unlock (&newmas);rcu_read_unlock ();mt_validate (&newmt);mt_set_non_kernel (0 ); -mtree_destroy (&newmt); +__mt_destroy (&newmt); +up_write (&newmt_lock); } }#endif
@@ -2489,6 +2498,10 @@ static noinline void __init check_dup_gavoid *tmp;MA_STATE (mas, mt,0 ,0 );MA_STATE (newmas, &newmt,0 ,0 ); +struct rw_semaphore newmt_lock; + +init_rwsem (&newmt_lock); +mt_set_external_lock (&newmt, &newmt_lock);if (!zero_start) i =1 ;
@@ -2498,9 +2511,9 @@ static noinline void __init check_dup_gamtree_store_range (mt, i*10 , (i+1 )*10 - gap,xa_mk_value (i),GFP_KERNEL ); -mt_init_flags (&newmt,MT_FLAGS_ALLOC_RANGE ); +mt_init_flags (&newmt,MT_FLAGS_ALLOC_RANGE |MT_FLAGS_LOCK_EXTERN );mt_set_non_kernel (99999 ); -mas_lock (&newmas); +down_write (&newmt_lock); ret =mas_expected_entries (&newmas, nr_entries);mt_set_non_kernel (0 );MT_BUG_ON (mt, ret !=0 );
@@ -2513,9 +2526,9 @@ static noinline void __init check_dup_ga }rcu_read_unlock ();mas_destroy (&newmas); -mas_unlock (&newmas); -mtree_destroy (&newmt); +__mt_destroy (&newmt); +up_write (&newmt_lock); }/* Duplicate many sizes of trees. Mainly to test expected entry values */
tools/include/linux/rwsem.h new file +40 -0
@@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +#ifndef _TOOLS__RWSEM_H +#define _TOOLS__RWSEM_H + +#include <pthread.h> + +struct rw_semaphore { +pthread_rwlock_t lock; +}; + +static inline int init_rwsem (struct rw_semaphore *sem) +{ +return pthread_rwlock_init (&sem->lock,NULL ); +} + +static inline int exit_rwsem (struct rw_semaphore *sem) +{ +return pthread_rwlock_destroy (&sem->lock); +} + +static inline int down_read (struct rw_semaphore *sem) +{ +return pthread_rwlock_rdlock (&sem->lock); +} + +static inline int up_read (struct rw_semaphore *sem) +{ +return pthread_rwlock_unlock (&sem->lock); +} + +static inline int down_write (struct rw_semaphore *sem) +{ +return pthread_rwlock_wrlock (&sem->lock); +} + +static inline int up_write (struct rw_semaphore *sem) +{ +return pthread_rwlock_unlock (&sem->lock); +} +#endif /* _TOOLS_RWSEM_H */
Greg Kroah-Hartman
maintainerPATCH 31/112 nfsd: lock_rename() needs both directories to live on the same fs
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit 1aee9158bc978f91701c5992e395efbc6da2de3c upstream.
... checking that after lock_rename() is too late. Incidentally, NFSv2 had no nfserr_xdev...
--- fs/nfsd/vfs.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
fs/nfsd/vfs.c +6 -6
@@ -1781,6 +1781,12 @@ nfsd_rename(struct svc_rqst *rqstp, struif (!flen ||isdotent (fname, flen) || !tlen ||isdotent (tname, tlen)) goto out; + err = (rqstp->rq_vers ==2 ) ? nfserr_acces : nfserr_xdev; +if (ffhp->fh_export->ex_path.mnt != tfhp->fh_export->ex_path.mnt) + goto out; +if (ffhp->fh_export->ex_path.dentry != tfhp->fh_export->ex_path.dentry) + goto out; + retry: host_err =fh_want_write (ffhp);if (host_err) {
@@ -1812,12 +1818,6 @@ retry:if (ndentry == trap) goto out_dput_new; - host_err = -EXDEV ; -if (ffhp->fh_export->ex_path.mnt != tfhp->fh_export->ex_path.mnt) - goto out_dput_new; -if (ffhp->fh_export->ex_path.dentry != tfhp->fh_export->ex_path.dentry) - goto out_dput_new; -if ((ndentry->d_sb->s_export_op->flags &EXPORT_OP_CLOSE_BEFORE_UNLINK ) &&nfsd_has_cached_files (ndentry)) { close_cached = true;
Greg Kroah-Hartman
maintainerPATCH 32/112 vdpa_sim_blk: Fix the potential leak of mgmt_dev
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shawn.Shao <[email protected]>
commit d121df789b159e9a8ee770666f210975a81e8111 upstream.
If the shared_buffer allocation fails, need to unregister mgmt_dev first.
Message-Id: <[email protected]>
--- drivers/vdpa/vdpa_sim/vdpa_sim_blk.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/vdpa/vdpa_sim/vdpa_sim_blk.c +3 -2
@@ -499,12 +499,13 @@ static int __init vdpasim_blk_init(void) GFP_KERNEL);if (!shared_buffer) { ret = -ENOMEM ; - goto parent_err; + goto mgmt_dev_err; } }return 0 ; - +mgmt_dev_err: +vdpa_mgmtdev_unregister (&mgmt_dev); parent_err:device_unregister (&vdpasim_blk_mgmtdev);return ret;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 33/112 vdpa/mlx5: Fix double release of debugfs entry
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dragos Tatulea <[email protected]>
commit f8a3db47d944a33eac1f37358db560e5aabbfbca upstream.
The error path in setup_driver deletes the debugfs entry but doesn't clear the pointer. During .dev_del the invalid pointer will be released again causing a crash.
This patch fixes the issue by always clearing the debugfs entry in mlx5_vdpa_remove_debugfs. Also, stop removing the debugfs entry in .dev_del op: the debugfs entry is already handled within the setup_driver/teardown_driver scope.
Message-Id: <[email protected]>
--- drivers/vdpa/mlx5/net/debug.c | 5 +++-- drivers/vdpa/mlx5/net/mlx5_vnet.c | 7 ++----- drivers/vdpa/mlx5/net/mlx5_vnet.h | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-)
drivers/vdpa/mlx5/net/debug.c +3 -2
@@ -146,7 +146,8 @@ void mlx5_vdpa_add_debugfs(struct mlx5_v ndev->rx_dent =debugfs_create_dir ("rx" , ndev->debugfs); } -void mlx5_vdpa_remove_debugfs (struct dentry *dbg) +void mlx5_vdpa_remove_debugfs (struct mlx5_vdpa_net *ndev) { -debugfs_remove_recursive (dbg); +debugfs_remove_recursive (ndev->debugfs); + ndev->debugfs =NULL ; }
drivers/vdpa/mlx5/net/mlx5_vnet.c +2 -5
@@ -2758,7 +2758,7 @@ err_tir: err_rqt:teardown_virtqueues (ndev); err_setup: -mlx5_vdpa_remove_debugfs (ndev->debugfs); +mlx5_vdpa_remove_debugfs (ndev); out:return err; }
@@ -2772,8 +2772,7 @@ static void teardown_driver(struct mlx5_if (!ndev->setup)return ; -mlx5_vdpa_remove_debugfs (ndev->debugfs); - ndev->debugfs =NULL ; +mlx5_vdpa_remove_debugfs (ndev);teardown_steering (ndev);destroy_tir (ndev);destroy_rqt (ndev);
@@ -3534,8 +3533,6 @@ static void mlx5_vdpa_dev_del(struct vdpstruct mlx5_vdpa_net *ndev =to_mlx5_vdpa_ndev (mvdev);struct workqueue_struct *wq; -mlx5_vdpa_remove_debugfs (ndev->debugfs); - ndev->debugfs =NULL ;unregister_link_notifier (ndev);_vdpa_unregister_device (dev); wq = mvdev->wq;
drivers/vdpa/mlx5/net/mlx5_vnet.h +1 -1
@@ -97,7 +97,7 @@ struct macvlan_node { };void mlx5_vdpa_add_debugfs (struct mlx5_vdpa_net *ndev); -void mlx5_vdpa_remove_debugfs (struct dentry *dbg); +void mlx5_vdpa_remove_debugfs (struct mlx5_vdpa_net *ndev);void mlx5_vdpa_add_rx_flow_table (struct mlx5_vdpa_net *ndev);void mlx5_vdpa_remove_rx_flow_table (struct mlx5_vdpa_net *ndev);void mlx5_vdpa_add_tirn (struct mlx5_vdpa_net *ndev);
Greg Kroah-Hartman
maintainerPATCH 34/112 ARM: OMAP1: ams-delta: Fix MODEM initialization failure
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Janusz Krzysztofik <[email protected]>
commit 5447da5d610b5701c1103cd4665b49da87fdf032 upstream.
Regulator drivers were modified to use asynchronous device probe. Since then, the board .init_late hook fails to acquire a GPIO based fixed regulator needed by an on-board voice MODEM device, and unregisters the MODEM. That in turn triggers a so far not discovered bug of device unregister function called for a device with no associated release() op.
serial8250 serial8250.1: incomplete constraints, dummy supplies not allowed
WARNING: CPU: 0 PID: 1 at drivers/base/core.c:2486 device_release+0x98/0xa8
Device 'serial8250.1' does not have a release() function, it is broken and
must be fixed. See Documentation/core-api/kobject.rst.
...put_device from platform_device_put+0x1c/0x24 platform_device_put from ams_delta_init_late+0x4c/0x68 ams_delta_init_late from init_machine_late+0x1c/0x94 init_machine_late from do_one_initcall+0x60/0x1d4
As a consequence, ASoC CODEC driver is no longer able to control its device over the voice MODEM's tty interface.
cx20442-codec: ASoC: error at soc_component_write_no_lock
on cx20442-codec for register: [0x00000000] -5
cx20442-codec: ASoC: error at snd_soc_component_update_bits_legacy
on cx20442-codec for register: [0x00000000] -5
cx20442-codec: ASoC: error at snd_soc_component_update_bits
on cx20442-codec for register: [0x00000000] -5
The regulator hangs of a GPIO pin controlled by basic-mmio-gpio driver. Unlike most GPIO drivers, that driver doesn't probe for devices before device_initcall, then GPIO pins under its control are not availabele to majority of devices probed at that phase, including regulators. On the other hand, serial8250 driver used by the MODEM device neither accepts via platform data nor handles regulators, then the board file is not able to teach that driver to return -EPROBE_DEFER when the regulator is not ready so the failed probe is retried after late_initcall.
Resolve the issue by extending description of the MODEM device with a dedicated power management domain. Acquire the regulator from the domain's .activate hook and return -EPROBE_DEFER if the regulator is not available. Having that under control, add the regulator device description to the list of platform devices initialized from .init_machine and drop the no longer needed custom .init_late hook.
v2: Trim down the warning for prettier git log output (Tony).
Message-ID: <[email protected]>
--- arch/arm/mach-omap1/board-ams-delta.c | 60 +++++++-------------------- 1 file changed, 16 insertions(+), 44 deletions(-)
arch/arm/mach-omap1/board-ams-delta.c +16 -44
@@ -550,6 +550,7 @@ static struct platform_device *ams_delta_devices[] __initdata = { &ams_delta_nand_device, &ams_delta_lcd_device, &cx20442_codec_device, + &modem_nreset_device, }; static struct gpiod_lookup_table *ams_delta_gpio_tables[] __initdata = {
@@ -782,26 +783,28 @@ static struct plat_serial8250_port ams_delta_modem_ports[] = { { }, }; +static int ams_delta_modem_pm_activate (struct device *dev) +{ + modem_priv.regulator =regulator_get (dev,"RESET#" ); +if (IS_ERR (modem_priv.regulator)) +return -EPROBE_DEFER ; + +return 0 ; +} + +static struct dev_pm_domain ams_delta_modem_pm_domain = { + .activate = ams_delta_modem_pm_activate, +}; +static struct platform_device ams_delta_modem_device = { .name ="serial8250" , .id =PLAT8250_DEV_PLATFORM1 , .dev = { .platform_data = ams_delta_modem_ports, + .pm_domain = &ams_delta_modem_pm_domain, }, }; -static int __init modem_nreset_init (void ) -{ -int err; - - err =platform_device_register (&modem_nreset_device); -if (err) -pr_err ("Couldn't register the modem regulator device\n" ); - -return err; -} - -/* * This function expects MODEM IRQ number already assigned to the port. * The MODEM device requires its RESET# pin kept high during probe.
@@ -833,37 +836,6 @@ static int __init ams_delta_modem_init(void) }arch_initcall_sync (ams_delta_modem_init); -static int __init late_init (void ) -{ -int err; - - err =modem_nreset_init (); -if (err) -return err; - -/* -* Once the modem device is registered, the modem_nreset -* regulator can be requested on behalf of that device. -*/ - modem_priv.regulator =regulator_get (&ams_delta_modem_device.dev, -"RESET#" ); -if (IS_ERR (modem_priv.regulator)) { - err =PTR_ERR (modem_priv.regulator); - goto unregister; - } -return 0 ; - -unregister: -platform_device_unregister (&ams_delta_modem_device); -return err; -} - -static void __init ams_delta_init_late (void ) -{ -omap1_init_late (); -late_init (); -} -static void __init ams_delta_map_io (void ) {omap1_map_io ();
@@ -877,7 +849,7 @@ MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)") .init_early = omap1_init_early, .init_irq = omap1_init_irq, .init_machine = ams_delta_init, - .init_late = ams_delta_init_late, + .init_late = omap1_init_late, .init_time = omap1_timer_init, .restart = omap1_restart,MACHINE_END
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 35/112 ARM: dts: rockchip: Fix i2c0 register address for RK3128
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Bee <[email protected]>
commit 2e9cbc4167da3134412ce47e4cdadbfdea30bbff upstream.
The register address for i2c0 is missing a 0x to mark it as hex.
--- arch/arm/boot/dts/rockchip/rk3128.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/rockchip/rk3128.dtsi +1 -1
@@ -426,7 +426,7 @@ saradc: saradc@2006c000 { i2c0: i2c@20072000 { compatible = "rockchip,rk3128-i2c", "rockchip,rk3288-i2c"; - reg = <20072000 0x1000>; + reg = <0x20072000 0x1000>; interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>; clock-names = "i2c"; clocks = <&cru PCLK_I2C0>;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 36/112 ARM: dts: rockchip: Add missing arm timer interrupt for RK3128
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Bee <[email protected]>
commit 7e3be9ea299927e6d65242c247eca0a21bc26a58 upstream.
The Cortex-A7 timer has 4 interrupts.
Add the missing one.
--- arch/arm/boot/dts/rockchip/rk3128.dtsi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/boot/dts/rockchip/rk3128.dtsi +2 -1
@@ -64,7 +64,8 @@ timer { compatible = "arm,armv7-timer"; interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>, <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>, - <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>; + <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>, + <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>; arm,cpu-registers-not-fw-configured; clock-frequency = <24000000>; };
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 37/112 ARM: dts: rockchip: Add missing quirk for RK3128s dma engine
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Bee <[email protected]>
commit b0b4e978784943c4ed8412dbb475178f8c51ba8e upstream.
Like most other Rockchip ARM SoCs, the PL330 needs the arm,pl330-periph-burst quirk in order to work as expected. Add it.
--- arch/arm/boot/dts/rockchip/rk3128.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/rockchip/rk3128.dtsi +1 -0
@@ -459,6 +459,7 @@ pdma: dma-controller@20078000 { interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>; arm,pl330-broken-no-flushp; + arm,pl330-periph-burst; clocks = <&cru ACLK_DMAC>; clock-names = "apb_pclk"; #dma-cells = <1>;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 38/112 ARM: dts: rockchip: Fix timer clocks for RK3128
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Bee <[email protected]>
commit 2c68d26f072b449bd45427241612cb3f8f997f82 upstream.
Currently the Rockchip timer source clocks are set to xin24 for no obvious reason and the actual timer clocks (SCLK_TIMER*) will get disabled during boot process as they have no user. That will make the SoC stuck as no timer source exists.
--- arch/arm/boot/dts/rockchip/rk3128.dtsi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm/boot/dts/rockchip/rk3128.dtsi +6 -6
@@ -234,7 +234,7 @@ timer0: timer@20044000 { compatible = "rockchip,rk3128-timer", "rockchip,rk3288-timer"; reg = <0x20044000 0x20>; interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&cru PCLK_TIMER>, <&xin24m>; + clocks = <&cru PCLK_TIMER>, <&cru SCLK_TIMER0>; clock-names = "pclk", "timer"; };
@@ -242,7 +242,7 @@ timer1: timer@20044020 { compatible = "rockchip,rk3128-timer", "rockchip,rk3288-timer"; reg = <0x20044020 0x20>; interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&cru PCLK_TIMER>, <&xin24m>; + clocks = <&cru PCLK_TIMER>, <&cru SCLK_TIMER1>; clock-names = "pclk", "timer"; };
@@ -250,7 +250,7 @@ timer2: timer@20044040 { compatible = "rockchip,rk3128-timer", "rockchip,rk3288-timer"; reg = <0x20044040 0x20>; interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&cru PCLK_TIMER>, <&xin24m>; + clocks = <&cru PCLK_TIMER>, <&cru SCLK_TIMER2>; clock-names = "pclk", "timer"; };
@@ -258,7 +258,7 @@ timer3: timer@20044060 { compatible = "rockchip,rk3128-timer", "rockchip,rk3288-timer"; reg = <0x20044060 0x20>; interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&cru PCLK_TIMER>, <&xin24m>; + clocks = <&cru PCLK_TIMER>, <&cru SCLK_TIMER3>; clock-names = "pclk", "timer"; };
@@ -266,7 +266,7 @@ timer4: timer@20044080 { compatible = "rockchip,rk3128-timer", "rockchip,rk3288-timer"; reg = <0x20044080 0x20>; interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&cru PCLK_TIMER>, <&xin24m>; + clocks = <&cru PCLK_TIMER>, <&cru SCLK_TIMER4>; clock-names = "pclk", "timer"; };
@@ -274,7 +274,7 @@ timer5: timer@200440a0 { compatible = "rockchip,rk3128-timer", "rockchip,rk3288-timer"; reg = <0x200440a0 0x20>; interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&cru PCLK_TIMER>, <&xin24m>; + clocks = <&cru PCLK_TIMER>, <&cru SCLK_TIMER5>; clock-names = "pclk", "timer"; };
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 39/112 accel/ivpu: Dont enter d0i3 during FLR
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacek Lawrynowicz <[email protected]>
commit 828d63042aeca132a93938b98dc7f1a6c97bbc51 upstream.
Avoid HW bug on some platforms where we enter D0i3 state and CPU is in low power states (C8 or above).
--- drivers/accel/ivpu/ivpu_drv.c | 11 ++++++++--- drivers/accel/ivpu/ivpu_drv.h | 1 + drivers/accel/ivpu/ivpu_hw.h | 8 ++++++++ drivers/accel/ivpu/ivpu_hw_mtl.c | 1 + drivers/accel/ivpu/ivpu_pm.c | 3 ++- 5 files changed, 20 insertions(+), 4 deletions(-)
drivers/accel/ivpu/ivpu_drv.c +8 -3
@@ -343,14 +343,19 @@ int ivpu_boot(struct ivpu_device *vdev)return 0 ; } -int ivpu_shutdown (struct ivpu_device *vdev) +void ivpu_prepare_for_reset (struct ivpu_device *vdev) { -int ret; -ivpu_hw_irq_disable (vdev);disable_irq (vdev->irq);ivpu_ipc_disable (vdev);ivpu_mmu_disable (vdev); +} + +int ivpu_shutdown (struct ivpu_device *vdev) +{ +int ret; + +ivpu_prepare_for_reset (vdev); ret =ivpu_hw_power_down (vdev);if (ret)
drivers/accel/ivpu/ivpu_drv.h +1 -0
@@ -144,6 +144,7 @@ void ivpu_file_priv_put(struct ivpu_fileint ivpu_boot (struct ivpu_device *vdev);int ivpu_shutdown (struct ivpu_device *vdev); +void ivpu_prepare_for_reset (struct ivpu_device *vdev);static inline bool ivpu_is_mtl (struct ivpu_device *vdev) {
drivers/accel/ivpu/ivpu_hw.h +8 -0
@@ -13,6 +13,7 @@ struct ivpu_hw_ops {int (*power_up)(struct ivpu_device *vdev);int (*boot_fw)(struct ivpu_device *vdev);int (*power_down)(struct ivpu_device *vdev); +int (*reset)(struct ivpu_device *vdev);bool (*is_idle)(struct ivpu_device *vdev);void (*wdt_disable)(struct ivpu_device *vdev);void (*diagnose_failure)(struct ivpu_device *vdev);
@@ -90,6 +91,13 @@ static inline int ivpu_hw_power_down(strreturn vdev->hw->ops->power_down (vdev); }; +static inline int ivpu_hw_reset (struct ivpu_device *vdev) +{ +ivpu_dbg (vdev,PM ,"HW reset\n" ); + +return vdev->hw->ops->reset (vdev); +}; +static inline void ivpu_hw_wdt_disable (struct ivpu_device *vdev) { vdev->hw->ops->wdt_disable (vdev);
drivers/accel/ivpu/ivpu_hw_mtl.c +1 -0
@@ -1041,6 +1041,7 @@ const struct ivpu_hw_ops ivpu_hw_mtl_ops .power_up = ivpu_hw_mtl_power_up, .is_idle = ivpu_hw_mtl_is_idle, .power_down = ivpu_hw_mtl_power_down, + .reset = ivpu_hw_mtl_reset, .boot_fw = ivpu_hw_mtl_boot_fw, .wdt_disable = ivpu_hw_mtl_wdt_disable, .diagnose_failure = ivpu_hw_mtl_diagnose_failure,
drivers/accel/ivpu/ivpu_pm.c +2 -1
@@ -260,7 +260,8 @@ void ivpu_pm_reset_prepare_cb(struct pciivpu_dbg (vdev,PM ,"Pre-reset..\n" );atomic_set (&vdev->pm->in_reset,1 ); -ivpu_shutdown (vdev); +ivpu_prepare_for_reset (vdev); +ivpu_hw_reset (vdev);ivpu_pm_prepare_cold_boot (vdev);ivpu_jobs_abort_all (vdev);ivpu_dbg (vdev,PM ,"Pre-reset done.\n" );
Greg Kroah-Hartman
maintainerPATCH 40/112 drm/i915/pmu: Check if pmu is closed before stopping event
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Umesh Nerlige Ramappa <[email protected]>
commit 4cbed7702eb775cca22fff6827a549092cb59f61 upstream.
When the driver unbinds, pmu is unregistered and i915->uabi_engines is set to RB_ROOT. Due to this, when i915 PMU tries to stop the engine events, it issues a warn_on because engine lookup fails.
All perf hooks are taking care of this using a pmu->closed flag that is set when PMU unregisters. The stop event seems to have been left out.
Check for pmu->closed in pmu_event_stop as well.
Based on discussion here -
https://patchwork.freedesktop.org/patch/492079/?series=105790&rev=2
v2: s/is/if/ in commit title
v3: Add fixes tag and cc stable
--- drivers/gpu/drm/i915/i915_pmu.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/i915/i915_pmu.c +9 -0
@@ -832,9 +832,18 @@ static void i915_pmu_event_start(structstatic void i915_pmu_event_stop (struct perf_event *event,int flags) { +struct drm_i915_private *i915 = +container_of (event->pmu,typeof (*i915), pmu.base); +struct i915_pmu *pmu = &i915->pmu; + +if (pmu->closed) + goto out; +if (flags &PERF_EF_UPDATE )i915_pmu_event_read (event);i915_pmu_disable (event); + +out: event->hw.state =PERF_HES_STOPPED ; }
Greg Kroah-Hartman
maintainerPATCH 41/112 drm/amd: Disable ASPM for VI w/ all Intel systems
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
commit 64ffd2f1d00c6235dabe9704bbb0d9ce3e28147f upstream.
Originally we were quirking ASPM disabled specifically for VI when used with Alder Lake, but it appears to have problems with Rocket Lake as well.
Like we've done in the case of dpm for newer platforms, disable ASPM for all Intel systems.
--- drivers/gpu/drm/amd/amdgpu/vi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vi.c +1 -1
@@ -1124,7 +1124,7 @@ static void vi_program_aspm(struct amdgpbool bL1SS = false;bool bClkReqSupport = true; -if (!amdgpu_device_should_use_aspm (adev) || !amdgpu_device_aspm_support_quirk ()) +if (!amdgpu_device_should_use_aspm (adev) || !amdgpu_device_pcie_dynamic_switching_supported ())return ; if (adev->flags & AMD_IS_APU ||
Greg Kroah-Hartman
maintainerPATCH 42/112 drm/dp_mst: Fix NULL deref in get_mst_branch_device_by_guid_helper()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukasz Majczak <[email protected]>
commit 3d887d512494d678b17c57b835c32f4e48d34f26 upstream.
As drm_dp_get_mst_branch_device_by_guid() is called from drm_dp_get_mst_branch_device_by_guid(), mstb parameter has to be checked, otherwise NULL dereference may occur in the call to
the memcpy() and cause following:
[12579.365869] BUG: kernel NULL pointer dereference, address: 0000000000000049 [12579.365878] #PF: supervisor read access in kernel mode [12579.365880] #PF: error_code(0x0000) - not-present page [12579.365882] PGD 0 P4D 0 [12579.365887] Oops: 0000 [#1] PREEMPT SMP NOPTI ... [12579.365895] Workqueue: events_long drm_dp_mst_up_req_work [12579.365899] RIP: 0010:memcmp+0xb/0x29 [12579.365921] Call Trace: [12579.365927] get_mst_branch_device_by_guid_helper+0x22/0x64 [12579.365930] drm_dp_mst_up_req_work+0x137/0x416 [12579.365933] process_one_work+0x1d0/0x419 [12579.365935] worker_thread+0x11a/0x289 [12579.365938] kthread+0x13e/0x14f [12579.365941] ? process_one_work+0x419/0x419 [12579.365943] ? kthread_blkcg+0x31/0x31 [12579.365946] ret_from_fork+0x1f/0x30
As get_mst_branch_device_by_guid_helper() is recursive, moving condition to the first line allow to remove a similar one for step over of NULL elements inside a loop.
--- drivers/gpu/drm/display/drm_dp_mst_topology.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/display/drm_dp_mst_topology.c +3 -3
@@ -2574,14 +2574,14 @@ static struct drm_dp_mst_branch *get_mststruct drm_dp_mst_branch *found_mstb;struct drm_dp_mst_port *port; +if (!mstb) +return NULL ; +if (memcmp (mstb->guid, guid,16 ) ==0 )return mstb;list_for_each_entry (port, &mstb->ports, next) { -if (!port->mstb) -continue ; - found_mstb =get_mst_branch_device_by_guid_helper (port->mstb, guid);if (found_mstb)
Greg Kroah-Hartman
maintainerPATCH 43/112 btrfs: remove v0 extent handling
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
[ Upstream commit 182741d287fb1ea870ee6ef45aa1915a0b031233 ]
The v0 extent item has been deprecated for a long time, and we don't have any report from the community either.
So it's time to remove the v0 extent specific error handling, and just treat them as regular extent tree corruption.
This patch would remove the btrfs_print_v0_err() helper, and enhance the involved error handling to treat them just as any extent tree corruption. No reports regarding v0 extents have been seen since the graceful handling was added in 2018.
This involves:
- btrfs_backref_add_tree_node()
This change is a little tricky, the new code is changed to only handle BTRFS_TREE_BLOCK_REF_KEY and BTRFS_SHARED_BLOCK_REF_KEY.
But this is safe, as we have rejected any unknown inline refs through btrfs_get_extent_inline_ref_type().
For keyed backrefs, we're safe to skip anything we don't know (that's if it can pass tree-checker in the first place).
- btrfs_lookup_extent_info()
- lookup_inline_extent_backref()
- run_delayed_extent_op()
- __btrfs_free_extent()
- add_tree_block()
Regular error handling of unexpected extent tree item, and abort transaction (if we have a trans handle).
- remove_extent_data_ref()
It's pretty much the same as the regular rejection of unknown backref key.
But for this particular case, we can also remove a BUG_ON().
- extent_data_ref_count()
We can remove the BTRFS_EXTENT_REF_V0_KEY BUG_ON(), as it would be rejected by the only caller.
- btrfs_print_leaf()
Remove the handling for BTRFS_EXTENT_REF_V0_KEY.
Stable-dep-of: eb96e221937a ("btrfs: fix unwritten extent buffer after snapshotting a new subvolume")
--- fs/btrfs/backref.c | 29 +++++++++++---------------- fs/btrfs/extent-tree.c | 35 ++++++++++++++++++++------------- fs/btrfs/messages.c | 6 ------ fs/btrfs/messages.h | 2 -- fs/btrfs/print-tree.c | 10 ++++------ fs/btrfs/relocation.c | 11 ++++++----- include/trace/events/btrfs.h | 1 - include/uapi/linux/btrfs_tree.h | 6 +++++- 8 files changed, 48 insertions(+), 52 deletions(-)
fs/btrfs/backref.c +12 -17
@@ -3373,7 +3373,6 @@ int btrfs_backref_add_tree_node(struct btrfs_backref_cache *cache,struct btrfs_key *node_key, struct btrfs_backref_node *cur) { - struct btrfs_fs_info *fs_info = cache->fs_info; struct btrfs_backref_edge *edge;struct btrfs_backref_node *exist;int ret;
@@ -3462,25 +3461,21 @@ int btrfs_backref_add_tree_node(struct btrfs_backref_cache *cache, ret =handle_direct_tree_backref (cache, &key, cur);if (ret <0 ) goto out; -continue ; - }else if (unlikely (key.type ==BTRFS_EXTENT_REF_V0_KEY )) { - ret = -EINVAL ; -btrfs_print_v0_err (fs_info); -btrfs_handle_fs_error (fs_info, ret,NULL ); - goto out; - }else if (key.type !=BTRFS_TREE_BLOCK_REF_KEY ) { -continue ; + }else if (key.type ==BTRFS_TREE_BLOCK_REF_KEY ) { +/* +* key.type == BTRFS_TREE_BLOCK_REF_KEY, inline ref +* offset means the root objectid. We need to search +* the tree to get its parent bytenr. +*/ + ret =handle_indirect_tree_backref (cache, path, &key, node_key, + cur); +if (ret <0 ) + goto out; } -/* -* key.type == BTRFS_TREE_BLOCK_REF_KEY, inline ref offset -* means the root objectid. We need to search the tree to get -* its parent bytenr. +* Unrecognized tree backref items (if it can pass tree-checker) +* would be ignored. */ - ret =handle_indirect_tree_backref (cache, path, &key, node_key, - cur); -if (ret <0 ) - goto out; } ret =0 ; cur->checked =1 ;
fs/btrfs/extent-tree.c +21 -14
@@ -187,8 +187,10 @@ int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans, num_refs =btrfs_extent_refs (leaf, ei); extent_flags =btrfs_extent_flags (leaf, ei); }else { - ret = -EINVAL ; -btrfs_print_v0_err (fs_info); + ret = -EUCLEAN ; +btrfs_err (fs_info, +"unexpected extent item size, has %u expect >= %zu" , + item_size,sizeof (*ei));if (trans)btrfs_abort_transaction (trans, ret);else
@@ -624,12 +626,12 @@ static noinline int remove_extent_data_ref(struct btrfs_trans_handle *trans, ref2 =btrfs_item_ptr (leaf, path->slots[0 ], struct btrfs_shared_data_ref); num_refs =btrfs_shared_data_ref_count (leaf, ref2); - }else if (unlikely (key.type ==BTRFS_EXTENT_REF_V0_KEY )) { -btrfs_print_v0_err (trans->fs_info); -btrfs_abort_transaction (trans, -EINVAL ); -return -EINVAL ; }else { -BUG (); +btrfs_err (trans->fs_info, +"unrecognized backref key (%llu %u %llu)" , + key.objectid, key.type, key.offset); +btrfs_abort_transaction (trans, -EUCLEAN ); +return -EUCLEAN ; }BUG_ON (num_refs < refs_to_drop);
@@ -660,7 +662,6 @@ static noinline u32 extent_data_ref_count(struct btrfs_path *path, leaf = path->nodes[0 ];btrfs_item_key_to_cpu (leaf, &key, path->slots[0 ]); -BUG_ON (key.type ==BTRFS_EXTENT_REF_V0_KEY );if (iref) {/* * If type is invalid, we should have bailed out earlier than
@@ -881,8 +882,10 @@ int lookup_inline_extent_backref(struct btrfs_trans_handle *trans, leaf = path->nodes[0 ]; item_size =btrfs_item_size (leaf, path->slots[0 ]);if (unlikely (item_size <sizeof (*ei))) { - err = -EINVAL ; -btrfs_print_v0_err (fs_info); + err = -EUCLEAN ; +btrfs_err (fs_info, +"unexpected extent item size, has %llu expect >= %zu" , + item_size,sizeof (*ei));btrfs_abort_transaction (trans, err); goto out; }
@@ -1683,8 +1686,10 @@ static int run_delayed_extent_op(struct btrfs_trans_handle *trans, item_size =btrfs_item_size (leaf, path->slots[0 ]);if (unlikely (item_size <sizeof (*ei))) { - err = -EINVAL ; -btrfs_print_v0_err (fs_info); + err = -EUCLEAN ; +btrfs_err (fs_info, +"unexpected extent item size, has %u expect >= %zu" , + item_size,sizeof (*ei));btrfs_abort_transaction (trans, err); goto out; }
@@ -3113,8 +3118,10 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans, leaf = path->nodes[0 ]; item_size =btrfs_item_size (leaf, extent_slot);if (unlikely (item_size <sizeof (*ei))) { - ret = -EINVAL ; -btrfs_print_v0_err (info); + ret = -EUCLEAN ; +btrfs_err (trans->fs_info, +"unexpected extent item size, has %u expect >= %zu" , + item_size,sizeof (*ei));btrfs_abort_transaction (trans, ret); goto out; }
fs/btrfs/messages.c +0 -6
@@ -252,12 +252,6 @@ void __cold _btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, }#endif -void __cold btrfs_print_v0_err (struct btrfs_fs_info *fs_info) -{ -btrfs_err (fs_info, -"Unsupported V0 extent filesystem detected. Aborting. Please re-create your filesystem with a newer kernel" ); -} -#if BITS_PER_LONG ==32 void __cold btrfs_warn_32bit_limit (struct btrfs_fs_info *fs_info) {
fs/btrfs/messages.h +0 -2
@@ -181,8 +181,6 @@ do { \#define ASSERT (expr) (void)(expr)#endif -void __cold btrfs_print_v0_err (struct btrfs_fs_info *fs_info); - __printf(5, 6)__cold void __btrfs_handle_fs_error(struct btrfs_fs_info *fs_info, const char *function,
fs/btrfs/print-tree.c +4 -6
@@ -95,8 +95,10 @@ static void print_extent_item(const struct extent_buffer *eb, int slot, int typeint ref_index =0 ;if (unlikely (item_size <sizeof (*ei))) { -btrfs_print_v0_err (eb->fs_info); -btrfs_handle_fs_error (eb->fs_info, -EINVAL ,NULL ); +btrfs_err (eb->fs_info, +"unexpected extent item size, has %u expect >= %zu" , + item_size,sizeof (*ei)); +btrfs_handle_fs_error (eb->fs_info, -EUCLEAN ,NULL ); } ei = btrfs_item_ptr(eb, slot, struct btrfs_extent_item);
@@ -291,10 +293,6 @@ void btrfs_print_leaf(const struct extent_buffer *l)btrfs_file_extent_num_bytes (l, fi), btrfs_file_extent_ram_bytes(l, fi));break ; -case BTRFS_EXTENT_REF_V0_KEY : -btrfs_print_v0_err (fs_info); -btrfs_handle_fs_error (fs_info, -EINVAL ,NULL ); -break ;case BTRFS_BLOCK_GROUP_ITEM_KEY : bi =btrfs_item_ptr (l, i, struct btrfs_block_group_item);
fs/btrfs/relocation.c +6 -5
@@ -3256,12 +3256,13 @@ static int add_tree_block(struct reloc_control *rc,if (type ==BTRFS_TREE_BLOCK_REF_KEY ) owner =btrfs_extent_inline_ref_offset (eb, iref); } - }else if (unlikely (item_size ==sizeof (struct btrfs_extent_item_v0 ))) { -btrfs_print_v0_err (eb->fs_info); -btrfs_handle_fs_error (eb->fs_info, -EINVAL ,NULL ); -return -EINVAL ; }else { -BUG (); +btrfs_print_leaf (eb); +btrfs_err (rc->block_group->fs_info, +"unrecognized tree backref at tree block %llu slot %u" , + eb->start, path->slots[0 ]); +btrfs_release_path (path); +return -EUCLEAN ; }btrfs_release_path (path);
include/trace/events/btrfs.h +0 -1
@@ -38,7 +38,6 @@ struct find_free_extent_ctl;__print_symbolic (type, \ { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \ { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \ - { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \ { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \ { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" })
include/uapi/linux/btrfs_tree.h +5 -1
@@ -220,7 +220,11 @@#define BTRFS_EXTENT_DATA_REF_KEY 178 -#define BTRFS_EXTENT_REF_V0_KEY 180 +/* +* Obsolete key. Defintion removed in 6.6, value may be reused in the future. +* +* #define BTRFS_EXTENT_REF_V0_KEY 180 +*/ #define BTRFS_SHARED_BLOCK_REF_KEY 182
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 44/112 btrfs: fix unwritten extent buffer after snapshotting a new subvolume
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit eb96e221937af3c7bb8a63208dbab813ca5d3d7e ]
When creating a snapshot of a subvolume that was created in the current transaction, we can end up not persisting a dirty extent buffer that is referenced by the snapshot, resulting in IO errors due to checksum failures when trying to read the extent buffer later from disk. A sequence of steps that leads to this is the following:
1) At ioctl.c:create_subvol() we allocate an extent buffer, with logical address 36007936, for the leaf/root of a new subvolume that has an ID of 291. We mark the extent buffer as dirty, and at this point the subvolume tree has a single node/leaf which is also its root (level 0);
2) We no longer commit the transaction used to create the subvolume at create_subvol(). We used to, but that was recently removed in commit 1b53e51a4a8f ("btrfs: don't commit transaction for every subvol create");
3) The transaction used to create the subvolume has an ID of 33, so the extent buffer 36007936 has a generation of 33;
4) Several updates happen to subvolume 291 during transaction 33, several files created and its tree height changes from 0 to 1, so we end up with a new root at level 1 and the extent buffer 36007936 is now a leaf of that new root node, which is extent buffer 36048896.
The commit root remains as 36007936, since we are still at transaction 33;
5) Creation of a snapshot of subvolume 291, with an ID of 292, starts at ioctl.c:create_snapshot(). This triggers a commit of transaction 33 and we end up at transaction.c:create_pending_snapshot(), in the critical section of a transaction commit.
There we COW the root of subvolume 291, which is extent buffer 36048896. The COW operation returns extent buffer 36048896, since there's no need to COW because the extent buffer was created in this transaction and it was not written yet.
The we call btrfs_copy_root() against the root node 36048896. During this operation we allocate a new extent buffer to turn into the root node of the snapshot, copy the contents of the root node 36048896 into this snapshot root extent buffer, set the owner to 292 (the ID of the snapshot), etc, and then we call btrfs_inc_ref(). This will create a delayed reference for each leaf pointed by the root node with a reference root of 292 - this includes a reference for the leaf 36007936.
After that we set the bit BTRFS_ROOT_FORCE_COW in the root's state.
Then we call btrfs_insert_dir_item(), to create the directory entry in in the tree of subvolume 291 that points to the snapshot. This ends up needing to modify leaf 36007936 to insert the respective directory items. Because the bit BTRFS_ROOT_FORCE_COW is set for the root's state, we need to COW the leaf. We end up at btrfs_force_cow_block() and then at update_ref_for_cow().
At update_ref_for_cow() we call btrfs_block_can_be_shared() which returns false, despite the fact the leaf 36007936 is shared - the subvolume's root and the snapshot's root point to that leaf. The reason that it incorrectly returns false is because the commit root of the subvolume is extent buffer 36007936 - it was the initial root of the subvolume when we created it. So btrfs_block_can_be_shared() which has the following logic:
int btrfs_block_can_be_shared(struct btrfs_root *root,
struct extent_buffer *buf)
{
if (test_bit(BTRFS_ROOT_SHAREABLE, &root->state) &&
buf != root->node && buf != root->commit_root &&
(btrfs_header_generation(buf) <=
btrfs_root_last_snapshot(&root->root_item) ||
btrfs_header_flag(buf, BTRFS_HEADER_FLAG_RELOC)))
return 1;return 0;
}
Returns false (0) since 'buf' (extent buffer 36007936) matches the root's commit root.
As a result, at update_ref_for_cow(), we don't check for the number of references for extent buffer 36007936, we just assume it's not shared and therefore that it has only 1 reference, so we set the local variable 'refs' to 1.
Later on, in the final if-else statement at update_ref_for_cow():
static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct extent_buffer *buf,
struct extent_buffer *cow,
int *last_ref)
{
(...)
if (refs > 1) {
(...)
} else {
(...)
btrfs_clear_buffer_dirty(trans, buf);
*last_ref = 1;
}
}So we mark the extent buffer 36007936 as not dirty, and as a result we don't write it to disk later in the transaction commit, despite the fact that the snapshot's root points to it.
Attempting to access the leaf or dumping the tree for example shows that the extent buffer was not written:
$ btrfs inspect-internal dump-tree -t 292 /dev/sdb
btrfs-progs v6.2.2
file tree key (292 ROOT_ITEM 33)
node 36110336 level 1 items 2 free space 119 generation 33 owner 292
node 36110336 flags 0x1(WRITTEN) backref revision 1
checksum stored a8103e3e
checksum calced a8103e3e
fs uuid 90c9a46f-ae9f-4626-9aff-0cbf3e2e3a79
chunk uuid e8c9c885-78f4-4d31-85fe-89e5f5fd4a07
key (256 INODE_ITEM 0) block 36007936 gen 33
key (257 EXTENT_DATA 0) block 36052992 gen 33
checksum verify failed on 36007936 wanted 0x00000000 found 0x86005f29
checksum verify failed on 36007936 wanted 0x00000000 found 0x86005f29
total bytes 107374182400
bytes used 38572032
uuid 90c9a46f-ae9f-4626-9aff-0cbf3e2e3a79The respective on disk region is full of zeroes as the device was trimmed at mkfs time.
Obviously 'btrfs check' also detects and complains about this:
$ btrfs check /dev/sdb
Opening filesystem to check...
Checking filesystem on /dev/sdb
UUID: 90c9a46f-ae9f-4626-9aff-0cbf3e2e3a79
generation: 33 (33)
[1/7] checking root items
[2/7] checking extents
checksum verify failed on 36007936 wanted 0x00000000 found 0x86005f29
checksum verify failed on 36007936 wanted 0x00000000 found 0x86005f29
checksum verify failed on 36007936 wanted 0x00000000 found 0x86005f29
bad tree block 36007936, bytenr mismatch, want=36007936, have=0
owner ref check failed [36007936 4096]
ERROR: errors found in extent allocation tree or chunk allocation
[3/7] checking free space tree
[4/7] checking fs roots
checksum verify failed on 36007936 wanted 0x00000000 found 0x86005f29
checksum verify failed on 36007936 wanted 0x00000000 found 0x86005f29
checksum verify failed on 36007936 wanted 0x00000000 found 0x86005f29
bad tree block 36007936, bytenr mismatch, want=36007936, have=0
The following tree block(s) is corrupted in tree 292:
tree block bytenr: 36110336, level: 1, node key: (256, 1, 0)
root 292 root dir 256 not found
ERROR: errors found in fs roots
found 38572032 bytes used, error(s) found
total csum bytes: 16048
total tree bytes: 1265664
total fs tree bytes: 1118208
total extent tree bytes: 65536
btree space waste bytes: 562598
file data blocks allocated: 65978368
referenced 36569088Fix this by updating btrfs_block_can_be_shared() to consider that an extent buffer may be shared if it matches the commit root and if its generation matches the current transaction's generation.
This can be reproduced with the following script:
$ cat test.sh #!/bin/bash
MNT=/mnt/sdi
DEV=/dev/sdi
# Use a filesystem with a 64K node size so that we have the same node
# size on every machine regardless of its page size (on x86_64 default # node size is 16K due to the 4K page size, while on PPC it's 64K by # default). This way we can make sure we are able to create a btree for # the subvolume with a height of 2. mkfs.btrfs -f -n 64K $DEV mount $DEV $MNT
btrfs subvolume create $MNT/subvol
# Create a few empty files on the subvolume, this bumps its btree
# height to 2 (root node at level 1 and 2 leaves).
for ((i = 1; i <= 300; i++)); do
echo -n > $MNT/subvol/file_$i
donebtrfs subvolume snapshot -r $MNT/subvol $MNT/subvol/snap
umount $DEV
btrfs check $DEV
Running it on a 6.5 kernel (or any 6.6-rc kernel at the moment):
$ ./test.sh
Create subvolume '/mnt/sdi/subvol'
Create a readonly snapshot of '/mnt/sdi/subvol' in '/mnt/sdi/subvol/snap'
Opening filesystem to check...
Checking filesystem on /dev/sdi
UUID: bbdde2ff-7d02-45ca-8a73-3c36f23755a1
[1/7] checking root items
[2/7] checking extents
parent transid verify failed on 30539776 wanted 7 found 5
parent transid verify failed on 30539776 wanted 7 found 5
parent transid verify failed on 30539776 wanted 7 found 5
Ignoring transid failure
owner ref check failed [30539776 65536]
ERROR: errors found in extent allocation tree or chunk allocation
[3/7] checking free space tree
[4/7] checking fs roots
parent transid verify failed on 30539776 wanted 7 found 5
Ignoring transid failure
Wrong key of child node/leaf, wanted: (256, 1, 0), have: (2, 132, 0)
Wrong generation of child node/leaf, wanted: 5, have: 7
root 257 root dir 256 not found
ERROR: errors found in fs roots
found 917504 bytes used, error(s) found
total csum bytes: 0
total tree bytes: 851968
total fs tree bytes: 393216
total extent tree bytes: 65536
btree space waste bytes: 736550
file data blocks allocated: 0
referenced 0A test case for fstests will follow soon.
--- fs/btrfs/backref.c | 14 +++++++++----- fs/btrfs/backref.h | 3 ++- fs/btrfs/ctree.c | 21 ++++++++++++++++----- fs/btrfs/ctree.h | 3 ++- fs/btrfs/relocation.c | 7 ++++--- 5 files changed, 33 insertions(+), 15 deletions(-)
fs/btrfs/backref.c +9 -5
@@ -3196,12 +3196,14 @@ static int handle_direct_tree_backref(struct btrfs_backref_cache *cache,* We still need to do a tree search to find out the parents. This is for * TREE_BLOCK_REF backref (keyed or inlined). * +* @trans: Transaction handle. * @ref_key: The same as @ref_key in handle_direct_tree_backref() * @tree_key: The first key of this tree block. * @path: A clean (released) path, to avoid allocating path every time * the function get called. */ -static int handle_indirect_tree_backref(struct btrfs_backref_cache *cache, +static int handle_indirect_tree_backref(struct btrfs_trans_handle *trans, + struct btrfs_backref_cache *cache, struct btrfs_path *path, struct btrfs_key *ref_key, struct btrfs_key *tree_key,
@@ -3315,7 +3317,7 @@ static int handle_indirect_tree_backref(struct btrfs_backref_cache *cache,* If we know the block isn't shared we can avoid * checking its backrefs. */ -if (btrfs_block_can_be_shared (root, eb)) +if (btrfs_block_can_be_shared (trans, root, eb)) upper->checked =0 ;else upper->checked =1 ;
@@ -3363,11 +3365,13 @@ static int handle_indirect_tree_backref(struct btrfs_backref_cache *cache,* links aren't yet bi-directional. Needs to finish such links. * Use btrfs_backref_finish_upper_links() to finish such linkage. * +* @trans: Transaction handle. * @path: Released path for indirect tree backref lookup * @iter: Released backref iter for extent tree search * @node_key: The first key of the tree block */ -int btrfs_backref_add_tree_node(struct btrfs_backref_cache *cache, +int btrfs_backref_add_tree_node(struct btrfs_trans_handle *trans, + struct btrfs_backref_cache *cache, struct btrfs_path *path, struct btrfs_backref_iter *iter, struct btrfs_key *node_key,
@@ -3467,8 +3471,8 @@ int btrfs_backref_add_tree_node(struct btrfs_backref_cache *cache,* offset means the root objectid. We need to search * the tree to get its parent bytenr. */ - ret =handle_indirect_tree_backref (cache, path, &key, node_key, - cur); + ret =handle_indirect_tree_backref (trans, cache, path, + &key, node_key, cur);if (ret <0 ) goto out; }
fs/btrfs/backref.h +2 -1
@@ -540,7 +540,8 @@ static inline void btrfs_backref_panic(struct btrfs_fs_info *fs_info, bytenr); } -int btrfs_backref_add_tree_node(struct btrfs_backref_cache *cache, +int btrfs_backref_add_tree_node(struct btrfs_trans_handle *trans, + struct btrfs_backref_cache *cache, struct btrfs_path *path, struct btrfs_backref_iter *iter, struct btrfs_key *node_key,
fs/btrfs/ctree.c +16 -5
@@ -367,7 +367,8 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,/* * check if the tree block can be shared by multiple trees */ -int btrfs_block_can_be_shared (struct btrfs_root *root, +int btrfs_block_can_be_shared (struct btrfs_trans_handle *trans, +struct btrfs_root *root,struct extent_buffer *buf) {/*
@@ -376,11 +377,21 @@ int btrfs_block_can_be_shared(struct btrfs_root *root,* not allocated by tree relocation, we know the block is not shared. */ if (test_bit (BTRFS_ROOT_SHAREABLE , &root->state) && - buf != root->node && buf != root->commit_root && + buf != root->node && (btrfs_header_generation (buf) <=btrfs_root_last_snapshot (&root->root_item) || -btrfs_header_flag (buf,BTRFS_HEADER_FLAG_RELOC ))) -return 1 ; +btrfs_header_flag (buf,BTRFS_HEADER_FLAG_RELOC ))) { +if (buf != root->commit_root) +return 1 ; +/* +* An extent buffer that used to be the commit root may still be +* shared because the tree height may have increased and it +* became a child of a higher level root. This can happen when +* snapshotting a subvolume created in the current transaction. +*/ +if (btrfs_header_generation (buf) == trans->transid) +return 1 ; + }return 0 ; }
@@ -415,7 +426,7 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans,* are only allowed for blocks use full backrefs. */ -if (btrfs_block_can_be_shared (root, buf)) { +if (btrfs_block_can_be_shared (trans, root, buf)) { ret =btrfs_lookup_extent_info (trans, fs_info, buf->start,btrfs_header_level (buf),1 , &refs, &flags);
fs/btrfs/ctree.h +2 -1
@@ -540,7 +540,8 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,struct btrfs_root *root, struct extent_buffer *buf, struct extent_buffer **cow_ret, u64 new_root_objectid); -int btrfs_block_can_be_shared (struct btrfs_root *root, +int btrfs_block_can_be_shared (struct btrfs_trans_handle *trans, +struct btrfs_root *root,struct extent_buffer *buf);int btrfs_del_ptr (struct btrfs_trans_handle *trans,struct btrfs_root *root,struct btrfs_path *path,int level,int slot);
fs/btrfs/relocation.c +4 -3
@@ -466,6 +466,7 @@ static bool handle_useless_nodes(struct reloc_control *rc,* cached. */ static noinline_for_stack struct btrfs_backref_node *build_backref_tree( +struct btrfs_trans_handle *trans,struct reloc_control *rc,struct btrfs_key *node_key,int level,u64 bytenr) {
@@ -499,8 +500,8 @@ static noinline_for_stack struct btrfs_backref_node *build_backref_tree(/* Breadth-first search to build backref cache */ do { - ret = btrfs_backref_add_tree_node(cache, path, iter, node_key, - cur); + ret = btrfs_backref_add_tree_node(trans, cache, path, iter, + node_key, cur); if (ret < 0) { err = ret; goto out;
@@ -2803,7 +2804,7 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans,/* Do tree relocation */ rbtree_postorder_for_each_entry_safe (block, next, blocks, rb_node) { - node =build_backref_tree (rc, &block->key, + node =build_backref_tree (trans, rc, &block->key, block->level, block->bytenr);if (IS_ERR (node)) { err =PTR_ERR (node);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 45/112 ARM: OMAP: timer32K: fix all kernel-doc warnings
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit 7eeca8ccd1066c68d6002dbbe26433f8c17c53eb ]
Fix kernel-doc warnings reported by the kernel test robot:
timer32k.c:186: warning: cannot understand function prototype: 'struct timespec64 persistent_ts; ' timer32k.c:191: warning: Function parameter or member 'ts' not described in 'omap_read_persistent_clock64' timer32k.c:216: warning: Function parameter or member 'vbase' not described in 'omap_init_clocksource_32k' timer32k.c:216: warning: Excess function parameter 'pbase' description in 'omap_init_clocksource_32k' timer32k.c:216: warning: Excess function parameter 'size' description in 'omap_init_clocksource_32k' timer32k.c:216: warning: No description found for return value of 'omap_init_clocksource_32k'
Message-ID: <[email protected]>
--- arch/arm/mach-omap1/timer32k.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
arch/arm/mach-omap1/timer32k.c +7 -7
@@ -176,17 +176,18 @@ static u64 notrace omap_32k_read_sched_clock(void)return sync32k_cnt_reg ?readl_relaxed (sync32k_cnt_reg) :0 ; } +static struct timespec64 persistent_ts; +static cycles_t cycles; +static unsigned int persistent_mult, persistent_shift; +/** * omap_read_persistent_clock64 - Return time from a persistent clock. +* @ts: &struct timespec64 for the returned time * * Reads the time from a source which isn't disabled during PM, the * 32k sync timer. Convert the cycles elapsed since last read into * nsecs and adds to a monotonically increasing timespec64. */ -static struct timespec64 persistent_ts; -static cycles_t cycles; -static unsigned int persistent_mult, persistent_shift; -static void omap_read_persistent_clock64 (struct timespec64 *ts) {unsigned long long nsecs;
@@ -206,10 +207,9 @@ static void omap_read_persistent_clock64(struct timespec64 *ts)/** * omap_init_clocksource_32k - setup and register counter 32k as a * kernel clocksource -* @pbase: base addr of counter_32k module -* @size: size of counter_32k to map +* @vbase: base addr of counter_32k module * -* Returns 0 upon success or negative error code upon failure. +* Returns: %0 upon success or negative error code upon failure. * */ static int __init omap_init_clocksource_32k (void __iomem *vbase)
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 46/112 firmware/imx-dsp: Fix use_after_free in imx_dsp_setup_channels()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hao Ge <[email protected]>
[ Upstream commit 1558b1a8dd388f5fcc3abc1e24de854a295044c3 ]
dsp_chan->name and chan_name points to same block of memory, because dev_err still needs to be used it,so we need free it's memory after use to avoid use_after_free.
--- drivers/firmware/imx/imx-dsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/imx/imx-dsp.c +1 -1
@@ -115,11 +115,11 @@ static int imx_dsp_setup_channels(struct imx_dsp_ipc *dsp_ipc) dsp_chan->idx = i %2 ; dsp_chan->ch =mbox_request_channel_byname (cl, chan_name);if (IS_ERR (dsp_chan->ch)) { -kfree (dsp_chan->name); ret =PTR_ERR (dsp_chan->ch);if (ret != -EPROBE_DEFER )dev_err (dev,"Failed to request mbox chan %s ret %d\n" , chan_name, ret); +kfree (dsp_chan->name); goto out; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 47/112 clk: ti: Fix missing omap4 mcbsp functional clock and aliases
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Lindgren <[email protected]>
[ Upstream commit cc2d819dd7df94a72bde7b9b9331a6535084092d ]
We are using a wrong mcbsp functional clock. The interconnect target module driver provided clock for mcbsp is not same as the mcbsp functional clock known as the gfclk main_clk. The mcbsp functional clocks for mcbsp should have been added before we dropped the legacy platform data.
Additionally we are also missing the clock aliases for the clocks used by the audio driver if reparenting is needed. This causes audio driver errors like "CLKS: could not clk_get() prcm_fck" for mcbsp as reported by Andreas. The mcbsp clock aliases too should have been added before we dropped the legacy platform data.
Let's add the clocks and aliases with a single patch to fix the issue.
--- arch/arm/boot/dts/ti/omap/omap4-l4-abe.dtsi | 6 ++++++ arch/arm/boot/dts/ti/omap/omap4-l4.dtsi | 2 ++ drivers/clk/ti/clk-44xx.c | 5 +++++ 3 files changed, 13 insertions(+)
arch/arm/boot/dts/ti/omap/omap4-l4-abe.dtsi +6 -0
@@ -109,6 +109,8 @@ reg = <0x0 0xff>, /* MPU private access */ <0x49022000 0xff>; /* L3 Interconnect */ reg-names = "mpu", "dma"; + clocks = <&abe_clkctrl OMAP4_MCBSP1_CLKCTRL 24>; + clock-names = "fck"; interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "common"; ti,buffer-size = <128>;
@@ -142,6 +144,8 @@ reg = <0x0 0xff>, /* MPU private access */ <0x49024000 0xff>; /* L3 Interconnect */ reg-names = "mpu", "dma"; + clocks = <&abe_clkctrl OMAP4_MCBSP2_CLKCTRL 24>; + clock-names = "fck"; interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "common"; ti,buffer-size = <128>;
@@ -175,6 +179,8 @@ reg = <0x0 0xff>, /* MPU private access */ <0x49026000 0xff>; /* L3 Interconnect */ reg-names = "mpu", "dma"; + clocks = <&abe_clkctrl OMAP4_MCBSP3_CLKCTRL 24>; + clock-names = "fck"; interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "common"; ti,buffer-size = <128>;
arch/arm/boot/dts/ti/omap/omap4-l4.dtsi +2 -0
@@ -2043,6 +2043,8 @@ compatible = "ti,omap4-mcbsp"; reg = <0x0 0xff>; /* L4 Interconnect */ reg-names = "mpu"; + clocks = <&l4_per_clkctrl OMAP4_MCBSP4_CLKCTRL 24>; + clock-names = "fck"; interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "common"; ti,buffer-size = <128>;
drivers/clk/ti/clk-44xx.c +5 -0
@@ -749,9 +749,14 @@ static struct ti_dt_clk omap44xx_clks[] = {DT_CLK (NULL ,"mcbsp1_sync_mux_ck" ,"abe-clkctrl:0028:26" ),DT_CLK (NULL ,"mcbsp2_sync_mux_ck" ,"abe-clkctrl:0030:26" ),DT_CLK (NULL ,"mcbsp3_sync_mux_ck" ,"abe-clkctrl:0038:26" ), +DT_CLK ("40122000.mcbsp" ,"prcm_fck" ,"abe-clkctrl:0028:26" ), +DT_CLK ("40124000.mcbsp" ,"prcm_fck" ,"abe-clkctrl:0030:26" ), +DT_CLK ("40126000.mcbsp" ,"prcm_fck" ,"abe-clkctrl:0038:26" ),DT_CLK (NULL ,"mcbsp4_sync_mux_ck" ,"l4-per-clkctrl:00c0:26" ), +DT_CLK ("48096000.mcbsp" ,"prcm_fck" ,"l4-per-clkctrl:00c0:26" ),DT_CLK (NULL ,"ocp2scp_usb_phy_phy_48m" ,"l3-init-clkctrl:00c0:8" ),DT_CLK (NULL ,"otg_60m_gfclk" ,"l3-init-clkctrl:0040:24" ), +DT_CLK (NULL ,"pad_fck" ,"pad_clks_ck" ),DT_CLK (NULL ,"per_mcbsp4_gfclk" ,"l4-per-clkctrl:00c0:24" ),DT_CLK (NULL ,"pmd_stm_clock_mux_ck" ,"emu-sys-clkctrl:0000:20" ), DT_CLK(NULL, "pmd_trace_clk_mux_ck", "emu-sys-clkctrl:0000:22"),
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 48/112 clk: ti: Fix missing omap5 mcbsp functional clock and aliases
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Lindgren <[email protected]>
[ Upstream commit 0b9a4a67c60d3e15b39a69d480a50ce7eeff9bc1 ]
We are using a wrong mcbsp functional clock. The interconnect target module driver provided clock for mcbsp is not same as the mcbsp functional clock known as the gfclk main_clk. The mcbsp functional clocks for mcbsp should have been added before we dropped the legacy platform data.
Additionally we are also missing the clock aliases for the clocks used by the audio driver if reparenting is needed. This causes audio driver errors like "CLKS: could not clk_get() prcm_fck" for mcbsp as reported by Andreas. The mcbsp clock aliases too should have been added before we dropped the legacy platform data.
Let's add the clocks and aliases with a single patch to fix the issue similar to omap4. On omap5, there is no mcbsp4 instance on the l4_per interconnect.
--- arch/arm/boot/dts/ti/omap/omap5-l4-abe.dtsi | 6 ++++++ drivers/clk/ti/clk-54xx.c | 4 ++++ 2 files changed, 10 insertions(+)
arch/arm/boot/dts/ti/omap/omap5-l4-abe.dtsi +6 -0
@@ -109,6 +109,8 @@ reg = <0x0 0xff>, /* MPU private access */ <0x49022000 0xff>; /* L3 Interconnect */ reg-names = "mpu", "dma"; + clocks = <&abe_clkctrl OMAP5_MCBSP1_CLKCTRL 24>; + clock-names = "fck"; interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "common"; ti,buffer-size = <128>;
@@ -142,6 +144,8 @@ reg = <0x0 0xff>, /* MPU private access */ <0x49024000 0xff>; /* L3 Interconnect */ reg-names = "mpu", "dma"; + clocks = <&abe_clkctrl OMAP5_MCBSP2_CLKCTRL 24>; + clock-names = "fck"; interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "common"; ti,buffer-size = <128>;
@@ -175,6 +179,8 @@ reg = <0x0 0xff>, /* MPU private access */ <0x49026000 0xff>; /* L3 Interconnect */ reg-names = "mpu", "dma"; + clocks = <&abe_clkctrl OMAP5_MCBSP3_CLKCTRL 24>; + clock-names = "fck"; interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "common"; ti,buffer-size = <128>;
drivers/clk/ti/clk-54xx.c +4 -0
@@ -565,15 +565,19 @@ static struct ti_dt_clk omap54xx_clks[] = {DT_CLK (NULL ,"gpio8_dbclk" ,"l4per-clkctrl:00f8:8" ),DT_CLK (NULL ,"mcbsp1_gfclk" ,"abe-clkctrl:0028:24" ),DT_CLK (NULL ,"mcbsp1_sync_mux_ck" ,"abe-clkctrl:0028:26" ), +DT_CLK ("40122000.mcbsp" ,"prcm_fck" ,"abe-clkctrl:0028:26" ),DT_CLK (NULL ,"mcbsp2_gfclk" ,"abe-clkctrl:0030:24" ),DT_CLK (NULL ,"mcbsp2_sync_mux_ck" ,"abe-clkctrl:0030:26" ), +DT_CLK ("40124000.mcbsp" ,"prcm_fck" ,"abe-clkctrl:0030:26" ),DT_CLK (NULL ,"mcbsp3_gfclk" ,"abe-clkctrl:0038:24" ),DT_CLK (NULL ,"mcbsp3_sync_mux_ck" ,"abe-clkctrl:0038:26" ), +DT_CLK ("40126000.mcbsp" ,"prcm_fck" ,"abe-clkctrl:0038:26" ),DT_CLK (NULL ,"mmc1_32khz_clk" ,"l3init-clkctrl:0008:8" ),DT_CLK (NULL ,"mmc1_fclk" ,"l3init-clkctrl:0008:25" ),DT_CLK (NULL ,"mmc1_fclk_mux" ,"l3init-clkctrl:0008:24" ),DT_CLK (NULL ,"mmc2_fclk" ,"l3init-clkctrl:0010:25" ),DT_CLK (NULL ,"mmc2_fclk_mux" ,"l3init-clkctrl:0010:24" ), +DT_CLK (NULL ,"pad_fck" ,"pad_clks_ck" ),DT_CLK (NULL ,"sata_ref_clk" ,"l3init-clkctrl:0068:8" ),DT_CLK (NULL ,"timer10_gfclk_mux" ,"l4per-clkctrl:0008:24" ), DT_CLK(NULL, "timer11_gfclk_mux", "l4per-clkctrl:0010:24"),
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 49/112 r8169: fix the KCSAN reported data-race in rtl_tx() while reading tp->cur_tx
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mirsad Goran Todorovac <[email protected]>
[ Upstream commit c1c0ce31b2420d5c173228a2132a492ede03d81f ]
KCSAN reported the following data-race:
==================================================================
BUG: KCSAN: data-race in rtl8169_poll [r8169] / rtl8169_start_xmit [r8169]
write (marked) to 0xffff888102474b74 of 4 bytes by task 5358 on cpu 29:rtl8169_start_xmit (drivers/net/ethernet/realtek/r8169_main.c:4254) r8169dev_hard_start_xmit (./include/linux/netdevice.h:4889 ./include/linux/netdevice.h:4903 net/core/dev.c:3544 net/core/dev.c:3560) sch_direct_xmit (net/sched/sch_generic.c:342)
__dev_queue_xmit (net/core/dev.c:3817 net/core/dev.c:4306) ip_finish_output2 (./include/linux/netdevice.h:3082 ./include/net/neighbour.h:526 ./include/net/neighbour.h:540 net/ipv4/ip_output.c:233) __ip_finish_output (net/ipv4/ip_output.c:311 net/ipv4/ip_output.c:293)
ip_finish_output (net/ipv4/ip_output.c:328)ip_output (net/ipv4/ip_output.c:435)ip_send_skb (./include/net/dst.h:458 net/ipv4/ip_output.c:127 net/ipv4/ip_output.c:1486) udp_send_skb (net/ipv4/udp.c:963)udp_sendmsg (net/ipv4/udp.c:1246)
inet_sendmsg (net/ipv4/af_inet.c:840 (discriminator 4)) sock_sendmsg (net/socket.c:730 net/socket.c:753)
__sys_sendto (net/socket.c:2177)__x64_sys_sendto (net/socket.c:2185)do_syscall_64 (arch/x86/entry/common.c:50 arch/x86/entry/common.c:80) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:120)
read to 0xffff888102474b74 of 4 bytes by interrupt on cpu 21:rtl8169_poll (drivers/net/ethernet/realtek/r8169_main.c:4397 drivers/net/ethernet/realtek/r8169_main.c:4581) r8169 __napi_poll (net/core/dev.c:6527)net_rx_action (net/core/dev.c:6596 net/core/dev.c:6727)__do_softirq (kernel/softirq.c:553)__irq_exit_rcu (kernel/softirq.c:427 kernel/softirq.c:632)irq_exit_rcu (kernel/softirq.c:647)common_interrupt (arch/x86/kernel/irq.c:247 (discriminator 14))asm_common_interrupt (./arch/x86/include/asm/idtentry.h:636)cpuidle_enter_state (drivers/cpuidle/cpuidle.c:291)cpuidle_enter (drivers/cpuidle/cpuidle.c:390)call_cpuidle (kernel/sched/idle.c:135)
do_idle (kernel/sched/idle.c:219 kernel/sched/idle.c:282) cpu_startup_entry (kernel/sched/idle.c:378 (discriminator 1)) start_secondary (arch/x86/kernel/smpboot.c:210 arch/x86/kernel/smpboot.c:294)
secondary_startup_64_no_verify (arch/x86/kernel/head_64.S:433)
value changed: 0x002f4815 -> 0x002f4816
Reported by Kernel Concurrency Sanitizer on:
CPU: 21 PID: 0 Comm: swapper/21 Tainted: G L 6.6.0-rc2-kcsan-00143-gb5cbe7c00aa0 #41 Hardware name: ASRock X670E PG Lightning/X670E PG Lightning, BIOS 1.21 04/26/2023 ==================================================================
The write side of drivers/net/ethernet/realtek/r8169_main.c is:
==================
4251 /* rtl_tx needs to see descriptor changes before updated tp->cur_tx */
4252 smp_wmb();
4253
→ 4254 WRITE_ONCE(tp->cur_tx, tp->cur_tx + frags + 1);
4255
4256 stop_queue = !netif_subqueue_maybe_stop(dev, 0, rtl_tx_slots_avail(tp),
4257 R8169_TX_STOP_THRS,
4258 R8169_TX_START_THRS);
The read side is the function rtl_tx():
4355 static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp,
4356 int budget)
4357 {
4358 unsigned int dirty_tx, bytes_compl = 0, pkts_compl = 0;
4359 struct sk_buff *skb;
4360
4361 dirty_tx = tp->dirty_tx;
4362
4363 while (READ_ONCE(tp->cur_tx) != dirty_tx) {
4364 unsigned int entry = dirty_tx % NUM_TX_DESC;
4365 u32 status;
4366
4367 status = le32_to_cpu(tp->TxDescArray[entry].opts1);
4368 if (status & DescOwn)
4369 break;
4370
4371 skb = tp->tx_skb[entry].skb;
4372 rtl8169_unmap_tx_skb(tp, entry);
4373
4374 if (skb) {
4375 pkts_compl++;
4376 bytes_compl += skb->len;
4377 napi_consume_skb(skb, budget);
4378 }
4379 dirty_tx++;
4380 }
4381
4382 if (tp->dirty_tx != dirty_tx) {
4383 dev_sw_netstats_tx_add(dev, pkts_compl, bytes_compl);
4384 WRITE_ONCE(tp->dirty_tx, dirty_tx);
4385
4386 netif_subqueue_completed_wake(dev, 0, pkts_compl, bytes_compl,
4387 rtl_tx_slots_avail(tp),
4388 R8169_TX_START_THRS);
4389 /*
4390 * 8168 hack: TxPoll requests are lost when the Tx packets are
4391 * too close. Let's kick an extra TxPoll request when a burst
4392 * of start_xmit activity is detected (if it is not detected,
4393 * it is slow enough). -- FR
4394 * If skb is NULL then we come here again once a tx irq is
4395 * triggered after the last fragment is marked transmitted.
4396 */ → 4397 if (tp->cur_tx != dirty_tx && skb)
4398 rtl8169_doorbell(tp);
4399 }
4400 }
Obviously from the code, an earlier detected data-race for tp->cur_tx was fixed in the line 4363:
4363 while (READ_ONCE(tp->cur_tx) != dirty_tx) {but the same solution is required for protecting the other access to tp->cur_tx:
→ 4397 if (READ_ONCE(tp->cur_tx) != dirty_tx && skb)
4398 rtl8169_doorbell(tp);
The write in the line 4254 is protected with WRITE_ONCE(), but the read in the line 4397 might have suffered read tearing under some compiler optimisations.
The fix eliminated the KCSAN data-race report for this bug.
It is yet to be evaluated what happens if tp->cur_tx changes between the test in line 4363 and line 4397. This test should certainly not be cached by the compiler in some register for such a long time, while asynchronous writes to tp->cur_tx might have occurred in line 4254 in the meantime.
--- drivers/net/ethernet/realtek/r8169_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/realtek/r8169_main.c +1 -1
@@ -4394,7 +4394,7 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp,* If skb is NULL then we come here again once a tx irq is * triggered after the last fragment is marked transmitted. */ -if (tp->cur_tx != dirty_tx && skb) +if (READ_ONCE (tp->cur_tx) != dirty_tx && skb)rtl8169_doorbell (tp); } }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 50/112 r8169: fix the KCSAN reported data-race in rtl_tx while reading TxDescArray[entry].opts1
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mirsad Goran Todorovac <[email protected]>
[ Upstream commit dcf75a0f6bc136de94e88178ae5f51b7f879abc9 ]
KCSAN reported the following data-race:
==================================================================
BUG: KCSAN: data-race in rtl8169_poll (drivers/net/ethernet/realtek/r8169_main.c:4368 drivers/net/ethernet/realtek/r8169_main.c:4581) r8169
race at unknown origin, with read to 0xffff888140d37570 of 4 bytes by interrupt on cpu 21:rtl8169_poll (drivers/net/ethernet/realtek/r8169_main.c:4368 drivers/net/ethernet/realtek/r8169_main.c:4581) r8169 __napi_poll (net/core/dev.c:6527)net_rx_action (net/core/dev.c:6596 net/core/dev.c:6727)__do_softirq (kernel/softirq.c:553)__irq_exit_rcu (kernel/softirq.c:427 kernel/softirq.c:632)irq_exit_rcu (kernel/softirq.c:647)sysvec_apic_timer_interrupt (arch/x86/kernel/apic/apic.c:1074 (discriminator 14)) asm_sysvec_apic_timer_interrupt (./arch/x86/include/asm/idtentry.h:645)cpuidle_enter_state (drivers/cpuidle/cpuidle.c:291)cpuidle_enter (drivers/cpuidle/cpuidle.c:390)call_cpuidle (kernel/sched/idle.c:135)
do_idle (kernel/sched/idle.c:219 kernel/sched/idle.c:282) cpu_startup_entry (kernel/sched/idle.c:378 (discriminator 1)) start_secondary (arch/x86/kernel/smpboot.c:210 arch/x86/kernel/smpboot.c:294)
secondary_startup_64_no_verify (arch/x86/kernel/head_64.S:433)
value changed: 0xb0000042 -> 0x00000000
Reported by Kernel Concurrency Sanitizer on:
CPU: 21 PID: 0 Comm: swapper/21 Tainted: G L 6.6.0-rc2-kcsan-00143-gb5cbe7c00aa0 #41 Hardware name: ASRock X670E PG Lightning/X670E PG Lightning, BIOS 1.21 04/26/2023 ==================================================================
The read side is in
drivers/net/ethernet/realtek/r8169_main.c
=========================================
4355 static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp,
4356 int budget)
4357 {
4358 unsigned int dirty_tx, bytes_compl = 0, pkts_compl = 0;
4359 struct sk_buff *skb;
4360
4361 dirty_tx = tp->dirty_tx;
4362
4363 while (READ_ONCE(tp->cur_tx) != dirty_tx) {
4364 unsigned int entry = dirty_tx % NUM_TX_DESC;
4365 u32 status;
4366
→ 4367 status = le32_to_cpu(tp->TxDescArray[entry].opts1);
4368 if (status & DescOwn)
4369 break;
4370
4371 skb = tp->tx_skb[entry].skb;
4372 rtl8169_unmap_tx_skb(tp, entry);
4373
4374 if (skb) {
4375 pkts_compl++;
4376 bytes_compl += skb->len;
4377 napi_consume_skb(skb, budget);
4378 }
4379 dirty_tx++;
4380 }
4381
4382 if (tp->dirty_tx != dirty_tx) {
4383 dev_sw_netstats_tx_add(dev, pkts_compl, bytes_compl);
4384 WRITE_ONCE(tp->dirty_tx, dirty_tx);
4385
4386 netif_subqueue_completed_wake(dev, 0, pkts_compl, bytes_compl,
4387 rtl_tx_slots_avail(tp),
4388 R8169_TX_START_THRS);
4389 /*
4390 * 8168 hack: TxPoll requests are lost when the Tx packets are
4391 * too close. Let's kick an extra TxPoll request when a burst
4392 * of start_xmit activity is detected (if it is not detected,
4393 * it is slow enough). -- FR
4394 * If skb is NULL then we come here again once a tx irq is
4395 * triggered after the last fragment is marked transmitted.
4396 */ 4397 if (READ_ONCE(tp->cur_tx) != dirty_tx && skb)
4398 rtl8169_doorbell(tp);
4399 }
4400 }
tp->TxDescArray[entry].opts1 is reported to have a data-race and READ_ONCE() fixes this KCSAN warning.
4366
→ 4367 status = le32_to_cpu(READ_ONCE(tp->TxDescArray[entry].opts1));
4368 if (status & DescOwn)
4369 break;
4370
--- drivers/net/ethernet/realtek/r8169_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/realtek/r8169_main.c +1 -1
@@ -4364,7 +4364,7 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp,unsigned int entry = dirty_tx %NUM_TX_DESC ;u32 status; - status =le32_to_cpu (tp->TxDescArray[entry].opts1); + status =le32_to_cpu (READ_ONCE (tp->TxDescArray[entry].opts1));if (status & DescOwn)break ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 51/112 r8169: fix the KCSAN reported data race in rtl_rx while reading desc->opts1
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mirsad Goran Todorovac <[email protected]>
[ Upstream commit f97eee484e71890131f9c563c5cc6d5a69e4308d ]
KCSAN reported the following data-race bug:
==================================================================
BUG: KCSAN: data-race in rtl8169_poll (drivers/net/ethernet/realtek/r8169_main.c:4430 drivers/net/ethernet/realtek/r8169_main.c:4583) r8169
race at unknown origin, with read to 0xffff888117e43510 of 4 bytes by interrupt on cpu 21:rtl8169_poll (drivers/net/ethernet/realtek/r8169_main.c:4430 drivers/net/ethernet/realtek/r8169_main.c:4583) r8169 __napi_poll (net/core/dev.c:6527)net_rx_action (net/core/dev.c:6596 net/core/dev.c:6727)__do_softirq (kernel/softirq.c:553)__irq_exit_rcu (kernel/softirq.c:427 kernel/softirq.c:632)irq_exit_rcu (kernel/softirq.c:647)sysvec_apic_timer_interrupt (arch/x86/kernel/apic/apic.c:1074 (discriminator 14)) asm_sysvec_apic_timer_interrupt (./arch/x86/include/asm/idtentry.h:645)cpuidle_enter_state (drivers/cpuidle/cpuidle.c:291)cpuidle_enter (drivers/cpuidle/cpuidle.c:390)call_cpuidle (kernel/sched/idle.c:135)
do_idle (kernel/sched/idle.c:219 kernel/sched/idle.c:282) cpu_startup_entry (kernel/sched/idle.c:378 (discriminator 1)) start_secondary (arch/x86/kernel/smpboot.c:210 arch/x86/kernel/smpboot.c:294)
secondary_startup_64_no_verify (arch/x86/kernel/head_64.S:433)
value changed: 0x80003fff -> 0x3402805f
Reported by Kernel Concurrency Sanitizer on:
CPU: 21 PID: 0 Comm: swapper/21 Tainted: G L 6.6.0-rc2-kcsan-00143-gb5cbe7c00aa0 #41 Hardware name: ASRock X670E PG Lightning/X670E PG Lightning, BIOS 1.21 04/26/2023 ==================================================================
drivers/net/ethernet/realtek/r8169_main.c:
==========================================
4429
→ 4430 status = le32_to_cpu(desc->opts1);
4431 if (status & DescOwn)
4432 break;
4433
4434 /* This barrier is needed to keep us from reading
4435 * any other fields out of the Rx descriptor until 4436 * we know the status of DescOwn 4437 */
4438 dma_rmb();
4439
4440 if (unlikely(status & RxRES)) {
4441 if (net_ratelimit())
4442 netdev_warn(dev, "Rx ERROR. status = %08x\n",
Marco Elver explained that dma_rmb() doesn't prevent the compiler to tear up the access to desc->opts1 which can be written to concurrently. READ_ONCE() should prevent that from happening:
4429
→ 4430 status = le32_to_cpu(READ_ONCE(desc->opts1));
4431 if (status & DescOwn)
4432 break;
4433
As the consequence of this fix, this KCSAN warning was eliminated.
--- drivers/net/ethernet/realtek/r8169_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/realtek/r8169_main.c +1 -1
@@ -4427,7 +4427,7 @@ static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, int budgetdma_addr_t addr;u32 status; - status =le32_to_cpu (desc->opts1); + status =le32_to_cpu (READ_ONCE (desc->opts1));if (status & DescOwn)break ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 52/112 iavf: initialize waitqueues before starting watchdog_task
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Schmidt <[email protected]>
[ Upstream commit 7db3111043885c146e795c199d39c3f9042d97c0 ]
It is not safe to initialize the waitqueues after queueing the watchdog_task. It will be using them.
The chance of this causing a real problem is very small, because there will be some sleeping before any of the waitqueues get used. I got a crash only after inserting an artificial sleep in iavf_probe.
Queue the watchdog_task as the last step in iavf_probe. Add a comment to prevent repeating the mistake.
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +3 -2
@@ -4982,8 +4982,6 @@ static int iavf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)INIT_WORK (&adapter->finish_config, iavf_finish_config);INIT_DELAYED_WORK (&adapter->watchdog_task, iavf_watchdog_task);INIT_DELAYED_WORK (&adapter->client_task, iavf_client_task); -queue_delayed_work (adapter->wq, &adapter->watchdog_task, -msecs_to_jiffies (5 * (pdev->devfn &0x07 )));/* Setup the wait queue for indicating transition to down status */ init_waitqueue_head (&adapter->down_waitqueue);
@@ -4994,6 +4992,9 @@ static int iavf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)/* Setup the wait queue for indicating virtchannel events */ init_waitqueue_head (&adapter->vc_waitqueue); +queue_delayed_work (adapter->wq, &adapter->watchdog_task, +msecs_to_jiffies (5 * (pdev->devfn &0x07 ))); +/* Initialization goes on in the work. Do not add more of it below. */ return 0 ; err_ioremap:
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 53/112 i40e: Fix I40E_FLAG_VF_VLAN_PRUNING value
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Vecera <[email protected]>
[ Upstream commit 665e7d83c5386f9abdc67b2e4b6e6d9579aadfcb ]
Commit c87c938f62d8f1 ("i40e: Add VF VLAN pruning") added new PF flag I40E_FLAG_VF_VLAN_PRUNING but its value collides with existing I40E_FLAG_TOTAL_PORT_SHUTDOWN_ENABLED flag.
Move the affected flag at the end of the flags and fix its value.
Reproducer:
[root@cnb-03 ~]# ethtool --set-priv-flags enp2s0f0np0 link-down-on-close on [root@cnb-03 ~]# ethtool --set-priv-flags enp2s0f0np0 vf-vlan-pruning on [root@cnb-03 ~]# ethtool --set-priv-flags enp2s0f0np0 link-down-on-close off
[ 6323.142585] i40e 0000:02:00.0: Setting link-down-on-close not supported on this port (because total-port-shutdown is enabled)
netlink error: Operation not supported
[root@cnb-03 ~]# ethtool --set-priv-flags enp2s0f0np0 vf-vlan-pruning off [root@cnb-03 ~]# ethtool --set-priv-flags enp2s0f0np0 link-down-on-close off
The link-down-on-close flag cannot be modified after setting vf-vlan-pruning because vf-vlan-pruning shares the same bit with total-port-shutdown flag that prevents any modification of link-down-on-close flag.
--- drivers/net/ethernet/intel/i40e/i40e.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e.h +1 -1
@@ -580,7 +580,6 @@ struct i40e_pf {#define I40E_FLAG_DISABLE_FW_LLDP BIT(24)#define I40E_FLAG_RS_FEC BIT(25)#define I40E_FLAG_BASE_R_FEC BIT(26) -#define I40E_FLAG_VF_VLAN_PRUNING BIT(27)/* TOTAL_PORT_SHUTDOWN * Allows to physically disable the link on the NIC's port. * If enabled, (after link down request from the OS)
@@ -603,6 +602,7 @@ struct i40e_pf {* in abilities field of i40e_aq_set_phy_config structure */ #define I40E_FLAG_TOTAL_PORT_SHUTDOWN_ENABLED BIT(27) +#define I40E_FLAG_VF_VLAN_PRUNING BIT(28)struct i40e_client_instance *cinst;bool stat_offsets_loaded;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 54/112 treewide: Spelling fix in comment
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kunwu Chan <[email protected]>
[ Upstream commit fb71ba0ed8be9534493c80ba00142a64d9972a72 ]
reques -> request
--- drivers/net/ethernet/toshiba/ps3_gelic_wireless.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/toshiba/ps3_gelic_wireless.c +1 -1
@@ -1217,7 +1217,7 @@ static int gelic_wl_set_encodeext(struct net_device *netdev, key_index = wl->current_key;if (!enc->length && (ext->ext_flags &IW_ENCODE_EXT_SET_TX_KEY )) { -/* reques to change default key index */ +/* request to change default key index */ pr_debug ("%s: request to change default key to %d\n" , __func__, key_index); wl->current_key = key_index;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 55/112 igb: Fix potential memory leak in igb_add_ethtool_nfc_entry
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mateusz Palczewski <[email protected]>
[ Upstream commit 8c0b48e01daba5ca58f939a8425855d3f4f2ed14 ]
Add check for return of igb_update_ethtool_nfc_entry so that in case of any potential errors the memory alocated for input will be freed.
--- drivers/net/ethernet/intel/igb/igb_ethtool.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/igb/igb_ethtool.c +5 -1
@@ -2978,11 +2978,15 @@ static int igb_add_ethtool_nfc_entry(struct igb_adapter *adapter,if (err) goto err_out_w_lock; -igb_update_ethtool_nfc_entry (adapter, input, input->sw_idx); + err =igb_update_ethtool_nfc_entry (adapter, input, input->sw_idx); +if (err) + goto err_out_input_filter;spin_unlock (&adapter->nfc_lock);return 0 ; +err_out_input_filter: +igb_erase_filter (adapter, input); err_out_w_lock:spin_unlock (&adapter->nfc_lock); err_out:
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 56/112 net: do not leave an empty skb in write queue
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 72bf4f1767f0386970dc04726dc5bc2e3991dc19 ]
Under memory stress conditions, tcp_sendmsg_locked() might call sk_stream_wait_memory(), thus releasing the socket lock.
If a fresh skb has been allocated prior to this, we should not leave it in the write queue otherwise tcp_write_xmit() could panic.
This apparently does not happen often, but a future change in __sk_mem_raise_allocated() that Shakeel and others are considering would increase chances of being hurt.
Under discussion is to remove this controversial part:
/* Fail only if socket is _under_ its sndbuf.
* In this case we cannot block, so that we have to fail.
*/
if (sk->sk_wmem_queued + size >= sk->sk_sndbuf) {
/* Force charge with __GFP_NOFAIL */
if (memcg_charge && !charged) {
mem_cgroup_charge_skmem(sk->sk_memcg, amt,
gfp_memcg_charge() | __GFP_NOFAIL);
}
return 1;
}--- net/ipv4/tcp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
net/ipv4/tcp.c +5 -3
@@ -925,10 +925,11 @@ int tcp_send_mss(struct sock *sk, int *size_goal, int flags)return mss_now; } -/* In some cases, both sendmsg() could have added an skb to the write queue, -* but failed adding payload on it. We need to remove it to consume less +/* In some cases, sendmsg() could have added an skb to the write queue, +* but failed adding payload on it. We need to remove it to consume less * memory, but more importantly be able to generate EPOLLOUT for Edge Trigger -* epoll() users. +* epoll() users. Another reason is that tcp_write_xmit() does not like +* finding an empty skb in the write queue. */ void tcp_remove_empty_skb (struct sock *sk) {
@@ -1286,6 +1287,7 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size) wait_for_space:set_bit (SOCK_NOSPACE , &sk->sk_socket->flags); +tcp_remove_empty_skb (sk);if (copied)tcp_push (sk, flags & ~MSG_MORE , mss_now,TCP_NAGLE_PUSH , size_goal);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 57/112 neighbour: fix various data-races
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit a9beb7e81bcb876615e1fbb3c07f3f9dba69831f ]
1) tbl->gc_thresh1, tbl->gc_thresh2, tbl->gc_thresh3 and tbl->gc_interval can be written from sysfs.
2) tbl->last_flush is read locklessly from neigh_alloc()
3) tbl->proxy_queue.qlen is read locklessly from neightbl_fill_info()
4) neightbl_fill_info() reads cpu stats that can be changed concurrently.
--- net/core/neighbour.c | 67 +++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 32 deletions(-)
net/core/neighbour.c +35 -32
@@ -251,7 +251,8 @@ bool neigh_remove_one(struct neighbour *ndel, struct neigh_table *tbl)static int neigh_forced_gc (struct neigh_table *tbl) { -int max_clean =atomic_read (&tbl->gc_entries) - tbl->gc_thresh2; +int max_clean =atomic_read (&tbl->gc_entries) - +READ_ONCE (tbl->gc_thresh2);unsigned long tref = jiffies -5 *HZ ;struct neighbour *n, *tmp;int shrunk =0 ;
@@ -280,7 +281,7 @@ static int neigh_forced_gc(struct neigh_table *tbl) } } - tbl->last_flush = jiffies; +WRITE_ONCE (tbl->last_flush, jiffies);write_unlock_bh (&tbl->lock);
@@ -464,17 +465,17 @@ static struct neighbour *neigh_alloc(struct neigh_table *tbl, {struct neighbour *n =NULL ;unsigned long now = jiffies; -int entries; +int entries, gc_thresh3;if (exempt_from_gc) goto do_alloc; entries =atomic_inc_return (&tbl->gc_entries) -1 ; -if (entries >= tbl->gc_thresh3 || - (entries >= tbl->gc_thresh2 && -time_after (now, tbl->last_flush +5 *HZ ))) { -if (!neigh_forced_gc (tbl) && - entries >= tbl->gc_thresh3) { + gc_thresh3 =READ_ONCE (tbl->gc_thresh3); +if (entries >= gc_thresh3 || + (entries >=READ_ONCE (tbl->gc_thresh2) && +time_after (now,READ_ONCE (tbl->last_flush) +5 *HZ ))) { +if (!neigh_forced_gc (tbl) && entries >= gc_thresh3) {net_info_ratelimited ("%s: neighbor table overflow!\n" , tbl->id);NEIGH_CACHE_STAT_INC (tbl, table_fulls);
@@ -955,13 +956,14 @@ static void neigh_periodic_work(struct work_struct *work)if (time_after (jiffies, tbl->last_rand +300 *HZ )) {struct neigh_parms *p; - tbl->last_rand = jiffies; + +WRITE_ONCE (tbl->last_rand, jiffies);list_for_each_entry (p, &tbl->parms_list, list) p->reachable_time =neigh_rand_reach_time (NEIGH_VAR (p,BASE_REACHABLE_TIME )); } -if (atomic_read (&tbl->entries) < tbl->gc_thresh1) +if (atomic_read (&tbl->entries) <READ_ONCE (tbl->gc_thresh1)) goto out;for (i =0 ; i < (1 << nht->hash_shift); i++) {
@@ -2167,15 +2169,16 @@ static int neightbl_fill_info(struct sk_buff *skb, struct neigh_table *tbl, ndtmsg->ndtm_pad2 =0 ;if (nla_put_string (skb,NDTA_NAME , tbl->id) || -nla_put_msecs (skb,NDTA_GC_INTERVAL , tbl->gc_interval,NDTA_PAD ) || -nla_put_u32 (skb,NDTA_THRESH1 , tbl->gc_thresh1) || -nla_put_u32 (skb,NDTA_THRESH2 , tbl->gc_thresh2) || -nla_put_u32 (skb,NDTA_THRESH3 , tbl->gc_thresh3)) +nla_put_msecs (skb,NDTA_GC_INTERVAL ,READ_ONCE (tbl->gc_interval), +NDTA_PAD ) || +nla_put_u32 (skb,NDTA_THRESH1 ,READ_ONCE (tbl->gc_thresh1)) || +nla_put_u32 (skb,NDTA_THRESH2 ,READ_ONCE (tbl->gc_thresh2)) || +nla_put_u32 (skb,NDTA_THRESH3 ,READ_ONCE (tbl->gc_thresh3))) goto nla_put_failure; {unsigned long now = jiffies; -long flush_delta = now - tbl->last_flush; -long rand_delta = now - tbl->last_rand; +long flush_delta = now -READ_ONCE (tbl->last_flush); +long rand_delta = now -READ_ONCE (tbl->last_rand);struct neigh_hash_table *nht;struct ndt_config ndc = { .ndtc_key_len = tbl->key_len,
@@ -2183,7 +2186,7 @@ static int neightbl_fill_info(struct sk_buff *skb, struct neigh_table *tbl, .ndtc_entries = atomic_read(&tbl->entries), .ndtc_last_flush = jiffies_to_msecs(flush_delta), .ndtc_last_rand = jiffies_to_msecs(rand_delta), - .ndtc_proxy_qlen = tbl->proxy_queue.qlen, + .ndtc_proxy_qlen = READ_ONCE(tbl->proxy_queue.qlen), };rcu_read_lock ();
@@ -2206,17 +2209,17 @@ static int neightbl_fill_info(struct sk_buff *skb, struct neigh_table *tbl,struct neigh_statistics *st; st =per_cpu_ptr (tbl->stats, cpu); - ndst.ndts_allocs += st->allocs; - ndst.ndts_destroys += st->destroys; - ndst.ndts_hash_grows += st->hash_grows; - ndst.ndts_res_failed += st->res_failed; - ndst.ndts_lookups += st->lookups; - ndst.ndts_hits += st->hits; - ndst.ndts_rcv_probes_mcast += st->rcv_probes_mcast; - ndst.ndts_rcv_probes_ucast += st->rcv_probes_ucast; - ndst.ndts_periodic_gc_runs += st->periodic_gc_runs; - ndst.ndts_forced_gc_runs += st->forced_gc_runs; - ndst.ndts_table_fulls += st->table_fulls; + ndst.ndts_allocs +=READ_ONCE (st->allocs); + ndst.ndts_destroys +=READ_ONCE (st->destroys); + ndst.ndts_hash_grows +=READ_ONCE (st->hash_grows); + ndst.ndts_res_failed +=READ_ONCE (st->res_failed); + ndst.ndts_lookups +=READ_ONCE (st->lookups); + ndst.ndts_hits +=READ_ONCE (st->hits); + ndst.ndts_rcv_probes_mcast +=READ_ONCE (st->rcv_probes_mcast); + ndst.ndts_rcv_probes_ucast +=READ_ONCE (st->rcv_probes_ucast); + ndst.ndts_periodic_gc_runs +=READ_ONCE (st->periodic_gc_runs); + ndst.ndts_forced_gc_runs +=READ_ONCE (st->forced_gc_runs); + ndst.ndts_table_fulls +=READ_ONCE (st->table_fulls); } if (nla_put_64bit(skb, NDTA_STATS, sizeof(ndst), &ndst,
@@ -2445,16 +2448,16 @@ static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, goto errout_tbl_lock;if (tb[NDTA_THRESH1 ]) - tbl->gc_thresh1 =nla_get_u32 (tb[NDTA_THRESH1 ]); +WRITE_ONCE (tbl->gc_thresh1,nla_get_u32 (tb[NDTA_THRESH1 ]));if (tb[NDTA_THRESH2 ]) - tbl->gc_thresh2 =nla_get_u32 (tb[NDTA_THRESH2 ]); +WRITE_ONCE (tbl->gc_thresh2,nla_get_u32 (tb[NDTA_THRESH2 ]));if (tb[NDTA_THRESH3 ]) - tbl->gc_thresh3 =nla_get_u32 (tb[NDTA_THRESH3 ]); +WRITE_ONCE (tbl->gc_thresh3,nla_get_u32 (tb[NDTA_THRESH3 ]));if (tb[NDTA_GC_INTERVAL ]) - tbl->gc_interval =nla_get_msecs (tb[NDTA_GC_INTERVAL ]); +WRITE_ONCE (tbl->gc_interval,nla_get_msecs (tb[NDTA_GC_INTERVAL ])); err =0 ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 58/112 igc: Fix ambiguity in the ethtool advertising
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sasha Neftin <[email protected]>
[ Upstream commit e7684d29efdf37304c62bb337ea55b3428ca118e ]
The 'ethtool_convert_link_mode_to_legacy_u32' method does not allow us to advertise 2500M speed support and TP (twisted pair) properly. Convert to 'ethtool_link_ksettings_test_link_mode' to advertise supported speed and eliminate ambiguity.
--- drivers/net/ethernet/intel/igc/igc_ethtool.c | 35 ++++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-)
drivers/net/ethernet/intel/igc/igc_ethtool.c +25 -10
@@ -1817,7 +1817,7 @@ igc_ethtool_set_link_ksettings(struct net_device *netdev,struct igc_adapter *adapter =netdev_priv (netdev);struct net_device *dev = adapter->netdev;struct igc_hw *hw = &adapter->hw; -u32 advertising; +u16 advertised =0 ;/* When adapter in resetting mode, autoneg/speed/duplex * cannot be changed
@@ -1842,18 +1842,33 @@ igc_ethtool_set_link_ksettings(struct net_device *netdev,while (test_and_set_bit (__IGC_RESETTING, &adapter->state))usleep_range (1000 ,2000 ); -ethtool_convert_link_mode_to_legacy_u32 (&advertising, - cmd->link_modes.advertising); -/* Converting to legacy u32 drops ETHTOOL_LINK_MODE_2500baseT_Full_BIT. -* We have to check this and convert it to ADVERTISE_2500_FULL -* (aka ETHTOOL_LINK_MODE_2500baseX_Full_BIT) explicitly. -*/ - if (ethtool_link_ksettings_test_link_mode(cmd, advertising, 2500baseT_Full)) - advertising |=ADVERTISE_2500_FULL ; +if (ethtool_link_ksettings_test_link_mode (cmd, advertising, + 2500baseT_Full)) + advertised |=ADVERTISE_2500_FULL ; + +if (ethtool_link_ksettings_test_link_mode (cmd, advertising, + 1000baseT_Full)) + advertised |=ADVERTISE_1000_FULL ; + +if (ethtool_link_ksettings_test_link_mode (cmd, advertising, + 100baseT_Full)) + advertised |=ADVERTISE_100_FULL ; + +if (ethtool_link_ksettings_test_link_mode (cmd, advertising, + 100baseT_Half)) + advertised |=ADVERTISE_100_HALF ; + +if (ethtool_link_ksettings_test_link_mode (cmd, advertising, + 10baseT_Full)) + advertised |=ADVERTISE_10_FULL ; + +if (ethtool_link_ksettings_test_link_mode (cmd, advertising, + 10baseT_Half)) + advertised |=ADVERTISE_10_HALF ;if (cmd->base.autoneg ==AUTONEG_ENABLE ) { hw->mac.autoneg =1 ; - hw->phy.autoneg_advertised = advertising; + hw->phy.autoneg_advertised = advertised;if (adapter->fc_autoneg) hw->fc.requested_mode = igc_fc_default; }else {
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 59/112 net: ethernet: adi: adin1110: Fix uninitialized variable
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dell Jin <[email protected]>
[ Upstream commit 965f9b8c0c1b37fa2a0e3ef56e40d5666d4cbb5c ]
The spi_transfer struct has to have all it's fields initialized to 0 in this case, since not all of them are set before starting the transfer. Otherwise, spi_sync_transfer() will sometimes return an error.
--- drivers/net/ethernet/adi/adin1110.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/adi/adin1110.c +1 -1
@@ -294,7 +294,7 @@ static int adin1110_read_fifo(struct adin1110_port_priv *port_priv) {struct adin1110_priv *priv = port_priv->priv;u32 header_len =ADIN1110_RD_HEADER_LEN ; -struct spi_transfer t; +struct spi_transfer t = {0 };u32 frame_size_no_fcs;struct sk_buff *rxb;u32 frame_size;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 60/112 net: ieee802154: adf7242: Fix some potential buffer overflow in adf7242_stats_show()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit ca082f019d8fbb983f03080487946da714154bae ]
strncat() usage in adf7242_debugfs_init() is wrong.
The size given to strncat() is the maximum number of bytes that can be written, excluding the trailing NULL.
Here, the size that is passed, DNAME_INLINE_LEN, does not take into account the size of "adf7242-" that is already in the array.
In order to fix it, use snprintf() instead.
--- drivers/net/ieee802154/adf7242.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ieee802154/adf7242.c +3 -2
@@ -1162,9 +1162,10 @@ static int adf7242_stats_show(struct seq_file *file, void *offset)static void adf7242_debugfs_init (struct adf7242_local *lp) { -char debugfs_dir_name[DNAME_INLINE_LEN +1 ] ="adf7242-" ; +char debugfs_dir_name[DNAME_INLINE_LEN +1 ]; -strncat (debugfs_dir_name,dev_name (&lp->spi->dev),DNAME_INLINE_LEN ); +snprintf (debugfs_dir_name,sizeof (debugfs_dir_name), +"adf7242-%s" ,dev_name (&lp->spi->dev)); lp->debugfs_root =debugfs_create_dir (debugfs_dir_name,NULL );
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 61/112 net: usb: smsc95xx: Fix uninit-value access in smsc95xx_read_reg
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shigeru Yoshida <[email protected]>
[ Upstream commit 51a32e828109b4a209efde44505baa356b37a4ce ]
syzbot reported the following uninit-value access issue [1]:
smsc95xx 1-1:0.0 (unnamed net_device) (uninitialized): Failed to read reg index 0x00000030: -32 smsc95xx 1-1:0.0 (unnamed net_device) (uninitialized): Error reading E2P_CMD
=====================================================
BUG: KMSAN: uninit-value in smsc95xx_reset+0x409/0x25f0 drivers/net/usb/smsc95xx.c:896 smsc95xx_reset+0x409/0x25f0 drivers/net/usb/smsc95xx.c:896 smsc95xx_bind+0x9bc/0x22e0 drivers/net/usb/smsc95xx.c:1131 usbnet_probe+0x100b/0x4060 drivers/net/usb/usbnet.c:1750 usb_probe_interface+0xc75/0x1210 drivers/usb/core/driver.c:396 really_probe+0x506/0xf40 drivers/base/dd.c:658 __driver_probe_device+0x2a7/0x5d0 drivers/base/dd.c:800 driver_probe_device+0x72/0x7b0 drivers/base/dd.c:830 __device_attach_driver+0x55a/0x8f0 drivers/base/dd.c:958 bus_for_each_drv+0x3ff/0x620 drivers/base/bus.c:457 __device_attach+0x3bd/0x640 drivers/base/dd.c:1030 device_initial_probe+0x32/0x40 drivers/base/dd.c:1079 bus_probe_device+0x3d8/0x5a0 drivers/base/bus.c:532 device_add+0x16ae/0x1f20 drivers/base/core.c:3622 usb_set_configuration+0x31c9/0x38c0 drivers/usb/core/message.c:2207 usb_generic_driver_probe+0x109/0x2a0 drivers/usb/core/generic.c:238 usb_probe_device+0x290/0x4a0 drivers/usb/core/driver.c:293 really_probe+0x506/0xf40 drivers/base/dd.c:658 __driver_probe_device+0x2a7/0x5d0 drivers/base/dd.c:800 driver_probe_device+0x72/0x7b0 drivers/base/dd.c:830 __device_attach_driver+0x55a/0x8f0 drivers/base/dd.c:958 bus_for_each_drv+0x3ff/0x620 drivers/base/bus.c:457 __device_attach+0x3bd/0x640 drivers/base/dd.c:1030 device_initial_probe+0x32/0x40 drivers/base/dd.c:1079 bus_probe_device+0x3d8/0x5a0 drivers/base/bus.c:532 device_add+0x16ae/0x1f20 drivers/base/core.c:3622 usb_new_device+0x15f6/0x22f0 drivers/usb/core/hub.c:2589 hub_port_connect drivers/usb/core/hub.c:5440 [inline] hub_port_connect_change drivers/usb/core/hub.c:5580 [inline] port_event drivers/usb/core/hub.c:5740 [inline] hub_event+0x53bc/0x7290 drivers/usb/core/hub.c:5822 process_one_work kernel/workqueue.c:2630 [inline] process_scheduled_works+0x104e/0x1e70 kernel/workqueue.c:2703 worker_thread+0xf45/0x1490 kernel/workqueue.c:2784 kthread+0x3e8/0x540 kernel/kthread.c:388 ret_from_fork+0x66/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304
Local variable buf.i225 created at:
smsc95xx_read_reg drivers/net/usb/smsc95xx.c:90 [inline] smsc95xx_reset+0x203/0x25f0 drivers/net/usb/smsc95xx.c:892 smsc95xx_bind+0x9bc/0x22e0 drivers/net/usb/smsc95xx.c:1131 CPU: 1 PID: 773 Comm: kworker/1:2 Not tainted 6.6.0-rc1-syzkaller-00125-ge42bebf6db29 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/2023 Workqueue: usb_hub_wq hub_event =====================================================
Similar to e9c65989920f ("net: usb: smsc75xx: Fix uninit-value access in __smsc75xx_read_reg"), this issue is caused because usbnet_read_cmd() reads less bytes than requested (zero byte in the reproducer). In this case, 'buf' is not properly filled.
This patch fixes the issue by returning -ENODATA if usbnet_read_cmd() reads less bytes than requested.
sysbot reported similar uninit-value access issue [2]. The root cause is the same as mentioned above, and this patch addresses it as well.
--- drivers/net/usb/smsc95xx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/usb/smsc95xx.c +3 -1
@@ -95,7 +95,9 @@ static int __must_check smsc95xx_read_reg(struct usbnet *dev, u32 index, ret =fn (dev,USB_VENDOR_REQUEST_READ_REGISTER ,USB_DIR_IN |USB_TYPE_VENDOR |USB_RECIP_DEVICE ,0 , index, &buf,4 ); -if (ret <0 ) { +if (ret <4 ) { + ret = ret <0 ? ret : -ENODATA ; +if (ret != -ENODEV )netdev_warn (dev->net,"Failed to read reg index 0x%08x: %d\n" , index, ret);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 62/112 r8152: Increase USB control msg timeout to 5000ms as per spec
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
[ Upstream commit a5feba71ec9c14a54c3babdc732c5b6866d8ee43 ]
According to the comment next to USB_CTRL_GET_TIMEOUT and USB_CTRL_SET_TIMEOUT, although sending/receiving control messages is usually quite fast, the spec allows them to take up to 5 seconds. Let's increase the timeout in the Realtek driver from 500ms to 5000ms (using the #defines) to account for this.
This is not just a theoretical change. The need for the longer timeout was seen in testing. Specifically, if you drop a sc7180-trogdor based Chromebook into the kdb debugger and then "go" again after sitting in the debugger for a while, the next USB control message takes a long time. Out of ~40 tests the slowest USB control message was 4.5 seconds.
While dropping into kdb is not exactly an end-user scenario, the above is similar to what could happen due to an temporary interrupt storm, what could happen if there was a host controller (HW or SW) issue, or what could happen if the Realtek device got into a confused state and needed time to recover.
This change is fairly critical since the r8152 driver in Linux doesn't expect register reads/writes (which are backed by USB control messages) to fail.
--- drivers/net/usb/r8152.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/usb/r8152.c +4 -3
@@ -1212,7 +1212,7 @@ int get_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data) ret =usb_control_msg (tp->udev, tp->pipe_ctrl_in,RTL8152_REQ_GET_REGS ,RTL8152_REQT_READ , - value, index, tmp, size,500 ); + value, index, tmp, size,USB_CTRL_GET_TIMEOUT );if (ret <0 )memset (data,0xff , size);else
@@ -1235,7 +1235,7 @@ int set_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data) ret =usb_control_msg (tp->udev, tp->pipe_ctrl_out,RTL8152_REQ_SET_REGS ,RTL8152_REQT_WRITE , - value, index, tmp, size,500 ); + value, index, tmp, size,USB_CTRL_SET_TIMEOUT );kfree (tmp);
@@ -9512,7 +9512,8 @@ static u8 __rtl_get_hw_ver(struct usb_device *udev) ret =usb_control_msg (udev,usb_rcvctrlpipe (udev,0 ),RTL8152_REQ_GET_REGS ,RTL8152_REQT_READ , -PLA_TCR0 ,MCU_TYPE_PLA , tmp,sizeof (*tmp),500 ); +PLA_TCR0 ,MCU_TYPE_PLA , tmp,sizeof (*tmp), +USB_CTRL_GET_TIMEOUT );if (ret >0 ) ocp_data = (__le32_to_cpu (*tmp) >>16 ) &VERSION_MASK ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 63/112 r8152: Run the unload routine if we have errors during probe
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
[ Upstream commit 5dd17689526971c5ae12bc8398f34bd68cd0499e ]
The rtl8152_probe() function lacks a call to the chip-specific unload() routine when it sees an error in probe. Add it in to match the cleanup code in rtl8152_disconnect().
--- drivers/net/usb/r8152.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/usb/r8152.c +2 -0
@@ -9802,6 +9802,8 @@ static int rtl8152_probe(struct usb_interface *intf, out1:tasklet_kill (&tp->tx_tl); +if (tp->rtl_ops.unload) + tp->rtl_ops.unload (tp);usb_set_intfdata (intf,NULL ); out:free_netdev (netdev);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 64/112 r8152: Cancel hw_phy_work if we have an error in probe
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
[ Upstream commit bb8adff9123e492598162ac1baad01a53891aef6 ]
The error handling in rtl8152_probe() is missing a call to cancel the hw_phy_work. Add it in to match what's in the cleanup code in rtl8152_disconnect().
--- drivers/net/usb/r8152.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/r8152.c +1 -0
@@ -9802,6 +9802,7 @@ static int rtl8152_probe(struct usb_interface *intf, out1:tasklet_kill (&tp->tx_tl); +cancel_delayed_work_sync (&tp->hw_phy_work);if (tp->rtl_ops.unload) tp->rtl_ops.unload (tp);usb_set_intfdata (intf,NULL );
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 65/112 r8152: Release firmware if we have an error in probe
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
[ Upstream commit b8d35024d4059ca550cba11ac9ab23a6c238d929 ]
The error handling in rtl8152_probe() is missing a call to release firmware. Add it in to match what's in the cleanup code in rtl8152_disconnect().
--- drivers/net/usb/r8152.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/r8152.c +1 -0
@@ -9805,6 +9805,7 @@ static int rtl8152_probe(struct usb_interface *intf,cancel_delayed_work_sync (&tp->hw_phy_work);if (tp->rtl_ops.unload) tp->rtl_ops.unload (tp); +rtl8152_release_firmware (tp);usb_set_intfdata (intf,NULL ); out:free_netdev (netdev);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 66/112 tcp: fix wrong RTO timeout when received SACK reneging
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fred Chen <[email protected]>
[ Upstream commit d2a0fc372aca561556e765d0a9ec365c7c12f0ad ]
This commit fix wrong RTO timeout when received SACK reneging.
When an ACK arrived pointing to a SACK reneging, tcp_check_sack_reneging() will rearm the RTO timer for min(1/2*srtt, 10ms) into to the future.
But since the commit 62d9f1a6945b ("tcp: fix TLP timer not set when CA_STATE changes from DISORDER to OPEN") merged, the tcp_set_xmit_timer() is moved after tcp_fastretrans_alert()(which do the SACK reneging check), so the RTO timeout will be overwrited by tcp_set_xmit_timer() with icsk_rto instead of 1/2*srtt.
Here is a packetdrill script to check this bug:
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 +0 bind(3, ..., ...) = 0 +0 listen(3, 1) = 0
// simulate srtt to 100ms
+0 < S 0:0(0) win 32792 <mss 1000, sackOK,nop,nop,nop,wscale 7>
+0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 7>
+.1 < . 1:1(0) ack 1 win 1024
+0 accept(3, ..., ...) = 4
+0 write(4, ..., 10000) = 10000
+0 > P. 1:10001(10000) ack 1
// inject sack
+.1 < . 1:1(0) ack 1 win 257 <sack 1001:10001,nop,nop>
+0 > . 1:1001(1000) ack 1
// inject sack reneging
+.1 < . 1:1(0) ack 1001 win 257 <sack 9001:10001,nop,nop>
// we expect rto fired in 1/2*srtt (50ms)
+.05 > . 1001:2001(1000) ack 1
This fix remove the FLAG_SET_XMIT_TIMER from ack_flag when tcp_check_sack_reneging() set RTO timer with 1/2*srtt to avoid being overwrited later.
--- net/ipv4/tcp_input.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
net/ipv4/tcp_input.c +5 -4
@@ -2202,16 +2202,17 @@ void tcp_enter_loss(struct sock *sk)* restore sanity to the SACK scoreboard. If the apparent reneging * persists until this RTO then we'll clear the SACK scoreboard. */ -static bool tcp_check_sack_reneging (struct sock *sk,int flag) +static bool tcp_check_sack_reneging (struct sock *sk,int *ack_flag) { -if (flag &FLAG_SACK_RENEGING && - flag &FLAG_SND_UNA_ADVANCED ) { +if (*ack_flag &FLAG_SACK_RENEGING && + *ack_flag &FLAG_SND_UNA_ADVANCED ) {struct tcp_sock *tp =tcp_sk (sk);unsigned long delay =max (usecs_to_jiffies (tp->srtt_us >>4 ),msecs_to_jiffies (10 ));inet_csk_reset_xmit_timer (sk,ICSK_TIME_RETRANS , delay,TCP_RTO_MAX ); + *ack_flag &= ~FLAG_SET_XMIT_TIMER ;return true; }return false;
@@ -2981,7 +2982,7 @@ static void tcp_fastretrans_alert(struct sock *sk, const u32 prior_snd_una, tp->prior_ssthresh =0 ;/* B. In all the states check for reneging SACKs. */ -if (tcp_check_sack_reneging (sk, flag)) +if (tcp_check_sack_reneging (sk, ack_flag))return ;/* C. Check consistency of the current state. */
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 67/112 wifi: cfg80211: pass correct pointer to rdev_inform_bss()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Greear <[email protected]>
[ Upstream commit 3e3929ef889e650dd585dc0f4f7f18240688811a ]
Confusing struct member names here resulted in passing the wrong pointer, causing crashes. Pass the correct one.
--- net/wireless/scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/wireless/scan.c +1 -1
@@ -2125,7 +2125,7 @@ cfg80211_inform_single_bss_data(struct wiphy *wiphy,if (!res) goto drop; -rdev_inform_bss (rdev, &res->pub, ies, data->drv_data); +rdev_inform_bss (rdev, &res->pub, ies, drv_data->drv_data);if (data->bss_source ==BSS_SOURCE_MBSSID ) {/* this is a nontransmitting bss, we need to add it to
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 68/112 wifi: cfg80211: fix assoc response warning on failed links
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit c434b2be2d80d236bb090fdb493d4bd5ed589238 ]
The warning here shouldn't be done before we even set the bss field (or should've used the input data). Move the assignment before the warning to fix it.
We noticed this now because of Wen's bugfix, where the bug fixed there had previously hidden this other bug.
--- net/wireless/mlme.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/wireless/mlme.c +2 -1
@@ -43,10 +43,11 @@ void cfg80211_rx_assoc_resp(struct net_device *dev,for (link_id =0 ; link_id <ARRAY_SIZE (data->links); link_id++) { cr.links[link_id].status = data->links[link_id].status; + cr.links[link_id].bss = data->links[link_id].bss; +WARN_ON_ONCE (cr.links[link_id].status !=WLAN_STATUS_SUCCESS && (!cr.ap_mld_addr || !cr.links[link_id].bss)); - cr.links[link_id].bss = data->links[link_id].bss;if (!cr.links[link_id].bss)continue ; cr.links[link_id].bssid = data->links[link_id].bss->bssid;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 69/112 wifi: mac80211: dont drop all unprotected public action frames
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avraham Stern <[email protected]>
[ Upstream commit 91535613b6090fc968c601d11d4e2f16b333713c ]
Not all public action frames have a protected variant. When MFP is enabled drop only public action frames that have a dual protected variant.
--- include/linux/ieee80211.h | 29 +++++++++++++++++++++++++++++ net/mac80211/rx.c | 3 +-- 2 files changed, 30 insertions(+), 2 deletions(-)
include/linux/ieee80211.h +29 -0
@@ -4236,6 +4236,35 @@ static inline bool ieee80211_is_public_action(struct ieee80211_hdr *hdr,return mgmt->u.action.category ==WLAN_CATEGORY_PUBLIC ; } +/** +* ieee80211_is_protected_dual_of_public_action - check if skb contains a +* protected dual of public action management frame +* @skb: the skb containing the frame, length will be checked +* +* Return: true if the skb contains a protected dual of public action +* management frame, false otherwise. +*/ +static inline bool +ieee80211_is_protected_dual_of_public_action (struct sk_buff *skb) +{ +u8 action; + +if (!ieee80211_is_public_action ((void *)skb->data, skb->len) || + skb->len <IEEE80211_MIN_ACTION_SIZE +1 ) +return false; + + action = *(u8 *)(skb->data +IEEE80211_MIN_ACTION_SIZE ); + +return action !=WLAN_PUB_ACTION_20_40_BSS_COEX && + action !=WLAN_PUB_ACTION_DSE_REG_LOC_ANN && + action !=WLAN_PUB_ACTION_MSMT_PILOT && + action !=WLAN_PUB_ACTION_TDLS_DISCOVER_RES && + action !=WLAN_PUB_ACTION_LOC_TRACK_NOTI && + action !=WLAN_PUB_ACTION_FTM_REQUEST && + action !=WLAN_PUB_ACTION_FTM_RESPONSE && + action !=WLAN_PUB_ACTION_FILS_DISCOVERY ; +} +/** * _ieee80211_is_group_privacy_action - check if frame is a group addressed * privacy action frame
net/mac80211/rx.c +1 -2
@@ -2468,8 +2468,7 @@ static int ieee80211_drop_unencrypted_mgmt(struct ieee80211_rx_data *rx)/* drop unicast public action frames when using MPF */ if (is_unicast_ether_addr (mgmt->da) && -ieee80211_is_public_action ((void *)rx->skb->data, - rx->skb->len)) +ieee80211_is_protected_dual_of_public_action (rx->skb))return -EACCES ; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 70/112 net/handshake: fix file ref count in handshake_nl_accept_doit()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Moritz Wanzenböck <[email protected]>
[ Upstream commit 7798b59409c345d4a6034a4326bceb9f7e2e8b58 ]
If req->hr_proto->hp_accept() fail, we call fput() twice:
Once in the error path, but also a second time because sock->file is at that point already associated with the file descriptor. Once the task exits, as it would probably do after receiving an error reading from netlink, the fd is closed, calling fput() a second time.
To fix, we move installing the file after the error path for the hp_accept() call. In the case of errors we simply put the unused fd. In case of success we can use fd_install() to link the sock->file to the reserved fd.
--- net/handshake/netlink.c | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-)
net/handshake/netlink.c +5 -25
@@ -87,29 +87,6 @@ struct nlmsghdr *handshake_genl_put(struct sk_buff *msg, }EXPORT_SYMBOL (handshake_genl_put); -/* -* dup() a kernel socket for use as a user space file descriptor -* in the current process. The kernel socket must have an -* instatiated struct file. -* -* Implicit argument: "current()" -*/ -static int handshake_dup (struct socket *sock) -{ -struct file *file; -int newfd; - - file =get_file (sock->file); - newfd =get_unused_fd_flags (O_CLOEXEC ); -if (newfd <0 ) { -fput (file); -return newfd; - } - -fd_install (newfd, file); -return newfd; -} -int handshake_nl_accept_doit (struct sk_buff *skb,struct genl_info *info) {struct net *net =sock_net (skb->sk);
@@ -133,17 +110,20 @@ int handshake_nl_accept_doit(struct sk_buff *skb, struct genl_info *info) goto out_status; sock = req->hr_sk->sk_socket; - fd =handshake_dup (sock); + fd =get_unused_fd_flags (O_CLOEXEC );if (fd <0 ) { err = fd; goto out_complete; } + err = req->hr_proto->hp_accept (req, info, fd);if (err) { -fput (sock->file); +put_unused_fd (fd); goto out_complete; } +fd_install (fd,get_file (sock->file)); +trace_handshake_cmd_accept (net, req, req->hr_sk, fd);return 0 ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 71/112 gtp: uapi: fix GTPA_MAX
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit adc8df12d91a2b8350b0cd4c7fec3e8546c9d1f8 ]
Subtract one to __GTPA_MAX, otherwise GTPA_MAX is off by 2.
--- include/uapi/linux/gtp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/gtp.h +1 -1
@@ -33,6 +33,6 @@ enum gtp_attrs {GTPA_PAD , __GTPA_MAX, }; -#define GTPA_MAX (__GTPA_MAX + 1) +#define GTPA_MAX (__GTPA_MAX - 1)#endif /* _UAPI_LINUX_GTP_H_ */
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 72/112 gtp: fix fragmentation needed check with gso
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 4530e5b8e2dad63dcad2206232dd86e4b1489b6c ]
Call skb_gso_validate_network_len() to check if packet is over PMTU.
--- drivers/net/gtp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/gtp.c +3 -2
@@ -871,8 +871,9 @@ static int gtp_build_skb_ip4(struct sk_buff *skb, struct net_device *dev,skb_dst_update_pmtu_no_confirm (skb, mtu); -if (!skb_is_gso (skb) && (iph->frag_off &htons (IP_DF )) && - mtu <ntohs (iph->tot_len)) { +if (iph->frag_off &htons (IP_DF ) && + ((!skb_is_gso (skb) && skb->len > mtu) || + (skb_is_gso (skb) && !skb_gso_validate_network_len (skb, mtu)))) {netdev_dbg (dev,"packet too big, fragmentation needed\n" );icmp_ndo_send (skb,ICMP_DEST_UNREACH ,ICMP_FRAG_NEEDED ,htonl (mtu));
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 73/112 drm/i915/perf: Determine context valid in OA reports
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Umesh Nerlige Ramappa <[email protected]>
[ Upstream commit cba94bbcff08d209710dd7bdc139caad675a6f8d ]
When supporting OA for TGL, it was seen that the context valid bit in the report ID was not defined, however revisiting the spec seems to have this bit defined. The bit is used to determine if a context is valid on a context switch and is essential to determine active and idle periods for a context. Re-enable the context valid bit for gen12 platforms.
BSpec: 52196 (description of report_id)
v2: Include BSpec reference (Ashutosh)
--- drivers/gpu/drm/i915/i915_perf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_perf.c +2 -2
@@ -482,8 +482,7 @@ static void oa_report_id_clear(struct i915_perf_stream *stream, u32 *report)static bool oa_report_ctx_invalid (struct i915_perf_stream *stream,void *report) {return !(oa_report_id (stream, report) & - stream->perf->gen8_valid_ctx_bit) && -GRAPHICS_VER (stream->perf->i915) <=11 ; + stream->perf->gen8_valid_ctx_bit); }static u64 oa_timestamp (struct i915_perf_stream *stream,void *report)
@@ -5106,6 +5105,7 @@ static void i915_perf_init_info(struct drm_i915_private *i915) perf->gen8_valid_ctx_bit =BIT (16 );break ;case 12 : + perf->gen8_valid_ctx_bit =BIT (16 );/* * Calculate offset at runtime in oa_pin_context for gen12 and * cache the value in perf->ctx_oactxctrl_offset.
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 74/112 i40e: Fix wrong check for I40E_TXR_FLAGS_WB_ON_ITR
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Vecera <[email protected]>
[ Upstream commit 77a8c982ff0d4c3a14022c6fe9e3dbfb327552ec ]
The I40E_TXR_FLAGS_WB_ON_ITR is i40e_ring flag and not i40e_pf one.
--- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +1 -1
@@ -2854,7 +2854,7 @@ int i40e_napi_poll(struct napi_struct *napi, int budget)return budget; } -if (vsi->back->flags &I40E_TXR_FLAGS_WB_ON_ITR ) +if (q_vector->tx.ring[0 ].flags &I40E_TXR_FLAGS_WB_ON_ITR ) q_vector->arm_wb_state = false;/* Exit the polling mode, but don't re-enable interrupts if stack might
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 75/112 netfilter: flowtable: GC pushes back packets to classic path
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 735795f68b37e9bb49f642407a0d49b1631ea1c7 ]
Since 41f2c7c342d3 ("net/sched: act_ct: Fix promotion of offloaded unreplied tuple"), flowtable GC pushes back flows with IPS_SEEN_REPLY back to classic path in every run, ie. every second. This is because of a new check for NF_FLOW_HW_ESTABLISHED which is specific of sched/act_ct.
In Netfilter's flowtable case, NF_FLOW_HW_ESTABLISHED never gets set on and IPS_SEEN_REPLY is unreliable since users decide when to offload the flow before, such bit might be set on at a later stage.
Fix it by adding a custom .gc handler that sched/act_ct can use to deal with its NF_FLOW_HW_ESTABLISHED bit.
--- include/net/netfilter/nf_flow_table.h | 1 + net/netfilter/nf_flow_table_core.c | 14 +++++++------- net/sched/act_ct.c | 7 +++++++ 3 files changed, 15 insertions(+), 7 deletions(-)
include/net/netfilter/nf_flow_table.h +1 -0
@@ -53,6 +53,7 @@ struct nf_flowtable_type {struct list_head list;int family;int (*init)(struct nf_flowtable *ft); +bool (*gc)(const struct flow_offload *flow);int (*setup)(struct nf_flowtable *ft,struct net_device *dev,enum flow_block_command cmd);
net/netfilter/nf_flow_table_core.c +7 -7
@@ -316,12 +316,6 @@ void flow_offload_refresh(struct nf_flowtable *flow_table, }EXPORT_SYMBOL_GPL (flow_offload_refresh); -static bool nf_flow_is_outdated (const struct flow_offload *flow) -{ -return test_bit (IPS_SEEN_REPLY_BIT , &flow->ct->status) && - !test_bit (NF_FLOW_HW_ESTABLISHED , &flow->flags); -} -static inline bool nf_flow_has_expired (const struct flow_offload *flow) {return nf_flow_timeout_delta (flow->timeout) <=0 ;
@@ -407,12 +401,18 @@ nf_flow_table_iterate(struct nf_flowtable *flow_table,return err; } +static bool nf_flow_custom_gc (struct nf_flowtable *flow_table, +const struct flow_offload *flow) +{ +return flow_table->type->gc && flow_table->type->gc (flow); +} +static void nf_flow_offload_gc_step (struct nf_flowtable *flow_table,struct flow_offload *flow,void *data) {if (nf_flow_has_expired (flow) ||nf_ct_is_dying (flow->ct) || -nf_flow_is_outdated (flow)) +nf_flow_custom_gc (flow_table, flow))flow_offload_teardown (flow);if (test_bit (NF_FLOW_TEARDOWN , &flow->flags)) {
net/sched/act_ct.c +7 -0
@@ -278,7 +278,14 @@ static int tcf_ct_flow_table_fill_actions(struct net *net,return err; } +static bool tcf_ct_flow_is_outdated (const struct flow_offload *flow) +{ +return test_bit (IPS_SEEN_REPLY_BIT , &flow->ct->status) && + !test_bit (NF_FLOW_HW_ESTABLISHED , &flow->flags); +} +static struct nf_flowtable_type flowtable_ct = { + .gc = tcf_ct_flow_is_outdated, .action = tcf_ct_flow_table_fill_actions, .owner =THIS_MODULE , };
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 76/112 net/sched: act_ct: additional checks for outdated flows
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vlad Buslov <[email protected]>
[ Upstream commit a63b6622120cd03a304796dbccb80655b3a21798 ]
Current nf_flow_is_outdated() implementation considers any flow table flow which state diverged from its underlying CT connection status for teardown which can be problematic in the following cases:
- Flow has never been offloaded to hardware in the first place either because flow table has hardware offload disabled (flag NF_FLOWTABLE_HW_OFFLOAD is not set) or because it is still pending on 'add' workqueue to be offloaded for the first time. The former is incorrect, the later generates excessive deletions and additions of flows.
- Flow is already pending to be updated on the workqueue. Tearing down such flows will also generate excessive removals from the flow table, especially on highly loaded system where the latency to re-offload a flow via 'add' workqueue can be quite high.
When considering a flow for teardown as outdated verify that it is both offloaded to hardware and doesn't have any pending updates.
--- net/sched/act_ct.c | 2 ++ 1 file changed, 2 insertions(+)
net/sched/act_ct.c +2 -0
@@ -281,6 +281,8 @@ static int tcf_ct_flow_table_fill_actions(struct net *net,static bool tcf_ct_flow_is_outdated (const struct flow_offload *flow) {return test_bit (IPS_SEEN_REPLY_BIT , &flow->ct->status) && +test_bit (IPS_HW_OFFLOAD_BIT , &flow->ct->status) && + !test_bit (NF_FLOW_HW_PENDING , &flow->flags) && !test_bit (NF_FLOW_HW_ESTABLISHED , &flow->flags); }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 77/112 drm/logicvc: Kconfig: select REGMAP and REGMAP_MMIO
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sui Jingfeng <[email protected]>
[ Upstream commit 4e6c38c38723a954b85aa9ee62603bb4a37acbb4 ]
drm/logicvc driver is depend on REGMAP and REGMAP_MMIO, should select this two kconfig option, otherwise the driver failed to compile on platform without REGMAP_MMIO selected:
ERROR: modpost: "__devm_regmap_init_mmio_clk" [drivers/gpu/drm/logicvc/logicvc-drm.ko] undefined! make[1]: *** [scripts/Makefile.modpost:136: Module.symvers] Error 1
make: *** [Makefile:1978: modpost] Error 2
--- drivers/gpu/drm/logicvc/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/logicvc/Kconfig +2 -0
@@ -5,5 +5,7 @@ config DRM_LOGICVC select DRM_KMS_HELPER select DRM_KMS_DMA_HELPER select DRM_GEM_DMA_HELPER + select REGMAP + select REGMAP_MMIO help DRM display driver for the logiCVC programmable logic block from Xylon
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 78/112 drm/i915/mcr: Hold GT forcewake during steering operations
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matt Roper <[email protected]>
[ Upstream commit 78cc55e0b64c820673a796635daf82c7eadfe152 ]
The steering control and semaphore registers are inside an "always on" power domain with respect to RC6. However there are some issues if higher-level platform sleep states are entering/exiting at the same time these registers are accessed. Grabbing GT forcewake and holding it over the entire lock/steer/unlock cycle ensures that those sleep states have been fully exited before we access these registers.
This is expected to become a formally documented/numbered workaround soon.
Note that this patch alone isn't expected to have an immediately noticeable impact on MCR (mis)behavior; an upcoming pcode firmware update will also be necessary to provide the other half of this workaround.
v2:
- Move the forcewake inside the Xe_LPG-specific IP version check. This should only be necessary on platforms that have a steering semaphore.
--- drivers/gpu/drm/i915/gt/intel_gt_mcr.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gt/intel_gt_mcr.c +22 -2
@@ -376,9 +376,26 @@ void intel_gt_mcr_lock(struct intel_gt *gt, unsigned long *flags)* driver threads, but also with hardware/firmware agents. A dedicated * locking register is used. */ -if (GRAPHICS_VER_FULL (gt->i915) >=IP_VER (12 ,70 )) +if (GRAPHICS_VER_FULL (gt->i915) >=IP_VER (12 ,70 )) { +/* +* The steering control and semaphore registers are inside an +* "always on" power domain with respect to RC6. However there +* are some issues if higher-level platform sleep states are +* entering/exiting at the same time these registers are +* accessed. Grabbing GT forcewake and holding it over the +* entire lock/steer/unlock cycle ensures that those sleep +* states have been fully exited before we access these +* registers. This wakeref will be released in the unlock +* routine. +* +* This is expected to become a formally documented/numbered +* workaround soon. +*/ +intel_uncore_forcewake_get (gt->uncore,FORCEWAKE_GT ); + err =wait_for (intel_uncore_read_fw (gt->uncore,MTL_STEER_SEMAPHORE ) ==0x1 ,100 ); + }/* * Even on platforms with a hardware lock, we'll continue to grab
@@ -415,8 +432,11 @@ void intel_gt_mcr_unlock(struct intel_gt *gt, unsigned long flags) {spin_unlock_irqrestore (>->mcr_lock, flags); -if (GRAPHICS_VER_FULL (gt->i915) >=IP_VER (12 ,70 )) +if (GRAPHICS_VER_FULL (gt->i915) >=IP_VER (12 ,70 )) {intel_uncore_write_fw (gt->uncore,MTL_STEER_SEMAPHORE ,0x1 ); + +intel_uncore_forcewake_put (gt->uncore,FORCEWAKE_GT ); + } }/**
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 79/112 iavf: in iavf_down, disable queues when removing the driver
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Schmidt <[email protected]>
[ Upstream commit 53798666648af3aa0dd512c2380576627237a800 ]
In iavf_down, we're skipping the scheduling of certain operations if the driver is being removed. However, the IAVF_FLAG_AQ_DISABLE_QUEUES request must not be skipped in this case, because iavf_close waits for the transition to the __IAVF_DOWN state, which happens in iavf_virtchnl_completion after the queues are released.
Without this fix, "rmmod iavf" takes half a second per interface that's up and prints the "Device resources not yet released" warning.
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -1
@@ -1437,9 +1437,9 @@ void iavf_down(struct iavf_adapter *adapter) adapter->aq_required |=IAVF_FLAG_AQ_DEL_FDIR_FILTER ;if (!list_empty (&adapter->adv_rss_list_head)) adapter->aq_required |=IAVF_FLAG_AQ_DEL_ADV_RSS_CFG ; - adapter->aq_required |=IAVF_FLAG_AQ_DISABLE_QUEUES ; } + adapter->aq_required |=IAVF_FLAG_AQ_DISABLE_QUEUES ;mod_delayed_work (adapter->wq, &adapter->watchdog_task,0 ); }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 80/112 scsi: sd: Introduce manage_shutdown device flag
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Damien Le Moal <[email protected]>
commit 24eca2dce0f8d19db808c972b0281298d0bafe99 upstream.
Commit aa3998dbeb3a ("ata: libata-scsi: Disable scsi device manage_system_start_stop") change setting the manage_system_start_stop flag to false for libata managed disks to enable libata internal management of disk suspend/resume. However, a side effect of this change is that on system shutdown, disks are no longer being stopped (set to standby mode with the heads unloaded). While this is not a critical issue, this unclean shutdown is not recommended and shows up with increased smart counters (e.g. the unexpected power loss counter "Unexpect_Power_Loss_Ct").
Instead of defining a shutdown driver method for all ATA adapter drivers (not all of them define that operation), this patch resolves this issue by further refining the sd driver start/stop control of disks using the new flag manage_shutdown. If this new flag is set to true by a low level driver, the function sd_shutdown() will issue a START STOP UNIT command with the start argument set to 0 when a disk needs to be powered off (suspended) on system power off, that is, when system_state is equal to SYSTEM_POWER_OFF.
Similarly to the other manage_xxx flags, the new manage_shutdown flag is exposed through sysfs as a read-write device attribute.
To avoid any confusion between manage_shutdown and manage_system_start_stop, the comments describing these flags in include/scsi/scsi.h are also improved.
--- drivers/ata/libata-scsi.c | 5 +++-- drivers/firewire/sbp2.c | 1 + drivers/scsi/sd.c | 39 ++++++++++++++++++++++++++++++++++++--- include/scsi/scsi_device.h | 20 ++++++++++++++++++-- 4 files changed, 58 insertions(+), 7 deletions(-)
drivers/ata/libata-scsi.c +3 -2
@@ -1103,10 +1103,11 @@ int ata_scsi_dev_config(struct scsi_devi/* * Ask the sd driver to issue START STOP UNIT on runtime suspend -* and resume only. For system level suspend/resume, devices -* power state is handled directly by libata EH. +* and resume and shutdown only. For system level suspend/resume, +* devices power state is handled directly by libata EH. */ sdev->manage_runtime_start_stop = true; + sdev->manage_shutdown = true; }/*
drivers/firewire/sbp2.c +1 -0
@@ -1521,6 +1521,7 @@ static int sbp2_scsi_slave_configure(strif (sbp2_param_exclusive_login) { sdev->manage_system_start_stop = true; sdev->manage_runtime_start_stop = true; + sdev->manage_shutdown = true; }if (sdev->type ==TYPE_ROM )
drivers/scsi/sd.c +36 -3
@@ -221,7 +221,8 @@ manage_start_stop_show(struct device *dereturn sysfs_emit (buf,"%u\n" , sdp->manage_system_start_stop && - sdp->manage_runtime_start_stop); + sdp->manage_runtime_start_stop && + sdp->manage_shutdown); }static DEVICE_ATTR_RO (manage_start_stop);
@@ -287,6 +288,35 @@ manage_runtime_start_stop_store(struct d }static DEVICE_ATTR_RW (manage_runtime_start_stop); +static ssize_t manage_shutdown_show (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct scsi_disk *sdkp =to_scsi_disk (dev); +struct scsi_device *sdp = sdkp->device; + +return sysfs_emit (buf,"%u\n" , sdp->manage_shutdown); +} + +static ssize_t manage_shutdown_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct scsi_disk *sdkp =to_scsi_disk (dev); +struct scsi_device *sdp = sdkp->device; +bool v; + +if (!capable (CAP_SYS_ADMIN )) +return -EACCES ; + +if (kstrtobool (buf, &v)) +return -EINVAL ; + + sdp->manage_shutdown = v; + +return count; +} +static DEVICE_ATTR_RW (manage_shutdown); +static ssize_t allow_restart_show (struct device *dev,struct device_attribute *attr,char *buf) {
@@ -619,6 +649,7 @@ static struct attribute *sd_disk_attrs[] &dev_attr_manage_start_stop.attr, &dev_attr_manage_system_start_stop.attr, &dev_attr_manage_runtime_start_stop.attr, + &dev_attr_manage_shutdown.attr, &dev_attr_protection_type.attr, &dev_attr_protection_mode.attr, &dev_attr_app_tag_own.attr,
@@ -3858,8 +3889,10 @@ static void sd_shutdown(struct device *dsd_sync_cache (sdkp,NULL ); } -if (system_state !=SYSTEM_RESTART && - sdkp->device->manage_system_start_stop) { +if ((system_state !=SYSTEM_RESTART && + sdkp->device->manage_system_start_stop) || + (system_state ==SYSTEM_POWER_OFF && + sdkp->device->manage_shutdown)) {sd_printk (KERN_NOTICE , sdkp,"Stopping disk\n" );sd_start_stop_device (sdkp,0 ); }
include/scsi/scsi_device.h +18 -2
@@ -162,8 +162,24 @@ struct scsi_device {* core. */ unsigned int eh_timeout;/* Error handling timeout */ -bool manage_system_start_stop;/* Let HLD (sd) manage system start/stop */ -bool manage_runtime_start_stop;/* Let HLD (sd) manage runtime start/stop */ +/* +* If true, let the high-level device driver (sd) manage the device +* power state for system suspend/resume (suspend to RAM and +* hibernation) operations. +*/ +bool manage_system_start_stop; + +/* +* If true, let the high-level device driver (sd) manage the device +* power state for runtime device suspand and resume operations. +*/ +bool manage_runtime_start_stop; + +/* +* If true, let the high-level device driver (sd) manage the device +* power state for system shutdown (power off) operations. +*/ +bool manage_shutdown; unsigned removable:1; unsigned changed:1; /* Data invalid due to media change */
Greg Kroah-Hartman
maintainerPATCH 81/112 blk-throttle: check for overflow in calculate_bytes_allowed
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Khazhismel Kumykov <[email protected]>
commit 2dd710d476f2f1f6eaca884f625f69ef4389ed40 upstream.
Inexact, we may reject some not-overflowing values incorrectly, but they'll be on the order of exabytes allowed anyways.
This fixes divide error crash on x86 if bps_limit is not configured or is set too high in the rare case that jiffy_elapsed is greater than HZ.
--- block/blk-throttle.c | 6 ++++++ 1 file changed, 6 insertions(+)
block/blk-throttle.c +6 -0
@@ -723,6 +723,12 @@ static unsigned int calculate_io_allowedstatic u64 calculate_bytes_allowed (u64 bps_limit,unsigned long jiffy_elapsed) { +/* +* Can result be wider than 64 bits? +* We check against 62, not 64, due to ilog2 truncation. +*/ +if (ilog2 (bps_limit) +ilog2 (jiffy_elapsed) -ilog2 (HZ ) >62 ) +return U64_MAX ;return mul_u64_u64_div_u64 (bps_limit, (u64 )jiffy_elapsed, (u64 )HZ ); }
Greg Kroah-Hartman
maintainerPATCH 82/112 kasan: print the original fault addr when access invalid shadow
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haibo Li <[email protected]>
commit babddbfb7d7d70ae7f10fedd75a45d8ad75fdddf upstream.
when the checked address is illegal,the corresponding shadow address from kasan_mem_to_shadow may have no mapping in mmu table. Access such shadow address causes kernel oops. Here is a sample about oops on arm64(VA 39bit) with KASAN_SW_TAGS and KASAN_OUTLINE on:
[ffffffb80aaaaaaa] pgd=000000005d3ce003, p4d=000000005d3ce003,
pud=000000005d3ce003, pmd=0000000000000000 Internal error: Oops: 0000000096000006 [#1] PREEMPT SMP Modules linked in: CPU: 3 PID: 100 Comm: sh Not tainted 6.6.0-rc1-dirty #43 Hardware name: linux,dummy-virt (DT) pstate: 80000005 (Nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : __hwasan_load8_noabort+0x5c/0x90 lr : do_ib_ob+0xf4/0x110
ffffffb80aaaaaaa is the shadow address for efffff80aaaaaaaa. The problem is reading invalid shadow in kasan_check_range.
The generic kasan also has similar oops.
It only reports the shadow address which causes oops but not the original address.
Commit 2f004eea0fc8("x86/kasan: Print original address on #GP") introduce to kasan_non_canonical_hook but limit it to KASAN_INLINE.
This patch extends it to KASAN_OUTLINE mode.
--- include/linux/kasan.h | 6 +++--- mm/kasan/report.c | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-)
include/linux/kasan.h +3 -3
@@ -464,10 +464,10 @@ static inline void kasan_free_module_sha#endif /* (CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS) && !CONFIG_KASAN_VMALLOC */ -#ifdef CONFIG_KASAN_INLINE +#ifdef CONFIG_KASAN void kasan_non_canonical_hook (unsigned long addr); -#else /* CONFIG_KASAN_INLINE */ +#else /* CONFIG_KASAN */ static inline void kasan_non_canonical_hook (unsigned long addr) { } -#endif /* CONFIG_KASAN_INLINE */ +#endif /* CONFIG_KASAN */ #endif /* LINUX_KASAN_H */
mm/kasan/report.c +1 -3
@@ -621,9 +621,8 @@ void kasan_report_async(void) }#endif /* CONFIG_KASAN_HW_TAGS */ -#ifdef CONFIG_KASAN_INLINE /* -* With CONFIG_KASAN_INLINE, accesses to bogus pointers (outside the high +* With CONFIG_KASAN, accesses to bogus pointers (outside the high * canonical half of the address space) cause out-of-bounds shadow memory reads * before the actual access. For addresses in the low canonical half of the * address space, as well as most non-canonical addresses, that out-of-bounds
@@ -659,4 +658,3 @@ void kasan_non_canonical_hook(unsigned lpr_alert ("KASAN: %s in range [0x%016lx-0x%016lx]\n" , bug_type, orig_addr, orig_addr +KASAN_GRANULE_SIZE -1 ); } -#endif
Greg Kroah-Hartman
maintainerPATCH 83/112 io_uring/fdinfo: lock SQ thread while retrieving thread cpu/pid
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
commit 7644b1a1c9a7ae8ab99175989bfc8676055edb46 upstream.
We could race with SQ thread exit, and if we do, we'll hit a NULL pointer dereference when the thread is cleared. Grab the SQPOLL data lock before attempting to get the task cpu and pid for fdinfo, this ensures we have a stable view of it.
--- io_uring/fdinfo.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
io_uring/fdinfo.c +12 -6
@@ -49,7 +49,6 @@ static __cold int io_uring_show_cred(struct seq_file *m, unsigned int id,static __cold void __io_uring_show_fdinfo (struct io_ring_ctx *ctx,struct seq_file *m) { -struct io_sq_data *sq =NULL ;struct io_overflow_cqe *ocqe;struct io_rings *r = ctx->rings;unsigned int sq_mask = ctx->sq_entries -1 , cq_mask = ctx->cq_entries -1 ;
@@ -60,6 +59,7 @@ static __cold void __io_uring_show_fdinfo(struct io_ring_ctx *ctx,unsigned int cq_shift =0 ;unsigned int sq_shift =0 ;unsigned int sq_entries, cq_entries; +int sq_pid =-1 , sq_cpu =-1 ;bool has_lock;unsigned int i;
@@ -137,13 +137,19 @@ static __cold void __io_uring_show_fdinfo(struct io_ring_ctx *ctx, has_lock =mutex_trylock (&ctx->uring_lock);if (has_lock && (ctx->flags &IORING_SETUP_SQPOLL )) { - sq = ctx->sq_data; -if (!sq->thread) - sq =NULL ; +struct io_sq_data *sq = ctx->sq_data; + +if (mutex_trylock (&sq->lock)) { +if (sq->thread) { + sq_pid =task_pid_nr (sq->thread); + sq_cpu =task_cpu (sq->thread); + } +mutex_unlock (&sq->lock); + } } -seq_printf (m,"SqThread:\t%d\n" , sq ?task_pid_nr (sq->thread) :-1 ); -seq_printf (m,"SqThreadCpu:\t%d\n" , sq ?task_cpu (sq->thread) :-1 ); +seq_printf (m,"SqThread:\t%d\n" , sq_pid); +seq_printf (m,"SqThreadCpu:\t%d\n" , sq_cpu);seq_printf (m,"UserFiles:\t%u\n" , ctx->nr_user_files);for (i =0 ; has_lock && i < ctx->nr_user_files; i++) {struct file *f =io_file_from_index (&ctx->file_table, i);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 84/112 iio: afe: rescale: Accept only offset channels
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
commit bee448390e5166d019e9e037194d487ee94399d9 upstream.
As noted by Jonathan Cameron: it is perfectly legal for a channel to have an offset but no scale in addition to the raw interface. The conversion will imply that scale is 1:1.
Make rescale_configure_channel() accept just scale, or just offset to process a channel.
When a user asks for IIO_CHAN_INFO_OFFSET in rescale_read_raw() we now have to deal with the fact that OFFSET could be present but SCALE missing. Add code to simply scale 1:1 in this case.
--- drivers/iio/afe/iio-rescale.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/iio/afe/iio-rescale.c +15 -4
@@ -214,8 +214,18 @@ static int rescale_read_raw(struct iio_dreturn ret <0 ? ret : -EOPNOTSUPP ; } - ret =iio_read_channel_scale (rescale->source, &scale, &scale2); -return rescale_process_offset (rescale, ret, scale, scale2, +if (iio_channel_has_info (rescale->source->channel, +IIO_CHAN_INFO_SCALE )) { + ret =iio_read_channel_scale (rescale->source, &scale, &scale2); +return rescale_process_offset (rescale, ret, scale, scale2, + schan_off, val, val2); + } + +/* +* If we get here we have no scale so scale 1:1 but apply +* rescaler and offset, if any. +*/ +return rescale_process_offset (rescale,IIO_VAL_FRACTIONAL ,1 ,1 , schan_off, val, val2);default :return -EINVAL ;
@@ -280,8 +290,9 @@ static int rescale_configure_channel(str chan->type = rescale->cfg->type;if (iio_channel_has_info (schan,IIO_CHAN_INFO_RAW ) && -iio_channel_has_info (schan,IIO_CHAN_INFO_SCALE )) { -dev_info (dev,"using raw+scale source channel\n" ); + (iio_channel_has_info (schan,IIO_CHAN_INFO_SCALE ) || +iio_channel_has_info (schan,IIO_CHAN_INFO_OFFSET ))) { +dev_info (dev,"using raw+scale/offset source channel\n" ); }else if (iio_channel_has_info (schan,IIO_CHAN_INFO_PROCESSED )) {dev_info (dev,"using processed channel\n" ); rescale->chan_processed = true;
Greg Kroah-Hartman
maintainerPATCH 85/112 iio: exynos-adc: request second interupt only when touchscreen mode is used
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <[email protected]>
commit 865b080e3229102f160889328ce2e8e97aa65ea0 upstream.
Second interrupt is needed only when touchscreen mode is used, so don't request it unconditionally. This removes the following annoying warning during boot:
exynos-adc 14d10000.adc: error -ENXIO: IRQ index 1 not found
--- drivers/iio/adc/exynos_adc.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-)
drivers/iio/adc/exynos_adc.c +15 -11
@@ -826,16 +826,26 @@ static int exynos_adc_probe(struct platf } } +/* leave out any TS related code if unreachable */ +if (IS_REACHABLE (CONFIG_INPUT )) { + has_ts =of_property_read_bool (pdev->dev.of_node, +"has-touchscreen" ) || pdata; + } + irq =platform_get_irq (pdev,0 );if (irq <0 )return irq; info->irq = irq; - irq =platform_get_irq (pdev,1 ); -if (irq == -EPROBE_DEFER ) -return irq; - - info->tsirq = irq; +if (has_ts) { + irq =platform_get_irq (pdev,1 ); +if (irq == -EPROBE_DEFER ) +return irq; + + info->tsirq = irq; + }else { + info->tsirq =-1 ; + } info->dev = &pdev->dev;
@@ -900,12 +910,6 @@ static int exynos_adc_probe(struct platfif (info->data->init_hw) info->data->init_hw (info); -/* leave out any TS related code if unreachable */ -if (IS_REACHABLE (CONFIG_INPUT )) { - has_ts =of_property_read_bool (pdev->dev.of_node, -"has-touchscreen" ) || pdata; - } -if (pdata) info->delay = pdata->delay;else
Greg Kroah-Hartman
maintainerPATCH 86/112 iio: adc: xilinx-xadc: Dont clobber preset voltage/temperature thresholds
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robert Hancock <[email protected]>
commit 8d6b3ea4d9eaca80982442b68a292ce50ce0a135 upstream.
In the probe function, the driver was reading out the thresholds already set in the core, which can be configured by the user in the Vivado tools when the FPGA image is built. However, it later clobbered those values with zero or maximum values. In particular, the overtemperature shutdown threshold register was overwritten with the max value, which effectively prevents the FPGA from shutting down when the desired threshold was eached, potentially risking hardware damage in that case.
Remove this code to leave the preconfigured default threshold values intact.
The code was also disabling all alarms regardless of what enable state they were left in by the FPGA image, including the overtemperature shutdown feature. Leave these bits in their original state so they are not unconditionally disabled.
--- drivers/iio/adc/xilinx-xadc-core.c | 22 ---------------------- 1 file changed, 22 deletions(-)
drivers/iio/adc/xilinx-xadc-core.c +0 -22
@@ -1423,28 +1423,6 @@ static int xadc_probe(struct platform_deif (ret)return ret; -/* Disable all alarms */ - ret =xadc_update_adc_reg (xadc,XADC_REG_CONF1 ,XADC_CONF1_ALARM_MASK , -XADC_CONF1_ALARM_MASK ); -if (ret) -return ret; - -/* Set thresholds to min/max */ -for (i =0 ; i <16 ; i++) { -/* -* Set max voltage threshold and both temperature thresholds to -* 0xffff, min voltage threshold to 0. -*/ -if (i %8 <4 || i ==7 ) - xadc->threshold[i] =0xffff ; -else - xadc->threshold[i] =0 ; - ret =xadc_write_adc_reg (xadc,XADC_REG_THRESHOLD (i), - xadc->threshold[i]); -if (ret) -return ret; - } -/* Go to non-buffered mode */ xadc_postdisable (indio_dev);
Greg Kroah-Hartman
maintainerPATCH 87/112 iio: adc: xilinx-xadc: Correct temperature offset/scale for UltraScale
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robert Hancock <[email protected]>
commit e2bd8c28b9bd835077eb65715d416d667694a80d upstream.
The driver was previously using offset and scale values for the temperature sensor readings which were only valid for 7-series devices. Add per-device-type values for offset and scale and set them appropriately for each device type.
Note that the values used for the UltraScale family are for UltraScale+ (i.e. the SYSMONE4 primitive) using the internal reference, as that seems to be the most common configuration and the device tree values Xilinx's device tree generator produces don't seem to give us anything to tell us which configuration is used. However, the differences within the UltraScale family seem fairly minor and it's closer than using the 7-series values instead in any case.
--- drivers/iio/adc/xilinx-xadc-core.c | 17 ++++++++++++++--- drivers/iio/adc/xilinx-xadc.h | 2 ++ 2 files changed, 16 insertions(+), 3 deletions(-)
drivers/iio/adc/xilinx-xadc-core.c +14 -3
@@ -456,6 +456,9 @@ static const struct xadc_ops xadc_zynq_o .interrupt_handler = xadc_zynq_interrupt_handler, .update_alarm = xadc_zynq_update_alarm, .type = XADC_TYPE_S7, + /* Temp in C = (val * 503.975) / 2**bits - 273.15 */ + .temp_scale = 503975, + .temp_offset = 273150, };static const unsigned int xadc_axi_reg_offsets[] = {
@@ -566,6 +569,9 @@ static const struct xadc_ops xadc_7s_axi .interrupt_handler = xadc_axi_interrupt_handler, .flags = XADC_FLAGS_BUFFERED | XADC_FLAGS_IRQ_OPTIONAL, .type = XADC_TYPE_S7, + /* Temp in C = (val * 503.975) / 2**bits - 273.15 */ + .temp_scale = 503975, + .temp_offset = 273150, };static const struct xadc_ops xadc_us_axi_ops = {
@@ -577,6 +583,12 @@ static const struct xadc_ops xadc_us_axi .interrupt_handler = xadc_axi_interrupt_handler, .flags = XADC_FLAGS_BUFFERED | XADC_FLAGS_IRQ_OPTIONAL, .type = XADC_TYPE_US, +/** +* Values below are for UltraScale+ (SYSMONE4) using internal reference. +* See https://docs.xilinx.com/v/u/en-US/ug580-ultrascale-sysmon +*/ + .temp_scale = 509314, + .temp_offset = 280231, }; static int _xadc_update_adc_reg(struct xadc *xadc, unsigned int reg,
@@ -945,8 +957,7 @@ static int xadc_read_raw(struct iio_dev *val2 = bits;return IIO_VAL_FRACTIONAL_LOG2 ;case IIO_TEMP : -/* Temp in C = (val * 503.975) / 2**bits - 273.15 */ - *val =503975 ; + *val = xadc->ops->temp_scale; *val2 = bits;return IIO_VAL_FRACTIONAL_LOG2 ;default :
@@ -954,7 +965,7 @@ static int xadc_read_raw(struct iio_dev }case IIO_CHAN_INFO_OFFSET :/* Only the temperature channel has an offset */ - *val = -((273150 << bits) /503975 ); + *val = -((xadc->ops->temp_offset << bits) / xadc->ops->temp_scale);return IIO_VAL_INT ;case IIO_CHAN_INFO_SAMP_FREQ : ret =xadc_read_samplerate (xadc);
drivers/iio/adc/xilinx-xadc.h +2 -0
@@ -85,6 +85,8 @@ struct xadc_ops {unsigned int flags;enum xadc_type type; +int temp_scale; +int temp_offset; }; static inline int _xadc_read_adc_reg(struct xadc *xadc, unsigned int reg,
Greg Kroah-Hartman
maintainerPATCH 88/112 i2c: muxes: i2c-mux-pinctrl: Use of_get_i2c_adapter_by_node()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herve Codina <[email protected]>
commit 3171d37b58a76e1febbf3f4af2d06234a98cf88b upstream.
i2c-mux-pinctrl uses the pair of_find_i2c_adapter_by_node() / i2c_put_adapter(). These pair alone is not correct to properly lock the I2C parent adapter.
Indeed, i2c_put_adapter() decrements the module refcount while of_find_i2c_adapter_by_node() does not increment it. This leads to an underflow of the parent module refcount.
Use the dedicated function, of_get_i2c_adapter_by_node(), to handle correctly the module refcount.
--- drivers/i2c/muxes/i2c-mux-pinctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/muxes/i2c-mux-pinctrl.c +1 -1
@@ -62,7 +62,7 @@ static struct i2c_adapter *i2c_mux_pinctdev_err (dev,"Cannot parse i2c-parent\n" );return ERR_PTR (-ENODEV ); } - parent =of_find_i2c_adapter_by_node (parent_np); + parent =of_get_i2c_adapter_by_node (parent_np);of_node_put (parent_np);if (!parent)return ERR_PTR (-EPROBE_DEFER );
Greg Kroah-Hartman
maintainerPATCH 89/112 i2c: muxes: i2c-mux-gpmux: Use of_get_i2c_adapter_by_node()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herve Codina <[email protected]>
commit 3dc0ec46f6e7511fc4fdf6b6cda439382bc957f1 upstream.
i2c-mux-gpmux uses the pair of_find_i2c_adapter_by_node() / i2c_put_adapter(). These pair alone is not correct to properly lock the I2C parent adapter.
Indeed, i2c_put_adapter() decrements the module refcount while of_find_i2c_adapter_by_node() does not increment it. This leads to an underflow of the parent module refcount.
Use the dedicated function, of_get_i2c_adapter_by_node(), to handle correctly the module refcount.
--- drivers/i2c/muxes/i2c-mux-gpmux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/muxes/i2c-mux-gpmux.c +1 -1
@@ -52,7 +52,7 @@ static struct i2c_adapter *mux_parent_addev_err (dev,"Cannot parse i2c-parent\n" );return ERR_PTR (-ENODEV ); } - parent =of_find_i2c_adapter_by_node (parent_np); + parent =of_get_i2c_adapter_by_node (parent_np);of_node_put (parent_np);if (!parent)return ERR_PTR (-EPROBE_DEFER );
Greg Kroah-Hartman
maintainerPATCH 90/112 i2c: muxes: i2c-demux-pinctrl: Use of_get_i2c_adapter_by_node()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herve Codina <[email protected]>
commit 0fb118de5003028ad092a4e66fc6d07b86c3bc94 upstream.
i2c-demux-pinctrl uses the pair of_find_i2c_adapter_by_node() / i2c_put_adapter(). These pair alone is not correct to properly lock the I2C parent adapter.
Indeed, i2c_put_adapter() decrements the module refcount while of_find_i2c_adapter_by_node() does not increment it. This leads to an underflow of the parent module refcount.
Use the dedicated function, of_get_i2c_adapter_by_node(), to handle
correctly the module refcount.
--- drivers/i2c/muxes/i2c-demux-pinctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/muxes/i2c-demux-pinctrl.c +1 -1
@@ -61,7 +61,7 @@ static int i2c_demux_activate_master(strif (ret) goto err; - adap =of_find_i2c_adapter_by_node (priv->chan[new_chan].parent_np); + adap =of_get_i2c_adapter_by_node (priv->chan[new_chan].parent_np);if (!adap) { ret = -ENODEV ; goto err_with_revert;
Greg Kroah-Hartman
maintainerPATCH 91/112 i2c: stm32f7: Fix PEC handling in case of SMBUS transfers
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alain Volmat <[email protected]>
commit c896ff2dd8f30a6b0a922c83a96f6d43f05f0e92 upstream.
In case of SMBUS byte read with PEC enabled, the whole transfer is split into two commands. A first write command, followed by a read command. The write command does not have any PEC byte and a PEC byte is appended at the end of the read command. (cf Read byte protocol with PEC in SMBUS specification)
Within the STM32 I2C controller, handling (either sending or receiving) of the PEC byte is done via the PECBYTE bit in register CR2.
Currently, the PECBYTE is set at the beginning of a transfer, which lead to sending a PEC byte at the end of the write command (hence losing the real last byte), and also does not check the PEC byte received during the read command.
This patch corrects the function stm32f7_i2c_smbus_xfer_msg in order to only set the PECBYTE during the read command.
--- drivers/i2c/busses/i2c-stm32f7.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-stm32f7.c +6 -3
@@ -1059,9 +1059,10 @@ static int stm32f7_i2c_smbus_xfer_msg(st/* Configure PEC */ if ((flags &I2C_CLIENT_PEC ) && f7_msg->size !=I2C_SMBUS_QUICK ) { cr1 |=STM32F7_I2C_CR1_PECEN ; - cr2 |=STM32F7_I2C_CR2_PECBYTE ; -if (!f7_msg->read_write) +if (!f7_msg->read_write) { + cr2 |=STM32F7_I2C_CR2_PECBYTE ; f7_msg->count++; + } }else { cr1 &= ~STM32F7_I2C_CR1_PECEN ; cr2 &= ~STM32F7_I2C_CR2_PECBYTE ;
@@ -1149,8 +1150,10 @@ static void stm32f7_i2c_smbus_rep_start( f7_msg->stop = true;/* Add one byte for PEC if needed */ -if (cr1 &STM32F7_I2C_CR1_PECEN ) +if (cr1 &STM32F7_I2C_CR1_PECEN ) { + cr2 |=STM32F7_I2C_CR2_PECBYTE ; f7_msg->count++; + }/* Set number of bytes to be transferred */ cr2 &= ~(STM32F7_I2C_CR2_NBYTES_MASK );
Greg Kroah-Hartman
maintainerPATCH 92/112 i2c: aspeed: Fix i2c bus hang in slave read
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jian Zhang <[email protected]>
commit 54f1840ddee9bbdc8dd89fbbfdfa632401244146 upstream.
When the CONFIG_I2C_SLAVE option is enabled and the device operates as a slave, a situation arises where the master sends a START signal without the accompanying STOP signal. This action results in a persistent I2C bus timeout. The core issue stems from the fact that the i2c controller remains in a slave read state without a timeout mechanism. As a consequence, the bus perpetually experiences timeouts.
In this case, the i2c bus will be reset, but the slave_state reset is missing.
--- drivers/i2c/busses/i2c-aspeed.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-aspeed.c +2 -1
@@ -749,6 +749,8 @@ static void __aspeed_i2c_reg_slave(struc func_ctrl_reg_val =readl (bus->base +ASPEED_I2C_FUN_CTRL_REG ); func_ctrl_reg_val |=ASPEED_I2CD_SLAVE_EN ;writel (func_ctrl_reg_val, bus->base +ASPEED_I2C_FUN_CTRL_REG ); + + bus->slave_state =ASPEED_I2C_SLAVE_INACTIVE ; }static int aspeed_i2c_reg_slave (struct i2c_client *client)
@@ -765,7 +767,6 @@ static int aspeed_i2c_reg_slave(struct i__aspeed_i2c_reg_slave (bus, client->addr); bus->slave = client; - bus->slave_state =ASPEED_I2C_SLAVE_INACTIVE ;spin_unlock_irqrestore (&bus->lock, flags);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 93/112 tracing/kprobes: Fix symbol counting logic by looking at modules as well
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrii Nakryiko <[email protected]>
commit 926fe783c8a64b33997fec405cf1af3e61aed441 upstream.
Recent changes to count number of matching symbols when creating a kprobe event failed to take into account kernel modules. As such, it breaks kprobes on kernel module symbols, by assuming there is no match.
Fix this my calling module_kallsyms_on_each_symbol() in addition to kallsyms_on_each_match_symbol() to perform a proper counting.
--- kernel/trace/trace_kprobe.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)
kernel/trace/trace_kprobe.c +20 -4
@@ -714,14 +714,30 @@ static int count_symbols(void *data, unsreturn 0 ; } +struct sym_count_ctx { +unsigned int count; +const char *name; +}; + +static int count_mod_symbols (void *data,const char *name,unsigned long unused) +{ +struct sym_count_ctx *ctx = data; + +if (strcmp (name, ctx->name) ==0 ) + ctx->count++; + +return 0 ; +} +static unsigned int number_of_same_symbols (char *func_name) { -unsigned int count; +struct sym_count_ctx ctx = { .count =0 , .name = func_name }; + +kallsyms_on_each_match_symbol (count_symbols, func_name, &ctx.count); - count =0 ; -kallsyms_on_each_match_symbol (count_symbols, func_name, &count); +module_kallsyms_on_each_symbol (NULL , count_mod_symbols, &ctx); -return count; +return ctx.count; }static int __trace_kprobe_create (int argc,const char *argv[])
Greg Kroah-Hartman
maintainerPATCH 94/112 tracing/kprobes: Fix the description of variable length arguments
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yujie Liu <[email protected]>
commit e0f831836cead677fb07d54bd6bf499df35640c2 upstream.
Fix the following kernel-doc warnings:
kernel/trace/trace_kprobe.c:1029: warning: Excess function parameter 'args' description in '__kprobe_event_gen_cmd_start' kernel/trace/trace_kprobe.c:1097: warning: Excess function parameter 'args' description in '__kprobe_event_add_fields'
Refer to the usage of variable length arguments elsewhere in the kernel code, "@..." is the proper way to express it in the description.
--- kernel/trace/trace_kprobe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace_kprobe.c +2 -2
@@ -1022,7 +1022,7 @@ EXPORT_SYMBOL_GPL(kprobe_event_cmd_init)* @name: The name of the kprobe event * @loc: The location of the kprobe event * @kretprobe: Is this a return probe? -* @args: Variable number of arg (pairs), one pair for each field +* @...: Variable number of arg (pairs), one pair for each field * * NOTE: Users normally won't want to call this function directly, but * rather use the kprobe_event_gen_cmd_start() wrapper, which automatically
@@ -1095,7 +1095,7 @@ EXPORT_SYMBOL_GPL(__kprobe_event_gen_cmd/** * __kprobe_event_add_fields - Add probe fields to a kprobe command from arg list * @cmd: A pointer to the dynevent_cmd struct representing the new event -* @args: Variable number of arg (pairs), one pair for each field +* @...: Variable number of arg (pairs), one pair for each field * * NOTE: Users normally won't want to call this function directly, but * rather use the kprobe_event_add_fields() wrapper, which
Greg Kroah-Hartman
maintainerPATCH 95/112 misc: fastrpc: Reset metadata buffer to avoid incorrect free
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ekansh Gupta <[email protected]>
commit 1c29d80134ac116e0196c7bad58a2121381b679c upstream.
Metadata buffer is allocated during get_args for any remote call. This buffer carries buffers, fdlists and other payload information for the call. If the buffer is not reset, put_args might find some garbage FDs in the fdlist which might have an existing mapping in the list. This could result in improper freeing of FD map when DSP might still be using the buffer. Added change to reset the metadata buffer after allocation.
--- drivers/misc/fastrpc.c | 1 + 1 file changed, 1 insertion(+)
drivers/misc/fastrpc.c +1 -0
@@ -957,6 +957,7 @@ static int fastrpc_get_args(u32 kernel,if (err)return err; +memset (ctx->buf->virt,0 , pkt_size); rpra = ctx->buf->virt; list =fastrpc_invoke_buf_start (rpra, ctx->nscalars); pages =fastrpc_phy_page_start (list, ctx->nscalars);
Greg Kroah-Hartman
maintainerPATCH 96/112 misc: fastrpc: Free DMA handles for RPC calls with no arguments
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ekansh Gupta <[email protected]>
commit 206484303892a2a36c0c3414030ddfef658a4e70 upstream.
The FDs for DMA handles to be freed is updated in fdlist by DSP over a remote call. This holds true even for remote calls with no arguments. To handle this, get_args and put_args are needed to be called for remote calls with no arguments also as fdlist is allocated in get_args and FDs updated in fdlist is freed in put_args.
--- drivers/misc/fastrpc.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-)
drivers/misc/fastrpc.c +10 -13
@@ -1090,6 +1090,7 @@ static int fastrpc_put_args(struct fastr } } +/* Clean up fdlist which is updated by DSP */ for (i =0 ; i <FASTRPC_MAX_FDLIST ; i++) {if (!fdlist[i])break ;
@@ -1156,11 +1157,9 @@ static int fastrpc_internal_invoke(strucif (IS_ERR (ctx))return PTR_ERR (ctx); -if (ctx->nscalars) { - err =fastrpc_get_args (kernel, ctx); -if (err) - goto bail; - } + err =fastrpc_get_args (kernel, ctx); +if (err) + goto bail;/* make sure that all CPU memory writes are seen by DSP */ dma_wmb ();
@@ -1184,14 +1183,12 @@ static int fastrpc_internal_invoke(strucif (err) goto bail; -if (ctx->nscalars) { -/* make sure that all memory writes by DSP are seen by CPU */ -dma_rmb (); -/* populate all the output buffers with results */ - err =fastrpc_put_args (ctx, kernel); -if (err) - goto bail; - } +/* make sure that all memory writes by DSP are seen by CPU */ +dma_rmb (); +/* populate all the output buffers with results */ + err =fastrpc_put_args (ctx, kernel); +if (err) + goto bail; bail:if (err != -ERESTARTSYS && err != -ETIMEDOUT ) {
Greg Kroah-Hartman
maintainerPATCH 97/112 misc: fastrpc: Clean buffers on remote invocation failures
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ekansh Gupta <[email protected]>
commit 1c8093591d1e372d700fe65423e7315a8ecf721b upstream.
With current design, buffers and dma handles are not freed in case of remote invocation failures returned from DSP. This could result in buffer leakings and dma handle pointing to wrong memory in the fastrpc kernel. Adding changes to clean buffers and dma handles even when remote invocation to DSP returns failures.
--- drivers/misc/fastrpc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/misc/fastrpc.c +5 -5
@@ -1178,11 +1178,6 @@ static int fastrpc_internal_invoke(strucif (err) goto bail; -/* Check the response from remote dsp */ - err = ctx->retval; -if (err) - goto bail; -/* make sure that all memory writes by DSP are seen by CPU */ dma_rmb ();/* populate all the output buffers with results */
@@ -1190,6 +1185,11 @@ static int fastrpc_internal_invoke(strucif (err) goto bail; +/* Check the response from remote dsp */ + err = ctx->retval; +if (err) + goto bail; + bail:if (err != -ERESTARTSYS && err != -ETIMEDOUT ) {/* We are done with this compute context */
Greg Kroah-Hartman
maintainerPATCH 98/112 misc: fastrpc: Unmap only if buffer is unmapped from DSP
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ekansh Gupta <[email protected]>
commit 509143385db364c67556a914bef6c9a42fd2c74c upstream.
For unmapping any buffer from kernel, it should first be unmapped from DSP. In case unmap from DSP request fails, the map should not be removed from kernel as it might lead to SMMU faults and other memory issues.
--- drivers/misc/fastrpc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/misc/fastrpc.c +5 -3
@@ -1980,11 +1980,13 @@ static int fastrpc_req_mem_unmap_impl(st sc =FASTRPC_SCALARS (FASTRPC_RMID_INIT_MEM_UNMAP ,1 ,0 ); err =fastrpc_internal_invoke (fl, true,FASTRPC_INIT_HANDLE , sc, &args[0 ]); -fastrpc_map_put (map); -if (err) +if (err) {dev_err (dev,"unmmap\tpt fd = %d, 0x%09llx error\n" , map->fd, map->raddr); +return err; + } +fastrpc_map_put (map); -return err; +return 0 ; }static int fastrpc_req_mem_unmap (struct fastrpc_user *fl,char __user *argp)
Greg Kroah-Hartman
maintainerPATCH 99/112 nvmem: imx: correct nregs for i.MX6ULL
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
commit 2382c1b044231fd49eaf9aa82bc7113fc55487b8 upstream.
The nregs for i.MX6ULL should be 80 per fuse map, correct it.
--- drivers/nvmem/imx-ocotp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvmem/imx-ocotp.c +1 -1
@@ -520,7 +520,7 @@ static const struct ocotp_params imx6ul_ };static const struct ocotp_params imx6ull_params = { - .nregs =64 , + .nregs =80 , .bank_address_words =0 , .set_timing = imx_ocotp_set_imx6_timing, .ctrl =IMX_OCOTP_BM_CTRL_DEFAULT ,
Greg Kroah-Hartman
maintainerPATCH 100/112 nvmem: imx: correct nregs for i.MX6SLL
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
commit 414a98abbefd82d591f4e2d1efd2917bcd3b6f6d upstream.
The nregs for i.MX6SLL should be 80 per fuse map, correct it.
--- drivers/nvmem/imx-ocotp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvmem/imx-ocotp.c +1 -1
@@ -499,7 +499,7 @@ static const struct ocotp_params imx6sl_ };static const struct ocotp_params imx6sll_params = { - .nregs =128 , + .nregs =80 , .bank_address_words =0 , .set_timing = imx_ocotp_set_imx6_timing, .ctrl =IMX_OCOTP_BM_CTRL_DEFAULT ,
Greg Kroah-Hartman
maintainerPATCH 101/112 nvmem: imx: correct nregs for i.MX6UL
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
commit 7d6e10f5d254681983b53d979422c8de3fadbefb upstream.
The nregs for i.MX6UL should be 144 per fuse map, correct it.
--- drivers/nvmem/imx-ocotp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvmem/imx-ocotp.c +1 -1
@@ -513,7 +513,7 @@ static const struct ocotp_params imx6sx_ };static const struct ocotp_params imx6ul_params = { - .nregs =128 , + .nregs =144 , .bank_address_words =0 , .set_timing = imx_ocotp_set_imx6_timing, .ctrl =IMX_OCOTP_BM_CTRL_DEFAULT ,
Greg Kroah-Hartman
maintainerPATCH 102/112 x86/tsc: Defer marking TSC unstable to a worker
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit bd94d86f490b70c58b3fc5739328a53ad4b18d86 upstream.
Tetsuo reported the following lockdep splat when the TSC synchronization fails during CPU hotplug:
tsc: Marking TSC unstable due to check_tsc_sync_source failed
WARNING: inconsistent lock state
inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage. ffffffff8cfa1c78 (watchdog_lock){?.-.}-{2:2}, at: clocksource_watchdog+0x23/0x5a0 {IN-HARDIRQ-W} state was registered at:
_raw_spin_lock_irqsave+0x3f/0x60
clocksource_mark_unstable+0x1b/0x90
mark_tsc_unstable+0x41/0x50
check_tsc_sync_source+0x14f/0x180
sysvec_call_function_single+0x69/0x90
Possible unsafe locking scenario:
lock(watchdog_lock);
<Interrupt>
lock(watchdog_lock);
stack backtrace:
_raw_spin_lock+0x30/0x40
clocksource_watchdog+0x23/0x5a0
run_timer_softirq+0x2a/0x50
sysvec_apic_timer_interrupt+0x6e/0x90The reason is the recent conversion of the TSC synchronization function during CPU hotplug on the control CPU to a SMP function call. In case that the synchronization with the upcoming CPU fails, the TSC has to be marked unstable via clocksource_mark_unstable().
clocksource_mark_unstable() acquires 'watchdog_lock', but that lock is taken with interrupts enabled in the watchdog timer callback to minimize interrupt disabled time. That's obviously a possible deadlock scenario,
Before that change the synchronization function was invoked in thread context so this could not happen.
As it is not crucical whether the unstable marking happens slightly delayed, defer the call to a worker thread which avoids the lock context problem.
--- arch/x86/kernel/tsc_sync.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
arch/x86/kernel/tsc_sync.c +9 -1
@@ -15,6 +15,7 @@* ( The serial nature of the boot logic and the CPU hotplug lock * protects against more than 2 CPUs entering this code. ) */ +#include <linux/workqueue.h> #include <linux/topology.h> #include <linux/spinlock.h> #include <linux/kernel.h>
@@ -342,6 +343,13 @@ static inline unsigned int loop_timeout(int cpu)return (cpumask_weight (topology_core_cpumask (cpu)) >1 ) ?2 :20 ; } +static void tsc_sync_mark_tsc_unstable (struct work_struct *work) +{ +mark_tsc_unstable ("check_tsc_sync_source failed" ); +} + +static DECLARE_WORK(tsc_sync_work, tsc_sync_mark_tsc_unstable); +/* * The freshly booted CPU initiates this via an async SMP function call. */
@@ -395,7 +403,7 @@ retry: "turning off TSC clock.\n", max_warp);if (random_warps)pr_warn ("TSC warped randomly between CPUs\n" ); -mark_tsc_unstable ("check_tsc_sync_source failed" ); +schedule_work (&tsc_sync_work); }/*
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 103/112 x86/i8259: Skip probing when ACPI/MADT advertises PCAT compatibility
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit 128b0c9781c9f2651bea163cb85e52a6c7be0f9e upstream.
David and a few others reported that on certain newer systems some legacy interrupts fail to work correctly.
Debugging revealed that the BIOS of these systems leaves the legacy PIC in uninitialized state which makes the PIC detection fail and the kernel switches to a dummy implementation.
Unfortunately this fallback causes quite some code to fail as it depends on checks for the number of legacy PIC interrupts or the availability of the real PIC.
In theory there is no reason to use the PIC on any modern system when IO/APIC is available, but the dependencies on the related checks cannot be resolved trivially and on short notice. This needs lots of analysis and rework.
The PIC detection has been added to avoid quirky checks and force selection of the dummy implementation all over the place, especially in VM guest scenarios. So it's not an option to revert the relevant commit as that would break a lot of other scenarios.
One solution would be to try to initialize the PIC on detection fail and retry the detection, but that puts the burden on everything which does not have a PIC.
Fortunately the ACPI/MADT table header has a flag field, which advertises in bit 0 that the system is PCAT compatible, which means it has a legacy 8259 PIC.
Evaluate that bit and if set avoid the detection routine and keep the real PIC installed, which then gets initialized (for nothing) and makes the rest of the code with all the dependencies work again.
--- arch/x86/include/asm/i8259.h | 2 ++ arch/x86/kernel/acpi/boot.c | 3 +++ arch/x86/kernel/i8259.c | 38 ++++++++++++++++++++++++++++++-------- 3 files changed, 35 insertions(+), 8 deletions(-)
arch/x86/include/asm/i8259.h +2 -0
@@ -69,6 +69,8 @@ struct legacy_pic {void (*make_irq)(unsigned int irq); }; +void legacy_pic_pcat_compat (void ); +extern struct legacy_pic *legacy_pic;extern struct legacy_pic null_legacy_pic;
arch/x86/kernel/acpi/boot.c +3 -0
@@ -148,6 +148,9 @@ static int __init acpi_parse_madt(structpr_debug ("Local APIC address 0x%08x\n" , madt->address); } +if (madt->flags &ACPI_MADT_PCAT_COMPAT ) +legacy_pic_pcat_compat (); +/* ACPI 6.3 and newer support the online capable bit. */ if (acpi_gbl_FADT.header.revision > 6 || (acpi_gbl_FADT.header.revision == 6 &&
arch/x86/kernel/i8259.c +30 -8
@@ -32,6 +32,7 @@*/ static void init_8259A (int auto_eoi); +static bool pcat_compat__ro_after_init ;static int i8259A_auto_eoi;DEFINE_RAW_SPINLOCK (i8259A_lock);
@@ -301,15 +302,32 @@ static void unmask_8259A(void)static int probe_8259A (void ) { +unsigned char new_val, probe_val = ~(1 <<PIC_CASCADE_IR );unsigned long flags; -unsigned char probe_val = ~(1 <<PIC_CASCADE_IR ); -unsigned char new_val; + +/* +* If MADT has the PCAT_COMPAT flag set, then do not bother probing +* for the PIC. Some BIOSes leave the PIC uninitialized and probing +* fails. +* +* Right now this causes problems as quite some code depends on +* nr_legacy_irqs() > 0 or has_legacy_pic() == true. This is silly +* when the system has an IO/APIC because then PIC is not required +* at all, except for really old machines where the timer interrupt +* must be routed through the PIC. So just pretend that the PIC is +* there and let legacy_pic->init() initialize it for nothing. +* +* Alternatively this could just try to initialize the PIC and +* repeat the probe, but for cases where there is no PIC that's +* just pointless. +*/ +if (pcat_compat) +return nr_legacy_irqs (); +/* -* Check to see if we have a PIC. -* Mask all except the cascade and read -* back the value we just wrote. If we don't -* have a PIC, we will read 0xff as opposed to the -* value we wrote. +* Check to see if we have a PIC. Mask all except the cascade and +* read back the value we just wrote. If we don't have a PIC, we +* will read 0xff as opposed to the value we wrote. */ raw_spin_lock_irqsave (&i8259A_lock, flags);
@@ -431,5 +449,9 @@ static int __init i8259A_init_ops(void)return 0 ; } -device_initcall (i8259A_init_ops); + +void __init legacy_pic_pcat_compat (void ) +{ + pcat_compat = true; +}
Greg Kroah-Hartman
maintainerPATCH 104/112 x86/cpu: Add model number for Intel Arrow Lake mobile processor
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Luck <[email protected]>
commit b99d70c0d1380f1368fd4a82271280c4fd28558b upstream.
For "reasons" Intel has code-named this CPU with a "_H" suffix.
[ dhansen: As usual, apply this and send it upstream quickly to
make it easier for anyone who is doing work that consumes this. ]
--- arch/x86/include/asm/intel-family.h | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/include/asm/intel-family.h +2 -0
@@ -27,6 +27,7 @@* _X - regular server parts * _D - micro server parts * _N,_P - other mobile parts +* _H - premium mobile parts * _S - other client parts * * Historical OPTDIFFs:
@@ -125,6 +126,7 @@#define INTEL_FAM6_LUNARLAKE_M 0xBD +#define INTEL_FAM6_ARROWLAKE_H 0xC5#define INTEL_FAM6_ARROWLAKE 0xC6/* "Small Core" Processors (Atom/E-Core) */
Greg Kroah-Hartman
maintainerPATCH 105/112 perf/core: Fix potential NULL deref
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit a71ef31485bb51b846e8db8b3a35e432cc15afb5 upstream.
Smatch is awesome.
--- kernel/events/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/events/core.c +2 -1
@@ -13383,7 +13383,8 @@ static int inherit_group(struct perf_eve !perf_get_aux_event(child_ctr, leader))return -EINVAL ; } - leader->group_generation = parent_event->group_generation; +if (leader) + leader->group_generation = parent_event->group_generation;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 106/112 sparc32: fix a braino in fault handling in csum_and_copy_..._user()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit 1f36cd05e0081f2c75769a551d584c4ffb2a5660 upstream.
Fault handler used to make non-trivial calls, so it needed to set a stack frame up. Used to be
save ... - grab a stack frame, old %o... become %i...
....
ret - go back to address originally in %o7, currently %i7
restore - switch to previous stack frame, in delay slot
Non-trivial calls had been gone since ab5e8b331244 and that code should have become
retl - go back to address in %o7
clr %o0 - have return value set to 0
What it had become instead was
ret - go back to address in %i7 - return address of *caller*
clr %o0 - have return value set to 0
which is not good, to put it mildly - we forcibly return 0 from csum_and_copy_{from,to}_iter() (which is what the call of that thing had been inlined into) and do that without dropping the stack frame of said csum_and_copy_..._iter(). Confuses the hell out of the caller of csum_and_copy_..._iter(), obviously...
--- arch/sparc/lib/checksum_32.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sparc/lib/checksum_32.S +1 -1
@@ -453,5 +453,5 @@ ccslow: cmp %g1, 0 * we only bother with faults on loads... */ cc_fault: - ret + retl clr %o0
Greg Kroah-Hartman
maintainerPATCH 107/112 clk: Sanitize possible_parent_show to Handle Return Value of of_clk_get_parent_name
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alessandro Carminati <[email protected]>
commit ceb87a361d0b079ecbc7d2831618c19087f304a9 upstream.
In the possible_parent_show function, ensure proper handling of the return value from of_clk_get_parent_name to prevent potential issues arising from a NULL return.
The current implementation invokes seq_puts directly on the result of of_clk_get_parent_name without verifying the return value, which can lead to kernel panic if the function returns NULL.
This patch addresses the concern by introducing a check on the return value of of_clk_get_parent_name. If the return value is not NULL, the function proceeds to call seq_puts, providing the returned value as argument.
However, if of_clk_get_parent_name returns NULL, the function provides a static string as argument, avoiding the panic.
--- drivers/clk/clk.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/clk/clk.c +12 -9
@@ -3416,6 +3416,7 @@ static void possible_parent_show(struct unsigned int i, char terminator) {struct clk_core *parent; +const char *name =NULL ;/* * Go through the following options to fetch a parent's name.
@@ -3430,18 +3431,20 @@ static void possible_parent_show(struct* registered (yet). */ parent =clk_core_get_parent_by_index (core, i); -if (parent) +if (parent) {seq_puts (s, parent->name); -else if (core->parents[i].name) + }else if (core->parents[i].name) {seq_puts (s, core->parents[i].name); -else if (core->parents[i].fw_name) + }else if (core->parents[i].fw_name) {seq_printf (s,"<%s>(fw)" , core->parents[i].fw_name); -else if (core->parents[i].index >=0 ) -seq_puts (s, -of_clk_get_parent_name (core->of_node, - core->parents[i].index)); -else -seq_puts (s,"(missing)" ); + }else { +if (core->parents[i].index >=0 ) + name =of_clk_get_parent_name (core->of_node, core->parents[i].index); +if (!name) + name ="(missing)" ; + +seq_puts (s, name); + }seq_putc (s, terminator); }
Greg Kroah-Hartman
maintainerPATCH 108/112 clk: socfpga: gate: Account for the divider in determine_rate
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Ripard <[email protected]>
commit 601cb6d573facde5fc88efa935b074da64ae63c9 upstream.
Commit 9607beb917df ("clk: socfpga: gate: Add a determine_rate hook") added a determine_rate implementation set to the clk_hw_determine_rate_no_reparent, but failed to account for the internal divider that wasn't used before anywhere but in recalc_rate.
This led to inconsistencies between the clock rate stored in clk_core->rate and the one returned by clk_round_rate() that leverages determine_rate().
Since that driver seems to be widely used (and thus regression-prone) and not supporting rate changes (since it's missing a .set_rate implementation), we can just report the current divider programmed in the clock but not try to change it in any way.
This should be good enough to fix the issues reported, and if someone ever wants to allow the divider to change then it should be easy enough using the clk-divider helpers.
--- drivers/clk/socfpga/clk-gate.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-)
drivers/clk/socfpga/clk-gate.c +23 -4
@@ -87,10 +87,8 @@ static int socfpga_clk_set_parent(struct clk_hw *hwclk, u8 parent)return 0 ; } -static unsigned long socfpga_clk_recalc_rate (struct clk_hw *hwclk, -unsigned long parent_rate) +static u32 socfpga_clk_get_div (struct socfpga_gate_clk *socfpgaclk) { -struct socfpga_gate_clk *socfpgaclk =to_socfpga_gate_clk (hwclk);u32 div =1 , val;if (socfpgaclk->fixed_div)
@@ -105,12 +103,33 @@ static unsigned long socfpga_clk_recalc_rate(struct clk_hw *hwclk, div = (1 << val); } +return div; +} + +static unsigned long socfpga_clk_recalc_rate (struct clk_hw *hwclk, +unsigned long parent_rate) +{ +struct socfpga_gate_clk *socfpgaclk =to_socfpga_gate_clk (hwclk); +u32 div =socfpga_clk_get_div (socfpgaclk); +return parent_rate / div; } + +static int socfpga_clk_determine_rate (struct clk_hw *hwclk, +struct clk_rate_request *req) +{ +struct socfpga_gate_clk *socfpgaclk =to_socfpga_gate_clk (hwclk); +u32 div =socfpga_clk_get_div (socfpgaclk); + + req->rate = req->best_parent_rate / div; + +return 0 ; +} +static struct clk_ops gateclk_ops = { .recalc_rate = socfpga_clk_recalc_rate, - .determine_rate = clk_hw_determine_rate_no_reparent, + .determine_rate = socfpga_clk_determine_rate, .get_parent = socfpga_clk_get_parent, .set_parent = socfpga_clk_set_parent, };
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 109/112 clk: stm32: Fix a signedness issue in clk_stm32_composite_determine_rate()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 790437bbe0ef7e5cb5d091dd711c0d61d03945a5 upstream.
The divider_ro_round_rate() function could potentially return -EINVAL on error but the error handling doesn't work because "rate" is unsigned. It should be a type long.
--- drivers/clk/stm32/clk-stm32-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/stm32/clk-stm32-core.c +1 -1
@@ -431,7 +431,7 @@ static int clk_stm32_composite_determine_rate(struct clk_hw *hw, {struct clk_stm32_composite *composite =to_clk_stm32_composite (hw);const struct stm32_div_cfg *divider; -unsigned long rate; +long rate;if (composite->div_id ==NO_STM32_DIV )return 0 ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 110/112 platform/x86: Add s2idle quirk for more Lenovo laptops
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Lazar <[email protected]>
[ Upstream commit 3bde7ec13c971445faade32172cb0b4370b841d9 ]
When suspending to idle and resuming on some Lenovo laptops using the Mendocino APU, multiple NVME IOMMU page faults occur, showing up in dmesg as repeated errors:
nvme 0000:01:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x000b address=0xb6674000 flags=0x0000]
The system is unstable afterwards.
Applying the s2idle quirk introduced by commit 455cd867b85b ("platform/x86:thinkpad_acpi: Add a s2idle resume quirk for a number of laptops") allows these systems to work with the IOMMU enabled and s2idle resume to work.
--- drivers/platform/x86/amd/pmc-quirks.c | 73 ++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+)
drivers/platform/x86/amd/pmc-quirks.c +73 -0
@@ -111,6 +111,79 @@ static const struct dmi_system_id fwbug_ DMI_MATCH(DMI_PRODUCT_NAME, "21A1"), } }, +/* https://bugzilla.kernel.org/show_bug.cgi?id=218024 */ + { + .ident = "V14 G4 AMN", + .driver_data = &quirk_s2idle_bug, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "82YT"), + } + }, + { + .ident ="V14 G4 AMN" , + .driver_data = &quirk_s2idle_bug, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "83GE"), + } + }, + { + .ident ="V15 G4 AMN" , + .driver_data = &quirk_s2idle_bug, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "82YU"), + } + }, + { + .ident ="V15 G4 AMN" , + .driver_data = &quirk_s2idle_bug, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "83CQ"), + } + }, + { + .ident ="IdeaPad 1 14AMN7" , + .driver_data = &quirk_s2idle_bug, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "82VF"), + } + }, + { + .ident ="IdeaPad 1 15AMN7" , + .driver_data = &quirk_s2idle_bug, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "82VG"), + } + }, + { + .ident ="IdeaPad 1 15AMN7" , + .driver_data = &quirk_s2idle_bug, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "82X5"), + } + }, + { + .ident ="IdeaPad Slim 3 14AMN8" , + .driver_data = &quirk_s2idle_bug, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "82XN"), + } + }, + { + .ident ="IdeaPad Slim 3 15AMN8" , + .driver_data = &quirk_s2idle_bug, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "82XQ"), + } + }, /* https://gitlab.freedesktop.org/drm/amd/-/issues/2684 */ { .ident = "HP Laptop 15s-eq2xxx",
Greg Kroah-Hartman
maintainerPATCH 111/112 mm/damon/sysfs: check DAMOS regions update progress from before_terminate()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 76b7069bcc89dec33f03eb08abee165d0306b754 upstream.
DAMON_SYSFS can receive DAMOS tried regions update request while kdamond is already out of the main loop and before_terminate callback (damon_sysfs_before_terminate() in this case) is not yet called. And damon_sysfs_handle_cmd() can further be finished before the callback is invoked. Then, damon_sysfs_before_terminate() unlocks damon_sysfs_lock, which is not locked by anyone. This happens because the callback function assumes damon_sysfs_cmd_request_callback() should be called before it. Check if the assumption was true before doing the unlock, to avoid this problem.
--- mm/damon/sysfs.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
mm/damon/sysfs.c +5 -2
@@ -1202,6 +1202,8 @@ static int damon_sysfs_set_targets(strucreturn 0 ; } +static bool damon_sysfs_schemes_regions_updating; +static void damon_sysfs_before_terminate (struct damon_ctx *ctx) {struct damon_target *t, *next;
@@ -1209,10 +1211,12 @@ static void damon_sysfs_before_terminate/* damon_sysfs_schemes_update_regions_stop() might not yet called */ kdamond = damon_sysfs_cmd_request.kdamond; -if (kdamond && damon_sysfs_cmd_request.cmd == +if (kdamond && (damon_sysfs_cmd_request.cmd ==DAMON_SYSFS_CMD_UPDATE_SCHEMES_TRIED_REGIONS && + damon_sysfs_schemes_regions_updating) && ctx == kdamond->damon_ctx) {damon_sysfs_schemes_update_regions_stop (ctx); + damon_sysfs_schemes_regions_updating = false;mutex_unlock (&damon_sysfs_lock); }
@@ -1331,7 +1335,6 @@ static int damon_sysfs_commit_input(strustatic int damon_sysfs_cmd_request_callback (struct damon_ctx *c) {struct damon_sysfs_kdamond *kdamond; -static bool damon_sysfs_schemes_regions_updating;int err =0 ;/* avoid deadlock due to concurrent state_store('off') */
Greg Kroah-Hartman
maintainerPATCH 112/112 accel/ivpu/37xx: Fix missing VPUIP interrupts
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karol Wachowski <[email protected]>
commit b132ac51d7a50c37683be56c96ff64f8c887930f upstream.
Move sequence of masking and unmasking global interrupts from buttress interrupt handler to generic one that handles both VPUIP and BTRS interrupts. Unmasking global interrupts will re-trigger MSI for any pending interrupts.
Lack of this sequence will cause the driver to miss any VPUIP interrupt that comes after reading VPU_37XX_HOST_SS_ICB_STATUS_0 and before clearing all active interrupt sources.
--- drivers/accel/ivpu/ivpu_hw_mtl.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/accel/ivpu/ivpu_hw_mtl.c +5 -6
@@ -953,9 +953,6 @@ static u32 ivpu_hw_mtl_irqb_handler(struif (status ==0 )return 0 ; -/* Disable global interrupt before handling local buttress interrupts */ -REGB_WR32 (MTL_BUTTRESS_GLOBAL_INT_MASK ,0x1 ); -if (REG_TEST_FLD (MTL_BUTTRESS_INTERRUPT_STAT ,FREQ_CHANGE , status))ivpu_dbg (vdev,IRQ ,"FREQ_CHANGE irq: %08x" ,REGB_RD32 (MTL_BUTTRESS_CURRENT_PLL ));
@@ -986,9 +983,6 @@ static u32 ivpu_hw_mtl_irqb_handler(struelse REGB_WR32 (MTL_BUTTRESS_INTERRUPT_STAT , status); -/* Re-enable global interrupt */ -REGB_WR32 (MTL_BUTTRESS_GLOBAL_INT_MASK ,0x0 ); -if (schedule_recovery)ivpu_pm_schedule_recovery (vdev);
@@ -1000,9 +994,14 @@ static irqreturn_t ivpu_hw_mtl_irq_handlstruct ivpu_device *vdev = ptr;u32 ret_irqv, ret_irqb; +REGB_WR32 (MTL_BUTTRESS_GLOBAL_INT_MASK ,0x1 ); + ret_irqv =ivpu_hw_mtl_irqv_handler (vdev, irq); ret_irqb =ivpu_hw_mtl_irqb_handler (vdev, irq); +/* Re-enable global interrupts to re-trigger MSI for pending interrupts */ +REGB_WR32 (MTL_BUTTRESS_GLOBAL_INT_MASK ,0x0 ); +return IRQ_RETVAL (ret_irqb | ret_irqv); }
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.10 release. There are 112 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, 02 Nov 2023 16:58:38 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.5.10-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.5.y
and the diffstat can be found below.thanks,
greg k-h
The build fails on RISC-V.
arch/riscv/mm/hugetlbpage.c: In function ‘set_huge_pte_at’:arch/riscv/mm/hugetlbpage.c:188:13: error: ‘sz’ undeclared (first use in this function); did you mean ‘s8’? 188 | if (sz >= PGDIR_SIZE)
| ^~
| s8arch/riscv/mm/hugetlbpage.c:188:13: note: each undeclared identifier is reported only once for each function it appears in
Caused by commit 16b6f77970f7a690c61de142511c9ac488d83e04
riscv: fix set_huge_pte_at() for NAPOT mappings when a swap entry is set
This patch requires mainline commit 62ba41d2761206664a1fdc998051324457da2dd6
mm: riscv: fix an unsafe pte read in huge_pte_alloc()
Quoted 28 lines · Ron Economos
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.10 release. There are 112 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, 02 Nov 2023 16:58:38 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.5.10-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.5.y
and the diffstat can be found below.thanks,
greg k-h
The build fails on RISC-V.
arch/riscv/mm/hugetlbpage.c: In function ‘set_huge_pte_at’:arch/riscv/mm/hugetlbpage.c:188:13: error: ‘sz’ undeclared (first use in this function); did you mean ‘s8’?188 | if (sz >= PGDIR_SIZE) | ^~ | s8
Quoted 6 lines
arch/riscv/mm/hugetlbpage.c:188:13: note: each undeclared identifier is reported only once for each function it appears inCaused by commit
16b6f77970f7a690c61de142511c9ac488d83e04riscv: fix
set_huge_pte_at()for NAPOT mappings when a swap entry is set
The above build error was also noticed in our CI system.
Quoted 4 lines
This patch requires mainline commit
62ba41d2761206664a1fdc998051324457da2dd6mm: riscv: fix an unsafe pte read in
huge_pte_alloc()
Following riscv builds failed as other reported.
riscv:
* build/clang-nightly-defconfig
* build/clang-17-lkftconfig
* build/clang-17-defconfig
* build/gcc-13-defconfig
* build/gcc-13-lkftconfig
* build/gcc-8-defconfig
--
Linaro LKFT
https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 30 lines · Ron Economos
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.10 release. There are 112 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, 02 Nov 2023 16:58:38 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.5.10-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.5.y
and the diffstat can be found below.thanks,
greg k-h
The build fails on RISC-V.
arch/riscv/mm/hugetlbpage.c: In function ‘set_huge_pte_at’:arch/riscv/mm/hugetlbpage.c:188:13: error: ‘sz’ undeclared (first use in this function); did you mean ‘s8’?
188 | if (sz >=PGDIR_SIZE)
| ^~
| s8arch/riscv/mm/hugetlbpage.c:188:13: note: each undeclared identifier is reported only once for each function it appears in
Quoted 7 lines
Caused by commit
16b6f77970f7a690c61de142511c9ac488d83e04riscv: fix
set_huge_pte_at()for NAPOT mappings when a swap entry is setThis patch requires mainline commit
62ba41d2761206664a1fdc998051324457da2dd6mm: riscv: fix an unsafe pte read in
huge_pte_alloc()
Thanks, I'll just drop this commit and wait for someone who cares about riscv, and 6.5.y (it's only going to be alive for another few weeks), to resend the needed changes.
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.10 release. There are 112 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, 02 Nov 2023 16:58:38 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.5.10-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.5.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.10 release. There are 112 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, 02 Nov 2023 16:58:38 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.5.10-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.5.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.10 release. There are 112 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, 02 Nov 2023 16:58:38 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.5.10-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.5.y
and the diffstat can be found below.thanks,
greg k-h
Tested rc1 against the Fedora build system (aarch64, ppc64le, s390x, x86_64), and boot tested x86_64. No regressions noted.
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.10 release. There are 112 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.
Successfully compiled and installed bindeb-pkgs on my computer (Acer Aspire E15, Intel Core i3 Haswell). No noticeable regressions.
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.10 release. There are 112 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, 02 Nov 2023 16:58:38 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.5.10-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.5.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v6.5:
10 builds: 10 pass, 0 fail
26 boots: 26 pass, 0 fail
102 tests: 102 pass, 0 failLinux version: 6.5.10-rc1-g43ad4fdc1845
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Jon
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.10 release. There are 112 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, 02 Nov 2023 16:58:38 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.5.10-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.5.y
and the diffstat can be found below.thanks,
greg k-h
No regressions to report on my system.
[ 0.000000] Linux version 6.5.10-rc1+ (rbmarliere@debian) (Debian clang version 16.0.6 (16), GNU ld (GNU Binutils for Debian) 2.41) #10 SMP PREEMPT_DYNAMIC Wed Nov 1 08:08:55 -03 2023
Thank you,
- Ricardo