[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <561EC917.8090001@plumgrid.com>
Date: Wed, 14 Oct 2015 14:28:55 -0700
From: Alexei Starovoitov <ast@...mgrid.com>
To: Kaixu Xia <xiakaixu@...wei.com>, davem@...emloft.net,
acme@...nel.org, mingo@...hat.com, a.p.zijlstra@...llo.nl,
masami.hiramatsu.pt@...achi.com, jolsa@...nel.org,
daniel@...earbox.net
Cc: wangnan0@...wei.com, linux-kernel@...r.kernel.org,
pi3orama@....com, hekuang@...wei.com, netdev@...r.kernel.org
Subject: Re: [PATCH V2 2/2] bpf: control a set of perf events by creating a
new ioctl PERF_EVENT_IOC_SET_ENABLER
On 10/14/15 5:37 AM, Kaixu Xia wrote:
> + event->p_sample_disable = &enabler_event->sample_disable;
I don't like it as a concept and it's buggy implementation.
What happens here when enabler is alive, but other event is destroyed?
> --- a/kernel/trace/bpf_trace.c
> +++ b/kernel/trace/bpf_trace.c
> @@ -221,9 +221,12 @@ static u64 bpf_perf_event_sample_control(u64 r1, u64 index, u64 flag, u64 r4, u6
> struct bpf_array *array = container_of(map, struct bpf_array, map);
> struct perf_event *event;
>
> - if (unlikely(index >= array->map.max_entries))
> + if (unlikely(index > array->map.max_entries))
> return -E2BIG;
>
> + if (index == array->map.max_entries)
> + index = 0;
what is this hack for ?
Either use notification and user space disable or
call bpf_perf_event_sample_control() manually for each cpu.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists