Re: [PATCH v3 2/3] bpf: Implement function bpf_perf_event_read() that get the selected hardware PMU conuter

2015-08-03 Thread xiakaixu
于 2015/8/3 17:34, Peter Zijlstra 写道: > On Thu, Jul 23, 2015 at 09:42:41AM +, Kaixu Xia wrote: >> +static u64 bpf_perf_event_read(u64 r1, u64 index, u64 r3, u64 r4, u64 r5) >> +{ >> +struct bpf_map *map = (struct bpf_map *) (unsigned long) r1; >> +struct bpf_array *array =

Re: [PATCH v3 2/3] bpf: Implement function bpf_perf_event_read() that get the selected hardware PMU conuter

2015-08-03 Thread Peter Zijlstra
On Thu, Jul 23, 2015 at 09:42:41AM +, Kaixu Xia wrote: > +static u64 bpf_perf_event_read(u64 r1, u64 index, u64 r3, u64 r4, u64 r5) > +{ > + struct bpf_map *map = (struct bpf_map *) (unsigned long) r1; > + struct bpf_array *array = container_of(map, struct bpf_array, map); > +

Re: [PATCH v3 2/3] bpf: Implement function bpf_perf_event_read() that get the selected hardware PMU conuter

2015-08-03 Thread Peter Zijlstra
On Thu, Jul 23, 2015 at 09:42:41AM +, Kaixu Xia wrote: +static u64 bpf_perf_event_read(u64 r1, u64 index, u64 r3, u64 r4, u64 r5) +{ + struct bpf_map *map = (struct bpf_map *) (unsigned long) r1; + struct bpf_array *array = container_of(map, struct bpf_array, map); + struct

Re: [PATCH v3 2/3] bpf: Implement function bpf_perf_event_read() that get the selected hardware PMU conuter

2015-08-03 Thread xiakaixu
于 2015/8/3 17:34, Peter Zijlstra 写道: On Thu, Jul 23, 2015 at 09:42:41AM +, Kaixu Xia wrote: +static u64 bpf_perf_event_read(u64 r1, u64 index, u64 r3, u64 r4, u64 r5) +{ +struct bpf_map *map = (struct bpf_map *) (unsigned long) r1; +struct bpf_array *array = container_of(map,

Re: [PATCH v3 2/3] bpf: Implement function bpf_perf_event_read() that get the selected hardware PMU conuter

2015-07-23 Thread xiakaixu
于 2015/7/24 6:56, Alexei Starovoitov 写道: > On 7/23/15 2:42 AM, Kaixu Xia wrote: >> According to the perf_event_map_fd and index, the function >> bpf_perf_event_read() can convert the corresponding map >> value to the pointer to struct perf_event and return the >> Hardware PMU counter value. >> >>

Re: [PATCH v3 2/3] bpf: Implement function bpf_perf_event_read() that get the selected hardware PMU conuter

2015-07-23 Thread Alexei Starovoitov
On 7/23/15 2:42 AM, Kaixu Xia wrote: According to the perf_event_map_fd and index, the function bpf_perf_event_read() can convert the corresponding map value to the pointer to struct perf_event and return the Hardware PMU counter value. Signed-off-by: Kaixu Xia ... +static u64

[PATCH v3 2/3] bpf: Implement function bpf_perf_event_read() that get the selected hardware PMU conuter

2015-07-23 Thread Kaixu Xia
According to the perf_event_map_fd and index, the function bpf_perf_event_read() can convert the corresponding map value to the pointer to struct perf_event and return the Hardware PMU counter value. Signed-off-by: Kaixu Xia --- include/linux/bpf.h| 1 + include/linux/perf_event.h | 3

Re: [PATCH v3 2/3] bpf: Implement function bpf_perf_event_read() that get the selected hardware PMU conuter

2015-07-23 Thread Alexei Starovoitov
On 7/23/15 2:42 AM, Kaixu Xia wrote: According to the perf_event_map_fd and index, the function bpf_perf_event_read() can convert the corresponding map value to the pointer to struct perf_event and return the Hardware PMU counter value. Signed-off-by: Kaixu Xia xiaka...@huawei.com ... +static

Re: [PATCH v3 2/3] bpf: Implement function bpf_perf_event_read() that get the selected hardware PMU conuter

2015-07-23 Thread xiakaixu
于 2015/7/24 6:56, Alexei Starovoitov 写道: On 7/23/15 2:42 AM, Kaixu Xia wrote: According to the perf_event_map_fd and index, the function bpf_perf_event_read() can convert the corresponding map value to the pointer to struct perf_event and return the Hardware PMU counter value.

[PATCH v3 2/3] bpf: Implement function bpf_perf_event_read() that get the selected hardware PMU conuter

2015-07-23 Thread Kaixu Xia
According to the perf_event_map_fd and index, the function bpf_perf_event_read() can convert the corresponding map value to the pointer to struct perf_event and return the Hardware PMU counter value. Signed-off-by: Kaixu Xia xiaka...@huawei.com --- include/linux/bpf.h| 1 +