On Thu, Jul 23, 2015 at 09:42:40AM +, Kaixu Xia wrote:
> +static struct perf_event *convert_map_with_perf_event(void *value)
> +{
> + struct perf_event *event;
> + u32 fd;
> +
> + fd = *(u32 *)value;
> +
> + event = perf_event_get(fd);
> + if (IS_ERR(event))
> +
On Thu, Jul 23, 2015 at 09:42:40AM +, Kaixu Xia wrote:
+static struct perf_event *convert_map_with_perf_event(void *value)
+{
+ struct perf_event *event;
+ u32 fd;
+
+ fd = *(u32 *)value;
+
+ event = perf_event_get(fd);
+ if (IS_ERR(event))
+ return
On 7/23/15 7:22 PM, xiakaixu wrote:
+/* check if the value is already stored */
>>+if (array->events[index])
>>+return -EINVAL;
>>+
>>+/* convert the fd to the pointer to struct perf_event */
>>+event = convert_map_with_perf_event(value);
>
>imo helper name is misleading
于 2015/7/24 6:54, Alexei Starovoitov 写道:
> On 7/23/15 2:42 AM, Kaixu Xia wrote:
>> Introduce a new bpf map type 'BPF_MAP_TYPE_PERF_EVENT_ARRAY'.
>> This map only stores the pointer to struct perf_event. The
>> user space event FDs from perf_event_open() syscall are converted
>> to the pointer to
On 7/23/15 2:42 AM, Kaixu Xia wrote:
Introduce a new bpf map type 'BPF_MAP_TYPE_PERF_EVENT_ARRAY'.
This map only stores the pointer to struct perf_event. The
user space event FDs from perf_event_open() syscall are converted
to the pointer to struct perf_event and stored in map.
...
+static
Introduce a new bpf map type 'BPF_MAP_TYPE_PERF_EVENT_ARRAY'.
This map only stores the pointer to struct perf_event. The
user space event FDs from perf_event_open() syscall are converted
to the pointer to struct perf_event and stored in map.
Signed-off-by: Kaixu Xia
---
include/linux/bpf.h
On 7/23/15 2:42 AM, Kaixu Xia wrote:
Introduce a new bpf map type 'BPF_MAP_TYPE_PERF_EVENT_ARRAY'.
This map only stores the pointer to struct perf_event. The
user space event FDs from perf_event_open() syscall are converted
to the pointer to struct perf_event and stored in map.
...
+static
On 7/23/15 7:22 PM, xiakaixu wrote:
+/* check if the value is already stored */
+if (array-events[index])
+return -EINVAL;
+
+/* convert the fd to the pointer to struct perf_event */
+event = convert_map_with_perf_event(value);
imo helper name is misleading and it's too
于 2015/7/24 6:54, Alexei Starovoitov 写道:
On 7/23/15 2:42 AM, Kaixu Xia wrote:
Introduce a new bpf map type 'BPF_MAP_TYPE_PERF_EVENT_ARRAY'.
This map only stores the pointer to struct perf_event. The
user space event FDs from perf_event_open() syscall are converted
to the pointer to struct
Introduce a new bpf map type 'BPF_MAP_TYPE_PERF_EVENT_ARRAY'.
This map only stores the pointer to struct perf_event. The
user space event FDs from perf_event_open() syscall are converted
to the pointer to struct perf_event and stored in map.
Signed-off-by: Kaixu Xia xiaka...@huawei.com
---
10 matches
Mail list logo