linux/drivers/nvdimm
Li Chen e568088337 nvdimm: virtio_pmem: serialize flush requests
[ Upstream commit a9ba6733c7 ]

Under heavy concurrent flush traffic, virtio-pmem can overflow its request
virtqueue (req_vq): virtqueue_add_sgs() starts returning -ENOSPC and the
driver logs "no free slots in the virtqueue". Shortly after that the
device enters VIRTIO_CONFIG_S_NEEDS_RESET and flush requests fail with
"virtio pmem device needs a reset".

Serialize virtio_pmem_flush() with a per-device mutex so only one flush
request is in-flight at a time. This prevents req_vq descriptor overflow
under high concurrency.

Reproducer (guest with virtio-pmem):
  - mkfs.ext4 -F /dev/pmem0
  - mount -t ext4 -o dax,noatime /dev/pmem0 /mnt/bench
  - fio: ioengine=io_uring rw=randwrite bs=4k iodepth=64 numjobs=64
        direct=1 fsync=1 runtime=30s time_based=1
  - dmesg: "no free slots in the virtqueue"
           "virtio pmem device needs a reset"

Fixes: 6e84200c0a ("virtio-pmem: Add virtio pmem driver")
Signed-off-by: Li Chen <me@linux.beauty>
Acked-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Link: https://patch.msgid.link/20260203021353.121091-1-me@linux.beauty
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-02-26 14:59:27 -08:00
..
badrange.c nvdimm: Introduce guard() for nvdimm_bus_lock 2025-09-25 12:40:11 -05:00
btt.c block: switch ->getgeo() to struct gendisk 2025-08-13 02:59:29 -04:00
btt.h nvdimm-btt: convert to blk_alloc_disk/blk_cleanup_disk 2021-06-01 07:42:23 -06:00
btt_devs.c nvdimm: Introduce guard() for nvdimm_bus_lock 2025-09-25 12:40:11 -05:00
bus.c nvdimm: Remove duplicate linux/slab.h header 2025-09-29 10:06:03 -05:00
claim.c nvdimm: Introduce guard() for nvdimm_bus_lock 2025-09-25 12:40:11 -05:00
core.c nvdimm: Introduce guard() for nvdimm_bus_lock 2025-09-25 12:40:11 -05:00
dax_devs.c nvdimm: Introduce guard() for nvdimm_bus_lock 2025-09-25 12:40:11 -05:00
dimm.c nvdimm: Introduce guard() for nvdimm_bus_lock 2025-09-25 12:40:11 -05:00
dimm_devs.c nvdimm: Introduce guard() for nvdimm_bus_lock 2025-09-25 12:40:11 -05:00
e820.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
Kconfig libnvdimm: Fix ACPI_NFIT in BLK_DEV_PMEM help 2024-02-12 14:32:25 -07:00
label.c libnvdimm/labels: Fix divide error in nd_label_data_init() 2025-03-20 16:54:27 -05:00
label.h nvdimm/region: Delete nd_blk_region infrastructure 2022-03-11 15:53:13 -08:00
Makefile drivers/nvdimm: Fix build failure when CONFIG_PERF_EVENTS is not set 2022-03-23 12:17:36 -07:00
namespace_devs.c nvdimm: Introduce guard() for nvdimm_bus_lock 2025-09-25 12:40:11 -05:00
nd-core.h libnvdimm: Remove unused nd_attach_ndns 2025-03-03 08:03:43 -06:00
nd.h nvdimm: Introduce guard() for nvdimm_bus_lock 2025-09-25 12:40:11 -05:00
nd_perf.c nvdimm: Fix dereference after free in register_nvdimm_pmu() 2023-08-17 09:34:03 -07:00
nd_virtio.c nvdimm: virtio_pmem: serialize flush requests 2026-02-26 14:59:27 -08:00
of_pmem.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
pfn.h libnvdimm/namespace: Enforce memremap_compat_align() 2020-03-17 12:23:21 -07:00
pfn_devs.c nvdimm: Introduce guard() for nvdimm_bus_lock 2025-09-25 12:40:11 -05:00
pmem.c mm: remove callers of pfn_t functionality 2025-07-09 22:42:19 -07:00
pmem.h mm: remove callers of pfn_t functionality 2025-07-09 22:42:19 -07:00
region.c nvdimm: Introduce guard() for nvdimm_bus_lock 2025-09-25 12:40:11 -05:00
region_devs.c nvdimm: Introduce guard() for nvdimm_bus_lock 2025-09-25 12:40:11 -05:00
security.c nvdimm: Introduce guard() for nvdimm_bus_lock 2025-09-25 12:40:11 -05:00
virtio_pmem.c nvdimm: virtio_pmem: serialize flush requests 2026-02-26 14:59:27 -08:00
virtio_pmem.h nvdimm: virtio_pmem: serialize flush requests 2026-02-26 14:59:27 -08:00