mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Marc Zyngier <maz@kernel.org>,
	linux-kernel@vger.kernel.org, Reiji Watanabe <reijiw@google.com>,
	Will Deacon <will@kernel.org>
Subject: Re: [PATCH] perf/core: Drop __weak attribute from arch_perf_update_userpage() prototype
Date: Mon, 12 Jun 2023 16:54:23 +0200	[thread overview]
Message-ID: <20230612145423.GC83892@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <ZIcarHx0qbfC2iyy@FVFF77S0Q05N>

On Mon, Jun 12, 2023 at 02:16:28PM +0100, Mark Rutland wrote:
> On Sat, Jun 03, 2023 at 09:25:19AM +0100, Marc Zyngier wrote:
> > Reiji reports that the arm64 implementation of arch_perf_update_userpage()
> > is now ignored and replaced by the dummy stub in core code.
> > This seems to happen since the PMUv3 driver was moved to driver/perf.
> 
> I guess we should have a Cc stable then?
> 
> The below implies this has always been on dodgy ground, and so it's probably
> inaccurate to give this a Fixes tag pointing to the move.
> 
> > As it turns out, dropping the __weak attribute from the *prototype*
> > of the function solves the problem. You're right, this doesn't seem
> > to make much sense. And yet... It appears that both symbols get
> > flagged as weak, and that the first one to appear in the link order
> > wins:
> > 
> > $ nm drivers/perf/arm_pmuv3.o|grep arch_perf_update_userpage
> > 0000000000001db0 W arch_perf_update_userpage
> 
> Ah, so having it on th *declaration* will apply to any *definition*. :/

Yikes..

> That suggests this is a bad pattern generally, and we should probably remove
> the other __weak instances in headers. Lukcily it seems there aren't that many:
> 
> [mark@lakrids:~/src/linux]% git grep __weak -- **/*.h | wc -l
> 50
> 
> IMO we'd should aim to remove __weak entirely; it causes a number of weird
> things like this and it'd be much easier to manage with a small amount of
> ifdeffery.
> 
> Peter, thoughts?

Not a fan of __weak myself, after having had to deal with how the
compilers actually make it work.

Where do I queue this? perf/urgent?

  parent reply	other threads:[~2023-06-12 14:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-03  8:25 Marc Zyngier
2023-06-04 16:08 ` Reiji Watanabe
2023-06-12 13:16 ` Mark Rutland
2023-06-12 14:16   ` Marc Zyngier
2023-06-12 14:54   ` Peter Zijlstra [this message]
2023-06-12 15:03     ` Marc Zyngier
2023-06-16  9:06       ` 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=20230612145423.GC83892@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=reijiw@google.com \
    --cc=will@kernel.org \
    /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

all inboxes | Powered by JetHome®