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

Re: [RFC PATCH 08/10] xen: pci: remove pcidev_[un]lock[ed] calls


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 28 Feb 2023 17:51:34 +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=O8hqyLEJTtVAvew4f/pEMLzCvmFRMKYBiv3Hc/GeL7Q=; b=ktAeCpdt/tSlLQWmP2d1JPPzJIvHp/qyz51Og4m26P6uaEv7E6ux3Lz9xa7OCwvQa/PK/H3PvO9QGkucJzvolG6U8qcsD8RfjLix7XcWdtLUHx02kEWFaOWUNz5i3FcU39O5L1JPUTCgmaI1J/EHCABXWADWHdtGfn196R48bzMomboBT9EeV+ThYYMLEPGBsqo/ueCiFXTNiHLBgyR4waMLnxpza83v/V6ovJElV8ZMrEBnH28nEYLhkyU228YG57I3x2fBCKKkTD6RAMzlUq2rZwpe87Q18n3KPHXx2Fft5B1aqHnQw6UCouWBB5/YYi8gOnJZRNIf5CKNAHfofQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hdPRvwU24jibs6DUdCd/BQDqksp+j81JHLd0AoqZBHPM0SYO43l1kYflEnYVq6hI3SlDBA9yqlEzpW/YVYJXIqadMsI0DoKxh3w5EfEXm+ZjAn48OeWYZTVnhD+8C3hy4W+8PB6revbbOejcbzyAuD4b7sCbLqegmgLhe9pWBuoyK3MU6TXi9j61s1NsmTn4RJDWByR0siiZTv3fFBrBnldTRdeMU/5a5G3bQciuzV5GdU6SWDntFppkEk97Cd1A5zPT1CS+N2cwjMGghmFIV4HcdYp0X9oEPYYAxZktrF78r7pJ04i5VeR5wRR1AIf3laPzdQrNgubd2iyeXQBRGg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Paul Durrant <paul@xxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>
  • Delivery-date: Tue, 28 Feb 2023 16:52:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 28.01.2023 02:32, Stefano Stabellini wrote:
> On Wed, 31 Aug 2022, Volodymyr Babchuk wrote:
>> As pci devices are refcounted now and all list that store them are
>> protected by separate locks, we can safely drop global pcidevs_lock.
>>
>> Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
> 
> Up until this patch this patch series introduces:
> - d->pdevs_lock to protect d->pdev_list
> - pci_seg->alldevs_lock to protect pci_seg->alldevs_list
> - iommu->ats_list_lock to protect iommu->ats_devices
> - pdev refcounting to detect a pdev in-use and when to free it
> - pdev->lock to protect pdev->msi_list
> 
> They cover a lot of ground.  Are they collectively covering everything
> pcidevs_lock() was protecting?
> 
> deassign_device is not protected by pcidevs_lock anymore.
> deassign_device accesses a number of pdev fields, including quarantine,
> phantom_stride and fault.count.
> 
> deassign_device could run at the same time as assign_device who sets
> quarantine and other fields.
> 
> It looks like assign_device, deassign_device, and other functions
> accessing/modifying pdev fields should be protected by pdev->lock.
> 
> In fact, I think it would be safer to make sure every place that
> currently has a pcidevs_lock() gets a pdev->lock (unless there is a
> d->pdevs_lock, pci_seg->alldevs_lock, iommu->ats_list_lock, or another
> lock) ?

Yes, I agree - there shouldn't be cases where lock uses are removed
with neither replacement nor an explanation why the removal is safe.
Which in turn suggests that a change like the one here likely needs
doing in much smaller chunks. Grouping could possibly be based upon
all touched instances having the same replacement or justification.

Jan



 


Rackspace

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