linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Palmer Dabbelt <palmer@dabbelt.com>
To: vincent.chen@sifive.com
Cc: vincent.chen@sifive.com, linux-riscv@lists.infradead.org,
	deanbo422@gmail.com, Paul Walmsley <paul.walmsley@sifive.com>
Subject: Re: [PATCH 0/2] solve static percpu symbol issue in module and refine code model of module
Date: Thu, 27 Feb 2020 14:30:52 -0800 (PST)	[thread overview]
Message-ID: <mhng-d41d2239-32da-45af-8650-ecc60449578e@palmerdabbelt-glaptop1> (raw)
In-Reply-To: <1582253275-28181-1-git-send-email-vincent.chen@sifive.com>

On Thu, 20 Feb 2020 18:47:53 PST (-0800), vincent.chen@sifive.com wrote:
> The compiler uses the PIC-relative method to access static variables
> instead of GOT when the code model is PIC. Therefore, the limitation of
> the access range from the instruction to the symbol address is +-2GB.
> Under this circumstance, the kernel cannot load a kernel module if this
> module has static per-CPU symbols declared by DEFINE_PER_CPU(). The reason
> is that kernel relocates the .data..percpu section of the kernel module to
> the end of kernel's .data..percpu. Hence, the distance between the per-CPU
> symbols and the instruction will exceed the 2GB limits. To solve this
> problem, the kernel should place the loaded module in the memory area
> [&_end-2G, VMALLOC_END].
>
> Because the loaded module locates in the region [&_end-2G,VMALLOC_END]
> at runtime, the distance from the module start to the end of the kernel
> image does not exceed 2GB. Hence, the second patch changes the code model
> of the kernel module from PIC to medany to improve the performance of data
> access.
>
> Changes from v1->v2
> 1. Unify the definition of VMALLOC_MODULE_START
> 2. Modify the indent
>
> Vincent Chen (2):
>   riscv: avoid the PIC offset of static percpu data in module beyond 2G
>     limits
>   riscv: Replace PIC with medany to improve data accessing in module
>
>  arch/riscv/Makefile        |  6 ++++--
>  arch/riscv/kernel/module.c | 18 ++++++++++++++++++
>  2 files changed, 22 insertions(+), 2 deletions(-)

Looking at this again, I think this is actually a good candidate for fixes.
Unless there's any opposition I'll target it for rc5.  It's on fixes.

Thanks!


  parent reply	other threads:[~2020-02-27 22:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-21  2:47 [PATCH 0/2] solve static percpu symbol issue in module and refine code model of module Vincent Chen
2020-02-21  2:47 ` [PATCH V2 1/2] riscv: avoid the PIC offset of static percpu data in module beyond 2G limits Vincent Chen
2020-02-21  2:47 ` [PATCH V2 2/2] riscv: Change code model of module to medany to improve data accessing Vincent Chen
2020-02-27 22:30 ` Palmer Dabbelt [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-02-19  7:28 [PATCH 0/2] solve static percpu symbol issue in module and refine code model of module Vincent Chen

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=mhng-d41d2239-32da-45af-8650-ecc60449578e@palmerdabbelt-glaptop1 \
    --to=palmer@dabbelt.com \
    --cc=deanbo422@gmail.com \
    --cc=linux-riscv@lists.infradead.org \
    --cc=paul.walmsley@sifive.com \
    --cc=vincent.chen@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;
as well as URLs for NNTP newsgroup(s).