Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1247345

Re: [PATCH V2 2/2] bpf: control a set of perf events by creating a new ioctl PERF_EVENT_IOC_SET_ENABLER

From xiakaixu <xiakaixu@huawei.com>
Newsgroups linux.kernel
Subject Re: [PATCH V2 2/2] bpf: control a set of perf events by creating a new ioctl PERF_EVENT_IOC_SET_ENABLER
Date 2015-10-15 04:30 +0200
Message-ID <qjGsO-10W-9@gated-at.bofh.it> (permalink)
References <qjtvA-70U-7@gated-at.bofh.it> <qjtvA-70U-21@gated-at.bofh.it> <qjBMu-2mZ-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


于 2015/10/15 5:28, Alexei Starovoitov 写道:
> 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.

I will discard current implemention that controlling a set of
perf events by the 'enabler' event. Call bpf_perf_event_sample_control()
manually for each cpu is fine. Maybe we can add a loop to control all the
events stored in maps by judging the index, OK?
> 
> 
> 
> .
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH V2 0/2] bpf: enable/disable events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling Kaixu Xia <xiakaixu@huawei.com> - 2015-10-14 14:40 +0200
  [PATCH V2 2/2] bpf: control a set of perf events by creating a new ioctl PERF_EVENT_IOC_SET_ENABLER Kaixu Xia <xiakaixu@huawei.com> - 2015-10-14 14:40 +0200
    Re: [PATCH V2 2/2] bpf: control a set of perf events by creating a  new ioctl PERF_EVENT_IOC_SET_ENABLER Alexei Starovoitov <ast@plumgrid.com> - 2015-10-14 23:30 +0200
      Re: [PATCH V2 2/2] bpf: control a set of perf events by creating  a new ioctl PERF_EVENT_IOC_SET_ENABLER xiakaixu <xiakaixu@huawei.com> - 2015-10-15 04:30 +0200

csiph-web