From: Alex Ghiti <alex@ghiti.fr>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Palmer Dabbelt <palmer@dabbelt.com>
Cc: mpe@ellerman.id.au, paulus@samba.org,
Paul Walmsley <paul.walmsley@sifive.com>,
aou@eecs.berkeley.edu, Anup Patel <Anup.Patel@wdc.com>,
Atish Patra <Atish.Patra@wdc.com>,
zong.li@sifive.com, linux-kernel@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org,
linux-mm@kvack.org
Subject: Re: [PATCH v5 1/4] riscv: Move kernel mapping to vmalloc zone
Date: Thu, 23 Jul 2020 01:21:50 -0400 [thread overview]
Message-ID: <cade70e2-0179-2650-41c5-036679aaf30c@ghiti.fr> (raw)
In-Reply-To: <54af168083aee9dbda1b531227521a26b77ba2c8.camel@kernel.crashing.org>
Hi Benjamin,
Le 7/21/20 à 7:11 PM, Benjamin Herrenschmidt a écrit :
> On Tue, 2020-07-21 at 14:36 -0400, Alex Ghiti wrote:
>>>> I guess I don't understand why this is necessary at all.
>>>> Specifically: why
>>>> can't we just relocate the kernel within the linear map? That would
>>>> let the
>>>> bootloader put the kernel wherever it wants, modulo the physical
>>>> memory size we
>>>> support. We'd need to handle the regions that are coupled to the
>>>> kernel's
>>>> execution address, but we could just put them in an explicit memory
>>>> region
>>>> which is what we should probably be doing anyway.
>>>
>>> Virtual relocation in the linear mapping requires to move the kernel
>>> physically too. Zong implemented this physical move in its KASLR RFC
>>> patchset, which is cumbersome since finding an available physical spot
>>> is harder than just selecting a virtual range in the vmalloc range.
>>>
>>> In addition, having the kernel mapping in the linear mapping prevents
>>> the use of hugepage for the linear mapping resulting in performance loss
>>> (at least for the GB that encompasses the kernel).
>>>
>>> Why do you find this "ugly" ? The vmalloc region is just a bunch of
>>> available virtual addresses to whatever purpose we want, and as noted by
>>> Zong, arm64 uses the same scheme.
>
> I don't get it :-)
>
> At least on powerpc we move the kernel in the linear mapping and it
> works fine with huge pages, what is your problem there ? You rely on
> punching small-page size holes in there ?
>
ARCH_HAS_STRICT_KERNEL_RWX prevents the use of a hugepage for the kernel
mapping in the direct mapping as it sets different permissions to
different part of the kernel (data, text..etc).
> At least in the old days, there were a number of assumptions that
> the kernel text/data/bss resides in the linear mapping.
>
> If you change that you need to ensure that it's still physically
> contiguous and you'll have to tweak __va and __pa, which might induce
> extra overhead.
>
Yes that's done in this patch and indeed there is an overhead to those
functions.
> Cheers,
> Ben.
>
>
Thanks,
Alex
WARNING: multiple messages have this Message-ID (diff)
From: Alex Ghiti <alex@ghiti.fr>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Palmer Dabbelt <palmer@dabbelt.com>
Cc: aou@eecs.berkeley.edu, linux-mm@kvack.org, mpe@ellerman.id.au,
Anup Patel <Anup.Patel@wdc.com>,
linux-kernel@vger.kernel.org, Atish Patra <Atish.Patra@wdc.com>,
paulus@samba.org, zong.li@sifive.com,
Paul Walmsley <paul.walmsley@sifive.com>,
linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v5 1/4] riscv: Move kernel mapping to vmalloc zone
Date: Thu, 23 Jul 2020 01:21:50 -0400 [thread overview]
Message-ID: <cade70e2-0179-2650-41c5-036679aaf30c@ghiti.fr> (raw)
In-Reply-To: <54af168083aee9dbda1b531227521a26b77ba2c8.camel@kernel.crashing.org>
Hi Benjamin,
Le 7/21/20 à 7:11 PM, Benjamin Herrenschmidt a écrit :
> On Tue, 2020-07-21 at 14:36 -0400, Alex Ghiti wrote:
>>>> I guess I don't understand why this is necessary at all.
>>>> Specifically: why
>>>> can't we just relocate the kernel within the linear map? That would
>>>> let the
>>>> bootloader put the kernel wherever it wants, modulo the physical
>>>> memory size we
>>>> support. We'd need to handle the regions that are coupled to the
>>>> kernel's
>>>> execution address, but we could just put them in an explicit memory
>>>> region
>>>> which is what we should probably be doing anyway.
>>>
>>> Virtual relocation in the linear mapping requires to move the kernel
>>> physically too. Zong implemented this physical move in its KASLR RFC
>>> patchset, which is cumbersome since finding an available physical spot
>>> is harder than just selecting a virtual range in the vmalloc range.
>>>
>>> In addition, having the kernel mapping in the linear mapping prevents
>>> the use of hugepage for the linear mapping resulting in performance loss
>>> (at least for the GB that encompasses the kernel).
>>>
>>> Why do you find this "ugly" ? The vmalloc region is just a bunch of
>>> available virtual addresses to whatever purpose we want, and as noted by
>>> Zong, arm64 uses the same scheme.
>
> I don't get it :-)
>
> At least on powerpc we move the kernel in the linear mapping and it
> works fine with huge pages, what is your problem there ? You rely on
> punching small-page size holes in there ?
>
ARCH_HAS_STRICT_KERNEL_RWX prevents the use of a hugepage for the kernel
mapping in the direct mapping as it sets different permissions to
different part of the kernel (data, text..etc).
> At least in the old days, there were a number of assumptions that
> the kernel text/data/bss resides in the linear mapping.
>
> If you change that you need to ensure that it's still physically
> contiguous and you'll have to tweak __va and __pa, which might induce
> extra overhead.
>
Yes that's done in this patch and indeed there is an overhead to those
functions.
> Cheers,
> Ben.
>
>
Thanks,
Alex
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Alex Ghiti <alex@ghiti.fr>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Palmer Dabbelt <palmer@dabbelt.com>
Cc: aou@eecs.berkeley.edu, linux-mm@kvack.org,
Anup Patel <Anup.Patel@wdc.com>,
linux-kernel@vger.kernel.org, Atish Patra <Atish.Patra@wdc.com>,
paulus@samba.org, zong.li@sifive.com,
Paul Walmsley <paul.walmsley@sifive.com>,
linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v5 1/4] riscv: Move kernel mapping to vmalloc zone
Date: Thu, 23 Jul 2020 01:21:50 -0400 [thread overview]
Message-ID: <cade70e2-0179-2650-41c5-036679aaf30c@ghiti.fr> (raw)
In-Reply-To: <54af168083aee9dbda1b531227521a26b77ba2c8.camel@kernel.crashing.org>
Hi Benjamin,
Le 7/21/20 à 7:11 PM, Benjamin Herrenschmidt a écrit :
> On Tue, 2020-07-21 at 14:36 -0400, Alex Ghiti wrote:
>>>> I guess I don't understand why this is necessary at all.
>>>> Specifically: why
>>>> can't we just relocate the kernel within the linear map? That would
>>>> let the
>>>> bootloader put the kernel wherever it wants, modulo the physical
>>>> memory size we
>>>> support. We'd need to handle the regions that are coupled to the
>>>> kernel's
>>>> execution address, but we could just put them in an explicit memory
>>>> region
>>>> which is what we should probably be doing anyway.
>>>
>>> Virtual relocation in the linear mapping requires to move the kernel
>>> physically too. Zong implemented this physical move in its KASLR RFC
>>> patchset, which is cumbersome since finding an available physical spot
>>> is harder than just selecting a virtual range in the vmalloc range.
>>>
>>> In addition, having the kernel mapping in the linear mapping prevents
>>> the use of hugepage for the linear mapping resulting in performance loss
>>> (at least for the GB that encompasses the kernel).
>>>
>>> Why do you find this "ugly" ? The vmalloc region is just a bunch of
>>> available virtual addresses to whatever purpose we want, and as noted by
>>> Zong, arm64 uses the same scheme.
>
> I don't get it :-)
>
> At least on powerpc we move the kernel in the linear mapping and it
> works fine with huge pages, what is your problem there ? You rely on
> punching small-page size holes in there ?
>
ARCH_HAS_STRICT_KERNEL_RWX prevents the use of a hugepage for the kernel
mapping in the direct mapping as it sets different permissions to
different part of the kernel (data, text..etc).
> At least in the old days, there were a number of assumptions that
> the kernel text/data/bss resides in the linear mapping.
>
> If you change that you need to ensure that it's still physically
> contiguous and you'll have to tweak __va and __pa, which might induce
> extra overhead.
>
Yes that's done in this patch and indeed there is an overhead to those
functions.
> Cheers,
> Ben.
>
>
Thanks,
Alex
next prev parent reply other threads:[~2020-07-23 5:22 UTC|newest]
Thread overview: 89+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-07 7:59 [PATCH v5 0/4] vmalloc kernel mapping and relocatable kernel Alexandre Ghiti
2020-06-07 7:59 ` [PATCH v5 1/4] riscv: Move kernel mapping to vmalloc zone Alexandre Ghiti
2020-06-11 21:34 ` Atish Patra
2020-06-11 21:34 ` Atish Patra
2020-06-11 21:34 ` Atish Patra
2020-06-12 12:30 ` Alex Ghiti
2020-06-12 12:30 ` Alex Ghiti
2020-06-12 12:30 ` Alex Ghiti
2020-07-09 5:05 ` Palmer Dabbelt
2020-07-09 5:05 ` Palmer Dabbelt
2020-07-09 5:05 ` Palmer Dabbelt
2020-07-09 8:15 ` Zong Li
2020-07-09 8:15 ` Zong Li
2020-07-09 8:15 ` Zong Li
2020-07-09 11:11 ` Alex Ghiti
2020-07-09 11:11 ` Alex Ghiti
2020-07-09 11:11 ` Alex Ghiti
2020-07-21 18:36 ` Alex Ghiti
2020-07-21 18:36 ` Alex Ghiti
2020-07-21 18:36 ` Alex Ghiti
2020-07-21 19:05 ` Palmer Dabbelt
2020-07-21 19:05 ` Palmer Dabbelt
2020-07-21 19:05 ` Palmer Dabbelt
2020-07-21 23:12 ` Benjamin Herrenschmidt
2020-07-21 23:12 ` Benjamin Herrenschmidt
2020-07-21 23:12 ` Benjamin Herrenschmidt
2020-07-21 23:48 ` Palmer Dabbelt
2020-07-21 23:48 ` Palmer Dabbelt
2020-07-21 23:48 ` Palmer Dabbelt
2020-07-22 2:21 ` Benjamin Herrenschmidt
2020-07-22 2:21 ` Benjamin Herrenschmidt
2020-07-22 2:21 ` Benjamin Herrenschmidt
2020-07-22 4:50 ` Michael Ellerman
2020-07-22 4:50 ` Michael Ellerman
2020-07-22 4:50 ` Michael Ellerman
2020-07-22 5:46 ` Palmer Dabbelt
2020-07-22 5:46 ` Palmer Dabbelt
2020-07-22 5:46 ` Palmer Dabbelt
2020-07-22 9:43 ` Arnd Bergmann
2020-07-22 9:43 ` Arnd Bergmann
2020-07-22 9:43 ` Arnd Bergmann
2020-07-22 9:43 ` Arnd Bergmann
2020-07-22 19:52 ` Palmer Dabbelt
2020-07-22 19:52 ` Palmer Dabbelt
2020-07-22 19:52 ` Palmer Dabbelt
2020-07-22 20:22 ` Arnd Bergmann
2020-07-22 20:22 ` Arnd Bergmann
2020-07-22 20:22 ` Arnd Bergmann
2020-07-22 20:22 ` Arnd Bergmann
2020-07-22 21:05 ` Atish Patra
2020-07-22 21:05 ` Atish Patra
2020-07-22 21:05 ` Atish Patra
2020-07-22 21:05 ` Atish Patra
2020-07-24 7:20 ` Arnd Bergmann
2020-07-24 7:20 ` Arnd Bergmann
2020-07-24 7:20 ` Arnd Bergmann
2020-07-24 7:20 ` Arnd Bergmann
2020-07-23 5:32 ` Alex Ghiti
2020-07-23 5:32 ` Alex Ghiti
2020-07-23 5:32 ` Alex Ghiti
2020-07-21 23:11 ` Benjamin Herrenschmidt
2020-07-21 23:11 ` Benjamin Herrenschmidt
2020-07-21 23:11 ` Benjamin Herrenschmidt
2020-07-21 23:36 ` Palmer Dabbelt
2020-07-21 23:36 ` Palmer Dabbelt
2020-07-21 23:36 ` Palmer Dabbelt
2020-07-23 5:36 ` Alex Ghiti
2020-07-23 5:36 ` Alex Ghiti
2020-07-23 5:36 ` Alex Ghiti
2020-07-23 5:21 ` Alex Ghiti [this message]
2020-07-23 5:21 ` Alex Ghiti
2020-07-23 5:21 ` Alex Ghiti
2020-07-23 22:33 ` Benjamin Herrenschmidt
2020-07-23 22:33 ` Benjamin Herrenschmidt
2020-07-23 22:33 ` Benjamin Herrenschmidt
2020-07-24 8:14 ` Arnd Bergmann
2020-07-24 8:14 ` Arnd Bergmann
2020-07-24 8:14 ` Arnd Bergmann
2020-07-24 8:14 ` Arnd Bergmann
2020-06-07 7:59 ` [PATCH v5 2/4] riscv: Introduce CONFIG_RELOCATABLE Alexandre Ghiti
2020-06-07 7:59 ` Alexandre Ghiti
2020-06-10 14:10 ` Jerome Forissier
2020-06-11 19:43 ` Alex Ghiti
2020-06-07 7:59 ` [PATCH v5 3/4] powerpc: Move script to check relocations at compile time in scripts/ Alexandre Ghiti
2020-06-07 7:59 ` Alexandre Ghiti
2020-06-07 7:59 ` [PATCH v5 4/4] riscv: Check relocations at compile time Alexandre Ghiti
2020-06-07 7:59 ` Alexandre Ghiti
2020-07-08 4:21 ` [PATCH v5 0/4] vmalloc kernel mapping and relocatable kernel Alex Ghiti
2020-07-08 4:21 ` Alex Ghiti
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=cade70e2-0179-2650-41c5-036679aaf30c@ghiti.fr \
--to=alex@ghiti.fr \
--cc=Anup.Patel@wdc.com \
--cc=Atish.Patra@wdc.com \
--cc=aou@eecs.berkeley.edu \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=paulus@samba.org \
--cc=zong.li@sifive.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.