Gui-Dong Han
301c668d5e
drm/amdgpu: use atomic functions with memory barriers for vm fault info
...
[ Upstream commit 6df8e84aa6b5b1812cc2cacd6b3f5ccbb18cda2b ]
The atomic variable vm_fault_info_updated is used to synchronize access to
adev->gmc.vm_fault_info between the interrupt handler and
get_vm_fault_info().
The default atomic functions like atomic_set() and atomic_read() do not
provide memory barriers. This allows for CPU instruction reordering,
meaning the memory accesses to vm_fault_info and the vm_fault_info_updated
flag are not guaranteed to occur in the intended order. This creates a
race condition that can lead to inconsistent or stale data being used.
The previous implementation, which used an explicit mb(), was incomplete
and inefficient. It failed to account for all potential CPU reorderings,
such as the access of vm_fault_info being reordered before the atomic_read
of the flag. This approach is also more verbose and less performant than
using the proper atomic functions with acquire/release semantics.
Fix this by switching to atomic_set_release() and atomic_read_acquire().
These functions provide the necessary acquire and release semantics,
which act as memory barriers to ensure the correct order of operations.
It is also more efficient and idiomatic than using explicit full memory
barriers.
Fixes: b97dfa27ef ("drm/amdgpu: save vm fault information for amdkfd")
Cc: stable@vger.kernel.org
Signed-off-by: Gui-Dong Han <hanguidong02@gmail.com>
Signed-off-by: Felix Kuehling <felix.kuehling@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
[ kept kgd_dev parameter and adev cast in amdgpu_amdkfd_gpuvm_get_vm_fault_info ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-10-29 14:00:01 +01:00
..
accessibility
acpi
ACPI: debug: fix signedness issues in read/write helpers
2025-10-29 13:59:52 +01:00
amba
android
binder: remove "invalid inc weak" check
2025-10-29 14:00:00 +01:00
ata
ata: Fix SATA_MOBILE_LPM_POLICY description in Kconfig
2025-08-28 16:21:35 +02:00
atm
atm: atmtcp: Prevent arbitrary write in atmtcp_recv_control().
2025-09-04 14:05:54 +02:00
auxdisplay
base
drivers/base/node: fix double free in register_one_node()
2025-10-29 13:59:49 +01:00
bcma
block
drbd: add missing kref_get in handle_write_conflicts
2025-08-28 16:21:24 +02:00
bluetooth
bus
Revert "bus: ti-sysc: Probe for l4_wkup and l4_cfg interconnect devices first"
2025-06-27 11:02:55 +01:00
cdrom
char
tpm_tis: Fix incorrect arguments in tpm_tis_probe_irq_single
2025-10-29 13:59:52 +01:00
clk
clk: nxp: Fix pll0 rate check condition in LPC18xx CGU driver
2025-10-29 13:59:51 +01:00
clocksource
clocksource/drivers/clps711x: Fix resource leaks in error paths
2025-10-29 13:59:50 +01:00
connector
counter
cpufreq
cpufreq: intel_pstate: Fix object lifecycle issue in update_qos_request()
2025-10-29 13:59:52 +01:00
cpuidle
Revert "cpuidle: menu: Avoid discarding useful information"
2025-10-29 13:59:59 +01:00
crypto
crypto: atmel - Fix dma_unmap_sg() direction
2025-10-29 13:59:52 +01:00
dax
dca
devfreq
dio
dma
dmaengine: qcom: bam_dma: Fix DT error handling for num-channels/ees
2025-10-02 13:34:29 +02:00
dma-buf
dma-buf: fix timeout handling in dma_resv_wait_timeout v2
2025-07-17 18:25:04 +02:00
edac
EDAC/altera: Delete an inappropriate dma_free_coherent() call
2025-10-02 13:34:27 +02:00
eisa
extcon
firewire
firmware
firmware: meson_sm: fix device leak at probe
2025-10-29 13:59:52 +01:00
fpga
fpga: zynq_fpga: Fix the wrong usage of dma_map_sgtable()
2025-08-28 16:21:32 +02:00
fsi
gnss
gpio
gpio: pca953x: fix IRQ storm on system wake up
2025-09-09 18:44:00 +02:00
gpu
drm/amdgpu: use atomic functions with memory barriers for vm fault info
2025-10-29 14:00:01 +01:00
greybus
hid
HID: hid-ntrig: fix unable to handle page fault in ntrig_report_version()
2025-09-04 14:05:56 +02:00
hsi
hv
hwmon
hwmon: (occ) fix unaligned accesses
2025-06-27 11:02:57 +01:00
hwspinlock
hwtracing
i2c
i2c: designware: Add disabling clocks when probe fails
2025-10-29 13:59:47 +01:00
i3c
i3c: don't fail if GETHDRCAP is unsupported
2025-08-28 16:21:29 +02:00
ide
idle
iio
iio: frequency: adf4350: Fix prescaler usage.
2025-10-29 13:59:53 +01:00
infiniband
RDMA/siw: Always report immediate post SQ errors
2025-10-29 13:59:49 +01:00
input
Input: uinput - zero-initialize uinput_ff_upload_compat to avoid info leak
2025-10-29 13:59:50 +01:00
interconnect
iommu
ipack
irqchip
isdn
mISDN: Fix memory leak in dsp_hwec_enable()
2025-09-09 18:43:57 +02:00
leds
lightnvm
macintosh
mailbox
mailbox: zynqmp-ipi: Remove dev.parent check in zynqmp_ipi_free_mboxes
2025-10-29 13:59:52 +01:00
mcb
md
dm: fix NULL pointer dereference in __dm_suspend()
2025-10-29 13:59:55 +01:00
media
media: pci: ivtv: Add missing check after DMA map
2025-10-29 13:59:56 +01:00
memory
memory: samsung: exynos-srom: Fix of_iomap leak in exynos_srom_probe
2025-10-29 14:00:00 +01:00
memstick
memstick: Fix deadlock by moving removing flag earlier
2025-08-28 16:21:32 +02:00
message
mfd
mfd: intel_soc_pmic_chtdc_ti: Set use_single_read regmap_config flag
2025-10-29 13:59:55 +01:00
misc
misc: genwqe: Fix incorrect cmd field being reported in error
2025-10-29 13:59:48 +01:00
mmc
mmc: core: SPI mode remove cmd7
2025-10-29 13:59:53 +01:00
mtd
spi: cadence-quadspi: Flush posted register writes before DAC access
2025-10-29 14:00:00 +01:00
mux
net
net: ravb: Ensure memory write completes before ringing TX doorbell
2025-10-29 13:59:59 +01:00
nfc
ntb
nubus
nvdimm
nvme
nvmem
of
opp
oprofile
parisc
parport
pci
PCI: keystone: Use devm_request_irq() to free "ks-pcie-error-irq" on exit
2025-10-29 13:59:54 +01:00
pcmcia
pcmcia: omap_cf: Mark driver struct with __refdata to prevent section mismatch
2025-10-02 13:34:30 +02:00
perf
perf: arm_spe: Prevent overflow in PERF_IDX2OFF()
2025-10-29 13:59:46 +01:00
phy
phy: ti-pipe3: fix device leak at unbind
2025-10-02 13:34:30 +02:00
pinctrl
pinctrl: check the return value of pinmux_ops::get_function_name()
2025-10-29 13:59:50 +01:00
platform
platform/x86: thinkpad_acpi: Handle KCOV __init vs inline mismatches
2025-08-28 16:21:25 +02:00
pnp
power
power: supply: bq27xxx: restrict no-battery detection to bq27000
2025-10-02 13:34:31 +02:00
powercap
pps
pps: fix warning in pps_register_cdev when register device fail
2025-10-29 13:59:48 +01:00
ps3
ptp
pwm
pwm: berlin: Fix wrong register in suspend/resume
2025-10-29 13:59:56 +01:00
rapidio
drivers/rapidio/rio_cm.c: prevent possible heap overwrite
2025-06-27 11:02:56 +01:00
ras
regulator
regulator: core: fix NULL dereference on unbind due to stale coupling data
2025-08-28 16:21:17 +02:00
remoteproc
remoteproc: qcom: q6v5: Avoid disabling handover IRQ twice
2025-10-29 13:59:49 +01:00
reset
rpmsg
rtc
rtc: interface: Fix long-standing race when setting alarm
2025-10-29 13:59:53 +01:00
s390
scsi: s390: zfcp: Ensure synchronous unit_add
2025-06-27 11:02:56 +01:00
sbus
scsi
scsi: hpsa: Fix potential memory leak in hpsa_big_passthru_ioctl()
2025-10-29 13:59:53 +01:00
sfi
sh
siox
slimbus
soc
soc: qcom: rpmh-rsc: Unconditionally clear _TRIGGER bit for TCS
2025-10-29 13:59:46 +01:00
soundwire
soundwire: stream: restore params when prepare ports fail
2025-08-28 16:21:21 +02:00
spi
spi: spi-fsl-lpspi: Reset FIFO and disable module on transfer abort
2025-09-09 18:44:01 +02:00
spmi
ssb
staging
comedi: fix divide-by-zero in comedi_buf_munge()
2025-10-29 14:00:00 +01:00
target
scsi: target: target_core_configfs: Add length check to avoid buffer overflow
2025-10-29 13:59:44 +01:00
tc
tee
tee: Prevent size calculation wraparound on 32-bit kernels
2025-06-27 11:02:55 +01:00
thermal
thermal: sysfs: Return ENODATA instead of EAGAIN for reads
2025-08-28 16:21:25 +02:00
thunderbolt
thunderbolt: Fix copy+paste error in match_service_id()
2025-08-28 16:21:30 +02:00
tty
serial: max310x: Add error checking in probe()
2025-10-29 13:59:47 +01:00
uio
uio_hv_generic: Let userspace take care of interrupt mask
2025-10-29 13:59:50 +01:00
usb
xhci: dbc: enable back DbC in resume if it was enabled before suspend
2025-10-29 14:00:00 +01:00
vfio
vhost
vhost/net: Protect ubufs with rcu read lock in vhost_net_ubuf_put()
2025-09-04 14:05:53 +02:00
video
fbcon: Fix OOB access in font allocation
2025-10-02 13:34:34 +02:00
virt
virtio
visorbus
vlynq
vme
w1
watchdog
watchdog: mpc8xxx_wdt: Reload the watchdog timer when enabling the watchdog
2025-10-29 13:59:48 +01:00
xen
xen/events: Update virq_to_irq on migration
2025-10-29 13:59:56 +01:00
zorro
Kconfig
Makefile