Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Josh Hilke <jrhilke@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 David Matlack <dmatlack@google.com>,
	Alex Williamson <alex@shazbot.org>
Subject: Re: [PATCH v4 02/19] KVM: selftests: Add /proc/interrupts parsing helpers for IRQ test
Date: Mon, 1 Jun 2026 12:19:19 -0700	[thread overview]
Message-ID: <ah3bN2G7fsaI4zN1@google.com> (raw)
In-Reply-To: <20260530002134.558837-3-jrhilke@google.com>

On Sat, May 30, 2026, Josh Hilke wrote:
> index 000000000000..7c465e8584e2
> --- /dev/null
> +++ b/tools/testing/selftests/kvm/include/proc_util.h
> @@ -0,0 +1,9 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +#ifndef SELFTEST_KVM_PROC_UTIL_H
> +#define SELFTEST_KVM_PROC_UTIL_H
> +
> +#include <stdint.h>
> +
> +int get_proc_vfio_irq_number(const char *vfio_device_bdf, int msi);

I feel like the "proc" is confusing and unintesting.  How the utility gets the
information is an implementation detail that I don't think the caller particular
cares about.

"irq_number" is also vague.  There are myriad IRQ "numbers" in play.  "virtual
IRQ", as they're sometimes described by the IRQ subsystem, is unfortunately
terrible terminology for KVM+VFIO.  host_irq and linux_irq are the two names I
can think of that are fairly specific without too much potential for confusion.
I'd probably vote for host_irq?

I also think the function needs to have msix in the name, because within VFIO,
there are multiple flavors of interrupts that can be wired up, and this _only_
works for MSI-X.  And The param should be @msix.

I also think it might make sense to return an "unsigned int", to communicate that
it guarantees a valid IRQ was found, but I don't care terribly either way.

Maybe something like this?

  unsigned int vfio_msix_to_host_irq(const char *vfio_device_bdf, int msix)

or

  unsigned int vfio_get_msix_host_irq(const char *vfio_device_bdf, int msix)

or

  unsigned int vfio_get_host_irq_for_msix(const char *vfio_device_bdf, int msix)

I'd probably vote for the first one, vfio_msix_to_host_irq(), as it's more
obviously "just" a translation helper, e.g. isn't allocating an IRQ or anything.

  reply	other threads:[~2026-06-01 19:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-30  0:21 [PATCH v4 00/19] KVM: selftests: Link with VFIO selftests lib Josh Hilke
2026-05-30  0:21 ` [PATCH v4 01/19] KVM: selftests: Build and link selftests/vfio/lib into KVM selftests Josh Hilke
2026-05-30  0:21 ` [PATCH v4 02/19] KVM: selftests: Add /proc/interrupts parsing helpers for IRQ test Josh Hilke
2026-06-01 19:19   ` Sean Christopherson [this message]
2026-05-30  0:21 ` [PATCH v4 03/19] KVM: selftests: Add guest read/write macros Josh Hilke
2026-05-30  0:21 ` [PATCH v4 04/19] KVM: selftests: Rename guest_rng to kvm_rng Josh Hilke
2026-05-30  0:21 ` [PATCH v4 05/19] KVM: selftests: Add helper to generate random u64 in range [min,max] Josh Hilke
2026-05-30  0:21 ` [PATCH v4 06/19] KVM: selftests: Add IRQ injection test Josh Hilke
2026-05-30  0:21 ` [PATCH v4 15/19] KVM: selftests: Add pin_task_to_random_cpu() helper function Josh Hilke
2026-05-30  0:21 ` [PATCH v4 16/19] KVM: selftests: Verify vCPU migration during IRQ delivery in IRQ test Josh Hilke
2026-05-30  0:21 ` [PATCH v4 17/19] KVM: selftests: Print vCPU affinity on timeout during " Josh Hilke
2026-05-30  0:21 ` [PATCH v4 18/19] KVM: selftests: Make number of vCPUs configurable in " Josh Hilke
2026-05-30  0:21 ` [PATCH v4 19/19] KVM: selftests: Add xAPIC support " Josh Hilke
2026-05-30  0:26 ` [PATCH v4 00/19] KVM: selftests: Link with VFIO selftests lib Josh Hilke
2026-06-01 19:07 ` Sean Christopherson
     [not found] ` <20260530002134.558837-15-jrhilke@google.com>
2026-06-01 19:27   ` [PATCH v4 14/19] KVM: selftests: Add kvm_sched_getaffinity() wrapper and convert users Sean Christopherson
     [not found] ` <20260530002134.558837-9-jrhilke@google.com>
2026-06-01 20:02   ` [PATCH v4 08/19] KVM: selftests: Verify interrupts are received when IRQ affinity changes in IRQ test Sean Christopherson

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=ah3bN2G7fsaI4zN1@google.com \
    --to=seanjc@google.com \
    --cc=alex@shazbot.org \
    --cc=dmatlack@google.com \
    --cc=jrhilke@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.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