linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
	<x86@kernel.org>, Peter Oberparleiter <oberpar@linux.ibm.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Johannes Berg <johannes.berg@intel.com>,
	Nathan Chancellor <nathan@kernel.org>,
	Kees Cook <keescook@chromium.org>, Marco Elver <elver@google.com>,
	Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH] gcov,x86: Mark GCOV broken for x86
Date: Mon, 14 Jun 2021 11:05:35 -0700	[thread overview]
Message-ID: <CAKwvOdmPTi93n2L0_yQkrzLdmpxzrOR7zggSzonyaw2PGshApw@mail.gmail.com> (raw)
In-Reply-To: <20210614162018.GD68749@worktop.programming.kicks-ass.net>

On Mon, Jun 14, 2021 at 9:20 AM Peter Zijlstra <peterz@infradead.org> wrote:
>
> On Mon, Jun 14, 2021 at 09:05:04AM -0700, Nick Desaulniers wrote:
> > On Mon, Jun 14, 2021 at 3:17 AM Peter Zijlstra <peterz@infradead.org> wrote:
> > >
> > >
> > > As recently discovered, there is no function attribute to disable the
> > > -fprofile-generate instrumentation. As such, GCOV is fundamentally
> > > incompatible with architectures that rely on 'noinstr' for correctness.
> >
> > Is there context for comment, or is this patch meant as a joke?
>
> Only if you think recursion in exception entry code is funny.
>
> noinstr *MUST* disable any and all compiler generated instrumentation,
> currently it that isn't the case for -fprofile-gnerate, nor
> -fprofile-arc.
>
> Look for all the fun we had with KCOV back then. Luckily KCOV
> instrumentation was trivial to patch out using objtool, so that's what
> x86 is currently doing.
>
> Luckily both compilers grew a __no_sanitize_coverage recently and we no
> longer have to rely on objtool fixing up the compiler output for much
> longer.
>
>   https://lkml.kernel.org/r/20210527194448.3470080-1-elver@google.com
>
> Now all we need is one more such attribute to kill -fprofile-* stuff.

__attribute__((no_instrument_function)) is already wired to not emit
calls to mcount()/fentry().  I think extending it to also apply to
coverage (-fprofile-arcs) and instrumentation based profiling
(-fprofile-generate) is reasonable.

-- 
Thanks,
~Nick Desaulniers

  reply	other threads:[~2021-06-14 18:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-14 10:17 Peter Zijlstra
2021-06-14 10:31 ` Marco Elver
2021-06-14 14:43 ` Peter Oberparleiter
2021-06-18 11:13   ` Peter Zijlstra
2021-06-21 13:53     ` Peter Oberparleiter
2021-06-14 16:05 ` Nick Desaulniers
2021-06-14 16:20   ` Peter Zijlstra
2021-06-14 18:05     ` Nick Desaulniers [this message]
2021-06-14 18:20       ` Borislav Petkov
2021-06-14 19:03         ` Nick Desaulniers
2021-06-14 19:28           ` Borislav Petkov
2021-06-14 18:31       ` Fangrui Song
2021-06-14 19:07         ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKwvOdmPTi93n2L0_yQkrzLdmpxzrOR7zggSzonyaw2PGshApw@mail.gmail.com \
    --to=ndesaulniers@google.com \
    --cc=elver@google.com \
    --cc=johannes.berg@intel.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=nathan@kernel.org \
    --cc=oberpar@linux.ibm.com \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    --subject='Re: [PATCH] gcov,x86: Mark GCOV broken for x86' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox