[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190117124824.GE10486@hirez.programming.kicks-ass.net>
Date: Thu, 17 Jan 2019 13:48:24 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Song Liu <songliubraving@...com>
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
acme@...nel.org, ast@...nel.org, daniel@...earbox.net,
kernel-team@...com, dsahern@...il.com
Subject: Re: [PATCH v10 perf, bpf-next 1/9] perf, bpf: Introduce
PERF_RECORD_KSYMBOL
On Wed, Jan 16, 2019 at 08:29:23AM -0800, Song Liu wrote:
> +/* callback function to generate ksymbol name */
> +typedef int (perf_ksymbol_get_name_f)(char *name, int name_len, void *data);
> +extern void perf_event_ksymbol(u16 ksym_type, u64 addr, u32 len,
> + bool unregister,
> + perf_ksymbol_get_name_f get_name, void *data);
> +
I'm not liking the getname thing.. I know that's what BPF does, but can
we please do that in the caller or something?
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1114,11 +1114,8 @@ static inline void perf_event_task_sched
extern void perf_event_mmap(struct vm_area_struct *vma);
-/* callback function to generate ksymbol name */
-typedef int (perf_ksymbol_get_name_f)(char *name, int name_len, void *data);
extern void perf_event_ksymbol(u16 ksym_type, u64 addr, u32 len,
- bool unregister,
- perf_ksymbol_get_name_f get_name, void *data);
+ bool unregister, const char *name);
extern struct perf_guest_info_callbacks *perf_guest_cbs;
extern int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks);
@@ -1341,11 +1338,8 @@ static inline int perf_unregister_guest_
static inline void perf_event_mmap(struct vm_area_struct *vma) { }
-typedef int (perf_ksymbol_get_name_f)(char *name, int name_len, void *data);
static inline void perf_event_ksymbol(u16 ksym_type, u64 addr, u32 len,
- bool unregister,
- perf_ksymbol_get_name_f get_name,
- void *data) { }
+ bool unregister, const char *name) { }
static inline void perf_event_exec(void) { }
static inline void perf_event_comm(struct task_struct *tsk, bool exec) { }
static inline void perf_event_namespaces(struct task_struct *tsk) { }
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -7698,8 +7698,7 @@ static void perf_event_ksymbol_output(st
perf_output_end(&handle);
}
-void perf_event_ksymbol(u16 ksym_type, u64 addr, u32 len, bool unregister,
- perf_ksymbol_get_name_f get_name, void *data)
+void perf_event_ksymbol(u16 ksym_type, u64 addr, u32 len, bool unregister, const char *sym)
{
struct perf_ksymbol_event ksymbol_event;
char name[KSYM_NAME_LEN];
@@ -7713,7 +7712,7 @@ void perf_event_ksymbol(u16 ksym_type, u
ksym_type == PERF_RECORD_KSYMBOL_TYPE_UNKNOWN)
goto err;
- get_name(name, KSYM_NAME_LEN, data);
+ strlcpy(name, sym, KSYM_NAME_LEN);
name_len = strlen(name) + 1;
while (!IS_ALIGNED(name_len, sizeof(u64)))
name[name_len++] = '\0';
Powered by blists - more mailing lists