trace_uprobe: support reference counter in fd-based uprobe
Subsystems (2)
PATCH RESEND 1/1 trace_uprobe: support reference counter in fd-based uprobe
This patch enables uprobes with reference counter in fd-based uprobe. Highest 40 bits of perf_event_attr.config is used to stored offset of the reference counter (semaphore).
Format information in /sys/bus/event_source/devices/uprobe/format/ is updated to reflect this new feature.
--- include/linux/trace_events.h | 3 +- kernel/events/core.c | 49 ++++++++++++++++++++++++++------- kernel/trace/trace_event_perf.c | 7 +++-- kernel/trace/trace_probe.h | 3 +- kernel/trace/trace_uprobe.c | 4 ++- 5 files changed, 50 insertions(+), 16 deletions(-)
include/linux/trace_events.h +2 -1
@@ -575,7 +575,8 @@ extern int bpf_get_kprobe_info(const struct perf_event *event, bool perf_type_tracepoint);#endif #ifdef CONFIG_UPROBE_EVENTS -extern int perf_uprobe_init (struct perf_event *event,bool is_retprobe); +extern int perf_uprobe_init (struct perf_event *event, +unsigned long ref_ctr_offset,bool is_retprobe);extern void perf_uprobe_destroy (struct perf_event *event); extern int bpf_get_uprobe_info(const struct perf_event *event, u32 *fd_type, const char **filename,
kernel/events/core.c +39 -10
101 lines not on this page · raw message
kernel/trace/trace_event_perf.c +4 -3
@@ -290,7 +290,8 @@ void perf_kprobe_destroy(struct perf_event *p_event)#endif /* CONFIG_KPROBE_EVENTS */ #ifdef CONFIG_UPROBE_EVENTS -int perf_uprobe_init (struct perf_event *p_event,bool is_retprobe) +int perf_uprobe_init (struct perf_event *p_event, +unsigned long ref_ctr_offset,bool is_retprobe) {int ret;char *path =NULL ;
@@ -312,8 +313,8 @@ int perf_uprobe_init(struct perf_event *p_event, bool is_retprobe) goto out; } - tp_event =create_local_trace_uprobe ( - path, p_event->attr.probe_offset, is_retprobe); + tp_event =create_local_trace_uprobe (path, p_event->attr.probe_offset, + ref_ctr_offset, is_retprobe);if (IS_ERR (tp_event)) { ret =PTR_ERR (tp_event); goto out;
kernel/trace/trace_probe.h +2 -1
@@ -412,6 +412,7 @@ create_local_trace_kprobe(char *func, void *addr, unsigned long offs,extern void destroy_local_trace_kprobe (struct trace_event_call *event_call);extern struct trace_event_call * -create_local_trace_uprobe (char *name,unsigned long offs,bool is_return); +create_local_trace_uprobe (char *name,unsigned long offs, +unsigned long ref_ctr_offset,bool is_return);extern void destroy_local_trace_uprobe (struct trace_event_call *event_call);#endif
kernel/trace/trace_uprobe.c +3 -1
@@ -1405,7 +1405,8 @@ static int unregister_uprobe_event(struct trace_uprobe *tu)#ifdef CONFIG_PERF_EVENTS struct trace_event_call * -create_local_trace_uprobe (char *name,unsigned long offs,bool is_return) +create_local_trace_uprobe (char *name,unsigned long offs, +unsigned long ref_ctr_offset,bool is_return) {struct trace_uprobe *tu;struct path path;
@@ -1437,6 +1438,7 @@ create_local_trace_uprobe(char *name, unsigned long offs, bool is_return) tu->offset = offs; tu->path = path; + tu->ref_ctr_offset = ref_ctr_offset; tu->filename =kstrdup (name,GFP_KERNEL );init_trace_event_call (tu, &tu->tp.call);
--
2.17.1
kbuild test robot
build botThank you for the patch! Yet something to improve:
Hi Song,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on tip/perf/core]
[also build test ERROR on v4.19-rc5 next-20180925]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Song-Liu/trace_uprobe-support-reference-counter-in-fd-based-uprobe/20180925-135454
config: i386-randconfig-x005-201838 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce:
# save the attached .config to linux build tree
make ARCH=i386 All errors (new ones prefixed by >>):
kernel/trace/trace_uprobe.c: In function 'create_local_trace_uprobe':
>> kernel/trace/trace_uprobe.c:1376:4: error: 'struct trace_uprobe' has no member named 'ref_ctr_offset'
tu->ref_ctr_offset = ref_ctr_offset;
^~vim +1376 kernel/trace/trace_uprobe.c
1340
1341 #ifdef CONFIG_PERF_EVENTS
1342 struct trace_event_call *
1343 create_local_trace_uprobe(char *name, unsigned long offs,
1344 unsigned long ref_ctr_offset, bool is_return)
1345 {
1346 struct trace_uprobe *tu;
1347 struct path path;
1348 int ret;
1349
1350 ret = kern_path(name, LOOKUP_FOLLOW, &path);
1351 if (ret)
1352 return ERR_PTR(ret);
1353
1354 if (!d_is_reg(path.dentry)) {
1355 path_put(&path);
1356 return ERR_PTR(-EINVAL);
1357 }
1358
1359 /*
1360 * local trace_kprobes are not added to probe_list, so they are never
1361 * searched in find_trace_kprobe(). Therefore, there is no concern of
1362 * duplicated name "DUMMY_EVENT" here.
1363 */
1364 tu = alloc_trace_uprobe(UPROBE_EVENT_SYSTEM, "DUMMY_EVENT", 0,
1365 is_return);
1366
1367 if (IS_ERR(tu)) {
1368 pr_info("Failed to allocate trace_uprobe.(%d)\n",
1369 (int)PTR_ERR(tu));
1370 path_put(&path);
1371 return ERR_CAST(tu);
1372 }
1373
1374 tu->offset = offs;
1375 tu->path = path;
> 1376 tu->ref_ctr_offset = ref_ctr_offset;
1377 tu->filename = kstrdup(name, GFP_KERNEL);
1378 init_trace_event_call(tu, &tu->tp.call);
1379
1380 if (set_print_fmt(&tu->tp, is_ret_probe(tu)) < 0) {
1381 ret = -ENOMEM;
1382 goto error;
1383 }
1384
1385 return &tu->tp.call;
1386 error:
1387 free_trace_uprobe(tu);
1388 return ERR_PTR(ret);
1389 }
1390
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi,
This patch is based on this branch:
https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git/log/?h=ftrace/core
Thanks,
Song
Quoted 82 lines · kbuild test robot
Hi Song,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on tip/perf/core]
[also build test ERROR on v4.19-rc5 next-20180925]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]url: https://github.com/0day-ci/linux/commits/Song-Liu/trace_uprobe-support-reference-counter-in-fd-based-uprobe/20180925-135454
config: i386-randconfig-x005-201838 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce:# save the attached .config to linux build tree make ARCH=i386All errors (new ones prefixed by >>):
kernel/trace/trace_uprobe.c: In function 'create_local_trace_uprobe':Quoted 1 line
Quoted 1 line
kernel/trace/trace_uprobe.c:1376:4: error: 'structtrace_uprobe' has no member named 'ref_ctr_offset'tu->ref_ctr_offset = ref_ctr_offset; ^~vim +1376
kernel/trace/trace_uprobe.c1340
1341 #ifdefCONFIG_PERF_EVENTS
1342 structtrace_event_call*
1343 create_local_trace_uprobe(char *name, unsigned long offs,
1344 unsigned longref_ctr_offset, boolis_return)
1345 {
1346 structtrace_uprobe*tu;
1347 struct path path;
1348 int ret;
1349
1350 ret =kern_path(name, LOOKUP_FOLLOW, &path);
1351 if (ret)
1352 returnERR_PTR(ret);
1353
1354 if (!d_is_reg(path.dentry)) {
1355path_put(&path);
1356 returnERR_PTR(-EINVAL);
1357 }
1358
1359 /*
1360 * localtrace_kprobesare not added toprobe_list, so they are never
1361 * searched infind_trace_kprobe(). Therefore, there is no concern of
1362 * duplicated name "DUMMY_EVENT" here.
1363 */
1364 tu = alloc_trace_uprobe(UPROBE_EVENT_SYSTEM, "DUMMY_EVENT", 0,
1365is_return);
1366
1367 if (IS_ERR(tu)) {
1368 pr_info("Failed to allocate trace_uprobe.(%d)\n",
1369 (int)PTR_ERR(tu));
1370path_put(&path);
1371 returnERR_CAST(tu);
1372 }
1373
1374tu->offset= offs;
1375tu->path= path;Quoted 1 line
1376
tu->ref_ctr_offset=ref_ctr_offset;1377
tu->filename=kstrdup(name, GFP_KERNEL);
1378init_trace_event_call(tu, &tu->tp.call);
1379
1380 if (set_print_fmt(&tu->tp, is_ret_probe(tu))< 0) {
1381 ret =-ENOMEM;
1382 goto error;
1383 }
1384
1385 return&tu->tp.call;
1386 error:
1387free_trace_uprobe(tu);
1388 returnERR_PTR(ret);
1389 }
1390---
0-DAY kernel test infrastructure Open Source Technology Center
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.01.org_pipermail_kbuild-2Dall&d=DwIBAg&c=5VD0RTtNlTh3ycd41b3MUw&r=i6WobKxbeG3slzHSIOxTVtYIJw7qjCE6S0spDTKL-J4&m=3vAXcNkXYHALEVsIZG7-ToPCNADLh0bCVwEpureyaaw&s=eKJR9UoqZ2KCoTN58CznxX7ipOGdcRwG0zWFLsbzHXc&e= Intel Corporation
<.config.gz>
Steven Rostedt
maintainerQuoted 14 lines · On Mon, 24 Sep 2018 14:12:36 -0700 Song Liu <[email protected]> wrote:
This patch enables uprobes with reference counter in fd-based uprobe. Highest 40 bits of perf_event_attr.config is used to stored offset of the reference counter (semaphore).
Format information in
/sys/bus/event_source/devices/uprobe/format/is updated to reflect this new feature.Signed-off-by Song Liu <[email protected]>Reviewed-and-tested-by Ravi Bangoria <[email protected]>Cc Masami Hiramatsu <[email protected]>Cc Oleg Nesterov <[email protected]>Cc Srikar Dronamraju <[email protected]>Cc Naveen N. Rao <[email protected]>Cc Steven Rostedt (VMware) <[email protected]>
Quoted 4 lines
--- include/linux/trace_events.h | 3 +- kernel/events/core.c | 49 ++++++++++++++++++++++++++------- kernel/trace/trace_event_perf.c | 7 +++--
Peter,
This is based off of some uprobe code in my tree (which I just finished testing and need to push to linux-next). But can you give an ack to the perf parts?
Thanks!
-- Steve
Quoted 190 lines
kernel/trace/trace_probe.h | 3 +- kernel/trace/trace_uprobe.c | 4 ++- 5 files changed, 50 insertions(+), 16 deletions(-)include/linux/trace_events.h +2
-1@@ -575,7 +575,8 @@ extern int bpf_get_kprobe_info(const struct perf_event *event, bool perf_type_tracepoint);#endif #ifdef CONFIG_UPROBE_EVENTS -extern int perf_uprobe_init (struct perf_event *event,bool is_retprobe); +extern int perf_uprobe_init (struct perf_event *event, +unsigned long ref_ctr_offset,bool is_retprobe);extern void perf_uprobe_destroy (struct perf_event *event); extern int bpf_get_uprobe_info(const struct perf_event *event, u32 *fd_type, const char **filename,kernel/events/core.c +39
-10@@ -8368,30 +8368,39 @@ static struct pmu perf_tracepoint = {* * PERF_PROBE_CONFIG_IS_RETPROBE if set, create kretprobe/uretprobe * if not set, create kprobe/uprobe +* +* The following values specify a reference counter (or semaphore in the +* terminology of tools like dtrace, systemtap, etc.) Userspace Statically +* Defined Tracepoints (USDT). Currently, we use 40 bit for the offset. +* +* PERF_UPROBE_REF_CTR_OFFSET_BITS # of bits in config as th offset +* PERF_UPROBE_REF_CTR_OFFSET_SHIFT # of bits to shift left */ enum perf_probe_config {PERF_PROBE_CONFIG_IS_RETPROBE =1U <<0 ,/* [k,u]retprobe */ +PERF_UPROBE_REF_CTR_OFFSET_BITS =40 , +PERF_UPROBE_REF_CTR_OFFSET_SHIFT =64 -PERF_UPROBE_REF_CTR_OFFSET_BITS , };PMU_FORMAT_ATTR (retprobe,"config:0" ); +#endif -static struct attribute *probe_attrs[] = { +#ifdef CONFIG_KPROBE_EVENTS +static struct attribute *kprobe_attrs[] = { &format_attr_retprobe.attr,NULL , }; -static struct attribute_group probe_format_group = { +static struct attribute_group kprobe_format_group = { .name ="format" , - .attrs = probe_attrs, + .attrs = kprobe_attrs, }; -static const struct attribute_group *probe_attr_groups[] = { - &probe_format_group, +static const struct attribute_group *kprobe_attr_groups[] = { + &kprobe_format_group,NULL , }; -#endif -#ifdef CONFIG_KPROBE_EVENTS static int perf_kprobe_event_init (struct perf_event *event);static struct pmu perf_kprobe = { .task_ctx_nr = perf_sw_context,@@ -8401,7 +8410,7 @@ static struct pmu perf_kprobe = { .start = perf_swevent_start, .stop = perf_swevent_stop, .read = perf_swevent_read, - .attr_groups = probe_attr_groups, + .attr_groups = kprobe_attr_groups, };static int perf_kprobe_event_init (struct perf_event *event)@@ -8433,6 +8442,24 @@ static int perf_kprobe_event_init(struct perf_event *event)#endif /* CONFIG_KPROBE_EVENTS */ #ifdef CONFIG_UPROBE_EVENTS +PMU_FORMAT_ATTR (ref_ctr_offset,"config:63-24" ); + +static struct attribute *uprobe_attrs[] = { + &format_attr_retprobe.attr, + &format_attr_ref_ctr_offset.attr, +NULL , +}; + +static struct attribute_group uprobe_format_group = { + .name ="format" , + .attrs = uprobe_attrs, +}; + +static const struct attribute_group *uprobe_attr_groups[] = { + &uprobe_format_group, +NULL , +}; +static int perf_uprobe_event_init (struct perf_event *event);static struct pmu perf_uprobe = { .task_ctx_nr = perf_sw_context,@@ -8442,12 +8469,13 @@ static struct pmu perf_uprobe = { .start = perf_swevent_start, .stop = perf_swevent_stop, .read = perf_swevent_read, - .attr_groups = probe_attr_groups, + .attr_groups = uprobe_attr_groups, };static int perf_uprobe_event_init (struct perf_event *event) {int err; +unsigned long ref_ctr_offset;bool is_retprobe;if (event->attr.type != perf_uprobe.type)@@ -8463,7 +8491,8 @@ static int perf_uprobe_event_init(struct perf_event *event)return -EOPNOTSUPP ; is_retprobe = event->attr.config &PERF_PROBE_CONFIG_IS_RETPROBE ; - err =perf_uprobe_init (event, is_retprobe); + ref_ctr_offset = event->attr.config >>PERF_UPROBE_REF_CTR_OFFSET_SHIFT ; + err =perf_uprobe_init (event, ref_ctr_offset, is_retprobe);if (err)return err;kernel/trace/trace_event_perf.c +4
-3@@ -290,7 +290,8 @@ void perf_kprobe_destroy(struct perf_event *p_event)#endif /* CONFIG_KPROBE_EVENTS */ #ifdef CONFIG_UPROBE_EVENTS -int perf_uprobe_init (struct perf_event *p_event,bool is_retprobe) +int perf_uprobe_init (struct perf_event *p_event, +unsigned long ref_ctr_offset,bool is_retprobe) {int ret;char *path =NULL ;@@ -312,8 +313,8 @@ int perf_uprobe_init(struct perf_event *p_event, bool is_retprobe) goto out; } - tp_event =create_local_trace_uprobe ( - path, p_event->attr.probe_offset, is_retprobe); + tp_event =create_local_trace_uprobe (path, p_event->attr.probe_offset, + ref_ctr_offset, is_retprobe);if (IS_ERR (tp_event)) { ret =PTR_ERR (tp_event); goto out;kernel/trace/trace_probe.h +2
-1@@ -412,6 +412,7 @@ create_local_trace_kprobe(char *func, void *addr, unsigned long offs,extern void destroy_local_trace_kprobe (struct trace_event_call *event_call);extern struct trace_event_call * -create_local_trace_uprobe (char *name,unsigned long offs,bool is_return); +create_local_trace_uprobe (char *name,unsigned long offs, +unsigned long ref_ctr_offset,bool is_return);extern void destroy_local_trace_uprobe (struct trace_event_call *event_call);#endif kernel/trace/trace_uprobe.c +3
-2@@ -1405,7 +1405,8 @@ static int unregister_uprobe_event(struct trace_uprobe *tu)#ifdef CONFIG_PERF_EVENTS struct trace_event_call * -create_local_trace_uprobe (char *name,unsigned long offs,bool is_return) +create_local_trace_uprobe (char *name,unsigned long offs, +unsigned long ref_ctr_offset,bool is_return) {struct trace_uprobe *tu;struct path path;@@ -1437,6 +1438,7 @@ create_local_trace_uprobe(char *name, unsigned long offs, bool is_return) tu->offset = offs; tu->path = path; + tu->ref_ctr_offset = ref_ctr_offset; tu->filename =kstrdup (name,GFP_KERNEL );init_trace_event_call (tu, &tu->tp.call); --2.17.1
Peter Zijlstra
maintainerQuoted 50 lines · Steven Rostedt
Quoted 14 lines · On Mon, 24 Sep 2018 14:12:36 -0700 Song Liu <[email protected]> wrote:
This patch enables uprobes with reference counter in fd-based uprobe. Highest 40 bits of perf_event_attr.config is used to stored offset of the reference counter (semaphore).
Format information in
/sys/bus/event_source/devices/uprobe/format/is updated to reflect this new feature.Signed-off-by Song Liu <[email protected]>Reviewed-and-tested-by Ravi Bangoria <[email protected]>Cc Masami Hiramatsu <[email protected]>Cc Oleg Nesterov <[email protected]>Cc Srikar Dronamraju <[email protected]>Cc Naveen N. Rao <[email protected]>Cc Steven Rostedt (VMware) <[email protected]>Quoted 4 lines
--- include/linux/trace_events.h | 3 +- kernel/events/core.c | 49 ++++++++++++++++++++++++++------- kernel/trace/trace_event_perf.c | 7 +++--Peter,
This is based off of some uprobe code in my tree (which I just finished testing and need to push to linux-next). But can you give an ack to the perf parts?
Quoted 22 lines
kernel/events/core.c +9
-0@@ -8368,30 +8368,39 @@ static struct pmu perf_tracepoint = {* * PERF_PROBE_CONFIG_IS_RETPROBE if set, create kretprobe/uretprobe * if not set, create kprobe/uprobe +* +* The following values specify a reference counter (or semaphore in the +* terminology of tools like dtrace, systemtap, etc.) Userspace Statically +* Defined Tracepoints (USDT). Currently, we use 40 bit for the offset. +* +* PERF_UPROBE_REF_CTR_OFFSET_BITS # of bits in config as th offset +* PERF_UPROBE_REF_CTR_OFFSET_SHIFT # of bits to shift left */ enum perf_probe_config {PERF_PROBE_CONFIG_IS_RETPROBE =1U <<0 ,/* [k,u]retprobe */ +PERF_UPROBE_REF_CTR_OFFSET_BITS =40 , +PERF_UPROBE_REF_CTR_OFFSET_SHIFT =64 -PERF_UPROBE_REF_CTR_OFFSET_BITS , };
Quoted 1 line
kernel/events/core.c static struct pmu perf_tracepoint = { · line 8385
Quoted 1 line
kernel/events/core.c +0
-0PMU_FORMAT_ATTR (retprobe,"config:0" );
There's a PMU_FORMAT_ATTR() missing for the new part.
Hi Peter,
Quoted 99 lines · Song Liu
This patch enables uprobes with reference counter in fd-based uprobe. Highest 40 bits of perf_event_attr.config is used to stored offset of the reference counter (semaphore).
Format information in
/sys/bus/event_source/devices/uprobe/format/is updated to reflect this new feature.Signed-off-by Song Liu <[email protected]>Reviewed-and-tested-by Ravi Bangoria <[email protected]>Cc Masami Hiramatsu <[email protected]>Cc Oleg Nesterov <[email protected]>Cc Srikar Dronamraju <[email protected]>Cc Naveen N. Rao <[email protected]>Cc Steven Rostedt (VMware) <[email protected]>---
include/linux/trace_events.h | 3 +- kernel/events/core.c | 49 ++++++++++++++++++++++++++------- kernel/trace/trace_event_perf.c | 7 +++-- kernel/trace/trace_probe.h | 3 +- kernel/trace/trace_uprobe.c | 4 ++- 5 files changed, 50 insertions(+), 16 deletions(-)include/linux/trace_events.h +2
-1@@ -575,7 +575,8 @@ extern int bpf_get_kprobe_info(const struct perf_event *event, bool perf_type_tracepoint);#endif #ifdef CONFIG_UPROBE_EVENTS -extern int perf_uprobe_init (struct perf_event *event,bool is_retprobe); +extern int perf_uprobe_init (struct perf_event *event, +unsigned long ref_ctr_offset,bool is_retprobe);extern void perf_uprobe_destroy (struct perf_event *event); extern int bpf_get_uprobe_info(const struct perf_event *event, u32 *fd_type, const char **filename,kernel/events/core.c +17
-8@@ -8368,30 +8368,39 @@ static struct pmu perf_tracepoint = {* * PERF_PROBE_CONFIG_IS_RETPROBE if set, create kretprobe/uretprobe * if not set, create kprobe/uprobe +* +* The following values specify a reference counter (or semaphore in the +* terminology of tools like dtrace, systemtap, etc.) Userspace Statically +* Defined Tracepoints (USDT). Currently, we use 40 bit for the offset. +* +* PERF_UPROBE_REF_CTR_OFFSET_BITS # of bits in config as th offset +* PERF_UPROBE_REF_CTR_OFFSET_SHIFT # of bits to shift left */ enum perf_probe_config {PERF_PROBE_CONFIG_IS_RETPROBE =1U <<0 ,/* [k,u]retprobe */ +PERF_UPROBE_REF_CTR_OFFSET_BITS =40 , +PERF_UPROBE_REF_CTR_OFFSET_SHIFT =64 -PERF_UPROBE_REF_CTR_OFFSET_BITS , };PMU_FORMAT_ATTR (retprobe,"config:0" ); +#endif -static struct attribute *probe_attrs[] = { +#ifdef CONFIG_KPROBE_EVENTS +static struct attribute *kprobe_attrs[] = { &format_attr_retprobe.attr,NULL , }; -static struct attribute_group probe_format_group = { +static struct attribute_group kprobe_format_group = { .name ="format" , - .attrs = probe_attrs, + .attrs = kprobe_attrs, }; -static const struct attribute_group *probe_attr_groups[] = { - &probe_format_group, +static const struct attribute_group *kprobe_attr_groups[] = { + &kprobe_format_group,NULL , }; -#endif -#ifdef CONFIG_KPROBE_EVENTS static int perf_kprobe_event_init (struct perf_event *event);static struct pmu perf_kprobe = { .task_ctx_nr = perf_sw_context,@@ -8401,7 +8410,7 @@ static struct pmu perf_kprobe = { .start = perf_swevent_start, .stop = perf_swevent_stop, .read = perf_swevent_read, - .attr_groups = probe_attr_groups, + .attr_groups = kprobe_attr_groups, };static int perf_kprobe_event_init (struct perf_event *event)
kernel/events/core.c static int perf_kprobe_event_init(struct perf_event *event) · line 8445
Quoted 4 lines
kernel/events/core.c +1
-0@@ -8433,6 +8442,24 @@ static int perf_kprobe_event_init(struct perf_event *event)#endif /* CONFIG_KPROBE_EVENTS */ #ifdef CONFIG_UPROBE_EVENTS +PMU_FORMAT_ATTR (ref_ctr_offset,"config:63-24" );
I guess you meant this part? This is for uprobe only, so I put it here.
Thanks,
Song
Quoted 28 lines
kernel/events/core.c +18
-1+ +static struct attribute *uprobe_attrs[] = { + &format_attr_retprobe.attr, + &format_attr_ref_ctr_offset.attr, +NULL , +}; + +static struct attribute_group uprobe_format_group = { + .name ="format" , + .attrs = uprobe_attrs, +}; + +static const struct attribute_group *uprobe_attr_groups[] = { + &uprobe_format_group, +NULL , +}; +static int perf_uprobe_event_init (struct perf_event *event);static struct pmu perf_uprobe = { .task_ctx_nr = perf_sw_context,@@ -8442,12 +8469,13 @@ static struct pmu perf_uprobe = { .start = perf_swevent_start, .stop = perf_swevent_stop, .read = perf_swevent_read, - .attr_groups = probe_attr_groups, + .attr_groups = uprobe_attr_groups, };
Peter Zijlstra
maintainerQuoted 6 lines · Song Liu
Hi Peter,
Quoted 2 lines
#ifdef
CONFIG_UPROBE_EVENTS
+PMU_FORMAT_ATTR(ref_ctr_offset, "config:63-24");I guess you meant this part? This is for uprobe only, so I put it here.
Ah,.. right you are.
You seem to have the bitfield backwards, does that mean we should write the bits in backwards too? Seems a tad loopy if you ask me.
Did you instead mean: "config:24-63" ? Also, why 40 bits? 32 seems like a much more natural amount.
Quoted 12 lines · Peter Zijlstra
Quoted 6 lines · Song Liu
Hi Peter,
Quoted 2 lines
#ifdef
CONFIG_UPROBE_EVENTS
+PMU_FORMAT_ATTR(ref_ctr_offset, "config:63-24");I guess you meant this part? This is for uprobe only, so I put it here.
Quoted 7 lines
Ah,.. right you are.
You seem to have the bitfield backwards, does that mean we should write the bits in backwards too? Seems a tad loopy if you ask me.
Did you instead mean: "config:24-63" ? Also, why 40 bits? 32 seems like a much more natural amount.
I guess it should be "config:24-63". I didn't realize the bit order here. I picked 40 bits files up to 1 TB. 32 bits should be also be enough for most cases. Let me fix these in v2.
Thanks,
Song