Skip to contentSkip to conversation

6.4.4-rc1 review

PATCH In review Greg Kroah-Hartman 12 participants 827 messages Jul 16, 2023 – Jul 24, 2023 Page 1 of 7

Subsystems (13)
lore
Share & tools
lore

Greg Kroah-Hartman

author maintainer
#0 lore raw

cover 6.4.4-rc1 review

This is the start of the stable review cycle for the 6.4.4 release. There are 800 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Tue, 18 Jul 2023 19:48:07 +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.4.4-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.4.y
and the diffstat can be found below.

thanks,

greg k-h

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

Greg Kroah-Hartman <[email protected]>

    Linux 6.4.4-rc1

Andres Freund <[email protected]>
io_uring: Use io_schedule* in cqring wait

Sherry Sun <[email protected]>
tty: serial: fsl_lpuart: add earlycon for imx8ulp platform

Jason A. Donenfeld <[email protected]>
wireguard: netlink: send staged packets when setting initial private key

Jason A. Donenfeld <[email protected]>
wireguard: queueing: use saner cpu selection wrapping

Thadeu Lima de Souza Cascardo <[email protected]>
netfilter: nf_tables: prevent OOB access in nft_byteorder_eval

Thadeu Lima de Souza Cascardo <[email protected]>
netfilter: nf_tables: do not ignore genmask when looking up chain by id

Florent Revest <[email protected]>
netfilter: conntrack: Avoid nf_ct_helper_hash uses after free

Tao Zhou <[email protected]>
drm/amdgpu: check RAS irq existence for VCN/JPEG

Kenneth Feng <[email protected]>
drm/amd/pm: add abnormal fan detection for smu 13.0.0

Alex Deucher <[email protected]>
drm/amdgpu/sdma4: set align mask to 255

Evan Quan <[email protected]>
drm/amd/pm: revise the ASPM settings for thunderbolt attached scenario

Jiadong Zhu <[email protected]>
drm/amdgpu: Skip mark offset for high priority rings

Christian König <[email protected]>
drm/amdgpu: make sure that BOs have a backing store

Christian König <[email protected]>
drm/amdgpu: make sure BOs are locked in amdgpu_vm_get_memory

WANG Xuerui <[email protected]>
LoongArch: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation

Zhihao Cheng <[email protected]>
ovl: fix null pointer dereference in ovl_get_acl_rcu()

Zhihao Cheng <[email protected]>
ovl: let helper ovl_i_path_real() return the realinode

Zhihao Cheng <[email protected]>
ovl: fix null pointer dereference in ovl_permission()

Masahiro Yamada <[email protected]>

    kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS

Nathan Chancellor <[email protected]>
kbuild: Add KBUILD_CPPFLAGS to as-option invocation

Nathan Chancellor <[email protected]>
kbuild: Add CLANG_FLAGS to as-instr

Nathan Chancellor <[email protected]>
powerpc/vdso: Include CLANG_FLAGS explicitly in ldflags-y

Nathan Chancellor <[email protected]>
mips: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation

Arnd Bergmann <[email protected]>
Input: ads7846 - fix pointer cast warning

Jan Kara <[email protected]>
fs: no need to check source

Yu Kuai <[email protected]>
md/raid1-10: fix casting from randomized structure in raid1_submit_write()

Linus Walleij <[email protected]>
Input: ads7846 - Fix usage of match data

Yu Kuai <[email protected]>
blktrace: use inline function for blk_trace_remove() while blktrace is disabled

Christian Marangi <[email protected]>
leds: trigger: netdev: Recheck NETDEV_LED_MODE_LINKUP on dev rename

Arnd Bergmann <[email protected]>
ARM: orion5x: fix d2net gpio initialization

Krzysztof Kozlowski <[email protected]>
ARM: dts: qcom: ipq4019: fix broken NAND controller properties override

Linus Walleij <[email protected]>
ARM: dts: qcom: msm8660: Fix regulator node names

Krzysztof Kozlowski <[email protected]>
regulator: tps65219: Fix matching interrupts for their regulators

Ricardo Ribalda Delgado <[email protected]>
ASoC: mediatek: mt8173: Fix snd_soc_component_initialize error path

Ricardo Ribalda Delgado <[email protected]>
ASoC: mediatek: mt8173: Fix irq error path

Filipe Manana <[email protected]>
btrfs: do not BUG_ON() on tree mod log failure at __btrfs_cow_block()

Filipe Manana <[email protected]>
btrfs: fix extent buffer leak after tree mod log failure at split_node()

Filipe Manana <[email protected]>
btrfs: add missing error handling when logging operation while COWing extent buffer

Filipe Manana <[email protected]>
btrfs: fix race when deleting quota root from the dirty cow roots list

Naohiro Aota <[email protected]>
btrfs: move out now unused BG from the reclaim list

Naohiro Aota <[email protected]>
btrfs: reinsert BGs failed to reclaim

David Sterba <[email protected]>
btrfs: add block-group tree to lockdep classes

Naohiro Aota <[email protected]>
btrfs: bail out reclaim process if filesystem is read-only

Naohiro Aota <[email protected]>
btrfs: delete unused BGs while reclaiming BGs

Boris Burkov <[email protected]>
btrfs: warn on invalid slot in tree mod log rewind

Boris Burkov <[email protected]>
btrfs: insert tree mod log move in push_node_left

Christoph Hellwig <[email protected]>
btrfs: fix dirty_metadata_bytes for redirtied buffers

Matt Corallo <[email protected]>
btrfs: add handling for RAID1C23/DUP to btrfs_reduce_alloc_profile

Abhijeet Rastogi <[email protected]>
ipvs: increase ip_vs_conn_tab_bits range for 64BIT

Mario Limonciello <[email protected]>
usb: typec: ucsi: Mark dGPUs as DEVICE scope

Jan Kara <[email protected]>
fs: Lock moved directories

Jan Kara <[email protected]>
fs: Establish locking order for unrelated directories

Jan Kara <[email protected]>
Revert "udf: Protect rename against modification of moved directory"

Jan Kara <[email protected]>
Revert "f2fs: fix potential corruption when moving a directory"

Jan Kara <[email protected]>
ext4: Remove ext4 locking of moved directory

Thomas Weißschuh <[email protected]>
fs: avoid empty option when generating legacy mount string

Fabian Frederick <[email protected]>
jffs2: reduce stack usage in jffs2_build_xattr_subsystem()

Christian Brauner <[email protected]>
nfsd: use vfs setgid helper

Roberto Sassu <[email protected]>
shmem: use ramfs_kill_sb() for kill_sb method of ramfs-based tmpfs

Ryan Roberts <[email protected]>
mm/damon/ops-common: atomically test and clear young on ptes and pmds

Arnd Bergmann <[email protected]>
autofs: use flexible array in ioctl structure

Tianjia Zhang <[email protected]>
integrity: Fix possible multiple allocation in integrity_inode_get()

Kees Cook <[email protected]>
um: Use HOST_DIR for mrproper

Siddh Raman Pant <[email protected]>
watch_queue: prevent dangling pipe pointer

Zheng Wang <[email protected]>
bcache: Fix __bch_btree_node_alloc to make the failure behavior consistent

Zheng Wang <[email protected]>
bcache: Remove unnecessary NULL point check in node allocations

Mingzhe Zou <[email protected]>
bcache: fixup btree_cache_wait list damage

Quan Zhou <[email protected]>
wifi: mt76: mt7921e: fix init command fail with enabled device

Felix Fietkau <[email protected]>
wifi: cfg80211: fix receiving mesh packets without RFC1042 header

Alexander Wetzel <[email protected]>
wifi: ath10k: Serialize wake_tx_queue ops

Johannes Berg <[email protected]>
wifi: cfg80211: fix regulatory disconnect for non-MLO

Chevron Li <[email protected]>
mmc: sdhci: fix DMA configure compatibility issue when 64bit DMA mode is used.

Ulf Hansson <[email protected]>
mmc: mmci: Set PROBE_PREFER_ASYNCHRONOUS

Robert Marko <[email protected]>
mmc: core: disable TRIM on Micron MTFC4GACAJCN-1M

Robert Marko <[email protected]>
mmc: core: disable TRIM on Kingston EMMC04G-M627

Yu Zhao <[email protected]>

    mm/mglru: make memcg_lru->lock irq safe

Jens Axboe <[email protected]>
io_uring: wait interruptibly for request completions on exit

Jianmin Lv <[email protected]>
irqchip/loongson-pch-pic: Fix initialization of HT vector register

Dai Ngo <[email protected]>
NFSD: add encoding of op_recall flag for write delegation

Liu Peibao <[email protected]>
irqchip/loongson-pch-pic: Fix potential incorrect hwirq assignment

Jeff Layton <[email protected]>
nfsd: move init of percpu reply_cache_stats counters back to nfsd_init_net

Jianmin Lv <[email protected]>
irqchip/loongson-liointc: Fix IRQ trigger polarity

Mark Brown <[email protected]>
arm64/signal: Restore TPIDR2 register rather than memory state

Daniel Miess <[email protected]>
Revert "drm/amd/display: Move DCN314 DOMAIN power control to DMCUB"

Geert Uytterhoeven <[email protected]>
lib: dhry: fix sleeping allocations inside non-preemptable section

Matthew Wilcox (Oracle) <[email protected]>
writeback: account the number of pages written back

Robert Hancock <[email protected]>
i2c: xiic: Don't try to handle more interrupt events after error

John Johansen <[email protected]>
apparmor: fix profile verification and enable it

John Johansen <[email protected]>
apparmor: fix policy_compat permission remap with extended permissions

John Johansen <[email protected]>
apparmor: add missing failure check in compute_xmatch_perms

Danila Chernetsov <[email protected]>
apparmor: fix missing error check for rhashtable_insert_fast

Artur Rojek <[email protected]>
sh: dma: Fix DMA channel offset calculation

Marc Zyngier <[email protected]>
risc-v: Fix order of IPI enablement vs RCU startup

Thorsten Winkler <[email protected]>
s390/qeth: Fix vipa deletion

David Howells <[email protected]>
afs: Fix accidental truncation when storing data

Hariprasad Kelam <[email protected]>
octeontx-af: fix hardware timestamp configuration

Vladimir Oltean <[email protected]>
net: dsa: sja1105: always enable the send_meta options

Vladimir Oltean <[email protected]>
net: dsa: tag_sja1105: fix MAC DA patching from meta frames

Guillaume Nault <[email protected]>
pptp: Fix fib lookup calls.

Woody Zhang <[email protected]>
riscv: move memblock_allow_resize() after linear mapping is ready

Amir Goldstein <[email protected]>
fanotify: disallow mount/sb marks on kernel internal pseudo fs

Ville Syrjälä <[email protected]>
drm/i915/psr: Fix BDW PSR AUX CH data register offsets

Lin Ma <[email protected]>
net/sched: act_pedit: Add size check for TCA_PEDIT_PARMS_EX

Ilya Maximets <[email protected]>
xsk: Honor SO_BINDTODEVICE on bind

SeongJae Park <[email protected]>
bpf, btf: Warn but return no error for NULL btf from __register_btf_kfunc_id_set()

Maxime Coquelin <[email protected]>
vduse: fix NULL pointer dereference

Eric Dumazet <[email protected]>
tcp: annotate data races in __tcp_oow_rate_limited()

Eric Dumazet <[email protected]>
net: fix net_dev_start_xmit trace event vs skb_transport_offset()

Vladimir Oltean <[email protected]>
net: dsa: tag_sja1105: fix source port decoding in vlan_filtering=0 bridge mode

Vladimir Oltean <[email protected]>
net: bridge: keep ports without IFF_UNICAST_FLT in BR_PROMISC mode

Pali Rohár <[email protected]>
powerpc: dts: turris1x.dts: Fix PCIe MEM size for pci2 node

Randy Dunlap <[email protected]>
powerpc: allow PPC_EARLY_DEBUG_CPM only when SERIAL_CPM=y

Zeng Heng <[email protected]>
ntfs: Fix panic about slab-out-of-bounds caused by ntfs_listxattr()

Hariprasad Kelam <[email protected]>
octeontx2-af: Reset MAC features in FLR

Hariprasad Kelam <[email protected]>
octeontx2-af: Add validation before accessing cgx and lmac

Hariprasad Kelam <[email protected]>
octeontx2-af: Fix mapping for NIX block from CGX connection

Hariprasad Kelam <[email protected]>
octeontx2-af: cn10kb: fix interrupt csr addresses

Chao Yu <[email protected]>
f2fs: fix error path handling in truncate_dnode()

Nishanth Menon <[email protected]>

    mailbox: ti-msgmgr: Fill non-message tx data fields with 0x0

Mario Limonciello <[email protected]>
drm/amd: Don't try to enable secure display TA multiple times

Christian König <[email protected]>
drm/amdgpu: fix number of fence calculations

Jonas Gorski <[email protected]>
spi: bcm-qspi: return error if neither hif_mspi nor mspi is available

Zhengchao Shao <[email protected]>
mlxsw: minimal: fix potential memory leak in mlxsw_m_linecards_init

Pawel Dembicki <[email protected]>
net: dsa: vsc73xx: fix MTU configuration

Nick Child <[email protected]>
ibmvnic: Do not reset dql stats on NON_FATAL err

Martin Habets <[email protected]>
sfc: support for devlink port requires MAE access

Luiz Augusto von Dentz <[email protected]>
Bluetooth: MGMT: Fix marking SCAN_RSP as not connectable

Pauli Virtanen <[email protected]>
Bluetooth: ISO: use hci_sync for setting CIG parameters

Johan Hovold <[email protected]>
Bluetooth: fix invalid-bdaddr quirk for non-persistent setup

Tobias Heider <[email protected]>
Add MODULE_FIRMWARE() for FIRMWARE_TG357766.

Vladimir Oltean <[email protected]>
net: dsa: tag_sja1105: always prefer source port information from INCL_SRCPT

Vladimir Oltean <[email protected]>
net: dsa: sja1105: always enable the INCL_SRCPT option

Vladimir Oltean <[email protected]>
net: dsa: felix: don't drop PTP frames with tag_8021q when RX timestamping is disabled

Vladimir Oltean <[email protected]>
net: mscc: ocelot: don't keep PTP configuration of all ports in single structure

Vladimir Oltean <[email protected]>
net: mscc: ocelot: don't report that RX timestamping is enabled by default

Dmitry Baryshkov <[email protected]>
spi: spi-geni-qcom: enable SPI_CONTROLLER_MUST_TX for GPI DMA mode

Florian Westphal <[email protected]>

    net/sched: act_ipt: zero skb->cb before calling target

Florian Westphal <[email protected]>
net/sched: act_ipt: add sanity checks on skb before calling target

Florian Westphal <[email protected]>
net/sched: act_ipt: add sanity checks on table name and hook locations

Chengfeng Ye <[email protected]>

    sctp: fix potential deadlock on &net->sctp.addr_wq_lock

Randy Dunlap <[email protected]>
media: cec: i2c: ch7322: also select REGMAP

Arnd Bergmann <[email protected]>
media: tc358746: select CONFIG_GENERIC_PHY

Peng Fan <[email protected]>
tools/virtio: fix build break for aarch64

Dragos Tatulea <[email protected]>
virtio-vdpa: Fix unchecked call to NULL set_vq_affinity

Chao Yu <[email protected]>
f2fs: check return value of freeze_super()

Vinay Belgaumkar <[email protected]>
drm/i915/guc/slpc: Apply min softlimit correctly

Jouni Högander <[email protected]>
drm/i915/psr: Use hw.adjusted mode when calculating io/fast wake times

Christophe JAILLET <[email protected]>
rtc: st-lpc: Release some resources in st_rtc_probe() in case of error

Jinke Han <[email protected]>
blk-throttle: Fix io statistics for cgroup v1

Ian Rogers <[email protected]>
perf bpf: Move the declaration of struct rq

Li Nan <[email protected]>
md/raid10: fix the condition to call bio_end_io_acct()

Shuijing Li <[email protected]>
pwm: mtk_disp: Fix the disable flow of disp_pwm

Dan Carpenter <[email protected]>
pwm: ab8500: Fix error code in probe()

Marek Vasut <[email protected]>
pwm: sysfs: Do not apply state to already disabled PWMs

Fancy Fang <[email protected]>
pwm: imx-tpm: force 'real_period' to be zero in suspend

Yury Norov <[email protected]>
lib/bitmap: drop optimization of bitmap_{from,to}_arr64

Claudiu Beznea <[email protected]>
phy: tegra: xusb: check return value of devm_kzalloc()

Christophe JAILLET <[email protected]>
mfd: stmpe: Only disable the regulators if they are enabled

Neil Armstrong <[email protected]>
phy: qcom: qmp-combo: fix Display Port PHY configuration for SM8550

Yicong Yang <[email protected]>
hwtracing: hisi_ptt: Fix potential sleep in atomic context

Dmitry Baryshkov <[email protected]>
clk: qcom: mmcc-msm8974: fix MDSS_GDSC power flags

Claudiu Beznea <[email protected]>
misc: fastrpc: check return value of devm_kasprintf()

Daniel Golle <[email protected]>
cpufreq: mediatek: correct voltages for MT7622 and MT7623

Christian Borntraeger <[email protected]>
KVM: s390/diag: fix racy access of physical cpu number in diag 9c handler

Pierre Morel <[email protected]>
KVM: s390: vsie: fix the length of APCB bitmap

Amelie Delaunay <[email protected]>

    mfd: stmfx: Nullify stmfx->vdd in case of error

Amelie Delaunay <[email protected]>
mfd: stmfx: Fix error path in stmfx_chip_init

Laurentiu Tudor <[email protected]>
bus: fsl-mc: don't assume child devices are all fsl-mc devices

Phil Elwell <[email protected]>
nvmem: rmem: Use NVMEM_DEVID_AUTO

Mirsad Goran Todorovac <[email protected]>
test_firmware: return ENOMEM instead of ENOSPC on failed memory allocation

Alexander Stein <[email protected]>
nvmem: imx-ocotp: Reverse MAC addresses on all i.MX derivates

Yi Yingao <[email protected]>

    nvmem: sunplus-ocotp: release otp->clk before return

Nipun Gupta <[email protected]>
cdx: fix driver managed dma support

Matti Vaittinen <[email protected]>
drivers: fwnode: fix fwnode_irq_get[_byname]()

Tony Lindgren <[email protected]>
serial: 8250_omap: Use force_suspend and resume for system suspend

Greg Kroah-Hartman <[email protected]>
Revert "usb: common: usb-conn-gpio: Set last role to unknown before initial detection"

Jiasheng Jiang <[email protected]>
mfd: intel-lpss: Add missing check for platform_get_resource

Christophe JAILLET <[email protected]>
mfd: wcd934x: Fix an error handling path in wcd934x_slim_probe()

Daniel Bristot de Oliveira <[email protected]>
rtla/hwnoise: Reduce runtime to 75%

Christophe JAILLET <[email protected]>
usb: dwc3-meson-g12a: Fix an error handling path in dwc3_meson_g12a_probe()

Prashanth K <[email protected]>
usb: common: usb-conn-gpio: Set last role to unknown before initial detection

Christophe JAILLET <[email protected]>
usb: dwc3: qcom: Fix an error handling path in dwc3_qcom_probe()

Christophe JAILLET <[email protected]>
usb: dwc3: qcom: Release the correct resources in dwc3_qcom_remove()

Nico Boehr <[email protected]>
KVM: s390: fix KVM_S390_GET_CMMA_BITS for GFNs in memslot holes

Chao Yu <[email protected]>
f2fs: flush error flags in workqueue

Jaegeuk Kim <[email protected]>
f2fs: fix the wrong condition to determine atomic context

Chao Yu <[email protected]>
f2fs: support errors=remount-ro|continue|panic mountoption

Chao Yu <[email protected]>
f2fs: fix to avoid NULL pointer dereference f2fs_write_end_io()

Chao Yu <[email protected]>
f2fs: fix potential deadlock due to unpaired node_write lock use

Bob Peterson <[email protected]>
gfs2: Fix duplicate should_fault_in_pages() call

Sergey Shtylyov <[email protected]>
sh: Avoid using IRQ0 on SH3 and SH4

Hans de Goede <[email protected]>
media: atomisp: ov2680: Stop using half pixelclock for binned modes

Dan Carpenter <[email protected]>
media: atomisp: gmin_platform: fix out_len in gmin_get_config_dsm_var()

Hans de Goede <[email protected]>
media: atomisp: gc0310: Fix double free in gc0310_remove()

Rikard Falkeborn <[email protected]>
media: venus: helpers: Fix ALIGN() of non power of two

Stephan Gerhold <[email protected]>

    mfd: rt5033: Drop rt5033-battery sub-device

ChiYuan Huang <[email protected]>
power: supply: rt9467: Make charger-enable control as logic level

Mike Leach <[email protected]>
coresight: etm4x: Fix missing trctraceidr file in sysfs

James Clark <[email protected]>
coresight: Fix loss of connection info when a module is unloaded

Clark Wang <[email protected]>
i3c: master: svc: fix cpu schedule in spin lock

Yue Zhao <[email protected]>
lkdtm: replace ll_rw_block with submit_bh

Muchun Song <[email protected]>
kernfs: fix missing kernfs_idr_lock to remove an ID from the IDR

John Ogness <[email protected]>
serial: 8250: lock port for UART_IER access in omap8250_irq()

John Ogness <[email protected]>
serial: core: lock port for start_rx() in uart_resume_port()

John Ogness <[email protected]>

    serial: 8250: lock port for stop_rx() in omap8250_irq()

John Ogness <[email protected]>
serial: core: lock port for stop_rx() in uart_suspend_port()

Bhupesh Sharma <[email protected]>
usb: misc: eud: Fix eud sysfs path (use 'qcom_eud')

Arnd Bergmann <[email protected]>
usb: hide unused usbfs_notify_suspend/resume functions

Li Yang <[email protected]>
usb: phy: phy-tahvo: fix memory leak in tahvo_usb_probe()

Andy Shevchenko <[email protected]>
extcon: Fix kernel doc of property capability fields to avoid warnings

Andy Shevchenko <[email protected]>
extcon: Fix kernel doc of property fields to avoid warnings

Prashanth K <[email protected]>
usb: gadget: u_serial: Add null pointer check in gserial_suspend

Vladislav Efanov <[email protected]>
usb: dwc3: qcom: Fix potential memory leak

Krzysztof Kozlowski <[email protected]>
soundwire: debugfs: fix unbalanced pm_runtime_put()

Krzysztof Kozlowski <[email protected]>
soundwire: qcom: fix unbalanced pm_runtime_put()

Krzysztof Kozlowski <[email protected]>
soundwire: qcom: use consistently 'ctrl' as state variable name

Arnd Bergmann <[email protected]>
staging: vchiq_arm: mark vchiq_platform_init() static

Dmitry Baryshkov <[email protected]>
clk: qcom: mmcc-msm8974: use clk_rcg2_shared_ops for mdp_clk_src clock

Kathiravan T <[email protected]>
clk: qcom: ipq5332: fix the order of SLEEP_CLK and XO clock

Kathiravan T <[email protected]>
clk: qcom: ipq5332: fix the src parameter in ftbl_gcc_apss_axi_clk_src

Konrad Dybcio <[email protected]>
clk: qcom: dispcc-qcm2290: Fix GPLL0_OUT_DIV handling

Konrad Dybcio <[email protected]>
clk: qcom: dispcc-qcm2290: Fix BI_TCXO_AO handling

Robert Marko <[email protected]>
clk: qcom: ipq6018: fix networking resets

Yunfei Dong <[email protected]>
media: mediatek: vcodec: using decoder status instead of core work count

Martin Kepplinger <[email protected]>
media: hi846: fix usage of pm_runtime_get_if_in_use()

Geert Uytterhoeven <[email protected]>
media: renesas: fdp1: Identify R-Car Gen2 versions

Daniel Scally <[email protected]>
media: i2c: Correct format propagation for st-mipid02

Dan Carpenter <[email protected]>
media: i2c: imx296: fix error checking in imx296_read_temperature()

Duoming Zhou <[email protected]>
media: usb: siano: Fix warning due to null work_func_t function pointer

Marek Vasut <[email protected]>
media: videodev2.h: Fix struct v4l2_input tuner index comment

Ming Qian <[email protected]>
media: amphion: initiate a drain of the capture queue in dynamic resolution change

Daniel Lundberg Pedersen <[email protected]>
media: videodev2.h: Fix p_s32 and p_s64 pointer types

Christophe JAILLET <[email protected]>
media: common: saa7146: Avoid a leak in vmalloc_to_sg()

Ming Qian <[email protected]>
media: amphion: drop repeated codec data for vc1g format

Ming Qian <[email protected]>
media: amphion: drop repeated codec data for vc1l format

Daniil Dulov <[email protected]>
media: usb: Check az6007_read() return value

Konrad Dybcio <[email protected]>
clk: qcom: gcc-qcm2290: Mark RCGs shared where applicable

Mantas Pucka <[email protected]>
clk: qcom: gcc-ipq6018: Use floor ops for sdcc clocks

Taniya Das <[email protected]>
clk: qcom: camcc-sc7180: Add parent dependency to all camera GDSCs

Dmitry Baryshkov <[email protected]>
clk: qcom: mmcc-msm8974: remove oxili_ocmemgx_clk

Kathiravan T <[email protected]>
clk: qcom: gcc: ipq5332: Use floor ops for SDCC clocks

Konrad Dybcio <[email protected]>
interconnect: qcom: rpm: Don't use clk_get_optional for bus clocks anymore

Konrad Dybcio <[email protected]>
interconnect: qcom: rpm: Rename icc provider num_clocks to num_bus_clocks

Tony Lindgren <[email protected]>
serial: 8250: omap: Fix freeing of resources on failed register

Christophe JAILLET <[email protected]>
usb: dwc2: Fix some error handling paths

Basavaraj Natikar <[email protected]>
xhci: Improve the XHCI system resume time

Basavaraj Natikar <[email protected]>
USB: Extend pci resume function to handle PM events

Christophe JAILLET <[email protected]>
cpufreq: tegra194: Fix an error handling path in tegra194_cpufreq_probe()

John Paul Adrian Glaubitz <[email protected]>
sh: j2: Use ioremap() to translate device tree address into kernel memory

Yangtao Li <[email protected]>
f2fs: do not allow to defragment files have FI_COMPRESS_RELEASED

Konrad Dybcio <[email protected]>
dt-bindings: power: reset: qcom-pon: Only allow reboot-mode pre-pmk8350

Dan Carpenter <[email protected]>
w1: fix loop in w1_fini()

Stefan Wahren <[email protected]>
w1: w1_therm: fix locking behavior in convert_t

Thomas Gleixner <[email protected]>
x86/efi: Make efi_set_virtual_address_map IBT safe

Will Deacon <[email protected]>
arm64: sme: Use STR P to clear FFR context field in streaming SVE mode

Arnd Bergmann <[email protected]>
ksmbd: avoid field overflow warning

Paulo Alcantara <[email protected]>
smb: client: fix shared DFS root mounts with different prefixes

Paulo Alcantara <[email protected]>
smb: client: fix broken file attrs with nodfs mounts

Shyam Prasad N <[email protected]>
cifs: do all necessary checks for credits within or before locking

Shyam Prasad N <[email protected]>
cifs: prevent use-after-free by freeing the cfile later

Ard Biesheuvel <[email protected]>
efi/libstub: Disable PCI DMA before grabbing the EFI memory map

Masahiro Yamada <[email protected]>
kbuild: deb-pkg: remove the CONFIG_MODULES check in buildeb

Josh Triplett <[email protected]>
kbuild: builddeb: always make modules_install, to install modules.builtin*

Vishal Verma <[email protected]>
tools/testing/cxl: Fix command effects for inject/clear poison

Dan Williams <[email protected]>
cxl/region: Fix state transitions after reset failure

Dan Williams <[email protected]>
cxl/region: Flag partially torn down regions as unusable

Dan Williams <[email protected]>
cxl/region: Move cache invalidation before region teardown, and before setup

Sami Tolvanen <[email protected]>
kbuild: Disable GCOV for *.mod.o

Sami Tolvanen <[email protected]>
kbuild: Fix CFI failures with GCOV

Ding Hui <[email protected]>
SUNRPC: Fix UAF in svc_tcp_listen_data_ready()

Filipe Manana <[email protected]>
btrfs: do not BUG_ON() on tree mod log failure at balance_level()

Filipe Manana <[email protected]>
btrfs: fix race when deleting free space root from the dirty cow roots list

Christian Loehle <[email protected]>
mmc: block: ioctl: do write error check for spi

Demi Marie Obenour <[email protected]>
block: increment diskseq on all media change events

Michael Schmitz <[email protected]>
block: change all __u32 annotations to __be32 in affs_hardblocks.h

Michael Schmitz <[email protected]>
block: add overflow checks for Amiga partition support

Michael Schmitz <[email protected]>
block: fix signed int overflow in Amiga partition support

John Johansen <[email protected]>
apparmor: fix: kzalloc perms tables for shared dfas

Takashi Iwai <[email protected]>
ALSA: pcm: Fix potential data race at PCM memory allocation helpers

Takashi Iwai <[email protected]>
ALSA: jack: Fix mutex call in snd_jack_report()

Werner Sembach <[email protected]>
ALSA: hda/realtek: Add quirk for Clevo NPx0SNx

Andy Chi <[email protected]>
ALSA: hda/realtek: Enable mute/micmute LEDs and limit mic boost on EliteBook

Martin Kaiser <[email protected]>
hwrng: st - keep clock enabled while hwrng is registered

Tarun Sahu <[email protected]>
dax/kmem: Pass valid argument to memory_group_register_static

Dan Williams <[email protected]>
dax: Introduce alloc_dev_dax_id()

Dan Williams <[email protected]>
dax: Fix dax_mapping_release() use after free

Bharath SM <[email protected]>
SMB3: Do not send lease break acknowledgment if all file handles have been closed

Olga Kornievskaia <[email protected]>
NFSv4.1: freeze the session table upon receiving NFS4ERR_BADSESSION

Qi Zheng <[email protected]>
NFSv4.2: fix wrong shrinker_id

Hareshx Sankar Raj <[email protected]>
crypto: qat - unmap buffers before free for RSA

Hareshx Sankar Raj <[email protected]>
crypto: qat - unmap buffer before free for DH

Masahiro Yamada <[email protected]>
ARC: define ASM_NL and __ALIGN(_STR) outside #ifdef __ASSEMBLY__ guard

Dan Carpenter <[email protected]>
modpost: fix off by one in is_executable_section()

Pierre-Clément Tosi <[email protected]>
scripts/mksysmap: Fix badly escaped '$'

Bhupesh Sharma <[email protected]>
dt-bindings: qcom-qce: Fix compatible combinations for SM8150 and IPQ4019 SoCs

Stephan Müller <[email protected]>
crypto: jitter - correct health test during initialization

Arnd Bergmann <[email protected]>
crypto: marvell/cesa - Fix type mismatch warning

Masahiro Yamada <[email protected]>

    modpost: fix section mismatch message for R_ARM_{PC24,CALL,JUMP24}

Masahiro Yamada <[email protected]>
modpost: fix section mismatch message for R_ARM_ABS32

Randy Dunlap <[email protected]>
crypto: nx - fix build warnings when DEBUG_FS is not enabled

Masahiro Yamada <[email protected]>
modpost: remove broken calculation of exception_table_entry size

Herbert Xu <[email protected]>
hwrng: virtio - Fix race on data_avail and actual data

Eric Farman <[email protected]>
vfio/mdev: Move the compat_class initialization to module init

Xinghui Li <[email protected]>
PCI: vmd: Fix uninitialized variable usage in vmd_enable_domain()

Yoshihiro Shimoda <[email protected]>
PCI: endpoint: functions/pci-epf-test: Fix dma_chan direction

Shunsuke Mie <[email protected]>
PCI: endpoint: Fix a Kconfig prompt of vNTB driver

Song Shuai <[email protected]>
riscv: hibernate: remove WARN_ON in save_processor_state

Namhyung Kim <[email protected]>
perf test: Set PERF_EXEC_PATH for script execution

Aneesh Kumar K.V <[email protected]>
powerpc/mm/dax: Fix the condition when checking if altmap vmemap can cross-boundary

Aneesh Kumar K.V <[email protected]>
powerpc/book3s64/mm: Fix DirectMap stats in /proc/meminfo

Tiezhu Yang <[email protected]>
riscv: uprobes: Restore thread.bad_cause

Xi Pardee <[email protected]>
platform/x86:intel/pmc: Update maps for Meteor Lake P/M platforms

Manivannan Sadhasivam <[email protected]>
PCI: qcom: Disable write access to read only registers for IP v2.9.0

Manivannan Sadhasivam <[email protected]>
PCI: qcom: Use DWC helpers for modifying the read-only DBI registers

Song Shuai <[email protected]>
riscv: hibernation: Remove duplicate call of suspend_restore_csrs

Aditya Gupta <[email protected]>
powerpc: update ppc_save_regs to save current r1 in pt_regs

Colin Ian King <[email protected]>
powerpc/powernv/sriov: perform null check on iov before dereferencing iov

Stanley Chu <[email protected]>
scsi: ufs: core: mcq: Fix the incorrect OCS value for the device command

Bart Van Assche <[email protected]>
scsi: ufs: core: Remove a ufshcd_add_command_trace() call

Namhyung Kim <[email protected]>
perf stat: Reset aggr stats for each run

Claudiu Beznea <[email protected]>
pinctrl: at91-pio4: check return value of devm_kasprintf()

Claudiu Beznea <[email protected]>
pinctrl: microchip-sgpio: check return value of devm_kasprintf()

Xiaolei Wang <[email protected]>
pinctrl: freescale: Fix a memory out of bounds when num_configs is 1

Nicholas Piggin <[email protected]>
powerpc/64s: Fix VAS mm use after free

Ian Rogers <[email protected]>
perf tool x86: Fix perf_env memory leak

Ravi Bangoria <[email protected]>
perf tool x86: Consolidate is_amd check into single function

Michal Wilczynski <[email protected]>
platform/x86/dell/dell-rbtn: Fix resources leaking on error path

Aditya Gupta <[email protected]>
perf tests task_analyzer: Skip tests if no libtraceevent support

Aditya Gupta <[email protected]>

    perf tests task_analyzer: Fix bad substitution ${$1}

Kan Liang <[email protected]>
perf metric: Fix no group check

Namhyung Kim <[email protected]>
perf dwarf-aux: Fix off-by-one in die_get_varname()

David E. Box <[email protected]>
platform/x86/intel/pmc/mtl: Put devices in D3 during resume

David E. Box <[email protected]>
platform/x86/intel/pmc: Add resume callback

Mark Pearson <[email protected]>
platform/x86: thinkpad_acpi: Fix lkp-tests warnings for platform profiles

Arnaldo Carvalho de Melo <[email protected]>

    perf script: Fix allocation of evsel->priv related to per-event dump files

Christophe Leroy <[email protected]>
powerpc/signal32: Force inlining of __unsafe_save_user_regs() and save_tm_user_regs_unsafe()

Christophe Leroy <[email protected]>
powerpc/interrupt: Don't read MSR from interrupt_exit_kernel_prepare()

Christophe Leroy <[email protected]>
kcsan: Don't expect 64 bits atomic builtins from 32 bits architectures

Jiasheng Jiang <[email protected]>
pinctrl: npcm7xx: Add missing check for ioremap

Wells Lu <[email protected]>
pinctrl:sunplus: Add check for kmalloc

Mark Pearson <[email protected]>
platform/x86: think-lmi: Correct NVME password handling

Mark Pearson <[email protected]>
platform/x86: think-lmi: Correct System password interface

Mark Pearson <[email protected]>
platform/x86: think-lmi: mutex protection around multiple WMI calls

Xi Pardee <[email protected]>
platform/x86:intel/pmc: Remove Meteor Lake S platform support

Andy Shevchenko <[email protected]>
pinctrl: cherryview: Return correct value if pin in push-pull mode

Arnaldo Carvalho de Melo <[email protected]>
perf bench: Add missing setlocale() call to allow usage of %'d style formatting

Thierry Reding <[email protected]>
pinctrl: tegra: Duplicate pinmux functions table

Bart Van Assche <[email protected]>

    scsi: ufs: core: Fix handling of lrbp->cmd

Bart Van Assche <[email protected]>
scsi: ufs: core: Increase the START STOP UNIT timeout from one to ten seconds

Justin Tee <[email protected]>
scsi: lpfc: Revise NPIV ELS unsol rcv cmpl logic to drop ndlp based on nlp_state

Sui Jingfeng <[email protected]>
PCI: Add pci_clear_master() stub for non-CONFIG_PCI

Bart Van Assche <[email protected]>
scsi: ufs: Declare ufshcd_{hold,release}() once

Wells Lu <[email protected]>
pinctrl: sunplus: Add check for kmalloc

Junyan Ye <[email protected]>
PCI: ftpci100: Release the clock resources

Ian Rogers <[email protected]>
perf evsel: Don't let for_each_group() treat the head of the list as one of its nodes

Rongguang Wei <[email protected]>
PCI: pciehp: Cancel bringup sequence if card is not present

Dan Carpenter <[email protected]>
pinctrl: at91: fix a couple NULL vs IS_ERR() checks

Yuchen Yang <[email protected]>
scsi: 3w-xxxx: Add error handling for initialization failure in tw_probe()

Ding Hui <[email protected]>
PCI/ASPM: Disable ASPM on MFD function removal to avoid use-after-free

Hans de Goede <[email protected]>
platform/x86: lenovo-yogabook: Set default keyboard backligh brightness on probe()

Hans de Goede <[email protected]>
platform/x86: lenovo-yogabook: Reprobe devices on remove()

Hans de Goede <[email protected]>
platform/x86: lenovo-yogabook: Fix work race on remove()

Christophe JAILLET <[email protected]>
pinctrl: bcm2835: Handle gpiochip_add_pin_range() errors

Jinhong Zhu <[email protected]>
scsi: qedf: Fix NULL dereference in error handling

Nirmal Patel <[email protected]>
PCI: vmd: Reset VMD config register between soft reboots

Siddharth Vadapalli <[email protected]>
PCI: cadence: Fix Gen2 Link Retraining process

Jason Gunthorpe <[email protected]>
iommufd: Call iopt_area_contig_done() under the lock

Jason Gunthorpe <[email protected]>
iommufd: Do not access the area pointer after unlocking

Paul Cercueil <[email protected]>
MIPS: DTS: CI20: Raise VDDCORE voltage to 1.125 volts

Paul Cercueil <[email protected]>
MIPS: DTS: CI20: Add parent supplies to ACT8600 regulators

Syed Saba Kareem <[email protected]>
ASoC: amd: acp: clear pdm dma interrupt mask

Michael Walle <[email protected]>
ARM: dts: lan966x: kontron-d10: fix SPI CS

Michael Walle <[email protected]>
ARM: dts: lan966x: kontron-d10: fix board reset

Fei Shao <[email protected]>
clk: Fix memory leak in devm_clk_notifier_register()

Claudiu Beznea <[email protected]>
ASoC: imx-audmix: check return value of devm_kasprintf()

Amir Goldstein <[email protected]>
ovl: update of dentry revalidate flags after copy up

Alexey Romanov <[email protected]>
drivers: meson: secure-pwrc: always enable DMA domain

Claudiu Beznea <[email protected]>
clk: clocking-wizard: check return value of devm_kasprintf()

Claudiu Beznea <[email protected]>
clk: ti: clkctrl: check return value of kasprintf()

Claudiu Beznea <[email protected]>
clk: keystone: sci-clk: check return value of kasprintf()

Claudiu Beznea <[email protected]>
clk: si5341: free unused memory on probe failure

Claudiu Beznea <[email protected]>
clk: si5341: check return value of {devm_}kasprintf()

Claudiu Beznea <[email protected]>
clk: si5341: return error if one synth clock registration fails

Claudiu Beznea <[email protected]>
clk: cdce925: check return value of kasprintf()

Claudiu Beznea <[email protected]>
clk: vc5: check memory returned by kasprintf()

AngeloGioacchino Del Regno <[email protected]>
clk: mediatek: clk-mt8173-apmixedsys: Fix iomap not released issue

AngeloGioacchino Del Regno <[email protected]>
clk: mediatek: clk-mt8173-apmixedsys: Fix return value for of_iomap() error

AngeloGioacchino Del Regno <[email protected]>
clk: mediatek: clk-mtk: Grab iomem pointer for divider clocks

Dmitry Baryshkov <[email protected]>
drm/msm/dpu: correct MERGE_3D length

Dmitry Baryshkov <[email protected]>
drm/msm/dpu: fix sc7280 and sc7180 PINGPONG done interrupts

Marijn Suijten <[email protected]>
drm/msm/dpu: Disable pingpong TE on DPU 5.0.0 and above

Marijn Suijten <[email protected]>
drm/msm/dpu: Move autorefresh disable from CMD encoder to pingpong

Marijn Suijten <[email protected]>
drm/msm/dpu: Drop unused poll_timeout_wr_ptr PINGPONG callback

Luben Tuikov <[email protected]>
drm/amdgpu: Fix usage of UMC fill record in RAS

Srinivasan Shanmugam <[email protected]>
drm/amdgpu: Fix memcpy() in sienna_cichlid_append_powerplay_table function.

Daniel Golle <[email protected]>
arm64: dts: mt7986: increase bl2 partition on NAND of Bananapi R3

Nícolas F. R. A. Prado <[email protected]>
arm64: dts: mediatek: mt8192: Fix CPUs capacity-dmips-mhz

Allen-KH Cheng <[email protected]>
arm64: dts: mediatek: Add cpufreq nodes for MT8192

Bjorn Andersson <[email protected]>
drm/msm/dp: Free resources after unregistering them

Bjorn Andersson <[email protected]>
drm/msm/dp: Drop aux devices together with DP controller

Jessica Zhang <[email protected]>
drm/msm/dsi: Remove incorrect references to slice_count

Jessica Zhang <[email protected]>
drm/msm/dpu: Fix slice_last_group_size calculation

Dmitry Baryshkov <[email protected]>
drm/msm/dpu: do not enable color-management if DSPPs are not available

Su Hui <[email protected]>
ALSA: ac97: Fix possible NULL dereference in snd_ac97_mixer

Nishanth Menon <[email protected]>

    arm64: dts: ti: k3-am69-sk: Fix main_i2c0 alias

Thejasvi Konduru <[email protected]>
arm64: dts: ti: k3-j784s4: Fix wakeup pinmux range and pinctrl node offsets

Nishanth Menon <[email protected]>

    arm64: dts: ti: k3-j784s4-evm: Fix main_i2c0 alias

Andrew Davis <[email protected]>
arm64: dts: ti: k3-j721e-beagleboneai64: Fix mailbox node status

Yuan Can <[email protected]>
clk: tegra: tegra124-emc: Fix potential memory leak

Dan Carpenter <[email protected]>
clk: clocking-wizard: Fix Oops in clk_wzrd_register_divider()

Dan Carpenter <[email protected]>
clk: bcm: rpi: Fix off by one in raspberrypi_discover_clocks()

Abel Vesa <[email protected]>
arm64: dts: qcom: sm8550: Add missing interconnect path to USB HC

Marijn Suijten <[email protected]>
arm64: dts: qcom: sm8250-edo: Panel framebuffer is 2.5k instead of 4k

Konrad Dybcio <[email protected]>
arm64: dts: qcom: sm8550: Flush RSC sleep & wake votes

Konrad Dybcio <[email protected]>
arm64: dts: qcom: sdm845: Flush RSC sleep & wake votes

Konrad Dybcio <[email protected]>
arm64: dts: qcom: sdm670: Flush RSC sleep & wake votes

Konrad Dybcio <[email protected]>
arm64: dts: qcom: qdu1000: Flush RSC sleep & wake votes

Bosi Zhang <[email protected]>
clk: mediatek: fix of_iomap memory leak

Yuxing Liu <[email protected]>
clk: imx: clk-imx8mp: improve error handling in imx8mp_clocks_probe()

Zhanhao Hu <[email protected]>
clk: imx93: fix memory leak and missing unwind goto in imx93_clocks_probe

Hao Luo <[email protected]>
clk: imx: clk-imx8mn: fix memory leak in imx8mn_clocks_probe

Kai Ma <[email protected]>
clk: imx: clk-imxrt1050: fix memory leak in imxrt1050_clocks_probe

Adam Ford <[email protected]>
clk: imx: composite-8m: Add imx8m_divider_determine_rate

Kashyap Desai <[email protected]>
RDMA/bnxt_re: Avoid calling wake_up threads from spin_lock context

Kashyap Desai <[email protected]>
RDMA/bnxt_re: wraparound mbox producer index

Dmitry Baryshkov <[email protected]>
drm/msm/a5xx: really check for A510 in a5xx_gpu_init

Dmitry Baryshkov <[email protected]>
drm/msm/a6xx: don't set IO_PGTABLE_QUIRK_ARM_OUTER_WBWA with coherent SMMU

Chia-I Wu <[email protected]>
amdgpu: validate offset_in_bo of drm_amdgpu_gem_va

Bob Pearson <[email protected]>
RDMA/rxe: Fix access checks in rxe_check_bind_mw

Geert Uytterhoeven <[email protected]>
HID: uclogic: Modular KUnit tests should not depend on KUNIT=y

Nikita Zhandarovich <[email protected]>
drm/radeon: fix possible division-by-zero errors

Aurabindo Pillai <[email protected]>
drm/amd/display: Fix artifacting on eDP panels when engaging freesync video mode

Chen-Yu Tsai <[email protected]>
soc: mediatek: SVS: Fix MT8192 GPU node name

Daniil Dulov <[email protected]>
drm/amdkfd: Fix potential deallocation of previously deallocated memory.

Christophe JAILLET <[email protected]>
drm/amd/display: Fix a test dml32_rq_dlg_get_rq_reg()

Christophe JAILLET <[email protected]>
drm/amd/display: Fix a test CalculatePrefetchSchedule()

Paul Cercueil <[email protected]>
MIPS: DTS: CI20: Fix ACT8600 regulator node names

Maxime Ripard <[email protected]>
clk: Export clk_hw_forward_rate_request()

Christian Lamparter <[email protected]>
ARM: dts: BCM5301X: fix duplex-full => full-duplex

Guenter Roeck <[email protected]>
hwmon: (pmbus/adm1275) Fix problems with temperature monitoring on ADM1272

Tim Harvey <[email protected]>
hwmon: (gsc-hwmon) fix fan pwm temperature scaling

Olivier Moysan <[email protected]>
ARM: dts: stm32: fix i2s endpoint format property for stm32mp15xx-dkx

Dan Carpenter <[email protected]>
accel/habanalabs: fix gaudi2_get_tpc_idle_status() return

Marek Vasut <[email protected]>
ARM: dts: stm32: Fix audio routing on STM32MP15xx DHCOM PDK2

Chris Morgan <[email protected]>
arm64: dts: rockchip: Fix compatible for Bluetooth on rk3566-anbernic

Caleb Connolly <[email protected]>
Input: pm8941-powerkey - fix debounce on gen2+ PMICs

Keerthy <[email protected]>
arm64: dts: ti: k3-j7200: Fix physical address of pin

Cristian Ciocaltea <[email protected]>

    arm64: dts: rockchip: Assign ES8316 MCLK rate on rk3588-rock-5b

Ville Syrjälä <[email protected]>
drm/i915: No 10bit gamma on desktop gen3 parts

Matt Roper <[email protected]>
drm/i915/display: Make display responsible for probing its own IP

Matt Roper <[email protected]>
drm/i915/display: Move display runtime info to display structure

Matt Roper <[email protected]>

    drm/i915: Convert INTEL_INFO()->display to a pointer

Matt Roper <[email protected]>
drm/i915/display: Move display device info to header under display/

Jani Nikula <[email protected]>
drm/i915: hide mkwrite_device_info() better

Ville Syrjälä <[email protected]>
drm/i915: Fix limited range csc matrix

Bjorn Andersson <[email protected]>
dt-bindings: arm-smmu: Fix SC8280XP Adreno binding

Christophe JAILLET <[email protected]>
fbdev: omapfb: lcd_mipid: Fix an error handling path in mipid_spi_probe()

Kuogee Hsieh <[email protected]>
drm/msm/dpu: always clear every individual pending flush mask

Kuogee Hsieh <[email protected]>
drm/msm/dpu: set DSC flush bit correctly at MDP CTL flush register

Wolfram Sang <[email protected]>
arm64: dts: renesas: ulcb-kf: Remove flow control for SCIF1

Geert Uytterhoeven <[email protected]>
ARM: dts: iwg20d-q7-common: Fix backlight pwm specifier

Chengchang Tang <[email protected]>
RDMA/hns: Fix hns_roce_table_get return value

Brendan Cunningham <[email protected]>
IB/hfi1: Fix wrong mmu_node used for user SDMA packet after invalidate

Arnd Bergmann <[email protected]>
RDMA/irdma: avoid fortify-string warning in irdma_clr_wqes

Randy Dunlap <[email protected]>
soc/fsl/qe: fix usb.c build errors

Martin Blumenstingl <[email protected]>
ARM: dts: meson8: correct uart_B and uart_C clock references

Cristian Ciocaltea <[email protected]>
ASoC: es8316: Do not set rate constraints for unsupported MCLKs

Cristian Ciocaltea <[email protected]>
ASoC: es8316: Increment max value for ALC Capture Target Volume control

Dmitry Baryshkov <[email protected]>
ARM: dts: qcom: apq8074-dragonboard: Set DMA as remotely controlled

Krzysztof Kozlowski <[email protected]>
memory: brcmstb_dpfe: fix testing array offset after use

Marek Vasut <[email protected]>
ARM: dts: stm32: Shorten the AV96 HDMI sound card name

Douglas Anderson <[email protected]>
arm64: dts: mediatek: mt8195: Add mediatek,broken-save-restore-fw to cherry

Douglas Anderson <[email protected]>
arm64: dts: mediatek: mt8192: Add mediatek,broken-save-restore-fw to asurada

Douglas Anderson <[email protected]>
arm64: dts: mediatek: mt8183: Add mediatek,broken-save-restore-fw to kukui

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: apq8096: fix fixed regulator name property

Luca Weiss <[email protected]>
arm64: dts: qcom: pm7250b: add missing spmi-vadc include

Arnd Bergmann <[email protected]>
ARM: omap2: fix missing tick_broadcast() prototype

Arnd Bergmann <[email protected]>
ARM: ep93xx: fix missing-prototype warnings

Dario Binacchi <[email protected]>
drm/panel: simple: fix active size for Ampire AM-480272H3TMQW-T01H

Adam Ford <[email protected]>
drm: bridge: samsung-dsim: Fix PMS Calculator on imx8m[mnp]

Frieder Schrempf <[email protected]>
drm/bridge: ti-sn65dsi83: Fix enable/disable flow to meet spec

Stephan Gerhold <[email protected]>
arm64: dts: qcom: apq8016-sbc: Fix 1.8V power rail on LS expansion

Stephan Gerhold <[email protected]>
arm64: dts: qcom: apq8016-sbc: Fix regulator constraints

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: sdm845-polaris: add missing touchscreen child node reg

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: sm8550: correct pinctrl unit address

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: sm8550: correct crypto unit address

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: sm8350: correct USB phy unit address

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: sm8350: correct PCI phy unit address

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: sm8350: correct DMA controller unit address

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: sm6115: correct thermal-sensor unit address

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: sdm845: correct camss unit address

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: sdm630: correct camss unit address

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: msm8996: correct camss unit address

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: msm8994: correct SPMI unit address

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: msm8976: correct MMC unit address

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: msm8953: correct WCNSS unit address

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: msm8953: correct IOMMU unit address

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: msm8916: correct WCNSS unit address

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: msm8916: correct MMC unit address

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: msm8916: correct camss unit address

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: ipq6018: correct qrng unit address

Dmitry Baryshkov <[email protected]>
arm64: dts: qcom: pm8998: don't use GIC_SPI for SPMI interrupts

Krzysztof Kozlowski <[email protected]>
ARM: dts: qcom: msm8974: do not use underscore in node name (again)

Linus Walleij <[email protected]>
ARM/musb: omap2: Remove global GPIO numbers from TUSB6010

Linus Walleij <[email protected]>
ARM: omap2: Rewrite WLAN quirk to use GPIO descriptors

Linus Walleij <[email protected]>
ARM: omap2: Get USB hub reset GPIO from descriptor

Linus Walleij <[email protected]>
ARM/gpio: Push OMAP2 quirk down into TWL4030 driver

Linus Walleij <[email protected]>
ARM: omap1: Exorcise the legacy GPIO header

Linus Walleij <[email protected]>
ARM: omap1: Make serial wakeup GPIOs use descriptors

Linus Walleij <[email protected]>
ARM: omap1: Fix up the Nokia 770 board device IRQs

Linus Walleij <[email protected]>
ARM/mmc: Convert old mmci-omap to GPIO descriptors

Linus Walleij <[email protected]>
Input: ads7846 - Convert to use software nodes

Linus Walleij <[email protected]>
ARM: omap1: Remove reliance on GPIO numbers from SX1

Linus Walleij <[email protected]>
ARM: omap1: Remove reliance on GPIO numbers from PalmTE

Linus Walleij <[email protected]>
ARM: omap1: Drop header on AMS Delta

Linus Walleij <[email protected]>
ARM/mfd/gpio: Fixup TPS65010 regression on OMAP1 OSK1

Nícolas F. R. A. Prado <[email protected]>
drm/bridge: anx7625: Prevent endless probe loop

Bhupesh Sharma <[email protected]>
arm64: dts: qcom: qrb4210-rb2: Fix CD gpio for SDHC2

Tony Lindgren <[email protected]>
ARM: dts: gta04: Move model property out of pinctrl node

Biju Das <[email protected]>
clk: renesas: rzg2l: Fix CPG_SIPLL5_CLK1 register write

Jean-Philippe Brucker <[email protected]>
iommu/virtio: Return size mapped for a detached domain

Jean-Philippe Brucker <[email protected]>
iommu/virtio: Detach domain on endpoint release

Arnd Bergmann <[email protected]>
drm/nouveau: dispnv50: fix missing-prototypes warning

Konrad Dybcio <[email protected]>
drm/msm/dpu: Set DPU_DATA_HCTL_EN for in INTF_SC7180_MASK

Marijn Suijten <[email protected]>

    drm/msm/dpu: Use V4.0 PCC DSPP sub-block in SC7[12]80

Arnaud Vrac <[email protected]>
drm/msm/dpu: fix cursor block register bit offset in msm8998 hw catalog

Dmitry Baryshkov <[email protected]>
drm/msm/dsi: don't allow enabling 14nm VCO with unprogrammed rate

Dmitry Baryshkov <[email protected]>

    drm/msm/dpu: enable DSPP_2/3 for LM_2/3 on sm8450

Kalesh AP <[email protected]>
RDMA/bnxt_re: Fix to remove an unnecessary log

Kalesh AP <[email protected]>
RDMA/bnxt_re: Remove a redundant check inside bnxt_re_update_gid

Kalesh AP <[email protected]>
RDMA/bnxt_re: Use unique names while registering interrupts

Kalesh AP <[email protected]>
RDMA/bnxt_re: Fix to remove unnecessary return labels

Selvin Xavier <[email protected]>
RDMA/bnxt_re: Disable/kill tasklet only if it is enabled

Nikita Zhandarovich <[email protected]>
hwmon: (f71882fg) prevent possible division by zero

Dan Carpenter <[email protected]>
clk: imx: scu: use _safe list iterator to avoid a use after free

Devi Priya <[email protected]>
arm64: dts: qcom: ipq9574: Update the size of GICC & GICV regions

Alexander Stein <[email protected]>
drm/bridge: tc358767: Switch to devm MIPI-DSI helpers

Robert Marko <[email protected]>
arm64: dts: microchip: sparx5: do not use PSCI on reference boards

Tony Lindgren <[email protected]>
bus: ti-sysc: Fix dispc quirk masking bool variables

Marek Vasut <[email protected]>
ARM: dts: stm32: Move ethernet MAC EEPROM from SoM to carrier boards

Maíra Canal <[email protected]>
drm/vkms: Fix RGB565 pixel conversion

Maíra Canal <[email protected]>
drm: Add fixed-point helper to get rounded integer values

Maíra Canal <[email protected]>
drm/vkms: isolate pixel conversion functionality

Bard Liao <[email protected]>
ASoC: Intel: sof_sdw: start set codec init function with an adr index

Bard Liao <[email protected]>
ASoC: Intel: sof_sdw: remove SOF_SDW_TGL_HDMI for MeteorLake devices

Trevor Wu <[email protected]>
ASoC: dt-bindings: mediatek,mt8188-afe: correct clock name

Dan Carpenter <[email protected]>
driver: soc: xilinx: use _safe loop iterator to avoid a use after free

Dmitry Baryshkov <[email protected]>
drm/panel: sharp-ls043t1le01: adjust mode settings

XuDong Liu <[email protected]>
drm: sun4i_tcon: use devm_clk_get_enabled in sun4i_tcon_init_clocks

Marek Vasut <[email protected]>
Input: adxl34x - do not hardcode interrupt trigger type

Marek Vasut <[email protected]>
clk: rs9: Fix .driver_data content in i2c_device_id

Marek Vasut <[email protected]>
clk: vc7: Fix .driver_data content in i2c_device_id

Marek Vasut <[email protected]>
clk: vc5: Fix .driver_data content in i2c_device_id

[email protected] <[email protected]>
ARM: dts: meson8b: correct uart_B and uart_C clock references

Rafał Miłecki <[email protected]>
ARM: dts: BCM5301X: Drop "clock-names" from the SPI node

Luc Ma <[email protected]>
drm/vram-helper: fix function names in vram helper doc

Dmitry Torokhov <[email protected]>
Input: tests - fix input_test_match_device_id test

Francesco Dolcini <[email protected]>
drm/bridge: tc358768: fix THS_TRAILCNT computation

Francesco Dolcini <[email protected]>
drm/bridge: tc358768: fix TXTAGOCNT computation

Francesco Dolcini <[email protected]>
drm/bridge: tc358768: fix THS_ZEROCNT computation

Francesco Dolcini <[email protected]>
drm/bridge: tc358768: fix TCLK_TRAILCNT computation

Francesco Dolcini <[email protected]>
drm/bridge: tc358768: Add atomic_get_input_bus_fmts() implementation

Francesco Dolcini <[email protected]>
drm/bridge: tc358768: fix TCLK_ZEROCNT computation

Francesco Dolcini <[email protected]>
drm/bridge: tc358768: fix PLL target frequency

Francesco Dolcini <[email protected]>
drm/bridge: tc358768: fix PLL parameters computation

Francesco Dolcini <[email protected]>
drm/bridge: tc358768: always enable HS video mode

Alexander Stein <[email protected]>
drm/bridge: ti-sn65dsi83: Fix enable error path

Geert Uytterhoeven <[email protected]>
Input: tests - modular KUnit tests should not depend on KUNIT=y

Geert Uytterhoeven <[email protected]>
Input: tests - fix use-after-free and refcount underflow in input_test_exit()

Duoming Zhou <[email protected]>
Input: cyttsp4_core - change del_timer_sync() to timer_shutdown_sync()

Luca Weiss <[email protected]>

    Input: drv260x - sleep between polling GO bit

Markus Elfring <[email protected]>
drm/bridge: it6505: Move a variable assignment behind a null pointer check in receive_timing_debugfs_show()

Vinay Belgaumkar <[email protected]>
drm/i915/guc/slpc: Provide sysfs for efficient freq

Nicholas Kazlauskas <[email protected]>
drm/amd/display: Explicitly specify update type per plane info change

Nikita Zhandarovich <[email protected]>
radeon: avoid double free in ci_dpm_init()

Arnd Bergmann <[email protected]>
drm/amd/display: fix is_timing_changed() prototype

Wesley Chalmers <[email protected]>
drm/amd/display: Add logging for display MALL refresh setting

Srinivasan Shanmugam <[email protected]>
drm/amd/display: Unconditionally print when DP sink power state fails

Dan Carpenter <[email protected]>
drm/imx/lcdc: fix a NULL vs IS_ERR() bug in probe

Kuniyuki Iwashima <[email protected]>

    netlink: Add __sock_i_ino() for __netlink_diag_dump().

Vladimir Oltean <[email protected]>
net: dsa: avoid suspicious RCU usage for synced VLAN-aware MAC addresses

Cambda Zhu <[email protected]>
ipvlan: Fix return value of ipvlan_queue_xmit()

Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: fix underflow in chain reference counter

Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: unbind non-anonymous set if rule construction fails

Ilia.Gavrilov <[email protected]>
netfilter: nf_conntrack_sip: fix the ct_sip_parse_numerical_param() return value.

Florian Westphal <[email protected]>
netfilter: conntrack: dccp: copy entire header to stack buffer, not just basic one

Jeremy Sowden <[email protected]>
lib/ts_bm: reset initial match offset for every block of text

Lin Ma <[email protected]>
net: nfc: Fix use-after-free caused by nfc_llcp_find_local

Edward Cree <[email protected]>
sfc: fix crash when reading stats while NIC is resetting

David Howells <[email protected]>
ocfs2: Fix use of slab data with sendpage

Maxim Kochetkov <[email protected]>
net: axienet: Move reset before 64-bit DMA detection

Kuniyuki Iwashima <[email protected]>
gtp: Fix use-after-free in __gtp_encap_destroy().

Sabrina Dubroca <[email protected]>
selftests: rtnetlink: remove netdevsim device after ipsec offload test

Eric Dumazet <[email protected]>
sch_netem: fix issues in netem_change() vs get_dist_table()

Eric Dumazet <[email protected]>
bonding: do not assume skb mac_header is set

Eric Dumazet <[email protected]>
netlink: do not hard code device address lenth in fdb dumps

Eric Dumazet <[email protected]>
netlink: fix potential deadlock in netlink_set_err()

Bartosz Golaszewski <[email protected]>
net: stmmac: fix double serdes powerdown

Vinicius Costa Gomes <[email protected]>
igc: Work around HW bug causing missing timestamps

Vinicius Costa Gomes <[email protected]>
igc: Retrieve TX timestamp during interrupt handling

Vinicius Costa Gomes <[email protected]>
igc: Check if hardware TX timestamping is enabled earlier

Vinicius Costa Gomes <[email protected]>
igc: Fix race condition in PTP tx code

Jimmy Assarsson <[email protected]>
can: kvaser_pciefd: Set hardware timestamp on transmitted packets

Jimmy Assarsson <[email protected]>
can: kvaser_pciefd: Add function to set skb hwtstamps

Vincent Mailhol <[email protected]>
can: length: fix bitstuffing count

Gilad Sever <[email protected]>
bpf: Fix bpf socket lookup from tc/xdp to respect socket VRF bindings

Gilad Sever <[email protected]>
bpf: Call __bpf_sk_lookup()/__bpf_skc_lookup() directly via TC hookpoint

Gilad Sever <[email protected]>
bpf: Factor out socket lookup functions for the TC hookpoint.

Dmitry Antipov <[email protected]>
wifi: ath9k: convert msecs to jiffies where needed

Johannes Berg <[email protected]>
wifi: iwlwifi: mvm: check only affected links

Johannes Berg <[email protected]>
wifi: iwlwifi: mvm: indicate HW decrypt for beacon protection

Marek Vasut <[email protected]>
mmc: Add MMC_QUIRK_BROKEN_SD_CACHE for Kingston Canvas Go Plus from 11/2019

Douglas Anderson <[email protected]>
watchdog/hardlockup: keep kernel.nmi_watchdog sysctl as 0444 if probe fails

Lecopzer Chen <[email protected]>
watchdog/perf: adapt the watchdog_perf interface for async model

Douglas Anderson <[email protected]>
watchdog/hardlockup: rename some "NMI watchdog" constants/function

Douglas Anderson <[email protected]>
watchdog/hardlockup: move perf hardlockup checking/panic to common watchdog.c

Lecopzer Chen <[email protected]>
watchdog/hardlockup: change watchdog_nmi_enable() to void

Lecopzer Chen <[email protected]>
watchdog: remove WATCHDOG_DEFAULT

Mathieu Desnoyers <[email protected]>
mm: move mm_count into its own cache line

Ilan Peer <[email protected]>
wifi: ieee80211: Fix the common size calculation for reconfiguration ML

Johannes Berg <[email protected]>
wifi: cfg80211: fix regulatory disconnect with OCB/NAN

Benjamin Berg <[email protected]>
wifi: cfg80211: drop incorrect nontransmitted BSS update code

Benjamin Berg <[email protected]>
wifi: cfg80211: rewrite merging of inherited elements

Nicolas Cavallari <[email protected]>
wifi: mac80211: Remove "Missing iftype sband data/EHT cap" spam

Anjaneyulu <[email protected]>
wifi: iwlwifi: pcie: fix NULL pointer dereference in iwl_pcie_irq_rx_msix_handler()

Johannes Berg <[email protected]>
wifi: iwlwifi: pull from TXQs with softirqs disabled

Johannes Berg <[email protected]>
wifi: iwlwifi: mvm: correctly access HE/EHT sband capa

Gregory Greenman <[email protected]>
wifi: iwlwifi: mvm: add support for Extra EHT LTF

Johannes Berg <[email protected]>
wifi: mac80211: add helpers to access sband iftype data

Ziyang Huang <[email protected]>

    wifi: ath11k: Add missing hw_ops->get_ring_selector() for IPQ5018

Ziyang Huang <[email protected]>
wifi: ath11k: Restart firmware after cold boot calibration for IPQ5018

Ziyang Huang <[email protected]>
wifi: ath11k: Add missing ops config for IPQ5018 in ath11k_ahb_probe()

Jiasheng Jiang <[email protected]>
wifi: ath11k: Add missing check for ioremap

Edwin Peer <[email protected]>
rtnetlink: extend RTEXT_FILTER_SKIP_STATS to IFLA_VF_INFO

Mukesh Sisodiya <[email protected]>
wifi: iwlwifi: fw: print PC register value instead of address

Mukesh Sisodiya <[email protected]>
wifi: iwlwifi: mvm: Handle return value for iwl_mvm_sta_init

Ilan Peer <[email protected]>
wifi: mac80211: Fix permissions for valid_links debugfs entry

Eduard Zingerman <[email protected]>
bpf: Verify scalar ids mapping in regsafe() using check_ids()

Eduard Zingerman <[email protected]>
bpf: Use scalar ids in mark_chain_precision()

Remi Pommarel <[email protected]>
wifi: ath9k: Fix possible stall on ath9k_txq_list_has_key()

Eduard Zingerman <[email protected]>
selftests/bpf: Fix invalid pointer check in get_xlated_program()

Arnd Bergmann <[email protected]>
memstick r592: make memstick_debug_get_tpc_name() static

Douglas Anderson <[email protected]>
mmc: mediatek: Avoid ugly error message when SDIO wakeup IRQ isn't used

Zhen Lei <[email protected]>
kexec: fix a memory leak in crash_shrink_memory()

Douglas Anderson <[email protected]>
watchdog/perf: more properly prevent false positives with turbo modes

Douglas Anderson <[email protected]>
watchdog/perf: define dummy watchdog_update_hrtimer_threshold() on correct config

Haifeng Xu <[email protected]>
selftests: cgroup: fix unexpected failure on test_memcg_low

Karol Kolacinski <[email protected]>
ice: handle extts in the miscellaneous interrupt thread

Marek Vasut <[email protected]>
wifi: rsi: Do not set MMC_PM_KEEP_POWER in shutdown

Marek Vasut <[email protected]>
wifi: rsi: Do not configure WoWlan in shutdown hook if not enabled

Vijaya Krishna Nivarthi <[email protected]>
spi: spi-geni-qcom: Do not do DMA map/unmap inside driver, use framework instead

Vijaya Krishna Nivarthi <[email protected]>
soc: qcom: geni-se: Add interfaces geni_se_tx_init_dma() and geni_se_rx_init_dma()

Jesper Dangaard Brouer <[email protected]>
selftests/bpf: Fix check_mtu using wrong variable type

Johannes Berg <[email protected]>
wifi: mac80211: recalc min chandef for new STA links

Johannes Berg <[email protected]>
wifi: iwlwifi: mvm: send time sync only if needed

Viktor Malik <[email protected]>
tools/resolve_btfids: Fix setting HOSTCFLAGS

Dave Marchevsky <[email protected]>
bpf: Make bpf_refcount_acquire fallible for non-owning refs

Dave Marchevsky <[email protected]>
bpf: Fix __bpf_{list,rbtree}_add's beginning-of-node calculation

Dave Marchevsky <[email protected]>
bpf: Set kptr_struct_meta for node param to list and rbtree insert funcs

Dave Marchevsky <[email protected]>
bpf: Remove anonymous union in bpf_kfunc_call_arg_meta

Youghandhar Chintala <[email protected]>
wifi: ath10k: Trigger STA disconnect after reconfig complete on hardware restart

Jesper Dangaard Brouer <[email protected]>
samples/bpf: xdp1 and xdp2 reduce XDPBUFSIZE to 60

Sascha Hauer <[email protected]>
wifi: rtw88: usb: silence log flooding error message

Fedor Pchelkin <[email protected]>
wifi: ath9k: don't allow to overwrite ENDPOINT0 attributes

Christophe JAILLET <[email protected]>
wifi: ray_cs: Fix an error handling path in ray_probe()

Christophe JAILLET <[email protected]>
wifi: wl3501_cs: Fix an error handling path in wl3501_probe()

Christophe JAILLET <[email protected]>
wifi: atmel: Fix an error handling path in atmel_probe()

Christophe JAILLET <[email protected]>
wifi: orinoco: Fix an error handling path in orinoco_cs_probe()

Christophe JAILLET <[email protected]>
wifi: orinoco: Fix an error handling path in spectrum_cs_probe()

Geert Uytterhoeven <[email protected]>
regulator: core: Streamline debugfs operations

Geert Uytterhoeven <[email protected]>
regulator: core: Fix more error checking for debugfs_create_dir()

Sebastian Reichel <[email protected]>
regulator: rk808: fix asynchronous probing

Alexey Gladkov <[email protected]>
selftests/bpf: Do not use sign-file as testcase

Yafang Shao <[email protected]>
bpf: Fix memleak due to fentry attach failure

Yafang Shao <[email protected]>
bpf: Remove bpf trampoline selector

Alan Maguire <[email protected]>
bpftool: JIT limited misreported as negative value on aarch64

Krzysztof Kozlowski <[email protected]>
nfc: llcp: fix possible use of uninitialized variable in nfc_llcp_send_connect()

Joy Chakraborty <[email protected]>
spi: dw: Round of n_bytes to power of 2

Stanislav Fomichev <[email protected]>
bpf: Don't EFAULT for {g,s}setsockopt with wrong optlen

Andrii Nakryiko <[email protected]>
libbpf: fix offsetof() and container_of() to work with CO-RE

Edward Cree <[email protected]>
sfc: release encap match in efx_tc_flow_free()

Alexander Mikhalitsyn <[email protected]>
sctp: add bpf_bypass_getsockopt proto callback

Chuck Lever <[email protected]>

    net/handshake: Unpin sock->file if a handshake is cancelled

Christophe JAILLET <[email protected]>
wifi: mwifiex: Fix the size of a memory allocation in mwifiex_ret_802_11_scan()

Dan Carpenter <[email protected]>
wifi: rtw88: unlock on error path in rtw_ops_add_interface()

Amisha Patel <[email protected]>
wifi: wilc1000: fix for absent RSN capabilities WFA testcase

Vijaya Krishna Nivarthi <[email protected]>
spi: spi-geni-qcom: Correct CS_TOGGLE bit in SPI_TRANS_CFG

Pengcheng Yang <[email protected]>
samples/bpf: Fix buffer overflow in tcp_basertt

Dan Carpenter <[email protected]>

    wifi: rtw89: fix rtw89_read_chip_ver() for RTL8852B and RTL8851B

Andrii Nakryiko <[email protected]>
bpf: fix propagate_precision() logic for inner frames

Andrii Nakryiko <[email protected]>
bpf: maintain bitmasks across all active frames in __mark_chain_precision

Andrii Nakryiko <[email protected]>
bpf: improve precision backtrack logging

Andrii Nakryiko <[email protected]>
bpf: encapsulate precision backtracking bookkeeping

Martin KaFai Lau <[email protected]>
libbpf: btf_dump_type_data_check_overflow needs to consider BTF_MEMBER_BITFIELD_SIZE

Fedor Pchelkin <[email protected]>
wifi: ath9k: avoid referencing uninit memory in ath9k_wmi_ctrl_rx

Peter Seiderer <[email protected]>
wifi: ath9k: fix AR9003 mac hardware hang check register offset calculation

Jesper Dangaard Brouer <[email protected]>
igc: Enable and fix RX hash usage by netstack

Hao Jia <[email protected]>
sched/core: Avoid multiple calling update_rq_clock() in __cfsb_csd_unthrottle()

Jiasheng Jiang <[email protected]>
pstore/ram: Add check for kstrdup

Roberto Sassu <[email protected]>
ima: Fix build warnings

Roberto Sassu <[email protected]>
evm: Fix build warnings

Roberto Sassu <[email protected]>
evm: Complete description of evm_inode_setattr()

Mark Rutland <[email protected]>
locking/atomic: arm: fix sync ops

Tetsuo Handa <[email protected]>

    reiserfs: Initialize sec->length in reiserfs_security_init().

Juergen Gross <[email protected]>
x86/mm: Fix __swp_entry_to_pte() for Xen PV guests

Ravi Bangoria <[email protected]>
perf/ibs: Fix interface via core pmu events

Mark Brown <[email protected]>
selftests/ftace: Fix KTAP output ordering

Colin Ian King <[email protected]>
kselftest: vDSO: Fix accumulation of uninitialized ret when CLOCK_REALTIME is undefined

Thomas Weißschuh <[email protected]>
tools/nolibc: ensure fast64 integer types have 64 bits

Juergen Gross <[email protected]>
x86/xen: Set MTRR state when running as Xen PV initial domain

Juergen Gross <[email protected]>
x86/mtrr: Replace size_or_mask and size_and_mask with a much easier concept

Juergen Gross <[email protected]>
x86/hyperv: Set MTRR state when running as SEV-SNP Hyper-V guest

Juergen Gross <[email protected]>
x86/mtrr: Support setting MTRR state for software defined MTRRs

Juergen Gross <[email protected]>
x86/mtrr: Remove physical address size calculation

Qiuxu Zhuo <[email protected]>
rcu/rcuscale: Stop kfree_scale_thread thread(s) after unloading rcuscale

Qiuxu Zhuo <[email protected]>
rcu/rcuscale: Move rcu_scale_*() after kfree_scale_cleanup()

Paul E. McKenney <[email protected]>
rcutorture: Correct name of use_softirq module parameter

Paul E. McKenney <[email protected]>
rcu-tasks: Stop rcu_tasks_invoke_cbs() from using never-onlined CPUs

Paul E. McKenney <[email protected]>
rcu: Make rcu_cpu_starting() rely on interrupts being disabled

Daniel Latypov <[email protected]>
kunit: tool: undo type subscripts for subprocess.Popen

Peng Fan <[email protected]>
thermal/drivers/qoriq: Only enable supported sensors

Christophe JAILLET <[email protected]>
thermal/drivers/sun8i: Fix some error handling paths in sun8i_ths_probe()

Stephan Gerhold <[email protected]>
thermal/drivers/qcom/tsens-v0_1: Add mdm9607 correction offsets

Stephan Gerhold <[email protected]>
thermal/drivers/qcom/tsens-v0_1: Fix mdm9607 slope values

Matti Lehtimäki <[email protected]>
thermal/drivers/qcom/tsens-v0_1: Add support for MSM8226

Tero Kristo <[email protected]>
cpufreq: intel_pstate: Fix energy_performance_preference for passive

Arnd Bergmann <[email protected]>
ARM: 9303/1: kprobes: avoid missing-declaration warnings

Ulf Hansson <[email protected]>
PM: domains: Move the verification of in-params from genpd_add_device()

Zhang Rui <[email protected]>
powercap: RAPL: Fix CONFIG_IOSF_MBI dependency

Sumeet Pawnikar <[email protected]>
powercap: RAPL: fix invalid initialization for pl4_supported field

Li Yang <[email protected]>
APEI: GHES: correctly return NULL for ghes_get_devices()

Robin Murphy <[email protected]>
perf/arm_cspmu: Fix event attribute type

Ilkka Koskinen <[email protected]>
perf: arm_cspmu: Set irq affinitiy only if overflow interrupt is used

Junhao He <[email protected]>
drivers/perf: hisi: Don't migrate perf to the CPU going to teardown

Kirill A. Shutemov <[email protected]>
x86/tdx: Fix race between set_memory_encrypted() and load_unaligned_zeropad()

Kirill A. Shutemov <[email protected]>
x86/mm: Allow guest.enc_status_change_prepare() to fail

Marc Zyngier <[email protected]>
drivers/perf: apple_m1: Force 63bit counters for M2 CPUs

Robin Murphy <[email protected]>
perf/arm-cmn: Fix DTC reset

Nikita Zhandarovich <[email protected]>
PM: domains: fix integer overflow issues in genpd_parse_state()

Feng Mingxi <[email protected]>
clocksource/drivers/cadence-ttc: Fix memory leak in ttc_timer_probe

Ming Lei <[email protected]>
blk-mq: don't insert passthrough request into sw queue

Christoph Hellwig <[email protected]>
btrfs: fix file_offset for REQ_BTRFS_ONE_ORDERED bios that get split

Christoph Hellwig <[email protected]>
btrfs: don't treat zoned writeback as being from an async helper thread

Christoph Hellwig <[email protected]>
btrfs: only call __extent_writepage_io from extent_write_locked_range

Christoph Hellwig <[email protected]>
btrfs: don't fail writeback when allocating the compression context fails

Christoph Hellwig <[email protected]>
btrfs: fix range_end calculation in extent_write_locked_range

Christoph Hellwig <[email protected]>
btrfs: submit a writeback bio per extent_buffer

Christoph Hellwig <[email protected]>
btrfs: return bool from lock_extent_buffer_for_io

Christoph Hellwig <[email protected]>
btrfs: don't use btrfs_bio_ctrl for extent buffer reading

Christoph Hellwig <[email protected]>
btrfs: always read the entire extent_buffer

Sebastian Andrzej Siewior <[email protected]>
tracing/timer: Add missing hrtimer modes to decode_hrtimer_mode().

Wen Yang <[email protected]>
tick/rcu: Fix bogus ratelimit condition

Thomas Gleixner <[email protected]>
posix-timers: Prevent RT livelock in itimer_delete()

Gao Xiang <[email protected]>
erofs: fix compact 4B support for 16k block size

Chuck Lever <[email protected]>
svcrdma: Prevent page release when nothing was received

John Paul Adrian Glaubitz <[email protected]>
irqchip/jcore-aic: Fix missing allocation of IRQ descriptors

Antonio Borneo <[email protected]>
irqchip/stm32-exti: Fix warning on initialized field overwritten

Christoph Hellwig <[email protected]>
splice: don't call file_accessed in copy_splice_read

Jianmin Lv <[email protected]>
irqchip/loongson-eiointc: Fix irq affinity setting during resume

Yu Kuai <[email protected]>
block: fix blktrace debugfs entries leakage

Yu Kuai <[email protected]>
md/raid1-10: submit write io directly if bitmap is not enabled

Yu Kuai <[email protected]>
md/raid1-10: factor out a helper to submit normal write

Yu Kuai <[email protected]>
md/raid1-10: factor out a helper to add bio to plug

Li Nan <[email protected]>
md/raid10: fix io loss while replacement replace rdev

Li Nan <[email protected]>
md/raid10: fix null-ptr-deref of mreplace in raid10_sync_request

Li Nan <[email protected]>
md/raid10: fix wrong setting of max_corr_read_errors

Li Nan <[email protected]>
md/raid10: fix overflow of md/safe_mode_delay

Li Nan <[email protected]>
md/raid10: check slab-out-of-bounds in md_bitmap_get_counter

Chaitanya Kulkarni <[email protected]>
nvme-core: fix dev_pm_qos memleak

Chaitanya Kulkarni <[email protected]>
nvme-core: add missing fault-injection cleanup

Chaitanya Kulkarni <[email protected]>
nvme-core: fix memory leak in dhchap_ctrl_secret

Chaitanya Kulkarni <[email protected]>
nvme-core: fix memory leak in dhchap_secret_store

NeilBrown <[email protected]>
lockd: drop inappropriate svc_get() from locked_get()

Yu Kuai <[email protected]>
blk-mq: fix potential io hang by wrong 'wake_batch'

Arnd Bergmann <[email protected]>
virt: sevguest: Add CONFIG_CRYPTO dependency

Waiman Long <[email protected]>
blk-cgroup: Reinit blkg_iostat_set after clearing in blkcg_reset_stats()

Tom Lendacky <[email protected]>
x86/sev: Fix calculation of end address based on number of pages

Li Nan <[email protected]>
blk-iocost: use spin_lock_irqsave in adjust_inuse_and_calc_cost

Eric Biggers <[email protected]>
fsverity: don't use bio_first_page_all() in fsverity_verify_bio()

Eric Biggers <[email protected]>
fsverity: use shash API instead of ahash API

Shawn Wang <[email protected]>
x86/resctrl: Only show tasks' pid in current pid namespace

Gao Xiang <[email protected]>
erofs: kill hooked chains to avoid loops on deduplicated compressed images

David Howells <[email protected]>
splice: Fix filemap_splice_read() to use the correct inode

Yu Kuai <[email protected]>
block/rq_qos: protect rq_qos apis with a new lock

Bart Van Assche <[email protected]>
block: Fix the type of the second bdev_op_is_zoned_write() argument

Ming Lei <[email protected]>
blk-mq: don't queue plugged passthrough requests into scheduler

Alexander Gordeev <[email protected]>
s390/kasan: fix insecure W+X mapping warning

Arnd Bergmann <[email protected]>
fs: pipe: reveal missing function protoypes

Hersen Wu <[email protected]>
Revert "drm/amd/display: edp do not add non-edid timings"

Sean Nyekjaer <[email protected]>
iio: accel: fxls8962af: fixup buffer scan element type

Sean Nyekjaer <[email protected]>
iio: accel: fxls8962af: errata bug only applicable for FXLS8962AF

Fabrizio Lamarque <[email protected]>
iio: adc: ad7192: Fix internal/external clock selection

Fabrizio Lamarque <[email protected]>
iio: adc: ad7192: Fix null ad7192_state pointer access

Rasmus Villemoes <[email protected]>
iio: addac: ad74413: don't set DIN_SINK for functions other than digital input

Fabrizio Lamarque <[email protected]>
dt-bindings: iio: ad7192: Add mandatory reference voltage source

Alvin Šipraga <[email protected]>
extcon: usbc-tusb320: Unregister typec port on driver removal

EJ Hsu <[email protected]>
phy: tegra: xusb: Clear the driver reference in usb-phy dev

Krishna Kurapati <[email protected]>
usb: dwc3: gadget: Propagate core init errors to UDC during pullup

Davide Tronchin <[email protected]>
USB: serial: option: add LARA-R6 01B PIDs

[email protected] <[email protected]>
start_kernel: Add __no_stack_protector function attribute

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

Diffstat:

 Documentation/ABI/testing/sysfs-driver-eud         |   2 +-
 .../devicetree/bindings/crypto/qcom-qce.yaml       |   6 +
 .../devicetree/bindings/iio/adc/adi,ad7192.yaml    |   5 +
 .../devicetree/bindings/iommu/arm,smmu.yaml        |   6 +-
 .../devicetree/bindings/power/reset/qcom,pon.yaml  |   4 +-
 .../bindings/sound/mediatek,mt8188-afe.yaml        |  36 +-
 Documentation/fault-injection/provoke-crashes.rst  |   2 +-
 Documentation/filesystems/autofs-mount-control.rst |   2 +-
 Documentation/filesystems/autofs.rst               |   2 +-
 Documentation/filesystems/directory-locking.rst    |  26 +-
 Documentation/filesystems/f2fs.rst                 |  16 +
 Documentation/networking/af_xdp.rst                |   9 +
 Makefile                                           |   4 +-
 arch/arc/include/asm/linkage.h                     |   8 +-
 arch/arm/boot/dts/bcm53015-meraki-mr26.dts         |   2 +-
 arch/arm/boot/dts/bcm53016-meraki-mr32.dts         |   2 +-
 arch/arm/boot/dts/bcm5301x.dtsi                    |   1 -
 arch/arm/boot/dts/iwg20d-q7-common.dtsi            |   2 +-
 .../boot/dts/lan966x-kontron-kswitch-d10-mmt.dtsi  |  16 +-
 arch/arm/boot/dts/meson8.dtsi                      |   4 +-
 arch/arm/boot/dts/meson8b.dtsi                     |   4 +-
 arch/arm/boot/dts/omap3-gta04a5one.dts             |   4 +-
 arch/arm/boot/dts/qcom-apq8060-dragonboard.dts     |   4 +-
 arch/arm/boot/dts/qcom-apq8074-dragonboard.dts     |   4 +
 arch/arm/boot/dts/qcom-ipq4019-ap.dk04.1-c1.dts    |   8 +-
 arch/arm/boot/dts/qcom-ipq4019-ap.dk04.1.dtsi      |  10 +-
 arch/arm/boot/dts/qcom-ipq4019-ap.dk07.1.dtsi      |  12 +-
 arch/arm/boot/dts/qcom-msm8974.dtsi                |   2 +-
 arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi      |  11 +-
 arch/arm/boot/dts/stm32mp15xx-dhcor-avenger96.dtsi |   8 +-
 .../boot/dts/stm32mp15xx-dhcor-drc-compact.dtsi    |   6 +
 arch/arm/boot/dts/stm32mp15xx-dhcor-som.dtsi       |   6 -
 arch/arm/boot/dts/stm32mp15xx-dhcor-testbench.dtsi |   8 +
 arch/arm/boot/dts/stm32mp15xx-dkx.dtsi             |   2 +-
 arch/arm/include/asm/assembler.h                   |  17 +
 arch/arm/include/asm/sync_bitops.h                 |  29 +-
 arch/arm/lib/bitops.h                              |  14 +-
 arch/arm/lib/testchangebit.S                       |   4 +
 arch/arm/lib/testclearbit.S                        |   4 +
 arch/arm/lib/testsetbit.S                          |   4 +
 arch/arm/mach-ep93xx/timer-ep93xx.c                |   3 +-
 arch/arm/mach-omap1/board-ams-delta.c              |   1 -
 arch/arm/mach-omap1/board-nokia770.c               | 207 +++---
 arch/arm/mach-omap1/board-osk.c                    | 146 +++--
 arch/arm/mach-omap1/board-palmte.c                 |  51 +-
 arch/arm/mach-omap1/board-sx1-mmc.c                |   1 -
 arch/arm/mach-omap1/board-sx1.c                    |  40 +-
 arch/arm/mach-omap1/devices.c                      |   1 -
 arch/arm/mach-omap1/gpio15xx.c                     |   1 -
 arch/arm/mach-omap1/gpio16xx.c                     |   1 -
 arch/arm/mach-omap1/irq.c                          |   1 -
 arch/arm/mach-omap1/serial.c                       |  30 +-
 arch/arm/mach-omap2/board-generic.c                |   1 +
 arch/arm/mach-omap2/board-n8x0.c                   | 156 ++---
 arch/arm/mach-omap2/omap_device.c                  |   1 -
 arch/arm/mach-omap2/pdata-quirks.c                 | 132 ++--
 arch/arm/mach-omap2/usb-tusb6010.c                 |  20 +-
 arch/arm/mach-omap2/usb-tusb6010.h                 |  12 +
 arch/arm/mach-orion5x/board-dt.c                   |   3 +
 arch/arm/mach-orion5x/common.h                     |   6 +
 arch/arm/mach-pxa/spitz.c                          |  11 +-
 arch/arm/probes/kprobes/checkers-common.c          |   2 +-
 arch/arm/probes/kprobes/core.c                     |   2 +-
 arch/arm/probes/kprobes/opt-arm.c                  |   2 -
 arch/arm/probes/kprobes/test-core.c                |   2 +-
 arch/arm/probes/kprobes/test-core.h                |   4 +
 .../dts/mediatek/mt7986a-bananapi-bpi-r3-nand.dtso |   6 +-
 arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi     |   4 +
 arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi   |   4 +
 arch/arm64/boot/dts/mediatek/mt8192.dtsi           |  22 +-
 arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi    |   4 +
 arch/arm64/boot/dts/microchip/sparx5.dtsi          |   2 +-
 .../boot/dts/microchip/sparx5_pcb_common.dtsi      |  12 +
 arch/arm64/boot/dts/qcom/apq8016-sbc.dts           |  78 ++-
 arch/arm64/boot/dts/qcom/apq8096-ifc6640.dts       |   4 +-
 arch/arm64/boot/dts/qcom/ipq6018.dtsi              |   2 +-
 arch/arm64/boot/dts/qcom/ipq9574.dtsi              |   6 +-
 arch/arm64/boot/dts/qcom/msm8916.dtsi              |   8 +-
 arch/arm64/boot/dts/qcom/msm8953.dtsi              |   4 +-
 arch/arm64/boot/dts/qcom/msm8976.dtsi              |   6 +-
 arch/arm64/boot/dts/qcom/msm8994.dtsi              |   2 +-
 arch/arm64/boot/dts/qcom/msm8996.dtsi              |   2 +-
 arch/arm64/boot/dts/qcom/pm7250b.dtsi              |   1 +
 arch/arm64/boot/dts/qcom/pm8998.dtsi               |   2 +-
 arch/arm64/boot/dts/qcom/qdu1000.dtsi              |   1 +
 arch/arm64/boot/dts/qcom/qrb4210-rb2.dts           |   3 +-
 arch/arm64/boot/dts/qcom/sdm630.dtsi               |   2 +-
 arch/arm64/boot/dts/qcom/sdm670.dtsi               |   1 +
 arch/arm64/boot/dts/qcom/sdm845-xiaomi-polaris.dts |   1 +
 arch/arm64/boot/dts/qcom/sdm845.dtsi               |   3 +-
 arch/arm64/boot/dts/qcom/sm6115.dtsi               |   2 +-
 .../boot/dts/qcom/sm8250-sony-xperia-edo.dtsi      |   7 +-
 arch/arm64/boot/dts/qcom/sm8350.dtsi               |   6 +-
 arch/arm64/boot/dts/qcom/sm8550.dtsi               |   9 +-
 arch/arm64/boot/dts/renesas/ulcb-kf.dtsi           |   3 +-
 .../boot/dts/rockchip/rk3566-anbernic-rgxx3.dtsi   |   2 +-
 arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts    |   2 +
 arch/arm64/boot/dts/ti/k3-am69-sk.dts              |   2 +-
 .../boot/dts/ti/k3-j7200-common-proc-board.dts     |  28 +-
 arch/arm64/boot/dts/ti/k3-j721e-beagleboneai64.dts |   5 +
 arch/arm64/boot/dts/ti/k3-j784s4-evm.dts           |  32 +-
 arch/arm64/boot/dts/ti/k3-j784s4-mcu-wakeup.dtsi   |  29 +-
 arch/arm64/include/asm/fpsimdmacros.h              |   6 +-
 arch/arm64/kernel/signal.c                         |   2 +-
 arch/loongarch/Makefile                            |   2 +-
 arch/mips/Makefile                                 |   2 +-
 arch/mips/alchemy/devboards/db1000.c               |  11 +-
 arch/mips/boot/dts/ingenic/ci20.dts                |  38 +-
 arch/powerpc/Kconfig.debug                         |   2 +-
 arch/powerpc/boot/dts/turris1x.dts                 |   6 +-
 arch/powerpc/include/asm/nmi.h                     |   4 +-
 arch/powerpc/kernel/interrupt.c                    |   3 +-
 arch/powerpc/kernel/ppc_save_regs.S                |   6 +-
 arch/powerpc/kernel/signal_32.c                    |  15 +-
 arch/powerpc/kernel/smp.c                          |   1 +
 arch/powerpc/kernel/vdso/Makefile                  |   2 +-
 arch/powerpc/kernel/watchdog.c                     |  12 +-
 arch/powerpc/mm/book3s64/radix_pgtable.c           |  34 +-
 arch/powerpc/mm/init_64.c                          |   2 +-
 arch/powerpc/platforms/powernv/pci-sriov.c         |   6 +-
 arch/powerpc/platforms/powernv/vas-window.c        |   2 +-
 arch/powerpc/platforms/pseries/mobility.c          |   4 +-
 arch/powerpc/platforms/pseries/vas.c               |   2 +-
 arch/riscv/kernel/hibernate-asm.S                  |   1 -
 arch/riscv/kernel/hibernate.c                      |   1 -
 arch/riscv/kernel/probes/uprobes.c                 |   2 +
 arch/riscv/kernel/smpboot.c                        |   5 +-
 arch/riscv/mm/init.c                               |   4 +-
 arch/s390/kvm/diag.c                               |   8 +-
 arch/s390/kvm/kvm-s390.c                           |   4 +
 arch/s390/kvm/vsie.c                               |   6 +-
 arch/s390/mm/vmem.c                                |  14 +-
 arch/sh/drivers/dma/dma-sh.c                       |  37 +-
 arch/sh/include/mach-common/mach/highlander.h      |   2 +-
 arch/sh/include/mach-common/mach/r2d.h             |   2 +-
 arch/sh/include/mach-dreamcast/mach/sysasic.h      |   2 +-
 arch/sh/include/mach-se/mach/se7724.h              |   2 +-
 arch/sh/kernel/cpu/sh2/probe.c                     |   2 +-
 arch/sh/kernel/cpu/sh3/entry.S                     |   4 +-
 arch/sparc/kernel/nmi.c                            |  10 +-
 arch/um/Makefile                                   |   2 +-
 arch/x86/coco/tdx/tdx.c                            |  51 +-
 arch/x86/events/amd/core.c                         |   2 +-
 arch/x86/events/amd/ibs.c                          |  53 +-
 arch/x86/hyperv/ivm.c                              |   4 +
 arch/x86/include/asm/mtrr.h                        |  40 +-
 arch/x86/include/asm/perf_event.h                  |   2 +
 arch/x86/include/asm/pgtable_64.h                  |   4 +-
 arch/x86/include/asm/sev.h                         |  16 +-
 arch/x86/include/asm/x86_init.h                    |   2 +-
 arch/x86/include/uapi/asm/mtrr.h                   |   8 -
 arch/x86/kernel/cpu/mtrr/cleanup.c                 |  18 +-
 arch/x86/kernel/cpu/mtrr/generic.c                 | 124 +++-
 arch/x86/kernel/cpu/mtrr/mtrr.c                    |  73 +--
 arch/x86/kernel/cpu/mtrr/mtrr.h                    |   4 +-
 arch/x86/kernel/cpu/resctrl/rdtgroup.c             |   8 +-
 arch/x86/kernel/setup.c                            |   2 +
 arch/x86/kernel/sev.c                              |  14 +-
 arch/x86/kernel/x86_init.c                         |   2 +-
 arch/x86/mm/mem_encrypt_amd.c                      |   4 +-
 arch/x86/mm/pat/set_memory.c                       |   3 +-
 arch/x86/platform/efi/efi_64.c                     |   6 +-
 arch/x86/xen/enlighten_pv.c                        |  52 ++
 block/blk-cgroup.c                                 |  20 +-
 block/blk-core.c                                   |   1 +
 block/blk-iocost.c                                 |   7 +-
 block/blk-mq-debugfs.c                             |   2 +-
 block/blk-mq-tag.c                                 |  15 +-
 block/blk-mq.c                                     |  13 +-
 block/blk-mq.h                                     |   3 +-
 block/blk-rq-qos.c                                 |  20 +-
 block/blk-throttle.c                               |   6 -
 block/blk-throttle.h                               |   9 +
 block/blk-wbt.c                                    |   2 +
 block/disk-events.c                                |   1 +
 block/genhd.c                                      |   5 +-
 block/partitions/amiga.c                           | 102 ++-
 crypto/jitterentropy.c                             |   9 +-
 drivers/accel/habanalabs/gaudi2/gaudi2.c           |   2 +-
 drivers/acpi/apei/ghes.c                           |   2 +
 drivers/base/power/domain.c                        |  15 +-
 drivers/base/property.c                            |  12 +-
 drivers/bus/fsl-mc/dprc-driver.c                   |   6 +
 drivers/bus/ti-sysc.c                              |   4 +-
 drivers/cdx/cdx.c                                  |  18 +
 drivers/char/hw_random/st-rng.c                    |  21 +-
 drivers/char/hw_random/virtio-rng.c                |  10 +-
 drivers/clk/bcm/clk-raspberrypi.c                  |   4 +-
 drivers/clk/clk-cdce925.c                          |  12 +
 drivers/clk/clk-renesas-pcie.c                     |   4 +-
 drivers/clk/clk-si5341.c                           |  38 +-
 drivers/clk/clk-versaclock5.c                      |  45 +-
 drivers/clk/clk-versaclock7.c                      |   2 +-
 drivers/clk/clk.c                                  |   2 +
 drivers/clk/imx/clk-composite-8m.c                 |  31 +
 drivers/clk/imx/clk-imx8mn.c                       |   8 +-
 drivers/clk/imx/clk-imx8mp.c                       |  24 +-
 drivers/clk/imx/clk-imx93.c                        |  15 +-
 drivers/clk/imx/clk-imxrt1050.c                    |  22 +-
 drivers/clk/imx/clk-scu.c                          |   4 +-
 drivers/clk/keystone/sci-clk.c                     |   2 +
 drivers/clk/mediatek/clk-mt8173-apmixedsys.c       |   7 +-
 drivers/clk/mediatek/clk-mtk.c                     |  13 +-
 drivers/clk/qcom/camcc-sc7180.c                    |  19 +-
 drivers/clk/qcom/dispcc-qcm2290.c                  |  12 +-
 drivers/clk/qcom/gcc-ipq5332.c                     |   6 +-
 drivers/clk/qcom/gcc-ipq6018.c                     |  34 +-
 drivers/clk/qcom/gcc-qcm2290.c                     |  62 +-
 drivers/clk/qcom/mmcc-msm8974.c                    |  23 +-
 drivers/clk/renesas/rzg2l-cpg.c                    |   6 +-
 drivers/clk/renesas/rzg2l-cpg.h                    |   3 -
 drivers/clk/tegra/clk-tegra124-emc.c               |   2 +
 drivers/clk/ti/clkctrl.c                           |   7 +
 drivers/clk/xilinx/clk-xlnx-clock-wizard.c         |   7 +-
 drivers/clocksource/timer-cadence-ttc.c            |  19 +-
 drivers/cpufreq/intel_pstate.c                     |   2 +
 drivers/cpufreq/mediatek-cpufreq.c                 |  13 +-
 drivers/cpufreq/tegra194-cpufreq.c                 |   6 +-
 .../crypto/intel/qat/qat_common/qat_asym_algs.c    |  14 +-
 drivers/crypto/marvell/cesa/cipher.c               |   2 +-
 drivers/crypto/nx/Makefile                         |   2 +-
 drivers/crypto/nx/nx.h                             |   4 +-
 drivers/cxl/core/region.c                          | 102 +--
 drivers/cxl/cxl.h                                  |  16 +-
 drivers/dax/bus.c                                  |  61 +-
 drivers/dax/dax-private.h                          |   4 +-
 drivers/dax/kmem.c                                 |   2 +-
 drivers/extcon/extcon-usbc-tusb320.c               |  42 +-
 drivers/extcon/extcon.c                            |   8 +
 drivers/firmware/efi/libstub/efi-stub-helper.c     |   6 +-
 drivers/gpio/gpio-twl4030.c                        |  52 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c             |  11 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c           |   3 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c         |   6 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c            |   2 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c            |   3 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c       |   3 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c            |   3 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c             |  85 +--
 drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c             |  11 +-
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c             |   4 +-
 drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c           |   4 +-
 drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c    |  13 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  |  10 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c    |   5 +-
 .../dc/clk_mgr/dcn30/dcn30_clk_mgr_smu_msg.c       |   3 +
 drivers/gpu/drm/amd/display/dc/core/dc.c           |   3 -
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  |   6 +-
 drivers/gpu/drm/amd/display/dc/dc.h                |   3 +
 .../gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.c   |  23 -
 .../gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.h   |   2 -
 .../gpu/drm/amd/display/dc/dcn314/dcn314_init.c    |   2 +-
 .../amd/display/dc/dml/dcn21/display_mode_vba_21.c |   2 +-
 .../display/dc/dml/dcn32/display_rq_dlg_calc_32.c  |   2 +-
 .../display/dc/link/protocols/link_dp_capability.c |   4 +-
 .../drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c    |  18 +-
 .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c   |   1 +
 drivers/gpu/drm/bridge/analogix/anx7625.c          | 128 ++--
 drivers/gpu/drm/bridge/ite-it6505.c                |   3 +-
 drivers/gpu/drm/bridge/samsung-dsim.c              |  22 +-
 drivers/gpu/drm/bridge/tc358767.c                  |   4 +-
 drivers/gpu/drm/bridge/tc358768.c                  |  93 ++-
 drivers/gpu/drm/bridge/ti-sn65dsi83.c              |  20 +-
 drivers/gpu/drm/drm_gem_vram_helper.c              |   6 +-
 drivers/gpu/drm/i915/Makefile                      |   2 +
 drivers/gpu/drm/i915/display/intel_color.c         |  36 +-
 drivers/gpu/drm/i915/display/intel_crtc.c          |   2 +-
 drivers/gpu/drm/i915/display/intel_cursor.c        |   4 +-
 drivers/gpu/drm/i915/display/intel_display.c       |   2 +-
 drivers/gpu/drm/i915/display/intel_display.h       |  10 +-
 .../gpu/drm/i915/display/intel_display_device.c    | 728 +++++++++++++++++++++
 .../gpu/drm/i915/display/intel_display_device.h    |  86 +++
 drivers/gpu/drm/i915/display/intel_display_power.c |   6 +-
 .../gpu/drm/i915/display/intel_display_reg_defs.h  |  14 +-
 drivers/gpu/drm/i915/display/intel_fb_pin.c        |   2 +-
 drivers/gpu/drm/i915/display/intel_fbc.c           |   6 +-
 drivers/gpu/drm/i915/display/intel_hdcp.c          |   2 +-
 drivers/gpu/drm/i915/display/intel_hti.c           |   2 +-
 drivers/gpu/drm/i915/display/intel_psr.c           |   4 +-
 drivers/gpu/drm/i915/display/intel_psr_regs.h      |   2 +-
 drivers/gpu/drm/i915/display/skl_universal_plane.c |   2 +-
 drivers/gpu/drm/i915/display/skl_watermark.c       |   8 +-
 drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c        |  35 +
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c        |  40 +-
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h        |   1 +
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_types.h  |   1 +
 drivers/gpu/drm/i915/i915_driver.c                 |  12 +-
 drivers/gpu/drm/i915/i915_drv.h                    |  52 +-
 drivers/gpu/drm/i915/i915_pci.c                    | 384 +----------
 drivers/gpu/drm/i915/i915_reg.h                    |  33 -
 drivers/gpu/drm/i915/intel_device_info.c           | 140 ++--
 drivers/gpu/drm/i915/intel_device_info.h           |  69 +-
 drivers/gpu/drm/i915/intel_step.c                  |   8 +-
 drivers/gpu/drm/imx/lcdc/imx-lcdc.c                |   4 +-
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c              |   3 +-
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c              |   3 +-
 .../drm/msm/disp/dpu1/catalog/dpu_3_0_msm8998.h    |  12 +-
 .../gpu/drm/msm/disp/dpu1/catalog/dpu_4_0_sdm845.h |   8 +-
 .../gpu/drm/msm/disp/dpu1/catalog/dpu_5_0_sm8150.h |  12 +-
 .../drm/msm/disp/dpu1/catalog/dpu_5_1_sc8180x.h    |  12 +-
 .../gpu/drm/msm/disp/dpu1/catalog/dpu_6_0_sm8250.h |  12 +-
 .../gpu/drm/msm/disp/dpu1/catalog/dpu_6_2_sc7180.h |  10 +-
 .../gpu/drm/msm/disp/dpu1/catalog/dpu_6_3_sm6115.h |   2 +-
 .../drm/msm/disp/dpu1/catalog/dpu_6_5_qcm2290.h    |   2 +-
 .../gpu/drm/msm/disp/dpu1/catalog/dpu_7_2_sc7280.h |  18 +-
 .../gpu/drm/msm/disp/dpu1/catalog/dpu_8_1_sm8450.h |   4 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c           |   5 +-
 .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c   |  60 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c     |  36 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c         |   5 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c         |   5 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c    |  75 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h    |  31 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h            |   4 +
 drivers/gpu/drm/msm/dp/dp_display.c                |  16 +-
 drivers/gpu/drm/msm/dsi/dsi_host.c                 |  26 +-
 drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c         |   3 +
 drivers/gpu/drm/nouveau/dispnv50/disp.c            |   1 +
 drivers/gpu/drm/nouveau/nv50_display.h             |   4 +-
 drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c    |  11 +-
 drivers/gpu/drm/panel/panel-simple.c               |   4 +-
 drivers/gpu/drm/radeon/ci_dpm.c                    |  28 +-
 drivers/gpu/drm/radeon/cypress_dpm.c               |   8 +-
 drivers/gpu/drm/radeon/ni_dpm.c                    |   8 +-
 drivers/gpu/drm/radeon/rv740_dpm.c                 |   8 +-
 drivers/gpu/drm/sun4i/sun4i_tcon.c                 |  19 +-
 drivers/gpu/drm/vkms/vkms_composer.c               |   4 +-
 drivers/gpu/drm/vkms/vkms_drv.h                    |   4 +-
 drivers/gpu/drm/vkms/vkms_formats.c                | 131 ++--
 drivers/gpu/drm/vkms/vkms_formats.h                |   2 +-
 drivers/gpu/drm/vkms/vkms_plane.c                  |   2 +-
 drivers/hid/Kconfig                                |   2 +-
 drivers/hwmon/f71882fg.c                           |   7 +-
 drivers/hwmon/gsc-hwmon.c                          |   6 +-
 drivers/hwmon/pmbus/adm1275.c                      |  52 +-
 drivers/hwtracing/coresight/coresight-core.c       |   9 +-
 .../hwtracing/coresight/coresight-etm4x-sysfs.c    |  27 +-
 drivers/hwtracing/ptt/hisi_ptt.c                   |  12 +-
 drivers/hwtracing/ptt/hisi_ptt.h                   |   2 +
 drivers/i2c/busses/i2c-designware-pcidrv.c         |  13 +-
 drivers/i2c/busses/i2c-nvidia-gpu.c                |   3 +
 drivers/i2c/busses/i2c-xiic.c                      |   2 +
 drivers/i3c/master/svc-i3c-master.c                |  19 +-
 drivers/iio/accel/fxls8962af-core.c                |   8 +-
 drivers/iio/adc/ad7192.c                           |   8 +-
 drivers/iio/addac/ad74413r.c                       |  11 +-
 drivers/infiniband/hw/bnxt_re/main.c               |  20 +-
 drivers/infiniband/hw/bnxt_re/qplib_fp.c           |  40 +-
 drivers/infiniband/hw/bnxt_re/qplib_fp.h           |   2 +-
 drivers/infiniband/hw/bnxt_re/qplib_rcfw.c         |  46 +-
 drivers/infiniband/hw/bnxt_re/qplib_rcfw.h         |   1 +
 drivers/infiniband/hw/hfi1/ipoib_tx.c              |   4 +-
 drivers/infiniband/hw/hfi1/mmu_rb.c                | 101 +--
 drivers/infiniband/hw/hfi1/mmu_rb.h                |   3 +
 drivers/infiniband/hw/hfi1/sdma.c                  |  23 +-
 drivers/infiniband/hw/hfi1/sdma.h                  |  47 +-
 drivers/infiniband/hw/hfi1/sdma_txreq.h            |   2 +
 drivers/infiniband/hw/hfi1/user_sdma.c             | 137 ++--
 drivers/infiniband/hw/hfi1/user_sdma.h             |   1 -
 drivers/infiniband/hw/hfi1/vnic_sdma.c             |   4 +-
 drivers/infiniband/hw/hns/hns_roce_hem.c           |   7 +-
 drivers/infiniband/hw/irdma/uk.c                   |  10 +-
 drivers/infiniband/sw/rxe/rxe_mw.c                 |  17 +-
 drivers/input/Kconfig                              |   2 +-
 drivers/input/misc/adxl34x.c                       |   3 +-
 drivers/input/misc/drv260x.c                       |   1 +
 drivers/input/misc/pm8941-pwrkey.c                 |  19 +-
 drivers/input/tests/input_test.c                   |   6 +-
 drivers/input/touchscreen/ads7846.c                | 114 ++--
 drivers/input/touchscreen/cyttsp4_core.c           |   3 +-
 drivers/interconnect/qcom/icc-rpm.c                |  12 +-
 drivers/interconnect/qcom/icc-rpm.h                |   4 +-
 drivers/iommu/iommufd/device.c                     |   2 +-
 drivers/iommu/iommufd/io_pagetable.c               |  14 +-
 drivers/iommu/virtio-iommu.c                       |  57 +-
 drivers/irqchip/irq-jcore-aic.c                    |   7 +
 drivers/irqchip/irq-loongson-eiointc.c             |   2 +-
 drivers/irqchip/irq-loongson-liointc.c             |  12 +-
 drivers/irqchip/irq-loongson-pch-pic.c             |  10 +-
 drivers/irqchip/irq-stm32-exti.c                   |  12 +
 drivers/leds/trigger/ledtrig-netdev.c              |   3 +
 drivers/mailbox/ti-msgmgr.c                        |  12 +-
 drivers/md/bcache/btree.c                          |  25 +-
 drivers/md/bcache/btree.h                          |   1 +
 drivers/md/bcache/super.c                          |   4 +-
 drivers/md/bcache/writeback.c                      |  10 +
 drivers/md/md-bitmap.c                             |  21 +-
 drivers/md/md-bitmap.h                             |   7 +
 drivers/md/md.c                                    |   9 +-
 drivers/md/raid1-10.c                              |  42 ++
 drivers/md/raid1.c                                 |  25 +-
 drivers/md/raid10.c                                |  75 +--
 drivers/media/cec/i2c/Kconfig                      |   1 +
 drivers/media/common/saa7146/saa7146_core.c        |   6 +-
 drivers/media/i2c/Kconfig                          |   1 +
 drivers/media/i2c/hi846.c                          |   3 +-
 drivers/media/i2c/imx296.c                         |   4 +-
 drivers/media/i2c/st-mipid02.c                     |   9 +-
 drivers/media/platform/amphion/vdec.c              |   7 +-
 drivers/media/platform/amphion/venc.c              |   4 +-
 drivers/media/platform/amphion/vpu_malone.c        |  12 +
 drivers/media/platform/amphion/vpu_v4l2.c          |   5 +-
 drivers/media/platform/amphion/vpu_v4l2.h          |   2 +-
 .../platform/mediatek/vcodec/vdec_msg_queue.c      |  33 +-
 .../platform/mediatek/vcodec/vdec_msg_queue.h      |  16 +-
 drivers/media/platform/qcom/venus/helpers.c        |   4 +-
 drivers/media/platform/renesas/rcar_fdp1.c         |   5 +
 drivers/media/usb/dvb-usb-v2/az6007.c              |   3 +-
 drivers/media/usb/siano/smsusb.c                   |   3 +-
 drivers/memory/brcmstb_dpfe.c                      |   4 +-
 drivers/memstick/host/r592.c                       |   4 +-
 drivers/mfd/intel-lpss-acpi.c                      |   3 +
 drivers/mfd/rt5033.c                               |   3 -
 drivers/mfd/stmfx.c                                |   7 +-
 drivers/mfd/stmpe.c                                |   4 +-
 drivers/mfd/tps65010.c                             |  14 +-
 drivers/mfd/wcd934x.c                              |   9 +-
 drivers/misc/fastrpc.c                             |   3 +
 drivers/misc/lkdtm/core.c                          |   2 +-
 drivers/mmc/core/block.c                           |   6 +
 drivers/mmc/core/card.h                            |  30 +-
 drivers/mmc/core/quirks.h                          |  27 +
 drivers/mmc/core/sd.c                              |   2 +-
 drivers/mmc/host/mmci.c                            |   1 +
 drivers/mmc/host/mtk-sd.c                          |   2 +-
 drivers/mmc/host/omap.c                            |  46 +-
 drivers/mmc/host/sdhci.c                           |   4 +-
 drivers/net/bonding/bond_main.c                    |   2 +-
 drivers/net/can/kvaser_pciefd.c                    |  39 +-
 drivers/net/dsa/ocelot/felix.c                     |  12 +
 drivers/net/dsa/sja1105/sja1105.h                  |   2 +-
 drivers/net/dsa/sja1105/sja1105_main.c             |  14 +-
 drivers/net/dsa/sja1105/sja1105_ptp.c              |  48 +-
 drivers/net/dsa/vitesse-vsc73xx-core.c             |   6 +-
 drivers/net/ethernet/broadcom/tg3.c                |   1 +
 drivers/net/ethernet/ibm/ibmvnic.c                 |   9 +-
 drivers/net/ethernet/intel/ice/ice.h               |   7 +
 drivers/net/ethernet/intel/ice/ice_main.c          |  29 +-
 drivers/net/ethernet/intel/ice/ice_ptp.c           |  12 +-
 drivers/net/ethernet/intel/ice/ice_ptp.h           |   4 +-
 drivers/net/ethernet/intel/igc/igc.h               |  36 +-
 drivers/net/ethernet/intel/igc/igc_main.c          |  45 +-
 drivers/net/ethernet/intel/igc/igc_ptp.c           | 142 ++--
 drivers/net/ethernet/marvell/octeontx2/af/cgx.c    |  33 +-
 drivers/net/ethernet/marvell/octeontx2/af/cgx.h    |   2 +
 .../ethernet/marvell/octeontx2/af/lmac_common.h    |   3 +
 drivers/net/ethernet/marvell/octeontx2/af/rpm.c    |  32 +-
 drivers/net/ethernet/marvell/octeontx2/af/rpm.h    |   5 +-
 drivers/net/ethernet/marvell/octeontx2/af/rvu.c    |   1 +
 drivers/net/ethernet/marvell/octeontx2/af/rvu.h    |  12 +
 .../net/ethernet/marvell/octeontx2/af/rvu_cgx.c    |  22 +-
 drivers/net/ethernet/mellanox/mlxsw/minimal.c      |   1 +
 drivers/net/ethernet/mscc/ocelot.c                 |   1 -
 drivers/net/ethernet/mscc/ocelot_ptp.c             |  66 +-
 drivers/net/ethernet/sfc/ef10.c                    |  13 +-
 drivers/net/ethernet/sfc/efx_devlink.c             |   3 +
 drivers/net/ethernet/sfc/tc.c                      |  32 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |   6 -
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c  |  10 +-
 drivers/net/gtp.c                                  |   2 +
 drivers/net/ipvlan/ipvlan_core.c                   |   9 +-
 drivers/net/ppp/pptp.c                             |  31 +-
 drivers/net/wireguard/netlink.c                    |  14 +-
 drivers/net/wireguard/queueing.c                   |   1 +
 drivers/net/wireguard/queueing.h                   |  25 +-
 drivers/net/wireguard/receive.c                    |   2 +-
 drivers/net/wireguard/send.c                       |   2 +-
 drivers/net/wireless/ath/ath10k/core.c             |  12 +-
 drivers/net/wireless/ath/ath10k/core.h             |   3 +
 drivers/net/wireless/ath/ath10k/mac.c              |  13 +-
 drivers/net/wireless/ath/ath11k/ahb.c              |   1 +
 drivers/net/wireless/ath/ath11k/core.c             |   1 +
 drivers/net/wireless/ath/ath11k/hw.c               |   2 +-
 drivers/net/wireless/ath/ath11k/qmi.c              |   5 +
 drivers/net/wireless/ath/ath9k/ar9003_hw.c         |  27 +-
 drivers/net/wireless/ath/ath9k/htc_hst.c           |   8 +-
 drivers/net/wireless/ath/ath9k/main.c              |  11 +-
 drivers/net/wireless/ath/ath9k/wmi.c               |   4 +
 drivers/net/wireless/atmel/atmel_cs.c              |  13 +-
 drivers/net/wireless/intel/iwlwifi/fw/api/rs.h     |   2 +
 drivers/net/wireless/intel/iwlwifi/fw/dump.c       |   7 +-
 drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c |   2 +
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c        |   8 +-
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c  |   9 +-
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c       |  10 +-
 drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c     |  58 +-
 drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c      |   9 +-
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c       |   2 +
 drivers/net/wireless/intel/iwlwifi/pcie/rx.c       |   5 +-
 drivers/net/wireless/intersil/orinoco/orinoco_cs.c |  13 +-
 .../net/wireless/intersil/orinoco/spectrum_cs.c    |  13 +-
 drivers/net/wireless/legacy/ray_cs.c               |  16 +-
 drivers/net/wireless/legacy/wl3501_cs.c            |  16 +-
 drivers/net/wireless/marvell/mwifiex/scan.c        |   6 +-
 drivers/net/wireless/mediatek/mt76/mt7921/dma.c    |   4 -
 drivers/net/wireless/mediatek/mt76/mt7921/mcu.c    |   8 -
 drivers/net/wireless/mediatek/mt76/mt7921/pci.c    |   8 +
 drivers/net/wireless/microchip/wilc1000/hif.c      |   8 +-
 drivers/net/wireless/realtek/rtw88/mac80211.c      |   4 +-
 drivers/net/wireless/realtek/rtw88/usb.c           |   2 +-
 drivers/net/wireless/realtek/rtw89/core.c          |   2 +-
 drivers/net/wireless/rsi/rsi_91x_sdio.c            |   9 +-
 drivers/nvme/host/core.c                           |  16 +-
 drivers/nvmem/imx-ocotp.c                          |   8 +-
 drivers/nvmem/rmem.c                               |   1 +
 drivers/nvmem/sunplus-ocotp.c                      |   9 +-
 drivers/pci/controller/cadence/pcie-cadence-host.c |  27 +
 drivers/pci/controller/dwc/pcie-qcom.c             |  11 +-
 drivers/pci/controller/pci-ftpci100.c              |  14 +-
 drivers/pci/controller/vmd.c                       |  11 +-
 drivers/pci/endpoint/functions/Kconfig             |   2 +-
 drivers/pci/endpoint/functions/pci-epf-test.c      |   2 +-
 drivers/pci/hotplug/pciehp_ctrl.c                  |   8 +
 drivers/pci/pcie/aspm.c                            |  21 +-
 drivers/perf/apple_m1_cpu_pmu.c                    |  30 +-
 drivers/perf/arm-cmn.c                             |   7 +-
 drivers/perf/arm_cspmu/arm_cspmu.c                 |  11 +-
 drivers/perf/arm_pmu.c                             |   2 +
 drivers/perf/hisilicon/hisi_pcie_pmu.c             |   2 +-
 drivers/phy/Kconfig                                |   1 +
 drivers/phy/qualcomm/phy-qcom-qmp-combo.c          |   8 +-
 drivers/phy/tegra/xusb.c                           |   4 +
 drivers/pinctrl/bcm/pinctrl-bcm2835.c              |   6 +-
 drivers/pinctrl/freescale/pinctrl-scu.c            |   3 +-
 drivers/pinctrl/intel/pinctrl-cherryview.c         |  15 +-
 drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c          |   2 +
 drivers/pinctrl/pinctrl-at91-pio4.c                |   2 +
 drivers/pinctrl/pinctrl-at91.c                     |   8 +-
 drivers/pinctrl/pinctrl-microchip-sgpio.c          |   3 +
 drivers/pinctrl/sunplus/sppctl.c                   |  23 +-
 drivers/pinctrl/tegra/pinctrl-tegra.c              |  15 +-
 drivers/pinctrl/tegra/pinctrl-tegra.h              |   3 +-
 drivers/pinctrl/tegra/pinctrl-tegra114.c           |   7 +-
 drivers/pinctrl/tegra/pinctrl-tegra124.c           |   7 +-
 drivers/pinctrl/tegra/pinctrl-tegra194.c           |   7 +-
 drivers/pinctrl/tegra/pinctrl-tegra20.c            |   7 +-
 drivers/pinctrl/tegra/pinctrl-tegra210.c           |   7 +-
 drivers/pinctrl/tegra/pinctrl-tegra30.c            |   7 +-
 drivers/platform/x86/dell/dell-rbtn.c              |  13 +-
 drivers/platform/x86/intel/pmc/core.c              |  15 +-
 drivers/platform/x86/intel/pmc/core.h              |  31 +-
 drivers/platform/x86/intel/pmc/mtl.c               | 475 +++++++++++++-
 drivers/platform/x86/lenovo-yogabook-wmi.c         |  34 +-
 drivers/platform/x86/think-lmi.c                   |  20 +-
 drivers/platform/x86/thinkpad_acpi.c               |   6 +-
 drivers/power/supply/rt9467-charger.c              |   2 +-
 drivers/powercap/Kconfig                           |   4 +-
 drivers/powercap/intel_rapl_msr.c                  |  17 +-
 drivers/pwm/pwm-ab8500.c                           |   2 +-
 drivers/pwm/pwm-imx-tpm.c                          |   7 +
 drivers/pwm/pwm-mtk-disp.c                         |  13 +-
 drivers/pwm/sysfs.c                                |  17 +
 drivers/regulator/core.c                           |  30 +-
 drivers/regulator/rk808-regulator.c                |   1 +
 drivers/regulator/tps65219-regulator.c             |   6 +-
 drivers/rtc/rtc-st-lpc.c                           |   2 +-
 drivers/s390/net/qeth_l3_sys.c                     |   2 +-
 drivers/scsi/3w-xxxx.c                             |   4 +-
 drivers/scsi/lpfc/lpfc_els.c                       |  14 +-
 drivers/scsi/qedf/qedf_main.c                      |   3 +-
 drivers/soc/amlogic/meson-secure-pwrc.c            |   2 +-
 drivers/soc/fsl/qe/Kconfig                         |   1 +
 drivers/soc/mediatek/mtk-svs.c                     |   4 +-
 drivers/soc/qcom/qcom-geni-se.c                    |  67 +-
 drivers/soc/xilinx/xlnx_event_manager.c            |   6 +-
 drivers/soundwire/debugfs.c                        |   3 +-
 drivers/soundwire/qcom.c                           | 179 ++---
 drivers/spi/spi-bcm-qspi.c                         |  10 +-
 drivers/spi/spi-dw-core.c                          |   5 +-
 drivers/spi/spi-geni-qcom.c                        | 111 ++--
 drivers/staging/media/atomisp/i2c/atomisp-gc0310.c |   2 +-
 drivers/staging/media/atomisp/i2c/atomisp-ov2680.c |   8 +-
 drivers/staging/media/atomisp/i2c/ov2680.h         |   1 +
 .../media/atomisp/pci/atomisp_gmin_platform.c      |   2 +-
 .../vc04_services/interface/vchiq_arm/vchiq_arm.c  |   4 +-
 drivers/thermal/qcom/tsens-v0_1.c                  |  56 +-
 drivers/thermal/qcom/tsens.c                       |  19 +-
 drivers/thermal/qcom/tsens.h                       |   6 +-
 drivers/thermal/qoriq_thermal.c                    |  30 +-
 drivers/thermal/sun8i_thermal.c                    |  55 +-
 drivers/tty/serial/8250/8250_omap.c                |  25 +-
 drivers/tty/serial/fsl_lpuart.c                    |   1 +
 drivers/tty/serial/serial_core.c                   |  10 +-
 drivers/ufs/core/ufshcd-priv.h                     |   3 -
 drivers/ufs/core/ufshcd.c                          |  21 +-
 drivers/usb/core/devio.c                           |   2 +
 drivers/usb/core/hcd-pci.c                         |  24 +-
 drivers/usb/dwc2/platform.c                        |  16 +-
 drivers/usb/dwc3/dwc3-meson-g12a.c                 |   5 +-
 drivers/usb/dwc3/dwc3-qcom.c                       |  17 +-
 drivers/usb/dwc3/gadget.c                          |   4 +-
 drivers/usb/gadget/function/u_serial.c             |  13 +-
 drivers/usb/host/ehci-pci.c                        |   3 +-
 drivers/usb/host/ohci-pci.c                        |   8 +-
 drivers/usb/host/uhci-pci.c                        |   7 +-
 drivers/usb/host/xhci-histb.c                      |   2 +-
 drivers/usb/host/xhci-pci.c                        |   4 +-
 drivers/usb/host/xhci-plat.c                       |   4 +-
 drivers/usb/host/xhci-tegra.c                      |   2 +-
 drivers/usb/host/xhci.c                            |   5 +-
 drivers/usb/host/xhci.h                            |   2 +-
 drivers/usb/musb/musb_core.c                       |   1 -
 drivers/usb/musb/musb_core.h                       |   2 -
 drivers/usb/musb/tusb6010.c                        |  53 +-
 drivers/usb/phy/phy-tahvo.c                        |   2 +-
 drivers/usb/serial/option.c                        |   4 +
 drivers/usb/typec/ucsi/psy.c                       |  14 +
 drivers/vdpa/vdpa_user/vduse_dev.c                 |   6 +-
 drivers/vfio/mdev/mdev_core.c                      |  23 +-
 drivers/video/fbdev/omap/lcd_mipid.c               |  16 +-
 drivers/virt/coco/sev-guest/Kconfig                |   1 +
 drivers/virtio/virtio_vdpa.c                       |   4 +-
 drivers/w1/slaves/w1_therm.c                       |  31 +-
 drivers/w1/w1.c                                    |   4 +-
 fs/afs/write.c                                     |   8 +-
 fs/btrfs/bio.c                                     |   3 +-
 fs/btrfs/block-group.c                             |  41 +-
 fs/btrfs/ctree.c                                   |  49 +-
 fs/btrfs/disk-io.c                                 |   7 +-
 fs/btrfs/extent_io.c                               | 333 ++++------
 fs/btrfs/extent_io.h                               |   5 +-
 fs/btrfs/free-space-tree.c                         |   3 +
 fs/btrfs/inode.c                                   |  92 ++-
 fs/btrfs/locking.c                                 |   5 +-
 fs/btrfs/qgroup.c                                  |   2 +
 fs/btrfs/tree-mod-log.c                            | 115 +++-
 fs/erofs/zdata.c                                   |  72 +-
 fs/erofs/zmap.c                                    |   6 +-
 fs/ext4/namei.c                                    |  17 +-
 fs/f2fs/checkpoint.c                               |   7 +-
 fs/f2fs/compress.c                                 |  11 +-
 fs/f2fs/data.c                                     |  11 +-
 fs/f2fs/f2fs.h                                     |  23 +-
 fs/f2fs/file.c                                     |  13 +-
 fs/f2fs/gc.c                                       |  27 +-
 fs/f2fs/namei.c                                    |  16 +-
 fs/f2fs/node.c                                     |   7 +-
 fs/f2fs/super.c                                    | 160 ++++-
 fs/fs_context.c                                    |   3 +-
 fs/gfs2/file.c                                     |   2 +-
 fs/inode.c                                         |  42 ++
 fs/internal.h                                      |   2 +
 fs/jffs2/build.c                                   |   5 +-
 fs/jffs2/xattr.c                                   |  13 +-
 fs/jffs2/xattr.h                                   |   4 +-
 fs/kernfs/dir.c                                    |   2 +
 fs/lockd/svc.c                                     |   1 -
 fs/namei.c                                         |  25 +-
 fs/nfs/nfs42xattr.c                                |  79 ++-
 fs/nfs/nfs4proc.c                                  |   1 +
 fs/nfsd/cache.h                                    |   2 +
 fs/nfsd/nfs4xdr.c                                  |   2 +-
 fs/nfsd/nfscache.c                                 |  25 +-
 fs/nfsd/nfsctl.c                                   |  10 +-
 fs/nfsd/vfs.c                                      |   4 +-
 fs/notify/fanotify/fanotify_user.c                 |  14 +
 fs/ntfs3/xattr.c                                   |   3 +
 fs/ocfs2/cluster/tcp.c                             |  23 +-
 fs/overlayfs/copy_up.c                             |   2 +
 fs/overlayfs/dir.c                                 |   3 +-
 fs/overlayfs/export.c                              |   3 +-
 fs/overlayfs/inode.c                               |  17 +-
 fs/overlayfs/namei.c                               |   3 +-
 fs/overlayfs/overlayfs.h                           |   8 +-
 fs/overlayfs/super.c                               |   2 +-
 fs/overlayfs/util.c                                |  31 +-
 fs/pstore/ram_core.c                               |   2 +
 fs/ramfs/inode.c                                   |   2 +-
 fs/reiserfs/xattr_security.c                       |   1 +
 fs/smb/client/cifs_debug.c                         |  16 +-
 fs/smb/client/cifsglob.h                           |  10 +-
 fs/smb/client/cifsproto.h                          |   2 +-
 fs/smb/client/connect.c                            |  70 +-
 fs/smb/client/dfs.c                                |  55 +-
 fs/smb/client/dfs.h                                |  19 +-
 fs/smb/client/dfs_cache.c                          |   8 +-
 fs/smb/client/file.c                               |  25 +-
 fs/smb/client/misc.c                               |  38 +-
 fs/smb/client/smb2inode.c                          |   9 +-
 fs/smb/client/smb2ops.c                            |  19 +-
 fs/smb/client/transport.c                          |  20 +-
 fs/smb/server/smb_common.c                         |   2 +-
 fs/splice.c                                        |   1 -
 fs/udf/namei.c                                     |  14 +-
 fs/verity/enable.c                                 |  19 +-
 fs/verity/fsverity_private.h                       |  13 +-
 fs/verity/hash_algs.c                              | 131 +---
 fs/verity/verify.c                                 | 113 ++--
 include/drm/bridge/samsung-dsim.h                  |   3 +
 include/drm/drm_fixed.h                            |   6 +
 include/linux/bitmap.h                             |   8 +-
 include/linux/blk-mq.h                             |   3 +-
 include/linux/blkdev.h                             |   3 +-
 include/linux/blktrace_api.h                       |   6 +-
 include/linux/bpf.h                                |   1 -
 include/linux/bpf_verifier.h                       |  52 +-
 include/linux/can/length.h                         |  14 +-
 include/linux/compiler_attributes.h                |  12 +
 include/linux/dsa/sja1105.h                        |   4 -
 include/linux/ieee80211.h                          |   6 +-
 include/linux/mfd/tps65010.h                       |  11 +-
 include/linux/mfd/twl.h                            |   3 -
 include/linux/mm_types.h                           |  23 +-
 include/linux/mmc/card.h                           |   1 +
 include/linux/netdevice.h                          |   9 +
 include/linux/nmi.h                                |  35 +-
 include/linux/pci.h                                |   1 +
 include/linux/perf/arm_pmu.h                       |   2 +
 include/linux/pipe_fs_i.h                          |   4 -
 include/linux/platform_data/lcd-mipid.h            |   2 -
 include/linux/platform_data/mmc-omap.h             |   2 -
 include/linux/ramfs.h                              |   1 +
 include/linux/sh_intc.h                            |   6 +-
 include/linux/soc/qcom/geni-se.h                   |   4 +
 include/linux/spi/ads7846.h                        |   2 -
 include/linux/usb/hcd.h                            |   2 +-
 include/linux/usb/musb.h                           |  13 -
 include/linux/watch_queue.h                        |   3 +-
 include/net/bluetooth/mgmt.h                       |   1 +
 include/net/dsa.h                                  |  12 +-
 include/net/mac80211.h                             |  44 +-
 include/net/regulatory.h                           |  13 +-
 include/net/sock.h                                 |   1 +
 include/soc/mscc/ocelot.h                          |  10 +-
 include/trace/events/net.h                         |   3 +-
 include/trace/events/timer.h                       |   6 +-
 include/uapi/linux/affs_hardblocks.h               |  68 +-
 include/uapi/linux/auto_dev-ioctl.h                |   2 +-
 include/uapi/linux/videodev2.h                     |   6 +-
 include/ufs/ufshcd.h                               |   1 -
 init/Makefile                                      |   1 +
 init/main.c                                        |   3 +-
 io_uring/io_uring.c                                |  35 +-
 kernel/bpf/btf.c                                   |   6 +-
 kernel/bpf/cgroup.c                                |  15 +
 kernel/bpf/helpers.c                               |  12 +-
 kernel/bpf/trampoline.c                            |  32 +-
 kernel/bpf/verifier.c                              | 716 +++++++++++++++-----
 kernel/kcsan/core.c                                |   2 +
 kernel/kexec_core.c                                |   5 +-
 kernel/rcu/rcu.h                                   |   6 +
 kernel/rcu/rcuscale.c                              | 199 +++---
 kernel/rcu/tasks.h                                 |   7 +-
 kernel/rcu/tree.c                                  |  23 +-
 kernel/sched/fair.c                                |  18 +
 kernel/sched/sched.h                               |  22 +
 kernel/time/posix-timers.c                         |  43 +-
 kernel/time/tick-sched.c                           |   2 +-
 kernel/watch_queue.c                               |  12 +-
 kernel/watchdog.c                                  | 302 ++++++---
 kernel/watchdog_hld.c                              |  48 +-
 lib/bitmap.c                                       |   2 +-
 lib/dhry_1.c                                       |  11 +-
 lib/test_firmware.c                                |  12 +-
 lib/ts_bm.c                                        |   4 +-
 mm/damon/ops-common.c                              |  16 +-
 mm/damon/ops-common.h                              |   4 +-
 mm/damon/paddr.c                                   |   4 +-
 mm/damon/vaddr.c                                   |   4 +-
 mm/filemap.c                                       |   4 +-
 mm/page-writeback.c                                |   8 +-
 mm/shmem.c                                         |   2 +-
 mm/vmscan.c                                        |  13 +-
 net/bluetooth/hci_conn.c                           |  47 +-
 net/bluetooth/hci_event.c                          |  15 +-
 net/bluetooth/hci_sync.c                           |  28 +-
 net/bridge/br_if.c                                 |   5 +-
 net/core/filter.c                                  | 126 +++-
 net/core/rtnetlink.c                               | 104 +--
 net/core/sock.c                                    |  17 +-
 net/dsa/dsa.c                                      |   2 +-
 net/dsa/slave.c                                    |  84 ++-
 net/dsa/switch.c                                   |   4 +-
 net/dsa/switch.h                                   |   3 +
 net/dsa/tag_sja1105.c                              |  90 +--
 net/handshake/handshake.h                          |   1 +
 net/handshake/request.c                            |   4 +
 net/ipv4/tcp_input.c                               |  12 +-
 net/mac80211/debugfs_netdev.c                      |   2 +-
 net/mac80211/eht.c                                 |   5 +-
 net/mac80211/he.c                                  |   3 +-
 net/mac80211/mlme.c                                |  30 +-
 net/mac80211/sta_info.c                            |   2 +
 net/mac80211/util.c                                |  15 +-
 net/netfilter/ipvs/Kconfig                         |  27 +-
 net/netfilter/ipvs/ip_vs_conn.c                    |   4 +-
 net/netfilter/nf_conntrack_helper.c                |   4 +
 net/netfilter/nf_conntrack_proto_dccp.c            |  52 +-
 net/netfilter/nf_conntrack_sip.c                   |   2 +-
 net/netfilter/nf_tables_api.c                      |  17 +-
 net/netfilter/nft_byteorder.c                      |  14 +-
 net/netlink/af_netlink.c                           |   5 +-
 net/netlink/diag.c                                 |   7 +-
 net/nfc/llcp.h                                     |   1 -
 net/nfc/llcp_commands.c                            |  15 +-
 net/nfc/llcp_core.c                                |  49 +-
 net/nfc/llcp_sock.c                                |  18 +-
 net/nfc/netlink.c                                  |  20 +-
 net/nfc/nfc.h                                      |   1 +
 net/sched/act_ipt.c                                |  70 +-
 net/sched/act_pedit.c                              |   1 +
 net/sched/sch_netem.c                              |  59 +-
 net/sctp/socket.c                                  |  22 +-
 net/sunrpc/svcsock.c                               |  23 +-
 net/sunrpc/xprtrdma/svc_rdma_recvfrom.c            |  12 +-
 net/wireless/core.c                                |  16 -
 net/wireless/reg.c                                 |  16 +-
 net/wireless/scan.c                                | 367 ++++-------
 net/wireless/util.c                                |   2 +
 net/xdp/xsk.c                                      |   5 +
 samples/bpf/tcp_basertt_kern.c                     |   2 +-
 samples/bpf/xdp1_kern.c                            |   2 +-
 samples/bpf/xdp2_kern.c                            |   2 +-
 scripts/Makefile.clang                             |   3 +-
 scripts/Makefile.compiler                          |   4 +-
 scripts/Makefile.modfinal                          |   2 +-
 scripts/Makefile.vmlinux                           |   1 +
 scripts/mksysmap                                   |   4 +-
 scripts/mod/modpost.c                              |  86 +--
 scripts/package/builddeb                           |  14 +-
 security/apparmor/policy.c                         |  13 +
 security/apparmor/policy_compat.c                  |  20 +-
 security/apparmor/policy_unpack.c                  | 100 +--
 security/integrity/evm/evm_crypto.c                |   2 +-
 security/integrity/evm/evm_main.c                  |   4 +-
 security/integrity/iint.c                          |  15 +-
 security/integrity/ima/ima_modsig.c                |   3 +
 security/integrity/ima/ima_policy.c                |   3 +-
 sound/core/jack.c                                  |  15 +-
 sound/core/pcm_memory.c                            |  44 +-
 sound/pci/ac97/ac97_codec.c                        |   4 +-
 sound/pci/hda/patch_realtek.c                      |   7 +-
 sound/soc/amd/acp/acp-pdm.c                        |   2 +-
 sound/soc/codecs/es8316.c                          |  23 +-
 sound/soc/fsl/imx-audmix.c                         |   9 +
 sound/soc/intel/boards/sof_sdw.c                   |  18 +-
 sound/soc/mediatek/mt8173/mt8173-afe-pcm.c         |  13 +-
 tools/bpf/bpftool/feature.c                        |  24 +-
 tools/bpf/resolve_btfids/Makefile                  |   4 +-
 tools/include/nolibc/stdint.h                      |  10 +-
 tools/lib/bpf/bpf_helpers.h                        |  15 +-
 tools/lib/bpf/btf_dump.c                           |  22 +-
 tools/perf/arch/x86/util/Build                     |   1 +
 tools/perf/arch/x86/util/env.c                     |  19 +
 tools/perf/arch/x86/util/env.h                     |   7 +
 tools/perf/arch/x86/util/evsel.c                   |  16 +-
 tools/perf/arch/x86/util/mem-events.c              |  19 +-
 tools/perf/builtin-bench.c                         |   2 +
 tools/perf/builtin-script.c                        |  16 +-
 tools/perf/builtin-stat.c                          |   2 +
 tools/perf/tests/shell/test_task_analyzer.sh       |  26 +-
 tools/perf/util/bpf_skel/lock_contention.bpf.c     |   2 -
 tools/perf/util/bpf_skel/vmlinux.h                 |  10 +
 tools/perf/util/dwarf-aux.c                        |   2 +-
 tools/perf/util/evsel.h                            |  24 +-
 tools/perf/util/evsel_fprintf.c                    |   1 +
 tools/perf/util/metricgroup.c                      |   2 +-
 tools/testing/cxl/test/mem.c                       |   4 +-
 tools/testing/kunit/kunit_kernel.py                |   6 +-
 tools/testing/kunit/mypy.ini                       |   6 +
 tools/testing/kunit/run_checks.py                  |   2 +-
 tools/testing/selftests/bpf/Makefile               |   3 +-
 tools/testing/selftests/bpf/prog_tests/check_mtu.c |   2 +-
 .../testing/selftests/bpf/progs/refcounted_kptr.c  |   2 +
 .../selftests/bpf/progs/refcounted_kptr_fail.c     |   4 +-
 tools/testing/selftests/bpf/test_verifier.c        |  24 +-
 tools/testing/selftests/bpf/verifier/precise.c     | 106 +--
 tools/testing/selftests/cgroup/test_memcontrol.c   |   4 +-
 tools/testing/selftests/ftrace/ftracetest          |   2 +-
 tools/testing/selftests/net/rtnetlink.sh           |   1 +
 tools/testing/selftests/nolibc/nolibc-test.c       |   6 +-
 .../rcutorture/configs/rcu/BUSTED-BOOST.boot       |   2 +-
 .../selftests/rcutorture/configs/rcu/TREE03.boot   |   2 +-
 .../selftests/vDSO/vdso_test_clock_getres.c        |   4 +-
 tools/testing/selftests/wireguard/netns.sh         |  30 +-
 tools/tracing/rtla/src/osnoise_top.c               |   8 +-
 tools/virtio/Makefile                              |  13 +-
 877 files changed, 10447 insertions(+), 6356 deletions(-)
author maintainer
#1 lore raw

PATCH 1/800 start_kernel: Add __no_stack_protector function attribute

From: [email protected] <[email protected]>

commit 514ca14ed5444b911de59ed3381dfd195d99fe4b upstream.

Back during the discussion of
commit a9a3ed1eff36 ("x86: Fix early boot crash on gcc-10, third try") we discussed the need for a function attribute to control the omission of stack protectors on a per-function basis; at the time Clang had support for no_stack_protector but GCC did not. This was fixed in gcc-11. Now that the function attribute is available, let's start using it.

Callers of boot_init_stack_canary need to use this function attribute unless they're compiled with -fno-stack-protector, otherwise the canary stored in the stack slot of the caller will differ upon the call to boot_init_stack_canary. This will lead to a call to __stack_chk_fail() then panic.

---
 arch/powerpc/kernel/smp.c           |    1 +
 include/linux/compiler_attributes.h |   12 ++++++++++++
 init/main.c                         |    3 ++-
 3 files changed, 15 insertions(+), 1 deletion(-)
arch/powerpc/kernel/smp.c +1 -0
@@ -1605,6 +1605,7 @@ static void add_cpu_to_masks(int cpu)
 }
 
 /* Activate a secondary processor. */
+__no_stack_protector
 void start_secondary(void *unused)
 {
 	unsigned int cpu = raw_smp_processor_id();
include/linux/compiler_attributes.h +12 -0
@@ -256,6 +256,18 @@
 #define __noreturn                      __attribute__((__noreturn__))
 
 /*
+ * Optional: only supported since GCC >= 11.1, clang >= 7.0.
+ *
+ *   gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-no_005fstack_005fprotector-function-attribute
+ *   clang: https://clang.llvm.org/docs/AttributeReference.html#no-stack-protector-safebuffers
+ */
+#if __has_attribute(__no_stack_protector__)
+# define __no_stack_protector		__attribute__((__no_stack_protector__))
+#else
+# define __no_stack_protector
+#endif
+
+/*
  * Optional: not supported by gcc.
  *
  * clang: https://clang.llvm.org/docs/AttributeReference.html#overloadable
init/main.c +2 -1
@@ -877,7 +877,8 @@ static void __init print_unknown_bootopt
 	memblock_free(unknown_options, len);
 }
 
-asmlinkage __visible void __init __no_sanitize_address __noreturn start_kernel(void)
+asmlinkage __visible __init __no_sanitize_address __noreturn __no_stack_protector
+void start_kernel(void)
 {
 	char *command_line;
 	char *after_dashes;
author maintainer
#2 lore raw

PATCH 2/800 USB: serial: option: add LARA-R6 01B PIDs

In reply to Greg Kroah-Hartman

From: Davide Tronchin <[email protected]>

commit ffa5f7a3bf28c1306eef85d4056539c2d4b8eb09 upstream.

The new LARA-R6 product variant identified by the "01B" string can be configured (by AT interface) in three different USB modes:

* Default mode (Vendor ID: 0x1546 Product ID: 0x1311) with 4 serial interfaces

* RmNet mode (Vendor ID: 0x1546 Product ID: 0x1312) with 4 serial interfaces and 1 RmNet virtual network interface

* CDC-ECM mode (Vendor ID: 0x1546 Product ID: 0x1313) with 4 serial interface and 1 CDC-ECM virtual network interface
The first 4 interfaces of all the 3 USB configurations (default, RmNet, CDC-ECM) are the same.

In default mode LARA-R6 01B exposes the following interfaces:
If 0: Diagnostic
If 1: AT parser
If 2: AT parser
If 3: AT parser/alternative functions

In RmNet mode LARA-R6 01B exposes the following interfaces:
If 0: Diagnostic
If 1: AT parser
If 2: AT parser
If 3: AT parser/alternative functions
If 4: RMNET interface

In CDC-ECM mode LARA-R6 01B exposes the following interfaces:
If 0: Diagnostic
If 1: AT parser
If 2: AT parser
If 3: AT parser/alternative functions
If 4: CDC-ECM interface

---
 drivers/usb/serial/option.c |    4 ++++
 1 file changed, 4 insertions(+)
drivers/usb/serial/option.c +4 -0
@@ -1151,6 +1151,10 @@ static const struct usb_device_id option
 	{ USB_DEVICE(QUALCOMM_VENDOR_ID, 0x90fa),
 	  .driver_info = RSVD(3) },
 	/* u-blox products */
+	{ USB_DEVICE(UBLOX_VENDOR_ID, 0x1311) },	/* u-blox LARA-R6 01B */
+	{ USB_DEVICE(UBLOX_VENDOR_ID, 0x1312),		/* u-blox LARA-R6 01B (RMNET) */
+	  .driver_info = RSVD(4) },
+	{ USB_DEVICE_INTERFACE_CLASS(UBLOX_VENDOR_ID, 0x1313, 0xff) },	/* u-blox LARA-R6 01B (ECM) */
 	{ USB_DEVICE(UBLOX_VENDOR_ID, 0x1341) },	/* u-blox LARA-L6 */
 	{ USB_DEVICE(UBLOX_VENDOR_ID, 0x1342),		/* u-blox LARA-L6 (RMNET) */
 	  .driver_info = RSVD(4) },
author maintainer
#3 lore raw

PATCH 3/800 usb: dwc3: gadget: Propagate core init errors to UDC during pullup

In reply to Greg Kroah-Hartman

From: Krishna Kurapati <[email protected]>

commit c0aabed9cabe057309779a9e26fe86a113d24dad upstream.

In scenarios where pullup relies on resume (get sync) to initialize the controller and set the run stop bit, then core_init is followed by gadget_resume which will eventually set run stop bit.

But in cases where the core_init fails, the return value is not sent back to udc appropriately. So according to UDC the controller has started but in reality we never set the run stop bit.

On systems like Android, there are uevents sent to HAL depending on whether the configfs_bind / configfs_disconnect were invoked. In the above mentioned scnenario, if the core init fails, the run stop won't be set and the cable plug-out won't result in generation of any disconnect event and userspace would never get any uevent regarding cable plug out and we never call pullup(0) again. Furthermore none of the next Plug-In/Plug-Out's would be known to configfs.

Return back the appropriate result to UDC to let the userspace/ configfs know that the pullup failed so they can take appropriate action.

Fixes 77adb8bdf422 ("usb: dwc3: gadget: Allow runtime suspend if UDC unbinded")
Cc stable <[email protected]>

Message-ID: <[email protected]>

---
 drivers/usb/dwc3/gadget.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/dwc3/gadget.c +3 -1
@@ -2744,7 +2744,9 @@ static int dwc3_gadget_pullup(struct usb
 	ret = pm_runtime_get_sync(dwc->dev);
 	if (!ret || ret < 0) {
 		pm_runtime_put(dwc->dev);
-		return 0;
+		if (ret < 0)
+			pm_runtime_set_suspended(dwc->dev);
+		return ret;
 	}
 
 	if (dwc->pullups_connected == is_on) {
author maintainer
#4 lore raw

PATCH 4/800 phy: tegra: xusb: Clear the driver reference in usb-phy dev

In reply to Greg Kroah-Hartman

From: EJ Hsu <[email protected]>

commit c0c2fcb1325d0d4f3b322b5ee49385f8eca2560d upstream.

For the dual-role port, it will assign the phy dev to usb-phy dev and use the port dev driver as the dev driver of usb-phy.

When we try to destroy the port dev, it will destroy its dev driver as well. But we did not remove the reference from usb-phy dev. This might cause the use-after-free issue in KASAN.

Fixes e8f7d2f409a1 ("phy: tegra: xusb: Add usb-phy support")
---
 drivers/phy/tegra/xusb.c |    1 +
 1 file changed, 1 insertion(+)
drivers/phy/tegra/xusb.c +1 -0
@@ -568,6 +568,7 @@ static void tegra_xusb_port_unregister(s
 		usb_role_switch_unregister(port->usb_role_sw);
 		cancel_work_sync(&port->usb_phy_work);
 		usb_remove_phy(&port->usb_phy);
+		port->usb_phy.dev->driver = NULL;
 	}
 
 	if (port->ops->remove)
author maintainer
#5 lore raw

PATCH 5/800 extcon: usbc-tusb320: Unregister typec port on driver removal

In reply to Greg Kroah-Hartman

From: Alvin Šipraga <[email protected]>

commit 3adbaa30d973093a4f37927baf9596cca51b593d upstream.

The driver can register a typec port if suitable firmware properties are present. But if the driver is removed through sysfs unbind, rmmod or similar, then it does not clean up after itself and the typec port device remains registered. This can be seen in sysfs, where stale typec ports get left over in /sys/class/typec.

In order to fix this we have to add an i2c_driver remove function and call typec_unregister_port(), which is a no-op in the case where no typec port is created and the pointer remains NULL.

In the process we should also put the fwnode_handle when the typec port isn't registered anymore, including if an error occurs during probe. The typec subsystem does not increase or decrease the reference counter for us, so we track it in the driver's private data.

Note that the conditional check on TYPEC_PWR_MODE_PD was removed in the probe path because a call to tusb320_set_adv_pwr_mode() will perform an even more robust validation immediately after, hence there is no functional change here.

Fixes bf7571c00dca ("extcon: usbc-tusb320: Add USB TYPE-C support")
---
 drivers/extcon/extcon-usbc-tusb320.c |   42 ++++++++++++++++++++++++++++-------
 1 file changed, 34 insertions(+), 8 deletions(-)
drivers/extcon/extcon-usbc-tusb320.c +34 -8
@@ -78,6 +78,7 @@ struct tusb320_priv {
 	struct typec_capability	cap;
 	enum typec_port_type port_type;
 	enum typec_pwr_opmode pwr_opmode;
+	struct fwnode_handle *connector_fwnode;
 };
 
 static const char * const tusb_attached_states[] = {
@@ -391,27 +392,25 @@ static int tusb320_typec_probe(struct i2
 	/* Type-C connector found. */
 	ret = typec_get_fw_cap(&priv->cap, connector);
 	if (ret)
-		return ret;
+		goto err_put;
 
 	priv->port_type = priv->cap.type;
 
 	/* This goes into register 0x8 field CURRENT_MODE_ADVERTISE */
 	ret = fwnode_property_read_string(connector, "typec-power-opmode", &cap_str);
 	if (ret)
-		return ret;
+		goto err_put;
 
 	ret = typec_find_pwr_opmode(cap_str);
 	if (ret < 0)
-		return ret;
-	if (ret == TYPEC_PWR_MODE_PD)
-		return -EINVAL;
+		goto err_put;
 
 	priv->pwr_opmode = ret;
 
 	/* Initialize the hardware with the devicetree settings. */
 	ret = tusb320_set_adv_pwr_mode(priv);
 	if (ret)
-		return ret;
+		goto err_put;
 
 	priv->cap.revision		= USB_TYPEC_REV_1_1;
 	priv->cap.accessory[0]		= TYPEC_ACCESSORY_AUDIO;
@@ -422,10 +421,25 @@ static int tusb320_typec_probe(struct i2
 	priv->cap.fwnode		= connector;
 
 	priv->port = typec_register_port(&client->dev, &priv->cap);
-	if (IS_ERR(priv->port))
-		return PTR_ERR(priv->port);
+	if (IS_ERR(priv->port)) {
+		ret = PTR_ERR(priv->port);
+		goto err_put;
+	}
+
+	priv->connector_fwnode = connector;
 
 	return 0;
+
+err_put:
+	fwnode_handle_put(connector);
+
+	return ret;
+}
+
+static void tusb320_typec_remove(struct tusb320_priv *priv)
+{
+	typec_unregister_port(priv->port);
+	fwnode_handle_put(priv->connector_fwnode);
 }
 
 static int tusb320_probe(struct i2c_client *client)
@@ -438,7 +452,9 @@ static int tusb320_probe(struct i2c_clie
 	priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
+
 	priv->dev = &client->dev;
+	i2c_set_clientdata(client, priv);
 
 	priv->regmap = devm_regmap_init_i2c(client, &tusb320_regmap_config);
 	if (IS_ERR(priv->regmap))
@@ -489,10 +505,19 @@ static int tusb320_probe(struct i2c_clie
 					tusb320_irq_handler,
 					IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
 					client->name, priv);
+	if (ret)
+		tusb320_typec_remove(priv);
 
 	return ret;
 }
 
+static void tusb320_remove(struct i2c_client *client)
+{
+	struct tusb320_priv *priv = i2c_get_clientdata(client);
+
+	tusb320_typec_remove(priv);
+}
+
 static const struct of_device_id tusb320_extcon_dt_match[] = {
 	{ .compatible = "ti,tusb320", .data = &tusb320_ops, },
 	{ .compatible = "ti,tusb320l", .data = &tusb320l_ops, },
@@ -502,6 +527,7 @@ MODULE_DEVICE_TABLE(of, tusb320_extcon_d
 
 static struct i2c_driver tusb320_extcon_driver = {
 	.probe_new	= tusb320_probe,
+	.remove		= tusb320_remove,
 	.driver		= {
 		.name	= "extcon-tusb320",
 		.of_match_table = tusb320_extcon_dt_match,
author maintainer
#6 lore raw

PATCH 6/800 dt-bindings: iio: ad7192: Add mandatory reference voltage source

In reply to Greg Kroah-Hartman

From: Fabrizio Lamarque <[email protected]>

commit c6dab7245604862d86f0b6d764919f470584d24f upstream.

Add required reference voltage (VRef) supply regulator.

AD7192 requires three independent voltage sources: DVdd, AVdd and VRef (on REFINx pin pairs).

---
 Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml |    5 +++++
 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml +5 -0
@@ -47,6 +47,9 @@ properties:
   avdd-supply:
     description: AVdd voltage supply
 
+  vref-supply:
+    description: VRef voltage supply
+
   adi,rejection-60-Hz-enable:
     description: |
       This bit enables a notch at 60 Hz when the first notch of the sinc
@@ -89,6 +92,7 @@ required:
   - interrupts
   - dvdd-supply
   - avdd-supply
+  - vref-supply
   - spi-cpol
   - spi-cpha
 
@@ -115,6 +119,7 @@ examples:
             interrupt-parent = <&gpio>;
             dvdd-supply = <&dvdd>;
             avdd-supply = <&avdd>;
+            vref-supply = <&vref>;
 
             adi,refin2-pins-enable;
             adi,rejection-60-Hz-enable;
author maintainer
#7 lore raw

PATCH 7/800 iio: addac: ad74413: dont set DIN_SINK for functions other than digital input

In reply to Greg Kroah-Hartman

From: Rasmus Villemoes <[email protected]>

commit a4cba07e64e6ec22d9504a1a45d29afa863dc19c upstream.

Apparently, despite the name Digital Input Configuration Register, the settings in the DIN_CONFIGx registers also affect other channel functions. In particular, setting a non-zero value in the DIN_SINK field breaks the resistance measurement function.

Now, one can of course argue that specifying a drive-strength-microamp property along with a adi,ch-func which is not one of the digital input functions is a bug in the device tree. However, we have a rather complicated setup with instances of ad74412r on external hardware modules, and have set a default drive-strength-microamp in our DT fragments describing those, merely modifying the adi,ch-func settings to reflect however the modules have been wired up. And restricting this setting to just being done for digital input doesn't make the driver any more complex.

Fixes 504eb485589d1 (iio: ad74413r: wire up support for drive-strength-microamp property)
---
 drivers/iio/addac/ad74413r.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/iio/addac/ad74413r.c +6 -5
index e3366cf5eb31..6b0e8218f150 100644
@@ -1317,13 +1317,14 @@ static int ad74413r_setup_gpios(struct ad74413r_state *st)
 		}
 
 		if (config->func == CH_FUNC_DIGITAL_INPUT_LOGIC ||
-		    config->func == CH_FUNC_DIGITAL_INPUT_LOOP_POWER)
+		    config->func == CH_FUNC_DIGITAL_INPUT_LOOP_POWER) {
 			st->comp_gpio_offsets[comp_gpio_i++] = i;
 
-		strength = config->drive_strength;
-		ret = ad74413r_set_comp_drive_strength(st, i, strength);
-		if (ret)
-			return ret;
+			strength = config->drive_strength;
+			ret = ad74413r_set_comp_drive_strength(st, i, strength);
+			if (ret)
+				return ret;
+		}
 
 		ret = ad74413r_set_gpo_config(st, i, gpo_config);
 		if (ret)
Signature · 1 line
2.41.0
author maintainer
#8 lore raw

PATCH 8/800 iio: adc: ad7192: Fix null ad7192_state pointer access

In reply to Greg Kroah-Hartman

From: Fabrizio Lamarque <[email protected]>

commit 9e58e3a6f8e1c483c86a04903b7b7aa0923e4426 upstream.

Pointer to indio_dev structure is obtained via spi_get_drvdata() at the beginning of function ad7192_setup(), but the spi->dev->driver_data member is not initialized, hence a NULL pointer is returned.

Fix by changing ad7192_setup() signature to take pointer to struct iio_dev, and get ad7192_state pointer via st = iio_priv(indio_dev);

---
 drivers/iio/adc/ad7192.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/adc/ad7192.c +3 -3
@@ -380,9 +380,9 @@ static int ad7192_of_clock_select(struct
 	return clock_sel;
 }
 
-static int ad7192_setup(struct ad7192_state *st, struct device_node *np)
+static int ad7192_setup(struct iio_dev *indio_dev, struct device_node *np)
 {
-	struct iio_dev *indio_dev = spi_get_drvdata(st->sd.spi);
+	struct ad7192_state *st = iio_priv(indio_dev);
 	bool rej60_en, refin2_en;
 	bool buf_en, bipolar, burnout_curr_en;
 	unsigned long long scale_uv;
@@ -1069,7 +1069,7 @@ static int ad7192_probe(struct spi_devic
 		}
 	}
 
-	ret = ad7192_setup(st, spi->dev.of_node);
+	ret = ad7192_setup(indio_dev, spi->dev.of_node);
 	if (ret)
 		return ret;
 
author maintainer
#9 lore raw

PATCH 9/800 iio: adc: ad7192: Fix internal/external clock selection

In reply to Greg Kroah-Hartman

From: Fabrizio Lamarque <[email protected]>

commit f7d9e21dd274b97dc0a8dbc136a2ea8506063a96 upstream.

Fix wrong selection of internal clock when mclk is defined.

Resolve a logical inversion introduced in c9ec2cb328e3.

Fixes c9ec2cb328e3 ("iio: adc: ad7192: use devm_clk_get_optional() for mclk")
---
 drivers/iio/adc/ad7192.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ad7192.c +1 -1
@@ -367,7 +367,7 @@ static int ad7192_of_clock_select(struct
 	clock_sel = AD7192_CLK_INT;
 
 	/* use internal clock */
-	if (st->mclk) {
+	if (!st->mclk) {
 		if (of_property_read_bool(np, "adi,int-clock-output-enable"))
 			clock_sel = AD7192_CLK_INT_CO;
 	} else {
author maintainer
#10 lore raw

PATCH 10/800 iio: accel: fxls8962af: errata bug only applicable for FXLS8962AF

In reply to Greg Kroah-Hartman

From: Sean Nyekjaer <[email protected]>

commit b410a9307bc3a7cdee3c930c98f6fc9cf1d2c484 upstream.

Remove special errata handling if FXLS8964AF is used.

Fixes af959b7b96b8 ("iio: accel: fxls8962af: fix errata bug E3 - I2C burst reads")
---
 drivers/iio/accel/fxls8962af-core.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/iio/accel/fxls8962af-core.c +3 -2
@@ -904,9 +904,10 @@ static int fxls8962af_fifo_transfer(stru
 	int total_length = samples * sample_length;
 	int ret;
 
-	if (i2c_verify_client(dev))
+	if (i2c_verify_client(dev) &&
+	    data->chip_info->chip_id == FXLS8962AF_DEVICE_ID)
 		/*
-		 * Due to errata bug:
+		 * Due to errata bug (only applicable on fxls8962af):
 		 * E3: FIFO burst read operation error using I2C interface
 		 * We have to avoid burst reads on I2C..
 		 */
author maintainer
#11 lore raw

PATCH 11/800 iio: accel: fxls8962af: fixup buffer scan element type

In reply to Greg Kroah-Hartman

From: Sean Nyekjaer <[email protected]>

commit d1cfbd52ede5e5fabc09992894c5733b4057f159 upstream.

Scan elements for x,y,z channels is little endian and requires no bit shifts. LE vs. BE is controlled in register SENS_CONFIG2 and bit LE_BE, default value is LE.

Fixes a3e0b51884ee ("iio: accel: add support for FXLS8962AF/FXLS8964AF accelerometers")
---
 drivers/iio/accel/fxls8962af-core.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iio/accel/fxls8962af-core.c +1 -2
@@ -724,8 +724,7 @@ static const struct iio_event_spec fxls8
 		.sign = 's', \
 		.realbits = 12, \
 		.storagebits = 16, \
-		.shift = 4, \
-		.endianness = IIO_BE, \
+		.endianness = IIO_LE, \
 	}, \
 	.event_spec = fxls8962af_event, \
 	.num_event_specs = ARRAY_SIZE(fxls8962af_event), \
author maintainer
#12 lore raw

PATCH 12/800 Revert "drm/amd/display: edp do not add non-edid timings"

In reply to Greg Kroah-Hartman

From: Hersen Wu <[email protected]>

commit d6149086b45e150c170beaa4546495fd1880724c upstream.

This change causes regression when eDP and external display in mirror mode. When external display supports low resolution than eDP, use eDP timing to driver external display may cause corruption on external display.

This reverts commit e749dd10e5f292061ad63d2b030194bf7d7d452c.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -7
@@ -7196,13 +7196,7 @@ static int amdgpu_dm_connector_get_modes
 				drm_add_modes_noedid(connector, 1920, 1080);
 	} else {
 		amdgpu_dm_connector_ddc_get_modes(connector, edid);
-		/* most eDP supports only timings from its edid,
-		 * usually only detailed timings are available
-		 * from eDP edid. timings which are not from edid
-		 * may damage eDP
-		 */
-		if (connector->connector_type != DRM_MODE_CONNECTOR_eDP)
-			amdgpu_dm_connector_add_common_modes(encoder, connector);
+		amdgpu_dm_connector_add_common_modes(encoder, connector);
 		amdgpu_dm_connector_add_freesync_modes(connector, edid);
 	}
 	amdgpu_dm_fbc_init(connector);
author maintainer
#13 lore raw

PATCH 13/800 fs: pipe: reveal missing function protoypes

In reply to Greg Kroah-Hartman

From: Arnd Bergmann <[email protected]>

[ Upstream commit 247c8d2f9837a3e29e3b6b7a4aa9c36c37659dd4 ]

A couple of functions from fs/pipe.c are used both internally and for the watch queue code, but the declaration is only visible when the latter is enabled:

fs/pipe.c:1254:5: error: no previous prototype for 'pipe_resize_ring' fs/pipe.c:758:15: error: no previous prototype for 'account_pipe_buffers' fs/pipe.c:764:6: error: no previous prototype for 'too_many_pipe_buffers_soft' fs/pipe.c:771:6: error: no previous prototype for 'too_many_pipe_buffers_hard' fs/pipe.c:777:6: error: no previous prototype for 'pipe_is_unprivileged_user'

Make the visible unconditionally to avoid these warnings.

Fixes c73be61cede5 ("pipe: Add general notification queue support")

Message-Id: <[email protected]>

---
 include/linux/pipe_fs_i.h | 4 ----
 1 file changed, 4 deletions(-)
include/linux/pipe_fs_i.h +0 -4
index d2c3f16cf6b18..02e0086b10f6f 100644
@@ -261,18 +261,14 @@ void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *);
 
 extern const struct pipe_buf_operations nosteal_pipe_buf_ops;
 
-#ifdef CONFIG_WATCH_QUEUE
 unsigned long account_pipe_buffers(struct user_struct *user,
 				   unsigned long old, unsigned long new);
 bool too_many_pipe_buffers_soft(unsigned long user_bufs);
 bool too_many_pipe_buffers_hard(unsigned long user_bufs);
 bool pipe_is_unprivileged_user(void);
-#endif
 
 /* for F_SETPIPE_SZ and F_GETPIPE_SZ */
-#ifdef CONFIG_WATCH_QUEUE
 int pipe_resize_ring(struct pipe_inode_info *pipe, unsigned int nr_slots);
-#endif
 long pipe_fcntl(struct file *, unsigned int, unsigned long arg);
 struct pipe_inode_info *get_pipe_info(struct file *file, bool for_splice);
 
Signature · 1 line
2.39.2
author maintainer
#14 lore raw

PATCH 14/800 s390/kasan: fix insecure W+X mapping warning

In reply to Greg Kroah-Hartman

From: Alexander Gordeev <[email protected]>

[ Upstream commit 2ed8b509753a0454b52b2d72e982265472c8d861 ]

Since commit 3b5c3f000c2e ("s390/kasan: move shadow mapping to decompressor") the decompressor establishes mappings for the shadow memory and sets initial protection attributes to RWX. The decompressed kernel resets protection to RW+NX later on.

In case a shadow memory range is not aligned on page boundary (e.g. as result of mem= kernel command line parameter use), the "Checked W+X mappings: FAILED, 1 W+X pages found" warning hits.

Fixes 557b19709da9 ("s390/kasan: move shadow mapping to decompressor")
---
 arch/s390/mm/vmem.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
arch/s390/mm/vmem.c +10 -4
index 5b22c6e24528a..b9dcb4ae6c59a 100644
@@ -667,7 +667,15 @@ static void __init memblock_region_swap(void *a, void *b, int size)
 
 #ifdef CONFIG_KASAN
 #define __sha(x)	((unsigned long)kasan_mem_to_shadow((void *)x))
+
+static inline int set_memory_kasan(unsigned long start, unsigned long end)
+{
+	start = PAGE_ALIGN_DOWN(__sha(start));
+	end = PAGE_ALIGN(__sha(end));
+	return set_memory_rwnx(start, (end - start) >> PAGE_SHIFT);
+}
 #endif
+
 /*
  * map whole physical memory to virtual memory (identity mapping)
  * we reserve enough space in the vmalloc area for vmemmap to hotplug
@@ -737,10 +745,8 @@ void __init vmem_map_init(void)
 	}
 
 #ifdef CONFIG_KASAN
-	for_each_mem_range(i, &base, &end) {
-		set_memory_rwnx(__sha(base),
-				(__sha(end) - __sha(base)) >> PAGE_SHIFT);
-	}
+	for_each_mem_range(i, &base, &end)
+		set_memory_kasan(base, end);
 #endif
 	set_memory_rox((unsigned long)_stext,
 		       (unsigned long)(_etext - _stext) >> PAGE_SHIFT);
Signature · 1 line
2.39.2
author maintainer
#15 lore raw

PATCH 15/800 blk-mq: dont queue plugged passthrough requests into scheduler

In reply to Greg Kroah-Hartman

From: Ming Lei <[email protected]>

[ Upstream commit d97217e7f024bbe9aa62aea070771234c2879358 ]

Passthrough requests should never be queued to the I/O scheduler, as scheduling these opaque requests doesn't make sense, and I/O schedulers might require req->bio to be always valid.

We never let passthrough requests insert into the scheduler before commit 1c2d2fff6dc0 ("block: wire-up support for passthrough plugging"), restore this behavior even for passthrough requests issued under a plug.

[hch: use blk_mq_insert_requests for passthrough requests,
fix up the commit message and comments]

---
 block/blk-mq.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
block/blk-mq.c +6 -2
index 850bfb844ed2f..c763f0bc66371 100644
@@ -2711,6 +2711,7 @@ static void blk_mq_dispatch_plug_list(struct blk_plug *plug, bool from_sched)
 	struct request *requeue_list = NULL;
 	struct request **requeue_lastp = &requeue_list;
 	unsigned int depth = 0;
+	bool is_passthrough = false;
 	LIST_HEAD(list);
 
 	do {
@@ -2719,7 +2720,9 @@ static void blk_mq_dispatch_plug_list(struct blk_plug *plug, bool from_sched)
 		if (!this_hctx) {
 			this_hctx = rq->mq_hctx;
 			this_ctx = rq->mq_ctx;
-		} else if (this_hctx != rq->mq_hctx || this_ctx != rq->mq_ctx) {
+			is_passthrough = blk_rq_is_passthrough(rq);
+		} else if (this_hctx != rq->mq_hctx || this_ctx != rq->mq_ctx ||
+			   is_passthrough != blk_rq_is_passthrough(rq)) {
 			rq_list_add_tail(&requeue_lastp, rq);
 			continue;
 		}
@@ -2731,7 +2734,8 @@ static void blk_mq_dispatch_plug_list(struct blk_plug *plug, bool from_sched)
 	trace_block_unplug(this_hctx->queue, depth, !from_sched);
 
 	percpu_ref_get(&this_hctx->queue->q_usage_counter);
-	if (this_hctx->queue->elevator) {
+	/* passthrough requests should never be issued to the I/O scheduler */
+	if (this_hctx->queue->elevator && !is_passthrough) {
 		this_hctx->queue->elevator->type->ops.insert_requests(this_hctx,
 				&list, 0);
 		blk_mq_run_hw_queue(this_hctx, from_sched);
Signature · 1 line
2.39.2
author maintainer
#16 lore raw

PATCH 16/800 block: Fix the type of the second bdev_op_is_zoned_write() argument

In reply to Greg Kroah-Hartman

From: Bart Van Assche <[email protected]>

[ Upstream commit 3ddbe2a7e0d4a155a805f69c906c9beed30d4cc4 ]

Change the type of the second argument of bdev_op_is_zoned_write() from blk_opf_t into enum req_op because this function expects an operation without flags as second argument.

---
 include/linux/blkdev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/blkdev.h +1 -1
index c0ffe203a6022..be9d7d8237b33 100644
@@ -1282,7 +1282,7 @@ static inline unsigned int bdev_zone_no(struct block_device *bdev, sector_t sec)
 }
 
 static inline bool bdev_op_is_zoned_write(struct block_device *bdev,
-					  blk_opf_t op)
+					  enum req_op op)
 {
 	if (!bdev_is_zoned(bdev))
 		return false;
Signature · 1 line
2.39.2
author maintainer
#17 lore raw

PATCH 17/800 block/rq_qos: protect rq_qos apis with a new lock

In reply to Greg Kroah-Hartman

From: Yu Kuai <[email protected]>

[ Upstream commit a13bd91be22318768d55470cbc0b0f4488ef9edf ]

commit 50e34d78815e ("block: disable the elevator int del_gendisk") move rq_qos_exit() from disk_release() to del_gendisk(), this will introduce some problems:

1) If rq_qos_add() is triggered by enabling iocost/iolatency through cgroupfs, then it can concurrent with del_gendisk(), it's not safe to write 'q->rq_qos' concurrently.

2) Activate cgroup policy that is relied on rq_qos will call rq_qos_add() and blkcg_activate_policy(), and if rq_qos_exit() is called in the middle, null-ptr-dereference will be triggered in blkcg_activate_policy().

3) blkg_conf_open_bdev() can call blkdev_get_no_open() first to find the disk, then if rq_qos_exit() from del_gendisk() is done before rq_qos_add(), then memory will be leaked.

This patch add a new disk level mutex 'rq_qos_mutex':

1) The lock will protect rq_qos_exit() directly.

2) For wbt that doesn't relied on blk-cgroup, rq_qos_add() can only be called from disk initialization for now because wbt can't be destructed until rq_qos_exit(), so it's safe not to protect wbt for now. Hoever, in case that rq_qos dynamically destruction is supported in the furture, this patch also protect rq_qos_add() from wbt_init() directly, this is enough because blk-sysfs already synchronize writers with disk removal.

3) For iocost and iolatency, in order to synchronize disk removal and cgroup configuration, the lock is held after blkdev_get_no_open() from blkg_conf_open_bdev(), and is released in blkg_conf_exit(). In order to fix the above memory leak, disk_live() is checked after holding the new lock.

Fixes 50e34d78815e ("block: disable the elevator int del_gendisk")
---
 block/blk-cgroup.c     |  9 +++++++++
 block/blk-core.c       |  1 +
 block/blk-rq-qos.c     | 20 ++++++--------------
 block/blk-wbt.c        |  2 ++
 include/linux/blkdev.h |  1 +
 5 files changed, 19 insertions(+), 14 deletions(-)
block/blk-cgroup.c +9 -0
index dce1548a7a0c3..5215bc7af5514 100644
@@ -762,6 +762,13 @@ int blkg_conf_open_bdev(struct blkg_conf_ctx *ctx)
 		return -ENODEV;
 	}
 
+	mutex_lock(&bdev->bd_queue->rq_qos_mutex);
+	if (!disk_live(bdev->bd_disk)) {
+		blkdev_put_no_open(bdev);
+		mutex_unlock(&bdev->bd_queue->rq_qos_mutex);
+		return -ENODEV;
+	}
+
 	ctx->body = input;
 	ctx->bdev = bdev;
 	return 0;
@@ -906,6 +913,7 @@ EXPORT_SYMBOL_GPL(blkg_conf_prep);
  */
 void blkg_conf_exit(struct blkg_conf_ctx *ctx)
 	__releases(&ctx->bdev->bd_queue->queue_lock)
+	__releases(&ctx->bdev->bd_queue->rq_qos_mutex)
 {
 	if (ctx->blkg) {
 		spin_unlock_irq(&bdev_get_queue(ctx->bdev)->queue_lock);
@@ -913,6 +921,7 @@ void blkg_conf_exit(struct blkg_conf_ctx *ctx)
 	}
 
 	if (ctx->bdev) {
+		mutex_unlock(&ctx->bdev->bd_queue->rq_qos_mutex);
 		blkdev_put_no_open(ctx->bdev);
 		ctx->body = NULL;
 		ctx->bdev = NULL;
block/blk-core.c +1 -0
index 1da77e7d62894..3fc68b9444791 100644
@@ -420,6 +420,7 @@ struct request_queue *blk_alloc_queue(int node_id)
 	mutex_init(&q->debugfs_mutex);
 	mutex_init(&q->sysfs_lock);
 	mutex_init(&q->sysfs_dir_lock);
+	mutex_init(&q->rq_qos_mutex);
 	spin_lock_init(&q->queue_lock);
 
 	init_waitqueue_head(&q->mq_freeze_wq);
block/blk-rq-qos.c +6 -14
index d8cc820a365e3..167be74df4eec 100644
@@ -288,11 +288,13 @@ void rq_qos_wait(struct rq_wait *rqw, void *private_data,
 
 void rq_qos_exit(struct request_queue *q)
 {
+	mutex_lock(&q->rq_qos_mutex);
 	while (q->rq_qos) {
 		struct rq_qos *rqos = q->rq_qos;
 		q->rq_qos = rqos->next;
 		rqos->ops->exit(rqos);
 	}
+	mutex_unlock(&q->rq_qos_mutex);
 }
 
 int rq_qos_add(struct rq_qos *rqos, struct gendisk *disk, enum rq_qos_id id,
@@ -300,6 +302,8 @@ int rq_qos_add(struct rq_qos *rqos, struct gendisk *disk, enum rq_qos_id id,
 {
 	struct request_queue *q = disk->queue;
 
+	lockdep_assert_held(&q->rq_qos_mutex);
+
 	rqos->disk = disk;
 	rqos->id = id;
 	rqos->ops = ops;
@@ -307,18 +311,13 @@ int rq_qos_add(struct rq_qos *rqos, struct gendisk *disk, enum rq_qos_id id,
 	/*
 	 * No IO can be in-flight when adding rqos, so freeze queue, which
 	 * is fine since we only support rq_qos for blk-mq queue.
-	 *
-	 * Reuse ->queue_lock for protecting against other concurrent
-	 * rq_qos adding/deleting
 	 */
 	blk_mq_freeze_queue(q);
 
-	spin_lock_irq(&q->queue_lock);
 	if (rq_qos_id(q, rqos->id))
 		goto ebusy;
 	rqos->next = q->rq_qos;
 	q->rq_qos = rqos;
-	spin_unlock_irq(&q->queue_lock);
 
 	blk_mq_unfreeze_queue(q);
 
@@ -330,7 +329,6 @@ int rq_qos_add(struct rq_qos *rqos, struct gendisk *disk, enum rq_qos_id id,
 
 	return 0;
 ebusy:
-	spin_unlock_irq(&q->queue_lock);
 	blk_mq_unfreeze_queue(q);
 	return -EBUSY;
 }
@@ -340,21 +338,15 @@ void rq_qos_del(struct rq_qos *rqos)
 	struct request_queue *q = rqos->disk->queue;
 	struct rq_qos **cur;
 
-	/*
-	 * See comment in rq_qos_add() about freezing queue & using
-	 * ->queue_lock.
-	 */
-	blk_mq_freeze_queue(q);
+	lockdep_assert_held(&q->rq_qos_mutex);
 
-	spin_lock_irq(&q->queue_lock);
+	blk_mq_freeze_queue(q);
 	for (cur = &q->rq_qos; *cur; cur = &(*cur)->next) {
 		if (*cur == rqos) {
 			*cur = rqos->next;
 			break;
 		}
 	}
-	spin_unlock_irq(&q->queue_lock);
-
 	blk_mq_unfreeze_queue(q);
 
 	mutex_lock(&q->debugfs_mutex);
block/blk-wbt.c +2 -0
index 9ec2a2f1eda38..7a87506ff8e1c 100644
@@ -944,7 +944,9 @@ int wbt_init(struct gendisk *disk)
 	/*
 	 * Assign rwb and add the stats callback.
 	 */
+	mutex_lock(&q->rq_qos_mutex);
 	ret = rq_qos_add(&rwb->rqos, disk, RQ_QOS_WBT, &wbt_rqos_ops);
+	mutex_unlock(&q->rq_qos_mutex);
 	if (ret)
 		goto err_free;
 
include/linux/blkdev.h +1 -0
index be9d7d8237b33..67e942d776bd8 100644
@@ -392,6 +392,7 @@ struct request_queue {
 
 	struct blk_queue_stats	*stats;
 	struct rq_qos		*rq_qos;
+	struct mutex		rq_qos_mutex;
 
 	const struct blk_mq_ops	*mq_ops;
 
Signature · 1 line
2.39.2
author maintainer
#18 lore raw

PATCH 18/800 splice: Fix filemap_splice_read() to use the correct inode

In reply to Greg Kroah-Hartman

From: David Howells <[email protected]>

[ Upstream commit c37222082f23c456664d1c3182a714670ab8f9a4 ]

Fix filemap_splice_read() to use file->f_mapping->host, not file->f_inode, as the source of the file size because in the case of a block device, file->f_inode points to the block-special file (which is typically 0 length) and not the backing store.

Fixes 07073eb01c5f ("splice: Add a func to do a splice from a buffered file without ITER_PIPE")
cc Steve French <[email protected]>
cc Jens Axboe <[email protected]>
cc Al Viro <[email protected]>
cc David Hildenbrand <[email protected]>
cc John Hubbard <[email protected]>
---
 mm/filemap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/filemap.c +2 -2
index 83dda76d1fc36..8abce63b259c9 100644
@@ -2906,7 +2906,7 @@ ssize_t filemap_splice_read(struct file *in, loff_t *ppos,
 	do {
 		cond_resched();
 
-		if (*ppos >= i_size_read(file_inode(in)))
+		if (*ppos >= i_size_read(in->f_mapping->host))
 			break;
 
 		iocb.ki_pos = *ppos;
@@ -2922,7 +2922,7 @@ ssize_t filemap_splice_read(struct file *in, loff_t *ppos,
 		 * part of the page is not copied back to userspace (unless
 		 * another truncate extends the file - this is desired though).
 		 */
-		isize = i_size_read(file_inode(in));
+		isize = i_size_read(in->f_mapping->host);
 		if (unlikely(*ppos >= isize))
 			break;
 		end_offset = min_t(loff_t, isize, *ppos + len);
Signature · 1 line
2.39.2
author maintainer
#19 lore raw

PATCH 19/800 erofs: kill hooked chains to avoid loops on deduplicated compressed images

In reply to Greg Kroah-Hartman

From: Gao Xiang <[email protected]>

[ Upstream commit 967c28b23f6c89bb8eef6a046ea88afe0d7c1029 ]

After heavily stressing EROFS with several images which include a hand-crafted image of repeated patterns for more than 46 days, I found two chains could be linked with each other almost simultaneously and form a loop so that the entire loop won't be submitted. As a consequence, the corresponding file pages will remain locked forever.

It can be _only_ observed on data-deduplicated compressed images. For example, consider two chains with five pclusters in total:

	Chain 1:  2->3->4->5    -- The tail pcluster is 5;
        Chain 2:  5->1->2       -- The tail pcluster is 2.

Chain 2 could link to Chain 1 with pcluster 5; and Chain 1 could link to Chain 2 at the same time with pcluster 2.

Since hooked chains are all linked locklessly now, I have no idea how to simply avoid the race. Instead, let's avoid hooked chains completely until I could work out a proper way to fix this and end users finally tell us that it's needed to add it back.

Actually, this optimization can be found with multi-threaded workloads (especially even more often on deduplicated compressed images), yet I'm not sure about the overall system impacts of not having this compared with implementation complexity.

Fixes 267f2492c8f7 ("erofs: introduce multi-reference pclusters (fully-referenced)")
---
 fs/erofs/zdata.c | 72 ++++++++----------------------------------------
 1 file changed, 11 insertions(+), 61 deletions(-)
fs/erofs/zdata.c +11 -61
index 160b3da43aecd..502893e3da010 100644
@@ -94,11 +94,8 @@ struct z_erofs_pcluster {
 
 /* let's avoid the valid 32-bit kernel addresses */
 
-/* the chained workgroup has't submitted io (still open) */
+/* the end of a chain of pclusters */
 #define Z_EROFS_PCLUSTER_TAIL           ((void *)0x5F0ECAFE)
-/* the chained workgroup has already submitted io */
-#define Z_EROFS_PCLUSTER_TAIL_CLOSED    ((void *)0x5F0EDEAD)
-
 #define Z_EROFS_PCLUSTER_NIL            (NULL)
 
 struct z_erofs_decompressqueue {
@@ -499,20 +496,6 @@ int __init z_erofs_init_zip_subsystem(void)
 
 enum z_erofs_pclustermode {
 	Z_EROFS_PCLUSTER_INFLIGHT,
-	/*
-	 * The current pclusters was the tail of an exist chain, in addition
-	 * that the previous processed chained pclusters are all decided to
-	 * be hooked up to it.
-	 * A new chain will be created for the remaining pclusters which are
-	 * not processed yet, so different from Z_EROFS_PCLUSTER_FOLLOWED,
-	 * the next pcluster cannot reuse the whole page safely for inplace I/O
-	 * in the following scenario:
-	 *  ________________________________________________________________
-	 * |      tail (partial) page     |       head (partial) page       |
-	 * |   (belongs to the next pcl)  |   (belongs to the current pcl)  |
-	 * |_______PCLUSTER_FOLLOWED______|________PCLUSTER_HOOKED__________|
-	 */
-	Z_EROFS_PCLUSTER_HOOKED,
 	/*
 	 * a weak form of Z_EROFS_PCLUSTER_FOLLOWED, the difference is that it
 	 * could be dispatched into bypass queue later due to uptodated managed
@@ -530,8 +513,8 @@ enum z_erofs_pclustermode {
 	 *  ________________________________________________________________
 	 * |  tail (partial) page |          head (partial) page           |
 	 * |  (of the current cl) |      (of the previous collection)      |
-	 * | PCLUSTER_FOLLOWED or |                                        |
-	 * |_____PCLUSTER_HOOKED__|___________PCLUSTER_FOLLOWED____________|
+	 * |                      |                                        |
+	 * |__PCLUSTER_FOLLOWED___|___________PCLUSTER_FOLLOWED____________|
 	 *
 	 * [  (*) the above page can be used as inplace I/O.               ]
 	 */
@@ -544,7 +527,7 @@ struct z_erofs_decompress_frontend {
 	struct z_erofs_bvec_iter biter;
 
 	struct page *candidate_bvpage;
-	struct z_erofs_pcluster *pcl, *tailpcl;
+	struct z_erofs_pcluster *pcl;
 	z_erofs_next_pcluster_t owned_head;
 	enum z_erofs_pclustermode mode;
 
@@ -750,19 +733,7 @@ static void z_erofs_try_to_claim_pcluster(struct z_erofs_decompress_frontend *f)
 		return;
 	}
 
-	/*
-	 * type 2, link to the end of an existing open chain, be careful
-	 * that its submission is controlled by the original attached chain.
-	 */
-	if (*owned_head != &pcl->next && pcl != f->tailpcl &&
-	    cmpxchg(&pcl->next, Z_EROFS_PCLUSTER_TAIL,
-		    *owned_head) == Z_EROFS_PCLUSTER_TAIL) {
-		*owned_head = Z_EROFS_PCLUSTER_TAIL;
-		f->mode = Z_EROFS_PCLUSTER_HOOKED;
-		f->tailpcl = NULL;
-		return;
-	}
-	/* type 3, it belongs to a chain, but it isn't the end of the chain */
+	/* type 2, it belongs to an ongoing chain */
 	f->mode = Z_EROFS_PCLUSTER_INFLIGHT;
 }
 
@@ -823,9 +794,6 @@ static int z_erofs_register_pcluster(struct z_erofs_decompress_frontend *fe)
 			goto err_out;
 		}
 	}
-	/* used to check tail merging loop due to corrupted images */
-	if (fe->owned_head == Z_EROFS_PCLUSTER_TAIL)
-		fe->tailpcl = pcl;
 	fe->owned_head = &pcl->next;
 	fe->pcl = pcl;
 	return 0;
@@ -846,7 +814,6 @@ static int z_erofs_collector_begin(struct z_erofs_decompress_frontend *fe)
 
 	/* must be Z_EROFS_PCLUSTER_TAIL or pointed to previous pcluster */
 	DBG_BUGON(fe->owned_head == Z_EROFS_PCLUSTER_NIL);
-	DBG_BUGON(fe->owned_head == Z_EROFS_PCLUSTER_TAIL_CLOSED);
 
 	if (!(map->m_flags & EROFS_MAP_META)) {
 		grp = erofs_find_workgroup(fe->inode->i_sb,
@@ -865,10 +832,6 @@ static int z_erofs_collector_begin(struct z_erofs_decompress_frontend *fe)
 
 	if (ret == -EEXIST) {
 		mutex_lock(&fe->pcl->lock);
-		/* used to check tail merging loop due to corrupted images */
-		if (fe->owned_head == Z_EROFS_PCLUSTER_TAIL)
-			fe->tailpcl = fe->pcl;
-
 		z_erofs_try_to_claim_pcluster(fe);
 	} else if (ret) {
 		return ret;
@@ -1025,8 +988,7 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe,
 	 * those chains are handled asynchronously thus the page cannot be used
 	 * for inplace I/O or bvpage (should be processed in a strict order.)
 	 */
-	tight &= (fe->mode >= Z_EROFS_PCLUSTER_HOOKED &&
-		  fe->mode != Z_EROFS_PCLUSTER_FOLLOWED_NOINPLACE);
+	tight &= (fe->mode > Z_EROFS_PCLUSTER_FOLLOWED_NOINPLACE);
 
 	cur = end - min_t(unsigned int, offset + end - map->m_la, end);
 	if (!(map->m_flags & EROFS_MAP_MAPPED)) {
@@ -1404,10 +1366,7 @@ static void z_erofs_decompress_queue(const struct z_erofs_decompressqueue *io,
 	};
 	z_erofs_next_pcluster_t owned = io->head;
 
-	while (owned != Z_EROFS_PCLUSTER_TAIL_CLOSED) {
-		/* impossible that 'owned' equals Z_EROFS_WORK_TPTR_TAIL */
-		DBG_BUGON(owned == Z_EROFS_PCLUSTER_TAIL);
-		/* impossible that 'owned' equals Z_EROFS_PCLUSTER_NIL */
+	while (owned != Z_EROFS_PCLUSTER_TAIL) {
 		DBG_BUGON(owned == Z_EROFS_PCLUSTER_NIL);
 
 		be.pcl = container_of(owned, struct z_erofs_pcluster, next);
@@ -1424,7 +1383,7 @@ static void z_erofs_decompressqueue_work(struct work_struct *work)
 		container_of(work, struct z_erofs_decompressqueue, u.work);
 	struct page *pagepool = NULL;
 
-	DBG_BUGON(bgq->head == Z_EROFS_PCLUSTER_TAIL_CLOSED);
+	DBG_BUGON(bgq->head == Z_EROFS_PCLUSTER_TAIL);
 	z_erofs_decompress_queue(bgq, &pagepool);
 	erofs_release_pages(&pagepool);
 	kvfree(bgq);
@@ -1612,7 +1571,7 @@ static struct z_erofs_decompressqueue *jobqueue_init(struct super_block *sb,
 		q->sync = true;
 	}
 	q->sb = sb;
-	q->head = Z_EROFS_PCLUSTER_TAIL_CLOSED;
+	q->head = Z_EROFS_PCLUSTER_TAIL;
 	return q;
 }
 
@@ -1630,11 +1589,7 @@ static void move_to_bypass_jobqueue(struct z_erofs_pcluster *pcl,
 	z_erofs_next_pcluster_t *const submit_qtail = qtail[JQ_SUBMIT];
 	z_erofs_next_pcluster_t *const bypass_qtail = qtail[JQ_BYPASS];
 
-	DBG_BUGON(owned_head == Z_EROFS_PCLUSTER_TAIL_CLOSED);
-	if (owned_head == Z_EROFS_PCLUSTER_TAIL)
-		owned_head = Z_EROFS_PCLUSTER_TAIL_CLOSED;
-
-	WRITE_ONCE(pcl->next, Z_EROFS_PCLUSTER_TAIL_CLOSED);
+	WRITE_ONCE(pcl->next, Z_EROFS_PCLUSTER_TAIL);
 
 	WRITE_ONCE(*submit_qtail, owned_head);
 	WRITE_ONCE(*bypass_qtail, &pcl->next);
@@ -1705,15 +1660,10 @@ static void z_erofs_submit_queue(struct z_erofs_decompress_frontend *f,
 		unsigned int i = 0;
 		bool bypass = true;
 
-		/* no possible 'owned_head' equals the following */
-		DBG_BUGON(owned_head == Z_EROFS_PCLUSTER_TAIL_CLOSED);
 		DBG_BUGON(owned_head == Z_EROFS_PCLUSTER_NIL);
-
 		pcl = container_of(owned_head, struct z_erofs_pcluster, next);
+		owned_head = READ_ONCE(pcl->next);
 
-		/* close the main owned chain at first */
-		owned_head = cmpxchg(&pcl->next, Z_EROFS_PCLUSTER_TAIL,
-				     Z_EROFS_PCLUSTER_TAIL_CLOSED);
 		if (z_erofs_is_inline_pcluster(pcl)) {
 			move_to_bypass_jobqueue(pcl, qtail, owned_head);
 			continue;
Signature · 1 line
2.39.2
author maintainer
#20 lore raw

PATCH 20/800 x86/resctrl: Only show tasks pid in current pid namespace

In reply to Greg Kroah-Hartman

From: Shawn Wang <[email protected]>

[ Upstream commit 2997d94b5dd0e8b10076f5e0b6f18410c73e28bd ]

When writing a task id to the "tasks" file in an rdtgroup, rdtgroup_tasks_write() treats the pid as a number in the current pid namespace. But when reading the "tasks" file, rdtgroup_tasks_show() shows the list of global pids from the init namespace, which is confusing and incorrect.

To be more robust, let the "tasks" file only show pids in the current pid namespace.

---
 arch/x86/kernel/cpu/resctrl/rdtgroup.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/resctrl/rdtgroup.c +6 -2
index 6ad33f355861f..61cdd9b1bb6d8 100644
@@ -726,11 +726,15 @@ static ssize_t rdtgroup_tasks_write(struct kernfs_open_file *of,
 static void show_rdt_tasks(struct rdtgroup *r, struct seq_file *s)
 {
 	struct task_struct *p, *t;
+	pid_t pid;
 
 	rcu_read_lock();
 	for_each_process_thread(p, t) {
-		if (is_closid_match(t, r) || is_rmid_match(t, r))
-			seq_printf(s, "%d\n", t->pid);
+		if (is_closid_match(t, r) || is_rmid_match(t, r)) {
+			pid = task_pid_vnr(t);
+			if (pid)
+				seq_printf(s, "%d\n", pid);
+		}
 	}
 	rcu_read_unlock();
 }
Signature · 1 line
2.39.2
author maintainer
#21 lore raw

PATCH 21/800 fsverity: use shash API instead of ahash API

In reply to Greg Kroah-Hartman

From: Eric Biggers <[email protected]>

[ Upstream commit 8fcd94add6c5c93ed3b9314456e8420914401530 ]

The "ahash" API, like the other scatterlist-based crypto APIs such as "skcipher", comes with some well-known limitations. First, it can't easily be used with vmalloc addresses. Second, the request struct can't be allocated on the stack. This adds complexity and a possible failure point that needs to be worked around, e.g. using a mempool.

The only benefit of ahash over "shash" is that ahash is needed to access traditional memory-to-memory crypto accelerators, i.e. drivers/crypto/. However, this style of crypto acceleration has largely fallen out of favor and been superseded by CPU-based acceleration or inline crypto engines. Also, ahash needs to be used asynchronously to take full advantage of such hardware, but fs/verity/ has never done this.

On all systems that aren't actually using one of these ahash-only crypto accelerators, ahash just adds unnecessary overhead as it sits between the user and the underlying shash algorithms.

Also, XFS is planned to cache fsverity Merkle tree blocks in the existing XFS buffer cache. As a result, it will be possible for a single Merkle tree block to be split across discontiguous pages
(https://lore.kernel.org/r/[email protected]).
This data will need to be hashed. It is easiest to work with a vmapped address in this case. However, ahash is incompatible with this.

Therefore, let's convert fs/verity/ from ahash to shash. This simplifies the code, and it should also slightly improve performance for everyone who wasn't actually using one of these ahash-only crypto accelerators, i.e. almost everyone (or maybe even everyone)!

Stable-dep-of: d1f0c5ea04cd ("fsverity: don't use bio_first_page_all() in fsverity_verify_bio()")

---
 fs/verity/enable.c           |  19 ++---
 fs/verity/fsverity_private.h |  13 +---
 fs/verity/hash_algs.c        | 131 ++++++-----------------------------
 fs/verity/verify.c           | 109 +++++++++++------------------
 4 files changed, 71 insertions(+), 201 deletions(-)
fs/verity/enable.c +6 -13
index fc4c50e5219dc..bd86b25ac084b 100644
@@ -7,6 +7,7 @@
 
 #include "fsverity_private.h"
 
+#include <crypto/hash.h>
 #include <linux/mount.h>
 #include <linux/sched/signal.h>
 #include <linux/uaccess.h>
@@ -20,7 +21,7 @@ struct block_buffer {
 /* Hash a block, writing the result to the next level's pending block buffer. */
 static int hash_one_block(struct inode *inode,
 			  const struct merkle_tree_params *params,
-			  struct ahash_request *req, struct block_buffer *cur)
+			  struct block_buffer *cur)
 {
 	struct block_buffer *next = cur + 1;
 	int err;
@@ -36,8 +37,7 @@ static int hash_one_block(struct inode *inode,
 	/* Zero-pad the block if it's shorter than the block size. */
 	memset(&cur->data[cur->filled], 0, params->block_size - cur->filled);
 
-	err = fsverity_hash_block(params, inode, req, virt_to_page(cur->data),
-				  offset_in_page(cur->data),
+	err = fsverity_hash_block(params, inode, cur->data,
 				  &next->data[next->filled]);
 	if (err)
 		return err;
@@ -76,7 +76,6 @@ static int build_merkle_tree(struct file *filp,
 	struct inode *inode = file_inode(filp);
 	const u64 data_size = inode->i_size;
 	const int num_levels = params->num_levels;
-	struct ahash_request *req;
 	struct block_buffer _buffers[1 + FS_VERITY_MAX_LEVELS + 1] = {};
 	struct block_buffer *buffers = &_buffers[1];
 	unsigned long level_offset[FS_VERITY_MAX_LEVELS];
@@ -90,9 +89,6 @@ static int build_merkle_tree(struct file *filp,
 		return 0;
 	}
 
-	/* This allocation never fails, since it's mempool-backed. */
-	req = fsverity_alloc_hash_request(params->hash_alg, GFP_KERNEL);
-
 	/*
 	 * Allocate the block buffers.  Buffer "-1" is for data blocks.
 	 * Buffers 0 <= level < num_levels are for the actual tree levels.
@@ -130,7 +126,7 @@ static int build_merkle_tree(struct file *filp,
 			fsverity_err(inode, "Short read of file data");
 			goto out;
 		}
-		err = hash_one_block(inode, params, req, &buffers[-1]);
+		err = hash_one_block(inode, params, &buffers[-1]);
 		if (err)
 			goto out;
 		for (level = 0; level < num_levels; level++) {
@@ -141,8 +137,7 @@ static int build_merkle_tree(struct file *filp,
 			}
 			/* Next block at @level is full */
 
-			err = hash_one_block(inode, params, req,
-					     &buffers[level]);
+			err = hash_one_block(inode, params, &buffers[level]);
 			if (err)
 				goto out;
 			err = write_merkle_tree_block(inode,
@@ -162,8 +157,7 @@ static int build_merkle_tree(struct file *filp,
 	/* Finish all nonempty pending tree blocks. */
 	for (level = 0; level < num_levels; level++) {
 		if (buffers[level].filled != 0) {
-			err = hash_one_block(inode, params, req,
-					     &buffers[level]);
+			err = hash_one_block(inode, params, &buffers[level]);
 			if (err)
 				goto out;
 			err = write_merkle_tree_block(inode,
@@ -183,7 +177,6 @@ static int build_merkle_tree(struct file *filp,
 out:
 	for (level = -1; level < num_levels; level++)
 		kfree(buffers[level].data);
-	fsverity_free_hash_request(params->hash_alg, req);
 	return err;
 }
 
fs/verity/fsverity_private.h +2 -11
index d34dcc033d723..8527beca2a454 100644
@@ -11,9 +11,6 @@
 #define pr_fmt(fmt) "fs-verity: " fmt
 
 #include <linux/fsverity.h>
-#include <linux/mempool.h>
-
-struct ahash_request;
 
 /*
  * Implementation limit: maximum depth of the Merkle tree.  For now 8 is plenty;
@@ -23,11 +20,10 @@ struct ahash_request;
 
 /* A hash algorithm supported by fs-verity */
 struct fsverity_hash_alg {
-	struct crypto_ahash *tfm; /* hash tfm, allocated on demand */
+	struct crypto_shash *tfm; /* hash tfm, allocated on demand */
 	const char *name;	  /* crypto API name, e.g. sha256 */
 	unsigned int digest_size; /* digest size in bytes, e.g. 32 for SHA-256 */
 	unsigned int block_size;  /* block size in bytes, e.g. 64 for SHA-256 */
-	mempool_t req_pool;	  /* mempool with a preallocated hash request */
 	/*
 	 * The HASH_ALGO_* constant for this algorithm.  This is different from
 	 * FS_VERITY_HASH_ALG_*, which uses a different numbering scheme.
@@ -85,15 +81,10 @@ extern struct fsverity_hash_alg fsverity_hash_algs[];
 
 struct fsverity_hash_alg *fsverity_get_hash_alg(const struct inode *inode,
 						unsigned int num);
-struct ahash_request *fsverity_alloc_hash_request(struct fsverity_hash_alg *alg,
-						  gfp_t gfp_flags);
-void fsverity_free_hash_request(struct fsverity_hash_alg *alg,
-				struct ahash_request *req);
 const u8 *fsverity_prepare_hash_state(struct fsverity_hash_alg *alg,
 				      const u8 *salt, size_t salt_size);
 int fsverity_hash_block(const struct merkle_tree_params *params,
-			const struct inode *inode, struct ahash_request *req,
-			struct page *page, unsigned int offset, u8 *out);
+			const struct inode *inode, const void *data, u8 *out);
 int fsverity_hash_buffer(struct fsverity_hash_alg *alg,
 			 const void *data, size_t size, u8 *out);
 void __init fsverity_check_hash_algs(void);
fs/verity/hash_algs.c +21 -110

237 lines not on this page · raw message

fs/verity/verify.c +42 -67

228 lines not on this page · raw message

Signature · 1 line
2.39.2
author maintainer
#22 lore raw

PATCH 22/800 fsverity: dont use bio_first_page_all() in fsverity_verify_bio()

In reply to Greg Kroah-Hartman

From: Eric Biggers <[email protected]>

[ Upstream commit d1f0c5ea04cd0a93309de0246278f0b22394692d ]

bio_first_page_all(bio)->mapping->host is not compatible with large folios, since the first page of the bio is not necessarily the head page of the folio, and therefore it might not have the mapping pointer set.

Therefore, move the dereference of ->mapping->host into verify_data_blocks(), which works with a folio.

(Like the commit that this Fixes, this hasn't actually been tested with large folios yet, since the filesystems that use fs/verity/ don't support that yet. But based on code review, I think this is needed.)

Fixes 5d0f0e57ed90 ("fsverity: support verifying data from large folios")
---
 fs/verity/verify.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
fs/verity/verify.c +5 -5
index e9ae1eef5f191..cf40e2fe6ace7 100644
@@ -256,9 +256,10 @@ verify_data_block(struct inode *inode, struct fsverity_info *vi,
 }
 
 static bool
-verify_data_blocks(struct inode *inode, struct folio *data_folio,
-		   size_t len, size_t offset, unsigned long max_ra_pages)
+verify_data_blocks(struct folio *data_folio, size_t len, size_t offset,
+		   unsigned long max_ra_pages)
 {
+	struct inode *inode = data_folio->mapping->host;
 	struct fsverity_info *vi = inode->i_verity_info;
 	const unsigned int block_size = vi->tree_params.block_size;
 	u64 pos = (u64)data_folio->index << PAGE_SHIFT;
@@ -298,7 +299,7 @@ verify_data_blocks(struct inode *inode, struct folio *data_folio,
  */
 bool fsverity_verify_blocks(struct folio *folio, size_t len, size_t offset)
 {
-	return verify_data_blocks(folio->mapping->host, folio, len, offset, 0);
+	return verify_data_blocks(folio, len, offset, 0);
 }
 EXPORT_SYMBOL_GPL(fsverity_verify_blocks);
 
@@ -319,7 +320,6 @@ EXPORT_SYMBOL_GPL(fsverity_verify_blocks);
  */
 void fsverity_verify_bio(struct bio *bio)
 {
-	struct inode *inode = bio_first_page_all(bio)->mapping->host;
 	struct folio_iter fi;
 	unsigned long max_ra_pages = 0;
 
@@ -337,7 +337,7 @@ void fsverity_verify_bio(struct bio *bio)
 	}
 
 	bio_for_each_folio_all(fi, bio) {
-		if (!verify_data_blocks(inode, fi.folio, fi.length, fi.offset,
+		if (!verify_data_blocks(fi.folio, fi.length, fi.offset,
 					max_ra_pages)) {
 			bio->bi_status = BLK_STS_IOERR;
 			break;
Signature · 1 line
2.39.2
author maintainer
#23 lore raw

PATCH 23/800 blk-iocost: use spin_lock_irqsave in adjust_inuse_and_calc_cost

In reply to Greg Kroah-Hartman

From: Li Nan <[email protected]>

[ Upstream commit 8d211554679d0b23702bd32ba04aeac0c1c4f660 ]

adjust_inuse_and_calc_cost() use spin_lock_irq() and IRQ will be enabled when unlock. DEADLOCK might happen if we have held other locks and disabled IRQ before invoking it.

Fix it by using spin_lock_irqsave() instead, which can keep IRQ state consistent with before when unlock.

================================
WARNING: inconsistent lock state
5.10.0-02758-g8e5f91fd772f #26 Not tainted
--------------------------------
inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage. kworker/2:3/388 [HC0[0]:SC0[0]:HE0:SE1] takes:
ffff888118c00c28 (&bfqd->lock){?.-.}-{2:2}, at: spin_lock_irq ffff888118c00c28 (&bfqd->lock){?.-.}-{2:2}, at: bfq_bio_merge+0x141/0x390 {IN-HARDIRQ-W} state was registered at:

    __lock_acquire+0x3d7/0x1070
    lock_acquire+0x197/0x4a0
    __raw_spin_lock_irqsave
    _raw_spin_lock_irqsave+0x3b/0x60
    bfq_idle_slice_timer_body
    bfq_idle_slice_timer+0x53/0x1d0
    __run_hrtimer+0x477/0xa70
    __hrtimer_run_queues+0x1c6/0x2d0
    hrtimer_interrupt+0x302/0x9e0
    local_apic_timer_interrupt
    __sysvec_apic_timer_interrupt+0xfd/0x420
    run_sysvec_on_irqstack_cond
    sysvec_apic_timer_interrupt+0x46/0xa0
    asm_sysvec_apic_timer_interrupt+0x12/0x20
  irq event stamp: 837522
  hardirqs last  enabled at (837521): [<ffffffff84b9419d>] __raw_spin_unlock_irqrestore
  hardirqs last  enabled at (837521): [<ffffffff84b9419d>] _raw_spin_unlock_irqrestore+0x3d/0x40
  hardirqs last disabled at (837522): [<ffffffff84b93fa3>] __raw_spin_lock_irq
  hardirqs last disabled at (837522): [<ffffffff84b93fa3>] _raw_spin_lock_irq+0x43/0x50
  softirqs last  enabled at (835852): [<ffffffff84e00558>] __do_softirq+0x558/0x8ec
  softirqs last disabled at (835845): [<ffffffff84c010ff>] asm_call_irq_on_stack+0xf/0x20

other info that might help us debug this:

   Possible unsafe locking scenario:
         CPU0
         ----
    lock(&bfqd->lock);
    <Interrupt>
      lock(&bfqd->lock);

*** DEADLOCK ***

3 locks held by kworker/2:3/388:
#0: ffff888107af0f38 ((wq_completion)kthrotld){+.+.}-{0:0}, at: process_one_work+0x742/0x13f0 #1: ffff8881176bfdd8 ((work_completion)(&td->dispatch_work)){+.+.}-{0:0}, at: process_one_work+0x777/0x13f0 #2: ffff888118c00c28 (&bfqd->lock){?.-.}-{2:2}, at: spin_lock_irq
#2: ffff888118c00c28 (&bfqd->lock){?.-.}-{2:2}, at: bfq_bio_merge+0x141/0x390

  stack backtrace:
  CPU: 2 PID: 388 Comm: kworker/2:3 Not tainted 5.10.0-02758-g8e5f91fd772f #26
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
  Workqueue: kthrotld blk_throtl_dispatch_work_fn
  Call Trace:
   __dump_stack lib/dump_stack.c:77 [inline]
   dump_stack+0x107/0x167
   print_usage_bug
   valid_state
   mark_lock_irq.cold+0x32/0x3a
   mark_lock+0x693/0xbc0
   mark_held_locks+0x9e/0xe0
   __trace_hardirqs_on_caller
   lockdep_hardirqs_on_prepare.part.0+0x151/0x360
   trace_hardirqs_on+0x5b/0x180
   __raw_spin_unlock_irq
   _raw_spin_unlock_irq+0x24/0x40
   spin_unlock_irq
   adjust_inuse_and_calc_cost+0x4fb/0x970
   ioc_rqos_merge+0x277/0x740
   __rq_qos_merge+0x62/0xb0
   rq_qos_merge
   bio_attempt_back_merge+0x12c/0x4a0
   blk_mq_sched_try_merge+0x1b6/0x4d0
   bfq_bio_merge+0x24a/0x390
   __blk_mq_sched_bio_merge+0xa6/0x460
   blk_mq_sched_bio_merge
   blk_mq_submit_bio+0x2e7/0x1ee0
   __submit_bio_noacct_mq+0x175/0x3b0
   submit_bio_noacct+0x1fb/0x270
   blk_throtl_dispatch_work_fn+0x1ef/0x2b0
   process_one_work+0x83e/0x13f0
   process_scheduled_works
   worker_thread+0x7e3/0xd80
   kthread+0x353/0x470
   ret_from_fork+0x1f/0x30
Fixes b0853ab4a238 ("blk-iocost: revamp in-period donation snapbacks")
---
 block/blk-iocost.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
block/blk-iocost.c +4 -3
index 285ced3467abb..6084a9519883e 100644
@@ -2455,6 +2455,7 @@ static u64 adjust_inuse_and_calc_cost(struct ioc_gq *iocg, u64 vtime,
 	u32 hwi, adj_step;
 	s64 margin;
 	u64 cost, new_inuse;
+	unsigned long flags;
 
 	current_hweight(iocg, NULL, &hwi);
 	old_hwi = hwi;
@@ -2473,11 +2474,11 @@ static u64 adjust_inuse_and_calc_cost(struct ioc_gq *iocg, u64 vtime,
 	    iocg->inuse == iocg->active)
 		return cost;
 
-	spin_lock_irq(&ioc->lock);
+	spin_lock_irqsave(&ioc->lock, flags);
 
 	/* we own inuse only when @iocg is in the normal active state */
 	if (iocg->abs_vdebt || list_empty(&iocg->active_list)) {
-		spin_unlock_irq(&ioc->lock);
+		spin_unlock_irqrestore(&ioc->lock, flags);
 		return cost;
 	}
 
@@ -2498,7 +2499,7 @@ static u64 adjust_inuse_and_calc_cost(struct ioc_gq *iocg, u64 vtime,
 	} while (time_after64(vtime + cost, now->vnow) &&
 		 iocg->inuse != iocg->active);
 
-	spin_unlock_irq(&ioc->lock);
+	spin_unlock_irqrestore(&ioc->lock, flags);
 
 	TRACE_IOCG_PATH(inuse_adjust, iocg, now,
 			old_inuse, iocg->inuse, old_hwi, hwi);
Signature · 1 line
2.39.2
author maintainer
#24 lore raw

PATCH 24/800 x86/sev: Fix calculation of end address based on number of pages

In reply to Greg Kroah-Hartman

From: Tom Lendacky <[email protected]>

[ Upstream commit 5dee19b6b2b194216919b99a1f5af2949a754016 ]

When calculating an end address based on an unsigned int number of pages, any value greater than or equal to 0x100000 that is shift PAGE_SHIFT bits results in a 0 value, resulting in an invalid end address. Change the number of pages variable in various routines from an unsigned int to an unsigned long to calculate the end address correctly.

Fixes 5e5ccff60a29 ("x86/sev: Add helper for validating pages in early enc attribute changes")
Fixes dc3f3d2474b8 ("x86/mm: Validate memory when changing the C-bit")
---
 arch/x86/include/asm/sev.h | 16 ++++++++--------
 arch/x86/kernel/sev.c      | 14 +++++++-------
 2 files changed, 15 insertions(+), 15 deletions(-)
arch/x86/include/asm/sev.h +8 -8
index 13dc2a9d23c1e..7ca5c9ec8b52e 100644
@@ -192,12 +192,12 @@ struct snp_guest_request_ioctl;
 
 void setup_ghcb(void);
 void __init early_snp_set_memory_private(unsigned long vaddr, unsigned long paddr,
-					 unsigned int npages);
+					 unsigned long npages);
 void __init early_snp_set_memory_shared(unsigned long vaddr, unsigned long paddr,
-					unsigned int npages);
+					unsigned long npages);
 void __init snp_prep_memory(unsigned long paddr, unsigned int sz, enum psc_op op);
-void snp_set_memory_shared(unsigned long vaddr, unsigned int npages);
-void snp_set_memory_private(unsigned long vaddr, unsigned int npages);
+void snp_set_memory_shared(unsigned long vaddr, unsigned long npages);
+void snp_set_memory_private(unsigned long vaddr, unsigned long npages);
 void snp_set_wakeup_secondary_cpu(void);
 bool snp_init(struct boot_params *bp);
 void __init __noreturn snp_abort(void);
@@ -212,12 +212,12 @@ static inline int pvalidate(unsigned long vaddr, bool rmp_psize, bool validate)
 static inline int rmpadjust(unsigned long vaddr, bool rmp_psize, unsigned long attrs) { return 0; }
 static inline void setup_ghcb(void) { }
 static inline void __init
-early_snp_set_memory_private(unsigned long vaddr, unsigned long paddr, unsigned int npages) { }
+early_snp_set_memory_private(unsigned long vaddr, unsigned long paddr, unsigned long npages) { }
 static inline void __init
-early_snp_set_memory_shared(unsigned long vaddr, unsigned long paddr, unsigned int npages) { }
+early_snp_set_memory_shared(unsigned long vaddr, unsigned long paddr, unsigned long npages) { }
 static inline void __init snp_prep_memory(unsigned long paddr, unsigned int sz, enum psc_op op) { }
-static inline void snp_set_memory_shared(unsigned long vaddr, unsigned int npages) { }
-static inline void snp_set_memory_private(unsigned long vaddr, unsigned int npages) { }
+static inline void snp_set_memory_shared(unsigned long vaddr, unsigned long npages) { }
+static inline void snp_set_memory_private(unsigned long vaddr, unsigned long npages) { }
 static inline void snp_set_wakeup_secondary_cpu(void) { }
 static inline bool snp_init(struct boot_params *bp) { return false; }
 static inline void snp_abort(void) { }
arch/x86/kernel/sev.c +7 -7
index b031244d6d2df..108bbae59c35a 100644
@@ -645,7 +645,7 @@ static u64 __init get_jump_table_addr(void)
 	return ret;
 }
 
-static void pvalidate_pages(unsigned long vaddr, unsigned int npages, bool validate)
+static void pvalidate_pages(unsigned long vaddr, unsigned long npages, bool validate)
 {
 	unsigned long vaddr_end;
 	int rc;
@@ -662,7 +662,7 @@ static void pvalidate_pages(unsigned long vaddr, unsigned int npages, bool valid
 	}
 }
 
-static void __init early_set_pages_state(unsigned long paddr, unsigned int npages, enum psc_op op)
+static void __init early_set_pages_state(unsigned long paddr, unsigned long npages, enum psc_op op)
 {
 	unsigned long paddr_end;
 	u64 val;
@@ -701,7 +701,7 @@ static void __init early_set_pages_state(unsigned long paddr, unsigned int npage
 }
 
 void __init early_snp_set_memory_private(unsigned long vaddr, unsigned long paddr,
-					 unsigned int npages)
+					 unsigned long npages)
 {
 	/*
 	 * This can be invoked in early boot while running identity mapped, so
@@ -723,7 +723,7 @@ void __init early_snp_set_memory_private(unsigned long vaddr, unsigned long padd
 }
 
 void __init early_snp_set_memory_shared(unsigned long vaddr, unsigned long paddr,
-					unsigned int npages)
+					unsigned long npages)
 {
 	/*
 	 * This can be invoked in early boot while running identity mapped, so
@@ -879,7 +879,7 @@ static void __set_pages_state(struct snp_psc_desc *data, unsigned long vaddr,
 		sev_es_terminate(SEV_TERM_SET_LINUX, GHCB_TERM_PSC);
 }
 
-static void set_pages_state(unsigned long vaddr, unsigned int npages, int op)
+static void set_pages_state(unsigned long vaddr, unsigned long npages, int op)
 {
 	unsigned long vaddr_end, next_vaddr;
 	struct snp_psc_desc *desc;
@@ -904,7 +904,7 @@ static void set_pages_state(unsigned long vaddr, unsigned int npages, int op)
 	kfree(desc);
 }
 
-void snp_set_memory_shared(unsigned long vaddr, unsigned int npages)
+void snp_set_memory_shared(unsigned long vaddr, unsigned long npages)
 {
 	if (!cc_platform_has(CC_ATTR_GUEST_SEV_SNP))
 		return;
@@ -914,7 +914,7 @@ void snp_set_memory_shared(unsigned long vaddr, unsigned int npages)
 	set_pages_state(vaddr, npages, SNP_PAGE_STATE_SHARED);
 }
 
-void snp_set_memory_private(unsigned long vaddr, unsigned int npages)
+void snp_set_memory_private(unsigned long vaddr, unsigned long npages)
 {
 	if (!cc_platform_has(CC_ATTR_GUEST_SEV_SNP))
 		return;
Signature · 1 line
2.39.2
author maintainer
#25 lore raw

PATCH 25/800 blk-cgroup: Reinit blkg_iostat_set after clearing in blkcg_reset_stats()

In reply to Greg Kroah-Hartman

From: Waiman Long <[email protected]>

[ Upstream commit 3d2af77e31ade05ff7ccc3658c3635ec1bea0979 ]

When blkg_alloc() is called to allocate a blkcg_gq structure with the associated blkg_iostat_set's, there are 2 fields within blkg_iostat_set that requires proper initialization - blkg & sync. The former field was introduced by commit 3b8cc6298724 ("blk-cgroup:
Optimize blkcg_rstat_flush()") while the later one was introduced by commit f73316482977 ("blk-cgroup: reimplement basic IO stats using cgroup rstat").

Unfortunately those fields in the blkg_iostat_set's are not properly re-initialized when they are cleared in v1's blkcg_reset_stats(). This can lead to a kernel panic due to NULL pointer access of the blkg pointer. The missing initialization of sync is less problematic and can be a problem in a debug kernel due to missing lockdep initialization.

Fix these problems by re-initializing them after memory clearing.

Fixes 3b8cc6298724 ("blk-cgroup: Optimize blkcg_rstat_flush()")
Fixes f73316482977 ("blk-cgroup: reimplement basic IO stats using cgroup rstat")
---
 block/blk-cgroup.c | 5 +++++
 1 file changed, 5 insertions(+)
block/blk-cgroup.c +5 -0
index 5215bc7af5514..aaf9903ad7b2f 100644
@@ -624,8 +624,13 @@ static int blkcg_reset_stats(struct cgroup_subsys_state *css,
 			struct blkg_iostat_set *bis =
 				per_cpu_ptr(blkg->iostat_cpu, cpu);
 			memset(bis, 0, sizeof(*bis));
+
+			/* Re-initialize the cleared blkg_iostat_set */
+			u64_stats_init(&bis->sync);
+			bis->blkg = blkg;
 		}
 		memset(&blkg->iostat, 0, sizeof(blkg->iostat));
+		u64_stats_init(&blkg->iostat.sync);
 
 		for (i = 0; i < BLKCG_MAX_POLS; i++) {
 			struct blkcg_policy *pol = blkcg_policy[i];
Signature · 1 line
2.39.2
author maintainer
#26 lore raw

PATCH 26/800 virt: sevguest: Add CONFIG_CRYPTO dependency

In reply to Greg Kroah-Hartman

From: Arnd Bergmann <[email protected]>

[ Upstream commit 84b9b44b99780d35fe72ac63c4724f158771e898 ]

This driver fails to link when CRYPTO is disabled, or in a loadable module:

WARNING: unmet direct dependencies detected for CRYPTO_GCM
WARNING: unmet direct dependencies detected for CRYPTO_AEAD2
Depends on [m]: CRYPTO [=m]
Selected by [y]:
- SEV_GUEST [=y] && VIRT_DRIVERS [=y] && AMD_MEM_ENCRYPT [=y]

x86_64-linux-ld: crypto/aead.o: in function `crypto_register_aeads':

---
 drivers/virt/coco/sev-guest/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/virt/coco/sev-guest/Kconfig +1 -0
index f9db0799ae67c..da2d7ca531f0f 100644
@@ -2,6 +2,7 @@ config SEV_GUEST
 	tristate "AMD SEV Guest driver"
 	default m
 	depends on AMD_MEM_ENCRYPT
+	select CRYPTO
 	select CRYPTO_AEAD2
 	select CRYPTO_GCM
 	help
Signature · 1 line
2.39.2
author maintainer
#27 lore raw

PATCH 27/800 blk-mq: fix potential io hang by wrong wake_batch

In reply to Greg Kroah-Hartman

From: Yu Kuai <[email protected]>

[ Upstream commit 4f1731df60f9033669f024d06ae26a6301260b55 ]

In __blk_mq_tag_busy/idle(), updating 'active_queues' and calculating 'wake_batch' is not atomic:

t1: t2:
_blk_mq_tag_busy blk_mq_tag_busy
inc active_queues
// assume 1->2

			inc active_queues
			// 2 -> 3
			blk_mq_update_wake_batch
			// calculate based on 3

blk_mq_update_wake_batch
/* calculate based on 2, while active_queues is actually 3. */

Fix this problem by protecting them wih 'tags->lock', this is not a hot path, so performance should not be concerned. And now that all writers are inside the lock, switch 'actives_queues' from atomic to unsigned int.

Fixes 180dccb0dba4 ("blk-mq: fix tag_get wait task can't be awakened")
---
 block/blk-mq-debugfs.c |  2 +-
 block/blk-mq-tag.c     | 15 ++++++++++-----
 block/blk-mq.h         |  3 +--
 include/linux/blk-mq.h |  3 +--
 4 files changed, 13 insertions(+), 10 deletions(-)
block/blk-mq-debugfs.c +1 -1
index d23a8554ec4ae..7851e149d365f 100644
@@ -399,7 +399,7 @@ static void blk_mq_debugfs_tags_show(struct seq_file *m,
 	seq_printf(m, "nr_tags=%u\n", tags->nr_tags);
 	seq_printf(m, "nr_reserved_tags=%u\n", tags->nr_reserved_tags);
 	seq_printf(m, "active_queues=%d\n",
-		   atomic_read(&tags->active_queues));
+		   READ_ONCE(tags->active_queues));
 
 	seq_puts(m, "\nbitmap_tags:\n");
 	sbitmap_queue_show(&tags->bitmap_tags, m);
block/blk-mq-tag.c +10 -5
index dfd81cab57888..cc57e2dd9a0bb 100644
@@ -38,6 +38,7 @@ static void blk_mq_update_wake_batch(struct blk_mq_tags *tags,
 void __blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx)
 {
 	unsigned int users;
+	struct blk_mq_tags *tags = hctx->tags;
 
 	/*
 	 * calling test_bit() prior to test_and_set_bit() is intentional,
@@ -55,9 +56,11 @@ void __blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx)
 			return;
 	}
 
-	users = atomic_inc_return(&hctx->tags->active_queues);
-
-	blk_mq_update_wake_batch(hctx->tags, users);
+	spin_lock_irq(&tags->lock);
+	users = tags->active_queues + 1;
+	WRITE_ONCE(tags->active_queues, users);
+	blk_mq_update_wake_batch(tags, users);
+	spin_unlock_irq(&tags->lock);
 }
 
 /*
@@ -90,9 +93,11 @@ void __blk_mq_tag_idle(struct blk_mq_hw_ctx *hctx)
 			return;
 	}
 
-	users = atomic_dec_return(&tags->active_queues);
-
+	spin_lock_irq(&tags->lock);
+	users = tags->active_queues - 1;
+	WRITE_ONCE(tags->active_queues, users);
 	blk_mq_update_wake_batch(tags, users);
+	spin_unlock_irq(&tags->lock);
 
 	blk_mq_tag_wakeup_all(tags, false);
 }
block/blk-mq.h +1 -2
index e876584d35163..890fef9796bf9 100644
@@ -417,8 +417,7 @@ static inline bool hctx_may_queue(struct blk_mq_hw_ctx *hctx,
 			return true;
 	}
 
-	users = atomic_read(&hctx->tags->active_queues);
-
+	users = READ_ONCE(hctx->tags->active_queues);
 	if (!users)
 		return true;
 
include/linux/blk-mq.h +1 -2
index 06caacd77ed66..710d122472641 100644
@@ -746,8 +746,7 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q,
 struct blk_mq_tags {
 	unsigned int nr_tags;
 	unsigned int nr_reserved_tags;
-
-	atomic_t active_queues;
+	unsigned int active_queues;
 
 	struct sbitmap_queue bitmap_tags;
 	struct sbitmap_queue breserved_tags;
Signature · 1 line
2.39.2
author maintainer
#28 lore raw

PATCH 28/800 lockd: drop inappropriate svc_get() from locked_get()

In reply to Greg Kroah-Hartman

From: NeilBrown <[email protected]>

[ Upstream commit 665e89ab7c5af1f2d260834c861a74b01a30f95f ]

The below-mentioned patch was intended to simplify refcounting on the svc_serv used by locked. The goal was to only ever have a single reference from the single thread. To that end we dropped a call to lockd_start_svc() (except when creating thread) which would take a reference, and dropped the svc_put(serv) that would drop that reference.

Unfortunately we didn't also remove the svc_get() from lockd_create_svc() in the case where the svc_serv already existed. So after the patch:
- on the first call the svc_serv was allocated and the one reference was given to the thread, so there are no extra references
- on subsequent calls svc_get() was called so there is now an extra reference.
This is clearly not consistent.

The inconsistency is also clear in the current code in lockd_get() takes *two* references, one on nlmsvc_serv and one by incrementing
nlmsvc_users. This clearly does not match lockd_put().

So: drop that svc_get() from lockd_get() (which used to be in lockd_create_svc().

---
 fs/lockd/svc.c | 1 -
 1 file changed, 1 deletion(-)
fs/lockd/svc.c +0 -1
index 04ba95b83d168..22d3ff3818f5f 100644
@@ -355,7 +355,6 @@ static int lockd_get(void)
 	int error;
 
 	if (nlmsvc_serv) {
-		svc_get(nlmsvc_serv);
 		nlmsvc_users++;
 		return 0;
 	}
Signature · 1 line
2.39.2
author maintainer
#29 lore raw

PATCH 29/800 nvme-core: fix memory leak in dhchap_secret_store

In reply to Greg Kroah-Hartman

From: Chaitanya Kulkarni <[email protected]>

[ Upstream commit a836ca33c5b07d34dd5347af9f64d25651d12674 ]

Free dhchap_secret in nvme_ctrl_dhchap_secret_store() before we return fix following kmemleack:-

unreferenced object 0xffff8886376ea800 (size 64):
comm "check", pid 22048, jiffies 4344316705 (age 92.199s) hex dump (first 32 bytes):

    44 48 48 43 2d 31 3a 30 30 3a 6e 78 72 35 4b 67  DHHC-1:00:nxr5Kg
    75 58 34 75 6f 41 78 73 4a 61 34 63 2f 68 75 4c  uX4uoAxsJa4c/huL
  backtrace:
    [<0000000030ce5d4b>] __kmalloc+0x4b/0x130
    [<000000009be1cdc1>] nvme_ctrl_dhchap_secret_store+0x8f/0x160 [nvme_core]
    [<00000000ac06c96a>] kernfs_fop_write_iter+0x12b/0x1c0
    [<00000000437e7ced>] vfs_write+0x2ba/0x3c0
    [<00000000f9491baf>] ksys_write+0x5f/0xe0
    [<000000001c46513d>] do_syscall_64+0x3b/0x90
    [<00000000ecf348fe>] entry_SYSCALL_64_after_hwframe+0x72/0xdc
unreferenced object 0xffff8886376eaf00 (size 64):
  comm "check", pid 22048, jiffies 4344316736 (age 92.168s)
  hex dump (first 32 bytes):
    44 48 48 43 2d 31 3a 30 30 3a 6e 78 72 35 4b 67  DHHC-1:00:nxr5Kg
    75 58 34 75 6f 41 78 73 4a 61 34 63 2f 68 75 4c  uX4uoAxsJa4c/huL
  backtrace:
    [<0000000030ce5d4b>] __kmalloc+0x4b/0x130
    [<000000009be1cdc1>] nvme_ctrl_dhchap_secret_store+0x8f/0x160 [nvme_core]
    [<00000000ac06c96a>] kernfs_fop_write_iter+0x12b/0x1c0
    [<00000000437e7ced>] vfs_write+0x2ba/0x3c0
    [<00000000f9491baf>] ksys_write+0x5f/0xe0
    [<000000001c46513d>] do_syscall_64+0x3b/0x90
    [<00000000ecf348fe>] entry_SYSCALL_64_after_hwframe+0x72/0xdc
Fixes f50fff73d620 ("nvme: implement In-Band authentication")
---
 drivers/nvme/host/core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/nvme/host/core.c +5 -2
index 3ec38e2b91732..c2096f0d50537 100644
@@ -3872,8 +3872,10 @@ static ssize_t nvme_ctrl_dhchap_secret_store(struct device *dev,
 		int ret;
 
 		ret = nvme_auth_generate_key(dhchap_secret, &key);
-		if (ret)
+		if (ret) {
+			kfree(dhchap_secret);
 			return ret;
+		}
 		kfree(opts->dhchap_secret);
 		opts->dhchap_secret = dhchap_secret;
 		host_key = ctrl->host_key;
@@ -3881,7 +3883,8 @@ static ssize_t nvme_ctrl_dhchap_secret_store(struct device *dev,
 		ctrl->host_key = key;
 		mutex_unlock(&ctrl->dhchap_auth_mutex);
 		nvme_auth_free_key(host_key);
-	}
+	} else
+		kfree(dhchap_secret);
 	/* Start re-authentication */
 	dev_info(ctrl->device, "re-authenticating controller\n");
 	queue_work(nvme_wq, &ctrl->dhchap_auth_work);
Signature · 1 line
2.39.2
author maintainer
#30 lore raw

PATCH 30/800 nvme-core: fix memory leak in dhchap_ctrl_secret

In reply to Greg Kroah-Hartman

From: Chaitanya Kulkarni <[email protected]>

[ Upstream commit 99c2dcc8ffc24e210a3aa05c204d92f3ef460b05 ]

Free dhchap_secret in nvme_ctrl_dhchap_ctrl_secret_store() before we return when nvme_auth_generate_key() returns error.

Fixes f50fff73d620 ("nvme: implement In-Band authentication")
---
 drivers/nvme/host/core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/nvme/host/core.c +5 -2
index c2096f0d50537..a275e7e2969e9 100644
@@ -3929,8 +3929,10 @@ static ssize_t nvme_ctrl_dhchap_ctrl_secret_store(struct device *dev,
 		int ret;
 
 		ret = nvme_auth_generate_key(dhchap_secret, &key);
-		if (ret)
+		if (ret) {
+			kfree(dhchap_secret);
 			return ret;
+		}
 		kfree(opts->dhchap_ctrl_secret);
 		opts->dhchap_ctrl_secret = dhchap_secret;
 		ctrl_key = ctrl->ctrl_key;
@@ -3938,7 +3940,8 @@ static ssize_t nvme_ctrl_dhchap_ctrl_secret_store(struct device *dev,
 		ctrl->ctrl_key = key;
 		mutex_unlock(&ctrl->dhchap_auth_mutex);
 		nvme_auth_free_key(ctrl_key);
-	}
+	} else
+		kfree(dhchap_secret);
 	/* Start re-authentication */
 	dev_info(ctrl->device, "re-authenticating controller\n");
 	queue_work(nvme_wq, &ctrl->dhchap_auth_work);
Signature · 1 line
2.39.2
author maintainer
#31 lore raw

PATCH 31/800 nvme-core: add missing fault-injection cleanup

In reply to Greg Kroah-Hartman

From: Chaitanya Kulkarni <[email protected]>

[ Upstream commit 3a12a0b868a512fcada564699d00f5e652c0998c ]

Add missing fault-injection cleanup in nvme_init_ctrl() in the error unwind path that also fixes following message for blktests:-

linux-block (for-next) # grep debugfs debugfs-err.log

[  147.853464] debugfs: Directory 'nvme1' with parent '/' already present!
[  147.853973] nvme1: failed to create debugfs attr
[  148.802490] debugfs: Directory 'nvme1' with parent '/' already present!
[  148.803244] nvme1: failed to create debugfs attr
[  148.877304] debugfs: Directory 'nvme1' with parent '/' already present!
[  148.877775] nvme1: failed to create debugfs attr
[  149.816652] debugfs: Directory 'nvme1' with parent '/' already present!
[  149.818011] nvme1: failed to create debugfs attr

Stable-dep-of: 7ed5cf8e6d9b ("nvme-core: fix dev_pm_qos memleak")

---
 drivers/nvme/host/core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/nvme/host/core.c +1 -0
index a275e7e2969e9..43bb5071b222c 100644
@@ -5249,6 +5249,7 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev,
 
 	return 0;
 out_free_cdev:
+	nvme_fault_inject_fini(&ctrl->fault_inject);
 	cdev_device_del(&ctrl->cdev, ctrl->device);
 out_free_name:
 	nvme_put_ctrl(ctrl);
Signature · 1 line
2.39.2
author maintainer
#32 lore raw

PATCH 32/800 nvme-core: fix dev_pm_qos memleak

In reply to Greg Kroah-Hartman

From: Chaitanya Kulkarni <[email protected]>

[ Upstream commit 7ed5cf8e6d9bfb6a78d0471317edff14f0f2b4dd ]

Call dev_pm_qos_hide_latency_tolerance() in the error unwind patch to avoid following kmemleak:-

blktests (master) # kmemleak-clear; ./check nvme/044; blktests (master) # kmemleak-scan ; kmemleak-show
nvme/044 (Test bi-directional authentication) [passed]

    runtime  2.111s  ...  2.124s
unreferenced object 0xffff888110c46240 (size 96):
  comm "nvme", pid 33461, jiffies 4345365353 (age 75.586s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<0000000069ac2cec>] kmalloc_trace+0x25/0x90
    [<000000006acc66d5>] dev_pm_qos_update_user_latency_tolerance+0x6f/0x100
    [<00000000cc376ea7>] nvme_init_ctrl+0x38e/0x410 [nvme_core]
    [<000000007df61b4b>] 0xffffffffc05e88b3
    [<00000000d152b985>] 0xffffffffc05744cb
    [<00000000f04a4041>] vfs_write+0xc5/0x3c0
    [<00000000f9491baf>] ksys_write+0x5f/0xe0
    [<000000001c46513d>] do_syscall_64+0x3b/0x90
    [<00000000ecf348fe>] entry_SYSCALL_64_after_hwframe+0x72/0xdc
---
 drivers/nvme/host/core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/nvme/host/core.c +1 -0
index 43bb5071b222c..3395e27438393 100644
@@ -5250,6 +5250,7 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev,
 	return 0;
 out_free_cdev:
 	nvme_fault_inject_fini(&ctrl->fault_inject);
+	dev_pm_qos_hide_latency_tolerance(ctrl->device);
 	cdev_device_del(&ctrl->cdev, ctrl->device);
 out_free_name:
 	nvme_put_ctrl(ctrl);
Signature · 1 line
2.39.2
author maintainer
#33 lore raw

PATCH 33/800 md/raid10: check slab-out-of-bounds in md_bitmap_get_counter

In reply to Greg Kroah-Hartman

From: Li Nan <[email protected]>

[ Upstream commit 301867b1c16805aebbc306aafa6ecdc68b73c7e5 ]

If we write a large number to md/bitmap_set_bits, md_bitmap_checkpage() will return -EINVAL because 'page >= bitmap->pages', but the return value was not checked immediately in md_bitmap_get_counter() in order to set *blocks value and slab-out-of-bounds occurs.

Move check of 'page >= bitmap->pages' to md_bitmap_get_counter() and return directly if true.

Fixes ef4256733506 ("md/bitmap: optimise scanning of empty bitmaps.")
---
 drivers/md/md-bitmap.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/md/md-bitmap.c +9 -8
index bc8d7565171d4..358a064959028 100644
@@ -54,14 +54,7 @@ __acquires(bitmap->lock)
 {
 	unsigned char *mappage;
 
-	if (page >= bitmap->pages) {
-		/* This can happen if bitmap_start_sync goes beyond
-		 * End-of-device while looking for a whole page.
-		 * It is harmless.
-		 */
-		return -EINVAL;
-	}
-
+	WARN_ON_ONCE(page >= bitmap->pages);
 	if (bitmap->bp[page].hijacked) /* it's hijacked, don't try to alloc */
 		return 0;
 
@@ -1387,6 +1380,14 @@ __acquires(bitmap->lock)
 	sector_t csize;
 	int err;
 
+	if (page >= bitmap->pages) {
+		/*
+		 * This can happen if bitmap_start_sync goes beyond
+		 * End-of-device while looking for a whole page or
+		 * user set a huge number to sysfs bitmap_set_bits.
+		 */
+		return NULL;
+	}
 	err = md_bitmap_checkpage(bitmap, page, create, 0);
 
 	if (bitmap->bp[page].hijacked ||
Signature · 1 line
2.39.2
author maintainer
#34 lore raw

PATCH 34/800 md/raid10: fix overflow of md/safe_mode_delay

In reply to Greg Kroah-Hartman

From: Li Nan <[email protected]>

[ Upstream commit 6beb489b2eed25978523f379a605073f99240c50 ]

There is no input check when echo md/safe_mode_delay in safe_delay_store(). And msec might also overflow when HZ < 1000 in safe_delay_show(), Fix it by checking overflow in safe_delay_store() and use unsigned long conversion in safe_delay_show().

Fixes 72e02075a33f ("md: factor out parsing of fixed-point numbers")
---
 drivers/md/md.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/md/md.c +4 -3
index 8e344b4b34446..b2d69260b5b1c 100644
@@ -3794,8 +3794,9 @@ int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale)
 static ssize_t
 safe_delay_show(struct mddev *mddev, char *page)
 {
-	int msec = (mddev->safemode_delay*1000)/HZ;
-	return sprintf(page, "%d.%03d\n", msec/1000, msec%1000);
+	unsigned int msec = ((unsigned long)mddev->safemode_delay*1000)/HZ;
+
+	return sprintf(page, "%u.%03u\n", msec/1000, msec%1000);
 }
 static ssize_t
 safe_delay_store(struct mddev *mddev, const char *cbuf, size_t len)
@@ -3807,7 +3808,7 @@ safe_delay_store(struct mddev *mddev, const char *cbuf, size_t len)
 		return -EINVAL;
 	}
 
-	if (strict_strtoul_scaled(cbuf, &msec, 3) < 0)
+	if (strict_strtoul_scaled(cbuf, &msec, 3) < 0 || msec > UINT_MAX / HZ)
 		return -EINVAL;
 	if (msec == 0)
 		mddev->safemode_delay = 0;
Signature · 1 line
2.39.2
author maintainer
#35 lore raw

PATCH 35/800 md/raid10: fix wrong setting of max_corr_read_errors

In reply to Greg Kroah-Hartman

From: Li Nan <[email protected]>

[ Upstream commit f8b20a405428803bd9881881d8242c9d72c6b2b2 ]

There is no input check when echo md/max_read_errors and overflow might occur. Add check of input number.

Fixes 1e50915fe0bb ("raid: improve MD/raid10 handling of correctable read errors.")
---
 drivers/md/md.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/md/md.c +2 -0
index b2d69260b5b1c..350094f1cb09f 100644
@@ -4478,6 +4478,8 @@ max_corrected_read_errors_store(struct mddev *mddev, const char *buf, size_t len
 	rv = kstrtouint(buf, 10, &n);
 	if (rv < 0)
 		return rv;
+	if (n > INT_MAX)
+		return -EINVAL;
 	atomic_set(&mddev->max_corr_read_errors, n);
 	return len;
 }
Signature · 1 line
2.39.2
author maintainer
#36 lore raw

PATCH 36/800 md/raid10: fix null-ptr-deref of mreplace in raid10_sync_request

In reply to Greg Kroah-Hartman

From: Li Nan <[email protected]>

[ Upstream commit 34817a2441747b48e444cb0e05d84e14bc9443da ]

There are two check of 'mreplace' in raid10_sync_request(). In the first check, 'need_replace' will be set and 'mreplace' will be used later if no-Faulty 'mreplace' exists, In the second check, 'mreplace' will be set to NULL if it is Faulty, but 'need_replace' will not be changed accordingly. null-ptr-deref occurs if Faulty is set between two check.

Fix it by merging two checks into one. And replace 'need_replace' with 'mreplace' because their values are always the same.

Fixes ee37d7314a32 ("md/raid10: Fix raid10 replace hang when new added disk faulty")
---
 drivers/md/raid10.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/md/raid10.c +5 -9
index 4fcfcb350d2b4..0acb4c103c10e 100644
@@ -3438,7 +3438,6 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
 			int must_sync;
 			int any_working;
 			int need_recover = 0;
-			int need_replace = 0;
 			struct raid10_info *mirror = &conf->mirrors[i];
 			struct md_rdev *mrdev, *mreplace;
 
@@ -3450,11 +3449,10 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
 			    !test_bit(Faulty, &mrdev->flags) &&
 			    !test_bit(In_sync, &mrdev->flags))
 				need_recover = 1;
-			if (mreplace != NULL &&
-			    !test_bit(Faulty, &mreplace->flags))
-				need_replace = 1;
+			if (mreplace && test_bit(Faulty, &mreplace->flags))
+				mreplace = NULL;
 
-			if (!need_recover && !need_replace) {
+			if (!need_recover && !mreplace) {
 				rcu_read_unlock();
 				continue;
 			}
@@ -3470,8 +3468,6 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
 				rcu_read_unlock();
 				continue;
 			}
-			if (mreplace && test_bit(Faulty, &mreplace->flags))
-				mreplace = NULL;
 			/* Unless we are doing a full sync, or a replacement
 			 * we only need to recover the block if it is set in
 			 * the bitmap
@@ -3594,11 +3590,11 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
 				bio = r10_bio->devs[1].repl_bio;
 				if (bio)
 					bio->bi_end_io = NULL;
-				/* Note: if need_replace, then bio
+				/* Note: if replace is not NULL, then bio
 				 * cannot be NULL as r10buf_pool_alloc will
 				 * have allocated it.
 				 */
-				if (!need_replace)
+				if (!mreplace)
 					break;
 				bio->bi_next = biolist;
 				biolist = bio;
Signature · 1 line
2.39.2
author maintainer
#37 lore raw

PATCH 37/800 md/raid10: fix io loss while replacement replace rdev

In reply to Greg Kroah-Hartman

From: Li Nan <[email protected]>

[ Upstream commit 2ae6aaf76912bae53c74b191569d2ab484f24bf3 ]

When removing a disk with replacement, the replacement will be used to replace rdev. During this process, there is a brief window in which both rdev and replacement are read as NULL in raid10_write_request(). This will result in io not being submitted but it should be.

//remove //write
raid10_remove_disk raid10_write_request
mirror->rdev = NULL

					 read rdev -> NULL
   mirror->rdev = mirror->replacement
   mirror->replacement = NULL
					 read replacement -> NULL

Fix it by reading replacement first and rdev later, meanwhile, use smp_mb() to prevent memory reordering.

Fixes 475b0321a4df ("md/raid10: writes should get directed to replacement as well as original.")
---
 drivers/md/raid10.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
drivers/md/raid10.c +18 -4
index 0acb4c103c10e..c059533b890f9 100644
@@ -779,8 +779,16 @@ static struct md_rdev *read_balance(struct r10conf *conf,
 		disk = r10_bio->devs[slot].devnum;
 		rdev = rcu_dereference(conf->mirrors[disk].replacement);
 		if (rdev == NULL || test_bit(Faulty, &rdev->flags) ||
-		    r10_bio->devs[slot].addr + sectors > rdev->recovery_offset)
+		    r10_bio->devs[slot].addr + sectors >
+		    rdev->recovery_offset) {
+			/*
+			 * Read replacement first to prevent reading both rdev
+			 * and replacement as NULL during replacement replace
+			 * rdev.
+			 */
+			smp_mb();
 			rdev = rcu_dereference(conf->mirrors[disk].rdev);
+		}
 		if (rdev == NULL ||
 		    test_bit(Faulty, &rdev->flags))
 			continue;
@@ -1479,9 +1487,15 @@ static void raid10_write_request(struct mddev *mddev, struct bio *bio,
 
 	for (i = 0;  i < conf->copies; i++) {
 		int d = r10_bio->devs[i].devnum;
-		struct md_rdev *rdev = rcu_dereference(conf->mirrors[d].rdev);
-		struct md_rdev *rrdev = rcu_dereference(
-			conf->mirrors[d].replacement);
+		struct md_rdev *rdev, *rrdev;
+
+		rrdev = rcu_dereference(conf->mirrors[d].replacement);
+		/*
+		 * Read replacement first to prevent reading both rdev and
+		 * replacement as NULL during replacement replace rdev.
+		 */
+		smp_mb();
+		rdev = rcu_dereference(conf->mirrors[d].rdev);
 		if (rdev == rrdev)
 			rrdev = NULL;
 		if (rdev && (test_bit(Faulty, &rdev->flags)))
Signature · 1 line
2.39.2
author maintainer
#38 lore raw

PATCH 38/800 md/raid1-10: factor out a helper to add bio to plug

In reply to Greg Kroah-Hartman

From: Yu Kuai <[email protected]>

[ Upstream commit 5ec6ca140a034682e421e2e808ef5ddfdfd65242 ]

The code in raid1 and raid10 is identical, prepare to limit the number of plugged bios.

Stable-dep-of: 7db922bae3ab ("md/raid1-10: submit write io directly if bitmap is not enabled")

---
 drivers/md/raid1-10.c | 16 ++++++++++++++++
 drivers/md/raid1.c    | 12 +-----------
 drivers/md/raid10.c   | 11 +----------
 3 files changed, 18 insertions(+), 21 deletions(-)
drivers/md/raid1-10.c +16 -0
index e61f6cad4e08e..9bf19a3409cef 100644
@@ -109,3 +109,19 @@ static void md_bio_reset_resync_pages(struct bio *bio, struct resync_pages *rp,
 		size -= len;
 	} while (idx++ < RESYNC_PAGES && size > 0);
 }
+
+static inline bool raid1_add_bio_to_plug(struct mddev *mddev, struct bio *bio,
+				      blk_plug_cb_fn unplug)
+{
+	struct raid1_plug_cb *plug = NULL;
+	struct blk_plug_cb *cb = blk_check_plugged(unplug, mddev,
+						   sizeof(*plug));
+
+	if (!cb)
+		return false;
+
+	plug = container_of(cb, struct raid1_plug_cb, cb);
+	bio_list_add(&plug->pending, bio);
+
+	return true;
+}
drivers/md/raid1.c +1 -11
index 68a9e2d9985b2..131d8fd5ccaab 100644
@@ -1343,8 +1343,6 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
 	struct bitmap *bitmap = mddev->bitmap;
 	unsigned long flags;
 	struct md_rdev *blocked_rdev;
-	struct blk_plug_cb *cb;
-	struct raid1_plug_cb *plug = NULL;
 	int first_clone;
 	int max_sectors;
 	bool write_behind = false;
@@ -1573,15 +1571,7 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
 					      r1_bio->sector);
 		/* flush_pending_writes() needs access to the rdev so...*/
 		mbio->bi_bdev = (void *)rdev;
-
-		cb = blk_check_plugged(raid1_unplug, mddev, sizeof(*plug));
-		if (cb)
-			plug = container_of(cb, struct raid1_plug_cb, cb);
-		else
-			plug = NULL;
-		if (plug) {
-			bio_list_add(&plug->pending, mbio);
-		} else {
+		if (!raid1_add_bio_to_plug(mddev, mbio, raid1_unplug)) {
 			spin_lock_irqsave(&conf->device_lock, flags);
 			bio_list_add(&conf->pending_bio_list, mbio);
 			spin_unlock_irqrestore(&conf->device_lock, flags);
drivers/md/raid10.c +1 -10
index c059533b890f9..eb0c1d019958e 100644
@@ -1290,8 +1290,6 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio,
 	const blk_opf_t do_sync = bio->bi_opf & REQ_SYNC;
 	const blk_opf_t do_fua = bio->bi_opf & REQ_FUA;
 	unsigned long flags;
-	struct blk_plug_cb *cb;
-	struct raid1_plug_cb *plug = NULL;
 	struct r10conf *conf = mddev->private;
 	struct md_rdev *rdev;
 	int devnum = r10_bio->devs[n_copy].devnum;
@@ -1331,14 +1329,7 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio,
 
 	atomic_inc(&r10_bio->remaining);
 
-	cb = blk_check_plugged(raid10_unplug, mddev, sizeof(*plug));
-	if (cb)
-		plug = container_of(cb, struct raid1_plug_cb, cb);
-	else
-		plug = NULL;
-	if (plug) {
-		bio_list_add(&plug->pending, mbio);
-	} else {
+	if (!raid1_add_bio_to_plug(mddev, mbio, raid10_unplug)) {
 		spin_lock_irqsave(&conf->device_lock, flags);
 		bio_list_add(&conf->pending_bio_list, mbio);
 		spin_unlock_irqrestore(&conf->device_lock, flags);
Signature · 1 line
2.39.2
author maintainer
#39 lore raw

PATCH 39/800 md/raid1-10: factor out a helper to submit normal write

In reply to Greg Kroah-Hartman

From: Yu Kuai <[email protected]>

[ Upstream commit 8295efbe68c080047e98d9c0eb5cb933b238a8cb ]

There are multiple places to do the same thing, factor out a helper to prevent redundant code, and the helper will be used in following patch as well.

Stable-dep-of: 7db922bae3ab ("md/raid1-10: submit write io directly if bitmap is not enabled")

---
 drivers/md/raid1-10.c | 17 +++++++++++++++++
 drivers/md/raid1.c    | 13 ++-----------
 drivers/md/raid10.c   | 26 ++++----------------------
 3 files changed, 23 insertions(+), 33 deletions(-)
drivers/md/raid1-10.c +17 -0
index 9bf19a3409cef..506299bd55cb6 100644
@@ -110,6 +110,23 @@ static void md_bio_reset_resync_pages(struct bio *bio, struct resync_pages *rp,
 	} while (idx++ < RESYNC_PAGES && size > 0);
 }
 
+
+static inline void raid1_submit_write(struct bio *bio)
+{
+	struct md_rdev *rdev = (struct md_rdev *)bio->bi_bdev;
+
+	bio->bi_next = NULL;
+	bio_set_dev(bio, rdev->bdev);
+	if (test_bit(Faulty, &rdev->flags))
+		bio_io_error(bio);
+	else if (unlikely(bio_op(bio) ==  REQ_OP_DISCARD &&
+			  !bdev_max_discard_sectors(bio->bi_bdev)))
+		/* Just ignore it */
+		bio_endio(bio);
+	else
+		submit_bio_noacct(bio);
+}
+
 static inline bool raid1_add_bio_to_plug(struct mddev *mddev, struct bio *bio,
 				      blk_plug_cb_fn unplug)
 {
drivers/md/raid1.c +2 -11
index 131d8fd5ccaab..e51b77a3a8397 100644
@@ -799,17 +799,8 @@ static void flush_bio_list(struct r1conf *conf, struct bio *bio)
 
 	while (bio) { /* submit pending writes */
 		struct bio *next = bio->bi_next;
-		struct md_rdev *rdev = (void *)bio->bi_bdev;
-		bio->bi_next = NULL;
-		bio_set_dev(bio, rdev->bdev);
-		if (test_bit(Faulty, &rdev->flags)) {
-			bio_io_error(bio);
-		} else if (unlikely((bio_op(bio) == REQ_OP_DISCARD) &&
-				    !bdev_max_discard_sectors(bio->bi_bdev)))
-			/* Just ignore it */
-			bio_endio(bio);
-		else
-			submit_bio_noacct(bio);
+
+		raid1_submit_write(bio);
 		bio = next;
 		cond_resched();
 	}
drivers/md/raid10.c +4 -22
index eb0c1d019958e..9d11a52367d17 100644
@@ -917,17 +917,8 @@ static void flush_pending_writes(struct r10conf *conf)
 
 		while (bio) { /* submit pending writes */
 			struct bio *next = bio->bi_next;
-			struct md_rdev *rdev = (void*)bio->bi_bdev;
-			bio->bi_next = NULL;
-			bio_set_dev(bio, rdev->bdev);
-			if (test_bit(Faulty, &rdev->flags)) {
-				bio_io_error(bio);
-			} else if (unlikely((bio_op(bio) ==  REQ_OP_DISCARD) &&
-					    !bdev_max_discard_sectors(bio->bi_bdev)))
-				/* Just ignore it */
-				bio_endio(bio);
-			else
-				submit_bio_noacct(bio);
+
+			raid1_submit_write(bio);
 			bio = next;
 		}
 		blk_finish_plug(&plug);
@@ -1138,17 +1129,8 @@ static void raid10_unplug(struct blk_plug_cb *cb, bool from_schedule)
 
 	while (bio) { /* submit pending writes */
 		struct bio *next = bio->bi_next;
-		struct md_rdev *rdev = (void*)bio->bi_bdev;
-		bio->bi_next = NULL;
-		bio_set_dev(bio, rdev->bdev);
-		if (test_bit(Faulty, &rdev->flags)) {
-			bio_io_error(bio);
-		} else if (unlikely((bio_op(bio) ==  REQ_OP_DISCARD) &&
-				    !bdev_max_discard_sectors(bio->bi_bdev)))
-			/* Just ignore it */
-			bio_endio(bio);
-		else
-			submit_bio_noacct(bio);
+
+		raid1_submit_write(bio);
 		bio = next;
 	}
 	kfree(plug);
Signature · 1 line
2.39.2
author maintainer
#40 lore raw

PATCH 40/800 md/raid1-10: submit write io directly if bitmap is not enabled

In reply to Greg Kroah-Hartman

From: Yu Kuai <[email protected]>

[ Upstream commit 7db922bae3abdf0a1db81ef7228cc0b996a0c1e3 ]

Commit 6cce3b23f6f8 ("[PATCH] md: write intent bitmap support for raid10") add bitmap support, and it changed that write io is submitted through daemon thread because bitmap need to be updated before write io. And later, plug is used to fix performance regression because all the write io will go to demon thread, which means io can't be issued concurrently.

However, if bitmap is not enabled, the write io should not go to daemon thread in the first place, and plug is not needed as well.

Fixes 6cce3b23f6f8 ("[PATCH] md: write intent bitmap support for raid10")
---
 drivers/md/md-bitmap.c |  4 +---
 drivers/md/md-bitmap.h |  7 +++++++
 drivers/md/raid1-10.c  | 13 +++++++++++--
 3 files changed, 19 insertions(+), 5 deletions(-)
drivers/md/md-bitmap.c +1 -3
index 358a064959028..ea226a37b110a 100644
@@ -1016,7 +1016,6 @@ static int md_bitmap_file_test_bit(struct bitmap *bitmap, sector_t block)
 	return set;
 }
 
-
 /* this gets called when the md device is ready to unplug its underlying
  * (slave) device queues -- before we let any writes go down, we need to
  * sync the dirty pages of the bitmap file to disk */
@@ -1026,8 +1025,7 @@ void md_bitmap_unplug(struct bitmap *bitmap)
 	int dirty, need_write;
 	int writing = 0;
 
-	if (!bitmap || !bitmap->storage.filemap ||
-	    test_bit(BITMAP_STALE, &bitmap->flags))
+	if (!md_bitmap_enabled(bitmap))
 		return;
 
 	/* look at each page to see if there are any set bits that need to be
drivers/md/md-bitmap.h +7 -0
index cfd7395de8fd3..3a4750952b3a7 100644
@@ -273,6 +273,13 @@ int md_bitmap_copy_from_slot(struct mddev *mddev, int slot,
 			     sector_t *lo, sector_t *hi, bool clear_bits);
 void md_bitmap_free(struct bitmap *bitmap);
 void md_bitmap_wait_behind_writes(struct mddev *mddev);
+
+static inline bool md_bitmap_enabled(struct bitmap *bitmap)
+{
+	return bitmap && bitmap->storage.filemap &&
+	       !test_bit(BITMAP_STALE, &bitmap->flags);
+}
+
 #endif
 
 #endif
drivers/md/raid1-10.c +11 -2
index 506299bd55cb6..73cc3cb9154d8 100644
@@ -131,9 +131,18 @@ static inline bool raid1_add_bio_to_plug(struct mddev *mddev, struct bio *bio,
 				      blk_plug_cb_fn unplug)
 {
 	struct raid1_plug_cb *plug = NULL;
-	struct blk_plug_cb *cb = blk_check_plugged(unplug, mddev,
-						   sizeof(*plug));
+	struct blk_plug_cb *cb;
+
+	/*
+	 * If bitmap is not enabled, it's safe to submit the io directly, and
+	 * this can get optimal performance.
+	 */
+	if (!md_bitmap_enabled(mddev->bitmap)) {
+		raid1_submit_write(bio);
+		return true;
+	}
 
+	cb = blk_check_plugged(unplug, mddev, sizeof(*plug));
 	if (!cb)
 		return false;
 
Signature · 1 line
2.39.2
author maintainer
#41 lore raw

PATCH 41/800 block: fix blktrace debugfs entries leakage

In reply to Greg Kroah-Hartman

From: Yu Kuai <[email protected]>

[ Upstream commit dd7de3704af9989b780693d51eaea49a665bd9c2 ]

Commit 99d055b4fd4b ("block: remove per-disk debugfs files in blk_unregister_queue") moves blk_trace_shutdown() from blk_release_queue() to blk_unregister_queue(), this is safe if blktrace is created through sysfs, however, there is a regression in corner case.

blktrace can still be enabled after del_gendisk() through ioctl if the disk is opened before del_gendisk(), and if blktrace is not shutdown through ioctl before closing the disk, debugfs entries will be leaked.

Fix this problem by shutdown blktrace in disk_release(), this is safe because blk_trace_remove() is reentrant.

Fixes 99d055b4fd4b ("block: remove per-disk debugfs files in blk_unregister_queue")
---
 block/genhd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
block/genhd.c +4 -1
index 1cb489b927d50..bb895397e9385 100644
@@ -25,8 +25,9 @@
 #include <linux/pm_runtime.h>
 #include <linux/badblocks.h>
 #include <linux/part_stat.h>
-#include "blk-throttle.h"
+#include <linux/blktrace_api.h>
 
+#include "blk-throttle.h"
 #include "blk.h"
 #include "blk-mq-sched.h"
 #include "blk-rq-qos.h"
@@ -1171,6 +1172,8 @@ static void disk_release(struct device *dev)
 	might_sleep();
 	WARN_ON_ONCE(disk_live(disk));
 
+	blk_trace_remove(disk->queue);
+
 	/*
 	 * To undo the all initialization from blk_mq_init_allocated_queue in
 	 * case of a probe failure where add_disk is never called we have to
Signature · 1 line
2.39.2
author maintainer
#42 lore raw

PATCH 42/800 irqchip/loongson-eiointc: Fix irq affinity setting during resume

In reply to Greg Kroah-Hartman

From: Jianmin Lv <[email protected]>

[ Upstream commit fb07b8f83441febeb0daf199b5f18c6de9bbab03 ]

The hierarchy of PCH PIC, PCH PCI MSI and EIONTC is as following:

        PCH PIC ------->|
                        |---->EIOINTC
        PCH PCI MSI --->|

so the irq_data list of irq_desc for IRQs on PCH PIC and PCH PCI MSI is like this:

irq_desc->irq_data(domain: PCH PIC)->parent_data(domain: EIOINTC) irq_desc->irq_data(domain: PCH PCI MSI)->parent_data(domain: EIOINTC)

In eiointc_resume(), the irq_data passed into eiointc_set_irq_affinity() should be matched to EIOINTC domain instead of PCH PIC or PCH PCI MSI domain, so fix it.

Fixes a90335c2dfb4 ("irqchip/loongson-eiointc: Add suspend/resume support")
---
 drivers/irqchip/irq-loongson-eiointc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-loongson-eiointc.c +1 -1
index 71ef19f77a5a0..a7fcde3e3ecc7 100644
@@ -314,7 +314,7 @@ static void eiointc_resume(void)
 			desc = irq_resolve_mapping(eiointc_priv[i]->eiointc_domain, j);
 			if (desc && desc->handle_irq && desc->handle_irq != handle_bad_irq) {
 				raw_spin_lock(&desc->lock);
-				irq_data = &desc->irq_data;
+				irq_data = irq_domain_get_irq_data(eiointc_priv[i]->eiointc_domain, irq_desc_get_irq(desc));
 				eiointc_set_irq_affinity(irq_data, irq_data->common->affinity, 0);
 				raw_spin_unlock(&desc->lock);
 			}
Signature · 1 line
2.39.2
author maintainer
#43 lore raw

PATCH 43/800 splice: dont call file_accessed in copy_splice_read

In reply to Greg Kroah-Hartman

From: Christoph Hellwig <[email protected]>

[ Upstream commit 0b24be4691c9e6ea13ca70050d42a9f9032fa788 ]

copy_splice_read calls into ->read_iter to read the data, which already calls file_accessed.

Fixes 33b3b041543e ("splice: Add a func to do a splice from an O_DIRECT file without ITER_PIPE")
---
 fs/splice.c | 1 -
 1 file changed, 1 deletion(-)
fs/splice.c +0 -1
index 3e06611d19ae5..030e162985b5d 100644
@@ -355,7 +355,6 @@ ssize_t direct_splice_read(struct file *in, loff_t *ppos,
 		reclaim -= ret;
 		remain = ret;
 		*ppos = kiocb.ki_pos;
-		file_accessed(in);
 	} else if (ret < 0) {
 		/*
 		 * callers of ->splice_read() expect -EAGAIN on
Signature · 1 line
2.39.2
author maintainer
#44 lore raw

PATCH 44/800 irqchip/stm32-exti: Fix warning on initialized field overwritten

In reply to Greg Kroah-Hartman

From: Antonio Borneo <[email protected]>

[ Upstream commit 48f31e496488a25f443c0df52464da446fb1d10c ]

While compiling with W=1, both gcc and clang complain about a tricky way to initialize an array by filling it with a non-zero value and then overrride some of the array elements. In this case the override is intentional, so just disable the specific warning for only this part of the code.

Note: the flag "-Woverride-init" is recognized by both compilers, but the warning msg from clang reports "-Winitializer-overrides". The doc of clang clarifies that the two flags are synonyms, so use here only the flag name common on both compilers.

Fixes c297493336b7 ("irqchip/stm32-exti: Simplify irq description table")
---
 drivers/irqchip/irq-stm32-exti.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/irqchip/irq-stm32-exti.c +12 -0
index 6a3f7498ea8ea..8bbb2b114636c 100644
@@ -173,6 +173,16 @@ static struct irq_chip stm32_exti_h_chip_direct;
 #define EXTI_INVALID_IRQ       U8_MAX
 #define STM32MP1_DESC_IRQ_SIZE (ARRAY_SIZE(stm32mp1_exti_banks) * IRQS_PER_BANK)
 
+/*
+ * Use some intentionally tricky logic here to initialize the whole array to
+ * EXTI_INVALID_IRQ, but then override certain fields, requiring us to indicate
+ * that we "know" that there are overrides in this structure, and we'll need to
+ * disable that warning from W=1 builds.
+ */
+__diag_push();
+__diag_ignore_all("-Woverride-init",
+		  "logic to initialize all and then override some is OK");
+
 static const u8 stm32mp1_desc_irq[] = {
 	/* default value */
 	[0 ... (STM32MP1_DESC_IRQ_SIZE - 1)] = EXTI_INVALID_IRQ,
@@ -266,6 +276,8 @@ static const u8 stm32mp13_desc_irq[] = {
 	[70] = 98,
 };
 
+__diag_pop();
+
 static const struct stm32_exti_drv_data stm32mp1_drv_data = {
 	.exti_banks = stm32mp1_exti_banks,
 	.bank_nr = ARRAY_SIZE(stm32mp1_exti_banks),
Signature · 1 line
2.39.2
author maintainer
#45 lore raw

PATCH 45/800 irqchip/jcore-aic: Fix missing allocation of IRQ descriptors

In reply to Greg Kroah-Hartman

From: John Paul Adrian Glaubitz <[email protected]>

[ Upstream commit 4848229494a323eeaab62eee5574ef9f7de80374 ]

The initialization function for the J-Core AIC aic_irq_of_init() is currently missing the call to irq_alloc_descs() which allocates and initializes all the IRQ descriptors. Add missing function call and return the error code from irq_alloc_descs() in case the allocation fails.

---
 drivers/irqchip/irq-jcore-aic.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/irqchip/irq-jcore-aic.c +7 -0
index 5f47d8ee4ae39..b9dcc8e78c750 100644
@@ -68,6 +68,7 @@ static int __init aic_irq_of_init(struct device_node *node,
 	unsigned min_irq = JCORE_AIC2_MIN_HWIRQ;
 	unsigned dom_sz = JCORE_AIC_MAX_HWIRQ+1;
 	struct irq_domain *domain;
+	int ret;
 
 	pr_info("Initializing J-Core AIC\n");
 
@@ -100,6 +101,12 @@ static int __init aic_irq_of_init(struct device_node *node,
 	jcore_aic.irq_unmask = noop;
 	jcore_aic.name = "AIC";
 
+	ret = irq_alloc_descs(-1, min_irq, dom_sz - min_irq,
+			      of_node_to_nid(node));
+
+	if (ret < 0)
+		return ret;
+
 	domain = irq_domain_add_legacy(node, dom_sz - min_irq, min_irq, min_irq,
 				       &jcore_aic_irqdomain_ops,
 				       &jcore_aic);
Signature · 1 line
2.39.2
author maintainer
#46 lore raw

PATCH 46/800 svcrdma: Prevent page release when nothing was received

In reply to Greg Kroah-Hartman

From: Chuck Lever <[email protected]>

[ Upstream commit baf6d18b116b7dc84ed5e212c3a89f17cdc3f28c ]

I noticed that svc_rqst_release_pages() was still unnecessarily releasing a page when svc_rdma_recvfrom() returns zero.

Fixes a53d5cb0646a ("svcrdma: Avoid releasing a page in svc_xprt_release()")
---
 net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +6 -6
index a22fe7587fa6f..70207d8a318a4 100644
@@ -796,6 +796,12 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp)
 	struct svc_rdma_recv_ctxt *ctxt;
 	int ret;
 
+	/* Prevent svc_xprt_release() from releasing pages in rq_pages
+	 * when returning 0 or an error.
+	 */
+	rqstp->rq_respages = rqstp->rq_pages;
+	rqstp->rq_next_page = rqstp->rq_respages;
+
 	rqstp->rq_xprt_ctxt = NULL;
 
 	ctxt = NULL;
@@ -819,12 +825,6 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp)
 				   DMA_FROM_DEVICE);
 	svc_rdma_build_arg_xdr(rqstp, ctxt);
 
-	/* Prevent svc_xprt_release from releasing pages in rq_pages
-	 * if we return 0 or an error.
-	 */
-	rqstp->rq_respages = rqstp->rq_pages;
-	rqstp->rq_next_page = rqstp->rq_respages;
-
 	ret = svc_rdma_xdr_decode_req(&rqstp->rq_arg, ctxt);
 	if (ret < 0)
 		goto out_err;
Signature · 1 line
2.39.2
author maintainer
#47 lore raw

PATCH 47/800 erofs: fix compact 4B support for 16k block size

In reply to Greg Kroah-Hartman

From: Gao Xiang <[email protected]>

[ Upstream commit 001b8ccd0650727e54ec16ef72bf1b8eeab7168e ]

In compact 4B, two adjacent lclusters are packed together as a unit to form on-disk indexes for effective random access, as below:

(amortized = 4, vcnt = 2)

       _____________________________________________
      |___@_____ encoded bits __________|_ blkaddr _|
      0        .                                    amortized * vcnt = 8
      .             .
      .                  .              amortized * vcnt - 4 = 4
      .                        .
      .____________________________.
      |_type (2 bits)_|_clusterofs_|

Therefore, encoded bits for each pack are 32 bits (4 bytes). IOWs, since each lcluster can get 16 bits for its type and clusterofs, the maximum supported lclustersize for compact 4B format is 16k (14 bits).

Fix this to enable compact 4B format for 16k lclusters (blocks), which is tested on an arm64 server with 16k page size.

Fixes 152a333a5895 ("staging: erofs: add compacted compression indexes support")
---
 fs/erofs/zmap.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
fs/erofs/zmap.c +1 -5
index d37c5c89c7287..920fb4dbc731c 100644
@@ -129,7 +129,7 @@ static int unpack_compacted_index(struct z_erofs_maprecorder *m,
 	u8 *in, type;
 	bool big_pcluster;
 
-	if (1 << amortizedshift == 4)
+	if (1 << amortizedshift == 4 && lclusterbits <= 14)
 		vcnt = 2;
 	else if (1 << amortizedshift == 2 && lclusterbits == 12)
 		vcnt = 16;
@@ -231,7 +231,6 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m,
 {
 	struct inode *const inode = m->inode;
 	struct erofs_inode *const vi = EROFS_I(inode);
-	const unsigned int lclusterbits = vi->z_logical_clusterbits;
 	const erofs_off_t ebase = sizeof(struct z_erofs_map_header) +
 		ALIGN(erofs_iloc(inode) + vi->inode_isize + vi->xattr_isize, 8);
 	unsigned int totalidx = erofs_iblks(inode);
@@ -239,9 +238,6 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m,
 	unsigned int amortizedshift;
 	erofs_off_t pos;
 
-	if (lclusterbits != 12)
-		return -EOPNOTSUPP;
-
 	if (lcn >= totalidx)
 		return -EINVAL;
 
Signature · 1 line
2.39.2
author maintainer
#48 lore raw

PATCH 48/800 posix-timers: Prevent RT livelock in itimer_delete()

In reply to Greg Kroah-Hartman

From: Thomas Gleixner <[email protected]>

[ Upstream commit 9d9e522010eb5685d8b53e8a24320653d9d4cbbf ]

itimer_delete() has a retry loop when the timer is concurrently expired. On non-RT kernels this just spin-waits until the timer callback has completed, except for posix CPU timers which have HAVE_POSIX_CPU_TIMERS_TASK_WORK enabled.

In that case and on RT kernels the existing task could live lock when preempting the task which does the timer delivery.

Replace spin_unlock() with an invocation of timer_wait_running() to handle it the same way as the other retry loops in the posix timer code.

Fixes ec8f954a40da ("posix-timers: Use a callback for cancel synchronization on PREEMPT_RT")
---
 kernel/time/posix-timers.c | 43 +++++++++++++++++++++++++++++++-------
 1 file changed, 35 insertions(+), 8 deletions(-)
kernel/time/posix-timers.c +35 -8
index 808a247205a9a..ed3c4a9543982 100644
@@ -1037,27 +1037,52 @@ SYSCALL_DEFINE1(timer_delete, timer_t, timer_id)
 }
 
 /*
- * return timer owned by the process, used by exit_itimers
+ * Delete a timer if it is armed, remove it from the hash and schedule it
+ * for RCU freeing.
  */
 static void itimer_delete(struct k_itimer *timer)
 {
-retry_delete:
-	spin_lock_irq(&timer->it_lock);
+	unsigned long flags;
+
+	/*
+	 * irqsave is required to make timer_wait_running() work.
+	 */
+	spin_lock_irqsave(&timer->it_lock, flags);
 
+retry_delete:
+	/*
+	 * Even if the timer is not longer accessible from other tasks
+	 * it still might be armed and queued in the underlying timer
+	 * mechanism. Worse, that timer mechanism might run the expiry
+	 * function concurrently.
+	 */
 	if (timer_delete_hook(timer) == TIMER_RETRY) {
-		spin_unlock_irq(&timer->it_lock);
+		/*
+		 * Timer is expired concurrently, prevent livelocks
+		 * and pointless spinning on RT.
+		 *
+		 * timer_wait_running() drops timer::it_lock, which opens
+		 * the possibility for another task to delete the timer.
+		 *
+		 * That's not possible here because this is invoked from
+		 * do_exit() only for the last thread of the thread group.
+		 * So no other task can access and delete that timer.
+		 */
+		if (WARN_ON_ONCE(timer_wait_running(timer, &flags) != timer))
+			return;
+
 		goto retry_delete;
 	}
 	list_del(&timer->list);
 
-	spin_unlock_irq(&timer->it_lock);
+	spin_unlock_irqrestore(&timer->it_lock, flags);
 	release_posix_timer(timer, IT_ID_SET);
 }
 
 /*
- * This is called by do_exit or de_thread, only when nobody else can
- * modify the signal->posix_timers list. Yet we need sighand->siglock
- * to prevent the race with /proc/pid/timers.
+ * Invoked from do_exit() when the last thread of a thread group exits.
+ * At that point no other task can access the timers of the dying
+ * task anymore.
  */
 void exit_itimers(struct task_struct *tsk)
 {
@@ -1067,10 +1092,12 @@ void exit_itimers(struct task_struct *tsk)
 	if (list_empty(&tsk->signal->posix_timers))
 		return;
 
+	/* Protect against concurrent read via /proc/$PID/timers */
 	spin_lock_irq(&tsk->sighand->siglock);
 	list_replace_init(&tsk->signal->posix_timers, &timers);
 	spin_unlock_irq(&tsk->sighand->siglock);
 
+	/* The timers are not longer accessible via tsk::signal */
 	while (!list_empty(&timers)) {
 		tmr = list_first_entry(&timers, struct k_itimer, list);
 		itimer_delete(tmr);
Signature · 1 line
2.39.2
author maintainer
#49 lore raw

PATCH 49/800 tick/rcu: Fix bogus ratelimit condition

In reply to Greg Kroah-Hartman

From: Wen Yang <[email protected]>

[ Upstream commit a7e282c77785c7eabf98836431b1f029481085ad ]

The ratelimit logic in report_idle_softirq() is broken because the exit condition is always true:

	static int ratelimit;

	if (ratelimit < 10)
		return false;  ---> always returns here

	ratelimit++;           ---> no chance to run

Make it check for >= 10 instead.

Fixes 0345691b24c0 ("tick/rcu: Stop allowing RCU_SOFTIRQ in idle")
---
 kernel/time/tick-sched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/tick-sched.c +1 -1
index 42c0be3080bde..4df14db4da490 100644
@@ -1041,7 +1041,7 @@ static bool report_idle_softirq(void)
 			return false;
 	}
 
-	if (ratelimit < 10)
+	if (ratelimit >= 10)
 		return false;
 
 	/* On RT, softirqs handling may be waiting on some lock */
Signature · 1 line
2.39.2
author maintainer
#50 lore raw

PATCH 50/800 tracing/timer: Add missing hrtimer modes to decode_hrtimer_mode().

In reply to Greg Kroah-Hartman

From: Sebastian Andrzej Siewior <[email protected]>

[ Upstream commit 2951580ba6adb082bb6b7154a5ecb24e7c1f7569 ]

The trace output for the HRTIMER_MODE_.*_HARD modes is seen as a number since these modes are not decoded. The author was not aware of the fancy decoding function which makes the life easier.

Extend decode_hrtimer_mode() with the additional HRTIMER_MODE_.*_HARD modes.

---
 include/trace/events/timer.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
include/trace/events/timer.h +5 -1
index 3e8619c72f774..b4bc2828fa09f 100644
@@ -158,7 +158,11 @@ DEFINE_EVENT(timer_class, timer_cancel,
 		{ HRTIMER_MODE_ABS_SOFT,	"ABS|SOFT"	},	\
 		{ HRTIMER_MODE_REL_SOFT,	"REL|SOFT"	},	\
 		{ HRTIMER_MODE_ABS_PINNED_SOFT,	"ABS|PINNED|SOFT" },	\
-		{ HRTIMER_MODE_REL_PINNED_SOFT,	"REL|PINNED|SOFT" })
+		{ HRTIMER_MODE_REL_PINNED_SOFT,	"REL|PINNED|SOFT" },	\
+		{ HRTIMER_MODE_ABS_HARD,	"ABS|HARD" },		\
+		{ HRTIMER_MODE_REL_HARD,	"REL|HARD" },		\
+		{ HRTIMER_MODE_ABS_PINNED_HARD, "ABS|PINNED|HARD" },	\
+		{ HRTIMER_MODE_REL_PINNED_HARD,	"REL|PINNED|HARD" })
 
 /**
  * hrtimer_init - called when the hrtimer is initialized
Signature · 1 line
2.39.2
author maintainer
#51 lore raw

PATCH 51/800 btrfs: always read the entire extent_buffer

In reply to Greg Kroah-Hartman

From: Christoph Hellwig <[email protected]>

[ Upstream commit e95382834cf885b478dbe14a66451b863eb35c94 ]

Currently read_extent_buffer_pages skips pages that are already uptodate when reading in an extent_buffer. While this reduces the amount of data read, it increases the number of I/O operations as we now need to do multiple I/Os when reading an extent buffer with one or more uptodate pages in the middle of it. On any modern storage device, be that hard drives or SSDs this actually decreases I/O performance. Fortunately this case is pretty rare as the pages are always initially read together and then aged the same way. Besides simplifying the code a bit as-is this will allow for major simplifications to the I/O completion handler later on.

Note that the case where all pages are uptodate is still handled by an optimized fast path that does not read any data from disk.

Stable-dep-of: 7027f87108ce ("btrfs: don't treat zoned writeback as being from an async helper thread")

---
 fs/btrfs/extent_io.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)
fs/btrfs/extent_io.c +5 -12
index a1adadd5d25dd..d1a635f237688 100644
@@ -4314,7 +4314,6 @@ int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num,
 	int locked_pages = 0;
 	int all_uptodate = 1;
 	int num_pages;
-	unsigned long num_reads = 0;
 	struct btrfs_bio_ctrl bio_ctrl = {
 		.opf = REQ_OP_READ,
 		.mirror_num = mirror_num,
@@ -4360,10 +4359,8 @@ int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num,
 	 */
 	for (i = 0; i < num_pages; i++) {
 		page = eb->pages[i];
-		if (!PageUptodate(page)) {
-			num_reads++;
+		if (!PageUptodate(page))
 			all_uptodate = 0;
-		}
 	}
 
 	if (all_uptodate) {
@@ -4373,7 +4370,7 @@ int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num,
 
 	clear_bit(EXTENT_BUFFER_READ_ERR, &eb->bflags);
 	eb->read_mirror = 0;
-	atomic_set(&eb->io_pages, num_reads);
+	atomic_set(&eb->io_pages, num_pages);
 	/*
 	 * It is possible for release_folio to clear the TREE_REF bit before we
 	 * set io_pages. See check_buffer_tree_ref for a more detailed comment.
@@ -4383,13 +4380,9 @@ int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num,
 	for (i = 0; i < num_pages; i++) {
 		page = eb->pages[i];
 
-		if (!PageUptodate(page)) {
-			ClearPageError(page);
-			submit_extent_page(&bio_ctrl, page_offset(page), page,
-					   PAGE_SIZE, 0);
-		} else {
-			unlock_page(page);
-		}
+		ClearPageError(page);
+		submit_extent_page(&bio_ctrl, page_offset(page), page,
+				   PAGE_SIZE, 0);
 	}
 
 	submit_one_bio(&bio_ctrl);
Signature · 1 line
2.39.2
author maintainer
#52 lore raw

PATCH 52/800 btrfs: dont use btrfs_bio_ctrl for extent buffer reading

In reply to Greg Kroah-Hartman

From: Christoph Hellwig <[email protected]>

[ Upstream commit b78b98e06fb7f9860da5a7c28e1edbaefc2f7be1 ]

The btrfs_bio_ctrl machinery is overkill for reading extent_buffers as we always operate on PAGE_SIZE chunks (or one smaller one for the subpage case) that are contiguous and are guaranteed to fit into a single bio. Replace it with open coded btrfs_bio_alloc, __bio_add_page and btrfs_submit_bio calls in a helper function shared between the subpage and node size >= PAGE_SIZE cases.

Stable-dep-of: 7027f87108ce ("btrfs: don't treat zoned writeback as being from an async helper thread")

---
 fs/btrfs/extent_io.c | 99 ++++++++++++++++----------------------------
 1 file changed, 36 insertions(+), 63 deletions(-)
fs/btrfs/extent_io.c +36 -63
index d1a635f237688..51f0f28fb9b2c 100644
@@ -98,22 +98,12 @@ void btrfs_extent_buffer_leak_debug_check(struct btrfs_fs_info *fs_info)
  */
 struct btrfs_bio_ctrl {
 	struct btrfs_bio *bbio;
-	int mirror_num;
 	enum btrfs_compression_type compress_type;
 	u32 len_to_oe_boundary;
 	blk_opf_t opf;
 	btrfs_bio_end_io_t end_io_func;
 	struct writeback_control *wbc;
 
-	/*
-	 * This is for metadata read, to provide the extra needed verification
-	 * info.  This has to be provided for submit_one_bio(), as
-	 * submit_one_bio() can submit a bio if it ends at stripe boundary.  If
-	 * no such parent_check is provided, the metadata can hit false alert at
-	 * endio time.
-	 */
-	struct btrfs_tree_parent_check *parent_check;
-
 	/*
 	 * Tell writepage not to lock the state bits for this range, it still
 	 * does the unlocking.
@@ -124,7 +114,6 @@ struct btrfs_bio_ctrl {
 static void submit_one_bio(struct btrfs_bio_ctrl *bio_ctrl)
 {
 	struct btrfs_bio *bbio = bio_ctrl->bbio;
-	int mirror_num = bio_ctrl->mirror_num;
 
 	if (!bbio)
 		return;
@@ -132,25 +121,14 @@ static void submit_one_bio(struct btrfs_bio_ctrl *bio_ctrl)
 	/* Caller should ensure the bio has at least some range added */
 	ASSERT(bbio->bio.bi_iter.bi_size);
 
-	if (!is_data_inode(&bbio->inode->vfs_inode)) {
-		if (btrfs_op(&bbio->bio) != BTRFS_MAP_WRITE) {
-			/*
-			 * For metadata read, we should have the parent_check,
-			 * and copy it to bbio for metadata verification.
-			 */
-			ASSERT(bio_ctrl->parent_check);
-			memcpy(&bbio->parent_check,
-			       bio_ctrl->parent_check,
-			       sizeof(struct btrfs_tree_parent_check));
-		}
+	if (!is_data_inode(&bbio->inode->vfs_inode))
 		bbio->bio.bi_opf |= REQ_META;
-	}
 
 	if (btrfs_op(&bbio->bio) == BTRFS_MAP_READ &&
 	    bio_ctrl->compress_type != BTRFS_COMPRESS_NONE)
-		btrfs_submit_compressed_read(bbio, mirror_num);
+		btrfs_submit_compressed_read(bbio, 0);
 	else
-		btrfs_submit_bio(bbio, mirror_num);
+		btrfs_submit_bio(bbio, 0);
 
 	/* The bbio is owned by the end_io handler now */
 	bio_ctrl->bbio = NULL;
@@ -4242,6 +4220,36 @@ void set_extent_buffer_uptodate(struct extent_buffer *eb)
 	}
 }
 
+static void __read_extent_buffer_pages(struct extent_buffer *eb, int mirror_num,
+				       struct btrfs_tree_parent_check *check)
+{
+	int num_pages = num_extent_pages(eb), i;
+	struct btrfs_bio *bbio;
+
+	clear_bit(EXTENT_BUFFER_READ_ERR, &eb->bflags);
+	eb->read_mirror = 0;
+	atomic_set(&eb->io_pages, num_pages);
+	check_buffer_tree_ref(eb);
+
+	bbio = btrfs_bio_alloc(INLINE_EXTENT_BUFFER_PAGES,
+			       REQ_OP_READ | REQ_META, eb->fs_info,
+			       end_bio_extent_readpage, NULL);
+	bbio->bio.bi_iter.bi_sector = eb->start >> SECTOR_SHIFT;
+	bbio->inode = BTRFS_I(eb->fs_info->btree_inode);
+	bbio->file_offset = eb->start;
+	memcpy(&bbio->parent_check, check, sizeof(*check));
+	if (eb->fs_info->nodesize < PAGE_SIZE) {
+		__bio_add_page(&bbio->bio, eb->pages[0], eb->len,
+			       eb->start - page_offset(eb->pages[0]));
+	} else {
+		for (i = 0; i < num_pages; i++) {
+			ClearPageError(eb->pages[i]);
+			__bio_add_page(&bbio->bio, eb->pages[i], PAGE_SIZE, 0);
+		}
+	}
+	btrfs_submit_bio(bbio, mirror_num);
+}
+
 static int read_extent_buffer_subpage(struct extent_buffer *eb, int wait,
 				      int mirror_num,
 				      struct btrfs_tree_parent_check *check)
@@ -4250,11 +4258,6 @@ static int read_extent_buffer_subpage(struct extent_buffer *eb, int wait,
 	struct extent_io_tree *io_tree;
 	struct page *page = eb->pages[0];
 	struct extent_state *cached_state = NULL;
-	struct btrfs_bio_ctrl bio_ctrl = {
-		.opf = REQ_OP_READ,
-		.mirror_num = mirror_num,
-		.parent_check = check,
-	};
 	int ret;
 
 	ASSERT(!test_bit(EXTENT_BUFFER_UNMAPPED, &eb->bflags));
@@ -4282,18 +4285,10 @@ static int read_extent_buffer_subpage(struct extent_buffer *eb, int wait,
 		return 0;
 	}
 
-	clear_bit(EXTENT_BUFFER_READ_ERR, &eb->bflags);
-	eb->read_mirror = 0;
-	atomic_set(&eb->io_pages, 1);
-	check_buffer_tree_ref(eb);
-	bio_ctrl.end_io_func = end_bio_extent_readpage;
-
 	btrfs_subpage_clear_error(fs_info, page, eb->start, eb->len);
-
 	btrfs_subpage_start_reader(fs_info, page, eb->start, eb->len);
-	submit_extent_page(&bio_ctrl, eb->start, page, eb->len,
-			   eb->start - page_offset(page));
-	submit_one_bio(&bio_ctrl);
+
+	__read_extent_buffer_pages(eb, mirror_num, check);
 	if (wait != WAIT_COMPLETE) {
 		free_extent_state(cached_state);
 		return 0;
@@ -4314,11 +4309,6 @@ int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num,
 	int locked_pages = 0;
 	int all_uptodate = 1;
 	int num_pages;
-	struct btrfs_bio_ctrl bio_ctrl = {
-		.opf = REQ_OP_READ,
-		.mirror_num = mirror_num,
-		.parent_check = check,
-	};
 
 	if (test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags))
 		return 0;
@@ -4368,24 +4358,7 @@ int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num,
 		goto unlock_exit;
 	}
 
-	clear_bit(EXTENT_BUFFER_READ_ERR, &eb->bflags);
-	eb->read_mirror = 0;
-	atomic_set(&eb->io_pages, num_pages);
-	/*
-	 * It is possible for release_folio to clear the TREE_REF bit before we
-	 * set io_pages. See check_buffer_tree_ref for a more detailed comment.
-	 */
-	check_buffer_tree_ref(eb);
-	bio_ctrl.end_io_func = end_bio_extent_readpage;
-	for (i = 0; i < num_pages; i++) {
-		page = eb->pages[i];
-
-		ClearPageError(page);
-		submit_extent_page(&bio_ctrl, page_offset(page), page,
-				   PAGE_SIZE, 0);
-	}
-
-	submit_one_bio(&bio_ctrl);
+	__read_extent_buffer_pages(eb, mirror_num, check);
 
 	if (wait != WAIT_COMPLETE)
 		return 0;
Signature · 1 line
2.39.2
author maintainer
#53 lore raw

PATCH 53/800 btrfs: return bool from lock_extent_buffer_for_io

In reply to Greg Kroah-Hartman

From: Christoph Hellwig <[email protected]>

[ Upstream commit 9fdd160160f002ac2604c5b8f90598febad44ae7 ]

lock_extent_buffer_for_io never returns a negative error value, so switch the return value to a simple bool.

Stable-dep-of: 7027f87108ce ("btrfs: don't treat zoned writeback as being from an async helper thread")

---
 fs/btrfs/extent_io.c | 37 +++++++++++--------------------------
 1 file changed, 11 insertions(+), 26 deletions(-)
fs/btrfs/extent_io.c +11 -26
index 51f0f28fb9b2c..28d0792359968 100644
@@ -1671,18 +1671,17 @@ static void end_extent_buffer_writeback(struct extent_buffer *eb)
  *
  * May try to flush write bio if we can't get the lock.
  *
- * Return  0 if the extent buffer doesn't need to be submitted.
- *           (E.g. the extent buffer is not dirty)
- * Return >0 is the extent buffer is submitted to bio.
- * Return <0 if something went wrong, no page is locked.
+ * Return %false if the extent buffer doesn't need to be submitted (e.g. the
+ * extent buffer is not dirty)
+ * Return %true is the extent buffer is submitted to bio.
  */
-static noinline_for_stack int lock_extent_buffer_for_io(struct extent_buffer *eb,
+static noinline_for_stack bool lock_extent_buffer_for_io(struct extent_buffer *eb,
 			  struct btrfs_bio_ctrl *bio_ctrl)
 {
 	struct btrfs_fs_info *fs_info = eb->fs_info;
 	int i, num_pages;
 	int flush = 0;
-	int ret = 0;
+	bool ret = false;
 
 	if (!btrfs_try_tree_write_lock(eb)) {
 		submit_write_bio(bio_ctrl, 0);
@@ -1693,7 +1692,7 @@ static noinline_for_stack int lock_extent_buffer_for_io(struct extent_buffer *eb
 	if (test_bit(EXTENT_BUFFER_WRITEBACK, &eb->bflags)) {
 		btrfs_tree_unlock(eb);
 		if (bio_ctrl->wbc->sync_mode != WB_SYNC_ALL)
-			return 0;
+			return false;
 		if (!flush) {
 			submit_write_bio(bio_ctrl, 0);
 			flush = 1;
@@ -1720,7 +1719,7 @@ static noinline_for_stack int lock_extent_buffer_for_io(struct extent_buffer *eb
 		percpu_counter_add_batch(&fs_info->dirty_metadata_bytes,
 					 -eb->len,
 					 fs_info->dirty_metadata_batch);
-		ret = 1;
+		ret = true;
 	} else {
 		spin_unlock(&eb->refs_lock);
 	}
@@ -2053,7 +2052,6 @@ static int submit_eb_subpage(struct page *page, struct btrfs_bio_ctrl *bio_ctrl)
 	u64 page_start = page_offset(page);
 	int bit_start = 0;
 	int sectors_per_node = fs_info->nodesize >> fs_info->sectorsize_bits;
-	int ret;
 
 	/* Lock and write each dirty extent buffers in the range */
 	while (bit_start < fs_info->subpage_info->bitmap_nr_bits) {
@@ -2099,25 +2097,13 @@ static int submit_eb_subpage(struct page *page, struct btrfs_bio_ctrl *bio_ctrl)
 		if (!eb)
 			continue;
 
-		ret = lock_extent_buffer_for_io(eb, bio_ctrl);
-		if (ret == 0) {
-			free_extent_buffer(eb);
-			continue;
+		if (lock_extent_buffer_for_io(eb, bio_ctrl)) {
+			write_one_subpage_eb(eb, bio_ctrl);
+			submitted++;
 		}
-		if (ret < 0) {
-			free_extent_buffer(eb);
-			goto cleanup;
-		}
-		write_one_subpage_eb(eb, bio_ctrl);
 		free_extent_buffer(eb);
-		submitted++;
 	}
 	return submitted;
-
-cleanup:
-	/* We hit error, end bio for the submitted extent buffers */
-	submit_write_bio(bio_ctrl, ret);
-	return ret;
 }
 
 /*
@@ -2196,8 +2182,7 @@ static int submit_eb_page(struct page *page, struct btrfs_bio_ctrl *bio_ctrl,
 
 	*eb_context = eb;
 
-	ret = lock_extent_buffer_for_io(eb, bio_ctrl);
-	if (ret <= 0) {
+	if (!lock_extent_buffer_for_io(eb, bio_ctrl)) {
 		btrfs_revert_meta_write_pointer(cache, eb);
 		if (cache)
 			btrfs_put_block_group(cache);
Signature · 1 line
2.39.2
author maintainer
#54 lore raw

PATCH 54/800 btrfs: submit a writeback bio per extent_buffer

In reply to Greg Kroah-Hartman

From: Christoph Hellwig <[email protected]>

[ Upstream commit 50b21d7a066f9a702b1d54ca11fc577302e875cb ]

Stop trying to cluster writes of multiple extent_buffers into a single bio. There is no need for that as the blk_plug mechanism used all the way up in writeback_inodes_wb gives us the same I/O pattern even with multiple bios. Removing the clustering simplifies lock_extent_buffer_for_io a lot and will also allow passing the eb as private data to the end I/O handler.

Stable-dep-of: 7027f87108ce ("btrfs: don't treat zoned writeback as being from an async helper thread")

---
 fs/btrfs/extent_io.c | 102 ++++++++++++++++---------------------------
 1 file changed, 37 insertions(+), 65 deletions(-)
fs/btrfs/extent_io.c +37 -65
index 28d0792359968..0c9538bb3c852 100644
@@ -1669,41 +1669,24 @@ static void end_extent_buffer_writeback(struct extent_buffer *eb)
 /*
  * Lock extent buffer status and pages for writeback.
  *
- * May try to flush write bio if we can't get the lock.
- *
  * Return %false if the extent buffer doesn't need to be submitted (e.g. the
  * extent buffer is not dirty)
  * Return %true is the extent buffer is submitted to bio.
  */
 static noinline_for_stack bool lock_extent_buffer_for_io(struct extent_buffer *eb,
-			  struct btrfs_bio_ctrl *bio_ctrl)
+			  struct writeback_control *wbc)
 {
 	struct btrfs_fs_info *fs_info = eb->fs_info;
-	int i, num_pages;
-	int flush = 0;
 	bool ret = false;
+	int i;
 
-	if (!btrfs_try_tree_write_lock(eb)) {
-		submit_write_bio(bio_ctrl, 0);
-		flush = 1;
-		btrfs_tree_lock(eb);
-	}
-
-	if (test_bit(EXTENT_BUFFER_WRITEBACK, &eb->bflags)) {
+	btrfs_tree_lock(eb);
+	while (test_bit(EXTENT_BUFFER_WRITEBACK, &eb->bflags)) {
 		btrfs_tree_unlock(eb);
-		if (bio_ctrl->wbc->sync_mode != WB_SYNC_ALL)
+		if (wbc->sync_mode != WB_SYNC_ALL)
 			return false;
-		if (!flush) {
-			submit_write_bio(bio_ctrl, 0);
-			flush = 1;
-		}
-		while (1) {
-			wait_on_extent_buffer_writeback(eb);
-			btrfs_tree_lock(eb);
-			if (!test_bit(EXTENT_BUFFER_WRITEBACK, &eb->bflags))
-				break;
-			btrfs_tree_unlock(eb);
-		}
+		wait_on_extent_buffer_writeback(eb);
+		btrfs_tree_lock(eb);
 	}
 
 	/*
@@ -1735,19 +1718,8 @@ static noinline_for_stack bool lock_extent_buffer_for_io(struct extent_buffer *e
 	if (!ret || fs_info->nodesize < PAGE_SIZE)
 		return ret;
 
-	num_pages = num_extent_pages(eb);
-	for (i = 0; i < num_pages; i++) {
-		struct page *p = eb->pages[i];
-
-		if (!trylock_page(p)) {
-			if (!flush) {
-				submit_write_bio(bio_ctrl, 0);
-				flush = 1;
-			}
-			lock_page(p);
-		}
-	}
-
+	for (i = 0; i < num_extent_pages(eb); i++)
+		lock_page(eb->pages[i]);
 	return ret;
 }
 
@@ -1977,11 +1949,16 @@ static void prepare_eb_write(struct extent_buffer *eb)
  * Page locking is only utilized at minimum to keep the VMM code happy.
  */
 static void write_one_subpage_eb(struct extent_buffer *eb,
-				 struct btrfs_bio_ctrl *bio_ctrl)
+				 struct writeback_control *wbc)
 {
 	struct btrfs_fs_info *fs_info = eb->fs_info;
 	struct page *page = eb->pages[0];
 	bool no_dirty_ebs = false;
+	struct btrfs_bio_ctrl bio_ctrl = {
+		.wbc = wbc,
+		.opf = REQ_OP_WRITE | wbc_to_write_flags(wbc),
+		.end_io_func = end_bio_subpage_eb_writepage,
+	};
 
 	prepare_eb_write(eb);
 
@@ -1995,40 +1972,43 @@ static void write_one_subpage_eb(struct extent_buffer *eb,
 	if (no_dirty_ebs)
 		clear_page_dirty_for_io(page);
 
-	bio_ctrl->end_io_func = end_bio_subpage_eb_writepage;
-
-	submit_extent_page(bio_ctrl, eb->start, page, eb->len,
+	submit_extent_page(&bio_ctrl, eb->start, page, eb->len,
 			   eb->start - page_offset(page));
 	unlock_page(page);
+	submit_one_bio(&bio_ctrl);
 	/*
 	 * Submission finished without problem, if no range of the page is
 	 * dirty anymore, we have submitted a page.  Update nr_written in wbc.
 	 */
 	if (no_dirty_ebs)
-		bio_ctrl->wbc->nr_to_write--;
+		wbc->nr_to_write--;
 }
 
 static noinline_for_stack void write_one_eb(struct extent_buffer *eb,
-			struct btrfs_bio_ctrl *bio_ctrl)
+					    struct writeback_control *wbc)
 {
 	u64 disk_bytenr = eb->start;
 	int i, num_pages;
+	struct btrfs_bio_ctrl bio_ctrl = {
+		.wbc = wbc,
+		.opf = REQ_OP_WRITE | wbc_to_write_flags(wbc),
+		.end_io_func = end_bio_extent_buffer_writepage,
+	};
 
 	prepare_eb_write(eb);
 
-	bio_ctrl->end_io_func = end_bio_extent_buffer_writepage;
-
 	num_pages = num_extent_pages(eb);
 	for (i = 0; i < num_pages; i++) {
 		struct page *p = eb->pages[i];
 
 		clear_page_dirty_for_io(p);
 		set_page_writeback(p);
-		submit_extent_page(bio_ctrl, disk_bytenr, p, PAGE_SIZE, 0);
+		submit_extent_page(&bio_ctrl, disk_bytenr, p, PAGE_SIZE, 0);
 		disk_bytenr += PAGE_SIZE;
-		bio_ctrl->wbc->nr_to_write--;
+		wbc->nr_to_write--;
 		unlock_page(p);
 	}
+	submit_one_bio(&bio_ctrl);
 }
 
 /*
@@ -2045,7 +2025,7 @@ static noinline_for_stack void write_one_eb(struct extent_buffer *eb,
  * Return >=0 for the number of submitted extent buffers.
  * Return <0 for fatal error.
  */
-static int submit_eb_subpage(struct page *page, struct btrfs_bio_ctrl *bio_ctrl)
+static int submit_eb_subpage(struct page *page, struct writeback_control *wbc)
 {
 	struct btrfs_fs_info *fs_info = btrfs_sb(page->mapping->host->i_sb);
 	int submitted = 0;
@@ -2097,8 +2077,8 @@ static int submit_eb_subpage(struct page *page, struct btrfs_bio_ctrl *bio_ctrl)
 		if (!eb)
 			continue;
 
-		if (lock_extent_buffer_for_io(eb, bio_ctrl)) {
-			write_one_subpage_eb(eb, bio_ctrl);
+		if (lock_extent_buffer_for_io(eb, wbc)) {
+			write_one_subpage_eb(eb, wbc);
 			submitted++;
 		}
 		free_extent_buffer(eb);
@@ -2126,7 +2106,7 @@ static int submit_eb_subpage(struct page *page, struct btrfs_bio_ctrl *bio_ctrl)
  * previous call.
  * Return <0 for fatal error.
  */
-static int submit_eb_page(struct page *page, struct btrfs_bio_ctrl *bio_ctrl,
+static int submit_eb_page(struct page *page, struct writeback_control *wbc,
 			  struct extent_buffer **eb_context)
 {
 	struct address_space *mapping = page->mapping;
@@ -2138,7 +2118,7 @@ static int submit_eb_page(struct page *page, struct btrfs_bio_ctrl *bio_ctrl,
 		return 0;
 
 	if (btrfs_sb(page->mapping->host->i_sb)->nodesize < PAGE_SIZE)
-		return submit_eb_subpage(page, bio_ctrl);
+		return submit_eb_subpage(page, wbc);
 
 	spin_lock(&mapping->private_lock);
 	if (!PagePrivate(page)) {
@@ -2171,8 +2151,7 @@ static int submit_eb_page(struct page *page, struct btrfs_bio_ctrl *bio_ctrl,
 		 * If for_sync, this hole will be filled with
 		 * trasnsaction commit.
 		 */
-		if (bio_ctrl->wbc->sync_mode == WB_SYNC_ALL &&
-		    !bio_ctrl->wbc->for_sync)
+		if (wbc->sync_mode == WB_SYNC_ALL && !wbc->for_sync)
 			ret = -EAGAIN;
 		else
 			ret = 0;
@@ -2182,12 +2161,12 @@ static int submit_eb_page(struct page *page, struct btrfs_bio_ctrl *bio_ctrl,
 
 	*eb_context = eb;
 
-	if (!lock_extent_buffer_for_io(eb, bio_ctrl)) {
+	if (!lock_extent_buffer_for_io(eb, wbc)) {
 		btrfs_revert_meta_write_pointer(cache, eb);
 		if (cache)
 			btrfs_put_block_group(cache);
 		free_extent_buffer(eb);
-		return ret;
+		return 0;
 	}
 	if (cache) {
 		/*
@@ -2196,7 +2175,7 @@ static int submit_eb_page(struct page *page, struct btrfs_bio_ctrl *bio_ctrl,
 		btrfs_schedule_zone_finish_bg(cache, eb);
 		btrfs_put_block_group(cache);
 	}
-	write_one_eb(eb, bio_ctrl);
+	write_one_eb(eb, wbc);
 	free_extent_buffer(eb);
 	return 1;
 }
@@ -2205,11 +2184,6 @@ int btree_write_cache_pages(struct address_space *mapping,
 				   struct writeback_control *wbc)
 {
 	struct extent_buffer *eb_context = NULL;
-	struct btrfs_bio_ctrl bio_ctrl = {
-		.wbc = wbc,
-		.opf = REQ_OP_WRITE | wbc_to_write_flags(wbc),
-		.extent_locked = 0,
-	};
 	struct btrfs_fs_info *fs_info = BTRFS_I(mapping->host)->root->fs_info;
 	int ret = 0;
 	int done = 0;
@@ -2251,7 +2225,7 @@ int btree_write_cache_pages(struct address_space *mapping,
 		for (i = 0; i < nr_folios; i++) {
 			struct folio *folio = fbatch.folios[i];
 
-			ret = submit_eb_page(&folio->page, &bio_ctrl, &eb_context);
+			ret = submit_eb_page(&folio->page, wbc, &eb_context);
 			if (ret == 0)
 				continue;
 			if (ret < 0) {
@@ -2312,8 +2286,6 @@ int btree_write_cache_pages(struct address_space *mapping,
 		ret = 0;
 	if (!ret && BTRFS_FS_ERROR(fs_info))
 		ret = -EROFS;
-	submit_write_bio(&bio_ctrl, ret);
-
 	btrfs_zoned_meta_io_unlock(fs_info);
 	return ret;
 }
Signature · 1 line
2.39.2
author maintainer
#55 lore raw

PATCH 55/800 btrfs: fix range_end calculation in extent_write_locked_range

In reply to Greg Kroah-Hartman

From: Christoph Hellwig <[email protected]>

[ Upstream commit 36614a3beba33a05ad78d4dcb9aa1d00e8a7d01f ]

The range_end field in struct writeback_control is inclusive, just like the end parameter passed to extent_write_locked_range. Not doing this could cause extra writeout, which is harmless but suboptimal.

Fixes 771ed689d2cd ("Btrfs: Optimize compressed writeback and reads")

Stable-dep-of: 7027f87108ce ("btrfs: don't treat zoned writeback as being from an async helper thread")

---
 fs/btrfs/extent_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/extent_io.c +1 -1
index 0c9538bb3c852..ac3aae55d55e5 100644
@@ -2468,7 +2468,7 @@ int extent_write_locked_range(struct inode *inode, u64 start, u64 end)
 	struct writeback_control wbc_writepages = {
 		.sync_mode	= WB_SYNC_ALL,
 		.range_start	= start,
-		.range_end	= end + 1,
+		.range_end	= end,
 		.no_cgroup_owner = 1,
 	};
 	struct btrfs_bio_ctrl bio_ctrl = {
Signature · 1 line
2.39.2
author maintainer
#56 lore raw

PATCH 56/800 btrfs: dont fail writeback when allocating the compression context fails

In reply to Greg Kroah-Hartman

From: Christoph Hellwig <[email protected]>

[ Upstream commit 973fb26e81a9f59dfe45b079a698c0e238f7bf69 ]

If cow_file_range_async fails to allocate the asynchronous writeback context, it currently returns an error and entirely fails the writeback. This is not a good idea as a writeback failure is a non-temporary error condition that will make the file system unusable. Just fall back to synchronous uncompressed writeback instead. This requires us to delay setting the BTRFS_INODE_HAS_ASYNC_EXTENT flag until we've committed to the async writeback.

The compression checks INODE_NOCOMPRESS and FORCE_COMPRESS are moved from cow_file_range_async to the preceding checks btrfs_run_delalloc_range().

Stable-dep-of: 7027f87108ce ("btrfs: don't treat zoned writeback as being from an async helper thread")

---
 fs/btrfs/inode.c | 74 ++++++++++++++++++------------------------------
 1 file changed, 28 insertions(+), 46 deletions(-)
fs/btrfs/inode.c +28 -46
index 7fcafcc5292c8..3d12dba145152 100644
@@ -1521,58 +1521,36 @@ static noinline void async_cow_free(struct btrfs_work *work)
 		kvfree(async_cow);
 }
 
-static int cow_file_range_async(struct btrfs_inode *inode,
-				struct writeback_control *wbc,
-				struct page *locked_page,
-				u64 start, u64 end, int *page_started,
-				unsigned long *nr_written)
+static bool cow_file_range_async(struct btrfs_inode *inode,
+				 struct writeback_control *wbc,
+				 struct page *locked_page,
+				 u64 start, u64 end, int *page_started,
+				 unsigned long *nr_written)
 {
 	struct btrfs_fs_info *fs_info = inode->root->fs_info;
 	struct cgroup_subsys_state *blkcg_css = wbc_blkcg_css(wbc);
 	struct async_cow *ctx;
 	struct async_chunk *async_chunk;
 	unsigned long nr_pages;
-	u64 cur_end;
 	u64 num_chunks = DIV_ROUND_UP(end - start, SZ_512K);
 	int i;
-	bool should_compress;
 	unsigned nofs_flag;
 	const blk_opf_t write_flags = wbc_to_write_flags(wbc);
 
-	unlock_extent(&inode->io_tree, start, end, NULL);
-
-	if (inode->flags & BTRFS_INODE_NOCOMPRESS &&
-	    !btrfs_test_opt(fs_info, FORCE_COMPRESS)) {
-		num_chunks = 1;
-		should_compress = false;
-	} else {
-		should_compress = true;
-	}
-
 	nofs_flag = memalloc_nofs_save();
 	ctx = kvmalloc(struct_size(ctx, chunks, num_chunks), GFP_KERNEL);
 	memalloc_nofs_restore(nofs_flag);
+	if (!ctx)
+		return false;
 
-	if (!ctx) {
-		unsigned clear_bits = EXTENT_LOCKED | EXTENT_DELALLOC |
-			EXTENT_DELALLOC_NEW | EXTENT_DEFRAG |
-			EXTENT_DO_ACCOUNTING;
-		unsigned long page_ops = PAGE_UNLOCK | PAGE_START_WRITEBACK |
-					 PAGE_END_WRITEBACK | PAGE_SET_ERROR;
-
-		extent_clear_unlock_delalloc(inode, start, end, locked_page,
-					     clear_bits, page_ops);
-		return -ENOMEM;
-	}
+	unlock_extent(&inode->io_tree, start, end, NULL);
+	set_bit(BTRFS_INODE_HAS_ASYNC_EXTENT, &inode->runtime_flags);
 
 	async_chunk = ctx->chunks;
 	atomic_set(&ctx->num_chunks, num_chunks);
 
 	for (i = 0; i < num_chunks; i++) {
-		if (should_compress)
-			cur_end = min(end, start + SZ_512K - 1);
-		else
-			cur_end = end;
+		u64 cur_end = min(end, start + SZ_512K - 1);
 
 		/*
 		 * igrab is called higher up in the call chain, take only the
@@ -1633,7 +1611,7 @@ static int cow_file_range_async(struct btrfs_inode *inode,
 		start = cur_end + 1;
 	}
 	*page_started = 1;
-	return 0;
+	return true;
 }
 
 static noinline int run_delalloc_zoned(struct btrfs_inode *inode,
@@ -2214,7 +2192,7 @@ int btrfs_run_delalloc_range(struct btrfs_inode *inode, struct page *locked_page
 		u64 start, u64 end, int *page_started, unsigned long *nr_written,
 		struct writeback_control *wbc)
 {
-	int ret;
+	int ret = 0;
 	const bool zoned = btrfs_is_zoned(inode->root->fs_info);
 
 	/*
@@ -2235,19 +2213,23 @@ int btrfs_run_delalloc_range(struct btrfs_inode *inode, struct page *locked_page
 		ASSERT(!zoned || btrfs_is_data_reloc_root(inode->root));
 		ret = run_delalloc_nocow(inode, locked_page, start, end,
 					 page_started, nr_written);
-	} else if (!btrfs_inode_can_compress(inode) ||
-		   !inode_need_compress(inode, start, end)) {
-		if (zoned)
-			ret = run_delalloc_zoned(inode, locked_page, start, end,
-						 page_started, nr_written);
-		else
-			ret = cow_file_range(inode, locked_page, start, end,
-					     page_started, nr_written, 1, NULL);
-	} else {
-		set_bit(BTRFS_INODE_HAS_ASYNC_EXTENT, &inode->runtime_flags);
-		ret = cow_file_range_async(inode, wbc, locked_page, start, end,
-					   page_started, nr_written);
+		goto out;
 	}
+
+	if (btrfs_inode_can_compress(inode) &&
+	    inode_need_compress(inode, start, end) &&
+	    cow_file_range_async(inode, wbc, locked_page, start,
+				 end, page_started, nr_written))
+		goto out;
+
+	if (zoned)
+		ret = run_delalloc_zoned(inode, locked_page, start, end,
+					 page_started, nr_written);
+	else
+		ret = cow_file_range(inode, locked_page, start, end,
+				     page_started, nr_written, 1, NULL);
+
+out:
 	ASSERT(ret <= 0);
 	if (ret)
 		btrfs_cleanup_ordered_extents(inode, locked_page, start,
Signature · 1 line
2.39.2
author maintainer
#57 lore raw

PATCH 57/800 btrfs: only call __extent_writepage_io from extent_write_locked_range

In reply to Greg Kroah-Hartman

From: Christoph Hellwig <[email protected]>

[ Upstream commit eb34dceace983e304e00d4bf711cec0a603959ac ]

__extent_writepage does a lot of things that make no sense for extent_write_locked_range, given that extent_write_locked_range itself is called from __extent_writepage either directly or through a workqueue, and all this work has already been done in the first invocation and the pages haven't been unlocked since. Call __extent_writepage_io directly instead and open code the logic tracked in btrfs_bio_ctrl::extent_locked.

Stable-dep-of: 7027f87108ce ("btrfs: don't treat zoned writeback as being from an async helper thread")

---
 fs/btrfs/extent_io.c | 65 ++++++++++++++++++--------------------------
 1 file changed, 26 insertions(+), 39 deletions(-)
fs/btrfs/extent_io.c +26 -39
index ac3aae55d55e5..6116da5d0a1ed 100644
@@ -103,12 +103,6 @@ struct btrfs_bio_ctrl {
 	blk_opf_t opf;
 	btrfs_bio_end_io_t end_io_func;
 	struct writeback_control *wbc;
-
-	/*
-	 * Tell writepage not to lock the state bits for this range, it still
-	 * does the unlocking.
-	 */
-	bool extent_locked;
 };
 
 static void submit_one_bio(struct btrfs_bio_ctrl *bio_ctrl)
@@ -1550,7 +1544,6 @@ static int __extent_writepage(struct page *page, struct btrfs_bio_ctrl *bio_ctrl
 {
 	struct folio *folio = page_folio(page);
 	struct inode *inode = page->mapping->host;
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
 	const u64 page_start = page_offset(page);
 	const u64 page_end = page_start + PAGE_SIZE - 1;
 	int ret;
@@ -1583,13 +1576,11 @@ static int __extent_writepage(struct page *page, struct btrfs_bio_ctrl *bio_ctrl
 		goto done;
 	}
 
-	if (!bio_ctrl->extent_locked) {
-		ret = writepage_delalloc(BTRFS_I(inode), page, bio_ctrl->wbc);
-		if (ret == 1)
-			return 0;
-		if (ret)
-			goto done;
-	}
+	ret = writepage_delalloc(BTRFS_I(inode), page, bio_ctrl->wbc);
+	if (ret == 1)
+		return 0;
+	if (ret)
+		goto done;
 
 	ret = __extent_writepage_io(BTRFS_I(inode), page, bio_ctrl, i_size, &nr);
 	if (ret == 1)
@@ -1634,21 +1625,7 @@ static int __extent_writepage(struct page *page, struct btrfs_bio_ctrl *bio_ctrl
 	 */
 	if (PageError(page))
 		end_extent_writepage(page, ret, page_start, page_end);
-	if (bio_ctrl->extent_locked) {
-		struct writeback_control *wbc = bio_ctrl->wbc;
-
-		/*
-		 * If bio_ctrl->extent_locked, it's from extent_write_locked_range(),
-		 * the page can either be locked by lock_page() or
-		 * process_one_page().
-		 * Let btrfs_page_unlock_writer() handle both cases.
-		 */
-		ASSERT(wbc);
-		btrfs_page_unlock_writer(fs_info, page, wbc->range_start,
-					 wbc->range_end + 1 - wbc->range_start);
-	} else {
-		unlock_page(page);
-	}
+	unlock_page(page);
 	ASSERT(ret <= 0);
 	return ret;
 }
@@ -2461,10 +2438,10 @@ int extent_write_locked_range(struct inode *inode, u64 start, u64 end)
 	int first_error = 0;
 	int ret = 0;
 	struct address_space *mapping = inode->i_mapping;
-	struct page *page;
+	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	const u32 sectorsize = fs_info->sectorsize;
+	loff_t i_size = i_size_read(inode);
 	u64 cur = start;
-	unsigned long nr_pages;
-	const u32 sectorsize = btrfs_sb(inode->i_sb)->sectorsize;
 	struct writeback_control wbc_writepages = {
 		.sync_mode	= WB_SYNC_ALL,
 		.range_start	= start,
@@ -2476,17 +2453,15 @@ int extent_write_locked_range(struct inode *inode, u64 start, u64 end)
 		/* We're called from an async helper function */
 		.opf = REQ_OP_WRITE | REQ_BTRFS_CGROUP_PUNT |
 			wbc_to_write_flags(&wbc_writepages),
-		.extent_locked = 1,
 	};
 
 	ASSERT(IS_ALIGNED(start, sectorsize) && IS_ALIGNED(end + 1, sectorsize));
-	nr_pages = (round_up(end, PAGE_SIZE) - round_down(start, PAGE_SIZE)) >>
-		   PAGE_SHIFT;
-	wbc_writepages.nr_to_write = nr_pages * 2;
 
 	wbc_attach_fdatawrite_inode(&wbc_writepages, inode);
 	while (cur <= end) {
 		u64 cur_end = min(round_down(cur, PAGE_SIZE) + PAGE_SIZE - 1, end);
+		struct page *page;
+		int nr = 0;
 
 		page = find_get_page(mapping, cur >> PAGE_SHIFT);
 		/*
@@ -2497,12 +2472,25 @@ int extent_write_locked_range(struct inode *inode, u64 start, u64 end)
 		ASSERT(PageLocked(page));
 		ASSERT(PageDirty(page));
 		clear_page_dirty_for_io(page);
-		ret = __extent_writepage(page, &bio_ctrl);
-		ASSERT(ret <= 0);
+
+		ret = __extent_writepage_io(BTRFS_I(inode), page, &bio_ctrl,
+					    i_size, &nr);
+		if (ret == 1)
+			goto next_page;
+
+		/* Make sure the mapping tag for page dirty gets cleared. */
+		if (nr == 0) {
+			set_page_writeback(page);
+			end_page_writeback(page);
+		}
+		if (ret)
+			end_extent_writepage(page, ret, cur, cur_end);
+		btrfs_page_unlock_writer(fs_info, page, cur, cur_end + 1 - cur);
 		if (ret < 0) {
 			found_error = true;
 			first_error = ret;
 		}
+next_page:
 		put_page(page);
 		cur = cur_end + 1;
 	}
@@ -2523,7 +2511,6 @@ int extent_writepages(struct address_space *mapping,
 	struct btrfs_bio_ctrl bio_ctrl = {
 		.wbc = wbc,
 		.opf = REQ_OP_WRITE | wbc_to_write_flags(wbc),
-		.extent_locked = 0,
 	};
 
 	/*
Signature · 1 line
2.39.2
author maintainer
#58 lore raw

PATCH 58/800 btrfs: dont treat zoned writeback as being from an async helper thread

In reply to Greg Kroah-Hartman

From: Christoph Hellwig <[email protected]>

[ Upstream commit 7027f87108ce3d23ea542e1a9a79056530db4a87 ]

When extent_write_locked_range was originally added, it was only used writing back compressed pages from an async helper thread. But it is now also used for writing back pages on zoned devices, where it is called directly from the ->writepage context. In this case we want to be able to pass on the writeback_control instead of creating a new one, and more importantly want to use all the normal cgroup interaction instead of potentially deferring writeback to another helper.

Fixes 898793d992c2 ("btrfs: zoned: write out partially allocated region")
---
 fs/btrfs/extent_io.c | 20 +++++++-------------
 fs/btrfs/extent_io.h |  3 ++-
 fs/btrfs/inode.c     | 20 +++++++++++++++-----
 3 files changed, 24 insertions(+), 19 deletions(-)
fs/btrfs/extent_io.c +7 -13
index 6116da5d0a1ed..a69a488605b21 100644
@@ -2432,7 +2432,8 @@ static int extent_write_cache_pages(struct address_space *mapping,
  * already been ran (aka, ordered extent inserted) and all pages are still
  * locked.
  */
-int extent_write_locked_range(struct inode *inode, u64 start, u64 end)
+int extent_write_locked_range(struct inode *inode, u64 start, u64 end,
+			      struct writeback_control *wbc)
 {
 	bool found_error = false;
 	int first_error = 0;
@@ -2442,22 +2443,16 @@ int extent_write_locked_range(struct inode *inode, u64 start, u64 end)
 	const u32 sectorsize = fs_info->sectorsize;
 	loff_t i_size = i_size_read(inode);
 	u64 cur = start;
-	struct writeback_control wbc_writepages = {
-		.sync_mode	= WB_SYNC_ALL,
-		.range_start	= start,
-		.range_end	= end,
-		.no_cgroup_owner = 1,
-	};
 	struct btrfs_bio_ctrl bio_ctrl = {
-		.wbc = &wbc_writepages,
-		/* We're called from an async helper function */
-		.opf = REQ_OP_WRITE | REQ_BTRFS_CGROUP_PUNT |
-			wbc_to_write_flags(&wbc_writepages),
+		.wbc = wbc,
+		.opf = REQ_OP_WRITE | wbc_to_write_flags(wbc),
 	};
 
+	if (wbc->no_cgroup_owner)
+		bio_ctrl.opf |= REQ_BTRFS_CGROUP_PUNT;
+
 	ASSERT(IS_ALIGNED(start, sectorsize) && IS_ALIGNED(end + 1, sectorsize));
 
-	wbc_attach_fdatawrite_inode(&wbc_writepages, inode);
 	while (cur <= end) {
 		u64 cur_end = min(round_down(cur, PAGE_SIZE) + PAGE_SIZE - 1, end);
 		struct page *page;
@@ -2497,7 +2492,6 @@ int extent_write_locked_range(struct inode *inode, u64 start, u64 end)
 
 	submit_write_bio(&bio_ctrl, found_error ? ret : 0);
 
-	wbc_detach_inode(&wbc_writepages);
 	if (found_error)
 		return first_error;
 	return ret;
fs/btrfs/extent_io.h +2 -1
index 4341ad978fb8e..aac7e6817e8ff 100644
@@ -179,7 +179,8 @@ int try_release_extent_mapping(struct page *page, gfp_t mask);
 int try_release_extent_buffer(struct page *page);
 
 int btrfs_read_folio(struct file *file, struct folio *folio);
-int extent_write_locked_range(struct inode *inode, u64 start, u64 end);
+int extent_write_locked_range(struct inode *inode, u64 start, u64 end,
+			      struct writeback_control *wbc);
 int extent_writepages(struct address_space *mapping,
 		      struct writeback_control *wbc);
 int btree_write_cache_pages(struct address_space *mapping,
fs/btrfs/inode.c +15 -5
index 3d12dba145152..2e6eed4b1b3cc 100644
@@ -934,6 +934,12 @@ static int submit_uncompressed_range(struct btrfs_inode *inode,
 	unsigned long nr_written = 0;
 	int page_started = 0;
 	int ret;
+	struct writeback_control wbc = {
+		.sync_mode		= WB_SYNC_ALL,
+		.range_start		= start,
+		.range_end		= end,
+		.no_cgroup_owner	= 1,
+	};
 
 	/*
 	 * Call cow_file_range() to run the delalloc range directly, since we
@@ -965,7 +971,10 @@ static int submit_uncompressed_range(struct btrfs_inode *inode,
 	}
 
 	/* All pages will be unlocked, including @locked_page */
-	return extent_write_locked_range(&inode->vfs_inode, start, end);
+	wbc_attach_fdatawrite_inode(&wbc, &inode->vfs_inode);
+	ret = extent_write_locked_range(&inode->vfs_inode, start, end, &wbc);
+	wbc_detach_inode(&wbc);
+	return ret;
 }
 
 static int submit_one_async_extent(struct btrfs_inode *inode,
@@ -1617,7 +1626,8 @@ static bool cow_file_range_async(struct btrfs_inode *inode,
 static noinline int run_delalloc_zoned(struct btrfs_inode *inode,
 				       struct page *locked_page, u64 start,
 				       u64 end, int *page_started,
-				       unsigned long *nr_written)
+				       unsigned long *nr_written,
+				       struct writeback_control *wbc)
 {
 	u64 done_offset = end;
 	int ret;
@@ -1649,8 +1659,8 @@ static noinline int run_delalloc_zoned(struct btrfs_inode *inode,
 			account_page_redirty(locked_page);
 		}
 		locked_page_done = true;
-		extent_write_locked_range(&inode->vfs_inode, start, done_offset);
-
+		extent_write_locked_range(&inode->vfs_inode, start, done_offset,
+					  wbc);
 		start = done_offset + 1;
 	}
 
@@ -2224,7 +2234,7 @@ int btrfs_run_delalloc_range(struct btrfs_inode *inode, struct page *locked_page
 
 	if (zoned)
 		ret = run_delalloc_zoned(inode, locked_page, start, end,
-					 page_started, nr_written);
+					 page_started, nr_written, wbc);
 	else
 		ret = cow_file_range(inode, locked_page, start, end,
 				     page_started, nr_written, 1, NULL);
Signature · 1 line
2.39.2
author maintainer
#59 lore raw

PATCH 59/800 btrfs: fix file_offset for REQ_BTRFS_ONE_ORDERED bios that get split

In reply to Greg Kroah-Hartman

From: Christoph Hellwig <[email protected]>

[ Upstream commit c731cd0b6d255e4855a7cac9f276864032ab2387 ]

If a bio gets split, it needs to have a proper file_offset for checksum validation and repair to work properly.

Based on feedback from Josef, commit 852eee62d31a ("btrfs: allow btrfs_submit_bio to split bios") skipped this adjustment for ONE_ORDERED bios. But if we actually ever need to split a ONE_ORDERED read bio, this will lead to a wrong file offset in the repair code. Right now the only user of the file_offset is logging of an error message so this is mostly harmless, but the wrong offset might be more problematic for additional users in the future.

Fixes 852eee62d31a ("btrfs: allow btrfs_submit_bio to split bios")
---
 fs/btrfs/bio.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/btrfs/bio.c +1 -2
index b3ad0f51e6162..b86faf8126e77 100644
@@ -95,8 +95,7 @@ static struct btrfs_bio *btrfs_split_bio(struct btrfs_fs_info *fs_info,
 	btrfs_bio_init(bbio, fs_info, NULL, orig_bbio);
 	bbio->inode = orig_bbio->inode;
 	bbio->file_offset = orig_bbio->file_offset;
-	if (!(orig_bbio->bio.bi_opf & REQ_BTRFS_ONE_ORDERED))
-		orig_bbio->file_offset += map_length;
+	orig_bbio->file_offset += map_length;
 
 	atomic_inc(&orig_bbio->pending_ios);
 	return bbio;
Signature · 1 line
2.39.2
author maintainer
#60 lore raw

PATCH 60/800 blk-mq: dont insert passthrough request into sw queue

In reply to Greg Kroah-Hartman

From: Ming Lei <[email protected]>

[ Upstream commit 2293cae703cda162684ae966db6b1b4a11b5e88f ]

In case of real io scheduler, q->elevator is set, so blk_mq_run_hw_queue() may just check if scheduler queue has request to dispatch, see __blk_mq_sched_dispatch_requests(). Then IO hang may be caused because all passthorugh requests may stay in sw queue.

And any passthrough request should have been inserted to hctx->dispatch always.

Fixes d97217e7f024 ("blk-mq: don't queue plugged passthrough requests into scheduler")
---
 block/blk-mq.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
block/blk-mq.c +6 -1
index c763f0bc66371..b9f4546139894 100644
@@ -2735,7 +2735,12 @@ static void blk_mq_dispatch_plug_list(struct blk_plug *plug, bool from_sched)
 
 	percpu_ref_get(&this_hctx->queue->q_usage_counter);
 	/* passthrough requests should never be issued to the I/O scheduler */
-	if (this_hctx->queue->elevator && !is_passthrough) {
+	if (is_passthrough) {
+		spin_lock(&this_hctx->lock);
+		list_splice_tail_init(&list, &this_hctx->dispatch);
+		spin_unlock(&this_hctx->lock);
+		blk_mq_run_hw_queue(this_hctx, from_sched);
+	} else if (this_hctx->queue->elevator) {
 		this_hctx->queue->elevator->type->ops.insert_requests(this_hctx,
 				&list, 0);
 		blk_mq_run_hw_queue(this_hctx, from_sched);
Signature · 1 line
2.39.2
author maintainer
#61 lore raw

PATCH 61/800 clocksource/drivers/cadence-ttc: Fix memory leak in ttc_timer_probe

In reply to Greg Kroah-Hartman

From: Feng Mingxi <[email protected]>

[ Upstream commit 8b5bf64c89c7100c921bd807ba39b2eb003061ab ]

Smatch reports:
drivers/clocksource/timer-cadence-ttc.c:529 ttc_timer_probe()
warn: 'timer_baseaddr' from of_iomap() not released on lines: 498,508,516.

timer_baseaddr may have the problem of not being released after use, I replaced it with the devm_of_iomap() function and added the clk_put() function to cleanup the "clk_ce" and "clk_cs".

Fixes e932900a3279 ("arm: zynq: Use standard timer binding")
Fixes 70504f311d4b ("clocksource/drivers/cadence_ttc: Convert init function to return error")
---
 drivers/clocksource/timer-cadence-ttc.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/clocksource/timer-cadence-ttc.c +13 -6
index 4efd0cf3b602d..0d52e28fea4de 100644
@@ -486,10 +486,10 @@ static int __init ttc_timer_probe(struct platform_device *pdev)
 	 * and use it. Note that the event timer uses the interrupt and it's the
 	 * 2nd TTC hence the irq_of_parse_and_map(,1)
 	 */
-	timer_baseaddr = of_iomap(timer, 0);
-	if (!timer_baseaddr) {
+	timer_baseaddr = devm_of_iomap(&pdev->dev, timer, 0, NULL);
+	if (IS_ERR(timer_baseaddr)) {
 		pr_err("ERROR: invalid timer base address\n");
-		return -ENXIO;
+		return PTR_ERR(timer_baseaddr);
 	}
 
 	irq = irq_of_parse_and_map(timer, 1);
@@ -513,20 +513,27 @@ static int __init ttc_timer_probe(struct platform_device *pdev)
 	clk_ce = of_clk_get(timer, clksel);
 	if (IS_ERR(clk_ce)) {
 		pr_err("ERROR: timer input clock not found\n");
-		return PTR_ERR(clk_ce);
+		ret = PTR_ERR(clk_ce);
+		goto put_clk_cs;
 	}
 
 	ret = ttc_setup_clocksource(clk_cs, timer_baseaddr, timer_width);
 	if (ret)
-		return ret;
+		goto put_clk_ce;
 
 	ret = ttc_setup_clockevent(clk_ce, timer_baseaddr + 4, irq);
 	if (ret)
-		return ret;
+		goto put_clk_ce;
 
 	pr_info("%pOFn #0 at %p, irq=%d\n", timer, timer_baseaddr, irq);
 
 	return 0;
+
+put_clk_ce:
+	clk_put(clk_ce);
+put_clk_cs:
+	clk_put(clk_cs);
+	return ret;
 }
 
 static const struct of_device_id ttc_timer_of_match[] = {
Signature · 1 line
2.39.2
author maintainer
#62 lore raw

PATCH 62/800 PM: domains: fix integer overflow issues in genpd_parse_state()

In reply to Greg Kroah-Hartman

From: Nikita Zhandarovich <[email protected]>

[ Upstream commit e5d1c8722083f0332dcd3c85fa1273d85fb6bed8 ]

Currently, while calculating residency and latency values, right operands may overflow if resulting values are big enough.

To prevent this, albeit unlikely case, play it safe and convert right operands to left ones' type s64.

Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE.

Fixes 30f604283e05 ("PM / Domains: Allow domain power states to be read from DT")
---
 drivers/base/power/domain.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/base/power/domain.c +3 -3
index 32084e38b73d0..51b9d4eaab5ea 100644
@@ -2939,10 +2939,10 @@ static int genpd_parse_state(struct genpd_power_state *genpd_state,
 
 	err = of_property_read_u32(state_node, "min-residency-us", &residency);
 	if (!err)
-		genpd_state->residency_ns = 1000 * residency;
+		genpd_state->residency_ns = 1000LL * residency;
 
-	genpd_state->power_on_latency_ns = 1000 * exit_latency;
-	genpd_state->power_off_latency_ns = 1000 * entry_latency;
+	genpd_state->power_on_latency_ns = 1000LL * exit_latency;
+	genpd_state->power_off_latency_ns = 1000LL * entry_latency;
 	genpd_state->fwnode = &state_node->fwnode;
 
 	return 0;
Signature · 1 line
2.39.2
author maintainer
#63 lore raw

PATCH 63/800 perf/arm-cmn: Fix DTC reset

In reply to Greg Kroah-Hartman

From: Robin Murphy <[email protected]>

[ Upstream commit 71746c995cac92fcf6a65661b51211cf2009d7f0 ]

It turns out that my naive DTC reset logic fails to work as intended, since, after checking with the hardware designers, the PMU actually needs to be fully enabled in order to correctly clear any pending overflows. Therefore, invert the sequence to start with turning on both enables so that we can reliably get the DTCs into a known state, then moving to our normal counters-stopped state from there. Since all the DTM counters have already been unpaired during the initial discovery pass, we just need to additionally reset the cycle counters to ensure that no other unexpected overflows occur during this period.

---
 drivers/perf/arm-cmn.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/perf/arm-cmn.c +4 -3
index 47d359f729579..89a685a09d848 100644
@@ -1899,9 +1899,10 @@ static int arm_cmn_init_dtc(struct arm_cmn *cmn, struct arm_cmn_node *dn, int id
 	if (dtc->irq < 0)
 		return dtc->irq;
 
-	writel_relaxed(0, dtc->base + CMN_DT_PMCR);
+	writel_relaxed(CMN_DT_DTC_CTL_DT_EN, dtc->base + CMN_DT_DTC_CTL);
+	writel_relaxed(CMN_DT_PMCR_PMU_EN | CMN_DT_PMCR_OVFL_INTR_EN, dtc->base + CMN_DT_PMCR);
+	writeq_relaxed(0, dtc->base + CMN_DT_PMCCNTR);
 	writel_relaxed(0x1ff, dtc->base + CMN_DT_PMOVSR_CLR);
-	writel_relaxed(CMN_DT_PMCR_OVFL_INTR_EN, dtc->base + CMN_DT_PMCR);
 
 	return 0;
 }
@@ -1961,7 +1962,7 @@ static int arm_cmn_init_dtcs(struct arm_cmn *cmn)
 			dn->type = CMN_TYPE_CCLA;
 	}
 
-	writel_relaxed(CMN_DT_DTC_CTL_DT_EN, cmn->dtc[0].base + CMN_DT_DTC_CTL);
+	arm_cmn_set_state(cmn, CMN_STATE_DISABLED);
 
 	return 0;
 }
Signature · 1 line
2.39.2
author maintainer
#64 lore raw

PATCH 64/800 drivers/perf: apple_m1: Force 63bit counters for M2 CPUs

In reply to Greg Kroah-Hartman

From: Marc Zyngier <[email protected]>

[ Upstream commit 8be3593b9efa8903d2ee7bb9cdf57a8e56c66f36 ]

Sidharth reports that on M2, the PMU never generates any interrupt when using 'perf record', which is a annoying as you get no sample. I'm temped to say "no sample, no problem", but others may have a different opinion.

Upon investigation, it appears that the counters on M2 are significantly different from the ones on M1, as they count on 64 bits instead of 48. Which of course, in the fine M1 tradition, means that we can only use 63 bits, as the top bit is used to signal the interrupt...

This results in having to introduce yet another flag to indicate yet another odd counter width. Who knows what the next crazy implementation will do...

With this, perf can work out the correct offset, and 'perf record' works as intended.

Tested on M2 and M2-Pro CPUs.

Cc Janne Grunau <[email protected]>
Cc Hector Martin <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Will Deacon <[email protected]>
Fixes 7d0bfb7c9977 ("drivers/perf: apple_m1: Add Apple M2 support")
---
 drivers/perf/apple_m1_cpu_pmu.c | 30 ++++++++++++++++++++++++------
 drivers/perf/arm_pmu.c          |  2 ++
 include/linux/perf/arm_pmu.h    |  2 ++
 3 files changed, 28 insertions(+), 6 deletions(-)
drivers/perf/apple_m1_cpu_pmu.c +24 -6
index 8574c6e58c83a..cd2de44b61b91 100644
@@ -493,6 +493,17 @@ static int m1_pmu_map_event(struct perf_event *event)
 	return armpmu_map_event(event, &m1_pmu_perf_map, NULL, M1_PMU_CFG_EVENT);
 }
 
+static int m2_pmu_map_event(struct perf_event *event)
+{
+	/*
+	 * Same deal as the above, except that M2 has 64bit counters.
+	 * Which, as far as we're concerned, actually means 63 bits.
+	 * Yes, this is getting awkward.
+	 */
+	event->hw.flags |= ARMPMU_EVT_63BIT;
+	return armpmu_map_event(event, &m1_pmu_perf_map, NULL, M1_PMU_CFG_EVENT);
+}
+
 static void m1_pmu_reset(void *info)
 {
 	int i;
@@ -525,7 +536,7 @@ static int m1_pmu_set_event_filter(struct hw_perf_event *event,
 	return 0;
 }
 
-static int m1_pmu_init(struct arm_pmu *cpu_pmu)
+static int m1_pmu_init(struct arm_pmu *cpu_pmu, u32 flags)
 {
 	cpu_pmu->handle_irq	  = m1_pmu_handle_irq;
 	cpu_pmu->enable		  = m1_pmu_enable_event;
@@ -536,7 +547,14 @@ static int m1_pmu_init(struct arm_pmu *cpu_pmu)
 	cpu_pmu->clear_event_idx  = m1_pmu_clear_event_idx;
 	cpu_pmu->start		  = m1_pmu_start;
 	cpu_pmu->stop		  = m1_pmu_stop;
-	cpu_pmu->map_event	  = m1_pmu_map_event;
+
+	if (flags & ARMPMU_EVT_47BIT)
+		cpu_pmu->map_event = m1_pmu_map_event;
+	else if (flags & ARMPMU_EVT_63BIT)
+		cpu_pmu->map_event = m2_pmu_map_event;
+	else
+		return WARN_ON(-EINVAL);
+
 	cpu_pmu->reset		  = m1_pmu_reset;
 	cpu_pmu->set_event_filter = m1_pmu_set_event_filter;
 
@@ -550,25 +568,25 @@ static int m1_pmu_init(struct arm_pmu *cpu_pmu)
 static int m1_pmu_ice_init(struct arm_pmu *cpu_pmu)
 {
 	cpu_pmu->name = "apple_icestorm_pmu";
-	return m1_pmu_init(cpu_pmu);
+	return m1_pmu_init(cpu_pmu, ARMPMU_EVT_47BIT);
 }
 
 static int m1_pmu_fire_init(struct arm_pmu *cpu_pmu)
 {
 	cpu_pmu->name = "apple_firestorm_pmu";
-	return m1_pmu_init(cpu_pmu);
+	return m1_pmu_init(cpu_pmu, ARMPMU_EVT_47BIT);
 }
 
 static int m2_pmu_avalanche_init(struct arm_pmu *cpu_pmu)
 {
 	cpu_pmu->name = "apple_avalanche_pmu";
-	return m1_pmu_init(cpu_pmu);
+	return m1_pmu_init(cpu_pmu, ARMPMU_EVT_63BIT);
 }
 
 static int m2_pmu_blizzard_init(struct arm_pmu *cpu_pmu)
 {
 	cpu_pmu->name = "apple_blizzard_pmu";
-	return m1_pmu_init(cpu_pmu);
+	return m1_pmu_init(cpu_pmu, ARMPMU_EVT_63BIT);
 }
 
 static const struct of_device_id m1_pmu_of_device_ids[] = {
drivers/perf/arm_pmu.c +2 -0
index 15bd1e34a88ea..277e29fbd504f 100644
@@ -109,6 +109,8 @@ static inline u64 arm_pmu_event_max_period(struct perf_event *event)
 {
 	if (event->hw.flags & ARMPMU_EVT_64BIT)
 		return GENMASK_ULL(63, 0);
+	else if (event->hw.flags & ARMPMU_EVT_63BIT)
+		return GENMASK_ULL(62, 0);
 	else if (event->hw.flags & ARMPMU_EVT_47BIT)
 		return GENMASK_ULL(46, 0);
 	else
include/linux/perf/arm_pmu.h +2 -0
index 525b5d64e3948..c0e4baf940dce 100644
@@ -26,9 +26,11 @@
  */
 #define ARMPMU_EVT_64BIT		0x00001 /* Event uses a 64bit counter */
 #define ARMPMU_EVT_47BIT		0x00002 /* Event uses a 47bit counter */
+#define ARMPMU_EVT_63BIT		0x00004 /* Event uses a 63bit counter */
 
 static_assert((PERF_EVENT_FLAG_ARCH & ARMPMU_EVT_64BIT) == ARMPMU_EVT_64BIT);
 static_assert((PERF_EVENT_FLAG_ARCH & ARMPMU_EVT_47BIT) == ARMPMU_EVT_47BIT);
+static_assert((PERF_EVENT_FLAG_ARCH & ARMPMU_EVT_63BIT) == ARMPMU_EVT_63BIT);
 
 #define HW_OP_UNSUPPORTED		0xFFFF
 #define C(_x)				PERF_COUNT_HW_CACHE_##_x
Signature · 1 line
2.39.2
author maintainer
#65 lore raw

PATCH 65/800 x86/mm: Allow guest.enc_status_change_prepare() to fail

In reply to Greg Kroah-Hartman

From: Kirill A. Shutemov <[email protected]>

[ Upstream commit 3f6819dd192ef4f0c568ec3e9d6d408b3fa1ad3d ]

TDX code is going to provide guest.enc_status_change_prepare() that is able to fail. TDX will use the call to convert the GPA range from shared to private. This operation can fail.

Add a way to return an error from the callback.

Stable-dep-of: 195edce08b63 ("x86/tdx: Fix race between set_memory_encrypted() and load_unaligned_zeropad()")

---
 arch/x86/include/asm/x86_init.h | 2 +-
 arch/x86/kernel/x86_init.c      | 2 +-
 arch/x86/mm/mem_encrypt_amd.c   | 4 +++-
 arch/x86/mm/pat/set_memory.c    | 3 ++-
 4 files changed, 7 insertions(+), 4 deletions(-)
arch/x86/include/asm/x86_init.h +1 -1
index 88085f369ff6f..1ca9701917c55 100644
@@ -150,7 +150,7 @@ struct x86_init_acpi {
  * @enc_cache_flush_required	Returns true if a cache flush is needed before changing page encryption status
  */
 struct x86_guest {
-	void (*enc_status_change_prepare)(unsigned long vaddr, int npages, bool enc);
+	bool (*enc_status_change_prepare)(unsigned long vaddr, int npages, bool enc);
 	bool (*enc_status_change_finish)(unsigned long vaddr, int npages, bool enc);
 	bool (*enc_tlb_flush_required)(bool enc);
 	bool (*enc_cache_flush_required)(void);
arch/x86/kernel/x86_init.c +1 -1
index d82f4fa2f1bfe..f230d4d7d8eb4 100644
@@ -130,7 +130,7 @@ struct x86_cpuinit_ops x86_cpuinit = {
 
 static void default_nmi_init(void) { };
 
-static void enc_status_change_prepare_noop(unsigned long vaddr, int npages, bool enc) { }
+static bool enc_status_change_prepare_noop(unsigned long vaddr, int npages, bool enc) { return true; }
 static bool enc_status_change_finish_noop(unsigned long vaddr, int npages, bool enc) { return false; }
 static bool enc_tlb_flush_required_noop(bool enc) { return false; }
 static bool enc_cache_flush_required_noop(void) { return false; }
arch/x86/mm/mem_encrypt_amd.c +3 -1
index e0b51c09109f6..4f95c449a406e 100644
@@ -319,7 +319,7 @@ static void enc_dec_hypercall(unsigned long vaddr, int npages, bool enc)
 #endif
 }
 
-static void amd_enc_status_change_prepare(unsigned long vaddr, int npages, bool enc)
+static bool amd_enc_status_change_prepare(unsigned long vaddr, int npages, bool enc)
 {
 	/*
 	 * To maintain the security guarantees of SEV-SNP guests, make sure
@@ -327,6 +327,8 @@ static void amd_enc_status_change_prepare(unsigned long vaddr, int npages, bool
 	 */
 	if (cc_platform_has(CC_ATTR_GUEST_SEV_SNP) && !enc)
 		snp_set_memory_shared(vaddr, npages);
+
+	return true;
 }
 
 /* Return true unconditionally: return value doesn't matter for the SEV side */
arch/x86/mm/pat/set_memory.c +2 -1
index 7159cf7876130..b8f48ebe753c7 100644
@@ -2151,7 +2151,8 @@ static int __set_memory_enc_pgtable(unsigned long addr, int numpages, bool enc)
 		cpa_flush(&cpa, x86_platform.guest.enc_cache_flush_required());
 
 	/* Notify hypervisor that we are about to set/clr encryption attribute. */
-	x86_platform.guest.enc_status_change_prepare(addr, numpages, enc);
+	if (!x86_platform.guest.enc_status_change_prepare(addr, numpages, enc))
+		return -EIO;
 
 	ret = __change_page_attr_set_clr(&cpa, 1);
 
Signature · 1 line
2.39.2
author maintainer
#66 lore raw

PATCH 66/800 x86/tdx: Fix race between set_memory_encrypted() and load_unaligned_zeropad()

In reply to Greg Kroah-Hartman

From: Kirill A. Shutemov <[email protected]>

[ Upstream commit 195edce08b63d293377f615f4f7f086715d2d212 ]

tl;dr: There is a race in the TDX private<=>shared conversion code
which could kill the TDX guest. Fix it by changing conversion ordering to eliminate the window.

TDX hardware maintains metadata to track which pages are private and shared. Additionally, TDX guests use the guest x86 page tables to specify whether a given mapping is intended to be private or shared. Bad things happen when the intent and metadata do not match.

So there are two thing in play:
1. "the page" -- the physical TDX page metadata
2. "the mapping" -- the guest-controlled x86 page table intent

For instance, an unrecoverable exit to VMM occurs if a guest touches a private mapping that points to a shared physical page.

In summary:
* Private mapping => Private Page == OK (obviously)
* Shared mapping => Shared Page == OK (obviously)
* Private mapping => Shared Page == BIG BOOM!
* Shared mapping => Private Page == OK-ish
(It will read generate a recoverable #VE via handle_mmio())

Enter load_unaligned_zeropad(). It can touch memory that is adjacent but otherwise unrelated to the memory it needs to touch. It will cause one of those unrecoverable exits (aka. BIG BOOM) if it blunders into a shared mapping pointing to a private page.

This is a problem when __set_memory_enc_pgtable() converts pages from shared to private. It first changes the mapping and second modifies the TDX page metadata. It's moving from:

* Shared mapping => Shared Page == OK
to:
* Private mapping => Shared Page == BIG BOOM!

This means that there is a window with a shared mapping pointing to a private page where load_unaligned_zeropad() can strike.

Add a TDX handler for guest.enc_status_change_prepare(). This converts the page from shared to private *before* the page becomes private. This ensures that there is never a private mapping to a shared page.

Leave a guest.enc_status_change_finish() in place but only use it for private=>shared conversions. This will delay updating the TDX metadata marking the page private until *after* the mapping matches the metadata. This also ensures that there is never a private mapping to a shared page.

[ dhansen: rewrite changelog ]

---
 arch/x86/coco/tdx/tdx.c | 51 ++++++++++++++++++++++++++++++++++++++---
 1 file changed, 48 insertions(+), 3 deletions(-)
arch/x86/coco/tdx/tdx.c +48 -3
index e146b599260f8..64f1343df062f 100644
@@ -840,6 +840,30 @@ static bool tdx_enc_status_changed(unsigned long vaddr, int numpages, bool enc)
 	return true;
 }
 
+static bool tdx_enc_status_change_prepare(unsigned long vaddr, int numpages,
+					  bool enc)
+{
+	/*
+	 * Only handle shared->private conversion here.
+	 * See the comment in tdx_early_init().
+	 */
+	if (enc)
+		return tdx_enc_status_changed(vaddr, numpages, enc);
+	return true;
+}
+
+static bool tdx_enc_status_change_finish(unsigned long vaddr, int numpages,
+					 bool enc)
+{
+	/*
+	 * Only handle private->shared conversion here.
+	 * See the comment in tdx_early_init().
+	 */
+	if (!enc)
+		return tdx_enc_status_changed(vaddr, numpages, enc);
+	return true;
+}
+
 void __init tdx_early_init(void)
 {
 	u64 cc_mask;
@@ -867,9 +891,30 @@ void __init tdx_early_init(void)
 	 */
 	physical_mask &= cc_mask - 1;
 
-	x86_platform.guest.enc_cache_flush_required = tdx_cache_flush_required;
-	x86_platform.guest.enc_tlb_flush_required   = tdx_tlb_flush_required;
-	x86_platform.guest.enc_status_change_finish = tdx_enc_status_changed;
+	/*
+	 * The kernel mapping should match the TDX metadata for the page.
+	 * load_unaligned_zeropad() can touch memory *adjacent* to that which is
+	 * owned by the caller and can catch even _momentary_ mismatches.  Bad
+	 * things happen on mismatch:
+	 *
+	 *   - Private mapping => Shared Page  == Guest shutdown
+         *   - Shared mapping  => Private Page == Recoverable #VE
+	 *
+	 * guest.enc_status_change_prepare() converts the page from
+	 * shared=>private before the mapping becomes private.
+	 *
+	 * guest.enc_status_change_finish() converts the page from
+	 * private=>shared after the mapping becomes private.
+	 *
+	 * In both cases there is a temporary shared mapping to a private page,
+	 * which can result in a #VE.  But, there is never a private mapping to
+	 * a shared page.
+	 */
+	x86_platform.guest.enc_status_change_prepare = tdx_enc_status_change_prepare;
+	x86_platform.guest.enc_status_change_finish  = tdx_enc_status_change_finish;
+
+	x86_platform.guest.enc_cache_flush_required  = tdx_cache_flush_required;
+	x86_platform.guest.enc_tlb_flush_required    = tdx_tlb_flush_required;
 
 	pr_info("Guest detected\n");
 }
Signature · 1 line
2.39.2
author maintainer
#67 lore raw

PATCH 67/800 drivers/perf: hisi: Dont migrate perf to the CPU going to teardown

In reply to Greg Kroah-Hartman

From: Junhao He <[email protected]>

[ Upstream commit 7a6a9f1c5a0a875a421db798d4b2ee022dc1ee1a ]

The driver needs to migrate the perf context if the current using CPU going to teardown. By the time calling the cpuhp::teardown() callback the cpu_online_mask() hasn't updated yet and still includes the CPU going to teardown. In current driver's implementation we may migrate the context to the teardown CPU and leads to the below calltrace:

...

[  368.104662][  T932] task:cpuhp/0         state:D stack:    0 pid:   15 ppid:     2 flags:0x00000008
[  368.113699][  T932] Call trace:
[  368.116834][  T932]  __switch_to+0x7c/0xbc
[  368.120924][  T932]  __schedule+0x338/0x6f0
[  368.125098][  T932]  schedule+0x50/0xe0
[  368.128926][  T932]  schedule_preempt_disabled+0x18/0x24
[  368.134229][  T932]  __mutex_lock.constprop.0+0x1d4/0x5dc
[  368.139617][  T932]  __mutex_lock_slowpath+0x1c/0x30
[  368.144573][  T932]  mutex_lock+0x50/0x60
[  368.148579][  T932]  perf_pmu_migrate_context+0x84/0x2b0
[  368.153884][  T932]  hisi_pcie_pmu_offline_cpu+0x90/0xe0 [hisi_pcie_pmu]
[  368.160579][  T932]  cpuhp_invoke_callback+0x2a0/0x650
[  368.165707][  T932]  cpuhp_thread_fun+0xe4/0x190
[  368.170316][  T932]  smpboot_thread_fn+0x15c/0x1a0
[  368.175099][  T932]  kthread+0x108/0x13c
[  368.179012][  T932]  ret_from_fork+0x10/0x18

...

Use function cpumask_any_but() to find one correct active cpu to fixes this issue.

---
 drivers/perf/hisilicon/hisi_pcie_pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/hisilicon/hisi_pcie_pmu.c +1 -1
index 6fee0b6e163bb..e10fc7cb9493a 100644
@@ -683,7 +683,7 @@ static int hisi_pcie_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node)
 
 	pcie_pmu->on_cpu = -1;
 	/* Choose a new CPU from all online cpus. */
-	target = cpumask_first(cpu_online_mask);
+	target = cpumask_any_but(cpu_online_mask, cpu);
 	if (target >= nr_cpu_ids) {
 		pci_err(pcie_pmu->pdev, "There is no CPU to set\n");
 		return 0;
Signature · 1 line
2.39.2
author maintainer
#68 lore raw

PATCH 68/800 perf: arm_cspmu: Set irq affinitiy only if overflow interrupt is used

In reply to Greg Kroah-Hartman

From: Ilkka Koskinen <[email protected]>

[ Upstream commit 225d757012e0afa673d8c862e6fb39ed2f429b4d ]

Don't try to set irq affinity if PMU doesn't have an overflow interrupt.

Fixes e37dfd65731d ("perf: arm_cspmu: Add support for ARM CoreSight PMU driver")
---
 drivers/perf/arm_cspmu/arm_cspmu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/perf/arm_cspmu/arm_cspmu.c +2 -1
index a3f1c410b4173..d0572162f0632 100644
@@ -1232,7 +1232,8 @@ static struct platform_driver arm_cspmu_driver = {
 static void arm_cspmu_set_active_cpu(int cpu, struct arm_cspmu *cspmu)
 {
 	cpumask_set_cpu(cpu, &cspmu->active_cpu);
-	WARN_ON(irq_set_affinity(cspmu->irq, &cspmu->active_cpu));
+	if (cspmu->irq)
+		WARN_ON(irq_set_affinity(cspmu->irq, &cspmu->active_cpu));
 }
 
 static int arm_cspmu_cpu_online(unsigned int cpu, struct hlist_node *node)
Signature · 1 line
2.39.2
author maintainer
#69 lore raw

PATCH 69/800 perf/arm_cspmu: Fix event attribute type

In reply to Greg Kroah-Hartman

From: Robin Murphy <[email protected]>

[ Upstream commit 71e0cb32d5fc61468e83ed962379af71bba8237e ]

ARM_CSPMU_EVENT_ATTR() defines a struct perf_pmu_events_attr, so arm_cspmu_sysfs_event_show() should not be interpreting it as struct dev_ext_attribute.

---
 drivers/perf/arm_cspmu/arm_cspmu.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/perf/arm_cspmu/arm_cspmu.c +4 -4
index d0572162f0632..e8bc8fc1fb9c0 100644
@@ -189,10 +189,10 @@ static inline bool use_64b_counter_reg(const struct arm_cspmu *cspmu)
 ssize_t arm_cspmu_sysfs_event_show(struct device *dev,
 				struct device_attribute *attr, char *buf)
 {
-	struct dev_ext_attribute *eattr =
-		container_of(attr, struct dev_ext_attribute, attr);
-	return sysfs_emit(buf, "event=0x%llx\n",
-			  (unsigned long long)eattr->var);
+	struct perf_pmu_events_attr *pmu_attr;
+
+	pmu_attr = container_of(attr, typeof(*pmu_attr), attr);
+	return sysfs_emit(buf, "event=0x%llx\n", pmu_attr->id);
 }
 EXPORT_SYMBOL_GPL(arm_cspmu_sysfs_event_show);
 
Signature · 1 line
2.39.2
author maintainer
#70 lore raw

PATCH 70/800 APEI: GHES: correctly return NULL for ghes_get_devices()

In reply to Greg Kroah-Hartman

From: Li Yang <[email protected]>

[ Upstream commit 9368aa1882ac7178adcd936cee5f0899dbf76dc4 ]

Since 315bada690e0 ("EDAC: Check for GHES preference in the chipset-specific EDAC drivers"), vendor specific EDAC driver will not probe correctly when CONFIG_ACPI_APEI_GHES is enabled but no GHES device is present. Make ghes_get_devices() return NULL when the GHES device list is empty to fix the problem.

Fixes 9057a3f7ac36 ("EDAC/ghes: Prepare to make ghes_edac a proper module")
---
 drivers/acpi/apei/ghes.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/acpi/apei/ghes.c +2 -0
index 34ad071a64e96..4382fe13ee3e4 100644
@@ -1544,6 +1544,8 @@ struct list_head *ghes_get_devices(void)
 
 			pr_warn_once("Force-loading ghes_edac on an unsupported platform. You're on your own!\n");
 		}
+	} else if (list_empty(&ghes_devs)) {
+		return NULL;
 	}
 
 	return &ghes_devs;
Signature · 1 line
2.39.2
author maintainer
#71 lore raw

PATCH 71/800 powercap: RAPL: fix invalid initialization for pl4_supported field

In reply to Greg Kroah-Hartman

From: Sumeet Pawnikar <[email protected]>

[ Upstream commit d05b5e0baf424c8c4b4709ac11f66ab726c8deaf ]

The current initialization of the struct x86_cpu_id via pl4_support_ids[] is partial and wrong. It is initializing "stepping" field with "X86_FEATURE_ANY" instead of "feature" field.

Use X86_MATCH_INTEL_FAM6_MODEL macro instead of initializing each field of the struct x86_cpu_id for pl4_supported list of CPUs. This X86_MATCH_INTEL_FAM6_MODEL macro internally uses another macro X86_MATCH_VENDOR_FAM_MODEL_FEATURE for X86 based CPU matching with appropriate initialized values.

Fixes eb52bc2ae5b8 ("powercap: RAPL: Add Power Limit4 support for Meteor Lake SoC")
Fixes b08b95cf30f5 ("powercap: RAPL: Add Power Limit4 support for Alder Lake-N and Raptor Lake-P")
Fixes 515755906921 ("powercap: RAPL: Add Power Limit4 support for RaptorLake")
Fixes 1cc5b9a411e4 ("powercap: Add Power Limit4 support for Alder Lake SoC")
Fixes 8365a898fe53 ("powercap: Add Power Limit4 support")
---
 drivers/powercap/intel_rapl_msr.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/powercap/intel_rapl_msr.c +8 -8
index a27673706c3d6..7be7561f5ad64 100644
@@ -137,14 +137,14 @@ static int rapl_msr_write_raw(int cpu, struct reg_action *ra)
 
 /* List of verified CPUs. */
 static const struct x86_cpu_id pl4_support_ids[] = {
-	{ X86_VENDOR_INTEL, 6, INTEL_FAM6_TIGERLAKE_L, X86_FEATURE_ANY },
-	{ X86_VENDOR_INTEL, 6, INTEL_FAM6_ALDERLAKE, X86_FEATURE_ANY },
-	{ X86_VENDOR_INTEL, 6, INTEL_FAM6_ALDERLAKE_L, X86_FEATURE_ANY },
-	{ X86_VENDOR_INTEL, 6, INTEL_FAM6_ALDERLAKE_N, X86_FEATURE_ANY },
-	{ X86_VENDOR_INTEL, 6, INTEL_FAM6_RAPTORLAKE, X86_FEATURE_ANY },
-	{ X86_VENDOR_INTEL, 6, INTEL_FAM6_RAPTORLAKE_P, X86_FEATURE_ANY },
-	{ X86_VENDOR_INTEL, 6, INTEL_FAM6_METEORLAKE, X86_FEATURE_ANY },
-	{ X86_VENDOR_INTEL, 6, INTEL_FAM6_METEORLAKE_L, X86_FEATURE_ANY },
+	X86_MATCH_INTEL_FAM6_MODEL(TIGERLAKE_L, NULL),
+	X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE, NULL),
+	X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_L, NULL),
+	X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_N, NULL),
+	X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE, NULL),
+	X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_P, NULL),
+	X86_MATCH_INTEL_FAM6_MODEL(METEORLAKE, NULL),
+	X86_MATCH_INTEL_FAM6_MODEL(METEORLAKE_L, NULL),
 	{}
 };
 
Signature · 1 line
2.39.2
author maintainer
#72 lore raw

PATCH 72/800 powercap: RAPL: Fix CONFIG_IOSF_MBI dependency

In reply to Greg Kroah-Hartman

From: Zhang Rui <[email protected]>

[ Upstream commit 4658fe81b3f8afe8adf37734ec5fe595d90415c6 ]

After commit 3382388d7148 ("intel_rapl: abstract RAPL common code"), accessing to IOSF_MBI interface is done in the RAPL common code.

Thus it is the CONFIG_INTEL_RAPL_CORE that has dependency of CONFIG_IOSF_MBI, while CONFIG_INTEL_RAPL_MSR does not.

This problem was not exposed previously because all the previous RAPL common code users, aka, the RAPL MSR and MMIO I/F drivers, have CONFIG_IOSF_MBI selected.

Fix the CONFIG_IOSF_MBI dependency in RAPL code. This also fixes a build time failure when the RAPL TPMI I/F driver is introduced without selecting CONFIG_IOSF_MBI.

x86_64-linux-ld: vmlinux.o: in function `set_floor_freq_atom':
intel_rapl_common.c:(.text+0x2dac9b8): undefined reference to `iosf_mbi_write'
x86_64-linux-ld: intel_rapl_common.c:(.text+0x2daca66): undefined reference to `iosf_mbi_read'

Reference to iosf_mbi.h is also removed from the RAPL MSR I/F driver.

---
 drivers/powercap/Kconfig          | 4 +++-
 drivers/powercap/intel_rapl_msr.c | 1 -
 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/powercap/Kconfig +3 -1
index 90d33cd1b670a..b063f75117738 100644
@@ -18,10 +18,12 @@ if POWERCAP
 # Client driver configurations go here.
 config INTEL_RAPL_CORE
 	tristate
+	depends on PCI
+	select IOSF_MBI
 
 config INTEL_RAPL
 	tristate "Intel RAPL Support via MSR Interface"
-	depends on X86 && IOSF_MBI
+	depends on X86 && PCI
 	select INTEL_RAPL_CORE
 	help
 	  This enables support for the Intel Running Average Power Limit (RAPL)
drivers/powercap/intel_rapl_msr.c +0 -1
index 7be7561f5ad64..9ea4797d70b44 100644
@@ -22,7 +22,6 @@
 #include <linux/processor.h>
 #include <linux/platform_device.h>
 
-#include <asm/iosf_mbi.h>
 #include <asm/cpu_device_id.h>
 #include <asm/intel-family.h>
 
Signature · 1 line
2.39.2
author maintainer
#73 lore raw

PATCH 73/800 PM: domains: Move the verification of in-params from genpd_add_device()

In reply to Greg Kroah-Hartman

From: Ulf Hansson <[email protected]>

[ Upstream commit 4384a70c8813e8573d1841fd94eee873f80a7e1a ]

Commit f38d1a6d0025 ("PM: domains: Allocate governor data dynamically based on a genpd governor") started to use the in-parameters in genpd_add_device(), without first doing a verification of them.

This isn't really a big problem, as most callers do a verification already.

Therefore, let's drop the verification from genpd_add_device() and make sure all the callers take care of it instead.

Fixes f38d1a6d0025 ("PM: domains: Allocate governor data dynamically based on a genpd governor")
---
 drivers/base/power/domain.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/base/power/domain.c +6 -3
index 51b9d4eaab5ea..5cb2023581d4d 100644
@@ -1632,9 +1632,6 @@ static int genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,
 
 	dev_dbg(dev, "%s()\n", __func__);
 
-	if (IS_ERR_OR_NULL(genpd) || IS_ERR_OR_NULL(dev))
-		return -EINVAL;
-
 	gpd_data = genpd_alloc_dev_data(dev, gd);
 	if (IS_ERR(gpd_data))
 		return PTR_ERR(gpd_data);
@@ -1676,6 +1673,9 @@ int pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev)
 {
 	int ret;
 
+	if (!genpd || !dev)
+		return -EINVAL;
+
 	mutex_lock(&gpd_list_lock);
 	ret = genpd_add_device(genpd, dev, dev);
 	mutex_unlock(&gpd_list_lock);
@@ -2523,6 +2523,9 @@ int of_genpd_add_device(struct of_phandle_args *genpdspec, struct device *dev)
 	struct generic_pm_domain *genpd;
 	int ret;
 
+	if (!dev)
+		return -EINVAL;
+
 	mutex_lock(&gpd_list_lock);
 
 	genpd = genpd_get_from_provider(genpdspec);
Signature · 1 line
2.39.2
author maintainer
#74 lore raw

PATCH 74/800 ARM: 9303/1: kprobes: avoid missing-declaration warnings

In reply to Greg Kroah-Hartman

From: Arnd Bergmann <[email protected]>

[ Upstream commit 1b9c3ddcec6a55e15d3e38e7405e2d078db02020 ]

checker_stack_use_t32strd() and kprobe_handler() can be made static since they are not used from other files, while coverage_start_registers() and __kprobes_test_case() are used from assembler code, and just need a declaration to avoid a warning with the global definition.

arch/arm/probes/kprobes/checkers-common.c:43:18: error: no previous prototype for 'checker_stack_use_t32strd' arch/arm/probes/kprobes/core.c:236:16: error: no previous prototype for 'kprobe_handler' arch/arm/probes/kprobes/test-core.c:723:10: error: no previous prototype for 'coverage_start_registers' arch/arm/probes/kprobes/test-core.c:918:14: error: no previous prototype for '__kprobes_test_case_start' arch/arm/probes/kprobes/test-core.c:952:14: error: no previous prototype for '__kprobes_test_case_end_16' arch/arm/probes/kprobes/test-core.c:967:14: error: no previous prototype for '__kprobes_test_case_end_32'

Fixes 6624cf651f1a ("ARM: kprobes: collects stack consumption for store instructions")
Fixes 454f3e132d05 ("ARM/kprobes: Remove jprobe arm implementation")
---
 arch/arm/probes/kprobes/checkers-common.c | 2 +-
 arch/arm/probes/kprobes/core.c            | 2 +-
 arch/arm/probes/kprobes/opt-arm.c         | 2 --
 arch/arm/probes/kprobes/test-core.c       | 2 +-
 arch/arm/probes/kprobes/test-core.h       | 4 ++++
 5 files changed, 7 insertions(+), 5 deletions(-)
arch/arm/probes/kprobes/checkers-common.c +1 -1
index 4d720990cf2a3..eba7ac4725c02 100644
@@ -40,7 +40,7 @@ enum probes_insn checker_stack_use_imm_0xx(probes_opcode_t insn,
  * Different from other insn uses imm8, the real addressing offset of
  * STRD in T32 encoding should be imm8 * 4. See ARMARM description.
  */
-enum probes_insn checker_stack_use_t32strd(probes_opcode_t insn,
+static enum probes_insn checker_stack_use_t32strd(probes_opcode_t insn,
 		struct arch_probes_insn *asi,
 		const struct decode_header *h)
 {
arch/arm/probes/kprobes/core.c +1 -1
index 9090c3a74dcce..d8238da095df7 100644
@@ -233,7 +233,7 @@ singlestep(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *kcb)
  * kprobe, and that level is reserved for user kprobe handlers, so we can't
  * risk encountering a new kprobe in an interrupt handler.
  */
-void __kprobes kprobe_handler(struct pt_regs *regs)
+static void __kprobes kprobe_handler(struct pt_regs *regs)
 {
 	struct kprobe *p, *cur;
 	struct kprobe_ctlblk *kcb;
arch/arm/probes/kprobes/opt-arm.c +0 -2
index dbef34ed933f2..7f65048380ca5 100644
@@ -145,8 +145,6 @@ __arch_remove_optimized_kprobe(struct optimized_kprobe *op, int dirty)
 	}
 }
 
-extern void kprobe_handler(struct pt_regs *regs);
-
 static void
 optimized_callback(struct optimized_kprobe *op, struct pt_regs *regs)
 {
arch/arm/probes/kprobes/test-core.c +1 -1
index c562832b86272..171c7076b89f4 100644
@@ -720,7 +720,7 @@ static const char coverage_register_lookup[16] = {
 	[REG_TYPE_NOSPPCX]	= COVERAGE_ANY_REG | COVERAGE_SP,
 };
 
-unsigned coverage_start_registers(const struct decode_header *h)
+static unsigned coverage_start_registers(const struct decode_header *h)
 {
 	unsigned regs = 0;
 	int i;
arch/arm/probes/kprobes/test-core.h +4 -0
index 56ad3c0aaeeac..c7297037c1623 100644
@@ -454,3 +454,7 @@ void kprobe_thumb32_test_cases(void);
 #else
 void kprobe_arm_test_cases(void);
 #endif
+
+void __kprobes_test_case_start(void);
+void __kprobes_test_case_end_16(void);
+void __kprobes_test_case_end_32(void);
Signature · 1 line
2.39.2
author maintainer
#75 lore raw

PATCH 75/800 cpufreq: intel_pstate: Fix energy_performance_preference for passive

In reply to Greg Kroah-Hartman

From: Tero Kristo <[email protected]>

[ Upstream commit 03f44ffb3d5be2fceda375d92c70ab6de4df7081 ]

If the intel_pstate driver is set to passive mode, then writing the same value to the energy_performance_preference sysfs twice will fail. This is caused by the wrong return value used (index of the matched energy_perf_string), instead of the length of the passed in parameter. Fix by forcing the internal return value to zero when the same preference is passed in by user. This same issue is not present when active mode is used for the driver.

Fixes f6ebbcf08f37 ("cpufreq: intel_pstate: Implement passive mode with HWP enabled")
---
 drivers/cpufreq/intel_pstate.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/cpufreq/intel_pstate.c +2 -0
index 2548ec92faa28..f29182512b982 100644
@@ -824,6 +824,8 @@ static ssize_t store_energy_performance_preference(
 			err = cpufreq_start_governor(policy);
 			if (!ret)
 				ret = err;
+		} else {
+			ret = 0;
 		}
 	}
 
Signature · 1 line
2.39.2
author maintainer
#76 lore raw

PATCH 76/800 thermal/drivers/qcom/tsens-v0_1: Add support for MSM8226

In reply to Greg Kroah-Hartman

From: Matti Lehtimäki <[email protected]>

[ Upstream commit 598e1afca47fdbb302ce8d288b06bcc8728efc6c ]

The MSM8226 TSENS IP has 6 thermal sensors in a TSENS v0.1 block. The thermal sensors use non-standard slope values.

Stable-dep-of: 6812d1dfbca9 ("thermal/drivers/qcom/tsens-v0_1: Fix mdm9607 slope values")

---
 drivers/thermal/qcom/tsens-v0_1.c | 27 ++++++++++++++++++++++++++-
 drivers/thermal/qcom/tsens.c      |  3 +++
 drivers/thermal/qcom/tsens.h      |  2 +-
 3 files changed, 30 insertions(+), 2 deletions(-)
drivers/thermal/qcom/tsens-v0_1.c +26 -1
index e89c6f39a3aea..ad57ab94546b0 100644
@@ -243,6 +243,18 @@ static int calibrate_8974(struct tsens_priv *priv)
 	return 0;
 }
 
+static int __init init_8226(struct tsens_priv *priv)
+{
+	priv->sensor[0].slope = 2901;
+	priv->sensor[1].slope = 2846;
+	priv->sensor[2].slope = 3038;
+	priv->sensor[3].slope = 2955;
+	priv->sensor[4].slope = 2901;
+	priv->sensor[5].slope = 2846;
+
+	return init_common(priv);
+}
+
 static int __init init_8939(struct tsens_priv *priv) {
 	priv->sensor[0].slope = 2911;
 	priv->sensor[1].slope = 2789;
@@ -258,7 +270,7 @@ static int __init init_8939(struct tsens_priv *priv) {
 	return init_common(priv);
 }
 
-/* v0.1: 8916, 8939, 8974, 9607 */
+/* v0.1: 8226, 8916, 8939, 8974, 9607 */
 
 static struct tsens_features tsens_v0_1_feat = {
 	.ver_major	= VER_0_1,
@@ -313,6 +325,19 @@ static const struct tsens_ops ops_v0_1 = {
 	.get_temp	= get_temp_common,
 };
 
+static const struct tsens_ops ops_8226 = {
+	.init		= init_8226,
+	.calibrate	= tsens_calibrate_common,
+	.get_temp	= get_temp_common,
+};
+
+struct tsens_plat_data data_8226 = {
+	.num_sensors	= 6,
+	.ops		= &ops_8226,
+	.feat		= &tsens_v0_1_feat,
+	.fields	= tsens_v0_1_regfields,
+};
+
 static const struct tsens_ops ops_8916 = {
 	.init		= init_common,
 	.calibrate	= calibrate_8916,
drivers/thermal/qcom/tsens.c +3 -0
index d3218127e617d..1c457b55efb39 100644
@@ -1095,6 +1095,9 @@ static const struct of_device_id tsens_table[] = {
 	}, {
 		.compatible = "qcom,mdm9607-tsens",
 		.data = &data_9607,
+	}, {
+		.compatible = "qcom,msm8226-tsens",
+		.data = &data_8226,
 	}, {
 		.compatible = "qcom,msm8916-tsens",
 		.data = &data_8916,
drivers/thermal/qcom/tsens.h +1 -1
index dba9cd38f637c..433eba370998c 100644
@@ -635,7 +635,7 @@ int get_temp_common(const struct tsens_sensor *s, int *temp);
 extern struct tsens_plat_data data_8960;
 
 /* TSENS v0.1 targets */
-extern struct tsens_plat_data data_8916, data_8939, data_8974, data_9607;
+extern struct tsens_plat_data data_8226, data_8916, data_8939, data_8974, data_9607;
 
 /* TSENS v1 targets */
 extern struct tsens_plat_data data_tsens_v1, data_8976, data_8956;
Signature · 1 line
2.39.2
author maintainer
#77 lore raw

PATCH 77/800 thermal/drivers/qcom/tsens-v0_1: Fix mdm9607 slope values

In reply to Greg Kroah-Hartman

From: Stephan Gerhold <[email protected]>

[ Upstream commit 6812d1dfbca99cd5032683354bf50e0002b2aa02 ]

According to the msm-3.18 vendor kernel from Qualcomm [1], mdm9607 uses a non-standard slope value of 3000 (instead of 3200) for all sensors. Fill it properly similar to the 8939 code added recently.

[1]: https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/blob/LE.UM.4.3.2.r1-04200-9x07/arch/arm/boot/dts/qcom/mdm9607.dtsi#L875

---
 drivers/thermal/qcom/tsens-v0_1.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/thermal/qcom/tsens-v0_1.c +17 -1
index ad57ab94546b0..e89a0da4b4e14 100644
@@ -270,6 +270,16 @@ static int __init init_8939(struct tsens_priv *priv) {
 	return init_common(priv);
 }
 
+static int __init init_9607(struct tsens_priv *priv)
+{
+	int i;
+
+	for (i = 0; i < priv->num_sensors; ++i)
+		priv->sensor[i].slope = 3000;
+
+	return init_common(priv);
+}
+
 /* v0.1: 8226, 8916, 8939, 8974, 9607 */
 
 static struct tsens_features tsens_v0_1_feat = {
@@ -381,9 +391,15 @@ struct tsens_plat_data data_8974 = {
 	.fields	= tsens_v0_1_regfields,
 };
 
+static const struct tsens_ops ops_9607 = {
+	.init		= init_9607,
+	.calibrate	= tsens_calibrate_common,
+	.get_temp	= get_temp_common,
+};
+
 struct tsens_plat_data data_9607 = {
 	.num_sensors	= 5,
-	.ops		= &ops_v0_1,
+	.ops		= &ops_9607,
 	.feat		= &tsens_v0_1_feat,
 	.fields	= tsens_v0_1_regfields,
 };
Signature · 1 line
2.39.2
author maintainer
#78 lore raw

PATCH 78/800 thermal/drivers/qcom/tsens-v0_1: Add mdm9607 correction offsets

In reply to Greg Kroah-Hartman

From: Stephan Gerhold <[email protected]>

[ Upstream commit b6f739da0070c36655118618a173a59fa14c7adc ]

According to the msm-3.18 vendor kernel from Qualcomm, mdm9607 needs "correction factors" to adjust for additional offsets observed after the factory calibration values in the fuses [1, 2].

The fixed offsets should be applied unless there is a special calibration mode value that indicates that no offsets are needed [3].

Note that the new calibration mode values are called differently in this patch compared to the vendor kernel:
- TSENS_TWO_POINT_CALIB_N_WA -> ONE_PT_CALIB2_NO_OFFSET
- TSENS_TWO_POINT_CALIB_N_OFFSET_WA -> TWO_PT_CALIB_NO_OFFSET
This is because close inspection of the calibration function [3] reveals that TSENS_TWO_POINT_CALIB_N_WA is actually a "one point" calibration because the if statements skip all "point2" related code for it.

[1]: https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/commit/d9d2db1b82bf3f72f5de0803d55e6849eb5b671e
[2]: https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/commit/d75aef53a760e8ff7bac54049d00c8b2ee1b193e
[3]: https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/blob/LE.UM.4.3.2.r1-04200-9x07/drivers/thermal/msm-tsens.c#L2987-3136

---
 drivers/thermal/qcom/tsens-v0_1.c | 11 +++++++++++
 drivers/thermal/qcom/tsens.c      | 16 +++++++++++++++-
 drivers/thermal/qcom/tsens.h      |  4 ++++
 3 files changed, 30 insertions(+), 1 deletion(-)
drivers/thermal/qcom/tsens-v0_1.c +11 -0
index e89a0da4b4e14..e9ce7b62b3818 100644
@@ -277,6 +277,17 @@ static int __init init_9607(struct tsens_priv *priv)
 	for (i = 0; i < priv->num_sensors; ++i)
 		priv->sensor[i].slope = 3000;
 
+	priv->sensor[0].p1_calib_offset = 1;
+	priv->sensor[0].p2_calib_offset = 1;
+	priv->sensor[1].p1_calib_offset = -4;
+	priv->sensor[1].p2_calib_offset = -2;
+	priv->sensor[2].p1_calib_offset = 4;
+	priv->sensor[2].p2_calib_offset = 8;
+	priv->sensor[3].p1_calib_offset = -3;
+	priv->sensor[3].p2_calib_offset = -5;
+	priv->sensor[4].p1_calib_offset = -4;
+	priv->sensor[4].p2_calib_offset = -4;
+
 	return init_common(priv);
 }
 
drivers/thermal/qcom/tsens.c +15 -1
index 1c457b55efb39..9dd5e4b709117 100644
@@ -134,10 +134,12 @@ int tsens_read_calibration(struct tsens_priv *priv, int shift, u32 *p1, u32 *p2,
 			p1[i] = p1[i] + (base1 << shift);
 		break;
 	case TWO_PT_CALIB:
+	case TWO_PT_CALIB_NO_OFFSET:
 		for (i = 0; i < priv->num_sensors; i++)
 			p2[i] = (p2[i] + base2) << shift;
 		fallthrough;
 	case ONE_PT_CALIB2:
+	case ONE_PT_CALIB2_NO_OFFSET:
 		for (i = 0; i < priv->num_sensors; i++)
 			p1[i] = (p1[i] + base1) << shift;
 		break;
@@ -149,6 +151,18 @@ int tsens_read_calibration(struct tsens_priv *priv, int shift, u32 *p1, u32 *p2,
 		}
 	}
 
+	/* Apply calibration offset workaround except for _NO_OFFSET modes */
+	switch (mode) {
+	case TWO_PT_CALIB:
+		for (i = 0; i < priv->num_sensors; i++)
+			p2[i] += priv->sensor[i].p2_calib_offset;
+		fallthrough;
+	case ONE_PT_CALIB2:
+		for (i = 0; i < priv->num_sensors; i++)
+			p1[i] += priv->sensor[i].p1_calib_offset;
+		break;
+	}
+
 	return mode;
 }
 
@@ -254,7 +268,7 @@ void compute_intercept_slope(struct tsens_priv *priv, u32 *p1,
 
 		if (!priv->sensor[i].slope)
 			priv->sensor[i].slope = SLOPE_DEFAULT;
-		if (mode == TWO_PT_CALIB) {
+		if (mode == TWO_PT_CALIB || mode == TWO_PT_CALIB_NO_OFFSET) {
 			/*
 			 * slope (m) = adc_code2 - adc_code1 (y2 - y1)/
 			 *	temp_120_degc - temp_30_degc (x2 - x1)
drivers/thermal/qcom/tsens.h +4 -0
index 433eba370998c..1cd8f4fe0971f 100644
@@ -10,6 +10,8 @@
 #define ONE_PT_CALIB		0x1
 #define ONE_PT_CALIB2		0x2
 #define TWO_PT_CALIB		0x3
+#define ONE_PT_CALIB2_NO_OFFSET	0x6
+#define TWO_PT_CALIB_NO_OFFSET	0x7
 #define CAL_DEGC_PT1		30
 #define CAL_DEGC_PT2		120
 #define SLOPE_FACTOR		1000
@@ -57,6 +59,8 @@ struct tsens_sensor {
 	unsigned int			hw_id;
 	int				slope;
 	u32				status;
+	int				p1_calib_offset;
+	int				p2_calib_offset;
 };
 
 /**
Signature · 1 line
2.39.2
author maintainer
#79 lore raw

PATCH 79/800 thermal/drivers/sun8i: Fix some error handling paths in sun8i_ths_probe()

In reply to Greg Kroah-Hartman

From: Christophe JAILLET <[email protected]>

[ Upstream commit 89382022b370dfd34eaae9c863baa123fcd4d132 ]

Should an error occur after calling sun8i_ths_resource_init() in the probe function, some resources need to be released, as already done in the .remove() function.

Switch to the devm_clk_get_enabled() helper and add a new devm_action to turn sun8i_ths_resource_init() into a fully managed function.

Move the place where reset_control_deassert() is called so that the recommended order of reset release/clock enable steps is kept. A64 manual states that:

	3.3.6.4. Gating and reset

	Make sure that the reset signal has been released before the release of
	module clock gating;

This fixes the issue and removes some LoC at the same time.

---
 drivers/thermal/sun8i_thermal.c | 55 +++++++++++----------------------
 1 file changed, 18 insertions(+), 37 deletions(-)
drivers/thermal/sun8i_thermal.c +18 -37
index 793ddce72132f..d4d241686c810 100644
@@ -319,6 +319,11 @@ static int sun8i_ths_calibrate(struct ths_device *tmdev)
 	return ret;
 }
 
+static void sun8i_ths_reset_control_assert(void *data)
+{
+	reset_control_assert(data);
+}
+
 static int sun8i_ths_resource_init(struct ths_device *tmdev)
 {
 	struct device *dev = tmdev->dev;
@@ -339,47 +344,35 @@ static int sun8i_ths_resource_init(struct ths_device *tmdev)
 		if (IS_ERR(tmdev->reset))
 			return PTR_ERR(tmdev->reset);
 
-		tmdev->bus_clk = devm_clk_get(&pdev->dev, "bus");
+		ret = reset_control_deassert(tmdev->reset);
+		if (ret)
+			return ret;
+
+		ret = devm_add_action_or_reset(dev, sun8i_ths_reset_control_assert,
+					       tmdev->reset);
+		if (ret)
+			return ret;
+
+		tmdev->bus_clk = devm_clk_get_enabled(&pdev->dev, "bus");
 		if (IS_ERR(tmdev->bus_clk))
 			return PTR_ERR(tmdev->bus_clk);
 	}
 
 	if (tmdev->chip->has_mod_clk) {
-		tmdev->mod_clk = devm_clk_get(&pdev->dev, "mod");
+		tmdev->mod_clk = devm_clk_get_enabled(&pdev->dev, "mod");
 		if (IS_ERR(tmdev->mod_clk))
 			return PTR_ERR(tmdev->mod_clk);
 	}
 
-	ret = reset_control_deassert(tmdev->reset);
-	if (ret)
-		return ret;
-
-	ret = clk_prepare_enable(tmdev->bus_clk);
-	if (ret)
-		goto assert_reset;
-
 	ret = clk_set_rate(tmdev->mod_clk, 24000000);
 	if (ret)
-		goto bus_disable;
-
-	ret = clk_prepare_enable(tmdev->mod_clk);
-	if (ret)
-		goto bus_disable;
+		return ret;
 
 	ret = sun8i_ths_calibrate(tmdev);
 	if (ret)
-		goto mod_disable;
+		return ret;
 
 	return 0;
-
-mod_disable:
-	clk_disable_unprepare(tmdev->mod_clk);
-bus_disable:
-	clk_disable_unprepare(tmdev->bus_clk);
-assert_reset:
-	reset_control_assert(tmdev->reset);
-
-	return ret;
 }
 
 static int sun8i_h3_thermal_init(struct ths_device *tmdev)
@@ -530,17 +523,6 @@ static int sun8i_ths_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int sun8i_ths_remove(struct platform_device *pdev)
-{
-	struct ths_device *tmdev = platform_get_drvdata(pdev);
-
-	clk_disable_unprepare(tmdev->mod_clk);
-	clk_disable_unprepare(tmdev->bus_clk);
-	reset_control_assert(tmdev->reset);
-
-	return 0;
-}
-
 static const struct ths_thermal_chip sun8i_a83t_ths = {
 	.sensor_num = 3,
 	.scale = 705,
@@ -642,7 +624,6 @@ MODULE_DEVICE_TABLE(of, of_ths_match);
 
 static struct platform_driver ths_driver = {
 	.probe = sun8i_ths_probe,
-	.remove = sun8i_ths_remove,
 	.driver = {
 		.name = "sun8i-thermal",
 		.of_match_table = of_ths_match,
Signature · 1 line
2.39.2
author maintainer
#80 lore raw

PATCH 80/800 thermal/drivers/qoriq: Only enable supported sensors

In reply to Greg Kroah-Hartman

From: Peng Fan <[email protected]>

[ Upstream commit 9301575df2509ecf8bd66f601046afaff606b1d5 ]

There are MAX 16 sensors, but not all of them supported. Such as i.MX8MQ, there are only 3 sensors. Enabling all 16 sensors will touch reserved bits from i.MX8MQ reference mannual, and TMU will stuck, temperature will not update anymore.

Fixes 45038e03d633 ("thermal: qoriq: Enable all sensors before registering them")
---
 drivers/thermal/qoriq_thermal.c | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)
drivers/thermal/qoriq_thermal.c +19 -11
index e58756323457e..3eca7085d9efe 100644
@@ -31,7 +31,6 @@
 #define TMR_DISABLE	0x0
 #define TMR_ME		0x80000000
 #define TMR_ALPF	0x0c000000
-#define TMR_MSITE_ALL	GENMASK(15, 0)
 
 #define REGS_TMTMIR	0x008	/* Temperature measurement interval Register */
 #define TMTMIR_DEFAULT	0x0000000f
@@ -105,6 +104,11 @@ static int tmu_get_temp(struct thermal_zone_device *tz, int *temp)
 	 * within sensor range. TEMP is an 9 bit value representing
 	 * temperature in KelVin.
 	 */
+
+	regmap_read(qdata->regmap, REGS_TMR, &val);
+	if (!(val & TMR_ME))
+		return -EAGAIN;
+
 	if (regmap_read_poll_timeout(qdata->regmap,
 				     REGS_TRITSR(qsensor->id),
 				     val,
@@ -128,15 +132,7 @@ static const struct thermal_zone_device_ops tmu_tz_ops = {
 static int qoriq_tmu_register_tmu_zone(struct device *dev,
 				       struct qoriq_tmu_data *qdata)
 {
-	int id;
-
-	if (qdata->ver == TMU_VER1) {
-		regmap_write(qdata->regmap, REGS_TMR,
-			     TMR_MSITE_ALL | TMR_ME | TMR_ALPF);
-	} else {
-		regmap_write(qdata->regmap, REGS_V2_TMSR, TMR_MSITE_ALL);
-		regmap_write(qdata->regmap, REGS_TMR, TMR_ME | TMR_ALPF_V2);
-	}
+	int id, sites = 0;
 
 	for (id = 0; id < SITES_MAX; id++) {
 		struct thermal_zone_device *tzd;
@@ -153,14 +149,26 @@ static int qoriq_tmu_register_tmu_zone(struct device *dev,
 			if (ret == -ENODEV)
 				continue;
 
-			regmap_write(qdata->regmap, REGS_TMR, TMR_DISABLE);
 			return ret;
 		}
 
+		if (qdata->ver == TMU_VER1)
+			sites |= 0x1 << (15 - id);
+		else
+			sites |= 0x1 << id;
+
 		if (devm_thermal_add_hwmon_sysfs(dev, tzd))
 			dev_warn(dev,
 				 "Failed to add hwmon sysfs attributes\n");
+	}
 
+	if (sites) {
+		if (qdata->ver == TMU_VER1) {
+			regmap_write(qdata->regmap, REGS_TMR, TMR_ME | TMR_ALPF | sites);
+		} else {
+			regmap_write(qdata->regmap, REGS_V2_TMSR, sites);
+			regmap_write(qdata->regmap, REGS_TMR, TMR_ME | TMR_ALPF_V2);
+		}
 	}
 
 	return 0;
Signature · 1 line
2.39.2
author maintainer
#81 lore raw

PATCH 81/800 kunit: tool: undo type subscripts for subprocess.Popen

In reply to Greg Kroah-Hartman

From: Daniel Latypov <[email protected]>

[ Upstream commit e30f65c4b3d671115bf2a9d9ef142285387f2aff ]

Writing subprocess.Popen[str] requires python 3.9+. kunit.py has an assertion that the python version is 3.7+, so we should try to stay backwards compatible.

This conflicts a bit with commit 1da2e6220e11 ("kunit: tool: fix pre-existing mypy --strict errors and update run_checks.py"), since mypy complains like so

Quoted 1 line

kunit_kernel.py:95: error: Missing type parameters for generic type "Popen" [type-arg]

Note: mypy --strict --python-version 3.7 does not work.

We could annotate each file with comments like
`# mypy: disable-error-code="type-arg"
but then we might still get nudged to break back-compat in other files.

This patch adds a mypy.ini file since it seems like the only way to disable specific error codes for all our files.

Note: run_checks.py doesn't need to specify --config_file mypy.ini, but I think being explicit is better, particularly since most kernel devs won't be familiar with how mypy works.

---
 tools/testing/kunit/kunit_kernel.py | 6 +++---
 tools/testing/kunit/mypy.ini        | 6 ++++++
 tools/testing/kunit/run_checks.py   | 2 +-
 3 files changed, 10 insertions(+), 4 deletions(-)
 create mode 100644 tools/testing/kunit/mypy.ini
tools/testing/kunit/kunit_kernel.py +3 -3
index f01f941061296..7f648802caf6a 100644
@@ -92,7 +92,7 @@ class LinuxSourceTreeOperations:
 		if stderr:  # likely only due to build warnings
 			print(stderr.decode())
 
-	def start(self, params: List[str], build_dir: str) -> subprocess.Popen[str]:
+	def start(self, params: List[str], build_dir: str) -> subprocess.Popen:
 		raise RuntimeError('not implemented!')
 
 
@@ -113,7 +113,7 @@ class LinuxSourceTreeOperationsQemu(LinuxSourceTreeOperations):
 		kconfig.merge_in_entries(base_kunitconfig)
 		return kconfig
 
-	def start(self, params: List[str], build_dir: str) -> subprocess.Popen[str]:
+	def start(self, params: List[str], build_dir: str) -> subprocess.Popen:
 		kernel_path = os.path.join(build_dir, self._kernel_path)
 		qemu_command = ['qemu-system-' + self._qemu_arch,
 				'-nodefaults',
@@ -142,7 +142,7 @@ class LinuxSourceTreeOperationsUml(LinuxSourceTreeOperations):
 		kconfig.merge_in_entries(base_kunitconfig)
 		return kconfig
 
-	def start(self, params: List[str], build_dir: str) -> subprocess.Popen[str]:
+	def start(self, params: List[str], build_dir: str) -> subprocess.Popen:
 		"""Runs the Linux UML binary. Must be named 'linux'."""
 		linux_bin = os.path.join(build_dir, 'linux')
 		params.extend(['mem=1G', 'console=tty', 'kunit_shutdown=halt'])
tools/testing/kunit/mypy.ini new file +6 -0
new file mode 100644
index 0000000000000..ddd288309efaa
@@ -0,0 +1,6 @@
+[mypy]
+strict = True
+
+# E.g. we can't write subprocess.Popen[str] until Python 3.9+.
+# But kunit.py tries to support Python 3.7+, so let's disable it.
+disable_error_code = type-arg
tools/testing/kunit/run_checks.py +1 -1
index 8208c3b3135ef..c6d494ea33739 100755
@@ -23,7 +23,7 @@ commands: Dict[str, Sequence[str]] = {
 	'kunit_tool_test.py': ['./kunit_tool_test.py'],
 	'kunit smoke test': ['./kunit.py', 'run', '--kunitconfig=lib/kunit', '--build_dir=kunit_run_checks'],
 	'pytype': ['/bin/sh', '-c', 'pytype *.py'],
-	'mypy': ['mypy', '--strict', '--exclude', '_test.py$', '--exclude', 'qemu_configs/', '.'],
+	'mypy': ['mypy', '--config-file', 'mypy.ini', '--exclude', '_test.py$', '--exclude', 'qemu_configs/', '.'],
 }
 
 # The user might not have mypy or pytype installed, skip them if so.
Signature · 1 line
2.39.2
author maintainer
#82 lore raw

PATCH 82/800 rcu: Make rcu_cpu_starting() rely on interrupts being disabled

In reply to Greg Kroah-Hartman

From: Paul E. McKenney <[email protected]>

[ Upstream commit 15d44dfa40305da1648de4bf001e91cc63148725 ]

Currently, rcu_cpu_starting() is written so that it might be invoked with interrupts enabled. However, it is always called when interrupts are disabled, either by rcu_init(), notify_cpu_starting(), or from a call point prior to the call to notify_cpu_starting().

But why bother requiring that interrupts be disabled? The purpose is to allow the rcu_data structure's ->beenonline flag to be set after all early processing has completed for the incoming CPU, thus allowing this flag to be used to determine when workqueues have been set up for the incoming CPU, while still allowing this flag to be used as a diagnostic within rcu_core().

This commit therefore makes rcu_cpu_starting() rely on interrupts being disabled.

Stable-dep-of: 401b0de3ae4f ("rcu-tasks: Stop rcu_tasks_invoke_cbs() from using never-onlined CPUs")

---
 kernel/rcu/tree.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
kernel/rcu/tree.c +5 -6
index f52ff72410416..d5c9afa8adfbd 100644
@@ -4368,15 +4368,16 @@ int rcutree_offline_cpu(unsigned int cpu)
  * Note that this function is special in that it is invoked directly
  * from the incoming CPU rather than from the cpuhp_step mechanism.
  * This is because this function must be invoked at a precise location.
+ * This incoming CPU must not have enabled interrupts yet.
  */
 void rcu_cpu_starting(unsigned int cpu)
 {
-	unsigned long flags;
 	unsigned long mask;
 	struct rcu_data *rdp;
 	struct rcu_node *rnp;
 	bool newcpu;
 
+	lockdep_assert_irqs_disabled();
 	rdp = per_cpu_ptr(&rcu_data, cpu);
 	if (rdp->cpu_started)
 		return;
@@ -4384,7 +4385,6 @@ void rcu_cpu_starting(unsigned int cpu)
 
 	rnp = rdp->mynode;
 	mask = rdp->grpmask;
-	local_irq_save(flags);
 	arch_spin_lock(&rcu_state.ofl_lock);
 	rcu_dynticks_eqs_online();
 	raw_spin_lock(&rcu_state.barrier_lock);
@@ -4403,17 +4403,16 @@ void rcu_cpu_starting(unsigned int cpu)
 	/* An incoming CPU should never be blocking a grace period. */
 	if (WARN_ON_ONCE(rnp->qsmask & mask)) { /* RCU waiting on incoming CPU? */
 		/* rcu_report_qs_rnp() *really* wants some flags to restore */
-		unsigned long flags2;
+		unsigned long flags;
 
-		local_irq_save(flags2);
+		local_irq_save(flags);
 		rcu_disable_urgency_upon_qs(rdp);
 		/* Report QS -after- changing ->qsmaskinitnext! */
-		rcu_report_qs_rnp(mask, rnp, rnp->gp_seq, flags2);
+		rcu_report_qs_rnp(mask, rnp, rnp->gp_seq, flags);
 	} else {
 		raw_spin_unlock_rcu_node(rnp);
 	}
 	arch_spin_unlock(&rcu_state.ofl_lock);
-	local_irq_restore(flags);
 	smp_mb(); /* Ensure RCU read-side usage follows above initialization. */
 }
 
Signature · 1 line
2.39.2
author maintainer
#83 lore raw

PATCH 83/800 rcu-tasks: Stop rcu_tasks_invoke_cbs() from using never-onlined CPUs

In reply to Greg Kroah-Hartman

From: Paul E. McKenney <[email protected]>

[ Upstream commit 401b0de3ae4fa49d1014c8941e26d9a25f37e7cf ]

The rcu_tasks_invoke_cbs() function relies on queue_work_on() to silently fall back to WORK_CPU_UNBOUND when the specified CPU is offline. However, the queue_work_on() function's silent fallback mechanism relies on that CPU having been online at some time in the past. When queue_work_on() is passed a CPU that has never been online, workqueue lockups ensue, which can be bad for your kernel's general health and well-being.

This commit therefore checks whether a given CPU has ever been online, and, if not substitutes WORK_CPU_UNBOUND in the subsequent call to queue_work_on(). Why not simply omit the queue_work_on() call entirely? Because this function is flooding callback-invocation notifications to all CPUs, and must deal with possibilities that include a sparse cpu_possible_mask.

This commit also moves the setting of the rcu_data structure's ->beenonline field to rcu_cpu_starting(), which executes on the incoming CPU before that CPU has ever enabled interrupts. This ensures that the required workqueues are present. In addition, because the incoming CPU has not yet enabled its interrupts, there cannot yet have been any softirq handlers running on this CPU, which means that the WARN_ON_ONCE(!rdp->beenonline) within the RCU_SOFTIRQ handler cannot have triggered yet.

Fixes d363f833c6d88 ("rcu-tasks: Use workqueues for multiple rcu_tasks_invoke_cbs() invocations")
---
 kernel/rcu/rcu.h   |  6 ++++++
 kernel/rcu/tasks.h |  7 +++++--
 kernel/rcu/tree.c  | 12 +++++++++++-
 3 files changed, 22 insertions(+), 3 deletions(-)
kernel/rcu/rcu.h +6 -0
index 4a1b9622598be..98c1544cf572b 100644
@@ -642,4 +642,10 @@ void show_rcu_tasks_trace_gp_kthread(void);
 static inline void show_rcu_tasks_trace_gp_kthread(void) {}
 #endif
 
+#ifdef CONFIG_TINY_RCU
+static inline bool rcu_cpu_beenfullyonline(int cpu) { return true; }
+#else
+bool rcu_cpu_beenfullyonline(int cpu);
+#endif
+
 #endif /* __LINUX_RCU_H */
kernel/rcu/tasks.h +5 -2
index 5f4fc8184dd0b..8f08c087142b0 100644
@@ -463,6 +463,7 @@ static void rcu_tasks_invoke_cbs(struct rcu_tasks *rtp, struct rcu_tasks_percpu
 {
 	int cpu;
 	int cpunext;
+	int cpuwq;
 	unsigned long flags;
 	int len;
 	struct rcu_head *rhp;
@@ -473,11 +474,13 @@ static void rcu_tasks_invoke_cbs(struct rcu_tasks *rtp, struct rcu_tasks_percpu
 	cpunext = cpu * 2 + 1;
 	if (cpunext < smp_load_acquire(&rtp->percpu_dequeue_lim)) {
 		rtpcp_next = per_cpu_ptr(rtp->rtpcpu, cpunext);
-		queue_work_on(cpunext, system_wq, &rtpcp_next->rtp_work);
+		cpuwq = rcu_cpu_beenfullyonline(cpunext) ? cpunext : WORK_CPU_UNBOUND;
+		queue_work_on(cpuwq, system_wq, &rtpcp_next->rtp_work);
 		cpunext++;
 		if (cpunext < smp_load_acquire(&rtp->percpu_dequeue_lim)) {
 			rtpcp_next = per_cpu_ptr(rtp->rtpcpu, cpunext);
-			queue_work_on(cpunext, system_wq, &rtpcp_next->rtp_work);
+			cpuwq = rcu_cpu_beenfullyonline(cpunext) ? cpunext : WORK_CPU_UNBOUND;
+			queue_work_on(cpuwq, system_wq, &rtpcp_next->rtp_work);
 		}
 	}
 
kernel/rcu/tree.c +11 -1
index d5c9afa8adfbd..ce51f85f0d5e4 100644
@@ -4283,7 +4283,6 @@ int rcutree_prepare_cpu(unsigned int cpu)
 	 */
 	rnp = rdp->mynode;
 	raw_spin_lock_rcu_node(rnp);		/* irqs already disabled. */
-	rdp->beenonline = true;	 /* We have now been online. */
 	rdp->gp_seq = READ_ONCE(rnp->gp_seq);
 	rdp->gp_seq_needed = rdp->gp_seq;
 	rdp->cpu_no_qs.b.norm = true;
@@ -4310,6 +4309,16 @@ static void rcutree_affinity_setting(unsigned int cpu, int outgoing)
 	rcu_boost_kthread_setaffinity(rdp->mynode, outgoing);
 }
 
+/*
+ * Has the specified (known valid) CPU ever been fully online?
+ */
+bool rcu_cpu_beenfullyonline(int cpu)
+{
+	struct rcu_data *rdp = per_cpu_ptr(&rcu_data, cpu);
+
+	return smp_load_acquire(&rdp->beenonline);
+}
+
 /*
  * Near the end of the CPU-online process.  Pretty much all services
  * enabled, and the CPU is now very much alive.
@@ -4413,6 +4422,7 @@ void rcu_cpu_starting(unsigned int cpu)
 		raw_spin_unlock_rcu_node(rnp);
 	}
 	arch_spin_unlock(&rcu_state.ofl_lock);
+	smp_store_release(&rdp->beenonline, true);
 	smp_mb(); /* Ensure RCU read-side usage follows above initialization. */
 }
 
Signature · 1 line
2.39.2
author maintainer
#84 lore raw

PATCH 84/800 rcutorture: Correct name of use_softirq module parameter

In reply to Greg Kroah-Hartman

From: Paul E. McKenney <[email protected]>

[ Upstream commit b409afe0268faeb77267f028ea85f2d93438fced ]

The BUSTED-BOOST and TREE03 scenarios specify a mythical tree.use_softirq module parameter, which means a failure to get full test coverage. This commit therefore corrects the name to rcutree.use_softirq.

Fixes e2b949d54392 ("rcutorture: Make TREE03 use real-time tree.use_softirq setting")
---
 .../testing/selftests/rcutorture/configs/rcu/BUSTED-BOOST.boot  | 2 +-
 tools/testing/selftests/rcutorture/configs/rcu/TREE03.boot      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/rcutorture/configs/rcu/BUSTED-BOOST.boot +1 -1
index f57720c52c0f9..84f6bb98ce993 100644
@@ -5,4 +5,4 @@ rcutree.gp_init_delay=3
 rcutree.gp_cleanup_delay=3
 rcutree.kthread_prio=2
 threadirqs
-tree.use_softirq=0
+rcutree.use_softirq=0
tools/testing/selftests/rcutorture/configs/rcu/TREE03.boot +1 -1
index 64f864f1f361f..8e50bfd4b710d 100644
@@ -4,4 +4,4 @@ rcutree.gp_init_delay=3
 rcutree.gp_cleanup_delay=3
 rcutree.kthread_prio=2
 threadirqs
-tree.use_softirq=0
+rcutree.use_softirq=0
Signature · 1 line
2.39.2
author maintainer
#85 lore raw

PATCH 85/800 rcu/rcuscale: Move rcu_scale_*() after kfree_scale_cleanup()

In reply to Greg Kroah-Hartman

From: Qiuxu Zhuo <[email protected]>

[ Upstream commit bf5ddd736509a7d9077c0b6793e6f0852214dbea ]

This code-movement-only commit moves the rcu_scale_cleanup() and rcu_scale_shutdown() functions to follow kfree_scale_cleanup(). This is code movement is in preparation for a bug-fix patch that invokes kfree_scale_cleanup() from rcu_scale_cleanup().

Stable-dep-of: 23fc8df26dea ("rcu/rcuscale: Stop kfree_scale_thread thread(s) after unloading rcuscale")

---
 kernel/rcu/rcuscale.c | 194 +++++++++++++++++++++---------------------
 1 file changed, 97 insertions(+), 97 deletions(-)
kernel/rcu/rcuscale.c +97 -97
index e82ec9f9a5d80..7e8965b0827a9 100644
@@ -522,89 +522,6 @@ rcu_scale_print_module_parms(struct rcu_scale_ops *cur_ops, const char *tag)
 		 scale_type, tag, nrealreaders, nrealwriters, verbose, shutdown);
 }
 
-static void
-rcu_scale_cleanup(void)
-{
-	int i;
-	int j;
-	int ngps = 0;
-	u64 *wdp;
-	u64 *wdpp;
-
-	/*
-	 * Would like warning at start, but everything is expedited
-	 * during the mid-boot phase, so have to wait till the end.
-	 */
-	if (rcu_gp_is_expedited() && !rcu_gp_is_normal() && !gp_exp)
-		SCALEOUT_ERRSTRING("All grace periods expedited, no normal ones to measure!");
-	if (rcu_gp_is_normal() && gp_exp)
-		SCALEOUT_ERRSTRING("All grace periods normal, no expedited ones to measure!");
-	if (gp_exp && gp_async)
-		SCALEOUT_ERRSTRING("No expedited async GPs, so went with async!");
-
-	if (torture_cleanup_begin())
-		return;
-	if (!cur_ops) {
-		torture_cleanup_end();
-		return;
-	}
-
-	if (reader_tasks) {
-		for (i = 0; i < nrealreaders; i++)
-			torture_stop_kthread(rcu_scale_reader,
-					     reader_tasks[i]);
-		kfree(reader_tasks);
-	}
-
-	if (writer_tasks) {
-		for (i = 0; i < nrealwriters; i++) {
-			torture_stop_kthread(rcu_scale_writer,
-					     writer_tasks[i]);
-			if (!writer_n_durations)
-				continue;
-			j = writer_n_durations[i];
-			pr_alert("%s%s writer %d gps: %d\n",
-				 scale_type, SCALE_FLAG, i, j);
-			ngps += j;
-		}
-		pr_alert("%s%s start: %llu end: %llu duration: %llu gps: %d batches: %ld\n",
-			 scale_type, SCALE_FLAG,
-			 t_rcu_scale_writer_started, t_rcu_scale_writer_finished,
-			 t_rcu_scale_writer_finished -
-			 t_rcu_scale_writer_started,
-			 ngps,
-			 rcuscale_seq_diff(b_rcu_gp_test_finished,
-					   b_rcu_gp_test_started));
-		for (i = 0; i < nrealwriters; i++) {
-			if (!writer_durations)
-				break;
-			if (!writer_n_durations)
-				continue;
-			wdpp = writer_durations[i];
-			if (!wdpp)
-				continue;
-			for (j = 0; j < writer_n_durations[i]; j++) {
-				wdp = &wdpp[j];
-				pr_alert("%s%s %4d writer-duration: %5d %llu\n",
-					scale_type, SCALE_FLAG,
-					i, j, *wdp);
-				if (j % 100 == 0)
-					schedule_timeout_uninterruptible(1);
-			}
-			kfree(writer_durations[i]);
-		}
-		kfree(writer_tasks);
-		kfree(writer_durations);
-		kfree(writer_n_durations);
-	}
-
-	/* Do torture-type-specific cleanup operations.  */
-	if (cur_ops->cleanup != NULL)
-		cur_ops->cleanup();
-
-	torture_cleanup_end();
-}
-
 /*
  * Return the number if non-negative.  If -1, the number of CPUs.
  * If less than -1, that much less than the number of CPUs, but
@@ -624,20 +541,6 @@ static int compute_real(int n)
 	return nr;
 }
 
-/*
- * RCU scalability shutdown kthread.  Just waits to be awakened, then shuts
- * down system.
- */
-static int
-rcu_scale_shutdown(void *arg)
-{
-	wait_event_idle(shutdown_wq, atomic_read(&n_rcu_scale_writer_finished) >= nrealwriters);
-	smp_mb(); /* Wake before output. */
-	rcu_scale_cleanup();
-	kernel_power_off();
-	return -EINVAL;
-}
-
 /*
  * kfree_rcu() scalability tests: Start a kfree_rcu() loop on all CPUs for number
  * of iterations and measure total time and number of GP for all iterations to complete.
@@ -874,6 +777,103 @@ kfree_scale_init(void)
 	return firsterr;
 }
 
+static void
+rcu_scale_cleanup(void)
+{
+	int i;
+	int j;
+	int ngps = 0;
+	u64 *wdp;
+	u64 *wdpp;
+
+	/*
+	 * Would like warning at start, but everything is expedited
+	 * during the mid-boot phase, so have to wait till the end.
+	 */
+	if (rcu_gp_is_expedited() && !rcu_gp_is_normal() && !gp_exp)
+		SCALEOUT_ERRSTRING("All grace periods expedited, no normal ones to measure!");
+	if (rcu_gp_is_normal() && gp_exp)
+		SCALEOUT_ERRSTRING("All grace periods normal, no expedited ones to measure!");
+	if (gp_exp && gp_async)
+		SCALEOUT_ERRSTRING("No expedited async GPs, so went with async!");
+
+	if (torture_cleanup_begin())
+		return;
+	if (!cur_ops) {
+		torture_cleanup_end();
+		return;
+	}
+
+	if (reader_tasks) {
+		for (i = 0; i < nrealreaders; i++)
+			torture_stop_kthread(rcu_scale_reader,
+					     reader_tasks[i]);
+		kfree(reader_tasks);
+	}
+
+	if (writer_tasks) {
+		for (i = 0; i < nrealwriters; i++) {
+			torture_stop_kthread(rcu_scale_writer,
+					     writer_tasks[i]);
+			if (!writer_n_durations)
+				continue;
+			j = writer_n_durations[i];
+			pr_alert("%s%s writer %d gps: %d\n",
+				 scale_type, SCALE_FLAG, i, j);
+			ngps += j;
+		}
+		pr_alert("%s%s start: %llu end: %llu duration: %llu gps: %d batches: %ld\n",
+			 scale_type, SCALE_FLAG,
+			 t_rcu_scale_writer_started, t_rcu_scale_writer_finished,
+			 t_rcu_scale_writer_finished -
+			 t_rcu_scale_writer_started,
+			 ngps,
+			 rcuscale_seq_diff(b_rcu_gp_test_finished,
+					   b_rcu_gp_test_started));
+		for (i = 0; i < nrealwriters; i++) {
+			if (!writer_durations)
+				break;
+			if (!writer_n_durations)
+				continue;
+			wdpp = writer_durations[i];
+			if (!wdpp)
+				continue;
+			for (j = 0; j < writer_n_durations[i]; j++) {
+				wdp = &wdpp[j];
+				pr_alert("%s%s %4d writer-duration: %5d %llu\n",
+					scale_type, SCALE_FLAG,
+					i, j, *wdp);
+				if (j % 100 == 0)
+					schedule_timeout_uninterruptible(1);
+			}
+			kfree(writer_durations[i]);
+		}
+		kfree(writer_tasks);
+		kfree(writer_durations);
+		kfree(writer_n_durations);
+	}
+
+	/* Do torture-type-specific cleanup operations.  */
+	if (cur_ops->cleanup != NULL)
+		cur_ops->cleanup();
+
+	torture_cleanup_end();
+}
+
+/*
+ * RCU scalability shutdown kthread.  Just waits to be awakened, then shuts
+ * down system.
+ */
+static int
+rcu_scale_shutdown(void *arg)
+{
+	wait_event_idle(shutdown_wq, atomic_read(&n_rcu_scale_writer_finished) >= nrealwriters);
+	smp_mb(); /* Wake before output. */
+	rcu_scale_cleanup();
+	kernel_power_off();
+	return -EINVAL;
+}
+
 static int __init
 rcu_scale_init(void)
 {
Signature · 1 line
2.39.2
author maintainer
#86 lore raw

PATCH 86/800 rcu/rcuscale: Stop kfree_scale_thread thread(s) after unloading rcuscale

In reply to Greg Kroah-Hartman

From: Qiuxu Zhuo <[email protected]>

[ Upstream commit 23fc8df26dead16687ae6eb47b0561a4a832e2f6 ]

Running the 'kfree_rcu_test' test case [1] results in a splat [2]. The root cause is the kfree_scale_thread thread(s) continue running after unloading the rcuscale module. This commit fixes that isue by invoking kfree_scale_cleanup() from rcu_scale_cleanup() when removing the rcuscale module.

[1] modprobe rcuscale kfree_rcu_test=1

    // After some time
    rmmod rcuscale
    rmmod torture

[2] BUG: unable to handle page fault for address: ffffffffc0601a87

    #PF: supervisor instruction fetch in kernel mode
    #PF: error_code(0x0010) - not-present page
    PGD 11de4f067 P4D 11de4f067 PUD 11de51067 PMD 112f4d067 PTE 0
    Oops: 0010 [#1] PREEMPT SMP NOPTI
    CPU: 1 PID: 1798 Comm: kfree_scale_thr Not tainted 6.3.0-rc1-rcu+ #1
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.0.0 02/06/2015
    RIP: 0010:0xffffffffc0601a87
    Code: Unable to access opcode bytes at 0xffffffffc0601a5d.
    RSP: 0018:ffffb25bc2e57e18 EFLAGS: 00010297
    RAX: 0000000000000000 RBX: ffffffffc061f0b6 RCX: 0000000000000000
    RDX: 0000000000000000 RSI: ffffffff962fd0de RDI: ffffffff962fd0de
    RBP: ffffb25bc2e57ea8 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000000
    R13: 0000000000000000 R14: 000000000000000a R15: 00000000001c1dbe
    FS:  0000000000000000(0000) GS:ffff921fa2200000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: ffffffffc0601a5d CR3: 000000011de4c006 CR4: 0000000000370ee0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
     <TASK>
     ? kvfree_call_rcu+0xf0/0x3a0
     ? kthread+0xf3/0x120
     ? kthread_complete_and_exit+0x20/0x20
     ? ret_from_fork+0x1f/0x30
     </TASK>
    Modules linked in: rfkill sunrpc ... [last unloaded: torture]
    CR2: ffffffffc0601a87
    ---[ end trace 0000000000000000 ]---
Fixes e6e78b004fa7 ("rcuperf: Add kfree_rcu() performance Tests")
---
 kernel/rcu/rcuscale.c | 5 +++++
 1 file changed, 5 insertions(+)
kernel/rcu/rcuscale.c +5 -0
index 7e8965b0827a9..d1221731c7cfd 100644
@@ -797,6 +797,11 @@ rcu_scale_cleanup(void)
 	if (gp_exp && gp_async)
 		SCALEOUT_ERRSTRING("No expedited async GPs, so went with async!");
 
+	if (kfree_rcu_test) {
+		kfree_scale_cleanup();
+		return;
+	}
+
 	if (torture_cleanup_begin())
 		return;
 	if (!cur_ops) {
Signature · 1 line
2.39.2
author maintainer
#87 lore raw

PATCH 87/800 x86/mtrr: Remove physical address size calculation

In reply to Greg Kroah-Hartman

From: Juergen Gross <[email protected]>

[ Upstream commit f6b980646b93a8c585b4ed991b8a34e8fc6ef847 ]

The physical address width calculation in mtrr_bp_init() can easily be replaced with using the already available value x86_phys_bits from struct cpuinfo_x86.

The same information source can be used in mtrr/cleanup.c, removing the need to pass that value on to mtrr_cleanup().

In print_mtrr_state() use x86_phys_bits instead of recalculating it from size_or_mask.

Move setting of size_or_mask and size_and_mask into a dedicated new function in mtrr/generic.c, enabling to make those 2 variables static, as they are used in generic.c only now.

Stable-dep-of: c957f1f3c498 ("x86/hyperv: Set MTRR state when running as SEV-SNP Hyper-V guest")

---
 arch/x86/kernel/cpu/mtrr/cleanup.c | 16 ++++----
 arch/x86/kernel/cpu/mtrr/generic.c | 12 +++++-
 arch/x86/kernel/cpu/mtrr/mtrr.c    | 61 ++++--------------------------
 arch/x86/kernel/cpu/mtrr/mtrr.h    |  4 +-
 4 files changed, 29 insertions(+), 64 deletions(-)
arch/x86/kernel/cpu/mtrr/cleanup.c +8 -8
index b5f43049fa5f7..70314093bb9b5 100644
@@ -173,7 +173,7 @@ early_param("mtrr_cleanup_debug", mtrr_cleanup_debug_setup);
 
 static void __init
 set_var_mtrr(unsigned int reg, unsigned long basek, unsigned long sizek,
-	     unsigned char type, unsigned int address_bits)
+	     unsigned char type)
 {
 	u32 base_lo, base_hi, mask_lo, mask_hi;
 	u64 base, mask;
@@ -183,7 +183,7 @@ set_var_mtrr(unsigned int reg, unsigned long basek, unsigned long sizek,
 		return;
 	}
 
-	mask = (1ULL << address_bits) - 1;
+	mask = (1ULL << boot_cpu_data.x86_phys_bits) - 1;
 	mask &= ~((((u64)sizek) << 10) - 1);
 
 	base = ((u64)basek) << 10;
@@ -209,7 +209,7 @@ save_var_mtrr(unsigned int reg, unsigned long basek, unsigned long sizek,
 	range_state[reg].type = type;
 }
 
-static void __init set_var_mtrr_all(unsigned int address_bits)
+static void __init set_var_mtrr_all(void)
 {
 	unsigned long basek, sizek;
 	unsigned char type;
@@ -220,7 +220,7 @@ static void __init set_var_mtrr_all(unsigned int address_bits)
 		sizek = range_state[reg].size_pfn << (PAGE_SHIFT - 10);
 		type = range_state[reg].type;
 
-		set_var_mtrr(reg, basek, sizek, type, address_bits);
+		set_var_mtrr(reg, basek, sizek, type);
 	}
 }
 
@@ -680,7 +680,7 @@ static int __init mtrr_search_optimal_index(void)
 	return index_good;
 }
 
-int __init mtrr_cleanup(unsigned address_bits)
+int __init mtrr_cleanup(void)
 {
 	unsigned long x_remove_base, x_remove_size;
 	unsigned long base, size, def, dummy;
@@ -742,7 +742,7 @@ int __init mtrr_cleanup(unsigned address_bits)
 		mtrr_print_out_one_result(i);
 
 		if (!result[i].bad) {
-			set_var_mtrr_all(address_bits);
+			set_var_mtrr_all();
 			pr_debug("New variable MTRRs\n");
 			print_out_mtrr_range_state();
 			return 1;
@@ -786,7 +786,7 @@ int __init mtrr_cleanup(unsigned address_bits)
 		gran_size = result[i].gran_sizek;
 		gran_size <<= 10;
 		x86_setup_var_mtrrs(range, nr_range, chunk_size, gran_size);
-		set_var_mtrr_all(address_bits);
+		set_var_mtrr_all();
 		pr_debug("New variable MTRRs\n");
 		print_out_mtrr_range_state();
 		return 1;
@@ -802,7 +802,7 @@ int __init mtrr_cleanup(unsigned address_bits)
 	return 0;
 }
 #else
-int __init mtrr_cleanup(unsigned address_bits)
+int __init mtrr_cleanup(void)
 {
 	return 0;
 }
arch/x86/kernel/cpu/mtrr/generic.c +11 -1
index ee09d359e08f0..3922552340b13 100644
@@ -38,6 +38,16 @@ u64 mtrr_tom2;
 struct mtrr_state_type mtrr_state;
 EXPORT_SYMBOL_GPL(mtrr_state);
 
+static u64 size_or_mask, size_and_mask;
+
+void __init mtrr_set_mask(void)
+{
+	unsigned int phys_addr = boot_cpu_data.x86_phys_bits;
+
+	size_or_mask = ~GENMASK_ULL(phys_addr - PAGE_SHIFT - 1, 0);
+	size_and_mask = ~size_or_mask & GENMASK_ULL(39, 20);
+}
+
 /*
  * BIOS is expected to clear MtrrFixDramModEn bit, see for example
  * "BIOS and Kernel Developer's Guide for the AMD Athlon 64 and AMD
@@ -422,7 +432,7 @@ static void __init print_mtrr_state(void)
 	}
 	pr_debug("MTRR variable ranges %sabled:\n",
 		 mtrr_state.enabled & MTRR_STATE_MTRR_ENABLED ? "en" : "dis");
-	high_width = (__ffs64(size_or_mask) - (32 - PAGE_SHIFT) + 3) / 4;
+	high_width = (boot_cpu_data.x86_phys_bits - (32 - PAGE_SHIFT) + 3) / 4;
 
 	for (i = 0; i < num_var_ranges; ++i) {
 		if (mtrr_state.var_ranges[i].mask_lo & (1 << 11))
arch/x86/kernel/cpu/mtrr/mtrr.c +8 -53

100 lines not on this page · raw message

arch/x86/kernel/cpu/mtrr/mtrr.h +2 -2
index 02eb5871492d0..a00987e6cc1c1 100644
@@ -51,7 +51,6 @@ void fill_mtrr_var_range(unsigned int index,
 		u32 base_lo, u32 base_hi, u32 mask_lo, u32 mask_hi);
 bool get_mtrr_state(void);
 
-extern u64 size_or_mask, size_and_mask;
 extern const struct mtrr_ops *mtrr_if;
 
 #define is_cpu(vnd)	(mtrr_if && mtrr_if->vendor == X86_VENDOR_##vnd)
@@ -60,6 +59,7 @@ extern unsigned int num_var_ranges;
 extern u64 mtrr_tom2;
 extern struct mtrr_state_type mtrr_state;
 
+void mtrr_set_mask(void);
 void mtrr_state_warn(void);
 const char *mtrr_attrib_to_str(int x);
 void mtrr_wrmsr(unsigned, unsigned, unsigned);
@@ -70,4 +70,4 @@ extern const struct mtrr_ops cyrix_mtrr_ops;
 extern const struct mtrr_ops centaur_mtrr_ops;
 
 extern int changed_by_mtrr_cleanup;
-extern int mtrr_cleanup(unsigned address_bits);
+extern int mtrr_cleanup(void);
Signature · 1 line
2.39.2
author maintainer
#88 lore raw

PATCH 88/800 x86/mtrr: Support setting MTRR state for software defined MTRRs

In reply to Greg Kroah-Hartman

From: Juergen Gross <[email protected]>

[ Upstream commit 29055dc74287467bd7a053d60b4afe753832960d ]

When running virtualized, MTRR access can be reduced (e.g. in Xen PV guests or when running as a SEV-SNP guest under Hyper-V). Typically, the hypervisor will not advertize the MTRR feature in CPUID data, resulting in no MTRR memory type information being available for the kernel.

This has turned out to result in problems (Link tags below):

- Hyper-V SEV-SNP guests using uncached mappings where they shouldn't
- Xen PV dom0 mapping memory as WB which should be UC- instead

Solve those problems by allowing an MTRR static state override, overwriting the empty state used today. In case such a state has been set, don't call get_mtrr_state() in mtrr_bp_init().

The set state will only be used by mtrr_type_lookup(), as in all other cases mtrr_enabled() is being checked, which will return false. Accept the overwrite call only for selected cases when running as a guest. Disable X86_FEATURE_MTRR in order to avoid any MTRR modifications by just refusing them.

[ bp: Massage. ]

Stable-dep-of: c957f1f3c498 ("x86/hyperv: Set MTRR state when running as SEV-SNP Hyper-V guest")

---
 arch/x86/include/asm/mtrr.h        |  8 ++++
 arch/x86/kernel/cpu/mtrr/generic.c | 60 +++++++++++++++++++++++++++++-
 arch/x86/kernel/cpu/mtrr/mtrr.c    | 14 ++++++-
 arch/x86/kernel/setup.c            |  2 +
 4 files changed, 82 insertions(+), 2 deletions(-)
arch/x86/include/asm/mtrr.h +8 -0
index f0eeaf6e5f5f7..f1cb81330a645 100644
@@ -31,6 +31,8 @@
  */
 # ifdef CONFIG_MTRR
 void mtrr_bp_init(void);
+void mtrr_overwrite_state(struct mtrr_var_range *var, unsigned int num_var,
+			  mtrr_type def_type);
 extern u8 mtrr_type_lookup(u64 addr, u64 end, u8 *uniform);
 extern void mtrr_save_fixed_ranges(void *);
 extern void mtrr_save_state(void);
@@ -48,6 +50,12 @@ void mtrr_disable(void);
 void mtrr_enable(void);
 void mtrr_generic_set_state(void);
 #  else
+static inline void mtrr_overwrite_state(struct mtrr_var_range *var,
+					unsigned int num_var,
+					mtrr_type def_type)
+{
+}
+
 static inline u8 mtrr_type_lookup(u64 addr, u64 end, u8 *uniform)
 {
 	/*
arch/x86/kernel/cpu/mtrr/generic.c +59 -1

75 lines not on this page · raw message

arch/x86/kernel/cpu/mtrr/mtrr.c +13 -1
index 1bdab16f16bdc..8638019f80680 100644
@@ -625,11 +625,23 @@ int __initdata changed_by_mtrr_cleanup;
  */
 void __init mtrr_bp_init(void)
 {
+	bool generic_mtrrs = cpu_feature_enabled(X86_FEATURE_MTRR);
 	const char *why = "(not available)";
 
 	mtrr_set_mask();
 
-	if (cpu_feature_enabled(X86_FEATURE_MTRR)) {
+	if (!generic_mtrrs && mtrr_state.enabled) {
+		/*
+		 * Software overwrite of MTRR state, only for generic case.
+		 * Note that X86_FEATURE_MTRR has been reset in this case.
+		 */
+		init_table();
+		pr_info("MTRRs set to read-only\n");
+
+		return;
+	}
+
+	if (generic_mtrrs) {
 		mtrr_if = &generic_mtrr_ops;
 	} else {
 		switch (boot_cpu_data.x86_vendor) {
arch/x86/kernel/setup.c +2 -0
index 16babff771bdf..0cccfeb67c3ad 100644
@@ -1037,6 +1037,8 @@ void __init setup_arch(char **cmdline_p)
 	/*
 	 * VMware detection requires dmi to be available, so this
 	 * needs to be done after dmi_setup(), for the boot CPU.
+	 * For some guest types (Xen PV, SEV-SNP, TDX) it is required to be
+	 * called before cache_bp_init() for setting up MTRR state.
 	 */
 	init_hypervisor_platform();
 
Signature · 1 line
2.39.2
author maintainer
#89 lore raw

PATCH 89/800 x86/hyperv: Set MTRR state when running as SEV-SNP Hyper-V guest

In reply to Greg Kroah-Hartman

From: Juergen Gross <[email protected]>

[ Upstream commit c957f1f3c498bcce85c04e92e60afbae1fd10cde ]

In order to avoid mappings using the UC- cache attribute, set the MTRR state to use WB caching as the default.

This is needed in order to cope with the fact that PAT is enabled, while MTRRs are not supported by the hypervisor.

---
 arch/x86/hyperv/ivm.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/x86/hyperv/ivm.c +4 -0
index cc92388b7a999..6f7c1b5606ad4 100644
@@ -17,6 +17,7 @@
 #include <asm/mem_encrypt.h>
 #include <asm/mshyperv.h>
 #include <asm/hypervisor.h>
+#include <asm/mtrr.h>
 
 #ifdef CONFIG_AMD_MEM_ENCRYPT
 
@@ -372,6 +373,9 @@ void __init hv_vtom_init(void)
 	x86_platform.guest.enc_cache_flush_required = hv_vtom_cache_flush_required;
 	x86_platform.guest.enc_tlb_flush_required = hv_vtom_tlb_flush_required;
 	x86_platform.guest.enc_status_change_finish = hv_vtom_set_host_visibility;
+
+	/* Set WB as the default cache mode. */
+	mtrr_overwrite_state(NULL, 0, MTRR_TYPE_WRBACK);
 }
 
 #endif /* CONFIG_AMD_MEM_ENCRYPT */
Signature · 1 line
2.39.2
author maintainer
#90 lore raw

PATCH 90/800 x86/mtrr: Replace size_or_mask and size_and_mask with a much easier concept

In reply to Greg Kroah-Hartman

From: Juergen Gross <[email protected]>

[ Upstream commit d053b481a5f16dbd4f020c6b3ebdf9173fdef0e2 ]

Replace size_or_mask and size_and_mask with the much easier concept of high reserved bits.

While at it, instead of using constants in the MTRR code, use some new

[ bp:
- Drop mtrr_set_mask()
- Unbreak long lines
- Move struct mtrr_state_type out of the uapi header as it doesn't belong there. It also fixes a HDRTEST breakage "unknown type name ‘bool’" as Reported-by: kernel test robot <[email protected]>
- Massage.
]

Stable-dep-of: a153f254e5cd ("x86/xen: Set MTRR state when running as Xen PV initial domain")

---
 arch/x86/include/asm/mtrr.h        | 32 +++++++++++++-
 arch/x86/include/uapi/asm/mtrr.h   |  8 ----
 arch/x86/kernel/cpu/mtrr/cleanup.c |  2 +-
 arch/x86/kernel/cpu/mtrr/generic.c | 70 +++++++++++++-----------------
 arch/x86/kernel/cpu/mtrr/mtrr.c    |  4 +-
 arch/x86/kernel/cpu/mtrr/mtrr.h    |  2 +-
 6 files changed, 65 insertions(+), 53 deletions(-)
arch/x86/include/asm/mtrr.h +30 -2
index f1cb81330a645..1bae790a553a5 100644
@@ -23,8 +23,35 @@
 #ifndef _ASM_X86_MTRR_H
 #define _ASM_X86_MTRR_H
 
+#include <linux/bits.h>
 #include <uapi/asm/mtrr.h>
 
+/* Defines for hardware MTRR registers. */
+#define MTRR_CAP_VCNT		GENMASK(7, 0)
+#define MTRR_CAP_FIX		BIT_MASK(8)
+#define MTRR_CAP_WC		BIT_MASK(10)
+
+#define MTRR_DEF_TYPE_TYPE	GENMASK(7, 0)
+#define MTRR_DEF_TYPE_FE	BIT_MASK(10)
+#define MTRR_DEF_TYPE_E		BIT_MASK(11)
+
+#define MTRR_DEF_TYPE_ENABLE	(MTRR_DEF_TYPE_FE | MTRR_DEF_TYPE_E)
+#define MTRR_DEF_TYPE_DISABLE	~(MTRR_DEF_TYPE_TYPE | MTRR_DEF_TYPE_ENABLE)
+
+#define MTRR_PHYSBASE_TYPE	GENMASK(7, 0)
+#define MTRR_PHYSBASE_RSVD	GENMASK(11, 8)
+
+#define MTRR_PHYSMASK_RSVD	GENMASK(10, 0)
+#define MTRR_PHYSMASK_V		BIT_MASK(11)
+
+struct mtrr_state_type {
+	struct mtrr_var_range var_ranges[MTRR_MAX_VAR_RANGES];
+	mtrr_type fixed_ranges[MTRR_NUM_FIXED_RANGES];
+	unsigned char enabled;
+	bool have_fixed;
+	mtrr_type def_type;
+};
+
 /*
  * The following functions are for use by other drivers that cannot use
  * arch_phys_wc_add and arch_phys_wc_del.
@@ -129,7 +156,8 @@ struct mtrr_gentry32 {
 #endif /* CONFIG_COMPAT */
 
 /* Bit fields for enabled in struct mtrr_state_type */
-#define MTRR_STATE_MTRR_FIXED_ENABLED	0x01
-#define MTRR_STATE_MTRR_ENABLED		0x02
+#define MTRR_STATE_SHIFT		10
+#define MTRR_STATE_MTRR_FIXED_ENABLED	(MTRR_DEF_TYPE_FE >> MTRR_STATE_SHIFT)
+#define MTRR_STATE_MTRR_ENABLED		(MTRR_DEF_TYPE_E >> MTRR_STATE_SHIFT)
 
 #endif /* _ASM_X86_MTRR_H */
arch/x86/include/uapi/asm/mtrr.h +0 -8
index 376563f2bac1f..ab194c8316259 100644
@@ -81,14 +81,6 @@ typedef __u8 mtrr_type;
 #define MTRR_NUM_FIXED_RANGES 88
 #define MTRR_MAX_VAR_RANGES 256
 
-struct mtrr_state_type {
-	struct mtrr_var_range var_ranges[MTRR_MAX_VAR_RANGES];
-	mtrr_type fixed_ranges[MTRR_NUM_FIXED_RANGES];
-	unsigned char enabled;
-	unsigned char have_fixed;
-	mtrr_type def_type;
-};
-
 #define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg))
 #define MTRRphysMask_MSR(reg) (0x200 + 2 * (reg) + 1)
 
arch/x86/kernel/cpu/mtrr/cleanup.c +1 -1
index 70314093bb9b5..ca2d567e729e2 100644
@@ -890,7 +890,7 @@ int __init mtrr_trim_uncached_memory(unsigned long end_pfn)
 		return 0;
 
 	rdmsr(MSR_MTRRdefType, def, dummy);
-	def &= 0xff;
+	def &= MTRR_DEF_TYPE_TYPE;
 	if (def != MTRR_TYPE_UNCACHABLE)
 		return 0;
 
arch/x86/kernel/cpu/mtrr/generic.c +31 -39

175 lines not on this page · raw message

arch/x86/kernel/cpu/mtrr/mtrr.c +2 -2
index 8638019f80680..be35a0b09604d 100644
@@ -115,7 +115,7 @@ static void __init set_num_var_ranges(bool use_generic)
 	else if (is_cpu(CYRIX) || is_cpu(CENTAUR))
 		config = 8;
 
-	num_var_ranges = config & 0xff;
+	num_var_ranges = config & MTRR_CAP_VCNT;
 }
 
 static void __init init_table(void)
@@ -628,7 +628,7 @@ void __init mtrr_bp_init(void)
 	bool generic_mtrrs = cpu_feature_enabled(X86_FEATURE_MTRR);
 	const char *why = "(not available)";
 
-	mtrr_set_mask();
+	phys_hi_rsvd = GENMASK(31, boot_cpu_data.x86_phys_bits - 32);
 
 	if (!generic_mtrrs && mtrr_state.enabled) {
 		/*
arch/x86/kernel/cpu/mtrr/mtrr.h +1 -1
index a00987e6cc1c1..59e8fb26bf9dd 100644
@@ -58,8 +58,8 @@ extern const struct mtrr_ops *mtrr_if;
 extern unsigned int num_var_ranges;
 extern u64 mtrr_tom2;
 extern struct mtrr_state_type mtrr_state;
+extern u32 phys_hi_rsvd;
 
-void mtrr_set_mask(void);
 void mtrr_state_warn(void);
 const char *mtrr_attrib_to_str(int x);
 void mtrr_wrmsr(unsigned, unsigned, unsigned);
Signature · 1 line
2.39.2
author maintainer
#91 lore raw

PATCH 91/800 x86/xen: Set MTRR state when running as Xen PV initial domain

In reply to Greg Kroah-Hartman

From: Juergen Gross <[email protected]>

[ Upstream commit a153f254e5cdf8fa3a1df90a6ffed3063fede154 ]

When running as Xen PV initial domain (aka dom0), MTRRs are disabled by the hypervisor, but the system should nevertheless use correct cache memory types. This has always kind of worked, as disabled MTRRs resulted in disabled PAT, too, so that the kernel avoided code paths resulting in inconsistencies. This bypassed all of the sanity checks the kernel is doing with enabled MTRRs in order to avoid memory mappings with conflicting memory types.

This has been changed recently, leading to PAT being accepted to be enabled, while MTRRs stayed disabled. The result is that mtrr_type_lookup() no longer is accepting all memory type requests, but started to return WB even if UC- was requested. This led to driver failures during initialization of some devices.

In reality MTRRs are still in effect, but they are under complete control of the Xen hypervisor. It is possible, however, to retrieve the MTRR settings from the hypervisor.

In order to fix those problems, overwrite the MTRR state via mtrr_overwrite_state() with the MTRR data from the hypervisor, if the system is running as a Xen dom0.

---
 arch/x86/xen/enlighten_pv.c | 52 +++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
arch/x86/xen/enlighten_pv.c +52 -0
index 093b78c8bbec0..8732b85d56505 100644
@@ -68,6 +68,7 @@
 #include <asm/reboot.h>
 #include <asm/hypervisor.h>
 #include <asm/mach_traps.h>
+#include <asm/mtrr.h>
 #include <asm/mwait.h>
 #include <asm/pci_x86.h>
 #include <asm/cpu.h>
@@ -119,6 +120,54 @@ static int __init parse_xen_msr_safe(char *str)
 }
 early_param("xen_msr_safe", parse_xen_msr_safe);
 
+/* Get MTRR settings from Xen and put them into mtrr_state. */
+static void __init xen_set_mtrr_data(void)
+{
+#ifdef CONFIG_MTRR
+	struct xen_platform_op op = {
+		.cmd = XENPF_read_memtype,
+		.interface_version = XENPF_INTERFACE_VERSION,
+	};
+	unsigned int reg;
+	unsigned long mask;
+	uint32_t eax, width;
+	static struct mtrr_var_range var[MTRR_MAX_VAR_RANGES] __initdata;
+
+	/* Get physical address width (only 64-bit cpus supported). */
+	width = 36;
+	eax = cpuid_eax(0x80000000);
+	if ((eax >> 16) == 0x8000 && eax >= 0x80000008) {
+		eax = cpuid_eax(0x80000008);
+		width = eax & 0xff;
+	}
+
+	for (reg = 0; reg < MTRR_MAX_VAR_RANGES; reg++) {
+		op.u.read_memtype.reg = reg;
+		if (HYPERVISOR_platform_op(&op))
+			break;
+
+		/*
+		 * Only called in dom0, which has all RAM PFNs mapped at
+		 * RAM MFNs, and all PCI space etc. is identity mapped.
+		 * This means we can treat MFN == PFN regarding MTRR settings.
+		 */
+		var[reg].base_lo = op.u.read_memtype.type;
+		var[reg].base_lo |= op.u.read_memtype.mfn << PAGE_SHIFT;
+		var[reg].base_hi = op.u.read_memtype.mfn >> (32 - PAGE_SHIFT);
+		mask = ~((op.u.read_memtype.nr_mfns << PAGE_SHIFT) - 1);
+		mask &= (1UL << width) - 1;
+		if (mask)
+			mask |= MTRR_PHYSMASK_V;
+		var[reg].mask_lo = mask;
+		var[reg].mask_hi = mask >> 32;
+	}
+
+	/* Only overwrite MTRR state if any MTRR could be got from Xen. */
+	if (reg)
+		mtrr_overwrite_state(var, reg, MTRR_TYPE_UNCACHABLE);
+#endif
+}
+
 static void __init xen_pv_init_platform(void)
 {
 	/* PV guests can't operate virtio devices without grants. */
@@ -135,6 +184,9 @@ static void __init xen_pv_init_platform(void)
 
 	/* pvclock is in shared info area */
 	xen_init_time_ops();
+
+	if (xen_initial_domain())
+		xen_set_mtrr_data();
 }
 
 static void __init xen_pv_guest_late_init(void)
Signature · 1 line
2.39.2
author maintainer
#92 lore raw

PATCH 92/800 tools/nolibc: ensure fast64 integer types have 64 bits

In reply to Greg Kroah-Hartman

From: Thomas Weißschuh <[email protected]>

[ Upstream commit f9bf5944d37b75b8238349d4fb5b7a97bbecfc9d ]

On 32bit platforms size_t is not enough to represent [u]int_fast64_t.

Fixes 3e9fd4e9a1d5 ("tools/nolibc: add integer types and integer limit macros")
---
 tools/include/nolibc/stdint.h                | 10 +++++-----
 tools/testing/selftests/nolibc/nolibc-test.c |  6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)
tools/include/nolibc/stdint.h +5 -5
index c1ce4f5e06034..661d942862c0b 100644
@@ -36,8 +36,8 @@ typedef  ssize_t       int_fast16_t;
 typedef   size_t      uint_fast16_t;
 typedef  ssize_t       int_fast32_t;
 typedef   size_t      uint_fast32_t;
-typedef  ssize_t       int_fast64_t;
-typedef   size_t      uint_fast64_t;
+typedef  int64_t       int_fast64_t;
+typedef uint64_t      uint_fast64_t;
 
 typedef  int64_t           intmax_t;
 typedef uint64_t          uintmax_t;
@@ -84,16 +84,16 @@ typedef uint64_t          uintmax_t;
 #define  INT_FAST8_MIN   INT8_MIN
 #define INT_FAST16_MIN   INTPTR_MIN
 #define INT_FAST32_MIN   INTPTR_MIN
-#define INT_FAST64_MIN   INTPTR_MIN
+#define INT_FAST64_MIN   INT64_MIN
 
 #define  INT_FAST8_MAX   INT8_MAX
 #define INT_FAST16_MAX   INTPTR_MAX
 #define INT_FAST32_MAX   INTPTR_MAX
-#define INT_FAST64_MAX   INTPTR_MAX
+#define INT_FAST64_MAX   INT64_MAX
 
 #define  UINT_FAST8_MAX  UINT8_MAX
 #define UINT_FAST16_MAX  SIZE_MAX
 #define UINT_FAST32_MAX  SIZE_MAX
-#define UINT_FAST64_MAX  SIZE_MAX
+#define UINT_FAST64_MAX  UINT64_MAX
 
 #endif /* _NOLIBC_STDINT_H */
tools/testing/selftests/nolibc/nolibc-test.c +3 -3
index 21bacc928bf7b..d37d036876ea9 100644
@@ -639,9 +639,9 @@ int run_stdlib(int min, int max)
 		CASE_TEST(limit_int_fast32_min);    EXPECT_EQ(1, INT_FAST32_MIN,   (int_fast32_t)    INTPTR_MIN); break;
 		CASE_TEST(limit_int_fast32_max);    EXPECT_EQ(1, INT_FAST32_MAX,   (int_fast32_t)    INTPTR_MAX); break;
 		CASE_TEST(limit_uint_fast32_max);   EXPECT_EQ(1, UINT_FAST32_MAX,  (uint_fast32_t)   UINTPTR_MAX); break;
-		CASE_TEST(limit_int_fast64_min);    EXPECT_EQ(1, INT_FAST64_MIN,   (int_fast64_t)    INTPTR_MIN); break;
-		CASE_TEST(limit_int_fast64_max);    EXPECT_EQ(1, INT_FAST64_MAX,   (int_fast64_t)    INTPTR_MAX); break;
-		CASE_TEST(limit_uint_fast64_max);   EXPECT_EQ(1, UINT_FAST64_MAX,  (uint_fast64_t)   UINTPTR_MAX); break;
+		CASE_TEST(limit_int_fast64_min);    EXPECT_EQ(1, INT_FAST64_MIN,   (int_fast64_t)    INT64_MIN); break;
+		CASE_TEST(limit_int_fast64_max);    EXPECT_EQ(1, INT_FAST64_MAX,   (int_fast64_t)    INT64_MAX); break;
+		CASE_TEST(limit_uint_fast64_max);   EXPECT_EQ(1, UINT_FAST64_MAX,  (uint_fast64_t)   UINT64_MAX); break;
 #if __SIZEOF_LONG__ == 8
 		CASE_TEST(limit_intptr_min);        EXPECT_EQ(1, INTPTR_MIN,       (intptr_t)        0x8000000000000000LL); break;
 		CASE_TEST(limit_intptr_max);        EXPECT_EQ(1, INTPTR_MAX,       (intptr_t)        0x7fffffffffffffffLL); break;
Signature · 1 line
2.39.2
author maintainer
#93 lore raw

PATCH 93/800 kselftest: vDSO: Fix accumulation of uninitialized ret when CLOCK_REALTIME is undefined

In reply to Greg Kroah-Hartman

From: Colin Ian King <[email protected]>

[ Upstream commit 375b9ff53cb6f9c042817b75f2be0a650626dc4f ]

In the unlikely case that CLOCK_REALTIME is not defined, variable ret is not initialized and further accumulation of return values to ret can leave ret in an undefined state. Fix this by initialized ret to zero and changing the assignment of ret to an accumulation for the CLOCK_REALTIME case.

Fixes 03f55c7952c9 ("kselftest: Extend vDSO selftest to clock_getres")
---
 tools/testing/selftests/vDSO/vdso_test_clock_getres.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/vDSO/vdso_test_clock_getres.c +2 -2
index 15dcee16ff726..38d46a8bf7cba 100644
@@ -84,12 +84,12 @@ static inline int vdso_test_clock(unsigned int clock_id)
 
 int main(int argc, char **argv)
 {
-	int ret;
+	int ret = 0;
 
 #if _POSIX_TIMERS > 0
 
 #ifdef CLOCK_REALTIME
-	ret = vdso_test_clock(CLOCK_REALTIME);
+	ret += vdso_test_clock(CLOCK_REALTIME);
 #endif
 
 #ifdef CLOCK_BOOTTIME
Signature · 1 line
2.39.2
author maintainer
#94 lore raw

PATCH 94/800 selftests/ftace: Fix KTAP output ordering

In reply to Greg Kroah-Hartman

From: Mark Brown <[email protected]>

[ Upstream commit 8cd0d8633e2de4e6dd9ddae7980432e726220fdb ]

The KTAP parser I used to test the KTAP output for ftracetest was overly robust and did not notice that the test number and pass/fail result were reversed. Fix this.

Fixes dbcf76390eb9 ("selftests/ftrace: Improve integration with kselftest runner")
---
 tools/testing/selftests/ftrace/ftracetest | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/ftrace/ftracetest +1 -1
index 2506621e75dfb..cb5f18c06593d 100755
@@ -301,7 +301,7 @@ ktaptest() { # result comment
     comment="# $comment"
   fi
 
-  echo $CASENO $result $INSTANCE$CASENAME $comment
+  echo $result $CASENO $INSTANCE$CASENAME $comment
 }
 
 eval_result() { # sigval
Signature · 1 line
2.39.2
author maintainer
#95 lore raw

PATCH 95/800 perf/ibs: Fix interface via core pmu events

In reply to Greg Kroah-Hartman

From: Ravi Bangoria <[email protected]>

[ Upstream commit 2fad201fe38ff9a692acedb1990ece2c52a29f95 ]

Although, IBS pmus can be invoked via their own interface, indirect IBS invocation via core pmu events is also supported with fixed set of events: cpu-cycles:p, r076:p (same as cpu-cycles:p) and r0C1:p (micro-ops) for user convenience.

This indirect IBS invocation is broken since commit 66d258c5b048 ("perf/core: Optimize perf_init_event()"), which added RAW pmu under 'pmu_idr' list and thus if event_init() fails with RAW pmu, it started returning error instead of trying other pmus.

Forward precise events from core pmu to IBS by overwriting 'type' and 'config' in the kernel copy of perf_event_attr. Overwriting will cause perf_init_event() to retry with updated 'type' and 'config', which will automatically forward event to IBS pmu.

Without patch:

  $ sudo ./perf record -C 0 -e r076:p -- sleep 1
  Error:
  The r076:p event is not supported.

With patch:

  $ sudo ./perf record -C 0 -e r076:p -- sleep 1
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.341 MB perf.data (37 samples) ]
---
 arch/x86/events/amd/core.c        |  2 +-
 arch/x86/events/amd/ibs.c         | 53 +++++++++++++++----------------
 arch/x86/include/asm/perf_event.h |  2 ++
 3 files changed, 29 insertions(+), 28 deletions(-)
arch/x86/events/amd/core.c +1 -1
index bccea57dee81e..abadd5f234254 100644
@@ -374,7 +374,7 @@ static int amd_pmu_hw_config(struct perf_event *event)
 
 	/* pass precise event sampling to ibs: */
 	if (event->attr.precise_ip && get_ibs_caps())
-		return -ENOENT;
+		return forward_event_to_ibs(event);
 
 	if (has_branch_stack(event) && !x86_pmu.lbr_nr)
 		return -EOPNOTSUPP;
arch/x86/events/amd/ibs.c +26 -27

80 lines not on this page · raw message

arch/x86/include/asm/perf_event.h +2 -0
index abf09882f58b6..f1a46500a2753 100644
@@ -478,8 +478,10 @@ struct pebs_xmm {
 
 #ifdef CONFIG_X86_LOCAL_APIC
 extern u32 get_ibs_caps(void);
+extern int forward_event_to_ibs(struct perf_event *event);
 #else
 static inline u32 get_ibs_caps(void) { return 0; }
+static inline int forward_event_to_ibs(struct perf_event *event) { return -ENOENT; }
 #endif
 
 #ifdef CONFIG_PERF_EVENTS
Signature · 1 line
2.39.2
author maintainer
#96 lore raw

PATCH 96/800 x86/mm: Fix __swp_entry_to_pte() for Xen PV guests

In reply to Greg Kroah-Hartman

From: Juergen Gross <[email protected]>

[ Upstream commit 0f88130e8a6fd185b0aeb5d8e286083735f2585a ]

Normally __swp_entry_to_pte() is never called with a value translating to a valid PTE. The only known exception is pte_swap_tests(), resulting in a WARN splat in Xen PV guests, as __pte_to_swp_entry() did translate the PFN of the valid PTE to a guest local PFN, while __swp_entry_to_pte() doesn't do the opposite translation.

Fix that by using __pte() in __swp_entry_to_pte() instead of open coding the native variant of it.

For correctness do the similar conversion for __swp_entry_to_pmd().

Fixes 05289402d717 ("mm/debug_vm_pgtable: add tests validating arch helpers for core MM features")
---
 arch/x86/include/asm/pgtable_64.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/pgtable_64.h +2 -2
index 7929327abe009..a629b1b9f65a6 100644
@@ -237,8 +237,8 @@ static inline void native_pgd_clear(pgd_t *pgd)
 
 #define __pte_to_swp_entry(pte)		((swp_entry_t) { pte_val((pte)) })
 #define __pmd_to_swp_entry(pmd)		((swp_entry_t) { pmd_val((pmd)) })
-#define __swp_entry_to_pte(x)		((pte_t) { .pte = (x).val })
-#define __swp_entry_to_pmd(x)		((pmd_t) { .pmd = (x).val })
+#define __swp_entry_to_pte(x)		(__pte((x).val))
+#define __swp_entry_to_pmd(x)		(__pmd((x).val))
 
 extern void cleanup_highmap(void);
 
Signature · 1 line
2.39.2
author maintainer
#97 lore raw

PATCH 97/800 reiserfs: Initialize sec->length in reiserfs_security_init().

In reply to Greg Kroah-Hartman

From: Tetsuo Handa <[email protected]>

[ Upstream commit d031f4e8b493df299123fbb4ec13db870584ed28 ]

syzbot is reporting that sec->length is not initialized.

Since security_inode_init_security() returns 0 when initxattrs is provided but call_int_hook(inode_init_security) returned -EOPNOTSUPP, control will reach to "if (sec->length && ...) {" without initializing sec->length.

Fixes 52ca4b6435a4 ("reiserfs: Switch to security_inode_init_security()")
---
 fs/reiserfs/xattr_security.c | 1 +
 1 file changed, 1 insertion(+)
fs/reiserfs/xattr_security.c +1 -0
index 6e0a099dd7886..078dd8cc312fc 100644
@@ -67,6 +67,7 @@ int reiserfs_security_init(struct inode *dir, struct inode *inode,
 
 	sec->name = NULL;
 	sec->value = NULL;
+	sec->length = 0;
 
 	/* Don't add selinux attributes on xattrs - they'll never get used */
 	if (IS_PRIVATE(dir))
Signature · 1 line
2.39.2
author maintainer
#98 lore raw

PATCH 98/800 locking/atomic: arm: fix sync ops

In reply to Greg Kroah-Hartman

From: Mark Rutland <[email protected]>

[ Upstream commit dda5f312bb09e56e7a1c3e3851f2000eb2e9c879 ]

The sync_*() ops on arch/arm are defined in terms of the regular bitops with no special handling. This is not correct, as UP kernels elide barriers for the fully-ordered operations, and so the required ordering is lost when such UP kernels are run under a hypervsior on an SMP system.

Fix this by defining sync ops with the required barriers.

Note: On 32-bit arm, the sync_*() ops are currently only used by Xen, which requires ARMv7, but the semantics can be implemented for ARMv6+.

---
 arch/arm/include/asm/assembler.h   | 17 +++++++++++++++++
 arch/arm/include/asm/sync_bitops.h | 29 +++++++++++++++++++++++++----
 arch/arm/lib/bitops.h              | 14 +++++++++++---
 arch/arm/lib/testchangebit.S       |  4 ++++
 arch/arm/lib/testclearbit.S        |  4 ++++
 arch/arm/lib/testsetbit.S          |  4 ++++
 6 files changed, 65 insertions(+), 7 deletions(-)
arch/arm/include/asm/assembler.h +17 -0
index 505a306e0271a..aebe2c8f6a686 100644
@@ -394,6 +394,23 @@ ALT_UP_B(.L0_\@)
 #endif
 	.endm
 
+/*
+ * Raw SMP data memory barrier
+ */
+	.macro	__smp_dmb mode
+#if __LINUX_ARM_ARCH__ >= 7
+	.ifeqs "\mode","arm"
+	dmb	ish
+	.else
+	W(dmb)	ish
+	.endif
+#elif __LINUX_ARM_ARCH__ == 6
+	mcr	p15, 0, r0, c7, c10, 5	@ dmb
+#else
+	.error "Incompatible SMP platform"
+#endif
+	.endm
+
 #if defined(CONFIG_CPU_V7M)
 	/*
 	 * setmode is used to assert to be in svc mode during boot. For v7-M
arch/arm/include/asm/sync_bitops.h +25 -4
index 6f5d627c44a3c..f46b3c570f92e 100644
@@ -14,14 +14,35 @@
  * ops which are SMP safe even on a UP kernel.
  */
 
+/*
+ * Unordered
+ */
+
 #define sync_set_bit(nr, p)		_set_bit(nr, p)
 #define sync_clear_bit(nr, p)		_clear_bit(nr, p)
 #define sync_change_bit(nr, p)		_change_bit(nr, p)
-#define sync_test_and_set_bit(nr, p)	_test_and_set_bit(nr, p)
-#define sync_test_and_clear_bit(nr, p)	_test_and_clear_bit(nr, p)
-#define sync_test_and_change_bit(nr, p)	_test_and_change_bit(nr, p)
 #define sync_test_bit(nr, addr)		test_bit(nr, addr)
-#define arch_sync_cmpxchg		arch_cmpxchg
 
+/*
+ * Fully ordered
+ */
+
+int _sync_test_and_set_bit(int nr, volatile unsigned long * p);
+#define sync_test_and_set_bit(nr, p)	_sync_test_and_set_bit(nr, p)
+
+int _sync_test_and_clear_bit(int nr, volatile unsigned long * p);
+#define sync_test_and_clear_bit(nr, p)	_sync_test_and_clear_bit(nr, p)
+
+int _sync_test_and_change_bit(int nr, volatile unsigned long * p);
+#define sync_test_and_change_bit(nr, p)	_sync_test_and_change_bit(nr, p)
+
+#define arch_sync_cmpxchg(ptr, old, new)				\
+({									\
+	__typeof__(*(ptr)) __ret;					\
+	__smp_mb__before_atomic();					\
+	__ret = arch_cmpxchg_relaxed((ptr), (old), (new));		\
+	__smp_mb__after_atomic();					\
+	__ret;								\
+})
 
 #endif
arch/arm/lib/bitops.h +11 -3
index 95bd359912889..f069d1b2318e6 100644
@@ -28,7 +28,7 @@ UNWIND(	.fnend		)
 ENDPROC(\name		)
 	.endm
 
-	.macro	testop, name, instr, store
+	.macro	__testop, name, instr, store, barrier
 ENTRY(	\name		)
 UNWIND(	.fnstart	)
 	ands	ip, r1, #3
@@ -38,7 +38,7 @@ UNWIND(	.fnstart	)
 	mov	r0, r0, lsr #5
 	add	r1, r1, r0, lsl #2	@ Get word offset
 	mov	r3, r2, lsl r3		@ create mask
-	smp_dmb
+	\barrier
 #if __LINUX_ARM_ARCH__ >= 7 && defined(CONFIG_SMP)
 	.arch_extension	mp
 	ALT_SMP(W(pldw)	[r1])
@@ -50,13 +50,21 @@ UNWIND(	.fnstart	)
 	strex	ip, r2, [r1]
 	cmp	ip, #0
 	bne	1b
-	smp_dmb
+	\barrier
 	cmp	r0, #0
 	movne	r0, #1
 2:	bx	lr
 UNWIND(	.fnend		)
 ENDPROC(\name		)
 	.endm
+
+	.macro	testop, name, instr, store
+	__testop \name, \instr, \store, smp_dmb
+	.endm
+
+	.macro	sync_testop, name, instr, store
+	__testop \name, \instr, \store, __smp_dmb
+	.endm
 #else
 	.macro	bitop, name, instr
 ENTRY(	\name		)
arch/arm/lib/testchangebit.S +4 -0
index 4ebecc67e6e04..f13fe9bc2399a 100644
@@ -10,3 +10,7 @@
                 .text
 
 testop	_test_and_change_bit, eor, str
+
+#if __LINUX_ARM_ARCH__ >= 6
+sync_testop	_sync_test_and_change_bit, eor, str
+#endif
arch/arm/lib/testclearbit.S +4 -0
index 009afa0f5b4a7..4d2c5ca620ebf 100644
@@ -10,3 +10,7 @@
                 .text
 
 testop	_test_and_clear_bit, bicne, strne
+
+#if __LINUX_ARM_ARCH__ >= 6
+sync_testop	_sync_test_and_clear_bit, bicne, strne
+#endif
arch/arm/lib/testsetbit.S +4 -0
index f3192e55acc87..649dbab65d8d0 100644
@@ -10,3 +10,7 @@
                 .text
 
 testop	_test_and_set_bit, orreq, streq
+
+#if __LINUX_ARM_ARCH__ >= 6
+sync_testop	_sync_test_and_set_bit, orreq, streq
+#endif
Signature · 1 line
2.39.2
author maintainer
#99 lore raw

PATCH 99/800 evm: Complete description of evm_inode_setattr()

In reply to Greg Kroah-Hartman

From: Roberto Sassu <[email protected]>

[ Upstream commit b1de86d4248b273cb12c4cd7d20c08d459519f7d ]

Add the description for missing parameters of evm_inode_setattr() to avoid the warning arising with W=n compile option.

Fixes 817b54aa45db ("evm: add evm_inode_setattr to prevent updating an invalid security.evm") # v3.2+
Fixes c1632a0f1120 ("fs: port ->setattr() to pass mnt_idmap") # v6.3+
---
 security/integrity/evm/evm_main.c | 2 ++
 1 file changed, 2 insertions(+)
security/integrity/evm/evm_main.c +2 -0
index cf24c5255583c..b1c2197473a21 100644
@@ -795,7 +795,9 @@ static int evm_attr_change(struct mnt_idmap *idmap,
 
 /**
  * evm_inode_setattr - prevent updating an invalid EVM extended attribute
+ * @idmap: idmap of the mount
  * @dentry: pointer to the affected dentry
+ * @attr: iattr structure containing the new file attributes
  *
  * Permit update of file attributes when files have a valid EVM signature,
  * except in the case of them having an immutable portable signature.
Signature · 1 line
2.39.2
author maintainer
#100 lore raw

PATCH 100/800 evm: Fix build warnings

In reply to Greg Kroah-Hartman

From: Roberto Sassu <[email protected]>

[ Upstream commit 996e0a97ebd7b11cb785794e2a83c20c1add9d92 ]

Fix build warnings (function parameters description) for evm_read_protected_xattrs(), evm_set_key() and evm_verifyxattr().

Fixes 7626676320f3 ("evm: provide a function to set the EVM key from the kernel") # v4.5+
Fixes 8314b6732ae4 ("ima: Define new template fields xattrnames, xattrlengths and xattrvalues") # v5.14+
Fixes 2960e6cb5f7c ("evm: additional parameter to pass integrity cache entry 'iint'") # v3.2+
---
 security/integrity/evm/evm_crypto.c | 2 +-
 security/integrity/evm/evm_main.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
security/integrity/evm/evm_crypto.c +1 -1
index 033804f5a5f20..0dae649f3740c 100644
@@ -40,7 +40,7 @@ static const char evm_hmac[] = "hmac(sha1)";
 /**
  * evm_set_key() - set EVM HMAC key from the kernel
  * @key: pointer to a buffer with the key data
- * @size: length of the key data
+ * @keylen: length of the key data
  *
  * This function allows setting the EVM HMAC key from the kernel
  * without using the "encrypted" key subsystem keys. It can be used
security/integrity/evm/evm_main.c +1 -1
index b1c2197473a21..c9b6e2a43478a 100644
@@ -318,7 +318,6 @@ int evm_protected_xattr_if_enabled(const char *req_xattr_name)
 /**
  * evm_read_protected_xattrs - read EVM protected xattr names, lengths, values
  * @dentry: dentry of the read xattrs
- * @inode: inode of the read xattrs
  * @buffer: buffer xattr names, lengths or values are copied to
  * @buffer_size: size of buffer
  * @type: n: names, l: lengths, v: values
@@ -390,6 +389,7 @@ int evm_read_protected_xattrs(struct dentry *dentry, u8 *buffer,
  * @xattr_name: requested xattr
  * @xattr_value: requested xattr value
  * @xattr_value_len: requested xattr value length
+ * @iint: inode integrity metadata
  *
  * Calculate the HMAC for the given dentry and verify it against the stored
  * security.evm xattr. For performance, use the xattr value and length
Signature · 1 line
2.39.2
author maintainer
#101 lore raw

PATCH 101/800 ima: Fix build warnings

In reply to Greg Kroah-Hartman

From: Roberto Sassu <[email protected]>

[ Upstream commit 95526d13038c2bbddd567a4d8e39fac42484e182 ]

Fix build warnings (function parameters description) for ima_collect_modsig(), ima_match_policy() and ima_parse_add_rule().

Fixes 15588227e086 ("ima: Collect modsig") # v5.4+
Fixes 2fe5d6def167 ("ima: integrity appraisal extension") # v5.14+
Fixes 4af4662fa4a9 ("integrity: IMA policy") # v3.2+
---
 security/integrity/ima/ima_modsig.c | 3 +++
 security/integrity/ima/ima_policy.c | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)
security/integrity/ima/ima_modsig.c +3 -0
index fb25723c65bc4..3e7bee30080f2 100644
@@ -89,6 +89,9 @@ int ima_read_modsig(enum ima_hooks func, const void *buf, loff_t buf_len,
 
 /**
  * ima_collect_modsig - Calculate the file hash without the appended signature.
+ * @modsig: parsed module signature
+ * @buf: data to verify the signature on
+ * @size: data size
  *
  * Since the modsig is part of the file contents, the hash used in its signature
  * isn't the same one ordinarily calculated by IMA. Therefore PKCS7 code
security/integrity/ima/ima_policy.c +2 -1
index 3ca8b7348c2e4..c9b3bd8f1bb9c 100644
@@ -721,6 +721,7 @@ static int get_subaction(struct ima_rule_entry *rule, enum ima_hooks func)
  * @secid: LSM secid of the task to be validated
  * @func: IMA hook identifier
  * @mask: requested action (MAY_READ | MAY_WRITE | MAY_APPEND | MAY_EXEC)
+ * @flags: IMA actions to consider (e.g. IMA_MEASURE | IMA_APPRAISE)
  * @pcr: set the pcr to extend
  * @template_desc: the template that should be used for this rule
  * @func_data: func specific data, may be NULL
@@ -1915,7 +1916,7 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
 
 /**
  * ima_parse_add_rule - add a rule to ima_policy_rules
- * @rule - ima measurement policy rule
+ * @rule: ima measurement policy rule
  *
  * Avoid locking by allowing just one writer at a time in ima_write_policy()
  * Returns the length of the rule parsed, an error code on failure
Signature · 1 line
2.39.2
author maintainer
#102 lore raw

PATCH 102/800 pstore/ram: Add check for kstrdup

In reply to Greg Kroah-Hartman

From: Jiasheng Jiang <[email protected]>

[ Upstream commit d97038d5ec2062733c1e016caf9baaf68cf64ea1 ]

Add check for the return value of kstrdup() and return the error if it fails in order to avoid NULL pointer dereference.

Fixes e163fdb3f7f8 ("pstore/ram: Regularize prz label allocation lifetime")
---
 fs/pstore/ram_core.c | 2 ++
 1 file changed, 2 insertions(+)
fs/pstore/ram_core.c +2 -0
index 966191d3a5ba2..85aaf0fc6d7d1 100644
@@ -599,6 +599,8 @@ struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size,
 	raw_spin_lock_init(&prz->buffer_lock);
 	prz->flags = flags;
 	prz->label = kstrdup(label, GFP_KERNEL);
+	if (!prz->label)
+		goto err;
 
 	ret = persistent_ram_buffer_map(start, size, prz, memtype);
 	if (ret)
Signature · 1 line
2.39.2
author maintainer
#103 lore raw

PATCH 103/800 sched/core: Avoid multiple calling update_rq_clock() in __cfsb_csd_unthrottle()

In reply to Greg Kroah-Hartman

From: Hao Jia <[email protected]>

[ Upstream commit ebb83d84e49b54369b0db67136a5fe1087124dcc ]

After commit 8ad075c2eb1f ("sched: Async unthrottling for cfs bandwidth"), we may update the rq clock multiple times in the loop of __cfsb_csd_unthrottle().

A prior (although less common) instance of this problem exists in unthrottle_offline_cfs_rqs().

Cure both by ensuring update_rq_clock() is called before the loop and setting RQCF_ACT_SKIP during the loop, to supress further updates. The alternative would be pulling update_rq_clock() out of unthrottle_cfs_rq(), but that gives an even bigger mess.

---
 kernel/sched/fair.c  | 18 ++++++++++++++++++
 kernel/sched/sched.h | 22 ++++++++++++++++++++++
 2 files changed, 40 insertions(+)
kernel/sched/fair.c +18 -0
index 373ff5f558844..4da5f35417626 100644
@@ -5576,6 +5576,14 @@ static void __cfsb_csd_unthrottle(void *arg)
 
 	rq_lock(rq, &rf);
 
+	/*
+	 * Iterating over the list can trigger several call to
+	 * update_rq_clock() in unthrottle_cfs_rq().
+	 * Do it once and skip the potential next ones.
+	 */
+	update_rq_clock(rq);
+	rq_clock_start_loop_update(rq);
+
 	/*
 	 * Since we hold rq lock we're safe from concurrent manipulation of
 	 * the CSD list. However, this RCU critical section annotates the
@@ -5595,6 +5603,7 @@ static void __cfsb_csd_unthrottle(void *arg)
 
 	rcu_read_unlock();
 
+	rq_clock_stop_loop_update(rq);
 	rq_unlock(rq, &rf);
 }
 
@@ -6115,6 +6124,13 @@ static void __maybe_unused unthrottle_offline_cfs_rqs(struct rq *rq)
 
 	lockdep_assert_rq_held(rq);
 
+	/*
+	 * The rq clock has already been updated in the
+	 * set_rq_offline(), so we should skip updating
+	 * the rq clock again in unthrottle_cfs_rq().
+	 */
+	rq_clock_start_loop_update(rq);
+
 	rcu_read_lock();
 	list_for_each_entry_rcu(tg, &task_groups, list) {
 		struct cfs_rq *cfs_rq = tg->cfs_rq[cpu_of(rq)];
@@ -6137,6 +6153,8 @@ static void __maybe_unused unthrottle_offline_cfs_rqs(struct rq *rq)
 			unthrottle_cfs_rq(cfs_rq);
 	}
 	rcu_read_unlock();
+
+	rq_clock_stop_loop_update(rq);
 }
 
 #else /* CONFIG_CFS_BANDWIDTH */
kernel/sched/sched.h +22 -0
index ec7b3e0a2b207..81ac605b9cd5c 100644
@@ -1546,6 +1546,28 @@ static inline void rq_clock_cancel_skipupdate(struct rq *rq)
 	rq->clock_update_flags &= ~RQCF_REQ_SKIP;
 }
 
+/*
+ * During cpu offlining and rq wide unthrottling, we can trigger
+ * an update_rq_clock() for several cfs and rt runqueues (Typically
+ * when using list_for_each_entry_*)
+ * rq_clock_start_loop_update() can be called after updating the clock
+ * once and before iterating over the list to prevent multiple update.
+ * After the iterative traversal, we need to call rq_clock_stop_loop_update()
+ * to clear RQCF_ACT_SKIP of rq->clock_update_flags.
+ */
+static inline void rq_clock_start_loop_update(struct rq *rq)
+{
+	lockdep_assert_rq_held(rq);
+	SCHED_WARN_ON(rq->clock_update_flags & RQCF_ACT_SKIP);
+	rq->clock_update_flags |= RQCF_ACT_SKIP;
+}
+
+static inline void rq_clock_stop_loop_update(struct rq *rq)
+{
+	lockdep_assert_rq_held(rq);
+	rq->clock_update_flags &= ~RQCF_ACT_SKIP;
+}
+
 struct rq_flags {
 	unsigned long flags;
 	struct pin_cookie cookie;
Signature · 1 line
2.39.2
author maintainer
#104 lore raw

PATCH 104/800 igc: Enable and fix RX hash usage by netstack

In reply to Greg Kroah-Hartman

From: Jesper Dangaard Brouer <[email protected]>

[ Upstream commit 84214ab4689f962b4bfc47fc9a5838d25ac4274d ]

When function igc_rx_hash() was introduced in v4.20 via commit 0507ef8a0372 ("igc: Add transmit and receive fastpath and interrupt handlers"), the hardware wasn't configured to provide RSS hash, thus it made sense to not enable net_device NETIF_F_RXHASH feature bit.

The NIC hardware was configured to enable RSS hash info in v5.2 via commit 2121c2712f82 ("igc: Add multiple receive queues control supporting"), but forgot to set the NETIF_F_RXHASH feature bit.

The original implementation of igc_rx_hash() didn't extract the associated pkt_hash_type, but statically set PKT_HASH_TYPE_L3. The largest portions of this patch are about extracting the RSS Type from the hardware and mapping this to enum pkt_hash_types. This was based on Foxville i225 software user manual rev-1.3.1 and tested on Intel Ethernet Controller I225-LM (rev 03).

For UDP it's worth noting that RSS (type) hashing have been disabled both for IPv4 and IPv6 (see IGC_MRQC_RSS_FIELD_IPV4_UDP + IGC_MRQC_RSS_FIELD_IPV6_UDP) because hardware RSS doesn't handle fragmented pkts well when enabled (can cause out-of-order). This results in PKT_HASH_TYPE_L3 for UDP packets, and hash value doesn't include UDP port numbers. Not being PKT_HASH_TYPE_L4, have the effect that netstack will do a software based hash calc calling into flow_dissect, but only when code calls skb_get_hash(), which doesn't necessary happen for local delivery.

For QA verification testing I wrote a small bpftrace prog:
[0] https://github.com/xdp-project/xdp-project/blob/master/areas/hints/monitor_skb_hash_on_dev.bt

---
 drivers/net/ethernet/intel/igc/igc.h      | 28 ++++++++++++++++++++
 drivers/net/ethernet/intel/igc/igc_main.c | 31 ++++++++++++++++++++---
 2 files changed, 55 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/igc/igc.h +28 -0
index 34aebf00a5123..f7f9e217e7b42 100644
@@ -13,6 +13,7 @@
 #include <linux/ptp_clock_kernel.h>
 #include <linux/timecounter.h>
 #include <linux/net_tstamp.h>
+#include <linux/bitfield.h>
 
 #include "igc_hw.h"
 
@@ -311,6 +312,33 @@ extern char igc_driver_name[];
 #define IGC_MRQC_RSS_FIELD_IPV4_UDP	0x00400000
 #define IGC_MRQC_RSS_FIELD_IPV6_UDP	0x00800000
 
+/* RX-desc Write-Back format RSS Type's */
+enum igc_rss_type_num {
+	IGC_RSS_TYPE_NO_HASH		= 0,
+	IGC_RSS_TYPE_HASH_TCP_IPV4	= 1,
+	IGC_RSS_TYPE_HASH_IPV4		= 2,
+	IGC_RSS_TYPE_HASH_TCP_IPV6	= 3,
+	IGC_RSS_TYPE_HASH_IPV6_EX	= 4,
+	IGC_RSS_TYPE_HASH_IPV6		= 5,
+	IGC_RSS_TYPE_HASH_TCP_IPV6_EX	= 6,
+	IGC_RSS_TYPE_HASH_UDP_IPV4	= 7,
+	IGC_RSS_TYPE_HASH_UDP_IPV6	= 8,
+	IGC_RSS_TYPE_HASH_UDP_IPV6_EX	= 9,
+	IGC_RSS_TYPE_MAX		= 10,
+};
+#define IGC_RSS_TYPE_MAX_TABLE		16
+#define IGC_RSS_TYPE_MASK		GENMASK(3,0) /* 4-bits (3:0) = mask 0x0F */
+
+/* igc_rss_type - Rx descriptor RSS type field */
+static inline u32 igc_rss_type(const union igc_adv_rx_desc *rx_desc)
+{
+	/* RSS Type 4-bits (3:0) number: 0-9 (above 9 is reserved)
+	 * Accessing the same bits via u16 (wb.lower.lo_dword.hs_rss.pkt_info)
+	 * is slightly slower than via u32 (wb.lower.lo_dword.data)
+	 */
+	return le32_get_bits(rx_desc->wb.lower.lo_dword.data, IGC_RSS_TYPE_MASK);
+}
+
 /* Interrupt defines */
 #define IGC_START_ITR			648 /* ~6000 ints/sec */
 #define IGC_4K_ITR			980
drivers/net/ethernet/intel/igc/igc_main.c +27 -4
index fa764190f2705..60ce0fd5bc8bb 100644
@@ -1697,14 +1697,36 @@ static void igc_rx_checksum(struct igc_ring *ring,
 		   le32_to_cpu(rx_desc->wb.upper.status_error));
 }
 
+/* Mapping HW RSS Type to enum pkt_hash_types */
+static const enum pkt_hash_types igc_rss_type_table[IGC_RSS_TYPE_MAX_TABLE] = {
+	[IGC_RSS_TYPE_NO_HASH]		= PKT_HASH_TYPE_L2,
+	[IGC_RSS_TYPE_HASH_TCP_IPV4]	= PKT_HASH_TYPE_L4,
+	[IGC_RSS_TYPE_HASH_IPV4]	= PKT_HASH_TYPE_L3,
+	[IGC_RSS_TYPE_HASH_TCP_IPV6]	= PKT_HASH_TYPE_L4,
+	[IGC_RSS_TYPE_HASH_IPV6_EX]	= PKT_HASH_TYPE_L3,
+	[IGC_RSS_TYPE_HASH_IPV6]	= PKT_HASH_TYPE_L3,
+	[IGC_RSS_TYPE_HASH_TCP_IPV6_EX] = PKT_HASH_TYPE_L4,
+	[IGC_RSS_TYPE_HASH_UDP_IPV4]	= PKT_HASH_TYPE_L4,
+	[IGC_RSS_TYPE_HASH_UDP_IPV6]	= PKT_HASH_TYPE_L4,
+	[IGC_RSS_TYPE_HASH_UDP_IPV6_EX] = PKT_HASH_TYPE_L4,
+	[10] = PKT_HASH_TYPE_NONE, /* RSS Type above 9 "Reserved" by HW  */
+	[11] = PKT_HASH_TYPE_NONE, /* keep array sized for SW bit-mask   */
+	[12] = PKT_HASH_TYPE_NONE, /* to handle future HW revisons       */
+	[13] = PKT_HASH_TYPE_NONE,
+	[14] = PKT_HASH_TYPE_NONE,
+	[15] = PKT_HASH_TYPE_NONE,
+};
+
 static inline void igc_rx_hash(struct igc_ring *ring,
 			       union igc_adv_rx_desc *rx_desc,
 			       struct sk_buff *skb)
 {
-	if (ring->netdev->features & NETIF_F_RXHASH)
-		skb_set_hash(skb,
-			     le32_to_cpu(rx_desc->wb.lower.hi_dword.rss),
-			     PKT_HASH_TYPE_L3);
+	if (ring->netdev->features & NETIF_F_RXHASH) {
+		u32 rss_hash = le32_to_cpu(rx_desc->wb.lower.hi_dword.rss);
+		u32 rss_type = igc_rss_type(rx_desc);
+
+		skb_set_hash(skb, rss_hash, igc_rss_type_table[rss_type]);
+	}
 }
 
 static void igc_rx_vlan(struct igc_ring *rx_ring,
@@ -6561,6 +6583,7 @@ static int igc_probe(struct pci_dev *pdev,
 	netdev->features |= NETIF_F_TSO;
 	netdev->features |= NETIF_F_TSO6;
 	netdev->features |= NETIF_F_TSO_ECN;
+	netdev->features |= NETIF_F_RXHASH;
 	netdev->features |= NETIF_F_RXCSUM;
 	netdev->features |= NETIF_F_HW_CSUM;
 	netdev->features |= NETIF_F_SCTP_CRC;
Signature · 1 line
2.39.2
author maintainer
#105 lore raw

PATCH 105/800 wifi: ath9k: fix AR9003 mac hardware hang check register offset calculation

In reply to Greg Kroah-Hartman

From: Peter Seiderer <[email protected]>

[ Upstream commit 3e56c80931c7615250fe4bf83f93b57881969266 ]

Fix ath9k_hw_verify_hang()/ar9003_hw_detect_mac_hang() register offset calculation (do not overflow the shift for the second register/queues above five, use the register layout described in the comments above ath9k_hw_verify_hang() instead).

Fixes 222e04830ff0 ("ath9k: Fix MAC HW hang check for AR9003")
---
 drivers/net/wireless/ath/ath9k/ar9003_hw.c | 27 ++++++++++++++--------
 1 file changed, 18 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_hw.c +18 -9
index 4f27a9fb1482b..e9bd13eeee92f 100644
@@ -1099,17 +1099,22 @@ static bool ath9k_hw_verify_hang(struct ath_hw *ah, unsigned int queue)
 {
 	u32 dma_dbg_chain, dma_dbg_complete;
 	u8 dcu_chain_state, dcu_complete_state;
+	unsigned int dbg_reg, reg_offset;
 	int i;
 
-	for (i = 0; i < NUM_STATUS_READS; i++) {
-		if (queue < 6)
-			dma_dbg_chain = REG_READ(ah, AR_DMADBG_4);
-		else
-			dma_dbg_chain = REG_READ(ah, AR_DMADBG_5);
+	if (queue < 6) {
+		dbg_reg = AR_DMADBG_4;
+		reg_offset = queue * 5;
+	} else {
+		dbg_reg = AR_DMADBG_5;
+		reg_offset = (queue - 6) * 5;
+	}
 
+	for (i = 0; i < NUM_STATUS_READS; i++) {
+		dma_dbg_chain = REG_READ(ah, dbg_reg);
 		dma_dbg_complete = REG_READ(ah, AR_DMADBG_6);
 
-		dcu_chain_state = (dma_dbg_chain >> (5 * queue)) & 0x1f;
+		dcu_chain_state = (dma_dbg_chain >> reg_offset) & 0x1f;
 		dcu_complete_state = dma_dbg_complete & 0x3;
 
 		if ((dcu_chain_state != 0x6) || (dcu_complete_state != 0x1))
@@ -1128,6 +1133,7 @@ static bool ar9003_hw_detect_mac_hang(struct ath_hw *ah)
 	u8 dcu_chain_state, dcu_complete_state;
 	bool dcu_wait_frdone = false;
 	unsigned long chk_dcu = 0;
+	unsigned int reg_offset;
 	unsigned int i = 0;
 
 	dma_dbg_4 = REG_READ(ah, AR_DMADBG_4);
@@ -1139,12 +1145,15 @@ static bool ar9003_hw_detect_mac_hang(struct ath_hw *ah)
 		goto exit;
 
 	for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
-		if (i < 6)
+		if (i < 6) {
 			chk_dbg = dma_dbg_4;
-		else
+			reg_offset = i * 5;
+		} else {
 			chk_dbg = dma_dbg_5;
+			reg_offset = (i - 6) * 5;
+		}
 
-		dcu_chain_state = (chk_dbg >> (5 * i)) & 0x1f;
+		dcu_chain_state = (chk_dbg >> reg_offset) & 0x1f;
 		if (dcu_chain_state == 0x6) {
 			dcu_wait_frdone = true;
 			chk_dcu |= BIT(i);
Signature · 1 line
2.39.2
author maintainer
#106 lore raw

PATCH 106/800 wifi: ath9k: avoid referencing uninit memory in ath9k_wmi_ctrl_rx

In reply to Greg Kroah-Hartman

From: Fedor Pchelkin <[email protected]>

[ Upstream commit f24292e827088bba8de7158501ac25a59b064953 ]

For the reasons also described in commit b383e8abed41 ("wifi: ath9k: avoid uninit memory read in ath9k_htc_rx_msg()"), ath9k_htc_rx_msg() should validate pkt_len before accessing the SKB.

For example, the obtained SKB may have been badly constructed with pkt_len = 8. In this case, the SKB can only contain a valid htc_frame_hdr but after being processed in ath9k_htc_rx_msg() and passed to ath9k_wmi_ctrl_rx() endpoint RX handler, it is expected to have a WMI command header which should be located inside its data payload.

Implement sanity checking inside ath9k_wmi_ctrl_rx(). Otherwise, uninit memory can be referenced.

Tested on Qualcomm Atheros Communications AR9271 802.11n .

Found by Linux Verification Center (linuxtesting.org) with Syzkaller.

---
 drivers/net/wireless/ath/ath9k/wmi.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/wireless/ath/ath9k/wmi.c +4 -0
index 19345b8f7bfd5..d652c647d56b5 100644
@@ -221,6 +221,10 @@ static void ath9k_wmi_ctrl_rx(void *priv, struct sk_buff *skb,
 	if (unlikely(wmi->stopped))
 		goto free_skb;
 
+	/* Validate the obtained SKB. */
+	if (unlikely(skb->len < sizeof(struct wmi_cmd_hdr)))
+		goto free_skb;
+
 	hdr = (struct wmi_cmd_hdr *) skb->data;
 	cmd_id = be16_to_cpu(hdr->command_id);
 
Signature · 1 line
2.39.2