linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Laura Abbott <labbott@redhat.com>, Arnd Bergmann <arnd@arndb.de>,
	Martin Sebor <msebor@gcc.gnu.org>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Luc Van Oostenryck <luc.vanoostenryck@gmail.com>,
	Andrey Konovalov <andreyknvl@google.com>,
	Kees Cook <keescook@chromium.org>,
	Sean Christopherson <sean.j.christopherson@intel.com>,
	Jessica Yu <jeyu@kernel.org>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	James Morris <james.morris@microsoft.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Borislav Petkov <bp@suse.de>, Matt Mullins <mmullins@fb.com>,
	Vincent Whitchurch <vincent.whitchurch@axis.com>,
	WANG Chao <chao.wang@ucloud.cn>
Subject: Re: [PATCH 0/3] Clean the new GCC 9 -Wmissing-attributes warnings
Date: Sat, 9 Feb 2019 13:31:38 +0100	[thread overview]
Message-ID: <CANiq72kZouVeaJ=NnyYqedCvz9A0K_GHEwuGXkgBbg5R_NRJTw@mail.gmail.com> (raw)
In-Reply-To: <CAKv+Gu9a=W6Fg+ai_W-HB1gL5oUg=FKcGdLk_15CdbHLWt6gMg@mail.gmail.com>

On Sat, Feb 9, 2019 at 12:26 PM Ard Biesheuvel
<ard.biesheuvel@linaro.org> wrote:
>
> On Sat, 9 Feb 2019 at 12:19, Miguel Ojeda
> <miguel.ojeda.sandonis@gmail.com> wrote:
> >
> > It also affects the optimizer in two different ways AFAIK:
> >
> >   * For the function itself, it gets optimized for size instead of speed.
> >   * For callers, the paths that lead to the calls are treated as unlikely.
> >
>
> That seems reasonable, but that still does not mean it is necessarily
> a problem if you apply 'cold' to one but not the other.

Indeed. As I said, it is likely that you missed the attribute, not a
sure thing (i.e. that you didn't do it explicitly).

> > So GCC reports it because you would be (likely) missing the
> > optimizations you expected if you are using the alias instead of the
> > target.
> >
>
> I see how that could be reasonable for extern declarations that do not
> match the definition, since in that case, it is assumed that there is
> only one instance of the function. For function pointers, I don't
> think this assumption is valid.

It sounds reasonable to have another warning for
declarations-definition attribute mismatches too. However, I don't see
why you would warn differently. Even if you have one instance of the
function, you may also be using the declaration to explicitly avoid
the unlikely treatment.

Now, whether the warning is worth or not or at which "level", it
depends. I guess the rationale behind having it under -Wall is that
they expect people to have missed copying the attributes, rather than
they are using aliases specifically to avoid a cold/... attribute.

> > In our case in patch 3, we do not want the optimization for callers,
> > which is why we don't mark the extern declaration as __cold (see the
> > commit message).
> >
>
> You did not cc me on the whole set, so I don't have the patch. But in
> any case, GCC 9 has not been released so we should still have time to
> talk sense into the GCC guys.

I only CC'd people on the relevant patches according to
get_maintainers (but yeah, 2 & 3 are related, I could have merged
those lists). Anyway, using the lore.kernel.org server makes it easy
to see an entire series when you have already one:

  https://lore.kernel.org/lkml/20190209000840.11018-1-miguel.ojeda.sandonis@gmail.com/

As for GCC, Martin (the author of the features) is CC'd, so he can
chime in (and I am sure he appreciates the feedback :-)

Cheers,
Miguel

  reply	other threads:[~2019-02-09 12:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-09  0:08 [PATCH 0/3] Clean the new GCC 9 -Wmissing-attributes warnings Miguel Ojeda
2019-02-09  0:08 ` [PATCH 1/3] lib/crc32.c: mark crc32_le_base/__crc32c_le_base aliases as __pure Miguel Ojeda
2019-02-09  0:08 ` [PATCH 2/3] Compiler Attributes: add support for __copy (gcc >= 9) Miguel Ojeda
2019-02-09  0:41   ` Nick Desaulniers
2019-02-09 12:36     ` Miguel Ojeda
2019-02-09  0:08 ` [PATCH 3/3] include/linux/module.h: copy __init/__exit attrs to init/cleanup_module Miguel Ojeda
2019-02-11 15:01   ` Jessica Yu
2019-02-09 10:44 ` [PATCH 0/3] Clean the new GCC 9 -Wmissing-attributes warnings Ard Biesheuvel
2019-02-09 11:19   ` Miguel Ojeda
2019-02-09 11:25     ` Ard Biesheuvel
2019-02-09 12:31       ` Miguel Ojeda [this message]
2019-02-11 16:21         ` Martin Sebor
2019-02-11 18:20           ` Ard Biesheuvel
2019-02-09 20:32 ` Laura Abbott
2019-02-13 17:30   ` Miguel Ojeda

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='CANiq72kZouVeaJ=NnyYqedCvz9A0K_GHEwuGXkgBbg5R_NRJTw@mail.gmail.com' \
    --to=miguel.ojeda.sandonis@gmail.com \
    --cc=andreyknvl@google.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=arnd@arndb.de \
    --cc=bp@suse.de \
    --cc=catalin.marinas@arm.com \
    --cc=chao.wang@ucloud.cn \
    --cc=herbert@gondor.apana.org.au \
    --cc=james.morris@microsoft.com \
    --cc=jeyu@kernel.org \
    --cc=keescook@chromium.org \
    --cc=krzk@kernel.org \
    --cc=labbott@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luc.vanoostenryck@gmail.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mmullins@fb.com \
    --cc=msebor@gcc.gnu.org \
    --cc=ndesaulniers@google.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=vincent.whitchurch@axis.com \
    --cc=yamada.masahiro@socionext.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).