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

Re: [RFC PATCH 00/10] Rework PCI locking


  • To: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 6 Sep 2022 12:32:22 +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=2Ux+tUw5q0jp5KZY1D27e/BBjcFYHXCAZ+7fbJZGQ2A=; b=MV9BzyGvocQG4Txxq05kJgfZ6qDoOxmSXnrhDtM0lmskwYHsQZ9q2raG7nqkUIGPQK0tnJlWQ//Bzdl6AF3F4lKdq1rPjUnqjxMFk7FA80lGiouHktBDIIDANPP4HreOY2OWqH5Cz9q+NkNCmvNuQ28CVcfGj3Dp6hStmTdGUZFVWxV/Z0t+rQG8+5xKG/kxrJtPTDBdCz/bHK17G6mziX3WcNHaIB6p23CxsM71JoOgAFcW54D6UlYHCp0ZXC0u6f+M7qsSs+8CyweNWUIT5wJZq6Ze63yX00W69kdXDjaB0/zio/xAaI/Vy0DbsBdBEYVawiEQgpQUCSNaPACXPg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nyuEAr3yxqu33u5aujl4OtenHRyY3sX5YejnBtXQjN74LrCedYyCFz1oASJDjQdbhOF0WJmPpHMR07QvICq4znv1WK42N/nZIr+PvZvCn7g2spbKFyRkRIGu/1YlmuMqgHQlu+M/5yK65DaQN71FikMHmPPq19oN0vDH41TDbQ3xcPa+eVWS9gd+YAc6yIOxkc8uNGUXxgKf6bER/bdUgDcBVLkM7qaIWp4Q8iq7Vs7vjW3Nqf2MA5OxmP6HyX/SWdlcDrYW/oF0t6DZWKQX2mn+s/KoJVPw514UH6wQyOxBUd+9VaWDqOUZ8RcTpUCfLtAmAt1JXp37W201cUQ2LQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: 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>, Kevin Tian <kevin.tian@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 06 Sep 2022 21:50:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 31.08.2022 16:10, Volodymyr Babchuk wrote:
> Hello,
> 
> This is yet another take to a PCI locking rework. This approach
> was suggest by Jan Beulich who proposed to use a reference
> counter to control lifetime of pci_dev objects.
> 
> When I started added reference counting it quickly became clear
> that this approach can provide more granular locking insted of
> huge pcidevs_lock() which is used right now. I studied how this
> lock used and what it protects. And found the following:
> 
> 0. Comment in pci.h states the following:
> 
>  153 /*
>  154  * The pcidevs_lock protect alldevs_list, and the assignment for the
>  155  * devices, it also sync the access to the msi capability that is not
>  156  * interrupt handling related (the mask bit register).
>  157  */
> 
> But in reality it does much more. Here is what I found:
> 
> 1. Lifetime of pci_dev struct
> 
> 2. Access to pseg->alldevs_list
> 
> 3. Access to domain->pdev_list
> 
> 4. Access to iommu->ats_list
> 
> 5. Access to MSI capability
> 
> 6. Some obsucure stuff in IOMMU drivers: there are places that
> are guarded by pcidevs_lock() but it seems that nothing
> PCI-related happens there.

Right - the lock being held was (ab)used in IOMMU code in a number of
places. This likely needs to change in the course of this re-work;
patch titles don't suggest this is currently part of the series.

> 7. Something that I probably overlooked

And this is the main risk here. The huge scope of the original lock
means that many things are serialized now but won't be anymore once
the lock is gone.

But yes - thanks for the work. To be honest I don't expect to be able
to look at this series in detail until after the Xen Summit. And even
then it may take a while ...

Jan



 


Rackspace

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