<div dir="ltr"><p dir="ltr"><br>
On May 20, 2016 12:36 AM, "Laine Stump" <<a href="mailto:laine@laine.org" target="_blank">laine@laine.org</a>> wrote:<br>
><br>
> On 05/19/2016 02:46 PM, Shivaprasad bhat wrote:<br>
>><br>
>><br>
>><br>
>> On Fri, May 20, 2016 at 12:05 AM, Laine Stump <<a href="mailto:laine@laine.org" target="_blank">laine@laine.org</a>> wrote:<br>
>>><br>
>>> On 05/18/2016 05:35 PM, Shivaprasad G Bhat wrote:<br>
>>>><br>
>>>> The hostdevices are the only devices which have dependencies<br>
>>>> outside of themselves such that, other functions of the PCI<br>
>>>> card should also have been detached from host driver before<br>
>>>> attempting the hotplug.<br>
>>><br>
>>><br>
>>> Are you saying that all the functions on a host device must be detached from their host driver, even if you're only assigning one or another of them to the guest?<br>
>>><br>
>> Yes. All devices from same iommu group should be detached from the host.<br>
><br>
><br>
> Ah right, I forgot about that. But that is something we already don't deal with (currently you can assign a single device from an iommu group with many devices, but managed='yes' won't work for it. That would require some other sort of managed mode, like "managed='group'" or something, but more elaborate managed modes have already been NACKed on the list (I posted an RFC patch for "managed='detach'" at the request of someone else - it would detach the device from the host driver before assignment, but not reattach it afterwards. This was deemed inappropriate and unnecessary.)<br>
><br>
> You may wonder why we don't want to automatically detach all the other devices without any clue to do so in the config - it's because you can't expect the user to know which devices are in the same iommu group as the one you want to assign, and you don't want to just automatically/silent detach one that is essential for continued operation of the host.<br>
><br>
> So we really should only detach those devices that are going to be assigned to the guest.<br>
><br>
><br>
>> Here, I hope the Card is independent. Otherwise, many cards can also<br>
>> belong to same iommu group. In such case, manual the nodedev-detach for other card functions is necessary.<br>
>>  <br>
>>>><br>
>>>><br>
>>>> This patch moves the detach to the beginning of the hotplug<br>
>>>> so that the following patch can detach all funtions first before<br>
>>>> attempting to hotplug any.<br>
>>>><br>
>>>> We need not move the detach for net devices using SRIOV as<br>
>>>> all SRIOV devices are single function devices.<br>
>>><br>
>>><br>
>>><br>
>>> I'm not sure why that makes any difference. In any case, you should detach all the devices that are going to be assigned, then assign them all, with the one going to function 0 being last.<br>
>><br>
>><br>
>> There will be only function zero. So I felt its not necessary. Are you saying different SRIOV functions(all with function zero) be hotplugged as<br>
>> different functions of single card in guest ? In that case, we would need to do that.<br>
><br>
><br>
> I couldn't parse your question, but I wasn't talking about SRIOV in particular, just saying that the way multifunction device assignment is done in qemu is to assign all the non-0 functions, then assign function 0. But that was just an incidental part of the conversation. The important part is that you first detach from the host all devices to be assigned, then you assign them all.</p><p dir="ltr">The SRIOV devices are single function and they dont have the dependency of "other" function to be detached before the device_add. So, they can be detached in <span style="font-size:12.7272720336914px">qemuDomainAttachNetDevice</span><span style="font-size:12.7272720336914px">() itself.</span><br></p><p><span style="font-size:12.7272720336914px">The case I am talking about is, should we be supporting the devices belonging to different iommu groups be hotplugged as a singled card into guest? Say 5 SRIOV functions hotplugged as a single Card. I am not sure we should allow that. Unlike I mentioned, in such case too we can detach in </span><span style="font-size:12.7272720336914px">qemuDomainAttachNetDevice</span><span style="font-size:12.7272720336914px">() itself and expect it to work.</span></p><p dir="ltr">><br>
</p>
</div>