[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: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 17 Apr 2023 13:02:06 +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=5vO59h4mbsX2JtvtV8+BTsUc+CYbHjxMOfqt9GLOhVI=; b=Rq+1T7ixx+5o4wUOmmzj0NZYZIiTXlPb6IxxGNe9LoJo+kYbBezp6zY3SIIJ/DGHgevXBCNl7yPKYDcQbsD0kwHqMjBKkZAJzv5su53In47JYvC3m6FwLqT28NQBn6qKzy4O/KIYZjawjF51VGmgMDO/ROVQ9y3prszcznPtypPogx2TCaBRVgMxc4TNGpWLfsRb3hbqRHWapeOocOqB6a8N7foyu8GI81VjsZTA8Vb2wVK8jzDXLeQjpiTjNBHyrwYUrFRtjS1NKLxIqtyLOsf9KPKn1ustu2s/ax6qLfpU9uCip6TODDDgbXzW5YotufOyn32QbwzzvYAxM7BtLQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P0+tTxMhwZ8fUg/ZpXKJBKhwsrNhY07oanbzPnWBVv82mK11+k8no8qJ8m6DX7lcvlswiKvGICnxqKgNGWEvKf71+sS079bm76OZbwcwhQTtVoI37U5DnwCgzHolfmY9+CqQ7W4xciECD33pacQ74B3qYZZKMHRUnBaokvXPPZh32Kyl4QBEqMQySzdxBAPCP+UG8C2hdYK26ThOzufPPzo/EHqXa2QNEiKANtM0BmaGIopz2KAg2R3BZXDERvOIr32dBeKT5XMyzfZM0+GA31VZkN7VSVyuOxHkxIDrBfsFIjAlWas0/18cBFFdYgGjGkB38l5KNo9GwhrLRYRNlQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@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>
  • Delivery-date: Mon, 17 Apr 2023 11:02:50 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 17.04.2023 12:51, Roger Pau Monné wrote:
> On Mon, Apr 17, 2023 at 12:34:31PM +0200, Jan Beulich wrote:
>> On 17.04.2023 12:17, Roger Pau Monné wrote:
>>> On Fri, Apr 14, 2023 at 01:30:39AM +0000, Volodymyr Babchuk wrote:
>>>> Above I have proposed another view on this. I hope, it will work for
>>>> you. Just to reiterate, idea is to allow "harmless" refcounts to be left
>>>> after returning from pci_remove_device(). By "harmless" I mean that
>>>> owners of those refcounts will not try to access the physical PCI
>>>> device if pci_remove_device() is already finished.
>>>
>>> I'm not strictly a maintainer of this piece code, albeit I have an
>>> opinion.  I will like to also hear Jans opinion, since he is the
>>> maintainer.
>>
>> I'm afraid I can't really appreciate the term "harmless refcounts". Whoever
>> holds a ref is entitled to access the device. As stated before, I see only
>> two ways of getting things consistent: Either pci_remove_device() is
>> invoked upon dropping of the last ref,
> 
> With this approach, what would be the implementation of
> PHYSDEVOP_manage_pci_remove?  Would it just check whether the pdev
> exist and either return 0 or -EBUSY?

If the device doesn't (physically) exist, it would return e.g. -ENODEV.
If it still exists and the pdev also does, it would return e.g. -EBUSY,
yes.

Jan

>> or it checks that it is dropping the
>> last one. The former looks architecturally cleaner to me, but I can accept
>> that moving there might be more of a change, so wouldn't object to going
>> the latter route.
> 
> One of my concerns is what is expected of PHYSDEVOP_manage_pci_remove,
> I don't think it's expected for PHYSDEVOP_manage_pci_remove to return
> 0 while there are users inside the hypervisor still holding a
> reference to the pdev.
> 
> Thanks, Roger.




 


Rackspace

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