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=-11.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 894C5C2B9F4 for ; Mon, 14 Jun 2021 16:06:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 63FC46120E for ; Mon, 14 Jun 2021 16:06:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234402AbhFNQIq (ORCPT ); Mon, 14 Jun 2021 12:08:46 -0400 Received: from mail-pf1-f179.google.com ([209.85.210.179]:43736 "EHLO mail-pf1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233543AbhFNQIp (ORCPT ); Mon, 14 Jun 2021 12:08:45 -0400 Received: by mail-pf1-f179.google.com with SMTP id a127so5054743pfa.10 for ; Mon, 14 Jun 2021 09:06:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :in-reply-to; bh=aDFM4HLqCSVdycnwG2jrfVEbxImV1zS0UB5Gbh8n44I=; b=D5PESK9qtKiBqnTot/K68RUFZD5EToGf+pGqCNqzbQc6HTrqJqXeaps7sySdKLwQNl f9+iDe7ToBtqj9Y57EgxTc73Ftdc73oY5TyrXHi5U7Tz6eXUpaWzO2r6T4HpB+n/wFnx NRcqytR6jgE+d3bjwtzpj7OlNaquzuZQXioAk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:in-reply-to; bh=aDFM4HLqCSVdycnwG2jrfVEbxImV1zS0UB5Gbh8n44I=; b=L2Uwmoka3L72gIqSK53fImsRRGm5XSOAw5dN1DIsCSrrUE8BtvgzRVNctFoPK3KBFr NcU2FCCHq1wvJv1rvL2+rKUlmO0uNyO1XOYCQ+TScYj3HmV0NvIba5/gp/9e+PafkQPy oHejnCq31HyRM04bdymn4k8fCAlBQEAskSiqGssglimFrA0im+YVFFW017irh/4JHrsx VGanIXLq87aDkUhDiJScLR+xpgHWSdhQcvuuNHuD5Qd9zuzOFSfYooHPMTLQfD2R2F63 +5fbJAmRdscoYCCYQcqspJY9gtCPX+BBFopIa8KNRxenBmPifELDjNuGMOyXGhtL74c9 4YFQ== X-Gm-Message-State: AOAM532hRBq8rpigy2q3PbSn+Ci24cKVDndNq6XwhjGpJ6WinY1Mb4Cp 9LU+weTA8oHb0CkdKZOUjzT7JoUX4XpwPA== X-Google-Smtp-Source: ABdhPJy/a6konmzIUoBphc/D/tcYpIux9aJQMuctRq8sPjp5PV+Y/ruV0RfuE7bhG0AnMrE0Ni9jZw== X-Received: by 2002:a63:3fc6:: with SMTP id m189mr17883783pga.239.1623686742073; Mon, 14 Jun 2021 09:05:42 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id j16sm14243500pgh.69.2021.06.14.09.05.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jun 2021 09:05:41 -0700 (PDT) Date: Mon, 14 Jun 2021 09:05:40 -0700 From: Kees Cook To: Jarmo Tiitto Cc: Sami Tolvanen , Bill Wendling , Nathan Chancellor , Nick Desaulniers , clang-built-linux@googlegroups.com, linux-kernel@vger.kernel.org, morbo@google.com Subject: Re: [RFC PATCH 0/5] pgo: Add PGO support for module profile data Message-ID: <202106140904.484E2337C@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210612032425.11425-1-jarmo.tiitto@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [oops, I failed to CC correctly -- resending] On Sat, Jun 12, 2021 at 06:24:21AM +0300, Jarmo Tiitto wrote: > This patch series intends to extend the current Clang PGO code to > support profile data from modules. Note that current PGO can and *does* > instrument all kernel code, including modules, but this profile data > is inaccessible. > > This patch series adds pgo/.profraw files from what > per loaded module profile data can be read. > > The final profile can be generated by merging all these profile files: > llvm-profdata merge --output=vmlinux.profdata vmlinux.profraw ... > and then building the optimized kernel. > > This v2 patch series is still an bit of RFC so I'd like feedback how > to do things better still. This looks pretty good; thank you! I sent some notes, which are mostly just clean-ups and patch hunk moves. > The patches itself are based on Kees/for-next/clang/features tree > where I have two of my bug fix patches already in. :-) > > I have done some initial testing: > * Booted the instrumented kernel on qemu *and* bare hardware. > * Module un/loading via test_module in QEMU. > * Built optimized kernel using the new profile data. If you haven't already, can you also test this with lock testing enabled? i.e. these configs: # Detect potential deadlocks. CONFIG_PROVE_LOCKING=y # Detect sleep-while-atomic. CONFIG_DEBUG_ATOMIC_SLEEP=y Thanks! -Kees > > Jarmo Tiitto (5): > pgo: Expose module sections for clang PGO instumentation. > pgo: Make serializing functions to take prf_object > pgo: Wire up the new more generic code for modules > pgo: Add module notifier machinery > pgo: Cleanup code in pgo/fs.c > > include/linux/module.h | 15 +++ > kernel/Makefile | 6 + > kernel/module.c | 7 ++ > kernel/pgo/fs.c | 241 ++++++++++++++++++++++++++++++++++------ > kernel/pgo/instrument.c | 57 +++++++--- > kernel/pgo/pgo.h | 85 ++++++++++---- > 6 files changed, 342 insertions(+), 69 deletions(-) > > > base-commit: 0039303120c0065f3952698597e0c9916b76ebd5 > -- > 2.32.0 > -- Kees Cook