[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210904230113.cpjota2sttx2w7aa@treble>
Date: Sat, 4 Sep 2021 16:01:13 -0700
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Song Liu <songliubraving@...com>,
"open list:BPF (Safe dynamic programs and tools)"
<bpf@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>,
"acme@...nel.org" <acme@...nel.org>,
"mingo@...hat.com" <mingo@...hat.com>,
"kjain@...ux.ibm.com" <kjain@...ux.ibm.com>,
Kernel Team <Kernel-team@...com>, jbaron@...mai.com,
rostedt@...dmis.org, ardb@...nel.org
Subject: Re: [PATCH v2 bpf-next 1/3] perf: enable branch record for software
events
On Wed, Sep 01, 2021 at 07:12:24PM +0200, Peter Zijlstra wrote:
> On Mon, Aug 30, 2021 at 08:07:24PM +0200, Peter Zijlstra wrote:
> > On Mon, Aug 30, 2021 at 05:41:46PM +0000, Song Liu wrote:
> > > DECLARE_STATIC_CALL(perf_snapshot_branch_stack,
> > > int (*)(struct perf_branch_snapshot *));
> >
> > > Something like
> > >
> > > typedef int (perf_snapshot_branch_stack_t)(struct perf_branch_snapshot *);
> > > DECLARE_STATIC_CALL(perf_snapshot_branch_stack, perf_snapshot_branch_stack_t);
> > >
> > > seems to work fine.
> >
> > Oh urg, indeed. It wants a function type, not a function pointer type.
> > I've been bitten by that before. Go with the typedef, that's the sanest.
>
> The below is the best I can make of it... it's a little inconsistent and
> somewhat tricky, but at least the compiler yells hard if you get it
> wrong.
>
> I can *almost* get to: DEFINE_STATIC_CALL(foo, &func), except for
> ARCH_DEFINE_STATIC_CALL_TRAMP() which needs the actual function name
> string for the ASM :-(
>
> The rest can do with a function pointer type and have it work.
Seems reasonable to me.
--
Josh
Powered by blists - more mailing lists