Message ID | 20230321-kexec_clang16-v6-4-a2255e81ab45@chromium.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2669282vqo; Mon, 1 May 2023 05:50:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7PgcLQuWdbM37Y/XxHSNY7K+AptKATjlx/a3U+yajnQx2O7vBNoZ0dplg+mK5o4ZXeayLs X-Received: by 2002:a05:6a20:43ac:b0:f0:3e78:715b with SMTP id i44-20020a056a2043ac00b000f03e78715bmr15178839pzl.40.1682945429655; Mon, 01 May 2023 05:50:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682945429; cv=none; d=google.com; s=arc-20160816; b=0RoY2qi2SvsLujzt2xsc2RR1nFldCt9DBmtKAnoR17wrDDlxwYZMZMIjnY2H0CJfga /YECstZPGcKNSZXkNuaNQRHcl1fKkhws6lj32Y1bS6PCtYQPX5beOfB68yEgpY3AKKSu PInT+Zo8y1XLcR6x8os7Y+Yq56k5y7+M8AGoPphDgNf5ox9U0LXf313JrsDlbtPQx5Wt /WJngkC4stuyKsluj96IjvEuet84Gf+/0Dn0dzifyXBuEG5hEHPAMqsqb8dxGpQuzQA4 t/8Jfi+NOtgq669KKDrytj79rpEdZp2NRcyiLPO1HewMcucWilzDWySrL9DHva0ZwrS/ d2Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=vsOOlRTCOjL3abNi/3ZUSQqB4+vgvV69cdyU9ee1C48=; b=uA6NmQUD/bSzq0RBrRF4Scvuu0+o+j+9a84rLD9iaxhQA+a/GQ2hav2gj8jb4X+af3 ci30kBnynh51kFrl/EWaXEXkFDlAesBlH4PCDlL+IUHzWROO1Ca0u0H3tBggxkx+y5pt 5XEbmGBVwNHYHV6a6LVjZ+QVqVTjO83Rk6+El3GmhvHt7v3Y0XgwTUfL4DHT4Wj1TeNW xcdrLlv95pWn/1I5JkxL3zGNGP3ODVrIaBROnig42PddR717X2LWhfH1pCDHnrJ7SHgt NDb5A92fN0KydO22kQjdsYExDAVJpfvEwSQ1YeJWCcTUv4R1dX/NsWBxQYZUgRNJK86p 2bHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hODYeDeY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c20-20020a6566d4000000b00518d97e15ebsi27273148pgw.431.2023.05.01.05.50.15; Mon, 01 May 2023 05:50:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hODYeDeY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232586AbjEAMjO (ORCPT <rfc822;rbbytesnap@gmail.com> + 99 others); Mon, 1 May 2023 08:39:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232556AbjEAMjE (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 1 May 2023 08:39:04 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3452E58 for <linux-kernel@vger.kernel.org>; Mon, 1 May 2023 05:39:02 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-50bc4d96e14so8630207a12.1 for <linux-kernel@vger.kernel.org>; Mon, 01 May 2023 05:39:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682944742; x=1685536742; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=vsOOlRTCOjL3abNi/3ZUSQqB4+vgvV69cdyU9ee1C48=; b=hODYeDeYg6APhZAviVEDv24zkkV5PSyD9YF80bCIKMgiHcDDsd8y08C3drl6nvnGJD IlJxYRT/wEBGX7nbEciydDBBtR5sxWJSS+Q1JOTL+EYkrNHQvWMsz4+2JhTAsCU5cMFe Ea+MOxsYngr/dEQhvm3KkMoPZiJyiwADd2JrY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682944742; x=1685536742; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vsOOlRTCOjL3abNi/3ZUSQqB4+vgvV69cdyU9ee1C48=; b=cbvArH7xDGKhcS4k09RJUxv+BJTrExTjlxy5kT3W3uG3t1FcA1+eJe3CuRmeImImcp bIj9pc9VMVv2m6HCmjuMlhnfBE1L7JbFfLFkATCzi+9oS7eLYzPdCYnek5o+TT6+ZsML EzSM0iXP8Q9MN0ZKi5IR3R8hv0vMqp0o+GWdrLi51Mw6Q48m/rS81HB6cYn42Vxhsv15 t02vuUhf5s43gCuyVJzuzX75ii5Yl9ZCA3PPjwRYE1rBbBfS7+RLDh+VQsxhlj5SwxEN QkdqktPGBv9KrF8csIakzmM83hPuwVw4Nb14bKlHuvtHWgaKouplEV3/npntPGB3yxJ0 Vbbg== X-Gm-Message-State: AC+VfDzx6cMSNXL/c1U62x4ggOE3K31hTyPZMnLa1zG+i8Tt/LZpb2GA hKu+WFW8ABqSR7RslJimJob/2w== X-Received: by 2002:a05:6402:27c8:b0:504:77ed:5a33 with SMTP id c8-20020a05640227c800b0050477ed5a33mr5864584ede.8.1682944742259; Mon, 01 May 2023 05:39:02 -0700 (PDT) Received: from alco.roam.corp.google.com ([2620:0:1059:10:c573:159e:712e:688b]) by smtp.gmail.com with ESMTPSA id c8-20020aa7c988000000b0050bcbb5708asm146772edt.35.2023.05.01.05.39.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 05:39:02 -0700 (PDT) From: Ricardo Ribalda <ribalda@chromium.org> Date: Mon, 01 May 2023 14:38:22 +0200 Subject: [PATCH v6 4/4] risc/purgatory: Add linker script MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230321-kexec_clang16-v6-4-a2255e81ab45@chromium.org> References: <20230321-kexec_clang16-v6-0-a2255e81ab45@chromium.org> In-Reply-To: <20230321-kexec_clang16-v6-0-a2255e81ab45@chromium.org> To: Eric Biederman <ebiederm@xmission.com>, Philipp Rudo <prudo@linux.vnet.ibm.com>, Dave Young <dyoung@redhat.com>, Andrew Morton <akpm@linux-foundation.org>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>, Nathan Chancellor <nathan@kernel.org>, Tom Rix <trix@redhat.com>, Michael Ellerman <mpe@ellerman.id.au>, Nicholas Piggin <npiggin@gmail.com>, Christophe Leroy <christophe.leroy@csgroup.eu>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu> Cc: Baoquan He <bhe@redhat.com>, Philipp Rudo <prudo@redhat.com>, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Ross Zwisler <zwisler@google.com>, Steven Rostedt <rostedt@goodmis.org>, Simon Horman <horms@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, llvm@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, Ricardo Ribalda <ribalda@chromium.org>, stable@vger.kernel.org X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1219; i=ribalda@chromium.org; h=from:subject:message-id; bh=ECbK3ORJb/ox8qpp2VcGabf7Ou2PzFFDokGI84nq/PQ=; b=owEBbQKS/ZANAwAKAdE30T7POsSIAcsmYgBkT7Lc5MTx2hMC4Re9phVjZPNed9BIxos1Pxii0 61fGiCxDbqJAjMEAAEKAB0WIQREDzjr+/4oCDLSsx7RN9E+zzrEiAUCZE+y3AAKCRDRN9E+zzrE iJuYD/9j2b1eDvjy+uQCumtGC2Jn+H/Md0JWPsxPb46aNyMDJJYtpnBOkQyLCIR1Ro6iTpnQQLM +8uN/ou0X4CF9cfN+g6f5JwkPoQfQcP+jYNP8HE3vvJyaw+gY8gFKrsolGYojIu5+7EZscjeM+x 7hCRkxslbxzkKo8bCXJPNM5bL+TS+8voKLtJw5vxmDtH71krf0z6Gp38OUM1qbruri9kSi75MmP pPIc503fFiicjySfDDJ804XtSoK2FjXUVn96C+XtJdu8JE5WpzayNi5G1CCxtOHmymMyPL11Nyb +Y3kXDpLRgX+07NcFuZOiO/0ThN8bGM98On1cBYfS5PV2bqYo2Cv6+KOCjnObJd8T8zLrIWY31E dkIZGehfJGieHtPMQYd0Up0Q7UFloD9EOCUk3YXQjbVL5YW62U0ajBT0UqSNiyO8Fk5AdOGQnDv M1oDH7eB6zhw04nOc8MvRcEL1vb70bgueckn6cp6u0ViYD7VRwHLkKiDx9y2wl93EfhhVpu9EpQ 108x63OJbcTsVjOEtHREb8lzuERyPHJsPH5o49C5N+yZd7HKY8dMY7vi4/kdo4rqsrCdLSOYIRN nVm4G0/Z6eWsohGrZwA5weUUpMcYwEHd+mCMobjyQ8WPRg/nBapyYtxdaEgYMK3As9R4j0j3G0s Q5pwBDSsFyR/N1Q== X-Developer-Key: i=ribalda@chromium.org; a=openpgp; fpr=9EC3BB66E2FC129A6F90B39556A0D81F9F782DA9 X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764696187035255358?= X-GMAIL-MSGID: =?utf-8?q?1764696187035255358?= |
Series | kexec: Fix kexec_file_load for llvm16 with PGO | |
Commit Message
Ricardo Ribalda
May 1, 2023, 12:38 p.m. UTC
If PGO is enabled, the purgatory ends up with multiple .text sections.
This is not supported by kexec and crashes the system.
Cc: stable@vger.kernel.org
Fixes: 930457057abe ("kernel/kexec_file.c: split up __kexec_load_puragory")
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
arch/riscv/purgatory/Makefile | 5 +++++
1 file changed, 5 insertions(+)
Comments
On Mon, 01 May 2023 05:38:22 PDT (-0700), ribalda@chromium.org wrote: > If PGO is enabled, the purgatory ends up with multiple .text sections. > This is not supported by kexec and crashes the system. > > Cc: stable@vger.kernel.org > Fixes: 930457057abe ("kernel/kexec_file.c: split up __kexec_load_puragory") > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> > --- > arch/riscv/purgatory/Makefile | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/arch/riscv/purgatory/Makefile b/arch/riscv/purgatory/Makefile > index 5730797a6b40..cf3a44121a90 100644 > --- a/arch/riscv/purgatory/Makefile > +++ b/arch/riscv/purgatory/Makefile > @@ -35,6 +35,11 @@ CFLAGS_sha256.o := -D__DISABLE_EXPORTS > CFLAGS_string.o := -D__DISABLE_EXPORTS > CFLAGS_ctype.o := -D__DISABLE_EXPORTS > > +# When profile optimization is enabled, llvm emits two different overlapping > +# text sections, which is not supported by kexec. Remove profile optimization > +# flags. > +KBUILD_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%,$(KBUILD_CFLAGS)) > + > # When linking purgatory.ro with -r unresolved symbols are not checked, > # also link a purgatory.chk binary without -r to check for unresolved symbols. > PURGATORY_LDFLAGS := -e purgatory_start -z nodefaultlib Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
On Mon, May 1, 2023 at 5:39 AM Ricardo Ribalda <ribalda@chromium.org> wrote: > > If PGO is enabled, the purgatory ends up with multiple .text sections. > This is not supported by kexec and crashes the system. > > Cc: stable@vger.kernel.org > Fixes: 930457057abe ("kernel/kexec_file.c: split up __kexec_load_puragory") > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> Hi Ricardo, Thanks for the series. Does this patch 4/4 need a new online commit description? It's not adding a linker script (maybe an earlier version was). > --- > arch/riscv/purgatory/Makefile | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/arch/riscv/purgatory/Makefile b/arch/riscv/purgatory/Makefile > index 5730797a6b40..cf3a44121a90 100644 > --- a/arch/riscv/purgatory/Makefile > +++ b/arch/riscv/purgatory/Makefile > @@ -35,6 +35,11 @@ CFLAGS_sha256.o := -D__DISABLE_EXPORTS > CFLAGS_string.o := -D__DISABLE_EXPORTS > CFLAGS_ctype.o := -D__DISABLE_EXPORTS > > +# When profile optimization is enabled, llvm emits two different overlapping > +# text sections, which is not supported by kexec. Remove profile optimization > +# flags. > +KBUILD_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%,$(KBUILD_CFLAGS)) > + > # When linking purgatory.ro with -r unresolved symbols are not checked, > # also link a purgatory.chk binary without -r to check for unresolved symbols. > PURGATORY_LDFLAGS := -e purgatory_start -z nodefaultlib > > -- > 2.40.1.495.gc816e09b53d-goog >
Hi Nick Thanks for catching this. It should have said risc/purgatory: Remove profile optimization flags Will fix it on my local branch in case there is a next version of the series. Otherwise, please the maintainer fix the subject. Thanks! On Mon, 1 May 2023 at 18:19, Nick Desaulniers <ndesaulniers@google.com> wrote: > > On Mon, May 1, 2023 at 5:39 AM Ricardo Ribalda <ribalda@chromium.org> wrote: > > > > If PGO is enabled, the purgatory ends up with multiple .text sections. > > This is not supported by kexec and crashes the system. > > > > Cc: stable@vger.kernel.org > > Fixes: 930457057abe ("kernel/kexec_file.c: split up __kexec_load_puragory") > > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> > > Hi Ricardo, > Thanks for the series. Does this patch 4/4 need a new online commit > description? It's not adding a linker script (maybe an earlier version > was). > > > --- > > arch/riscv/purgatory/Makefile | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/arch/riscv/purgatory/Makefile b/arch/riscv/purgatory/Makefile > > index 5730797a6b40..cf3a44121a90 100644 > > --- a/arch/riscv/purgatory/Makefile > > +++ b/arch/riscv/purgatory/Makefile > > @@ -35,6 +35,11 @@ CFLAGS_sha256.o := -D__DISABLE_EXPORTS > > CFLAGS_string.o := -D__DISABLE_EXPORTS > > CFLAGS_ctype.o := -D__DISABLE_EXPORTS > > > > +# When profile optimization is enabled, llvm emits two different overlapping > > +# text sections, which is not supported by kexec. Remove profile optimization > > +# flags. > > +KBUILD_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%,$(KBUILD_CFLAGS)) > > + > > # When linking purgatory.ro with -r unresolved symbols are not checked, > > # also link a purgatory.chk binary without -r to check for unresolved symbols. > > PURGATORY_LDFLAGS := -e purgatory_start -z nodefaultlib > > > > -- > > 2.40.1.495.gc816e09b53d-goog > > > > > -- > Thanks, > ~Nick Desaulniers
On Mon, May 01, 2023 at 07:18:12PM +0200, Ricardo Ribalda wrote: > On Mon, 1 May 2023 at 18:19, Nick Desaulniers <ndesaulniers@google.com> wrote: > > > > On Mon, May 1, 2023 at 5:39 AM Ricardo Ribalda <ribalda@chromium.org> wrote: > > > > > > If PGO is enabled, the purgatory ends up with multiple .text sections. > > > This is not supported by kexec and crashes the system. > > > > > > Cc: stable@vger.kernel.org > > > Fixes: 930457057abe ("kernel/kexec_file.c: split up __kexec_load_puragory") > > > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> > > > > Hi Ricardo, > > Thanks for the series. Does this patch 4/4 need a new online commit > > description? It's not adding a linker script (maybe an earlier version > > was). > Thanks for catching this. It should have said > > risc/purgatory: Remove profile optimization flags ^^ Perhaps with the omitted v added too? Also while playing the $subject nitpicking game, is it not called "profile**-guided** optimisation" (and ditto in the comments)? Cheers, Conor. > Will fix it on my local branch in case there is a next version of the > series. Otherwise, please the maintainer fix the subject. > > > --- > > > arch/riscv/purgatory/Makefile | 5 +++++ > > > 1 file changed, 5 insertions(+) > > > > > > diff --git a/arch/riscv/purgatory/Makefile b/arch/riscv/purgatory/Makefile > > > index 5730797a6b40..cf3a44121a90 100644 > > > --- a/arch/riscv/purgatory/Makefile > > > +++ b/arch/riscv/purgatory/Makefile > > > @@ -35,6 +35,11 @@ CFLAGS_sha256.o := -D__DISABLE_EXPORTS > > > CFLAGS_string.o := -D__DISABLE_EXPORTS > > > CFLAGS_ctype.o := -D__DISABLE_EXPORTS > > > > > > +# When profile optimization is enabled, llvm emits two different overlapping > > > +# text sections, which is not supported by kexec. Remove profile optimization > > > +# flags. > > > +KBUILD_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%,$(KBUILD_CFLAGS)) > > > + > > > # When linking purgatory.ro with -r unresolved symbols are not checked, > > > # also link a purgatory.chk binary without -r to check for unresolved symbols. > > > PURGATORY_LDFLAGS := -e purgatory_start -z nodefaultlib > > > > > > -- > > > 2.40.1.495.gc816e09b53d-goog > > > > > > > > > -- > > Thanks, > > ~Nick Desaulniers > > > > -- > Ricardo Ribalda > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv
Hi Conor Fixed on my branch https://git.kernel.org/pub/scm/linux/kernel/git/ribalda/linux.git/commit/?h=b4/kexec_clang16&id=1e9cda9fa638cc72581986f60b490cc069a38f75 Will submit a new version after a while :) Thanks! On Mon, 1 May 2023 at 19:28, Conor Dooley <conor@kernel.org> wrote: > > On Mon, May 01, 2023 at 07:18:12PM +0200, Ricardo Ribalda wrote: > > On Mon, 1 May 2023 at 18:19, Nick Desaulniers <ndesaulniers@google.com> wrote: > > > > > > On Mon, May 1, 2023 at 5:39 AM Ricardo Ribalda <ribalda@chromium.org> wrote: > > > > > > > > If PGO is enabled, the purgatory ends up with multiple .text sections. > > > > This is not supported by kexec and crashes the system. > > > > > > > > Cc: stable@vger.kernel.org > > > > Fixes: 930457057abe ("kernel/kexec_file.c: split up __kexec_load_puragory") > > > > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> > > > > > > Hi Ricardo, > > > Thanks for the series. Does this patch 4/4 need a new online commit > > > description? It's not adding a linker script (maybe an earlier version > > > was). > > > Thanks for catching this. It should have said > > > > risc/purgatory: Remove profile optimization flags > ^^ > Perhaps with the omitted v added too? > > Also while playing the $subject nitpicking game, is it not called > "profile**-guided** optimisation" (and ditto in the comments)? > > Cheers, > Conor. > > > Will fix it on my local branch in case there is a next version of the > > series. Otherwise, please the maintainer fix the subject. > > > > > --- > > > > arch/riscv/purgatory/Makefile | 5 +++++ > > > > 1 file changed, 5 insertions(+) > > > > > > > > diff --git a/arch/riscv/purgatory/Makefile b/arch/riscv/purgatory/Makefile > > > > index 5730797a6b40..cf3a44121a90 100644 > > > > --- a/arch/riscv/purgatory/Makefile > > > > +++ b/arch/riscv/purgatory/Makefile > > > > @@ -35,6 +35,11 @@ CFLAGS_sha256.o := -D__DISABLE_EXPORTS > > > > CFLAGS_string.o := -D__DISABLE_EXPORTS > > > > CFLAGS_ctype.o := -D__DISABLE_EXPORTS > > > > > > > > +# When profile optimization is enabled, llvm emits two different overlapping > > > > +# text sections, which is not supported by kexec. Remove profile optimization > > > > +# flags. > > > > +KBUILD_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%,$(KBUILD_CFLAGS)) > > > > + > > > > # When linking purgatory.ro with -r unresolved symbols are not checked, > > > > # also link a purgatory.chk binary without -r to check for unresolved symbols. > > > > PURGATORY_LDFLAGS := -e purgatory_start -z nodefaultlib > > > > > > > > -- > > > > 2.40.1.495.gc816e09b53d-goog > > > > > > > > > > > > > -- > > > Thanks, > > > ~Nick Desaulniers > > > > > > > > -- > > Ricardo Ribalda > > > > _______________________________________________ > > linux-riscv mailing list > > linux-riscv@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/linux-riscv
Hey Ricardo, On Mon, May 01, 2023 at 02:38:22PM +0200, Ricardo Ribalda wrote: > If PGO is enabled, the purgatory ends up with multiple .text sections. > This is not supported by kexec and crashes the system. > > Cc: stable@vger.kernel.org > Fixes: 930457057abe ("kernel/kexec_file.c: split up __kexec_load_puragory") > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> > --- > arch/riscv/purgatory/Makefile | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/arch/riscv/purgatory/Makefile b/arch/riscv/purgatory/Makefile > index 5730797a6b40..cf3a44121a90 100644 > --- a/arch/riscv/purgatory/Makefile > +++ b/arch/riscv/purgatory/Makefile > @@ -35,6 +35,11 @@ CFLAGS_sha256.o := -D__DISABLE_EXPORTS > CFLAGS_string.o := -D__DISABLE_EXPORTS > CFLAGS_ctype.o := -D__DISABLE_EXPORTS > > +# When profile optimization is enabled, llvm emits two different overlapping > +# text sections, which is not supported by kexec. Remove profile optimization > +# flags. > +KBUILD_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%,$(KBUILD_CFLAGS)) With the caveat of not being au fait with the workings of either PGO or of purgatory, how come you modify KBUILD_CFLAGS here rather than the purgatory specific PURGATORY_CFLAGS that are used later in the file? Cheers, Conor. > + > # When linking purgatory.ro with -r unresolved symbols are not checked, > # also link a purgatory.chk binary without -r to check for unresolved symbols. > PURGATORY_LDFLAGS := -e purgatory_start -z nodefaultlib > > -- > 2.40.1.495.gc816e09b53d-goog > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv
Hi Conor On Mon, 1 May 2023 at 19:41, Conor Dooley <conor@kernel.org> wrote: > > Hey Ricardo, > > On Mon, May 01, 2023 at 02:38:22PM +0200, Ricardo Ribalda wrote: > > If PGO is enabled, the purgatory ends up with multiple .text sections. > > This is not supported by kexec and crashes the system. > > > > Cc: stable@vger.kernel.org > > Fixes: 930457057abe ("kernel/kexec_file.c: split up __kexec_load_puragory") > > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> > > --- > > arch/riscv/purgatory/Makefile | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/arch/riscv/purgatory/Makefile b/arch/riscv/purgatory/Makefile > > index 5730797a6b40..cf3a44121a90 100644 > > --- a/arch/riscv/purgatory/Makefile > > +++ b/arch/riscv/purgatory/Makefile > > @@ -35,6 +35,11 @@ CFLAGS_sha256.o := -D__DISABLE_EXPORTS > > CFLAGS_string.o := -D__DISABLE_EXPORTS > > CFLAGS_ctype.o := -D__DISABLE_EXPORTS > > > > +# When profile optimization is enabled, llvm emits two different overlapping > > +# text sections, which is not supported by kexec. Remove profile optimization > > +# flags. > > +KBUILD_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%,$(KBUILD_CFLAGS)) > > With the caveat of not being au fait with the workings of either PGO or > of purgatory, how come you modify KBUILD_CFLAGS here rather than the > purgatory specific PURGATORY_CFLAGS that are used later in the file? Definitely, not a Makefile expert here, but when I tried this: @@ -35,6 +40,7 @@ PURGATORY_CFLAGS_REMOVE := -mcmodel=kernel PURGATORY_CFLAGS := -mcmodel=large -ffreestanding -fno-zero-initialized-in-bss -g0 PURGATORY_CFLAGS += $(DISABLE_STACKLEAK_PLUGIN) -DDISABLE_BRANCH_PROFILING PURGATORY_CFLAGS += -fno-stack-protector +PURGATORY_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%,$(KBUILD_CFLAGS)) It did not work. Fixes: bde971a83bbf ("KVM: arm64: nvhe: Fix build with profile optimization") does this approach, so this is what I tried and worked. Thanks! > > Cheers, > Conor. > > > + > > # When linking purgatory.ro with -r unresolved symbols are not checked, > > # also link a purgatory.chk binary without -r to check for unresolved symbols. > > PURGATORY_LDFLAGS := -e purgatory_start -z nodefaultlib > > > > -- > > 2.40.1.495.gc816e09b53d-goog > > > > > > _______________________________________________ > > linux-riscv mailing list > > linux-riscv@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/linux-riscv
On Mon, May 01, 2023 at 09:54:43PM +0200, Ricardo Ribalda wrote: > On Mon, 1 May 2023 at 19:41, Conor Dooley <conor@kernel.org> wrote: > > On Mon, May 01, 2023 at 02:38:22PM +0200, Ricardo Ribalda wrote: > > > If PGO is enabled, the purgatory ends up with multiple .text sections. > > > This is not supported by kexec and crashes the system. > > > > > > Cc: stable@vger.kernel.org > > > Fixes: 930457057abe ("kernel/kexec_file.c: split up __kexec_load_puragory") > > > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> > > > --- > > > arch/riscv/purgatory/Makefile | 5 +++++ > > > 1 file changed, 5 insertions(+) > > > > > > diff --git a/arch/riscv/purgatory/Makefile b/arch/riscv/purgatory/Makefile > > > index 5730797a6b40..cf3a44121a90 100644 > > > --- a/arch/riscv/purgatory/Makefile > > > +++ b/arch/riscv/purgatory/Makefile > > > @@ -35,6 +35,11 @@ CFLAGS_sha256.o := -D__DISABLE_EXPORTS > > > CFLAGS_string.o := -D__DISABLE_EXPORTS > > > CFLAGS_ctype.o := -D__DISABLE_EXPORTS > > > > > > +# When profile optimization is enabled, llvm emits two different overlapping > > > +# text sections, which is not supported by kexec. Remove profile optimization > > > +# flags. > > > +KBUILD_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%,$(KBUILD_CFLAGS)) > > > > With the caveat of not being au fait with the workings of either PGO or > > of purgatory, how come you modify KBUILD_CFLAGS here rather than the > > purgatory specific PURGATORY_CFLAGS that are used later in the file? > > Definitely, not a Makefile expert here, but when I tried this: > > @@ -35,6 +40,7 @@ PURGATORY_CFLAGS_REMOVE := -mcmodel=kernel > PURGATORY_CFLAGS := -mcmodel=large -ffreestanding > -fno-zero-initialized-in-bss -g0 > PURGATORY_CFLAGS += $(DISABLE_STACKLEAK_PLUGIN) -DDISABLE_BRANCH_PROFILING > PURGATORY_CFLAGS += -fno-stack-protector > +PURGATORY_CFLAGS := $(filter-out -fprofile-sample-use=% > -fprofile-use=%,$(KBUILD_CFLAGS)) > > It did not work. Unfortunately I am oh-so-far from an expert on this kind of thing, but I had thought that PURGATORY_CFLAGS_REMOVE was intended for this sort of purpose. > Fixes: bde971a83bbf ("KVM: arm64: nvhe: Fix build with profile optimization") > > does this approach, so this is what I tried and worked. That doesn't have a specific CFLAGS though afaict. Perhaps Nick etc have a more informed opinion here than I do, sorry. Thanks, Conor. > > > + > > > # When linking purgatory.ro with -r unresolved symbols are not checked, > > > # also link a purgatory.chk binary without -r to check for unresolved symbols. > > > PURGATORY_LDFLAGS := -e purgatory_start -z nodefaultlib > > > > > > -- > > > 2.40.1.495.gc816e09b53d-goog > > > > > > > > > _______________________________________________ > > > linux-riscv mailing list > > > linux-riscv@lists.infradead.org > > > http://lists.infradead.org/mailman/listinfo/linux-riscv > > > > -- > Ricardo Ribalda
diff --git a/arch/riscv/purgatory/Makefile b/arch/riscv/purgatory/Makefile index 5730797a6b40..cf3a44121a90 100644 --- a/arch/riscv/purgatory/Makefile +++ b/arch/riscv/purgatory/Makefile @@ -35,6 +35,11 @@ CFLAGS_sha256.o := -D__DISABLE_EXPORTS CFLAGS_string.o := -D__DISABLE_EXPORTS CFLAGS_ctype.o := -D__DISABLE_EXPORTS +# When profile optimization is enabled, llvm emits two different overlapping +# text sections, which is not supported by kexec. Remove profile optimization +# flags. +KBUILD_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%,$(KBUILD_CFLAGS)) + # When linking purgatory.ro with -r unresolved symbols are not checked, # also link a purgatory.chk binary without -r to check for unresolved symbols. PURGATORY_LDFLAGS := -e purgatory_start -z nodefaultlib