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

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


  • To: Julien Grall <julien@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 19 Jan 2023 10:47:20 +0100
  • 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=StbcwKNzIXnWXnkbS0ZasGDA2Bx/FiHBhcOFCg53lfY=; b=jAYUCFs6+OYY2M9jMfRo8ftCzZZO0N6rLSl3IUldMYTcW5K99JnAZAAti6pXCiirV8bfSL+PcI9x1z4rDiGDjND7jkmg7YPkpTohFpzHPMCzewJNjofp24cHM3RPL3xP5H1MHfwSASNh12jT7z1DnOTsMsDWYVE3MHs8htkryqOcwMHGQxW5NFIfMfASL64nog9aA7EtFlh83hoefuL8bACF06EuUpakJ9ugB/wAAurhir13GeGt9sHMNxOyDu6k+nZMfTFLT2oGQKR7ZkjBoAefF5O1Zg61COrzuY+2FWf5CntTUDaVvz11rxJGsDcergdMyfB8HHb8lM9B9M64KA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nJS5eeu5pEswiZbuP1beeikY73iOwPP25USDKZU5++DxPrxEGtkKj2Nw+zYeQsFHziyHBJdwQhwmuZLOsyBUokwihr/Q6LiPdkUWUhPcL3ZXTmkMY0lmxQ/IVrXAgLa38v2Jr1roJ4sz82faysV0j59Gr+sAw2enUsDisF8LsT7d5UZvZ0ovsfdILKbX0s7YtcUZHO3AuE2EjJPUFf0oP9DoGMaBxFzJer9x4tScfhZo2UuYsqluV9ZeGa6UzbOKr25+Tztzw2sJ0R7F1V+nYRCnTuf3Ofml0fGqsfIUftmnshkz7y02Bc7yuF/Kh9ejlOn79cWGyQvL6gS2FiQQcw==
  • 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>, 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>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 19 Jan 2023 09:47:36 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 18.01.2023 19:21, Julien Grall wrote:
> On 06/09/2022 11:32, Jan Beulich wrote:
>> 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 ...
> 
> I was wondering if this is still in your list to review?

Yes, it certainly is. But as before no predictions when I might get to it.

Jan



 


Rackspace

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