From patchwork Fri May 19 14:47:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 96478 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1303180vqo; Fri, 19 May 2023 08:04:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4rO6DvIKvmmSNy1E9/wVrW1SmhtCsYEhWlu/5SeBSAWO2xnRuELt8w0YA+GvcbAi5m+gPr X-Received: by 2002:a17:902:d48e:b0:1ac:8835:b881 with SMTP id c14-20020a170902d48e00b001ac8835b881mr2902804plg.17.1684508692206; Fri, 19 May 2023 08:04:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684508692; cv=none; d=google.com; s=arc-20160816; b=Zy7NKMiq5/8oW+sQwdTn2cC3AdDXsj2LebW386fCzneVw6uGO8Qd4pfsbgIos5B80u 1yB8ZSPZ1ypcgJGPmJJfFaf65S2hZ6EiMZ4OHEzHMQUvGIcPyfc8YYl+WpQW4BUHJs04 4U/7fB0xJQ3/1pszuOjrok0OsjOnJbNN5j8jchGG4d5NEtBwBTHDByut9Qddz12is+R5 1IUazVsjhlMHH1RU/jh4eCZqruV5NpJnwdYlEwMAtVI8I/sac3/le+dpqiMVpBnSzvOo fj765CTZDQqItpaFX/Ld/7MkS6cm9NZOdMjo/NAHvOEChVvwAbtoeJ/nsxs9qF2XLMd6 KhuA== 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=osK35APNMHUOM/vspbNmY4dm4o7cSGGXI42PTW0uu8s=; b=kp+5tGAAK6s7vGWEq2OnyaRSP+FxUwFRwoHhc2k8RTvPSpKVmyHGJd4hL4OcmQwiHT P+SsItdV0WTE78pvJw9i2OtKMs53HVRALnUU/tQLrbKvRJ2woLQSLJPSrqr43jRnkw75 obROl1rjkTuAXrVMyuS2NXALVDfwRJIQiyKiDzGiVAYRxynNGVI5Wg/WUT7iGe5sWB+w Z3+2dRkBDoUvN/qi3qQbd6bLgjtvheoPdd1NXESPY87aFs6LlIgpF1NCTTp8Mb3Uy+v0 w/U233Wlg6uq8CrlZAAit/lyEZ/FpaE0WjuIGBnbmChyqgMRg7j1yLqCszJ+NGxfODkA gwoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZYjh30K7; 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 j13-20020a170903024d00b001a6db2bef14si3910665plh.157.2023.05.19.08.04.38; Fri, 19 May 2023 08:04:52 -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=ZYjh30K7; 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 S232168AbjESOsr (ORCPT + 99 others); Fri, 19 May 2023 10:48:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232098AbjESOsc (ORCPT ); Fri, 19 May 2023 10:48:32 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6572C1B5 for ; Fri, 19 May 2023 07:48:31 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-96649b412easo532763666b.0 for ; Fri, 19 May 2023 07:48:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1684507711; x=1687099711; 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=osK35APNMHUOM/vspbNmY4dm4o7cSGGXI42PTW0uu8s=; b=ZYjh30K7khuwsHmxdTGgS+WoY9zJgx6/9/pcc1JbuvgcIEsldCdXXJbEp4NACjCKaD LMW1h53HHwQnKpmODQx7uXNQn0+JuBNgZS2Zh/7IejB20vSK2D1Unr6kMSuPVMXAFhiZ 9ZeWiBl87aFZW9wBv1Nh3DLuN2movq9+fC554= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507711; x=1687099711; 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=osK35APNMHUOM/vspbNmY4dm4o7cSGGXI42PTW0uu8s=; b=UokvlmPWXs1gY0jEEhuTpAya1J18aYOAr2fyxevhbeOJByHS2sfsKQlrEyId4TTeRZ GVZ+i/rZo2vxv2pNhq/tpXcaXC/ajhlFmYEXxv+LaSqX/krAonV23GxgNOUB1Ae0SDEo W0G4L/L7eNp9NmFS/x3+AJpsXHShA/F1y4Cj9OX6Btv8pc6v3cTeJtNhrfinFYUFbG+o COYx10yuY+29xwgDipX2zN+3P4CoRfELDTaD/q3gx2XZrP3WY4xymTjRtB9TTPKHfEZ+ MkUBRbKXdUGqjN8qFiuGceTomsOu4yvsWGmsjV5sujgrNCVKo/5snBIT8qIDnlI9geeI OVpA== X-Gm-Message-State: AC+VfDyTiDo8dF+JvVX360tJxMl5Ox75uZNgETI5/wxCu2kGraaEevTo 0jTb6NE/adZ+UiSXu4uP9EQGow== X-Received: by 2002:a17:906:d54a:b0:94e:f738:514f with SMTP id cr10-20020a170906d54a00b0094ef738514fmr2090904ejc.13.1684507710607; Fri, 19 May 2023 07:48:30 -0700 (PDT) Received: from alco.roam.corp.google.com ([2620:0:1059:10:62fd:274b:c2ab:69bb]) by smtp.gmail.com with ESMTPSA id a2-20020a17090680c200b0096a68648329sm2349437ejx.214.2023.05.19.07.48.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:48:30 -0700 (PDT) From: Ricardo Ribalda Date: Fri, 19 May 2023 16:47:39 +0200 Subject: [PATCH v7 4/4] riscv/purgatory: Remove PGO flags MIME-Version: 1.0 Message-Id: <20230321-kexec_clang16-v7-4-b05c520b7296@chromium.org> References: <20230321-kexec_clang16-v7-0-b05c520b7296@chromium.org> In-Reply-To: <20230321-kexec_clang16-v7-0-b05c520b7296@chromium.org> To: Eric Biederman , Philipp Rudo , Dave Young , Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Nathan Chancellor , Tom Rix , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: Baoquan He , Philipp Rudo , kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Ross Zwisler , Steven Rostedt , Simon Horman , Nick Desaulniers , llvm@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, Ricardo Ribalda , stable@vger.kernel.org, Palmer Dabbelt X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1298; i=ribalda@chromium.org; h=from:subject:message-id; bh=wdnk6GxBa5T/HIlvuq8XoXYQQFQFk4mx9eVuJiQf83M=; b=owEBbQKS/ZANAwAKAdE30T7POsSIAcsmYgBkZ4wzePFk89/IBhUZr9SWcIl2QkwFBFu2gEcYe /5y+YTRvGqJAjMEAAEKAB0WIQREDzjr+/4oCDLSsx7RN9E+zzrEiAUCZGeMMwAKCRDRN9E+zzrE iEJ9EACWgKvSdCRvRA4/lyxhvVHQgJQ0PCNnOhH3hpa3YJPoHyQLHQ8AWvcvBMla51KPtthYLTN RttNdzciI8SyWtWAc62LCy0wqaKDS+qbrbvVnUEYDgzqyCjq/gSxRky4clrjmFzUvY2wNCRfWMt yFLtWzm5iYd4N7d07L87XEKmPRitblqcy/VsPL9EMUutCQ5OQlaaSRto36SmkRf9nkrMPPzCH+2 qNNS8PY2lNeGzUvTDAi7F00EDf/PLWQ7pXaKeJeU56IsYS8v1VUoNdkx04R/AIO8TBdqwsDZhhD UqPLLPRwecZmAks5n575AFj+ZFRtUPueG6J2aQ1ndVzS+8/OTyW1xxwogq6fkwr44uXalhe3YxJ aUOnvtCxh06L48mQLfdlx1JhUTlhZ1AtVysiezFN9EedPP27rIgxpSSgnEwsjDWJny3YJfbGJQN Zk7DDEwAQLAN3GaT+i/K2X8PEHG6+A5SkFE+wZe5WKERCdPLVGgWjIYwaqXDAvGK/5DfORHun85 2qC2ReqZtGwpWhUfg6jJ4cFTsiNbkYy31b1T5/9BqXT5dBqfAuVU/QKYqg5qb4ciKtKesTLLV1H ZydnfO9MMJNG6tjvelUtgGQRPqf1ea9Lob19/0XoQrWh8oifHm8eWWisKYfQY/1ExftAFpZCeA5 BmR9KbCqwO2lwOg== X-Developer-Key: i=ribalda@chromium.org; a=openpgp; fpr=9EC3BB66E2FC129A6F90B39556A0D81F9F782DA9 X-Spam-Status: No, score=-2.1 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,URIBL_BLOCKED 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766335386499510827?= X-GMAIL-MSGID: =?utf-8?q?1766335386499510827?= If profile-guided optimization 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") Acked-by: Palmer Dabbelt Signed-off-by: Ricardo Ribalda --- arch/riscv/purgatory/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/riscv/purgatory/Makefile b/arch/riscv/purgatory/Makefile index 5730797a6b40..bd2e27f82532 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-guided 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