[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: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 26 Jul 2023 08:39:01 +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=J9AE0Vb4bcT6Fi0slcd1PzH0iQsO5wnomwC2k11hBAw=; b=k22UtrDyYNut0KNJ6ShYbCkplfsXiOUN1UiqoyXlayj7Rtg/yLsAuKZC5+UGUp9Q/m2Kd+YAUwDL8zpv2n5kZva61CcHQSNIQjtQ0AsZEkUIWHyOaFLi3AEmCMcuyweMBqqH3O91NuA3lWSrbuYslRrsVzkVlBBHxEaxyFXWTh/Aa8zvO1IcBapQpdTZc1H+X5GfZas8c4YVIPj/JYJb8Ew98075LsotgvmtitV6XfFncQgKB3s6wUI/Hecn1aREkYm0RvtAaxOchpnll46YKMJ8MvXNs6qHzimfjw8k9KgBrdHrSHi4qrTvnK3NprBNDvTz1hPZOf2d9lF45EgDwQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eQoEArJ+Ocb9YQy9/dhJJ6M5YvOoM4xC+tlbEJUCOUW3031NRezEW3JsX8S3iko32rXGxPodJUuj8boJS6B9pE762ZKFzZRFI7tr9dz8R7yhZpMb65tyvDip1qpUDaQVSWnEELQ3qjpR1xqYZoh2mTK9b4r75sliOd0RfZ3W9a1gXu4QW2ev80BvqMtYsrCdqg0un/7SYpAj8RcrGPJvhGq+X0otQ/RkOGb5V2klZdUm7dbwgLmRHbxx34AMXYiV5Sisy9gNVaDhtmRK4oP3HpcFNl07y1+i5J4ca8cktr9QIlLTDhUnJmEsBOrUAAFSh3v/8b7rGGbm+7bglJyRoQ==
  • 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>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 26 Jul 2023 06:39:14 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 26.07.2023 03:17, Volodymyr Babchuk wrote:
> Roger Pau Monné <roger.pau@xxxxxxxxxx> writes:
>> On Thu, Jul 20, 2023 at 12:32:31AM +0000, Volodymyr Babchuk wrote:
>>> --- a/xen/arch/x86/hvm/vmsi.c
>>> +++ b/xen/arch/x86/hvm/vmsi.c
>>> @@ -895,6 +895,8 @@ int vpci_msix_arch_print(const struct vpci_msix *msix)
>>>  {
>>>      unsigned int i;
>>>  
>>> +    ASSERT(rw_is_locked(&msix->pdev->domain->pci_lock));
>>> +
>>>      for ( i = 0; i < msix->max_entries; i++ )
>>>      {
>>>          const struct vpci_msix_entry *entry = &msix->entries[i];
>>> @@ -913,7 +915,9 @@ int vpci_msix_arch_print(const struct vpci_msix *msix)
>>>              struct pci_dev *pdev = msix->pdev;
>>>  
>>>              spin_unlock(&msix->pdev->vpci->lock);
>>> +            read_unlock(&pdev->domain->pci_lock);
>>>              process_pending_softirqs();
>>> +            read_lock(&pdev->domain->pci_lock);
>>
>> This should be a read_trylock(), much like the spin_trylock() below.
> 
> vpci_dump_msi() expects that vpci_msix_arch_print() will return holding
> this lock. I can rework both functions, of course. But then we will in
> situation when we need to known exact behavior of vpci_dump_msi() wrt of
> locks in the calling code...

Your reply sounds as if you hadn't seen my earlier suggestion on this
matter (making the behavior match also for the now 2nd lock involved).

Jan



 


Rackspace

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