Linux virtualization list
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yuho Choi" <oss.patchbox@gmail.com>
Cc: virtualization@lists.linux.dev,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Eugenio Perez" <eperezma@redhat.com>
Subject: Re: [PATCH v2] vdpa/vp_vdpa: Wait for device reset to complete
Date: Mon, 16 Nov 2026 03:11:05 +0000	[thread overview]
Message-ID: <sashiko-outbox-216109@kernel.org> (raw)
In-Reply-To: <20261116030152.1704527-2-oss.patchbox@gmail.com>

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

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

vdpa/vp_vdpa: Wait for device reset to complete

This commit polls device_status in vp_vdpa_reset() until it reads back 0
before freeing the MSI-X IRQs and returning.

> diff --git a/drivers/vdpa/virtio_pci/vp_vdpa.c b/drivers/vdpa/virtio_pci/vp_vdpa.c
> index 646efd9384fba..eba82ff253ea3 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]
Can this loop sleep forever if the PCI device is surprise-removed or
fails to reset?

On PCI hot-unplug, vp_vdpa_remove() unregisters the vDPA device, which
triggers vdpa_reset() -> vp_vdpa_reset() while MMIO reads from
cfg->device_status return 0xff on every iteration.  Without a timeout or
a check for pci_device_is_present(mdev->pci_dev), vp_vdpa_reset() hangs
indefinitely while holding vdpa->cf_lock and blocks vp_vdpa_free_irq()
and device teardown.

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

  reply	other threads:[~2026-11-16  3:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  3:01 [PATCH v2] vdpa/vp_vdpa: Wait for device reset to complete Yuho Choi
2026-11-16  3:11 ` sashiko-bot [this message]
2026-11-16  8:18 ` Michael S. Tsirkin

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=sashiko-outbox-216109@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