Re: [PATCH V6 11/14] perf/x86/intel: Disable sample-read the slots and metrics events

From: Peter Zijlstra
Date: Tue Jul 21 2020 - 15:18:25 EST


On Tue, Jul 21, 2020 at 12:07:29PM -0400, Liang, Kan wrote:

> I'm trying to produce the bug mentioned above, but I'm not sure under what
> situation, the core code will 'promote' the sibling metric events?

Create an event group:

fd = sys_perf_event_open();
fd1 = sys_perf_event_open(.group_fd = fd);
...

then kill the group leader:

close(fd);

Then the sibling events: fdN, should get promoted. Ideally try and use
fd1 in a read or so after this.

> I tried the suggested code below. It works well for the sample-read case.
> Perf tool errors out as expected.

I'm not sure you can create that case with perf-tool, it's a bit of a
daft thing to do, so you'll have to write a custom program.