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

Re: [PATCH] xen/pciback: don't call pcistub_device_put() under lock


  • To: Juergen Gross <jgross@xxxxxxxx>
  • From: Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>
  • Date: Tue, 28 Mar 2023 11:46:32 +0000
  • Accept-language: en-US, ru-RU
  • 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=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=9qKmWnoj5vjmFJbWqFY4zt+zKe2uqHMERXn07Z1eAvs=; b=PV9KRydVahk+ZsVlWkMEm5+wnDVDq3Hf3y9FGIwX9AwLpJO/1uVs/BNrHB8RSPIfdUmWiM67LL839vOlvbJYZUFhTQZWboptr/t3oDYCD44LskNu65uD+jhWjCRNln33DB6VJ93vBOJMqfEd2Q5W4lb/69ku7zpOQqbjIJYA0jb7hdUpT4WXgJYpX+8JczyC4/mO69mT88dRzIMFGCSxiNfWdxbsJDmFmrOSYvOx03/PSSMWNo/yfcQUt6Y+yuDRMWHmY7+qSPIcsTMz4BB5jJH7Zpq9K7qESpJ6CyR6KZOpzDCX4phbaSoEXBnYuF46SfZBMuCX4hu+dA7/EA5BWA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dw9PFsM7vQQEwen/WkQxITSoW6pjNMrDAtp6taiFJhodiAyIsvMG0A0I43245SltYDI2jU8o4VmVjanxBhcdxvHBO4Qy2CEvCPvZ86vBfcTmy40sQUQRyivjYWt6/bIRFkULCUosmK4VnID0Oqs+ocfJndJ4cpXh1UNagt4EXnopqlej40h/V2xRPq1fQPG7vOPHR1d+zlcg7QulrS28nDvU3W/JggAdw/xUN2X2as1Lq5JWVv6PfgVqo5F0OeEYw4+1zX6K7dXS39bbMnmVdhQUopfsKXoBFDDcwBZlLv0EFl29dMwgbe5fBOunOdXncyhk0hPitNwphA24VlAkCA==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Dan Carpenter <error27@xxxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 28 Mar 2023 11:47:03 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHZYVG3Th/ejZHSZUelfLFc3pO1U68QEzcA
  • Thread-topic: [PATCH] xen/pciback: don't call pcistub_device_put() under lock


On 28.03.23 11:45, Juergen Gross wrote:

Hello Juergen

> pcistub_device_put() shouldn't be called under spinlock, as it can
> sleep.
> 
> For this reason pcistub_device_get_pci_dev() needs to be modified:
> instead of always calling pcistub_device_get() just do the call of
> pcistub_device_get() only if it is really needed. This removes the
> need to call pcistub_device_put().
> 
> Reported-by: Dan Carpenter <error27@xxxxxxxxx>
> Link: 
> https://urldefense.com/v3/__https://lore.kernel.org/lkml/Y*JUIl64UDmdkboh@kadam/__;Kw!!GF_29dbcQIUBPA!wO4HR1jCrDMOfB1Ih2qEZs2jnqcieZUZnc6cPwh7Ta8hiLRKwS1Gs-1tmQP-NuEYoz9LhYWI8aFazIwIa8Lh$
>  [lore[.]kernel[.]org]
> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>


Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>

> ---
>   drivers/xen/xen-pciback/pci_stub.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/xen/xen-pciback/pci_stub.c 
> b/drivers/xen/xen-pciback/pci_stub.c
> index bba527620507..e34b623e4b41 100644
> --- a/drivers/xen/xen-pciback/pci_stub.c
> +++ b/drivers/xen/xen-pciback/pci_stub.c
> @@ -194,8 +194,6 @@ static struct pci_dev *pcistub_device_get_pci_dev(struct 
> xen_pcibk_device *pdev,
>       struct pci_dev *pci_dev = NULL;
>       unsigned long flags;
>   
> -     pcistub_device_get(psdev);
> -
>       spin_lock_irqsave(&psdev->lock, flags);
>       if (!psdev->pdev) {
>               psdev->pdev = pdev;
> @@ -203,8 +201,8 @@ static struct pci_dev *pcistub_device_get_pci_dev(struct 
> xen_pcibk_device *pdev,
>       }
>       spin_unlock_irqrestore(&psdev->lock, flags);
>   
> -     if (!pci_dev)
> -             pcistub_device_put(psdev);
> +     if (pci_dev)
> +             pcistub_device_get(psdev);
>   
>       return pci_dev;
>   }

 


Rackspace

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