From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: Thanushree Sreerama <thanushree.sreerama@nokia.com>, <dev@dpdk.org>
Cc: <stable@dpdk.org>
Subject: Re: [PATCH] pci: pci_vfio: Retry vfio setup device reset, if device is busy
Date: Wed, 3 Sep 2025 16:16:45 +0200 [thread overview]
Message-ID: <7175fd56-407a-4e65-a858-faa9b1f4e89a@intel.com> (raw)
In-Reply-To: <20250903111723.5111-1-thanushree.sreerama@nokia.com>
On 9/3/2025 1:17 PM, Thanushree Sreerama wrote:
> From: "Thanushree.Sreerama" <thanushree.sreerama@nokia.com>
>
> Add proper EAGAIN handling for the device setup by retrying the device reset
>
> Issue:
> asc-0a Disp_0[18237]: EAL: Unable to reset device! Error: 11 (Resource temporarily unavailable)
> asc-0a Disp_0[18237]: EAL: 0000:f4:02.3 setup device failed
> asc-0a Disp_0[18237]: EAL: Requested device 0000:f4:02.3 cannot be used
>
> Caused due to:
> 92d847a35e1 ("Revert "driver core: Fix uevent_show() vs driver detach race"")
> Cc: stable@dpdk.org
>
> Change-Id: Ic3ae8701fccdbf1e8e2a575d48e707b4c58e939a
> Signed-off-by: Thanushree Sreerama <thanushree.sreerama@nokia.com>
> ---
> drivers/bus/pci/linux/pci_vfio.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
> index fab3483d9f..20e212c9f1 100644
> --- a/drivers/bus/pci/linux/pci_vfio.c
> +++ b/drivers/bus/pci/linux/pci_vfio.c
> @@ -478,6 +478,8 @@ pci_vfio_is_ioport_bar(int vfio_dev_fd, int bar_index)
> static int
> pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd)
> {
> + int i, ret = 0, max_retries = 5, retry_delay_ms = 20;
> +
> if (pci_vfio_setup_interrupts(dev, vfio_dev_fd) != 0) {
> RTE_LOG(ERR, EAL, "Error setting up interrupts!\n");
> return -1;
> @@ -498,7 +500,19 @@ pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd)
> * Reset the device. If the device is not capable of resetting,
> * then it updates errno as EINVAL.
> */
> - if (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET) && errno != EINVAL) {
> + for (i = 0; i < max_retries; i++) {
> + errno = 0;
> + ret = ioctl(vfio_dev_fd, VFIO_DEVICE_RESET);
> + if (!ret || errno == EINVAL)
> + break;
> +
> + if (errno == EAGAIN) {
> + RTE_LOG(DEBUG, EAL, "Device busy, sleep %d ms and retry to reset %d of %d times\n",
> + retry_delay_ms, i + 1, max_retries);
> + usleep(retry_delay_ms * 1000);
Perhaps use one of the rte_delay_* functions for portability?
> + continue;
> + }
> +
> RTE_LOG(ERR, EAL, "Unable to reset device! Error: %d (%s)\n",
> errno, strerror(errno));
> return -1;
--
Thanks,
Anatoly
next prev parent reply other threads:[~2025-09-03 14:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 11:17 Thanushree Sreerama
2025-09-03 14:16 ` Burakov, Anatoly [this message]
2025-09-04 7:22 ` David Marchand
-- strict thread matches above, loose matches on Subject: below --
2025-09-03 11:15 Thanushree Sreerama
2025-09-03 11:11 Thanushree Sreerama
2025-08-20 14:00 Thanushree Sreerama
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=7175fd56-407a-4e65-a858-faa9b1f4e89a@intel.com \
--to=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
--cc=thanushree.sreerama@nokia.com \
/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;
as well as URLs for NNTP newsgroup(s).