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

Re: [libvirt] Fwd: In Use tracker for network and pci-passthrough devices: Laine response



On 06/28/2012 11:33 AM, Shradha Shah wrote:
> This is a reply I got from Laine Stump
> =====================================================================================================================
> 
> (NB: I'm Cc'ing Osier on this email, as he's quite knowledgeable about
> the PCI passthrough device allocation tracking code. You should probably
> move this discussion to the mailing list sooner rather than later
> though, as a public discussion of the design will give you a better
> chance of your first revision getting successfully past review :-))
> 
> On 06/26/2012 07:23 AM, Shradha Shah wrote:
>>> Laine,
>>>
>>> I have submitted my v2 patches for forward mode='hostdev' and am planning to work on the in-use tracker for network
>>> and pci-passthrough devices.
>>>
>>> I am unable to wrap my head around how I should be implementing this functionality. I am unable to decide at what 
>>> level I should be implementing this (network, domain or qemu).
>>>
>>> May I ask for your guidance in order to implement this functionality? 
>>>
> Yes, but I'm currently on vacation (in Turkey) so I won't have much time
> to respond until July 9 when I return.
> 
> In the meantime, I think the right way to do this is by integrating with
> the code in the qemu driver that keeps track of which PCI devices are in
> use. This already happens at the very basic level of "if the device
> allocated by the network driver is in use, the attempt to assign the
> device will fail"; instead, the network driver should be able to ask
> qemu if the device it wants to allocate to the guest is already in use
> (and reserve it, in one atomic operation).
> 
> Of course, once the network driver has reserved the device from qemu's
> PCI passthrough code, it would return that device to the qemu driver
> code that wants to attach the interface, and it would fail because it
> would be told the device is already in use (well, yeah! *We* just marked
> it as in-use!). To make that work, I guess some sort of
> cookie/handle/pointer would need to be passed from qemu's pci
> passthrough code back to the network driver, and the network driver
> would return it back to qemu's network interface attach code, which
> would then use that special cookie/handle/pointer to attach the device
> (saying "yeah, I know it's already in use, and here's my pass-card").

Wouldn't this approach require network driver to call functions from the
qemu driver?
I think this is not good for the hierarchical structure we are trying to 
maintain. 

> 
> (Talking about this makes me think that the code that keeps track of PCI
> device allocation shouldn't really be a part of qemu, but should be a
> separate module, so that the network driver can still function properly
> even if the qemu driver isn't loaded.)

Would this mean moving code to a new driver called device_driver.c or
devicetracker_driver.c (which consumes device_conf.ch) and is called by 
network, domain and qemu drivers?

If so, I like this approach.

> 
> Another twist to this that should be considered - if any particular
> device is in use by at least one guest for one of the macvtap modes,
> that device also needs to be marked as in-use in libvirt's pci device
> table - it would be disastrous if another guest decided to use that
> device for standard PCI Passthrough.

Agreed.

> 
> (Keep in mind that I wrote everything above without even once looking at
> the code or any other reference, so you should take it with a grain of
> salt!)
> 
> 
> 
> Many Thanks,
> Regards,
> Shradha Shah
> 
> On 06/28/2012 11:19 AM, Shradha Shah wrote:
>> This is a conversation that I started with Laine Stump for the implementation of the in-use tracker for network and pci devices.
>>
>> I want to make this conversation more public in order to receive everyone's view on the topic.
>>
>> I will also post the responses I got from Laine and Osier Yang.
>>
>> Many Thanks,
>> Regards,
>> Shradha Shah
>>
>>
>> -------- Original Message --------
>> Subject: In Use tracker for network and pci-passthrough devices
>> Date: Tue, 26 Jun 2012 12:23:52 +0100
>> From: Shradha Shah <sshah solarflare com>
>> To: Laine Stump <laine laine org>
>>
>> Laine,
>>
>> I have submitted my v2 patches for forward mode='hostdev' and am planning to work on the in-use tracker for network
>> and pci-passthrough devices.
>>
>> I am unable to wrap my head around how I should be implementing this functionality. I am unable to decide at what 
>> level I should be implementing this (network, domain or qemu).
>>
>> May I ask for your guidance in order to implement this functionality? 
>>
> 
> --
> libvir-list mailing list
> libvir-list redhat com
> https://www.redhat.com/mailman/listinfo/libvir-list


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