From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5633CC7EE23 for ; Fri, 26 May 2023 16:38:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236611AbjEZQi0 (ORCPT ); Fri, 26 May 2023 12:38:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230041AbjEZQiY (ORCPT ); Fri, 26 May 2023 12:38:24 -0400 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::222]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 828F9BC for ; Fri, 26 May 2023 09:38:19 -0700 (PDT) X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr Received: by mail.gandi.net (Postfix) with ESMTPSA id 01FAF40009; Fri, 26 May 2023 16:38:14 +0000 (UTC) Message-ID: Date: Fri, 26 May 2023 18:38:14 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH -fixes] riscv: Fix relocatable kernels with early alternatives using -fno-pie Content-Language: en-US To: Conor Dooley , Alexandre Ghiti Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Andreas Schwab , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org References: <20230526154630.289374-1-alexghiti@rivosinc.com> <20230526-clergyman-wriggly-accc659a3fad@spud> From: Alexandre Ghiti In-Reply-To: <20230526-clergyman-wriggly-accc659a3fad@spud> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/05/2023 18:24, 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 >> --- >> >> 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. Damn, that's going to ruin my long week-end...Thanks though, I'll try to figure out what's going on, too bad I don't have any thead boards! Thanks again, Alex > I didn't test on my unmatched. > > Thanks, > Conor. > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv