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

Re: [PATCH v10 03/17] vpci: use per-domain PCI lock to protect vpci structure


  • To: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Fri, 3 Nov 2023 11:39:23 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=epam.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=GKNexmUa3jn9+hTtdgPh/NPObG01v0Fc/Xv7Cqhhkfk=; b=KuEHzGMO5rqNjDqDDqnHZRc+eGfWHohYvRrC11zIWnTerM6f8+M6mJu7OWG1oXosc9lggSZRRLiExv4mQh/d4NkkloXIkCnfYFXhCITGda3YO/hAbiimivdQ8/u8sAZ+wJ53O07CkN/N+P0/HZUf+ANJPj8LoSpVzq83iKCR61DFm2BXDp0LWMkWHBU33MFVIRPXE3xePiVtnJTAluYVxixurq1/u5d42PRn6N3yTZ+eY9AC2rGa31hu4I89P76B3EGWjrdJXaSD6/i9c4VnaKYz41vDpsjAbcu/U2eUyMg4juLhGcEqWoB9WPbZxaY7OYoRd0mquNhmYq839Gg0FQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hueivS4yX5fMJ4myFGzTAFehGkKaP0HfQ5ZWZ3gXjFYdXADrj09dslHa1FqDiWqjb1NexHCx8uRoLziI97PJZEuuErF+JDJpjQSsmLQwNfWKxq/kqVk9Wo8ycxk0SS+Whn1Vy3R3xrTgBMKnv06VWFuAxqFzZZXMOI7l5jM20I0AhXZLWYZLLYfriVgUJkiLMQA2UPfojgp23DnSGIf1Vunals9CrW+iAKNOag5X7HzmDRcSCzz+ugqc60LuHt53AaeX5zZsiHD5/ywiZyeqPsUgpOYeLUdFrFHdYN8FvCzy6eLVdNLoMSHd7rBBMe+9PAX1QByM/B/FAZt4zIZ+XA==
  • Cc: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Jun Nakajima <jun.nakajima@xxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Paul Durrant <paul@xxxxxxx>
  • Delivery-date: Fri, 03 Nov 2023 15:39:38 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 10/12/23 18:09, Volodymyr Babchuk wrote:
> 6. We are removing multiple ASSERT(pcidevs_locked()) instances because
> they are too strict now: they should be corrected to
> ASSERT(pcidevs_locked() || rw_is_locked(&d->pci_lock)), but problem is
> that mentioned instances does not have access to the domain
> pointer and it is not feasible to pass a domain pointer to a function
> just for debugging purposes.

...

> diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
> index 20275260b3..466725d8ca 100644
> --- a/xen/arch/x86/msi.c
> +++ b/xen/arch/x86/msi.c
> @@ -988,8 +988,6 @@ static int __pci_enable_msi(struct msi_info *msi, struct 
> msi_desc **desc,
>  {
>      struct msi_desc *old_desc;
> 
> -    ASSERT(pcidevs_locked());
> -
>      if ( !pdev )
>          return -ENODEV;

I know it is mentioned in the commit message, so the ASSERT removal above may 
be okay. However, just to mention it: as we are passing pdev to this function 
now, we can access the domain pointer here. So the ASSERT can be turned into 
(after the !pdev check):

    ASSERT(pcidevs_locked() || rw_is_locked(&pdev->domain->pci_lock));

In which case pdev->domain != NULL might also want to be checked.

> 
> @@ -1043,8 +1041,6 @@ static int __pci_enable_msix(struct msi_info *msi, 
> struct msi_desc **desc,
>  {
>      struct msi_desc *old_desc;
> 
> -    ASSERT(pcidevs_locked());
> -
>      if ( !pdev || !pdev->msix )
>          return -ENODEV;

Same here.

> 
> @@ -1154,8 +1150,6 @@ int pci_prepare_msix(u16 seg, u8 bus, u8 devfn, bool 
> off)
>  int pci_enable_msi(struct msi_info *msi, struct msi_desc **desc,
>                    struct pci_dev *pdev)
>  {
> -    ASSERT(pcidevs_locked());
> -
>      if ( !use_msi )
>          return -EPERM;
> 



 


Rackspace

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