Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1666299 > unrolled thread
| Started by | Jeremy Linton <jeremy.linton@arm.com> |
|---|---|
| First post | 2017-06-15 00:40 +0200 |
| Last post | 2017-06-15 00:40 +0200 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH v2 00/13] trace: add the ability to parse sizeof() Jeremy Linton <jeremy.linton@arm.com> - 2017-06-15 00:40 +0200
[PATCH v2 03/13] trace: rename struct module entry for trace enums Jeremy Linton <jeremy.linton@arm.com> - 2017-06-15 00:40 +0200
| From | Jeremy Linton <jeremy.linton@arm.com> |
|---|---|
| Date | 2017-06-15 00:40 +0200 |
| Subject | [PATCH v2 00/13] trace: add the ability to parse sizeof() |
| Message-ID | <tSoXw-2yP-9@gated-at.bofh.it> |
There are a few cases of sizeof() embedded in TRACE_EVENT()
macros. That is a problem because "sizeof(structure)" is
passed to userspace, which doesn't know how to decode the
size of kernel data structures. There was a similar problem
with enums.
Rather than recreating much of the enum infrastructure lets
simply extend it, and append additional symbols into the
enum_map that can translate string sizeof() calls into
values. Of course that means that much of the infrastructure
is now poorly named so we go through and replace instances
describing "enum" with "eval" to indicate a generic C
expression to numerical evaluation routine.
v1->v2:
Modify the sample trace file to reflect a more reasonable example
Add an additional TRACE_DEFINE_SIZEOF() for fjes_hw_request_info
Add an additional patch to convert some hardcoded size values to sizeof
Jeremy Linton (13):
trace: rename kernel enum section to eval
trace: rename trace_enum_map to trace_eval_map
trace: rename struct module entry for trace enums
trace: rename trace enum data structures in trace.c
trace: rename trace_enum_mutex to trace_eval_mutex
trace: rename trace.c enum functions
trace: rename enum_map functions
tracing: Rename enum_replace to eval_replace
tracing: define TRACE_DEFINE_SIZEOF() macro to map sizeof's to their
values
tracing: Update sample file to describe the new macro
tracing: Add TRACE_DEFINE_SIZEOF() macros
tracing: Replace some majic constants with sizeof()
tracing: Rename and update the enum_map file
arch/arm64/kvm/trace.h | 2 +
drivers/net/fjes/fjes_trace.h | 2 +
include/asm-generic/vmlinux.lds.h | 6 +-
include/linux/module.h | 4 +-
include/linux/tracepoint.h | 7 +-
include/trace/events/thermal.h | 4 +-
include/trace/events/thermal_power_allocator.h | 4 +-
include/trace/events/xen.h | 13 +-
include/trace/trace_events.h | 26 +++-
kernel/module.c | 6 +-
kernel/trace/Kconfig | 22 +--
kernel/trace/trace.c | 194 ++++++++++++-------------
kernel/trace/trace.h | 4 +-
kernel/trace/trace_events.c | 24 +--
samples/trace_events/trace-events-sample.h | 28 ++--
sound/firewire/motu/amdtp-motu-trace.h | 12 +-
16 files changed, 202 insertions(+), 156 deletions(-)
--
2.9.4
[toc] | [next] | [standalone]
| From | Jeremy Linton <jeremy.linton@arm.com> |
|---|---|
| Date | 2017-06-15 00:40 +0200 |
| Subject | [PATCH v2 03/13] trace: rename struct module entry for trace enums |
| Message-ID | <tSp7c-2DF-23@gated-at.bofh.it> |
| In reply to | #1666299 |
Each module has a list of enum's its contributing to the
enum map, rename that entry to reflect its use by more than
enums.
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
include/linux/module.h | 4 ++--
kernel/module.c | 6 +++---
kernel/trace/trace.c | 6 +++---
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/linux/module.h b/include/linux/module.h
index 46b4804..8eb9a1e 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -442,8 +442,8 @@ struct module {
#ifdef CONFIG_EVENT_TRACING
struct trace_event_call **trace_events;
unsigned int num_trace_events;
- struct trace_eval_map **trace_enums;
- unsigned int num_trace_enums;
+ struct trace_eval_map **trace_evals;
+ unsigned int num_trace_evals;
#endif
#ifdef CONFIG_FTRACE_MCOUNT_RECORD
unsigned int num_ftrace_callsites;
diff --git a/kernel/module.c b/kernel/module.c
index 9ec4713..df1c4a9 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -3077,9 +3077,9 @@ static int find_module_sections(struct module *mod, struct load_info *info)
mod->trace_events = section_objs(info, "_ftrace_events",
sizeof(*mod->trace_events),
&mod->num_trace_events);
- mod->trace_enums = section_objs(info, "_ftrace_eval_map",
- sizeof(*mod->trace_enums),
- &mod->num_trace_enums);
+ mod->trace_evals = section_objs(info, "_ftrace_eval_map",
+ sizeof(*mod->trace_evals),
+ &mod->num_trace_evals);
#endif
#ifdef CONFIG_TRACING
mod->trace_bprintk_fmt_start = section_objs(info, "__trace_printk_fmt",
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index f82764b..85f0e3c 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -7718,7 +7718,7 @@ static void __init trace_enum_init(void)
#ifdef CONFIG_MODULES
static void trace_module_add_enums(struct module *mod)
{
- if (!mod->num_trace_enums)
+ if (!mod->num_trace_evals)
return;
/*
@@ -7728,7 +7728,7 @@ static void trace_module_add_enums(struct module *mod)
if (trace_module_has_bad_taint(mod))
return;
- trace_insert_enum_map(mod, mod->trace_enums, mod->num_trace_enums);
+ trace_insert_enum_map(mod, mod->trace_evals, mod->num_trace_evals);
}
#ifdef CONFIG_TRACE_ENUM_MAP_FILE
@@ -7737,7 +7737,7 @@ static void trace_module_remove_enums(struct module *mod)
union trace_enum_map_item *map;
union trace_enum_map_item **last = &trace_enum_maps;
- if (!mod->num_trace_enums)
+ if (!mod->num_trace_evals)
return;
mutex_lock(&trace_enum_mutex);
--
2.9.4
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web