Re: [KVM PATCH v4 3/3] kvm: add iosignalfd support

Gregory Haskins
2009-06-01T12:15:00Z

[-- Attachment #1: Type: text/plain, Size: 2129 bytes --]

Avi Kivity wrote:
> Gregory Haskins wrote:
>> This is closer to how the original series worked, but Avi asked for a
>> data-match token and thus the cookie was born. I think the rationale is
>> that we can't predict whether the same eventfd will be registered more
>> than once, and thus we need a way to further qualify it. However, to
>> your point, I cannot think of a valid use case for having the same fd
>> registered to the same address more than once, so perhaps your fd/addr
>> tuple is sufficient and we can drop the cookie (or, really, rename it to
>> "trigger" ;)
>>
>> Avi?
>>
>
> This is just how virtio works. To kick ring N of device X, it writes
> N to a port specific to X.
>
> If we lose N, then we don't know which ring was kicked and have to
> check them all.
>
> May we can rename cookie to data_match to make it explicit. If the
> data doesn't match, the eventfd isn't kicked.
>
> (Mark, same as we have arbitrary ring->MSI mappings (allowing one MSI
> to notify multiple rings), perhaps we should have the same capability
> for the other direction? So the guest could kick mulitple rings with
> one write, or just one ring, according to personal preference.
>
I think we are all on the same page here, actually (more or less). I
think the confusion was my own when you initially asked for a data-match
token, and I gave you "cookie". "cookie" as I implemented it was really
only used to match up the eventfd during de-assign, not the actual
signal event. I think what you are talking about here is the same as
what Mark and I have been calling "trigger". I agree that we need this
interface to be able to properly sort something like virtio, and I will
be including this in the next release.

OTOH, what I was proposing above is that my misguided attempt at
"cookie" for deassign is redundant with simply looking at the
eventfd/addr tuple. We can simply key off of those items to match up
the iosignalfd to close, and therefore lets get rid of the cookie field.

Sorry for the confusion. Let me know if you still think this isn't right.

-Greg

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 266 bytes --]