Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Josh Hilke" <jrhilke@google.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v4 9/9] vfio: selftests: igb: Recover after DMA-read faults
Date: Fri, 10 Jul 2026 22:33:42 +0000	[thread overview]
Message-ID: <20260710223343.65ADF1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260710-igb_v3_b4-v4-9-56e7e2576cc1@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Using a fixed heuristic delay before `vfio_pci_device_reset()` causes test flakes due to `ioctl_assert` failing on `-EAGAIN`.
--

--- Patch [9]: [PATCH v4 9/9] vfio: selftests: igb: Recover after DMA-read faults ---
commit 774200982f984c4b603b9d07688586c25dcf8c58
Author: Alex Williamson <alex.williamson@nvidia.com>

vfio: selftests: igb: Recover after DMA-read faults

This commit adds a mechanism to recover from DMA-read faults in the igb
selftest by issuing a VFIO_DEVICE_RESET. It introduces a 10ms heuristic
delay before the reset to allow PCIe/IOMMU/AER error handling to complete
and release the device lock.

> diff --git a/tools/testing/selftests/vfio/lib/drivers/igb/igb.c b/tools/testing/selftests/vfio/lib/drivers/igb/igb.c
> --- a/tools/testing/selftests/vfio/lib/drivers/igb/igb.c
> +++ b/tools/testing/selftests/vfio/lib/drivers/igb/igb.c
[ ... ]
> @@ -490,7 +512,28 @@ static int igb_memcpy_wait(struct vfio_pci_device *device)
[ ... ]
> +	/*
> +	 * The descriptor never completed.  On real 82576 hardware this
> +	 * typically follows a DMA-read fault from one of the intentional
> +	 * unmapped-IOVA tests; the fault leaves the descriptor engine
> +	 * unable to service subsequent valid descriptors.  CTRL.RST alone
> +	 * reinitializes the queue registers but leaves the engine wedged
> +	 * for the current process, so a broader VFIO_DEVICE_RESET (FLR)
> +	 * is required.
> +	 *
> +	 * Delay before requesting reset so PCIe/IOMMU/AER error handling
> +	 * triggered by the just-observed DMA fault can release the device
> +	 * lock VFIO_DEVICE_RESET contends for.  The 10 ms value is
> +	 * heuristic.  The current memcpy still fails with -ETIMEDOUT;
> +	 * recovery only ensures the next memcpy starts from a usable state.
> +	 */
> +	usleep(10000);
> +	igb_error_reset_and_reinit(device);

[Severity: Medium]
Since the 10ms delay is a heuristic, what happens if asynchronous PCIe AER
recovery (which can involve link resets and training) takes longer than
10ms?

If the device lock is still held when igb_error_reset_and_reinit() calls
vfio_pci_device_reset(), the underlying ioctl will return -EAGAIN. 

Because vfio_pci_device_reset() internally uses ioctl_assert() which expects
a return value of 0, returning -EAGAIN will immediately abort the test
program, resulting in a flaky test if the timing is missed.

Would it be more robust to explicitly retry the VFIO_DEVICE_RESET ioctl on 
-EAGAIN instead of relying on a fixed sleep and an unconditional assert?

> +
> +	return -ETIMEDOUT;
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260710-igb_v3_b4-v4-0-56e7e2576cc1@google.com?part=9

      reply	other threads:[~2026-07-10 22:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10 22:06 [PATCH v4 0/9] vfio: selftests: Add driver for Intel Ethernet Gigabit Controller (IGB) Josh Hilke
2026-07-10 22:06 ` [PATCH v4 1/9] vfio: selftests: igb: Add driver for IGB QEMU device Josh Hilke
2026-07-10 22:19   ` sashiko-bot
2026-07-10 22:06 ` [PATCH v4 2/9] vfio: selftests: igb: Use PHY internal loopback on 82576 Josh Hilke
2026-07-10 22:06 ` [PATCH v4 3/9] vfio: selftests: igb: Use advanced TX and RX descriptors Josh Hilke
2026-07-10 22:06 ` [PATCH v4 4/9] vfio: selftests: igb: Program MSI-X interrupt routing Josh Hilke
2026-07-10 22:23   ` sashiko-bot
2026-07-10 22:06 ` [PATCH v4 5/9] vfio: selftests: igb: Extend memcpy completion timeout for line-rate hardware Josh Hilke
2026-07-10 22:24   ` sashiko-bot
2026-07-10 22:06 ` [PATCH v4 6/9] vfio: selftests: igb: Disable PCIe completion timeout retries Josh Hilke
2026-07-10 22:06 ` [PATCH v4 7/9] vfio: selftests: Add helpers to re-enable interrupts Josh Hilke
2026-07-10 22:06 ` [PATCH v4 8/9] vfio: selftests: igb: Factor hardware programming into igb_hw_init() Josh Hilke
2026-07-10 22:06 ` [PATCH v4 9/9] vfio: selftests: igb: Recover after DMA-read faults Josh Hilke
2026-07-10 22:33   ` 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=20260710223343.65ADF1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=jrhilke@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@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