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

Re: [PATCH v2 15/18] IOMMU/x86: prefill newly allocate page tables


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 14 Dec 2021 12:41:14 +0100
  • 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=v+8BpJzw0eKICSZuO/VYrw03LPgsY0enNxrFAfUBmiY=; b=gDRSBFkD1u4u6LvkG/KC2wyD95EqyE355CHPp6xiDqpX8a9TT2nXbYocZKiufzJXuNhKpne9vGXuUyFEUr2coYgkPuJpe6q/uiN+liB6p+IucGHHamlo8KCmNH30HZ7C0/0nuGUlaZyWRjZSHEBZGnOJKSUY60l8aV5wKpCPHlZaKo9xD7rmYndwo4b7qiyiUJbGCZ1ONxrD0KyfSQE/EedDkhbLzPXfe3MaD4fFU3NaFq56ucvmym+1FNG38XqX5afIioi35NNOzFm1jdQEovQS+B/hvsLoaWzt1GLerrCOqTbsxQ86bCRC0ixNipYmsKtIGVZ4Gt2ywMwmxJlhqA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fa3lw7IwPQK1w5gU7ki9fPsgoGzSGTinEVznEY7fqQwaVnN19RY1LIBP9TDuJdGp2ApAfNcDDMGJZYGpAFfx3d3cSuUPaaFlfEAZtJWl+acj1RmsNIV7DHhNFmbtZda6R4e+2Zd9oEAJ4EOzAKkgidGMDY85AxNhklaq1QOgDDjHRr1RUgf80JdtcNPdr4B+6OwS6Wmnn8jKmVE6g35Ym5tmWPI5aJRORGEzkR0/9bwhh5qpy8iX1tlP/yXPQAigja8zDrVlFIXGZBFS4sSasBoPYO/buBwu9gL3+h4KrFINWudCSpiYe+9jvbGrua6is+/crMHZVYBUZh9FMG7xGA==
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>
  • Delivery-date: Tue, 14 Dec 2021 11:41:37 +0000
  • Ironport-data: A9a23:CBGquatlAEPoyr7m7tnxnTaGsufnVKFZMUV32f8akzHdYApBsoF/q tZmKWDUPPaPYTSheNAiYNnjo0wHvZHXnYI3QAU9/3sxEiND+JbJXdiXEBz9bniYRiHhoOOLz Cm8hv3odp1coqr0/0/1WlTZQP0VOZigHtIQMsadUsxKbVIiGHdJZS5LwbZj29cy2IThWWthh PupyyHhEA79s9JLGjp8B5Kr8HuDa9yr5Vv0FnRnDRx6lAe2e0s9VfrzFonoR5fMeaFGH/bSe gr25OrRElU1XfsaIojNfr7TKiXmS1NJVOSEoiI+t6OK2nCuqsGuu0qS2TV1hUp/0l20c95NJ Nplvp+IZjsSI7D2sulaVURHHiR6Ao8f0eqSSZS/mZT7I0zudnLtx7NlDV0sPJ1e8eFyaY1M3 aVGcnZXNEnF3r/ohuLgIgVvrp1LwM3DJoQQt2sm1TjEJf0nXYrCU+PB4towMDIY25ESQquHN pZxhTxHSwvyTTdwIgsrNrEXurexqCDDbWZUkQfAzUYwyzeKl1EguFT3C/LNc8GObdVYmACfv G2u12f0HBAccsCewDyt83Swi+uJliT+MKoQHrCl8v9hgHWI23ceThYRUDOTsfS/z0KzRd9bA 0gV4TY167g/8lSxSdvwVAH+p2SL1iPwQPIJTbd8slvUjPOJvUD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VxeRZg7cKrAeQeREWmtQtsJ uINpIOdOEYbmIK/PoSgjPIaurIqePvmMvD5Za8854ud3ATV0gJ1XYGNu/xKDwReOApP+tcKH LKjfA32AZINE5nJPhSQRI+Lp3+juyOsKijTQ8NBhYh5gXLpTS06ITiGxzd+hsFSTtAzZor7G CAymXCl+memsD+7iWZ+37Y7pxQltek4txfBPaUgsxQDjn3kA6naKloRrXHljEop+OE7kosjb D30lodFvU2z0mUUnC+oBPr1QWl+DEy60X6wVvdunfnqdyRfkNyN+NxwaZiNjfJ4Uspu99xlI hR2XiCipZRBRTc2Azg+tnhTXhR5wuJiEtntdRWo21UUIMYZrMUh5cY5llpHJAJGz+/wJw7Ed NpENrX6J9tAB2nhkjizypSKeGXLzYO9k/seDlGhiXV6UkYoJlB9TpZ+CRF9U1wsK7USPF/lp L52+pT5fZzp/QtHNFA7dE6MLyK41z2MGLx2V2pUCba/YE8SjrwQs3Mkf4IDN/DQu198HJ1ou WGbG9l
  • Ironport-sdr: bNrJJbYwc6rf+JWM64rwKXsAcMWUa+0sEIrPGYEn7VUhqptoOK1oe+Xsmwd1IJx5gx0m0zR5rB hbBWea6jEG/VHKV8rwyKQceGfzdZvYzm5gC5H6CvcZYMuiEj/PJsQ/d2lVzKbg+v2eW0IIWzh8 GYAGIaHW9tkfq5SzEeiqXL/NxSDdp5V1+PurIpCX4L3BRZDBIPgSdaGzOjbPJh+JTfNp7Rkwo5 xG0GQJZYfMY+mTfbW5E6RVRi7DLijvi4TJ1S0Dr0qQUgJuZbWMEJDK6o3gDAQtrELRg4Kiy7u8 JkiTdIFSaZugZsC40KOFOuQN
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Dec 14, 2021 at 10:15:37AM +0100, Jan Beulich wrote:
> On 13.12.2021 16:51, Roger Pau Monné wrote:
> > On Fri, Sep 24, 2021 at 11:54:58AM +0200, Jan Beulich wrote:
> >> Page table are used for two purposes after allocation: They either start
> >> out all empty, or they get filled to replace a superpage. Subsequently,
> >> to replace all empty or fully contiguous page tables, contiguous sub-
> >> regions will be recorded within individual page tables. Install the
> >> initial set of markers immediately after allocation. Make sure to retain
> >> these markers when further populating a page table in preparation for it
> >> to replace a superpage.
> >>
> >> The markers are simply 4-bit fields holding the order value of
> >> contiguous entries. To demonstrate this, if a page table had just 16
> >> entries, this would be the initial (fully contiguous) set of markers:
> >>
> >> index  0 1 2 3 4 5 6 7 8 9 A B C D E F
> >> marker 4 0 1 0 2 0 1 0 3 0 1 0 2 0 1 0

Could you expand bit more on this explanation?

I don't get how such markers are used, or how they relate to the page
table entries. I guess the point is to note whether entries are
populated, and whether such populated entries are contiguous?

Could you provide a more visual example maybe, about what would go
into each relevant page table entry, including the marker
information?

I would like to understand this instead of trying to figure out from
the code (as then I could be making wrong assumptions).

> >>
> >> "Contiguous" here means not only present entries with successively
> >> increasing MFNs, each one suitably aligned for its slot, but also a
> >> respective number of all non-present entries.
> > 
> > I'm afraid I'm slightly lost with all this, please bear with me. Is
> > this just a performance improvement when doing super-page
> > replacements, or there's more to it?
> 
> What I wanted to strictly avoid is to have to scan entire pages for
> contiguity (i.e. on average touching half a page), like e.g.
> map_pages_to_xen() and modify_xen_mappings() do. Hence I tried to
> find a scheme where for any individual update only a predictably
> very limited number of entries need inspecting (some of these then
> of course also need updating).

Thanks. So there's some extra cost here of having to update those
markers when a page table entry is modified.

Roger.



 


Rackspace

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