From: Michael Ellerman <mpe@ellerman.id.au>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Palmer Dabbelt <palmer@dabbelt.com>
Cc: alex@ghiti.fr, 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: Wed, 22 Jul 2020 14:50:42 +1000 [thread overview]
Message-ID: <87sgdkqhjx.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <bb461dde0df3eaf0bed949eebf0657b227431bb3.camel@kernel.crashing.org>
Benjamin Herrenschmidt <benh@kernel.crashing.org> writes:
> On Tue, 2020-07-21 at 16:48 -0700, Palmer Dabbelt wrote:
>> > Why ? Branch distance limits ? You can't use trampolines ?
>>
>> Nothing fundamental, it's just that we don't have a large code model in the C
>> compiler. As a result all the global symbols are resolved as 32-bit
>> PC-relative accesses. We could fix this with a fast large code model, but then
>> the kernel would need to relax global symbol references in modules and we don't
>> even do that for the simple code models we have now. FWIW, some of the
>> proposed large code models are essentially just split-PLT/GOT and therefor
>> don't require relaxation, but at that point we're essentially PIC until we
>> have more that 2GiB of kernel text -- and even then, we keep all the
>> performance issues.
>
> My memory might be out of date but I *think* we do it on powerpc
> without going to a large code model, but just having the in-kernel
> linker insert trampolines.
We build modules with the large code model, and always have AFAIK:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/powerpc/Makefile?commit=4fa640dc52302b5e62b01b05c755b055549633ae#n129
# -mcmodel=medium breaks modules because it uses 32bit offsets from
# the TOC pointer to create pointers where possible. Pointers into the
# percpu data area are created by this method.
#
# The kernel module loader relocates the percpu data section from the
# original location (starting with 0xd...) to somewhere in the base
# kernel percpu data space (starting with 0xc...). We need a full
# 64bit relocation for this to work, hence -mcmodel=large.
KBUILD_CFLAGS_MODULE += -mcmodel=large
We also insert trampolines for branches, but IIUC that's a separate
issue.
cheers
next prev parent reply other threads:[~2020-07-23 2:19 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mhng-831c4073-aefa-4aa0-a583-6a17f9aff9b7@palmerdabbelt-glaptop1>
[not found] ` <d7e3cbb7-c12a-bce2-f1db-c336d15f74bd@ghiti.fr>
2020-07-21 18:36 ` Alex Ghiti
2020-07-21 19:05 ` Palmer Dabbelt
2020-07-21 23:12 ` Benjamin Herrenschmidt
2020-07-21 23:48 ` Palmer Dabbelt
2020-07-22 2:21 ` Benjamin Herrenschmidt
2020-07-22 4:50 ` Michael Ellerman [this message]
2020-07-22 5:46 ` Palmer Dabbelt
2020-07-22 9:43 ` Arnd Bergmann
2020-07-22 19:52 ` Palmer Dabbelt
2020-07-22 20:22 ` Arnd Bergmann
2020-07-22 21:05 ` Atish Patra
2020-07-24 7:20 ` Arnd Bergmann
2020-07-23 5:32 ` Alex Ghiti
2020-07-21 23:11 ` Benjamin Herrenschmidt
2020-07-21 23:36 ` Palmer Dabbelt
2020-07-23 5:36 ` Alex Ghiti
2020-07-23 5:21 ` Alex Ghiti
2020-07-23 22:33 ` Benjamin Herrenschmidt
2020-07-24 8:14 ` Arnd Bergmann
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=87sgdkqhjx.fsf@mpe.ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=Anup.Patel@wdc.com \
--cc=Atish.Patra@wdc.com \
--cc=alex@ghiti.fr \
--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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox