Linux virtualization list
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yuho Choi" <oss.patchbox@gmail.com>
Cc: "Eugenio Perez" <eperezma@redhat.com>,
	virtualization@lists.linux.dev,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH v1] vdpa/vp_vdpa: Wait for device reset to complete
Date: Sat, 26 Sep 2026 21:34:21 +0000	[thread overview]
Message-ID: <20260926213421.9E5D61F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260926211507.1330179-1-oss.patchbox@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] vdpa: infinite wait in vp_vdpa_reset() on surprise removal
--

commit ae50410e662342786548e32b0e3164421c8c5862
Author: Yuho Choi <oss.patchbox@gmail.com>

vdpa/vp_vdpa: Wait for device reset to complete

This commit modifies vp_vdpa_reset() to poll the device status after writing
0, waiting for it to become 0. This ensures the device reset completes before
tearing down IOTLB/IOMMU mappings or freeing IRQs.

> diff --git a/drivers/vdpa/virtio_pci/vp_vdpa.c b/drivers/vdpa/virtio_pci/vp_vdpa.c
> index f2eb654b1665a..4285cb968479a 100644
> --- a/drivers/vdpa/virtio_pci/vp_vdpa.c
> +++ b/drivers/vdpa/virtio_pci/vp_vdpa.c
[ ... ]
> @@ -236,6 +237,9 @@ static int vp_vdpa_reset(struct vdpa_device *vdpa)
>  	u8 s = vp_vdpa_get_status(vdpa);
>  
>  	vp_modern_set_status(mdev, 0);
> +	/* Wait for the reset to complete */
> +	while (vp_modern_get_status(mdev))
> +		fsleep(1000);

[Severity: High]
Could this unbounded wait cause an infinite loop during a surprise removal?

If the underlying PCI device undergoes a surprise removal (hot-unplug) or a
fatal bus error, memory-mapped I/O reads via vp_modern_get_status() will
persistently return all-ones (0xFF).

Since there is no timeout or explicit check for the 0xFF PCIe disconnect
state, could this lead to a permanent kernel thread hang in uninterruptible
sleep?

>  
>  	if (s & VIRTIO_CONFIG_S_DRIVER_OK)
>  		vp_vdpa_free_irq(vp_vdpa);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260926211507.1330179-1-oss.patchbox@gmail.com?part=1

      reply	other threads:[~2026-09-26 21:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-26 21:14 [PATCH v1] vdpa/vp_vdpa: Wait for device reset to complete Yuho Choi
2026-09-26 21:34 ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260926213421.9E5D61F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=eperezma@redhat.com \
    --cc=mst@redhat.com \
    --cc=oss.patchbox@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=virtualization@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox