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=-23.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_IN_DEF_DKIM_WL 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 082F3C2B9F4 for ; Tue, 22 Jun 2021 08:09:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DA0D960FE9 for ; Tue, 22 Jun 2021 08:09:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229876AbhFVILl (ORCPT ); Tue, 22 Jun 2021 04:11:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229677AbhFVILl (ORCPT ); Tue, 22 Jun 2021 04:11:41 -0400 Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E64FC061766 for ; Tue, 22 Jun 2021 01:09:24 -0700 (PDT) Received: by mail-ot1-x32b.google.com with SMTP id i12-20020a05683033ecb02903346fa0f74dso20401152otu.10 for ; Tue, 22 Jun 2021 01:09:24 -0700 (PDT) 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=+KIhMHmG9xEoplSTe5YdDdzfi1paJ8XARniBwjTg03k=; b=Ym455ybyRuVNtnqTpdt7P8X+q69idT6SEJDlahlRmKJV8J1gpOx0evM0YjyJjusrTf a8cXrmGrAxJi7wlgusfO0uVUo/9QC971ql1DFoeOSzqCDZzmmHzsiKbu8s3eDfoCSt6G P2swb91IEChiat4UVcQfZ6vzmOk8Glck115Ho3zoNfvpzah8z5QZpvwHE39XDIyAgBuv 5gKW3tUs6lXErSCW6dacjs/ovleLewk67xUMAYNuTPq0/GqpoqUPtJ4oQBzqKf+sfFss /PtP6vNZC9LNRq6pivnr+kGJzasgfAfQuYKy+cVS8XlVMpWthsCQBcaV6ll+O2N9Akmy ksdg== 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=+KIhMHmG9xEoplSTe5YdDdzfi1paJ8XARniBwjTg03k=; b=uE/Hfzw03p7jfweWrTDdVMsaTJPlpTOwPF7MKbl6t5wIHY7Yo3UmAlwYfLSKE93Y4M YkN5Drs214Suo9sajz/WeA+iJ30Qfygd7dCvUjQYnVrgLqCmI3L4b3v+bR/g8BWWcp+p EJtDJNXd5R0omV6vcJgbx0E4+BD7MsbmT0+cAPXaei88GVf7+6Yc23fK8WWvRudcdj3g vo2mOkI/MhPzflBAjfvJwrDDNIihFoKCuZ3ATW5vOU2MNICX3+fx7QoVaYKpHvDMBzru 2uo9Y5ilK3kdStMYtu08FrW9BbbFbCoN8bUlVpwRSK7c9vNMCvgxJrGT7XxsXyUhtWii ypOA== X-Gm-Message-State: AOAM532BLvQrAzQ1BzuZqzSUHKciUteXm9o+9PKsz44JoAR+oJUlcbcI v96AQEMY+P9GIwtBRkNyv9XBbOzcG5e1lhyx4Pm33g== X-Google-Smtp-Source: ABdhPJxgFSBmdcbDb55PtEoRgnwSIeaz86uH0dDuE3fvOVYXbp9t15kLoyQklb8X4sv2BZbnmGZBqSmyIw3TqpcW5Eg= X-Received: by 2002:a05:6830:1bcb:: with SMTP id v11mr2131100ota.251.1624349363988; Tue, 22 Jun 2021 01:09:23 -0700 (PDT) MIME-Version: 1.0 References: <20210621231822.2848305-1-ndesaulniers@google.com> <20210621231822.2848305-4-ndesaulniers@google.com> In-Reply-To: From: Marco Elver Date: Tue, 22 Jun 2021 10:09:10 +0200 Message-ID: Subject: Re: [PATCH v2 3/3] Kconfig: add ARCH_WANTS_NO_INSTR+CC_HAS_NO_PROFILE_FN_ATTR, depend on for GCOV and PGO To: Peter Zijlstra Cc: Nick Desaulniers , Kees Cook , Bill Wendling , Sami Tolvanen , Peter Oberparleiter , Masahiro Yamada , Miguel Ojeda , Nathan Chancellor , Luc Van Oostenryck , Ard Biesheuvel , Will Deacon , Arnd Bergmann , Andrew Morton , Rasmus Villemoes , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, x86@kernel.org, Borislav Petkov , Martin Liska , Jonathan Corbet , Fangrui Song , linux-doc@vger.kernel.org, linux-kbuild@vger.kernel.org, Dmitry Vyukov , johannes.berg@intel.com, linux-toolchains@vger.kernel.org, Heiko Carstens , Vasily Gorbik , Christian Borntraeger , linux-s390@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Catalin Marinas Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-toolchains@vger.kernel.org On Tue, 22 Jun 2021 at 09:26, Peter Zijlstra wrote: > > On Mon, Jun 21, 2021 at 04:18:22PM -0700, Nick Desaulniers wrote: > > We don't want compiler instrumentation to touch noinstr functions, which > > are annotated with the no_profile_instrument_function function > > attribute. Add a Kconfig test for this and make PGO and GCOV depend on > > it. > > > > If an architecture is using noinstr, it should denote that via this > > Kconfig value. That makes Kconfigs that depend on noinstr able to > > express dependencies in an architecturally agnostic way. > > > > Cc: Masahiro Yamada > > Cc: Peter Oberparleiter > > Link: https://lore.kernel.org/lkml/YMTn9yjuemKFLbws@hirez.programming.kicks-ass.net/ > > Link: https://lore.kernel.org/lkml/YMcssV%2Fn5IBGv4f0@hirez.programming.kicks-ass.net/ > > Suggested-by: Nathan Chancellor > > Suggested-by: Peter Zijlstra > > Signed-off-by: Nick Desaulniers > > --- > > Changes V1 -> V2: > > * Add ARCH_WANTS_NO_INSTR > > * Change depdendencies to be !ARCH_WANTS_NO_INSTR || CC_HAS_NO_PROFILE_FN_ATTR > > rather than list architectures explicitly, as per Nathan. > > * s/no_profile/no_profile_instrument_function/ > > > > arch/Kconfig | 7 +++++++ > > arch/arm64/Kconfig | 1 + > > arch/s390/Kconfig | 1 + > > arch/x86/Kconfig | 1 + > > init/Kconfig | 3 +++ > > kernel/gcov/Kconfig | 1 + > > kernel/pgo/Kconfig | 3 ++- > > 7 files changed, 16 insertions(+), 1 deletion(-) > > > > diff --git a/arch/Kconfig b/arch/Kconfig > > index 2b4109b0edee..2113c6b3b801 100644 > > --- a/arch/Kconfig > > +++ b/arch/Kconfig > > @@ -285,6 +285,13 @@ config ARCH_THREAD_STACK_ALLOCATOR > > config ARCH_WANTS_DYNAMIC_TASK_STRUCT > > bool > > > > +config ARCH_WANTS_NO_INSTR > > + bool > > + help > > + An architecure should select this if the noinstr macro is being used on > > + functions to denote that the toolchain should avoid instrumenting such > > + functions and is required for correctness. > > + > > config ARCH_32BIT_OFF_T > > bool > > depends on !64BIT > > There's also CC_HAS_WORKING_NOSANITIZE_ADDRESS in lib/Kconfig.kasan that > might want to be hooked into this, but that can be done separately I > suppose. KASAN already depends on this for all compiler instrumentation modes, not just for 'noinstr' but also to avoid false positives. So it's not just for noinstr's benefit, and we should not weaken the requirement there.