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 X-Spam-Level: X-Spam-Status: No, score=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 657CFC433E0 for ; Fri, 22 Jan 2021 01:44:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 11688223C8 for ; Fri, 22 Jan 2021 01:44:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726564AbhAVBnq (ORCPT ); Thu, 21 Jan 2021 20:43:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726560AbhAVBnm (ORCPT ); Thu, 21 Jan 2021 20:43:42 -0500 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4329C0613D6 for ; Thu, 21 Jan 2021 17:43:01 -0800 (PST) Received: by mail-pf1-x436.google.com with SMTP id q20so2659700pfu.8 for ; Thu, 21 Jan 2021 17:43:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JHmsyWW/3ORqzCCxIgYU3HZ6BJYN5rvOhQgY5Vhnihs=; b=Cn+/rff9XjSf2PVRZ9I1XCBKIEto0f9KuoUnZTnmqqD1QOlEhW9ZnZite85Ce738Wi 8tocw6/MX2KaI+LYQUBK+8KNwsMiya4AOtiAzmjUNZCcjnW+pXKesWB7j7oaqfA8fmPn f5q6fZzknZHyEX/A3sV1Q8bl3TaHZeOaxDmwfwOoSyMGENEcreRpMKO4hR8qNAZdyEN+ Nlzqmhi+G9ajLzflu/7YuqZZ8AIxDh7OgmCKeK0onxi5FroP4jZNtoUqnSGO6iZu/VWj B/uvlnOmQJ1KmO8gg4jWUSWeN2NiBYX4wtlWKHETI+zFZPGwsA/PmAG6t9Qd1MXUNWsq vlJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JHmsyWW/3ORqzCCxIgYU3HZ6BJYN5rvOhQgY5Vhnihs=; b=O2EVr4auK+tBElVMXivdBqW6V49qS6zgLy02JdjJzt5zdPkafPxm1N/Sbo7/Ya/kV7 cxYEd/GnVc9vtd6FHSiQ7x7EI7ZGTAyNWVpNftsLTzs/RKT0L7yXU1HIRg87Vh7mxsUT z15Iwr0YJyYMTijOC00/SfPnDocfC4PicZZA49jdWw7Z0GELwfMBBitRYDJ1iTX5TVfy 44UIKBm7eyPj/RFnalUgd+lzE68ktpq7tnkO0fO1ff+rb+0Rz8Tg10eD9YM0/LrkB+/5 Co45dBbBmvVLWf/XWYJbecwB1lJVKuJwvwLh7UcoLRukVZI/iLn1LNNMMQtv/2sT1dRg ubwQ== X-Gm-Message-State: AOAM530m5HX11SXB1HcvClA0Nby3cQg3x6fCFChRQ5TOTkrRvjwwWjlr E2M/5lVKImL23kXmuClfgGOPq1knIl5fNbyBxaD+BA== X-Google-Smtp-Source: ABdhPJzJ1LehAQj3g0Au/DgMI3UZP7gu00iy/KoX+nhTCsE9nhsnY2k0RFL9OMEBX0CuzoXmdzNFrF1liYbS5euVww4= X-Received: by 2002:a62:7896:0:b029:1b6:7319:52a7 with SMTP id t144-20020a6278960000b02901b6731952a7mr2450111pfc.30.1611279780913; Thu, 21 Jan 2021 17:43:00 -0800 (PST) MIME-Version: 1.0 References: <20210113061958.886723-1-morbo@google.com> <20210116094357.3620352-1-morbo@google.com> In-Reply-To: From: Nick Desaulniers Date: Thu, 21 Jan 2021 17:42:49 -0800 Message-ID: Subject: Re: [PATCH v5] pgo: add clang's Profile Guided Optimization infrastructure To: Sedat Dilek Cc: Bill Wendling , Jonathan Corbet , Masahiro Yamada , Linux Doc Mailing List , LKML , Linux Kbuild mailing list , Clang-Built-Linux ML , Andrew Morton , Nathan Chancellor , Sami Tolvanen , Fangrui Song Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On Wed, Jan 20, 2021 at 6:03 PM Sedat Dilek wrote: > > On Mon, Jan 18, 2021 at 10:56 PM Bill Wendling wrote: > > > > On Mon, Jan 18, 2021 at 9:26 AM Sedat Dilek wrote: > > > > > > On Mon, Jan 18, 2021 at 1:39 PM Sedat Dilek wrote: > > > > > > > > On Mon, Jan 18, 2021 at 3:32 AM Bill Wendling wrote: > > > > > > > > > > On Sun, Jan 17, 2021 at 4:27 PM Sedat Dilek wrote: > > > > > > > > > > > > [ big snip ] > > > > > > > > > > [More snippage.] > > > > > > > > > > > [ CC Fangrui ] > > > > > > > > > > > > With the attached... > > > > > > > > > > > > [PATCH v3] module: Ignore _GLOBAL_OFFSET_TABLE_ when warning for > > > > > > undefined symbols > > > > > > > > > > > > ...I was finally able to boot into a rebuild PGO-optimized Linux-kernel. > > > > > > For details see ClangBuiltLinux issue #1250 "Unknown symbol > > > > > > _GLOBAL_OFFSET_TABLE_ loading kernel modules". > > > > > > > > > > > Thanks for confirming that this works with the above patch. > > > > > > > > > > > @ Bill Nick Sami Nathan > > > > > > > > > > > > 1, Can you say something of the impact passing "LLVM_IAS=1" to make? > > > > > > > > > > The integrated assembler and this option are more-or-less orthogonal > > > > > to each other. One can still use the GNU assembler with PGO. If you're > > > > > having an issue, it may be related to ClangBuiltLinux issue #1250. > > > > > > > > > > > 2. Can you please try Nick's DWARF v5 support patchset v5 and > > > > > > CONFIG_DEBUG_INFO_DWARF5=y (see attachments)? > > > > > > > > > > > I know Nick did several tests with PGO. He may have looked into it > > > > > already, but we can check. > > > > > > > > > > > > > Reproducible. > > > > > > > > LLVM_IAS=1 + DWARF5 = Not bootable > > > > > > > > I will try: > > > > > > > > LLVM_IAS=1 + DWARF4 > > > > > > > > > > I was not able to boot into such a built Linux-kernel. > > > > > PGO will have no effect on debugging data. If this is an issue with > > DWARF, then it's likely orthogonal to the PGO patch. > > > > > For me worked: DWARF2 and LLVM_IAS=1 *not* set. > > > > > > Of course, this could be an issue with my system's LLVM/Clang. > > > > > > Debian clang version > > > 12.0.0-++20210115111113+45ef053bd709-1~exp1~20210115101809.3724 > > > > > Please use the official clang 11.0.1 release > > (https://releases.llvm.org/download.html), modifying the > > kernel/pgo/Kconfig as I suggested above. The reason we specify clang > > 12 for the minimal version is because of an issue that was recently > > fixed. > > > > I downgraded to clang-11.1.0-rc1. > ( See attachment. ) > > Doing the first build with PGO enabled plus DWARF5 and LLVM_IAS=1 works. > > But again after generating vmlinux.profdata and doing the PGO-rebuild > - the resulting Linux-kernel does NOT boot in QEMU or on bare metal. > With GNU/as I can boot. > > So this is independent of DWARF v4 or DWARF v5 (LLVM_IAS=1 and DWARF > v2 is not allowed). > There is something wrong (here) with passing LLVM_IAS=1 to make when > doing the PGO-rebuild. > > Can someone please verify and confirm that the PGO-rebuild with > LLVM_IAS=1 boots or boots not? I was able to build+boot with LLVM_IAS=1 on my personal laptop (no dwarf 5, just mainline+v5). > > Thanks. > > - Sedat - > > > > Can you give me a LLVM commit-id where you had success with LLVM_IAS=1 > > > and especially CONFIG_DEBUG_INFO_DWARF5=y? > > > Success means I was able to boot in QEMU and/or bare metal. > > > > > The DWARF5 patch isn't in yet, so I don't want to rely upon it too much. I agree, providing test results with patches that haven't landed yet can cloud the interpretation of results. It would be helpful to drop local patch sets before trying this. If the resulting image still isn't working for you, can you please provide your config? Surely we'd be able to reproduce boot failures in QEMU? Nothing comes to mind about a change of assemblers causing an issue; I would assume assembly cannot be instrumented by the compiler (even though the compiler is the "driver" of the assembler). The hash warnings are certainly curious. IndexedInstrProfReader::getInstrProfRecord() is the only place in LLVM sources that can emit that. -- Thanks, ~Nick Desaulniers