Re: [RFC PATCH 1/1] perf/core: Wake up parent event if inherited event has no ring buffer

From: Peter Zijlstra
Date: Tue Jan 25 2022 - 14:13:10 EST


On Mon, Jan 24, 2022 at 02:58:18PM +0000, James Clark wrote:

> > Would this be the better patch?
>
> Yes I tested this and it also works.

Excellent!

> There is one other suspicious access
> of ->rb followed by if(rb) here in perf_poll(), but maybe it works out ok?
>
> mutex_lock(&event->mmap_mutex);
> rb = event->rb;
> if (rb)
> events = atomic_xchg(&rb->poll, 0);
>

That case must be good since it is the event from a file. Those cannot
be clones.

> We also have a Perf self test that covers this failure for Arm SPE now, I'm not
> sure if I should post that separately or with your new version of this fix?

They'd be routed through separate trees anyway, Arnaldo takes the
userspace stuff.