Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4490552pxj; Tue, 22 Jun 2021 01:10:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNTgqT7f+oLqXDa6XoTV9apq4dvihFlG7+2jHsjmKuvfthTSvVRSD2xnnmxhDg++Zj+PkN X-Received: by 2002:a6b:c707:: with SMTP id x7mr430805iof.160.1624349410657; Tue, 22 Jun 2021 01:10:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624349410; cv=none; d=google.com; s=arc-20160816; b=awj2HnMk80PusKljsLZgavPpro/DdvrRi1rbeWQ26KDTgxNjaOeBGYyHCglYeLOGMA 8zZB1cDYxRbV5H2KIqhzzmG1gbYq9R6LfHkGRee2IxE/wOTu0jCQkZq/2MBkaBNIfzTj ivJlU4GzUqvZiKdraVV5Lb10ybpKDBFUkaRD1I0vJhj/k3xN0YFLCytE17lrjmYeI+bU /BDtwesmrPYelQSN5750DkzkT16ooDKpsix+VAvYbkhQR/o7hem2EEf6OH5vgO5VYn8z A+JVa351DY4Gw1gief+UzX9P/SxCwec1IoNUf5q5gZqff98WK0j8mcxxfcN5cVuhqm4j 0Gng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=+KIhMHmG9xEoplSTe5YdDdzfi1paJ8XARniBwjTg03k=; b=a4TShtnVJfPBcWFWyrBB64sAYdAntP7tTpYBoxHWVkpXgVETTD77kjkygWVH8tP/Fx H2MGOYY/GBbLh087j+isy6BHA9wfp9dwbqvfK3I2kQ5mjyEO5K9vDAOmsFdVLMCSamE0 7B911uSPt+Et4jyq9erH3F4vJcJJsgoezkr+wjm1PZ8bljh5gxy0v8FRlaeEJvBHncp3 zKanJKjfp4J5MZfGzLtYHbDvJhJR5jVvZ0vEdFHx+EKZ9Upn2SYOQzbM8+kLsk+C4fa1 ed1oYMXEAwfpedmHzIjZKL6fIi12Eo/X+zp5utYNB1rqbur3wMosakGYmNVfTbH3mLYj QyFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Ym455yby; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p10si15240441ilg.70.2021.06.22.01.09.57; Tue, 22 Jun 2021 01:10:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Ym455yby; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229695AbhFVILm (ORCPT + 99 others); Tue, 22 Jun 2021 04:11:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229853AbhFVILl (ORCPT ); Tue, 22 Jun 2021 04:11:41 -0400 Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3E34C061756 for ; Tue, 22 Jun 2021 01:09:24 -0700 (PDT) Received: by mail-ot1-x32d.google.com with SMTP id v22-20020a0568301416b029044e2d8e855eso11218945otp.8 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=BgbKOgNOsBGjbyR05APF1/00CWVnbx8S0mPeGJYwccd5jW8H9opt7e7+6lSMYAmQbt 0V5QyDzP3933vrzYKoqGFvfd075IBU+nLDwT1BO3ZFhptNCBQz0WpVVX8k/5esPl8onK hip44C11wrUSs+G8XT+hy6fwOnRo5uO0FaXxGxgdf7laMAE29WC3U1XS27xcmXqaCFAw 8C4m4g16Jkzwz0T82c9nFFrJznKfMu68zj6Go0Etitd5LDMW5u8ASCjJqYJ5+bxB7j5U WMbszG2vPnLqSLYsvY54MviuBDkNy2b5vc/ilWg8PNvtzEkUqnYr59XKriADush/8FlF kfEg== X-Gm-Message-State: AOAM533XI0msEc3cqtmWjvQBo8SBVSWSKe2TU2awlFM1lx4rQOYNGNMj /QwJ764/N/CqsguRsSnpHfzlar55XVn/7UIPKcjYGQ== 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-kernel@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.