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

Re: [PATCH v5 03/14] vpci: move lock outside of struct vpci


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Oleksandr Andrushchenko <andr2000@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 12 Jan 2022 15:42:15 +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=3c7mr+1IjDTFZ2qeQkxXhtgqsz25YkWDAfDW3Iw1FzM=; b=PSVhrEyP2Gr74Y9LAoh+ZFhl2IWh6DYqLdSUdQwOnJZ4ffym0CG5Kd5X4lX5lf08t0zqXcoIP+IYMQKIYb9YB/WfRvLUkxs8rX6e7bpBkcXzBviL5YtR5QbELQSVsW8mrRa4Au73tCicTD3YsVAIVQs6cZzWNqfUEPuFXjMtJiw8k4FtYQEWwCe6s+r2XoXwM4cIuDHK1+Grs+aVbONjjOK1zeh9Jog/V8upnIKHrsS6xFP3JbT+5gGvH9N7dpXTZdaDXISziVdIgHWnQJGKFVupWqUr88Cp+qJxbdXupZMm9cC7RTlpQHdIyOMDrtKXBUrqk5AlYDrG9hc5pSfeog==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gOuu/h2T6leo0G6vVtaMuiUHLcEGCk+Oc3/RHBsaNtA3pdirbkpcSlIw1BSYxuGd+OyXm/W/AvAuxqjf34xZbfM/vV41XGGraDYJwrz53AFO0mWdbGhCVFnEazF5dKIQtP3KFK5V2fcErRMW/YkdQASwOP8fHnrkC+U97XzmBHzlVri/JcpVwyNPZTn6gJ/iW+4CGzCetGZGcw5HdYNmBEUgty9wYOVXpnATmslKJ5hoBvP+1Bt/JPx4QHuPzo1Bfk1a/+J2gwNnzs7qoEWoIh2grxsyosK4Ib9wBse1RxHMutcCC/Xn96a5lmfWQBI4wn5zA8mIGH58bUqvAWSL+g==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, julien@xxxxxxx, sstabellini@xxxxxxxxxx, oleksandr_tyshchenko@xxxxxxxx, volodymyr_babchuk@xxxxxxxx, Artem_Mygaiev@xxxxxxxx, andrew.cooper3@xxxxxxxxxx, george.dunlap@xxxxxxxxxx, paul@xxxxxxx, bertrand.marquis@xxxxxxx, rahul.singh@xxxxxxx, Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>, Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
  • Delivery-date: Wed, 12 Jan 2022 14:42:47 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 11.01.2022 16:17, Roger Pau Monné wrote:
> On Thu, Nov 25, 2021 at 01:02:40PM +0200, Oleksandr Andrushchenko wrote:
>> diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
>> index 657697fe3406..ceaac4516ff8 100644
>> --- a/xen/drivers/vpci/vpci.c
>> +++ b/xen/drivers/vpci/vpci.c
>> @@ -35,12 +35,10 @@ extern vpci_register_init_t *const __start_vpci_array[];
>>  extern vpci_register_init_t *const __end_vpci_array[];
>>  #define NUM_VPCI_INIT (__end_vpci_array - __start_vpci_array)
>>  
>> -void vpci_remove_device(struct pci_dev *pdev)
>> +static void vpci_remove_device_handlers_locked(struct pci_dev *pdev)
>>  {
>> -    if ( !has_vpci(pdev->domain) )
>> -        return;
>> +    ASSERT(spin_is_locked(&pdev->vpci_lock));
>>  
>> -    spin_lock(&pdev->vpci->lock);
>>      while ( !list_empty(&pdev->vpci->handlers) )
>>      {
>>          struct vpci_register *r = list_first_entry(&pdev->vpci->handlers,
>> @@ -50,15 +48,33 @@ void vpci_remove_device(struct pci_dev *pdev)
>>          list_del(&r->node);
>>          xfree(r);
>>      }
>> -    spin_unlock(&pdev->vpci->lock);
>> +}
>> +
>> +void vpci_remove_device_locked(struct pci_dev *pdev)
> 
> I think this could be static instead, as it's only used by
> vpci_remove_device and vpci_add_handlers which are local to the
> file.

Does the splitting out of vpci_remove_device_handlers_locked() belong in
this patch in the first place? There's no second caller being added, so
this looks to be an orthogonal adjustment.

Jan




 


Rackspace

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