summaryrefslogtreecommitdiffstats
path: root/mm/page_idle.c
diff options
context:
space:
mode:
authorDongli Zhang <dongli.zhang@oracle.com>2020-05-27 09:13:52 -0700
committerChristoph Hellwig <hch@lst.de>2020-05-27 20:32:56 +0200
commit9210c075cef29c1f764b4252f93105103bdfb292 (patch)
treec6d6b2a13976b6ac723df68bcc7c7312fc5bb397 /mm/page_idle.c
parentb69e2ef24b7b4867f80f47e2781e95d0bacd15cb (diff)
downloadlinux-9210c075cef29c1f764b4252f93105103bdfb292.tar.bz2
nvme-pci: avoid race between nvme_reap_pending_cqes() and nvme_poll()
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>
Diffstat (limited to 'mm/page_idle.c')
0 files changed, 0 insertions, 0 deletions