https://github.com/torvalds/linux
Revision 9210c075cef29c1f764b4252f93105103bdfb292 authored by Dongli Zhang on 27 May 2020, 16:13:52 UTC, committed by Christoph Hellwig on 27 May 2020, 18:32:56 UTC
There may be a race between nvme_reap_pending_cqes() and nvme_poll(), e.g., when doing live reset while polling the nvme device. CPU X CPU Y nvme_poll() nvme_dev_disable() -> nvme_stop_queues() -> nvme_suspend_io_queues() -> nvme_suspend_queue() -> spin_lock(&nvmeq->cq_poll_lock); -> nvme_reap_pending_cqes() -> nvme_process_cq() -> nvme_process_cq() In the above scenario, the nvme_process_cq() for the same queue may be running on both CPU X and CPU Y concurrently. It is much more easier to reproduce the issue when CONFIG_PREEMPT is enabled in kernel. When CONFIG_PREEMPT is disabled, it would take longer time for nvme_stop_queues()-->blk_mq_quiesce_queue() to wait for grace period. This patch protects nvme_process_cq() with nvmeq->cq_poll_lock in nvme_reap_pending_cqes(). Fixes: fa46c6fb5d61 ("nvme/pci: move cqe check after device shutdown") Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com> Reviewed-by: Ming Lei <ming.lei@redhat.com> Reviewed-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent b69e2ef
Tip revision: 9210c075cef29c1f764b4252f93105103bdfb292 authored by Dongli Zhang on 27 May 2020, 16:13:52 UTC
nvme-pci: avoid race between nvme_reap_pending_cqes() and nvme_poll()
nvme-pci: avoid race between nvme_reap_pending_cqes() and nvme_poll()
Tip revision: 9210c07
File | Mode | Size |
---|---|---|
bebob | ||
dice | ||
digi00x | ||
fireface | ||
fireworks | ||
motu | ||
oxfw | ||
tascam | ||
Kconfig | -rw-r--r-- | 4.8 KB |
Makefile | -rw-r--r-- | 664 bytes |
amdtp-am824.c | -rw-r--r-- | 11.7 KB |
amdtp-am824.h | -rw-r--r-- | 1.6 KB |
amdtp-stream-trace.h | -rw-r--r-- | 2.5 KB |
amdtp-stream.c | -rw-r--r-- | 39.8 KB |
amdtp-stream.h | -rw-r--r-- | 8.9 KB |
cmp.c | -rw-r--r-- | 9.6 KB |
cmp.h | -rw-r--r-- | 1.5 KB |
fcp.c | -rw-r--r-- | 10.3 KB |
fcp.h | -rw-r--r-- | 1.0 KB |
isight.c | -rw-r--r-- | 17.5 KB |
iso-resources.c | -rw-r--r-- | 6.5 KB |
iso-resources.h | -rw-r--r-- | 1.2 KB |
lib.c | -rw-r--r-- | 3.1 KB |
lib.h | -rw-r--r-- | 775 bytes |
packets-buffer.c | -rw-r--r-- | 2.1 KB |
packets-buffer.h | -rw-r--r-- | 786 bytes |
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...