[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: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 14 Dec 2021 12:48:13 +0100
  • 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=8tD7mjhLgKjpYmDK84hJGLgP69zuLm9AE3WnkKlb3PA=; b=H5X056fsDlNYU2vmR2oc32OIptpT+s4CEmAxYiYLYjtKwZ46CpNONZ4107uuFmZkejIvT2ygPXtbAEcHC7sHyjegmNO76pkrBc/HT2v2YlXgrgYCeN04tMBMJvvoWqRyKGgueHrByi93gI26/mKd+XTC+FwVQIJtB/yPhxD0T7rvo3Hh4qQbg3umKuzY8eNXcdSKhMl6MnACXPjcsLVCCwKd9w+jjmzzBNig2zkc2Kt01+9hV60VdTHefTOyTzj2elHXN46l3iaIrg+ZnI0bVAWziYgJujuwkEuSRGv0FBhjHu/CPuFVvj40tZ/S5hykNAYI5uc7CceukitDtIe3yw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=frW9FvbfUyxc5QuRRwMwPjpsQmRxeN0doA3VrkWeuNa/APIspT6dQLeJLhc+bPlK9AMA4IOWZG7NwkuoCsa4AyzanvJ5NljIEFINwLzsuPrBZ9QzAXZVPhk0uTFtc8NIXyvvUE5dhN+w0DJS4GbWJI7EqdtZ3XappazlBrKCzWExaRPXuKDMDqmUuVZNU/66TO3Cd6YxHAYGyepGQxG9BIQlRlcZkwSe/xy6wg9qtvCQqDXktOshm3Xn/+TVIrhqRZeq8KmPkNdWFPuKoy2qdh+1BaxeH8waq+ERfXQPkogOr3zSgYNTTkQE3JnLY6RhjfBV1E57Ftys0qbwJ/JZGg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.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:48:36 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 14.12.2021 12:41, Roger Pau Monné wrote:
> 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'm not sure I understand what you're after. The markers say "This
2^^marker aligned range is contiguous" (including the case of
contiguously clear). And they go into a vendor dependent ignored
4-bit field in each PTE. (Obviously odd numbered PTEs won't ever
be updated from holding a zero marker.)

An intermediate page table is eligible for replacement when the
marker of entry 0 is 9.

>>>> "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.

Well, yes, in order to re-coalesce _some_ extra cost is to be paid in
any event.

Jan




 


Rackspace

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