qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [libvirt] qapi DEVICE_DELETED event issued *before* ins


From: Laine Stump
Subject: Re: [Qemu-devel] [libvirt] qapi DEVICE_DELETED event issued *before* instance_finalize?!
Date: Mon, 5 Sep 2016 21:05:00 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

On 09/05/2016 05:36 AM, Paolo Bonzini wrote:

On 05/09/2016 11:23, Markus Armbruster wrote:
On the other hand, it is clearly documented that the DEVICE_DELETED
event is sent as soon as guest acknowledges completion of device
removal. So libvirt's buggy if we'd follow documentation strictly. But
then again, I don't see much information value in "guest has detached
device but qemu hasn't yet" event. Libvirt would ignore such event.
Unless I'm missing something, libvirt needs an event that signals "Guest
and QEMU are done with this device".  Current DEVICE_DELETED isn't.

Can we imagine a use for current DEVICE_DELETED, i.e. "Guest is done,
but QEMU isn't"?

Would anything break if we changed semantics of DEVICE_DELETED to what
libvirt actually needs?

If the answers are "no" and "no", let's do it.
There is a subtle aspect of this.  After the current DEVICE_DELETED, the
device id is not used any more.  So technically you could have

    device_add bar,id=foo
    device_del foo

    // something in QEMU prevents the device from going away?
    // for example there is a storage issue that blocks completion
    // of a read(), and bar is a storage device

    device_add bar,id=foo
    device_del foo

    // which foo is being deleted?  The old one or the new one?
    event DEVICE_DELETED

DEVICE_DELETED does have a meaning: management cannot talk to the device
anymore in QMP once it is raised.

Technically what libvirt wants to know for VFIO is not whether the
device is gone; it's whether the device's _backend_ (the VFIO file
descriptor) is gone.  The device backend could have been a separate QOM
object, but it isn't.

So perhaps we need a new event that is specific to VFIO?

Sigh.

I always hate adding more knobs...

The original reason libvirt asked for the DEVICE_DELETED event was because there were cases where libvirt was attempting to re-use the device id when it was still in use by qemu, so attempts to attach new devices were failing. When it was provided we just assumed that "DEVICE_DELETED" meant "everybody is finished with this device, and it's safe to recycle all the resources now". I guess we generalized just a bit too much.

From libvirt's point of view, I don't see any problem with widening the definition of the existing DEVICE_DELETED event. But if that doesn't make sense from QEMU's point of view, or if anyone can come up with a practical reason for wanting both events, we can of course modify our event handling accordingly (the simplest way would be to just ignore DEVICE_DELETED in the case of vfio devices, and wait for the new event to trigger both freeing of the device ID and re-attaching the device to its host driver; trying to release the device ID in response to DEVICE_DELETED, and then re-attach the device to the host driver in response to a separate event would just be adding an extra layer of waiting for no perceptible gain).

Oh, or are you saying that for vfio devices it would have this new new event *instead of* DEVICE_DELETED for vfio devices? I don't really see the point of that...


Thanks,

Paolo

--
libvir-list mailing list
address@hidden
https://www.redhat.com/mailman/listinfo/libvir-list





reply via email to

[Prev in Thread] Current Thread [Next in Thread]