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


Groups > linux.kernel > #1245312

Re: [RFC PATCH 2/2] bpf: Implement bpf_perf_event_sample_enable/disable() helpers

From "Wangnan (F)" <wangnan0@huawei.com>
Newsgroups linux.kernel
Subject Re: [RFC PATCH 2/2] bpf: Implement bpf_perf_event_sample_enable/disable() helpers
Date 2015-10-13 05:30 +0200
Message-ID <qiYrL-2vS-7@gated-at.bofh.it> (permalink)
References <qiHhh-2LN-29@gated-at.bofh.it> <qiHhh-2LN-27@gated-at.bofh.it> <qiQXg-8t1-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 2015/10/13 3:29, Alexei Starovoitov wrote:
> On 10/12/15 2:02 AM, Kaixu Xia wrote:
>> +extern const struct bpf_func_proto bpf_perf_event_sample_enable_proto;
>> +extern const struct bpf_func_proto bpf_perf_event_sample_disable_proto;
>
> externs are unnecessary. Just make them static.
> Also I prefer single helper that takes a flag, so we can extend it
> instead of adding func_id for every little operation.
>
> To avoid conflicts if you touch kernel/bpf/* or bpf.h please always
> base your patches of net-next.
>
> > +    atomic_set(&map->perf_sample_disable, 0);
>
> global flag per map is no go.
> events are independent and should be treated as such.
>

Then how to avoid racing? For example, when one core disabling all events
in a map, another core is enabling all of them. This racing may causes 
sereval
perf events in a map dump samples while other events not. To avoid such 
racing
I think some locking must be introduced, then cost is even higher.

The reason why we introduce an atomic pointer is because each operation 
should
controls a set of events, not one event, due to the per-cpu manner of 
perf events.

Thank you.

> Please squash these two patches, since they're part of one logical
> feature. Splitting them like this only makes review harder.
>
> -- 
> 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/


--
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 | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH 2/2] bpf: Implement bpf_perf_event_sample_enable/disable() helpers Kaixu Xia <xiakaixu@huawei.com> - 2015-10-12 11:10 +0200
  Re: [RFC PATCH 2/2] bpf: Implement  bpf_perf_event_sample_enable/disable() helpers Alexei Starovoitov <ast@plumgrid.com> - 2015-10-12 21:30 +0200
    Re: [RFC PATCH 2/2] bpf: Implement bpf_perf_event_sample_enable/disable()  helpers "Wangnan (F)" <wangnan0@huawei.com> - 2015-10-13 05:30 +0200
      Re: [RFC PATCH 2/2] bpf: Implement  bpf_perf_event_sample_enable/disable() helpers Alexei Starovoitov <ast@plumgrid.com> - 2015-10-13 05:40 +0200
        Re: [RFC PATCH 2/2] bpf: Implement bpf_perf_event_sample_enable/disable()  helpers "Wangnan (F)" <wangnan0@huawei.com> - 2015-10-13 06:00 +0200
          Re: [RFC PATCH 2/2] bpf: Implement  bpf_perf_event_sample_enable/disable() helpers Alexei Starovoitov <ast@plumgrid.com> - 2015-10-13 06:20 +0200
            Re: [RFC PATCH 2/2] bpf: Implement bpf_perf_event_sample_enable/disable()  helpers "Wangnan (F)" <wangnan0@huawei.com> - 2015-10-13 06:40 +0200
              Re: [RFC PATCH 2/2] bpf: Implement  bpf_perf_event_sample_enable/disable() helpers Alexei Starovoitov <ast@plumgrid.com> - 2015-10-13 07:20 +0200
                Re: [RFC PATCH 2/2] bpf: Implement bpf_perf_event_sample_enable/disable()  helpers "Wangnan (F)" <wangnan0@huawei.com> - 2015-10-13 09:10 +0200
                Re: [RFC PATCH 2/2] bpf: Implement  bpf_perf_event_sample_enable/disable() helpers He Kuang <hekuang@huawei.com> - 2015-10-13 13:00 +0200
                Re: [RFC PATCH 2/2] bpf: Implement bpf_perf_event_sample_enable/disable()  helpers "Wangnan (F)" <wangnan0@huawei.com> - 2015-10-13 13:20 +0200
                Re: [RFC PATCH 2/2] bpf: Implement  bpf_perf_event_sample_enable/disable() helpers Alexei Starovoitov <ast@plumgrid.com> - 2015-10-14 07:20 +0200

csiph-web