Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp770379rdb; Fri, 8 Sep 2023 16:24:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFUWHaSGz31ZMX7jQ+IGsE1lTkdUUiIlE8p+9iynRdht02tmMjktqX2EEo8uLnVf/f+eMVc X-Received: by 2002:a17:90a:c28f:b0:263:4815:cb9a with SMTP id f15-20020a17090ac28f00b002634815cb9amr3980384pjt.41.1694215448992; Fri, 08 Sep 2023 16:24:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694215448; cv=none; d=google.com; s=arc-20160816; b=V9VYUfQJZpLFdZfo2DGDmJVniR7nOcrAAhxedWbNGGvZf5/YFeNo9JjXMUnXxunbRs A4uly28bjVMuJl6IK/ugChTs+hF4cjChYK42ZUKmQ81suNoq2CTlP0VvJetPGCm8CtuN JoLC4oOwXvZUjKm22RO7/0ZxBYDSFNXnDg3PDytnMXmFTNfCuqs1KdUtqwGK62VQbzJ0 05340K9fH3WbT4ziUP8BVIekpAL59otbNWCebFn9hxGKYooH6CviBDD+ASiJatHOuXLO NRDRxu5AF64TlIMKUBSC+g5IEdYnQKZdshBkXJmaeMLzOCQo4z3ulhG/RDYyPSBKcj+D tccA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=KwM170Ct57lq4vNZ7xSkyIS4SWaJogcjmhutnsYYUvg=; fh=R+hEpPZKbJBkgifp94cB0AjDlkA9/fY8/Di+YOsGTwU=; b=pP1JUCd3Mv2PzN2bVtyHyKlmpt+AWNu2DIRfxuvK37IESsHhBIKDqByUEqMJjieTF9 PVXGkVcIKXGuWmjREL8Tvexw5MGBBSdtc2SNAHQ9BZ14/Cir743C2qUlon0AaxWrZ28H SE2y5uFLhnuHD8yzg4xQR63kg5ok6cAJur/3REoBtKz/bS1EiZUfDblNbZ94vI6TxGvC CnTzVogtJziZdLPDA+EZGuouYhTtZPUHdTR7IZ5OJQEHvirUPMXW6W8p8R280i83srvO vp2CFVzSK0i3Ku2SG8+bYg3RsK3qDq+gLH73aC31MG8327rWhiOFoy/U0C5RHE1YNlaQ Km3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=a6zALJdv; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pf1-20020a17090b1d8100b002639394cfcdsi2291076pjb.145.2023.09.08.16.23.54; Fri, 08 Sep 2023 16:24:08 -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=@kernel.org header.s=k20201202 header.b=a6zALJdv; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344277AbjIHWxW (ORCPT + 99 others); Fri, 8 Sep 2023 18:53:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242563AbjIHWxV (ORCPT ); Fri, 8 Sep 2023 18:53:21 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 038CA1FEB; Fri, 8 Sep 2023 15:53:18 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A35CC433CA; Fri, 8 Sep 2023 22:53:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694213597; bh=KwM170Ct57lq4vNZ7xSkyIS4SWaJogcjmhutnsYYUvg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=a6zALJdvJybZVN96yoS6EZ96AEPRkZIR3J4RfcotR605O+NAX+wNKtlhCkZ7m2Znv i6V/2X6pYg8E2vdc8LrkEoB0MIWoQalZNAUvZZgx+xmYcneTNW67WcPF/2ajJ7qFwi nSTyEdorTmAO+3CGT756wTHvIJ17mSEY9Xosqq7i1j7WrM7VgfKCpBQeF3kXj07jwc a/fA1MYPF1Zxm0UHR0htujt2KUCICJdTImw6i0KfsNo2VMYYWssP1ipoZSdLAWlQlq ijTEdEIp1PjWQuUEsWufaNPGDnt3zZBiGsfrWPOjprVAWSSXuYVBIBBYCypgu9egun AyVyrYTuWbNAw== Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-5007abb15e9so4334362e87.0; Fri, 08 Sep 2023 15:53:17 -0700 (PDT) X-Gm-Message-State: AOJu0Yxx0yV0dLIX7sk2urXKR80RiEC6xr5E43zBchKjwTFP6FdP5ooU q4L7+wscFyqO2/aWO8OY60RNugzED9fkcqLszQk= X-Received: by 2002:ac2:4bc5:0:b0:4fe:7e1f:766a with SMTP id o5-20020ac24bc5000000b004fe7e1f766amr3386244lfq.24.1694213595847; Fri, 08 Sep 2023 15:53:15 -0700 (PDT) MIME-Version: 1.0 References: <20230321-kexec_clang16-v7-0-b05c520b7296@chromium.org> In-Reply-To: From: Song Liu Date: Fri, 8 Sep 2023 15:53:02 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v7 0/4] kexec: Fix kexec_file_load for llvm16 with PGO To: Ricardo Ribalda Cc: 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 , 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, stable@vger.kernel.org, Palmer Dabbelt Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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_BLOCKED,SPF_HELO_NONE,SPF_PASS 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 On Fri, Sep 8, 2023 at 2:52=E2=80=AFPM Ricardo Ribalda wrote: > > Hi Song > > On Fri, 8 Sept 2023 at 23:48, Song Liu wrote: > > > > Hi Ricardo, > > > > Thanks for your kind reply. > > > > On Fri, Sep 8, 2023 at 2:18=E2=80=AFPM Ricardo Ribalda wrote: > > > > > > Hi Song > > > > > > On Fri, 8 Sept 2023 at 01:08, Song Liu wrote: > > > > > > > > Hi Ricardo and folks, > > > > > > > > On Fri, May 19, 2023 at 7:48=E2=80=AFAM Ricardo Ribalda wrote: > > > > > > > > > > When upreving llvm I realised that kexec stopped working on my te= st > > > > > platform. > > > > > > > > > > The reason seems to be that due to PGO there are multiple .text s= ections > > > > > on the purgatory, and kexec does not supports that. > > > > > > > > > > Signed-off-by: Ricardo Ribalda > > > > > > > > We are seeing WARNINGs like the following while kexec'ing a PGO and > > > > LTO enabled kernel: > > > > > > > > WARNING: CPU: 26 PID: 110894 at kernel/kexec_file.c:919 > > > > kexec_load_purgatory+0x37f/0x390 > > > > > > > > AFAICT, the warning was added by this set, and it was triggered whe= n > > > > we have many .text sections > > > > in purgatory.ro. The kexec was actually successful. So I wonder > > > > whether we really need the > > > > WARNING here. If we disable LTO (PGO is still enabled), we don't se= e > > > > the WARNING any more. > > > > > > > > I also tested an older kernel (5.19 based), where we also see many > > > > .text sections with LTO. It > > > > kexec()'ed fine. (It doesn't have the WARN_ON() in > > > > kexec_purgatory_setup_sechdrs). > > > > > > You have been "lucky" that the code has chosen the correct start > > > address, you need to modify the linker script of your kernel to > > > disable PGO. > > > You need to backport a patch like this: > > > https://lore.kernel.org/lkml/CAPhsuW5_qAvV0N3o+hOiAnb1=3DbuJ1pLzqYW9D= +Bwft6hxJvAeQ@mail.gmail.com/T/#md68b7f832216b0c56bbec0c9b07332e180b9ba2b > > > > We already have this commit in our branch. AFAICT, the issue was > > triggered by LTO. So something like the following seems fixes it > > (I haven't finished the end-to-end test yet). Does this change make > > sense to you? > > if the end-to-end works, please send it as a patch to the mailing list. > > Thanks! :) OK, it works (AFAICT). Sending the patch. Thanks, Song