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

Re: [PATCH v5 03/14] vpci: move lock outside of struct vpci


  • To: Oleksandr Andrushchenko <andr2000@xxxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 11 Jan 2022 16:17:16 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=FcV0lNMIFRVE2hKB1xAYqlr4g5G/7DISIT66BBWMIUA=; b=J8MtZrfZgjqU16tCLnS2Cjc3B+ixyPIz/Mve26olwwyYDNk4rhK+Jus6VWsYWBWcdtM/7+Hm8YrP4wm0LwFe+kdPbun0TQxuMXGJSXFT23ID8eNFImKlNL8XAXNi75ib3UoD0xZzJKaLWtMWWaTAbgYztQASfDbjGCM3/IiJyupOQWnz1h9g7PGoMdhS3haLeW78Bes1yfNfpPPm740Q4+3k82dc/JYMA6UGj7CfeQfhDeYcvkq3QZriOQzDGQEGIVxwG5ffOUhbiK9azBuyrdb5OiM1l8Qcnnb2xRqsVjrEYgHA9a/dl2LSIV19EHUzyxNq7zV7xWrTcxg0Fn1SwA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b5K35ZTvy9Bba30cg6PhodR2ERrpdnzXgilw7YkpERPvTjl1EqnBGTlk40YRmnQTrZ5Zbz89PTLH5cBp7kab3J9/cRfaSgZmJ9kusrwJ4JIujvvFOcSWavwMXCuJB/V9Ak6WsH7pyyR6F3rjaj0K3AFqWEGvRrmWTY3i5FOspvxN0ssG5aTk1jYNNXFdeQ2XNeUifi8vnnHmeL8BstgARl5uSAH1f3Uk/NxHhImru93yCr5dX9c/NnPWROUjHNYVXyk+nvTlan4hkz8iNOXkLl5v2VU8jPvG4lCxTG868q+WTjyaVgtUoaefSRXePNK0hf46wabP01tVdbGK0x5kaQ==
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <julien@xxxxxxx>, <sstabellini@xxxxxxxxxx>, <oleksandr_tyshchenko@xxxxxxxx>, <volodymyr_babchuk@xxxxxxxx>, <Artem_Mygaiev@xxxxxxxx>, <jbeulich@xxxxxxxx>, <andrew.cooper3@xxxxxxxxxx>, <george.dunlap@xxxxxxxxxx>, <paul@xxxxxxx>, <bertrand.marquis@xxxxxxx>, <rahul.singh@xxxxxxx>, Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>, Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
  • Delivery-date: Tue, 11 Jan 2022 15:17:42 +0000
  • Ironport-data: A9a23:nDI5hKk/6qCv8orHTTaIwGvo5gxBIERdPkR7XQ2eYbSJt1+Wr1Gzt xJKD2/Qaa7eZzH8Ldsna4y/8xhXv5Ddy4dgTQI/pXswRSMWpZLJC+rCIxarNUt+DCFioGGLT Sk6QoOdRCzhZiaE/n9BClVlxJVF/fngqoDUUYYoAQgsA180IMsdoUg7wbRh29cx2YLR7z6l4 rseneWOYDdJ5BYsWo4kw/rrRMRH5amaVJsw5zTSVNgT1LPsvyB94KE3fMldG0DQUIhMdtNWc s6YpF2PEsE1yD92Yj+tuu6TnkTn2dc+NyDW4pZdc/DKbhSvOkXee0v0XRYRQR4/ttmHozx+4 IRxsLW6dTcsBbDBnfU+Dx9SHXF+B6ITrdcrIVDn2SCS50jPcn+qyPRyFkAme4Yf/46bA0kXq 6ZecmpUKEne2aTmm9pXScE17ignBNPsM44F/Glp0BnSDOo8QICFSKLPjTNd9Glp2Z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PqJ9vCZkfw3K5rh8Jbf yygZCDWqaVhnH5/fdiZgfEfIoVqBRTnyTtksTejU8BwWwm/2nCTK4oAgHbVFSAB2uPsJUaHyba dzjk0iF59fDnMUxIFDYEYJG8vhYYCkCikhKsu6Gx3tUGilGE9+JndBDTOXIedzuocmJKpLAcAJ 8ckczquDIYDylcu0l56aLTw0itn+b7fPSFTIuN5oAjGQrlOAzw+RqEuMI/tx92mTZES80W9oSE 0DJobKFvEXiDZsDgjZj2/Zz9
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu, Nov 25, 2021 at 01:02:40PM +0200, Oleksandr Andrushchenko wrote:
> diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
> index 657697fe3406..ceaac4516ff8 100644
> --- a/xen/drivers/vpci/vpci.c
> +++ b/xen/drivers/vpci/vpci.c
> @@ -35,12 +35,10 @@ extern vpci_register_init_t *const __start_vpci_array[];
>  extern vpci_register_init_t *const __end_vpci_array[];
>  #define NUM_VPCI_INIT (__end_vpci_array - __start_vpci_array)
>  
> -void vpci_remove_device(struct pci_dev *pdev)
> +static void vpci_remove_device_handlers_locked(struct pci_dev *pdev)
>  {
> -    if ( !has_vpci(pdev->domain) )
> -        return;
> +    ASSERT(spin_is_locked(&pdev->vpci_lock));
>  
> -    spin_lock(&pdev->vpci->lock);
>      while ( !list_empty(&pdev->vpci->handlers) )
>      {
>          struct vpci_register *r = list_first_entry(&pdev->vpci->handlers,
> @@ -50,15 +48,33 @@ void vpci_remove_device(struct pci_dev *pdev)
>          list_del(&r->node);
>          xfree(r);
>      }
> -    spin_unlock(&pdev->vpci->lock);
> +}
> +
> +void vpci_remove_device_locked(struct pci_dev *pdev)

I think this could be static instead, as it's only used by
vpci_remove_device and vpci_add_handlers which are local to the
file.

Thanks, Roger.



 


Rackspace

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