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

Re: [PATCH v3 2/6] xen: pci: introduce reference counting for pdev


  • To: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 29 Mar 2023 12:04:58 +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=m9N7Kb9ZDYD6IGrvpuY9ZA50iPcP5rEl0mPeo9OWl/4=; b=PDVzd7p+ApbnqsOz+S2TLAbziwOF8m0lUdVIrukY5kUq3PO9AxOXaB+B15Q+fCpyB/nsOqKhz2ItumWzOstf1cC03RioLEqzVWgUV6iBVvpdckVE/5Ew7jjeFF/mIPt71JOMPkYnZRoBCUtx6ky0lzitGkve9U3uMsq+kLjnXJ9O7nN23KHDbvtqs4ImpMeEiC5CkPmSUTbnPlWp36Ro8jBxYzeWWiYSu4ByoRz6oa6XaNv1uzVD/R6tRyxPtReJRqOqT1ED3GvxL4LoIz5Xf650/fnKG4DL9Z5kS0ByVU4A88CvycaM5iOaRa00vEi+E3r7fTCd17IgGw+lxOgeSg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eUfiVXuGWDqMI4/gqIDUN1xHkCqqUsHxSNgTVqX8jGU57vJePszSu5IsAPNd5xdNJThr0VUJt/BtZGQkOM3MWyL6Oi1iWqv3VOVuT6VEkcqdG5FGP3k7IcwU64lHTmMIb6nFwvHwFCGMxdnJgQlSLXZ48jYJm16tlf5e6xGpyGmbJW8gBNr/RbhPG4Z2Xyz9vRkOcYz5kkLvtj0QtRy7Y6cynW8INqg3KbuUw16zye6zeZbTZHI71wXfvttR0sI/pKb36NhHq5erhWR3r6ro9eoBFPyQsetAojFoi7yAXQ/Ff8oLuk3FnmrF7f3G65wOfawDYPGEmDGRA/J/cFXkGg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 29 Mar 2023 10:05:11 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 14.03.2023 21:56, Volodymyr Babchuk wrote:
> @@ -422,33 +423,6 @@ static struct pci_dev *alloc_pdev(struct pci_seg *pseg, 
> u8 bus, u8 devfn)
>      return pdev;
>  }
>  
> -static void free_pdev(struct pci_seg *pseg, struct pci_dev *pdev)
> -{
> -    /* update bus2bridge */
> -    switch ( pdev->type )
> -    {
> -        unsigned int sec_bus, sub_bus;
> -
> -        case DEV_TYPE_PCIe2PCI_BRIDGE:
> -        case DEV_TYPE_LEGACY_PCI_BRIDGE:
> -            sec_bus = pci_conf_read8(pdev->sbdf, PCI_SECONDARY_BUS);
> -            sub_bus = pci_conf_read8(pdev->sbdf, PCI_SUBORDINATE_BUS);
> -
> -            spin_lock(&pseg->bus2bridge_lock);
> -            for ( ; sec_bus <= sub_bus; sec_bus++ )
> -                pseg->bus2bridge[sec_bus] = pseg->bus2bridge[pdev->bus];
> -            spin_unlock(&pseg->bus2bridge_lock);
> -            break;
> -
> -        default:
> -            break;
> -    }
> -
> -    list_del(&pdev->alldevs_list);
> -    pdev_msi_deinit(pdev);
> -    xfree(pdev);
> -}

No matter what cleanup model we choose in the end, I think it would be helpful
if this function wasn't effectively moved to the end of the file, but adjusted
in place. Then it'll be much easier to see what actually is moved out of here.
pcidev_{get,put}() could be added right after this function. They're important
enough anyway to warrant them not living at the bottom of the
file.

Jan



 


Rackspace

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