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

Re: [PATCH v3] mm/pdx: Add comments throughout the codebase for pdx


  • To: Alejandro Vallejo <alejandro.vallejo@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 14 Jul 2023 12:36:11 +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=9+RaykPCRbdgeRyXofqTtk73lNViHXDMglaAipBLksg=; b=OTb6E3XgwXDU2Pfo3jjkMQY1AA1G8Nzux1Rq+203X8wD1jTjEzPPSpeE/I2y5/Kz3IqjyikHsSaRoCoP7zgAEVdJwPjhe5yYcRtkTxqw48iy6eh9XGiVQcpSmsOBwPrsQe/RSsMNg+PpF/9S97HbyXQcXmr861GlZtwfG6DkTSKEix0kjd92r4xKJr45oDR80QX482paRnt/wjOEQb1P1JyQwsIQd3SN9KBWYQLH0EhqToVPGs5K0+m/RdcaJXXGHX5cRTQhRuQgQfxJuUrgUYHe3qNJ2ZZxpK3RX8Kapew+Nc4ha/49JxKHq3JflIQ1ruWvW5ZBQNn7ZGGtAOITfw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MxBL9k1guvJu+LE4HgQJuH1nCDfgEAG39UvHcnkg6cTP2ZDhAk03aX6WX7Mf5iUCkjg0EoOaX2JlR2yuY/0154Y15r0mr6zy5fJRaxI/noLhklhPcZvm9u9utaoKYhzTR5vKAQbPSyBMUlq2bMFuLGW1xBiAqsixaBm/46NbXArf2EfB9V03R+gojT3LzCPnZDiAGmtLYNi0nBPCmUYBYACIdQy4zbj4a21Vu9VzJzChmaV6Om2q5n/HjYQ3KocYl6al/5+Z6zCerV2Eo/aRY48XhnwJnlDOjqqiCvxdPf9jAXynoPMNXuf3O7CzZ3Z1dy+tVPoNMhWn7ZvQxbkGZw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 14 Jul 2023 10:36:29 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 14.07.2023 12:27, Alejandro Vallejo wrote:
> On Thu, Jul 13, 2023 at 05:12:09PM +0200, Jan Beulich wrote:
>> On 07.07.2023 18:07, Alejandro Vallejo wrote:
>>> --- a/xen/include/xen/mm.h
>>> +++ b/xen/include/xen/mm.h
>>> @@ -31,6 +31,17 @@
>>>   *   (i.e. all devices assigned to) a guest share a single DMA address 
>>> space
>>>   *   and, by default, Xen will ensure dfn == pfn.
>>>   *
>>> + * pdx: Page InDeX
>>> + *   Indices into the frame table holding the per-page's book-keeping
>>> + *   metadata. A compression scheme may be used, so there's a possibly non
>>> + *   identity mapping between valid(mfn) <-> valid(pdx). See the comments
>>> + *   in pdx.c for an in-depth explanation of that mapping. This also has a
>>> + *   knock-on effect on the directmap, as "compressed" pfns have no
>>> + *   corresponding mapped frames.
>>
>> Didn't you mean to keep the directmap part optional,
> I did.
> 
>> which would call for saying "may" here (twice)?
> That paragraph as-is doesn't really mandate a directmap. It merely state
> that there are knock-on effects on directmap indexing, not that there's
> always a directmap to index.
> 
>> Yet then ...
>>
>>
>>> --- a/xen/include/xen/pdx.h
>>> +++ b/xen/include/xen/pdx.h
>>> @@ -1,6 +1,73 @@
>>>  #ifndef __XEN_PDX_H__
>>>  #define __XEN_PDX_H__
>>>  
>>> +/*
>>> + * PDX (Page inDeX)
>>> + *
>>> + * This file deals with optimisations pertaining to frame table and
>>> + * directmap indexing, A pdx is an index into the frame table, which
>>> + * typically also means an index into the directmap[1]. However, having an
>>> + * identity relationship between mfn and pdx could waste copious amounts of
>>> + * memory in empty frame table entries and page tables. There are some
>>> + * techniques to bring memory wastage down.
>>> + *
>>> + * [1] Some ports apply further modifications to a pdx before indexing the
>>> + *     directmap. This doesn't change the fact that the same compression
>>> + *     present in the frame table is also present in the directmap
>>> + *     whenever said map is present.
>>
>> .. you mention it here as non-optional as well. Didn't you tell me that
>> Arm doesn't use compressed indexes into the directmap?
>>
>> Jan
> 
> The [1] note states "whenever said map is present", meaning that it may not
> be present. Saying it's optional is a stretch though. It's not like we can
> choose right now.
> 
>> Didn't you tell me that Arm doesn't use compressed indexes into the 
>> directmap?
> arm32 doesn't have a directmap at all. arm64 uses biased pdx as indices
> (they are offset by a constant), so they are still subject to compression.

Hmm, then our understanding of "optional" was differing: I understood
"use of compressed indexes is optional", when you apparently meant
"the use of a directmap is optional". If this is the case, then I
agree with the chosen wording. (Nevertheless using the suggested "may"
wouldn't yield and incorrect outcome.)

Jan



 


Rackspace

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