[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: Thu, 20 Jul 2023 15:27:29 +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=rggqXSpnfKDvnqpml8bOxYDB9mTW1feRAlb4rApz+Rw=; b=Fq20PDSHFK6aGMrV2s130agncjKNHaApIxRw4vtYRxi5j85neLbt450eFWj5cQ+5qJ2+49rV9ZPDVL3mvTbQhhsHkOlZ2Oxk18FKKcQqYpS7tLmXiEOJcX3czE1BEzcaa7cUUeilCnbq6k6/YRET9Zjr7FBLC1c99RhpZS9Z197Fr8kyHAoYGeERFotsXg8ojevESKopXRQkVL/ZHUEGEUCANHDb9AiiShKLe/IfD3HRcdwKwSk0p4eBnnvLkHpu7Bs5nnO61QliXwox6p2qcqQ7LRSazuxRt0V9YkWDlQWJ2vLDbauK7zCbsBnH3jVIC+5g8YTVB1xaQg/G/S0CcA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KZkf/fnhjWYnNWuFkP3tGGq+ku8hKnfXT7cgy8QBa8j00B2dm0ToRgyYV4Agffd0wS05esY+A83DFp5xODHWO6NQUpkCNEugg7IJhmLETqAAPyZswqPXw9umVDgREdpShYWRh8h76gUlyQ3mkZZ0zkFCpEfC2fPlicTnCqaT4/0VJU0HM1X6PePfSseldjYfMxUzMHxrAIWUTJqgtHcLaHUaMpMTXsZcjxgxldAndrCly6Ni6++ejPMULuQzAE12J+YY9RckMj9ORScfeSJcfNHQZsAjhXVNwiO6b8JCOl+3Ok/enNwKxFYoSibebpvQE02ns/I0/+y7UePXp1zHcw==
  • 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>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 20 Jul 2023 13:27:53 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 20.07.2023 13:20, Roger Pau Monné wrote:
> On Thu, Jul 20, 2023 at 12:32:31AM +0000, Volodymyr Babchuk wrote:
>> @@ -447,8 +476,16 @@ void vpci_write(pci_sbdf_t sbdf, unsigned int reg, 
>> unsigned int size,
>>  
>>      /*
>>       * Find the PCI dev matching the address, which for hwdom also requires
>> -     * consulting DomXEN.  Passthrough everything that's not trapped.
>> +     * consulting DomXEN. Passthrough everything that's not trapped.
>> +     * If this is hwdom, we need to hold locks for both domain in case if
>> +     * modify_bars is called()
> 
> Typo: the () wants to be at the end of modify_bars().
> 
>>       */
>> +    read_lock(&d->pci_lock);
>> +
>> +    /* dom_xen->pci_lock always should be taken second to prevent deadlock 
>> */
>> +    if ( is_hardware_domain(d) )
>> +        read_lock(&dom_xen->pci_lock);
> 
> For modify_bars() we also want the locks to be in write mode (at least
> the hw one), so that the position of the BARs can't be changed while
> modify_bars() is iterating over them.

Isn't changing of the BARs happening under the vpci lock? Or else I guess
I haven't understood the description correctly: My reading so far was
that it is only the presence (allocation status / pointer validity) that
is protected by this new lock.

Jan



 


Rackspace

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