Re: [PATCH v3 06/16] KVM: selftests: Add IRQ injection test
From: Josh Hilke
Date: Thu May 28 2026 - 19:02:41 EST
On Tue, May 26, 2026 at 7:10 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
>
> On Tue, Apr 21, 2026, Josh Hilke wrote:
> > + for (i = 0; i < nr_irqs; i++) {
> > + struct kvm_vcpu *vcpu = vcpus[i % nr_vcpus];
> > + struct timespec start;
> > +
> > + kvm_route_msi(vm, gsi, vcpu, vector);
> > +
> > + for (j = 0; j < nr_vcpus; j++)
> > + TEST_ASSERT(
>
> Thou hast committed the cardinal sin of leaking the demonic influence of Google3
> into the kernel.
>
> Never, ever wrap immediately after the opening '('.
I'll grab my rosary beads to pay penance (and fix this in v4).
> > + !SYNC_FROM_GUEST_AND_READ(vm, guest_received_irq[vcpus[j]->id]),
>
> Hmm, give how many times this shows up, maybe add a wrapper macro?
>
> #define GUEST_RECEIVED_IRQ(__vcpu) \
> SYNC_FROM_GUEST_AND_READ((__vcpu)->vm, guest_received_irq[(__vcpu)->id])
>
> Then this becomes:
>
> TEST_ASSERT(GUEST_RECEIVED_IRQ(vcpus[j]),
> "Blah blah blah");
>
> > + "IRQ flag for vCPU %d not clear prior to test",
> > + vcpus[j]->id);
> > +
> > + /* Trigger interrupt */
> > + eventfd_write(eventfd, 1);
> > +
> > + clock_gettime(CLOCK_MONOTONIC, &start);
> > + for (;;) {
> > + if (SYNC_FROM_GUEST_AND_READ(vm, guest_received_irq[vcpu->id]))
> > + break;
> > +
> > + if (timespec_to_ns(timespec_elapsed(start)) > timeout_ns)
> > + TEST_FAIL(
> > + "vCPU %d timed out waiting for IRQ from GSI %d (Vector 0x%x) !\n",
>
> Best get to reading Dante's Inferno.
Which circle am I going to? Need to know whether to bring a parka or
one of those mist fans people use at the beach to stay cool.