From: Conor Dooley <conor@kernel.org>
To: Alexandre Ghiti <alex@ghiti.fr>
Cc: Alexandre Ghiti <alexghiti@rivosinc.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Andreas Schwab <schwab@linux-m68k.org>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -fixes] riscv: Fix relocatable kernels with early alternatives using -fno-pie
Date: Sat, 27 May 2023 11:02:54 +0100 [thread overview]
Message-ID: <20230527-hyperlink-doctrine-ef22cfcb508a@spud> (raw)
In-Reply-To: <f6522c82-01bd-8a03-579d-a5b294784480@ghiti.fr>
[-- Attachment #1.1: Type: text/plain, Size: 2396 bytes --]
On Sat, May 27, 2023 at 11:13:18AM +0200, Alexandre Ghiti wrote:
>
> On 26/05/2023 18:35, Conor Dooley wrote:
> > On Fri, May 26, 2023 at 05:24:41PM +0100, Conor Dooley wrote:
> > > On Fri, May 26, 2023 at 05:46:30PM +0200, Alexandre Ghiti wrote:
> > > > Early alternatives are called with the mmu disabled, and then should not
> > > > access any global symbols through the GOT since it requires relocations,
> > > > relocations that we do before but *virtually*. So only use medany code
> > > > model for this early code.
> > > >
> > > > Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
> > > > ---
> > > >
> > > > Note that I'm not very happy with this fix, I think we need to put more
> > > > effort into "harmonizing" this very early code (ie before the mmu is
> > > > enabled) as it is spread between different locations and compiled
> > > > differently.
> > > Totally & I'll happily spend the time trying to review that work.
> > >
> > > > I'll work on that later, but for now, this fix does what is
> > > > needed to work (from my testing at least). Any Tested-by on the Unmatched
> > > > and T-head boards is welcome!
> > > On 6.4-rc1 & v6.4-rc1 + this patch, with CONFIG_RELOCATABLE added to my
> > > config, my Nezha fails to boot. There is no output whatsoever from the
> > > kernel. Turning off CONFIG_RELOCATABLE boots again.
> > I don't know if this is better or worse news, but same thing happens on
> > an icicle kit. What systems, other than QEMU, has the relocatable
> > eries been tested with, btw?
>
>
> I tested it on the Unmatched (Andreas did too).
Cool. I cracked out my unmatched and it has the same issue as the
icicle. Ditto my Visionfive v2. Here's my config.
https://raw.githubusercontent.com/ConchuOD/riscv-env/dev/conf/defconfig
A ~default qemu virt doesn't work either. (-m 2G -smp 5)
> Very weird it does not work on the icicle kit, there is no errata for this
> soc, so what gets executed this early for this soc? Do you know where it
> fails to boot? If you can debug, you should break on the address of the
> entry point (usually 0x8020_0000) since this is the stvec address, so when
> you get a trap, you will branch there, and then could you dump $sepc, $ra
> and $stval when you get there?
> Regarding the thead issue, I think the following should fix it:
It did not :/
Cheers,
Conor.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
[-- Attachment #2: Type: text/plain, Size: 161 bytes --]
_______________________________________________
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: Conor Dooley <conor@kernel.org>
To: Alexandre Ghiti <alex@ghiti.fr>
Cc: Alexandre Ghiti <alexghiti@rivosinc.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Andreas Schwab <schwab@linux-m68k.org>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -fixes] riscv: Fix relocatable kernels with early alternatives using -fno-pie
Date: Sat, 27 May 2023 11:02:54 +0100 [thread overview]
Message-ID: <20230527-hyperlink-doctrine-ef22cfcb508a@spud> (raw)
In-Reply-To: <f6522c82-01bd-8a03-579d-a5b294784480@ghiti.fr>
[-- Attachment #1: Type: text/plain, Size: 2396 bytes --]
On Sat, May 27, 2023 at 11:13:18AM +0200, Alexandre Ghiti wrote:
>
> On 26/05/2023 18:35, Conor Dooley wrote:
> > On Fri, May 26, 2023 at 05:24:41PM +0100, Conor Dooley wrote:
> > > On Fri, May 26, 2023 at 05:46:30PM +0200, Alexandre Ghiti wrote:
> > > > Early alternatives are called with the mmu disabled, and then should not
> > > > access any global symbols through the GOT since it requires relocations,
> > > > relocations that we do before but *virtually*. So only use medany code
> > > > model for this early code.
> > > >
> > > > Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
> > > > ---
> > > >
> > > > Note that I'm not very happy with this fix, I think we need to put more
> > > > effort into "harmonizing" this very early code (ie before the mmu is
> > > > enabled) as it is spread between different locations and compiled
> > > > differently.
> > > Totally & I'll happily spend the time trying to review that work.
> > >
> > > > I'll work on that later, but for now, this fix does what is
> > > > needed to work (from my testing at least). Any Tested-by on the Unmatched
> > > > and T-head boards is welcome!
> > > On 6.4-rc1 & v6.4-rc1 + this patch, with CONFIG_RELOCATABLE added to my
> > > config, my Nezha fails to boot. There is no output whatsoever from the
> > > kernel. Turning off CONFIG_RELOCATABLE boots again.
> > I don't know if this is better or worse news, but same thing happens on
> > an icicle kit. What systems, other than QEMU, has the relocatable
> > eries been tested with, btw?
>
>
> I tested it on the Unmatched (Andreas did too).
Cool. I cracked out my unmatched and it has the same issue as the
icicle. Ditto my Visionfive v2. Here's my config.
https://raw.githubusercontent.com/ConchuOD/riscv-env/dev/conf/defconfig
A ~default qemu virt doesn't work either. (-m 2G -smp 5)
> Very weird it does not work on the icicle kit, there is no errata for this
> soc, so what gets executed this early for this soc? Do you know where it
> fails to boot? If you can debug, you should break on the address of the
> entry point (usually 0x8020_0000) since this is the stvec address, so when
> you get a trap, you will branch there, and then could you dump $sepc, $ra
> and $stval when you get there?
> Regarding the thead issue, I think the following should fix it:
It did not :/
Cheers,
Conor.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2023-05-27 10:03 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-26 15:46 [PATCH -fixes] riscv: Fix relocatable kernels with early alternatives using -fno-pie Alexandre Ghiti
2023-05-26 15:46 ` Alexandre Ghiti
2023-05-26 16:24 ` Conor Dooley
2023-05-26 16:24 ` Conor Dooley
2023-05-26 16:35 ` Conor Dooley
2023-05-26 16:35 ` Conor Dooley
2023-05-27 9:13 ` Alexandre Ghiti
2023-05-27 9:13 ` Alexandre Ghiti
2023-05-27 10:02 ` Conor Dooley [this message]
2023-05-27 10:02 ` Conor Dooley
2023-05-28 13:00 ` Alexandre Ghiti
2023-05-28 13:00 ` Alexandre Ghiti
2023-05-28 13:12 ` Conor Dooley
2023-05-28 13:12 ` Conor Dooley
2023-05-28 13:42 ` Alexandre Ghiti
2023-05-28 13:42 ` Alexandre Ghiti
2023-05-28 13:56 ` Conor Dooley
2023-05-28 13:56 ` Conor Dooley
2023-05-29 18:51 ` Alexandre Ghiti
2023-05-29 18:51 ` Alexandre Ghiti
2023-05-29 19:06 ` Conor Dooley
2023-05-29 19:06 ` Conor Dooley
2023-05-29 19:37 ` Alexandre Ghiti
2023-05-29 19:37 ` Alexandre Ghiti
2023-05-30 11:27 ` Conor Dooley
2023-05-30 11:27 ` Conor Dooley
2023-05-30 14:33 ` Alexandre Ghiti
2023-05-30 14:33 ` Alexandre Ghiti
2023-05-30 17:47 ` Conor Dooley
2023-05-30 17:47 ` Conor Dooley
2023-05-30 18:04 ` Alexandre Ghiti
2023-05-30 18:04 ` Alexandre Ghiti
2023-05-30 20:22 ` Conor Dooley
2023-05-30 20:22 ` Conor Dooley
2023-05-31 7:26 ` Alexandre Ghiti
2023-05-31 7:26 ` Alexandre Ghiti
2023-05-31 9:32 ` Conor Dooley
2023-05-31 9:32 ` Conor Dooley
2023-05-31 11:03 ` Alexandre Ghiti
2023-05-31 11:03 ` Alexandre Ghiti
2023-05-26 16:38 ` Alexandre Ghiti
2023-05-26 16:38 ` Alexandre Ghiti
2023-05-31 15:03 ` Palmer Dabbelt
2023-05-31 15:03 ` Palmer Dabbelt
2023-05-31 15:10 ` patchwork-bot+linux-riscv
2023-05-31 15:10 ` patchwork-bot+linux-riscv
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=20230527-hyperlink-doctrine-ef22cfcb508a@spud \
--to=conor@kernel.org \
--cc=alex@ghiti.fr \
--cc=alexghiti@rivosinc.com \
--cc=aou@eecs.berkeley.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=schwab@linux-m68k.org \
/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.