Re: [PATCH net-next 2/2] samples/bpf: add samples for HW_CACHE / RAW events

2017-05-22 Thread David Miller
From: Alexei Starovoitov 
Date: Mon, 22 May 2017 16:35:07 -0700

> yet perf_event_read() is least documented. hmm.
>  * u64 bpf_perf_event_read(, index)
>  * Return: Number events read or error code
> 
> that needs to be fixed.

That's exactly what I was talking about :-)


Re: [PATCH net-next 2/2] samples/bpf: add samples for HW_CACHE / RAW events

2017-05-22 Thread David Miller
From: Alexei Starovoitov 
Date: Mon, 22 May 2017 16:35:07 -0700

> yet perf_event_read() is least documented. hmm.
>  * u64 bpf_perf_event_read(, index)
>  * Return: Number events read or error code
> 
> that needs to be fixed.

That's exactly what I was talking about :-)


Re: [PATCH net-next 2/2] samples/bpf: add samples for HW_CACHE / RAW events

2017-05-22 Thread Alexei Starovoitov

On 5/22/17 4:26 PM, David Miller wrote:

From: Alexei Starovoitov 
Date: Mon, 22 May 2017 15:48:40 -0700


@@ -31,7 +31,7 @@ static unsigned long long (*bpf_get_current_uid_gid)(void) =
(void *) BPF_FUNC_get_current_uid_gid;
 static int (*bpf_get_current_comm)(void *buf, int buf_size) =
(void *) BPF_FUNC_get_current_comm;
-static int (*bpf_perf_event_read)(void *map, int index) =
+static u64 (*bpf_perf_event_read)(void *map, u64 flags) =
(void *) BPF_FUNC_perf_event_read;


If the second argument really is "u64 flags", then please update
the comments in tools/include/uapi/linux/bpf.h as well.


of course.
As independent patch, I assume.
For both tools/include/uapi/...bpf.h and include/uapi/...bpf.h

It has some info:
/* BPF_FUNC_perf_event_output and BPF_FUNC_perf_event_read flags. */
#define BPF_F_INDEX_MASK0xULL
#define BPF_F_CURRENT_CPU   BPF_F_INDEX_MASK

yet perf_event_read() is least documented. hmm.
 * u64 bpf_perf_event_read(, index)
 * Return: Number events read or error code

that needs to be fixed.


Re: [PATCH net-next 2/2] samples/bpf: add samples for HW_CACHE / RAW events

2017-05-22 Thread Alexei Starovoitov

On 5/22/17 4:26 PM, David Miller wrote:

From: Alexei Starovoitov 
Date: Mon, 22 May 2017 15:48:40 -0700


@@ -31,7 +31,7 @@ static unsigned long long (*bpf_get_current_uid_gid)(void) =
(void *) BPF_FUNC_get_current_uid_gid;
 static int (*bpf_get_current_comm)(void *buf, int buf_size) =
(void *) BPF_FUNC_get_current_comm;
-static int (*bpf_perf_event_read)(void *map, int index) =
+static u64 (*bpf_perf_event_read)(void *map, u64 flags) =
(void *) BPF_FUNC_perf_event_read;


If the second argument really is "u64 flags", then please update
the comments in tools/include/uapi/linux/bpf.h as well.


of course.
As independent patch, I assume.
For both tools/include/uapi/...bpf.h and include/uapi/...bpf.h

It has some info:
/* BPF_FUNC_perf_event_output and BPF_FUNC_perf_event_read flags. */
#define BPF_F_INDEX_MASK0xULL
#define BPF_F_CURRENT_CPU   BPF_F_INDEX_MASK

yet perf_event_read() is least documented. hmm.
 * u64 bpf_perf_event_read(, index)
 * Return: Number events read or error code

that needs to be fixed.


Re: [PATCH net-next 2/2] samples/bpf: add samples for HW_CACHE / RAW events

2017-05-22 Thread David Miller
From: Alexei Starovoitov 
Date: Mon, 22 May 2017 15:48:40 -0700

> @@ -31,7 +31,7 @@ static unsigned long long (*bpf_get_current_uid_gid)(void) =
>   (void *) BPF_FUNC_get_current_uid_gid;
>  static int (*bpf_get_current_comm)(void *buf, int buf_size) =
>   (void *) BPF_FUNC_get_current_comm;
> -static int (*bpf_perf_event_read)(void *map, int index) =
> +static u64 (*bpf_perf_event_read)(void *map, u64 flags) =
>   (void *) BPF_FUNC_perf_event_read;

If the second argument really is "u64 flags", then please update
the comments in tools/include/uapi/linux/bpf.h as well.

Thank you.


Re: [PATCH net-next 2/2] samples/bpf: add samples for HW_CACHE / RAW events

2017-05-22 Thread David Miller
From: Alexei Starovoitov 
Date: Mon, 22 May 2017 15:48:40 -0700

> @@ -31,7 +31,7 @@ static unsigned long long (*bpf_get_current_uid_gid)(void) =
>   (void *) BPF_FUNC_get_current_uid_gid;
>  static int (*bpf_get_current_comm)(void *buf, int buf_size) =
>   (void *) BPF_FUNC_get_current_comm;
> -static int (*bpf_perf_event_read)(void *map, int index) =
> +static u64 (*bpf_perf_event_read)(void *map, u64 flags) =
>   (void *) BPF_FUNC_perf_event_read;

If the second argument really is "u64 flags", then please update
the comments in tools/include/uapi/linux/bpf.h as well.

Thank you.