linux-stable/drivers
Dave Jiang 6b4b87f2c3 dmaengine: idxd: fix submission race window
Konstantin observed that when descriptors are submitted, the descriptor is
added to the pending list after the submission. This creates a race window
with the slight possibility that the descriptor can complete before it
gets added to the pending list and this window would cause the completion
handler to miss processing the descriptor.

To address the issue, the addition of the descriptor to the pending list
must be done before it gets submitted to the hardware. However, submitting
to swq with ENQCMDS instruction can cause a failure with the condition of
either wq is full or wq is not "active".

With the descriptor allocation being the gate to the wq capacity, it is not
possible to hit a retry with ENQCMDS submission to the swq. The only
possible failure can happen is when wq is no longer "active" due to hw
error and therefore we are moving towards taking down the portal. Given
this is a rare condition and there's no longer concern over I/O
performance, the driver can walk the completion lists in order to retrieve
and abort the descriptor.

The error path will set the descriptor to aborted status. It will take the
work list lock to prevent further processing of worklist. It will do a
delete_all on the pending llist to retrieve all descriptors on the pending
llist. The delete_all action does not require a lock. It will walk through
the acquired llist to find the aborted descriptor while add all remaining
descriptors to the work list since it holds the lock. If it does not find
the aborted descriptor on the llist, it will walk through the work
list. And if it still does not find the descriptor, then it means the
interrupt handler has removed the desc from the llist but is pending on
the work list lock and will process it once the error path releases the
lock.

Fixes: eb15e7154f ("dmaengine: idxd: add interrupt handle request and release support")
Reported-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/162628855747.360485.10101925573082466530.stgit@djiang5-desk3.ch.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2021-07-20 22:55:08 +05:30
..
accessibility TTY / Serial patches for 5.14-rc1 2021-07-05 14:08:24 -07:00
acpi More ACPI updates for 5.14-rc1 2021-07-07 13:30:01 -07:00
amba
android
ata ARM: SoC changes for 5.14 2021-07-10 09:22:44 -07:00
atm Networking changes for 5.14. 2021-06-30 15:51:09 -07:00
auxdisplay
base More power management updates for 5.14-rc1 2021-07-07 13:22:59 -07:00
bcma
block block-5.14-2021-07-08 2021-07-09 12:05:33 -07:00
bluetooth TTY / Serial patches for 5.14-rc1 2021-07-05 14:08:24 -07:00
bus ARM: Drivers for 5.14 2021-07-10 09:46:20 -07:00
cdrom block: remove REQ_OP_SCSI_{IN,OUT} 2021-06-30 15:34:19 -06:00
char ARM: SoC changes for 5.14 2021-07-10 09:22:44 -07:00
clk The second batch of clk driver code for -rc1 2021-07-08 12:12:22 -07:00
clocksource This round has a diffstat dominated by Qualcomm clk drivers. Honestly though 2021-07-01 13:26:16 -07:00
comedi Staging / IIO driver patches for 5.14-rc1 2021-07-05 14:01:53 -07:00
connector
counter
cpufreq Merge branch 'cpufreq/arm/linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm 2021-07-01 14:25:43 +02:00
cpuidle - Add support for the Qcom MSM8226 (Bartosz Dudziak) 2021-06-30 14:56:51 +02:00
crypto ARM: SoC changes for 5.14 2021-07-10 09:22:44 -07:00
cxl
dax fs: remove noop_set_page_dirty() 2021-06-29 10:53:48 -07:00
dca
devfreq
dio
dma dmaengine: idxd: fix submission race window 2021-07-20 22:55:08 +05:30
dma-buf
edac Merge branch 'akpm' (patches from Andrew) 2021-07-02 12:08:10 -07:00
eisa
extcon Char / Misc driver updates for 5.14-rc1 2021-07-05 13:42:16 -07:00
firewire Char / Misc driver updates for 5.14-rc1 2021-07-05 13:42:16 -07:00
firmware ARM: Drivers for 5.14 2021-07-10 09:46:20 -07:00
fpga
fsi
gnss
gpio - Core Frameworks 2021-07-05 12:10:34 -07:00
gpu drm fixes for 5.14-rc1 2021-07-08 12:28:15 -07:00
greybus
hid Merge branch 'for-5.14/multitouch' into for-linus 2021-06-30 09:15:15 +02:00
hsi
hv Merge branch 'akpm' (patches from Andrew) 2021-07-02 12:08:10 -07:00
hwmon Char / Misc driver updates for 5.14-rc1 2021-07-05 13:42:16 -07:00
hwspinlock
hwtracing Char / Misc driver updates for 5.14-rc1 2021-07-05 13:42:16 -07:00
i2c Merge branch 'i2c/for-mergewindow' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2021-07-04 11:47:18 -07:00
i3c I3C for 5.14 2021-07-10 11:53:06 -07:00
idle
iio Staging / IIO driver patches for 5.14-rc1 2021-07-05 14:01:53 -07:00
infiniband Tracing updates for 5.14: 2021-07-03 11:13:22 -07:00
input This pull request contains the following changes for UML: 2021-07-09 10:19:13 -07:00
interconnect
iommu ARM: Drivers for 5.14 2021-07-10 09:46:20 -07:00
ipack TTY / Serial patches for 5.14-rc1 2021-07-05 14:08:24 -07:00
irqchip irqchip fixes for 5.14, take #1 2021-07-09 15:35:13 +02:00
isdn TTY / Serial patches for 5.14-rc1 2021-07-05 14:08:24 -07:00
leds This contains quite a lot of fixes, with more fixes in my inbox that 2021-07-03 11:57:42 -07:00
lightnvm
macintosh
mailbox mbox: add polarfire soc system controller mailbox 2021-06-26 12:06:48 -05:00
mcb
md - Various DM persistent-data library improvements and fixes that 2021-06-30 18:19:39 -07:00
media Driver core changes for 5.14-rc1 2021-07-05 13:51:41 -07:00
memory
memstick for-5.14/block-2021-06-29 2021-06-30 12:12:56 -07:00
message
mfd Driver core changes for 5.14-rc1 2021-07-05 13:51:41 -07:00
misc TTY / Serial patches for 5.14-rc1 2021-07-05 14:08:24 -07:00
mmc block-5.14-2021-07-08 2021-07-09 12:05:33 -07:00
most
mtd This pull request contains the following changes for UBIFS: 2021-07-09 10:10:47 -07:00
mux
net ARM: SoC changes for 5.14 2021-07-10 09:22:44 -07:00
nfc
ntb
nubus
nvdimm cxl for 5.14 2021-07-04 11:55:13 -07:00
nvme block-5.14-2021-07-08 2021-07-09 12:05:33 -07:00
nvmem Char / Misc driver updates for 5.14-rc1 2021-07-05 13:42:16 -07:00
of Devicetree updates for v5.14: 2021-07-03 10:54:08 -07:00
opp
parisc kernel.h: split out panic and oops helpers 2021-07-01 11:06:04 -07:00
parport
pci pci-v5.14-fixes-1 2021-07-10 11:57:57 -07:00
pcmcia
perf
phy USB / Thunderbolt patches for 5.14-rc1 2021-07-05 14:16:22 -07:00
pinctrl This is the bulk of pin control changes for the v5.14 kernel: 2021-07-01 16:57:14 -07:00
platform Driver core changes for 5.14-rc1 2021-07-05 13:51:41 -07:00
pnp Char / Misc driver updates for 5.14-rc1 2021-07-05 13:42:16 -07:00
power power supply and reset changes for the v5.14 series 2021-07-07 13:17:48 -07:00
powercap
pps
ps3
ptp ptp: Set lookup cookie when creating a PTP PPS source. 2021-06-29 11:29:37 -07:00
pwm pwm: Remove redundant assignment to pointer pwm 2021-07-07 21:43:32 +02:00
rapidio
ras
regulator - Core Frameworks 2021-07-05 12:10:34 -07:00
remoteproc remoteproc updates for v5.14 2021-07-07 10:50:03 -07:00
reset ARM: Drivers for 5.14 2021-07-10 09:46:20 -07:00
rpmsg
rtc RTC for 5.14 2021-07-10 16:19:10 -07:00
s390 s390 updates for the 5.14 merge window #2 2021-07-10 10:46:14 -07:00
sbus
scsi SCSI misc on 20210711 2021-07-11 10:59:53 -07:00
sh
siox
slimbus
soc ARM: Drivers for 5.14 2021-07-10 09:46:20 -07:00
soundwire Char / Misc driver updates for 5.14-rc1 2021-07-05 13:42:16 -07:00
spi Merge remote-tracking branch 'spi/for-5.14' into spi-next 2021-06-25 14:08:26 +01:00
spmi spmi: hisi-spmi-controller: move driver from staging 2021-06-25 10:02:05 +02:00
ssb
staging TTY / Serial patches for 5.14-rc1 2021-07-05 14:08:24 -07:00
target block-5.14-2021-07-08 2021-07-09 12:05:33 -07:00
tc
tee fallthrough fixes for Clang for 5.14-rc1 2021-06-28 20:03:38 -07:00
thermal - Add rk3568 sensor support (Finley Xiao) 2021-07-10 11:43:25 -07:00
thunderbolt USB / Thunderbolt patches for 5.14-rc1 2021-07-05 14:16:22 -07:00
tty This pull request contains the following changes for UML: 2021-07-09 10:19:13 -07:00
uio
usb USB / Thunderbolt patches for 5.14-rc1 2021-07-05 14:16:22 -07:00
vdpa vp_vdpa: allow set vq state to initial state after reset 2021-07-08 07:49:02 -04:00
vfio VFIO update for v5.14-rc1 2021-07-03 11:49:33 -07:00
vhost vdpa: support packed virtqueue for set/get_vq_state() 2021-07-08 07:49:01 -04:00
video This pull request contains the following changes for UML: 2021-07-09 10:19:13 -07:00
virt
virtio virtio,vhost,vdpa: features, fixes 2021-07-09 11:06:29 -07:00
visorbus
vlynq
vme
w1
watchdog linux-watchdog 5.14-rc1 tag 2021-07-07 12:57:46 -07:00
xen xen: branch for v5.14-rc1 2021-07-07 11:07:13 -07:00
zorro
Kconfig
Makefile hyperv-next for 5.14 2021-06-29 11:21:35 -07:00