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

Re: [PATCH v9 04/16] vpci: add hooks for PCI device assign/de-assign


  • To: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Wed, 20 Sep 2023 10:41:49 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=SLYPG3+XLKX87aX2BNbt6XEVI1IvRqOgNNa1Ts87+XY=; b=nLG85DVcEmeJfjIVYLro3GkCfQwF0C2+PovAPpgYG7+txaiygB9ub8tplmqV8+5fsWcsPqlbHon8QBMDmMXWiLQIEyhrCm2MJHTy6oe+ShudA/OkB83qH57/46zxWIUyKOs78eI9rXt8xb3G/vTT8b1ET+n6Soq5O7UvC9smwhsrOX/SYNHs4gKBbBeNdwsIgNwbUG70kQ70eQMKSbwaflfQhpzqlABX2UB046wh9Hh4RDTmt8MPm2X6/NAaaRtdxAhpmS1xJb4CPGzWk7JLn4prgPLZRJP2Pg9kKgKfB4uekliO5Bs/dZdZueDtglwKbZONMvph8wNuqPxxKQignA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kJtv4m5/cJWC3xCcU0CU3eS44JHgGAruxSv63+t5Ahg0aHNlZGcyHTLCs7F6mUUrlMW11S8GztdJeLq48dMAHFK57ELcR4ZpyBwpzo5EqUBkwNcZCm+ZosqH4sGIoH8w0g2y4JgK87FuznVtiYSh8nl0bbB4a25H1HnGRxq+6CnCsbpmyR2ArFc7LJtw+abODUOeOVijLFx8KsFqvZlTLgJV7db/8hW0bHwQ0j7t5IpZdPRhMiZkQoORkr5Mo9ON2pmKFTh1E2kTkEcRK+ilBU3UoCmbWqfG7X7joae1D7bPd3f5hi8xJX4cX2ls7IFkQTIqxAvBOPctsXLtTDeg3w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Paul Durrant <paul@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 20 Sep 2023 08:42:12 +0000
  • Ironport-data: A9a23:RKTAWKmX01MFsnDSJPg5+GXo5gw3J0RdPkR7XQ2eYbSJt1+Wr1Gzt xJOD2COaKnZMWejeY1+PYy/9kxXvpHSz9VhTlQ/pC9jEyMWpZLJC+rCIxarNUt+DCFhoGFPt JxCN4aafKjYaleG+39B55C49SEUOZmgH+e6UKicfHkpGWeIcQ954Tp7gek1n4V0ttawBgKJq LvartbWfVSowFaYCEpNg064gE0p5K6aVA8w5ARkPqga5geGzhH5MbpETU2PByqgKmVrNrbSq 9brlNmR4m7f9hExPdKp+p6TnpoiG+O60aCm0xK6aoD66vRwjnVaPpUTbZLwXXx/mTSR9+2d/ f0W3XCGpaXFCYWX8AgVe0Ew/yiTpsSq8pefSZS0mZT7I0Er7xIAahihZa07FdRwxwp5PY1B3 cFDDhk2cxS9u/vsg+jhZOJ0jZohNNa+aevzulk4pd3YJdAPZMmbBo/suppf1jp2gd1SF/HDY cZfcSBocBnLfxxIPBEQFY46m+CrwHL4dlW0qnrM/fZxvzeVk1Q3ieC1WDbWUoXiqcF9hEGXq 3iA523kKhobKMae2XyO9XfEaurnxHmhBN9LTubhnhJsqEGz6lxOIwRGaQeEr/TptXy6AsJGC ENBr0LCqoB3riRHVOLVYRq8p3KVuw8GbPBZGeY69QKlx7Ld5kCSAW1sZjxLZcEitcQ2bSc3z VLPlNTsbRR0rLCKQGiBsLeVqT+/MzIcK2MqbCoICwAC5rHLh4U+jQnGSNp5J4ezgsfoAjH7w z2Mry8Wiq0aiIgA0KDT1VLahzOhoLDZQwhz4R/YNkq+9R9wboOhY42u6HDY4OxGIYLfSUOO1 FAbn+CO4eZICouC/ASVSfgJNKGk4bCCKjK0qU5iGdwt+iqg/1anfJtM+3duKUFxKMEGdDT1J kjJtmtsCIR7OXKraep9Zd23AsFzlaz4T429DrbTc8ZEZYV3eEmf5iZyaEWM3mfr1k8xjaU4P pTdesGpZZoHNZlaIPONb791+dcWKuoWngs/mbiTI8yb7Iej
  • Ironport-hdrordr: A9a23:cggROa6W/ObU3Hp8ZgPXwDjXdLJyesId70hD6qkQc3Fom62j5q STdZEgvyMc5wx/ZJhNo7690cq7MBbhHPxOkOos1N6ZNWGLhILPFuBfBOPZqAEIcBeOlNK1u5 0BT0EEMqyWMbB75/yKnDVREbwbsaa6GHbDv5ah859vJzsaGp2J921Ce2Cm+tUdfng9OXI+fq Dsn/Zvln6bVlk8SN+0PXUBV/irnay3qHq3CSR2fyLO8WO1/EiV1II=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Sep 13, 2023 at 11:53:56PM +0000, Volodymyr Babchuk wrote:
> 
> Hi,
> 
> Jan Beulich <jbeulich@xxxxxxxx> writes:
> 
> > On 13.09.2023 01:41, Volodymyr Babchuk wrote:
> >> Jan Beulich <jbeulich@xxxxxxxx> writes:
> >>> On 30.08.2023 01:19, Volodymyr Babchuk wrote:
> >>>> @@ -1481,6 +1488,13 @@ static int assign_device(struct domain *d, u16 
> >>>> seg, u8 bus, u8 devfn, u32 flag)
> >>>>      if ( pdev->broken && d != hardware_domain && d != dom_io )
> >>>>          goto done;
> >>>>  
> >>>> +    if ( IS_ENABLED(CONFIG_HAS_VPCI_GUEST_SUPPORT) )
> >>>> +    {
> >>>> +        write_lock(&pdev->domain->pci_lock);
> >>>> +        vpci_deassign_device(pdev);
> >>>> +        write_unlock(&pdev->domain->pci_lock);
> >>>> +    }
> >>>
> >>> Why is the DomIO special case ...
> >> 
> >> vpci_deassign_device() does nothing if vPCI was initialized for a
> >> domain. So it not wrong to call this function even if pdev belongs to 
> >> dom_io.
> >
> > Well, okay, but then you acquire a lock just to do nothing (apart
> > from the apparent asymmetry).
> 
> Yes, I agree. I'll add the same check as below. Thanks for the review.

Hm, no, I would rather rely on the has_vpci check inside of
vpci_{,de}assign_device() than open coding dom_io checks elsewhere.

This is not a hot path, the extra lock taking is likely negligible
compared to the cost of assign operations.

Thanks, Roger.



 


Rackspace

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