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

Re: [PATCH v8 02/13] vpci: use per-domain PCI lock to protect vpci structure


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 21 Jul 2023 08:02:33 +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=/cMAsk5SO/im3WOoikG5RqmhbfUkisohoWRcAjHPFGo=; b=doo4UwjgtUO0L7sGuGJa1cXIfBnh4yBvJBm9kc7XINsKTkBnXzjJ6x2NRxx4YDLYs82CAR1MIEwwVqcJhQl9duYx41m1I3o+mBTJ2KJxgGEihJ70SA2Qjcpfl8YyL9WFcA8yJh15Z3RQpVdGHSllcVdd8yLhHItEvDHAVkplkW+/qX9gqcPyX0LBiA8SIxBPBlVSL/CKJaDaTauF28rE0eCFBtozoBsn8ZxmyJeVbieQ7p7TShCrIek0kb67XT+ZriARtSNMQ96OLfr9zo1GGyhjtaMW2Eden+DdAJGXLCstBnC931PXZVCs4cLV7V7G2WzOGUDJtHGJH+E4axCZOQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OLNzT1sz5rFcOMqgv9gq4qLfdqGwNKbg3SNo+ux799jaYVgGHrMikGBQo5SHaikzhP4kJkn2CIO0qYaEFE54qNPtgQS3Zso1V7e6GYRZbDBm996KEZqlpyZp8T7em637Am40OyqAInPiYCgMdg0SVB1w2YO+A1EkF7l+LjBLGNFQXW9H3Z7Gb2vVWPzpkfK/MWbjx4U3oKRvurrtkTeMKPxwIK5M97pstMA5QpuV9o8zTORoW7CIxBvHUEju/MLq+39vAYSI+74g64pduDNNWujELa9eNgQJeiNy4ZunmESYxLCBQJai36YEDB8OvP0WIMrjfJOLLFZdHyfszqmdOQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 21 Jul 2023 06:02:58 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 20.07.2023 18:14, Roger Pau Monné wrote:
> On Thu, Jul 20, 2023 at 06:03:49PM +0200, Jan Beulich wrote:
>> On 20.07.2023 02:32, Volodymyr Babchuk wrote:
>>> --- a/xen/drivers/vpci/msi.c
>>> +++ b/xen/drivers/vpci/msi.c
>>> @@ -190,6 +190,8 @@ static int cf_check init_msi(struct pci_dev *pdev)
>>>      uint16_t control;
>>>      int ret;
>>>  
>>> +    ASSERT(rw_is_write_locked(&pdev->domain->pci_lock));
>>
>> I'm afraid I have to ask the opposite question, compared to Roger's:
>> Why do you need the lock held for write here (and in init_msix())?
>> Neither list of devices nor the pdev->vpci pointer are being
>> altered.
> 
> This is called from vpci_add_handlers() which will acquire (or
> requires being called) with the lock in write mode in order to set
> pdev->vpci I would assume.

Right.

>  Strictly speaking however the init
> handlers don't require the lock in write mode unless we use such
> locking to get exclusive access to all the devices assigned to the
> domain BARs array for modify_bars().

Aiui in the present model modify_bars() has to use the vpci lock for
protection. Therefore imo in any of the init functions the assertions
should either express the real requirements of those functions, or be
omitted on the basis that they're all called out of add-handlers
anyway.

Jan



 


Rackspace

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