Re: [PATCH] perf/core: fast breakpoint modification via _IOC_MODIFY_BREAKPOINT

From: Milind Chabbi
Date: Mon Nov 13 2017 - 03:03:04 EST


SNIP

On Sun, Nov 12, 2017 at 11:46 PM, Jiri Olsa <jolsa@xxxxxxxxxx> wrote:

> but you closed fd4 before openning fd5..?

Yes, that is correct. I closed fd4. The reason is by closing fd4, we
are having a total of 3 hardware breakpoints active, but we are making
the software counting in the kernel think that four TYPE_DATA
breakpoints active. The counting should have disallowed us from
creating fd5 as per the following logic in the kernel:

static int __reserve_bp_slot(struct perf_event *bp)

{
....

/* Flexible counters need to keep at least one slot */
if (slots.pinned + (!!slots.flexible) > nr_slots[type])
return -ENOSPC;
....
}