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

Re: [PATCH v4 4/5] vpci: add SR-IOV support for PVH Dom0


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Mykyta Poturai <Mykyta_Poturai@xxxxxxxx>
  • Date: Fri, 6 Nov 2026 08:28:06 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uYwFRbSfknF0MGvs/x8hjTYIixhyIk2vqIBdL/UrpZQ=; b=rYdnp4KRBq6PN1WkilXslDRWOUMAZ8gaaLvGpSukWQnn2yMeu/cQLqHGMz7LzSiFwLCzBPz8lPHlhDWFPBRvD8NPix89tSvtk5Qfxh+IukgbbzxuAWhlRqmd1DqIWte4EsgiC0/svlnjOGBAZJQuevZfTA/1t3j0xMK9KLemailJdOuB2LCYpsGud2fJHXCCwJ9tvixRr2b6CgPpG9DsdGacj4y9Zk3BMAoEPyybkfkxXMcSqDA0FIeYBZBgI3tLpTy0MOWDKGZ52Fspdd7JDOw1/vIbyaC1KnxIridEjp0DTTuojIzkhgb7lW4VEdHcPOxZ8Y6c65qdCAJn7UlBGQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IpQa5urMt4DhU3qZyaom3Jf39oMiDPY8rt3SYqRM7NjWQeY+aXmW11PJpa+i3tNWGAb3gIhmkcTKOBSler3IUu/Owc4ZPbiEb9CcRGAV0KQ+hKrs62Yvzt5S4vm0BX1EvHwDnJXHmcw/B0gGnU4IhD5vqxByja8ITKP7z6qY3gKjixkBo7gmE8Q3jUxLav9cHx2GOUFzhjOz0r+sz5Tc+RLlk/PxqhGK3Eu7nW9X9THcN3KmV0my1hp9z4wzPwidIL9Aq+7yD/smwy2uotW+iryV/NYKD5q/tx8isvwmJ9p5g4WVU2KkYE2fXaiLS3Sj7H6d3gwYKx5uZUdPS/gqag==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
  • Authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, Community Manager <community.manager@xxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 06 Nov 2026 08:28:17 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHdXK6sWnTwG0FjdEmPa5OC537fErcTDN4AgA3LQAA=
  • Thread-topic: [PATCH v4 4/5] vpci: add SR-IOV support for PVH Dom0

On 10/28/26 3:49 PM, Jan Beulich wrote:
> On 15.10.2026 16:08, Mykyta Poturai wrote:

 >> --- a/xen/drivers/vpci/Makefile
 >> +++ b/xen/drivers/vpci/Makefile
 >> @@ -1,3 +1,4 @@
 >>  obj-y += cap.o
 >> +obj-y += sriov.o
 >>  obj-y += vpci.o header.o rebar.o
 >>  obj-$(CONFIG_HAS_PCI_MSI) += msi.o msix.o
 >
 > When I added cap.o on a separate line, the intention was that new files would
 > follow suite, including the respecting of sorting. Imo sriov.o wants to go
 > after msi{,x}.o. Seeing how the latter are conditionally included - wouldn't
 > SR-IOV also want to have a HAS_SRIOV control?

I will fix the sorting, but I think guarding every PCI cap under a config 
option seems 
like an overkill to me. MSI/X being an exception because it depends heavily on 
platform 
support (having a working ITS on Arm at least).

>> +    ASSERT(rw_is_locked(&d->pci_lock));
>> +
>> +    for_each_pdev ( d, pdev )
>> +    {
>> +        const struct vpci_sriov *sriov = pdev->vpci ? pdev->vpci->sriov : 
>> NULL;
>> +        unsigned int i;
>> +
>> +        if ( !sriov || !sriov->vfs_ready || NOW() < sriov->vfs_ready )
>> +            continue;
>> +
>> +        for ( i = 0; i < sriov->num_vfs; i++ )
>> +            if ( vf_sbdf(pdev, i).sbdf == sbdf.sbdf )
>> +                return pdev;
>> +    }
> 
> This loop can easily have hundreds of iterations, when the number of SR-IOV
> PFs in a system is likely relatively small. I wonder whether there shouldn't
> be a separate list of "PDEVs with VFs under construction".
> 

It can take a decent number of iterations, but it only runs when there is  a VF
still waiting to be added, so it is once per VF Enable and never on a normal
vPCI access. And even a few hundred iterations of a loop like this is nothing
next to the pci_add_device() that same access performs. I don't see a reason to
introduce the complexity of another list for that.

>> +static int cf_check init_sriov(struct pci_dev *pdev)
>> +{
>> +    unsigned int pos;
>> +
>> +    if ( pdev->info.is_virtfn )
>> +        return -EINVAL;
> 
> Can this happen? I.e. doesn't this want to be an assertion, much like ...
> 
>> +    pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_SRIOV);
>> +
>> +    ASSERT(pos);
> 
> ... this one?
> 

I think it is better to leave it to have some protection for malicious/faulty
devices that have VFs report SR-IOV caps themselves. Not sure if such devices
exist but still the check costs nothing.

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.