Re: [RFCv1 1/4] arm64: Use static key for tracing PID in CONTEXTIDR

From: Leo Yan
Date: Thu Oct 21 2021 - 10:37:36 EST


Hi James,

On Thu, Oct 21, 2021 at 03:33:01PM +0100, James Clark wrote:

[...]

> > +static int __init contextidr_init(void)
> > +{
> > + if (IS_ENABLED(CONFIG_PID_IN_CONTEXTIDR))
> > + static_branch_inc(&contextidr_in_use);
> > + return 0;
> > +}
> > +early_initcall(contextidr_init);
>
> Hi Leo,
>
> Can you skip this early_initcall() part if you do something like this:
>
> DECLARE_STATIC_KEY_MAYBE(CONFIG_PID_IN_CONTEXTIDR, contextidr_in_use)
>
> It seems like there is a way to conditionally initialise it to true.

Thanks for good point! Will test this way in next spin.

Leo