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

Re: [PATCH v9 04/16] vpci: add hooks for PCI device assign/de-assign


  • To: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 13 Sep 2023 07:58:01 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=h3XRPmyR/rYeCPkUbHbM6Ne0NiE7p8QqzvML3QMDIx8=; b=NL4fzdaIEP3fEQWVHEivPV7r6h+EQyYryA2fYrGB6aRYh0xl7vbscT6V8PAVpJeXU2gAl11S+Z2qd2QyZ5if4tu9B3tu/sDav03vyITN2vIGypqy7pNfCYHlssKsU3iGHzXgoj7VDiw8k0dW3Siwj21yOBkgkWGIyoEpJuWXxKFVRThuYr0g/XsOZEnLfPLG0ROFfqNveq0vhjRIYqy4vHSrb12iJi4cHV2VREBVywR0uQ7VVQwFZAr6MEqETM2Krc7eFDjrMyrxLOx/HRV0EKzo/OyC0RTTQl9ZQtJjuIVjdC5Q1ShzDUOzI9o2CBMqviyWQlhewCR1Mz6C3oWIPA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ogw/rbkbLIL7oVoxarbFERvm6WRF95/0zZcMbY8NXvHLZRaYmaUvPiEzDJAqFQX9AKoTvdkLE2Fqhxt+CSxMHoyeYn6kvS/QQXLwkEDWsKi51BqZfYuQzTPv+FmTb/s5qPgg3RTdvma1dRf19sAbMWt8FEJZPUYufNyeSKHn89UFLKN/pPmbQzyY/LpxA2X3onGSoLmJwTmLM5VakfhRUC2YGKzbt079MQnbbVxSjx+GU0fye8X93xSyB0y7iPF0DmDSoVBz2DovgdRXoiNNaS8l2Ig3cZWaVHpBUtXQa+xVx6NAG0AF1r/9kaTD//prckqGfgBaYfznSgpQ0PQVlQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Paul Durrant <paul@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 13 Sep 2023 05:58:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 13.09.2023 01:41, Volodymyr Babchuk wrote:
> Jan Beulich <jbeulich@xxxxxxxx> writes:
>> On 30.08.2023 01:19, Volodymyr Babchuk wrote:
>>> @@ -1481,6 +1488,13 @@ static int assign_device(struct domain *d, u16 seg, 
>>> u8 bus, u8 devfn, u32 flag)
>>>      if ( pdev->broken && d != hardware_domain && d != dom_io )
>>>          goto done;
>>>  
>>> +    if ( IS_ENABLED(CONFIG_HAS_VPCI_GUEST_SUPPORT) )
>>> +    {
>>> +        write_lock(&pdev->domain->pci_lock);
>>> +        vpci_deassign_device(pdev);
>>> +        write_unlock(&pdev->domain->pci_lock);
>>> +    }
>>
>> Why is the DomIO special case ...
> 
> vpci_deassign_device() does nothing if vPCI was initialized for a
> domain. So it not wrong to call this function even if pdev belongs to dom_io.

Well, okay, but then you acquire a lock just to do nothing (apart
from the apparent asymmetry).

>>> @@ -1506,6 +1520,15 @@ static int assign_device(struct domain *d, u16 seg, 
>>> u8 bus, u8 devfn, u32 flag)
>>>          rc = iommu_call(hd->platform_ops, assign_device, d, devfn,
>>>                          pci_to_dev(pdev), flag);
>>>      }
>>> +    if ( rc )
>>> +        goto done;
>>> +
>>> +    if ( IS_ENABLED(CONFIG_HAS_VPCI_GUEST_SUPPORT) && d != dom_io)
>>> +    {
>>> +        write_lock(&d->pci_lock);
>>> +        rc = vpci_assign_device(pdev);
>>> +        write_unlock(&d->pci_lock);
>>> +    }
>>
>> ... relevant only here?
>>
> 
> There is no sense to initialize vPCI for dom_io.

Of course.

Jan



 


Rackspace

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