Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: David Matlack <dmatlack@google.com>
To: Alex Williamson <alex.williamson@nvidia.com>
Cc: Alex Williamson <alex@shazbot.org>, kvm <kvm@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Jason Gunthorpe <jgg@ziepe.ca>, Kevin Tian <kevin.tian@intel.com>,
	Yi Liu <yi.l.liu@intel.com>
Subject: Re: [PATCH 2/4] selftests/vfio: Wait out transient -EBUSY on open/bind
Date: Wed, 9 Sep 2026 21:40:53 +0000	[thread overview]
Message-ID: <aqHSZY2IhWfK-jhl@google.com> (raw)
In-Reply-To: <20260901215358.2421359-3-alex.williamson@nvidia.com>

On 2026-09-01 03:53 PM, Alex Williamson wrote:
> If a test is killed, for example due to timeout, fput can be delayed,
> allowing the subsequent test to be started while the failing test still
> holds the device open count elevated.  This results in a cascade of
> failures as each subsequent test fails on open, blocked by the single
> user requirement at the group or device cdev file.
> 
> We can make the test framework more robust, and allow better
> identification of specific failing scenarios, by waiting-out transient
> -EBUSY failures on group open and cdev bind.
> 
> The 20s retry window is heuristically determined in testing on a system
> where scheduling can be significantly delayed due to SMI handling of
> platform errors generated from the mix-and-match test.
> 
> The SR-IOV uAPI and IOMMUFD setup tests retain their non-retry bind
> paths as these are not expected to encounter process kills due to
> underlying platform error handling variability.
> 
> Assisted-by: Qwen3.8-27B
> Signed-off-by: Alex Williamson <alex.williamson@nvidia.com>

I think we should fix this in kselftest_harness.h instead.

If the poll() times out the harness issues SIGKILL but then does not
wait for the process to finish exiting (waitpid(..., WNOHANG). If we
drop WNOHANG then the harness will wait for the killed process to exit
before proceeding with the next test case.

diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
index 1e459619fe86..150bd690ca7b 100644
--- a/tools/testing/selftests/kselftest_harness.h
+++ b/tools/testing/selftests/kselftest_harness.h
@@ -1008,7 +1008,7 @@ static void __wait_for_test(struct __test_metadata *t)
         /* signal process group */
         kill(-(t->pid), SIGKILL);
     }
-    child = waitpid(t->pid, &status, WNOHANG);
+    child = waitpid(t->pid, &status, 0);
     if (child == -1 && errno != EINTR) {
         t->exit_code = KSFT_FAIL;
         fprintf(TH_LOG_STREAM,


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

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01 21:53 [PATCH 0/4] vfio: Fix cdev second-open and harden selftests Alex Williamson
2026-09-01 21:53 ` [PATCH 1/4] vfio: Reject a second cdev open before mutating shared device state Alex Williamson
2026-09-09 22:27   ` David Matlack
2026-09-10 13:51   ` Jason Gunthorpe
2026-09-01 21:53 ` [PATCH 2/4] selftests/vfio: Wait out transient -EBUSY on open/bind Alex Williamson
2026-09-09 21:40   ` David Matlack [this message]
2026-09-10 22:50     ` Alex Williamson
2026-09-01 21:53 ` [PATCH 3/4] selftests/vfio: Extend mix_and_match timeout to 90s Alex Williamson
2026-09-09 21:42   ` David Matlack
2026-09-01 21:53 ` [PATCH 4/4] selftests/vfio: Extend timeout for runner executions Alex Williamson
2026-09-09 21:51   ` David Matlack

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=aqHSZY2IhWfK-jhl@google.com \
    --to=dmatlack@google.com \
    --cc=alex.williamson@nvidia.com \
    --cc=alex@shazbot.org \
    --cc=jgg@ziepe.ca \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yi.l.liu@intel.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