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

Re: [PATCH v3 3/3] xen/riscv: introduce identity mapping


  • To: Oleksii <oleksii.kurochko@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 20 Jul 2023 16:06:55 +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=tXpx28HhuSXyy3ZIGUgg5vvDxd1cieZ6+priZYEauxM=; b=PtFN+1asFOA5jRoznJ2mf1VnRpcT//gacbVdGHVXeN++9vWPFlGUNCpX5Fi8tZqG1E36XMMInRaKeNS3PK9V/o+qioQ5Lccf3urPvU+Vohn36LL/HcuQjHcjgLzPhNprpaCTHY4NXR1MZKjv5GzhpV5J7Lg4jQvOiZWr+bCLPFbMGjzkjn3wdBtmZCIpGhRo5DuLuTAPOxr8nWGnjZTdDOypCAzI1gDqxVKXLSodBEhQWZOhKd5FxxwsprnB0YWUVIDbd0wjmPrv2IztfxbIDPhGvBGoU5m1R/iOdcvwK1MC38Gc6OMay9AtOp2qW1ygLQ/CGh6cdRWc99omweMCKA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k37neeL/b2ADppTgg0yenLMeJZ/SE373fCDs9Op3FtpvB/jEf1pIIy6XKbuucfr+jjVWSHiWQ+zTqEXH7+VuldL3r6tGtvoxu4XBo3B96aNGIqh1JrgTrHzQ00S7NnHFyFSittzT4NEp5XFBirY6m7XQ2OFw4MwaUgdSU/INZIwgQVOnXQJLt2mRtMnuWAayMrIn/O5ixrD1aXJSMd4/L4xn0U+4Xcsj7SWFh9T8JcDiIztBFAoLXm0i9QITYjTb5UHhdpn7kolth9SVB8iJmMvoHfAbdGAhaxUahrD19vpz8FTYPWFnInq77HVe10tXSx6zEN0asdQmDwZ3nT6zQA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Bob Eshleman <bobbyeshleman@xxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 20 Jul 2023 14:07:14 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 20.07.2023 15:34, Oleksii wrote:
> On Thu, 2023-07-20 at 12:29 +0200, Jan Beulich wrote:
>> On 20.07.2023 10:28, Oleksii wrote:
>>> On Thu, 2023-07-20 at 07:58 +0200, Jan Beulich wrote:
>>>> On 19.07.2023 18:35, Oleksii wrote:
>>>>> Then we will have completely different L0 tables for identity
>>>>> mapping
>>>>> and not identity and the code above will be correct.
>>>>
>>>> As long as Xen won't grow beyond 2Mb total. Considering that at
>>>> some point you may want to use large page mappings for .text,
>>>> .data, and .rodata, that alone would grow Xen to 6 Mb (or really
>>>> 8,
>>>> assuming .init goes separate as well). That's leaving aside the
>>>> realistic option of the mere sum of all sections being larger
>>>> than
>>>> 2. That said, even Arm64 with ACPI is still quite a bit below
>>>> 2Mb.
>>>> x86 is nearing 2.5 though in even a somewhat limited config;
>>>> allyesconfig may well be beyond that already.
>>> I am missing something about Xen size. Lets assume that Xen will be
>>> mapped using only 4k pagees ( like it is done now ). Then if Xen
>>> will
>>> be more then 2Mb then only what will be changed is a number of page
>>> tables so it is only question of changing of PGTBL_INITIAL_COUNT (
>>> in
>>> case of RISC-V).
>>
>> And the way you do the tearing down of the transient 1:1 mapping.
> It looks like removing 1:1 mapping will be the same.
> 
> Let's assume that the size of Xen is 4 MB and that load and linker
> ranges don't overlap ( load and linker start address are 2Mb aligned ),
> and the difference between them isn't bigger than 1 GB. Then one L2
> page table, one L1 page table and two L0 page tables for identity
> mapping, and two L0 page tables for non-identity mapping are needed.
> Then at L1, we will have different indexes for load_start and
> linker_start. So what will be needed is to clean two L1 page table
> entries started from some index.
> 
> The only issue I see now is that it won't work in case if identity
> mapping crosses a 1 Gb boundary. Then for identity mapping, it will be
> needed two L1 page tables, and only one of them identity mapping will
> be removed.
> 
> Do I miss anything else?

Looks correct to me.

> Wouldn't it be better to take into account that now?

Sure, it's generally better to avoid leaving traps for someone to
fall into later.

Jan



 


Rackspace

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