lkml.org 
[lkml]   [2019]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [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';
\
 
 \ /
  Last update: 2019-01-17 13:48    [W:0.140 / U:16.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site