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

Re: [PATCH v3 5/6] vpci: use reference counter to protect vpci state


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 29 Mar 2023 11:31:49 +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=76rYo/icGWXG1N9jUWEnrx+p2geu0sIqXAVpi5oXy6c=; b=TTSU9pdlAm+EzViynOwFwSgMHu1H3FGMdWjXukDa+RZBTsrdUHEw4Vsy+IenBznyOcDoerUg7p/5pmS4ouRXMr6AuAdd5UPJ65a/4egCo5lpJLKwulc8Bs9nvqIoHDClGX+W3919lIfCcoUbHVG7VkSskRQvqLcPC4sC5Qftfee97LR5y/HpaUH8JAnLjig+d9ApghN6TEFOfKltMZn9lL5+Jzt5gUgQ/d1KbFSKqjDr/kMjwpHXLS6KjnwfaknIjtR1AAWjr3YnIoew1zJ1c9E4jhFlnUDSPcRVNlyshQH/O0E7KeGQ8G6awaNK5rsaKhV+z05YKfz+m8FZBB4+Yw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gh7mXWbnEdEjkxN81y7gHqj3AiwUkIhP8bU4U+V3o6MQh14twzcCNg2Xx/6fi6qUEZtW2ZakzUqKzMzJNuSMOhuLoF+zmab2ZxXq2Vb5PGwPJ8TG1urpEKouyFs8RBYortmOI7mqTYQI4jbd/NmSzl8UotbIHqsbd5SvODGUr9MB/4+8FPMR3Gh2qxDjzuwhHhe0nCIRLYCRH3tKUBAQZRtP9Zcf70wUsGcfHVF4O/+ZkRFz53gIqA+wTTX4moUSa++RHGxCNAfVi/UG8tTyIIa/hr3YGPSzb+WMvSEsjUsK+LLY/RrkqQPsXgSEJBhZZcXptZc955qANkEVj5wG9Q==
  • 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>
  • Delivery-date: Wed, 29 Mar 2023 09:32:13 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 17.03.2023 09:43, Roger Pau Monné wrote:
> On Tue, Mar 14, 2023 at 08:56:30PM +0000, Volodymyr Babchuk wrote:
>> vPCI MMIO handlers are accessing pdevs without protecting this
>> access with pcidevs_{lock|unlock}. This is not a problem as of now
>> as these are only used by Dom0. But, towards vPCI is used also for
>> guests, we need to properly protect pdev and pdev->vpci from being
>> removed while still in use.
>>
>> For that use pdev reference counting.
> 
> I wonder whether vPCI does need to take another reference to the
> device.  This all stems from me not having it fully clear how the
> reference counting is supposed to be used for pdevs.
> 
> As mentioned in a previous patch, I would expect device assignation to
> take a reference, and hence vPCI won't need to take an extra refcount
> since vPCI can only be used once the device has been assigned to a
> domain, and hence already has at least an extra reference taken from
> the fact it's assigned to a domain.
> 
> If anything I would add an ASSERT(pdev->refcount > 1) or equivalent.

FWIW: +1

Jan



 


Rackspace

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