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 07CB6C76196 for ; Tue, 11 Apr 2023 21:46:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229558AbjDKVqQ (ORCPT ); Tue, 11 Apr 2023 17:46:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229742AbjDKVqP (ORCPT ); Tue, 11 Apr 2023 17:46:15 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89A0955BF for ; Tue, 11 Apr 2023 14:46:10 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id d22-20020a17090a111600b0023d1b009f52so12444926pja.2 for ; Tue, 11 Apr 2023 14:46:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1681249569; x=1683841569; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=zejEY/r4Tfq5XbhV7cIEeG2i14mVKUoGXnXZCvl+x7Q=; b=JR7AbifGvum1/spLQ4gbBxoXTDJFbeqZS0i/NcRbMfRXymryrRUwE2AlNViLCIL0yk TK5vobsACwctOi92h20ARZXoHbc9lntb5ojtDAA86UVgkQ2aAAzs4yI2Ppqut09EX+jI rPkYLg6i19ex9xi5unVGzXuKv5tnXxZpZuFr0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681249569; x=1683841569; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zejEY/r4Tfq5XbhV7cIEeG2i14mVKUoGXnXZCvl+x7Q=; b=OFYpEYCOPFHwYepOm91vLrw0fxRVWOiTnG62TqFbmaqHJlnDIbNFn4qKMQ5PvJqn5e Imjlzcm2ANoWdtn/UXSKnQnoU10gfpmFjuwQr0VKLKNOeVYUx9MSiTEE9JF6TijN75O4 bxl59C3QiW28y/GBJP7iMPZYTamw/GnKDM75xfuOiGXhd/SKrjpKu77h2zprjWHz/Le7 8p7qf29fKRL3YLDXoXL0A6aYfdW9iGblXNOgeYYN3bohbOjdha9GakGC5YM27n3igO2U hc2/SAxakU0hwDUAsU4UUH1Qtx6tajxRUyC1Skx9JDzewX1xHpwvMCABIJpNvkkCuI8g n/Eg== X-Gm-Message-State: AAQBX9cmQ/vfl7GQ+2WxPzB/dJZ13iG7GUfwA2JTbVyPG0tfZLYu7VDX Pk7EqyicNdavMfElmWYmkjWAj3jviMMt67hNfFs= X-Google-Smtp-Source: AKy350ZYIjzD9CnLQ0+Kktz2l3Vjwclzw7IpGWEqxxoS0igerkCySH0MmhymI2vGTqbEZ6U62IGBmA== X-Received: by 2002:a05:6a20:7b08:b0:da:eb84:fcff with SMTP id s8-20020a056a207b0800b000daeb84fcffmr11590828pzh.29.1681249569571; Tue, 11 Apr 2023 14:46:09 -0700 (PDT) Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com. [209.85.214.170]) by smtp.gmail.com with ESMTPSA id l5-20020a654c45000000b005143448896csm8958972pgr.58.2023.04.11.14.46.08 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Apr 2023 14:46:08 -0700 (PDT) Received: by mail-pl1-f170.google.com with SMTP id m18so9175764plx.5 for ; Tue, 11 Apr 2023 14:46:08 -0700 (PDT) X-Received: by 2002:a17:90b:384f:b0:23f:9d83:ad76 with SMTP id nl15-20020a17090b384f00b0023f9d83ad76mr15506588pjb.23.1681249567905; Tue, 11 Apr 2023 14:46:07 -0700 (PDT) MIME-Version: 1.0 References: <20230321-kexec_clang16-v5-0-5563bf7c4173@chromium.org> <20230321-kexec_clang16-v5-2-5563bf7c4173@chromium.org> <20230330111523.4b98c8ce@gandalf.local.home> <20230330151826.GDZCWoQkQBj4BYbwWw@fat_crate.local> <20230330113127.3011e021@gandalf.local.home> <20230330160017.GEZCWyEXQVQZRBbYif@fat_crate.local> In-Reply-To: From: Ricardo Ribalda Date: Tue, 11 Apr 2023 23:45:56 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5 2/2] x86/purgatory: Add linker script To: Nick Desaulniers Cc: Steven Rostedt , Eric Biederman , Baoquan He , Philipp Rudo , kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Ross Zwisler , Simon Horman , "x86@kernel.org" , linux-toolchains@vger.kernel.org, clang-built-linux , Borislav Petkov Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-toolchains@vger.kernel.org Hi Nick On Sat, 8 Apr 2023 at 01:22, Nick Desaulniers wro= te: > > Hi Ricardo, > Thanks for the patch! Please make sure to cc our mailing list > for llvm specific issues. > scripts/get_maintainer.pl should recommend it, or you can find it from > clangbuiltlinux.github.io. You can also ping me internally for > toolchain related issues. > > Start of thread. > https://lore.kernel.org/lkml/20230321-kexec_clang16-v5-0-5563bf7c4173@chr= omium.org/ > > On Thu, Mar 30, 2023 at 9:00=E2=80=AFAM Borislav Petkov wr= ote: > > > > On Thu, Mar 30, 2023 at 11:31:27AM -0400, Steven Rostedt wrote: > > > On Thu, 30 Mar 2023 17:18:26 +0200 > > > Borislav Petkov wrote: > > > > > > > On Thu, Mar 30, 2023 at 11:15:23AM -0400, Steven Rostedt wrote: > > > > > > Make sure that the .text section is not divided in multiple ove= rlapping > > > > > > sections. This is not supported by kexec_file. > > Perhaps this is related to CrOS' use of AutoFDO creating .text.hot? > If so, it's probably more straightforward to straight up disable PGO > for kexec. See also: > > commit bde971a83bbf ("KVM: arm64: nvhe: Fix build with profile optimizati= on") It was indeed due to the AutoFDO, adding KBUILD_CFLAGS :=3D $(filter-out -fprofile-sample-use=3D% -fprofile-use=3D%, $(KBUILD_CFLAGS)) to arch/x86/purgatory/Makefile It is definitely simpler than adding a linker script, but I am not sure if it is the correct way to fix this... Seems like splitting .text in multiple sections is an implementation detail of the compiler and the only way to force it is with a linker script... Or am I missing something? Shall I send a new version with the KBUILD_CFLAGS ? Thanks! > > > > > > > > > And? > > > > > > > > What is the failure scenario? Why are you fixing it? Why do we care= ? > > > > > > > > This is way too laconic. > > > > > > > > > > Yeah, I think the change log in patch 1 needs to be in this patch too= , > > > which gives better context. > > > > Just read it. > > > > Why did it work with clang version < 16? > > I'll bet if we bisect llvm, we can spot what might have changed, which > may give us a clue on how to get the old behavior back; maybe without > the need for a linker script. > > Ricardo, how did you verify that your fix was correct? Surely we can > check using command line utilities without needing a full blown kexec > setup? If you can share more info, I can bisect llvm quickly. If it > requires profile data, you'll need to share it, since CrOS engineers > still have not posted public documentation on AutoFDO as I have > repeatedly asked for. The simplest test is to run: $readelf -S arch/x86/purgatory/purgatory.ro | grep "] \.text" [ 3] .text PROGBITS 0000000000000000 000002a0 If there is only one .text section then that kernel will be load properly via kexec_file(). > > > > > + toolchains ML. > > > > -- > > Regards/Gruss, > > Boris. > > > > https://people.kernel.org/tglx/notes-about-netiquette > > > > -- > Thanks, > ~Nick Desaulniers -- Ricardo Ribalda