Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: David Matlack <dmatlack@google.com>
To: Sean Christopherson <seanjc@google.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org,
	Alex Williamson <alex@shazbot.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Shuah Khan <shuah@kernel.org>
Subject: Re: [PATCH 3/3] KVM: selftests: Use VFIO selftests library to pick IOMMU mode in IRQ test
Date: Mon, 2 Nov 2026 18:59:55 +0000	[thread overview]
Message-ID: <aujdq2fsyt_xRGGV@google.com> (raw)
In-Reply-To: <auit0kVkAaWcNUvk@google.com>

On 2026-11-02 07:35 AM, Sean Christopherson wrote:
> On Mon, Nov 02, 2026, Sean Christopherson wrote:
> > On Thu, Oct 29, 2026, David Matlack wrote:
> > >  static void help(const char *name)
> > >  {
> > >  	printf("Usage: %s [-a] [-d <segment:bus:device.function>] [-e] [-h] [-i nr_irqs] [-m] [-n] [-t iommu_type] [-v nr_vcpus] [-x]\n", name);
> > > @@ -266,8 +250,7 @@ int main(int argc, char **argv)
> > >  	}
> > >  
> > >  	if (device_bdf) {
> > > -		if (!iommu_type)
> > > -			iommu_type = probe_iommu_type();
> > > +		TEST_REQUIRE(iommu_mode_is_available(iommu_type));
> > 
> > This is very unhelpful when neither IOMMUFD nor VFIO is available, especially
> > why the user doesn't explicitly provide the desired mode:
> > 
> >   # ./irq_test -d 0000:6f:01.0 -i 10000
> >   Random seed: 0x79d386bd
> >   1..0 # SKIP - Requirement not met: iommu_mode_is_available(iommu_type)

Agreed, that is not very helpful. I've added a
iommu_mode_unavailable_msg() helper to libvfio, which returns the reason
a given mode (or any mode, if NULL) is not available. So irq_test would
have:

    __TEST_REQUIRE(iommu_mode_is_available(iommu_type), "%s",
               iommu_mode_unavailable_msg(iommu_type));

which gives:

  # ./irq_test -d 0000:01:00.0 -t iommufd
  1..0 # SKIP - IOMMU mode 'iommufd' is not available
  # ./irq_test -d 0000:01:00.0
  1..0 # SKIP - No IOMMU mode is available. Is VFIO (or IOMMUFD) loaded and enabled?

> Side topic, it would be nice if iommu_mode_lookup() printed out the known modes
> when this is hit:
> 
> 	VFIO_FAIL("Unrecognized IOMMU mode: %s\n", iommu_mode);

Will do in v2. And I will also use the same helper to print out the list
of known modes in irq_test -h.

      reply	other threads:[~2026-11-02 19:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 22:17 [PATCH 0/3] vfio: selftests: Automatically detect the IOMMU mode David Matlack
2026-10-29 22:17 ` [PATCH 1/3] vfio: selftests: Automatically detect the IOMMU mode in iommu_init() David Matlack
2026-10-29 22:17 ` [PATCH 2/3] vfio: selftests: Skip tests when the IOMMU mode is not available David Matlack
2026-10-29 22:17 ` [PATCH 3/3] KVM: selftests: Use VFIO selftests library to pick IOMMU mode in IRQ test David Matlack
2026-11-02 15:09   ` Sean Christopherson
2026-11-02 15:35     ` Sean Christopherson
2026-11-02 18:59       ` David Matlack [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=aujdq2fsyt_xRGGV@google.com \
    --to=dmatlack@google.com \
    --cc=alex@shazbot.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=shuah@kernel.org \
    /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