From: Demi Marie Obenour <demiobenour@gmail.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: "virtio-comment@lists.linux.dev" <virtio-comment@lists.linux.dev>
Subject: Re: virtio-PCI interrupt corner cases
Date: Sun, 5 Apr 2026 16:34:15 -0400 [thread overview]
Message-ID: <a9ccf52a-ffda-48a6-ae30-20e22d65ec35@gmail.com> (raw)
In-Reply-To: <20260405161547-mutt-send-email-mst@kernel.org>
[-- Attachment #1.1.1: Type: text/plain, Size: 2548 bytes --]
On 4/5/26 16:24, Michael S. Tsirkin wrote:
> On Sun, Apr 05, 2026 at 03:35:27PM -0400, Demi Marie Obenour wrote:
>> There are several corner cases in virtio-PCI interrupt handling.
>> I'm trying to figure out what the expected behavior is in these cases,
>> as the spec isn't clear.
>>
>> 1. Suppose virtqueue 0 is mapped to MSI-X vector 5. The device
>> triggers an interrupt on virtqueue 0. Vector 5 is currently masked,
>> so the interrupt becomes pending. The driver then map virtqueue
>> 0 to vector 6 and this succeeds.
>>
>> a. Is there still have an interrupt pending on vector 5?
>
> as per the pci spec, there should not be, as the event source
> are satisfied:
>
>
> If a masked vector has its Pending bit set, and the associated underlying interrupt events are
> somehow satisfied (usually by software though the exact manner is function-specific), the
> function must clear the Pending bit, to avoid sending a spurious interrupt message later
> when software unmasks the vector. However, if a subsequent interrupt event occurs while
> the vector is still masked, the function must again set the Pending bit.
That makes sense, and is thankfully the easiest to implement.
>> b. If vector 6 is unmasked, is an interrupt delivered immediately?
>> c. If vector 6 is masked, does it become pending?
>
>
> I don't think there are any guarantees about vector 6.
In that case I will go with whichever option is easier to implement.
Is this a driver bug, or can a driver check to see if an interrupt
would have been needed in a race-free way?
>> 2. Suppose virtqueue 1 is mapped to MSI-X vector 7. The device
>> triggers an interrupt on virtqueue 1. Vector 7 is currently masked,
>> so the interrupt becomes pending. The driver then maps virtqueue 1
>> to NO_VECTOR.
>>
>> Is there still an interrupt pending on vector 7, or is the interrupt
>> lost?
>
> as per the pci spec, there should not be, as the event source
> is satisfied.
Makes sense. This is also the easiest to implement, thankfully.
>> 3. Suppose both virtqueues 3 and 4 are mapped to MSI-X vector 3.
>> The device triggers interrupts on both virtqueues. Does the driver
>> receive one interrupt or two?
>
> Depends on timing, host architecture etc. spec makes no guarantees.
Is the driver still guaranteed to get at least one interrupt, and
not more than two?
Thank you so much for your time and help.
--
Sincerely,
Demi Marie Obenour (she/her/hers)
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2026-04-05 20:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-05 19:35 virtio-PCI interrupt corner cases Demi Marie Obenour
2026-04-05 20:24 ` Michael S. Tsirkin
2026-04-05 20:34 ` Demi Marie Obenour [this message]
2026-04-05 20:43 ` Michael S. Tsirkin
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=a9ccf52a-ffda-48a6-ae30-20e22d65ec35@gmail.com \
--to=demiobenour@gmail.com \
--cc=mst@redhat.com \
--cc=virtio-comment@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