mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alex Ghiti <alex@ghiti.fr>
To: "Sunnanyong (Nanyong Sun,
	Intelligent Computing Solution Development Dep)"
	<sunnanyong@huawei.com>,
	paul.walmsley@sifive.com, palmer@dabbelt.com,
	aou@eecs.berkeley.edu, anup.patel@wdc.com
Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	palmerdabbelt@google.com, atish.patra@wdc.com,
	wangkefeng.wang@huawei.com
Subject: Re: [PATCH -next] riscv: mm: remove redundant trampoline PGD for 64bit
Date: Wed, 28 Jul 2021 08:25:48 +0200	[thread overview]
Message-ID: <2e4ea006-5a8d-3578-1cba-363b7ba37e6d@ghiti.fr> (raw)
In-Reply-To: <fe5c5f82-2528-caf9-9bd4-09987bdec05c@huawei.com>

Hi Nanyong,

Le 28/07/2021 à 05:09, Sunnanyong (Nanyong Sun, Intelligent Computing 
Solution Development Dep) a écrit :
> 在 2021/6/29 21:01, Alex Ghiti 写道:
> 
>> Hi Nanyong,
>>
>> Le 27/05/2021 à 16:48, Nanyong Sun a écrit :
>>> Remove redundant trampoline PGD for 64bit and add more comment
>>> for why 32bit systems need trampoline PGD.
>>>
>>> There was a patch and discussion similar to this,refer to
>>> the link [1][2].
>>>
>>> The trampoline PGD is redundant for 64bit systems because:
>>> 1. The early PGD covers the entire kernel mapping. Directly
>>> loading early PGD can achieve the result in boot stage.
>>> A more trampoline PGD makes code hard to understand.
>>> 2. Directly loading early PGD is safe in 64bit systems since
>>> the kernel virtual address starts as 0xFFFFxxxxxxxxxxxx,
>>> which has a very big gap with RAM address.It won't fall into
>>> the corner case that 32bit system worrys.
>>> 3. Remove redundant trampoline PGD can benefit to code maintaince,
>>> because 64bit systems have more page table levels.For example:
>>> If we want to support SV48 which has 4 page table levels, we have
>>> to add a trampoline_pud and insert it before trampoline_pmd.
>>
>> I do agree with your last point about code maintenance and this would 
>> be a welcome improvement before I respin my sv48 series.
>>
>> Some comments below though.
>>
>>>
>>> Reference link:
>>> [1]https://lore.kernel.org/linux-riscv/20190325092234.5451-4-anup.patel@wdc.com/ 
>>>
>>> [2]https://lkml.org/lkml/2019/3/28/147
>>>
>>> Signed-off-by: Nanyong Sun <sunnanyong@huawei.com>
>>> ---
>>>   arch/riscv/kernel/head.S | 13 +++++++++++--
>>>   arch/riscv/mm/init.c     | 21 +++++++--------------
>>>   2 files changed, 18 insertions(+), 16 deletions(-)
>>>
>>> diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S
>>> index 89cc58ab52b4..1897b17c5fcc 100644
>>> --- a/arch/riscv/kernel/head.S
>>> +++ b/arch/riscv/kernel/head.S
>>> @@ -93,12 +93,18 @@ relocate:
>>>       add a2, a2, a1
>>>       csrw CSR_TVEC, a2
>>
>> This is not needed in 64-bit then.
>>
>>
> I'm afraid this is still needed for 64-bit, which can convert the 
> physical address world to the virtual address world.
> 
> I also have made a experiment, it could not boot up if this is deleted.
> 

Yes you're right, sorry about that.

>> Thanks,
>>
>> Alex
>> .
> 
> Hi Alex,
> 
>      Very thanks for your carefully review, I have updated to version 
> two just now : )
> 
> 

Thanks, I'll take a look.

Alex

> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv

      reply	other threads:[~2021-07-28  6:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-27 14:48 Nanyong Sun
2021-06-17  9:38 ` Sunnanyong (Nanyong Sun, Intelligent Computing Solution Development Dep)
2021-06-29 13:01 ` Alex Ghiti
2021-07-28  3:09   ` Sunnanyong (Nanyong Sun, Intelligent Computing Solution Development Dep)
2021-07-28  6:25     ` Alex Ghiti [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2e4ea006-5a8d-3578-1cba-363b7ba37e6d@ghiti.fr \
    --to=alex@ghiti.fr \
    --cc=anup.patel@wdc.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=atish.patra@wdc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=palmerdabbelt@google.com \
    --cc=paul.walmsley@sifive.com \
    --cc=sunnanyong@huawei.com \
    --cc=wangkefeng.wang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®