Re: [PATCHv2 bpf-next 2/2] bpf: Move bpf_dispatcher function out of ftrace locations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 02, 2022 at 01:14:19PM +0200, Peter Zijlstra wrote:
> On Thu, Sep 01, 2022 at 03:41:50PM +0200, Jiri Olsa wrote:
> 
> > diff --git a/include/linux/bpf.h b/include/linux/bpf.h
> > index 9c1674973e03..4ab4b0a1beb8 100644
> > --- a/include/linux/bpf.h
> > +++ b/include/linux/bpf.h
> > @@ -924,7 +924,15 @@ int arch_prepare_bpf_dispatcher(void *image, s64 *funcs, int num_funcs);
> >  	},							\
> >  }
> >  
> > +#ifdef CONFIG_X86_64
> > +#define BPF_DISPATCHER_ATTRIBUTES __attribute__((__no_instrument_function__)) \
> > +				   __attribute__((patchable_function_entry(5)))
> > +#else
> > +#define BPF_DISPATCHER_ATTRIBUTES
> > +#endif
> > +
> >  #define DEFINE_BPF_DISPATCHER(name)					\
> > +	BPF_DISPATCHER_ATTRIBUTES					\
> >  	noinline __nocfi unsigned int bpf_dispatcher_##name##_func(	\
> >  		const void *ctx,					\
> >  		const struct bpf_insn *insnsi,				\
> 
> Are you sure you want the notrace x86_64 only?
> 
> That is, perhaps something like this...
> 
> +#ifdef CONFIG_X86_64
> +#define BPF_DISPATCHER_ATTRIBUTES	   __attribute__((patchable_function_entry(5)))
> +#else
> +#define BPF_DISPATCHER_ATTRIBUTES
> +#endif
> +
>  #define DEFINE_BPF_DISPATCHER(name)					\
> +	notrace BPF_DISPATCHER_ATTRIBUTES				\
>  	noinline __nocfi unsigned int bpf_dispatcher_##name##_func(	\
> 

that's also an option.. but I don't this it's big deal that the function
is traceable on other arches, because the dispatcher image is generated
only on x86, so no other arch is touching that function entry, so it's
safe for ftrace to attach

jirka



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux