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

Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers


  • To: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 1 Feb 2022 11:10:00 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=bO4jG1GuNrVkD5Sf93b0trfw7GU9uwzI+/wxRehQRJg=; b=gXIy/YKScE/kOnjaR8CWbE+9UHgA6MQom7ZUc7HzsRMB+R4WXpOFKmgaLkem883dJS90OXA+DdbOW26Xofc8UWJJmz2qs+WJeUPSW6DUdPaZoTh9QNR+IXBFdZdSURWOhjsqbqLtoy7be8DtpFpcknm2XSpiQaNcd8YjasIdQgcgo/B29fjyrT47zPo/1FSHtbUHMpyjyWNWedZ5G+1OXgRhgbnxyN9eQA35hp0TrRv0Lh6IXKvhSFRsYiUtBJAFJJslaAszDyWXCX7q0SDjtvBqAVWk3O7JICd005aA+aaF5Vs8ZR90GMgdyukan9z3cp0Z36QoWiB4YLBvothIUg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b8DawPAwcbuOsTKnPfhaVqt6xbTjxMcxANEU+9yixIu6dFeQLXk4Al3bpLHazbvfkZTvYq61q9HzW3/xIOHYbjTJNpWrCS4xtQ+XH8qGv0fYGYDrR3EtQFIdhTt1SHTkcUiba6UOh/BHeyX6KCgZ8NolrgHAk5uNnRDB0FpqdG7UFL6nSmLax8g6xjQs/PJFqqWLGt+a2o8wedl8UHTz4Zwazle5PEmuQntL0CgX1eaTIwPjwkZuFG78OT2ZXiSJm2ie/00KPjOQmFGqwW9koSnd00iqUk2DQzZ2m0wlXprk9RAP5vkfykOh346TqqsgyoSdhwC1Nc+6FEKkJRy2xQ==
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Artem Mygaiev <Artem_Mygaiev@xxxxxxxx>, "andrew.cooper3@xxxxxxxxxx" <andrew.cooper3@xxxxxxxxxx>, "george.dunlap@xxxxxxxxxx" <george.dunlap@xxxxxxxxxx>, "paul@xxxxxxx" <paul@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>
  • Delivery-date: Tue, 01 Feb 2022 10:10:16 +0000
  • Ironport-data: A9a23:yflj9Kxg7FvZlUgscE56t+cDwCrEfRIJ4+MujC+fZmUNrF6WrkUCz GJJXj+CMv2LMzamet9yOtji/ElTuJOAzYVhHQNvqCAxQypGp/SeCIXCJC8cHc8zwu4v7q5Dx 59DAjUVBJlsFhcwnvopW1TYhSEUOZugH9IQM8aZfHAhLeNYYH1500g7wbZg2tcAbeWRWGthh /uj+6UzB3f9s9JEGjp8B3Wr8U4HUFza4Vv0j3RmDRx5lAa2e0o9VfrzEZqZPXrgKrS4K8bhL wr1IBNVyUuCl/slIovNfr8W6STmSJaKVeSFoiI+t6RPHnGuD8H9u0o2HKN0VKtZt9mGt/Vf6 /Rz777hcwIwIJHRmtxaTyRZKz4raMWq+JefSZS+mcmazkmAeHrw2fR+SkoxOOX0+M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wAXzv3ZeXmqYbxidY8GRx0kKvyqa1D5E1BZ/eWFeCys5sQhd77cDs/CCeJeLEmt bgelYSbm6/VIXqLpDrrg40QWVrP+X8AL3RUukSIbtnQf6TPg3LMiSzT677Nsv3sc1v4SnMvkqu W7Zg/RD8yIk5TJ5O1NqoJqqQ12UG6y1wtTnZu6RKbmqPKCrTLYiD4lyMGQgbfhnf/EnKOE2T8l jMZRNh67Dz0ZjeERC36OdjTYdx8sDuBA7mQ7RQ5/qEC31W2W4wqPRJHQHfHms/rr5PaO3dyN1r glcoIYuusZi2/sv3AyA54KZm
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Feb 01, 2022 at 07:31:31AM +0000, Oleksandr Andrushchenko wrote:
> 
> 
> On 31.01.22 17:50, Jan Beulich wrote:
> > On 31.01.2022 16:06, Oleksandr Andrushchenko wrote:
> >> Hi, Roger!
> >>>>                rom->type = VPCI_BAR_EMPTY;
> >>>>        }
> >>>> diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
> >>>> index ed127a08a953..0a73b14a92dc 100644
> >>>> --- a/xen/include/xen/vpci.h
> >>>> +++ b/xen/include/xen/vpci.h
> >>>> @@ -68,7 +68,10 @@ struct vpci {
> >>>>        struct vpci_header {
> >>>>            /* Information about the PCI BARs of this device. */
> >>>>            struct vpci_bar {
> >>>> +            /* Physical view of the BAR. */
> >>> No, that's not the physical view, it's the physical (host) address.
> >>>
> >>>>                uint64_t addr;
> >>>> +            /* Guest view of the BAR: address and lower bits. */
> >>>> +            uint64_t guest_reg;
> >>> I continue to think it would be clearer if you store the guest address
> >>> here (gaddr, without the low bits) and add those in guest_bar_read
> >>> based on bar->{type,prefetchable}. Then it would be equivalent to the
> >>> existing 'addr' field.
> >>>
> >> I agreed first to do such a change, but then recalled our discussion with 
> >> Jan [1].
> >> And then we decided that in order for it to be efficient it is better if 
> >> we setup all the
> >> things during the write phase (rare), rather then during the write phase 
> >> (more often).
> > Small correction: The 2nd "write" was likely meant to be "read".
> Yes, this is correct.
> >   But
> > please recall that Roger is the maintainer of the code, so he gets
> > the final say.
> Agree, but would vote for the current approach as it still saves some
> CPU cycles making the read operation really tiny

I think you need to build the mapping rangeset(s) based on guest
addresses, not host ones, so it's likely going to be easier if you
store the address here in order to use it when building the rangeset.

Overall the cost of the vmexit will shadow the cost of doing a couple
of ORs here in order to return the guest view of the BAR.

If you think storing the guest view of the BAR register will make the
code easier to understand, then please go ahead. Otherwise I would
recommend to store the address like we do for the host position of the
BAR (ie: addr field).

Thanks, Roger.



 


Rackspace

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