Re: [PATCH] events/uprobes: move smp_read_barrier_depends() where needed

From: Oleg Nesterov
Date: Fri Jun 10 2016 - 15:37:02 EST


On 06/10, Andrea Parri wrote:
>
> On Fri, Jun 10, 2016 at 4:39 PM, Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
>
> > On 06/10, Oleg Nesterov wrote:
> > >
> > > On 06/10, Andrea Parri wrote:
> > > >
> > > > More simply/clean, as you said, maybe; one advantage of keeping
> > > > the "raw" smp_read_barrier_depends() in get_trampoline_vaddr() is
> > > > that we can avoid it when area is NULL;
> > >
> > > Do you really think it makes sense to optimize out read_barrier_depends
> > here?
> > >
> > > It can only be NULL in handle_swbp(), and in this case we are going to
> > do a
> > > lot of work, and in particular install this xol vma,
> >
> > Not to mention that alpha doesn't support uprobes, so this all is currently
> > cosmetic.
> >
>
> Do you mean a "cosmetic" improvement over the current version? ;-)

Yes, if you mean "turn smp_read_barrier_depends into lockless_dereference" ;)
So I will be happy to ack this patch if you make it.

But "optimize out smp_read_barrier_depends if NULL" imho makes no sense.

And, speaking of get_trampoline_vaddr() in particular, it is a bit ugly anyway.
prepare_uretprobe() can not hit area == NULL and doesn't need a barrier, while
handle_swbp() actually wants is_trampoline(bp_vaddr). Not that I really think
this needs a cleanup, at least until we change this code to use multiple
trampolines (say, for different stacks).

Oleg.