[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: Mon, 17 Jul 2023 17:26:33 +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=fFizzRq6ubBUv8UnCTIZeEGNkuJ58yYStXVp4GsQk9I=; b=duh2Iw/FQjv0/INP53xz8Dh/qdTOmWEKG6DmxGKXssUKBAxPKoV+/6FEO2XA6DbRQuRGWqcVS7VJTclp1FqPrJTlHIRswQdDerjFCbkK+7aOsXBB3+AeqVHmbcx9vLjoucFeqCTA/MQD+M0ciLHlos5XbF1Fb3TSug/qil24WEXJvhE+lRnelqEsxAadjJoWMH+qDOaI2uqrdOjtgJAyKfsELKyo/qcIelvdXSf/JtjkGNaA0ZmK4cTVUpWC1E9DpsGLdECAVhicTq/0N/bjabOUOHzgJ7sXgImrEi/sHzSY3hsHERccMUiqNp3b3875pFUkb9q+u+nvlhSrZ7FD3w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UOWal60g7JqN2Dwdjau/eEo0roAp0PQISj+sk3AawR/rGfD1VtP85gpyh7IAJT0AesC9mFySo9L0gx/txYCJPiTwbfbAB8gKPSuU68le0o6uJDsQzLrsqQrTI0P0xNH6Matf8D4abgXa+CLY1Dc0tOnOOeEtIZszVCHtBCiS5KgifGShIugkpq4LDF/55cIEVz+TC34E6ojhYkFiFwnawNTsVnLwgV6ucusVDqqAuAJdpv4uKoBsKr4tvQhBSZP8X1DoSY/5P5FUwRquwjrXx/ZoqEpcZrc9qKhjJHcDfE3bOdib6vt2VdASf9cTDhKpnJ8puHk7BjpjSeh7ZQ5DYw==
  • 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: Mon, 17 Jul 2023 15:26:46 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 17.07.2023 17:17, Alejandro Vallejo wrote:
> On Fri, Jul 14, 2023 at 12:36:11PM +0200, Jan Beulich wrote:
>> 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.)
> 
> Like this?
> 
> ```
>  * 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 may
>  *   have a knock-on effect on the directmap, as "compressed" pfns may not
>  *   have corresponding mapped frames.
> ```
> 
> If so, sure. I don't mind either way. I'm happy for those 2 _may_s to be 
> added. 

Yes please.

Thanks, Jan



 


Rackspace

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