From patchwork Wed Jun 14 22:27:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 105596 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp512070qgd; Wed, 14 Jun 2017 15:27:42 -0700 (PDT) X-Received: by 10.98.100.8 with SMTP id y8mr2036713pfb.79.1497479262245; Wed, 14 Jun 2017 15:27:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497479262; cv=none; d=google.com; s=arc-20160816; b=qvGAWBS1CNX0Tsyv6PtP9796cLMbrvhoTCa7FWrYpSj1HPWByyx5YO0TV0jJg8Ucjd q9qlasOTdmLp3cSOgoLJceARF9VEUNeG1iH1fjgn9CvvO0T/77rZQYpFTI48DBAZz7m+ 5bKYvP3EWNIcxBzLddYBUNQEGm6Lvo3uhsCitzQ55HwH5PoAkwf2LWZGN+l4jjk0qmYt Tw4m+iNvvB20u86JhvZuNOAs+6PjUXOZbsCtasRtqxaSseprs0U5PfKcjTmndflKk9xl YB77R2GJIh1dfjtIN0Iwi3lX62+NL3W6gPTfV6MycDKZqhmv9XZBcCBZJjnpHPgChrM+ 8/3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=oCEgMugLNIk1eHaGkIS0Lwx1isnVLJsNkI05RlFckDw=; b=jf0wO8ratXf9wGPD2s6WtMaFoGLkpN8/3E8iBTVcesTJ+yM6LW3awpjz9cWn7SDAg0 W2MhJ5eCYgV2edhRxa9TLDiZzPXbENYp8skBxUTwTy8eOh8mvAZOPkJJXo3aOoU0SoH0 TYrYlsXKOqdwhzfwVgw6flL4y3i94yF7gW4pyMQiGSY30/w+VtxTnZjOX8fr01Y5W2T6 C6NkzA8twt7stnQhxOMM8V0bLMTvSf82GzWo+aB1JivrChOf1OkWG/ggqj9y7XVlwrCZ qZHxlRPkf4krYajrYcjl1ynzf+9mkvUEmsSO9NK1u9la1it+ZFUKwb9WJiE51hzpWqSR sdtg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si886660plh.539.2017.06.14.15.27.41; Wed, 14 Jun 2017 15:27:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752681AbdFNW1g (ORCPT + 25 others); Wed, 14 Jun 2017 18:27:36 -0400 Received: from foss.arm.com ([217.140.101.70]:39566 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752080AbdFNW1b (ORCPT ); Wed, 14 Jun 2017 18:27:31 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5D3CC15A2; Wed, 14 Jun 2017 15:27:31 -0700 (PDT) Received: from beelzebub.ast.arm.com (beelzebub.austin.arm.com [10.118.12.119]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C89883F3E1; Wed, 14 Jun 2017 15:27:30 -0700 (PDT) From: Jeremy Linton To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, rostedt@goodmis.org, mingo@redhat.com, rusty@rustcorp.com.au, jeyu@redhat.com, kirill.shutemov@linux.intel.com, christoffer.dall@linaro.org, marc.zyngier@arm.com, jcm@jonmasters.org, clemens@ladisch.de, perex@perex.cz Subject: [PATCH v2 01/13] trace: rename kernel enum section to eval Date: Wed, 14 Jun 2017 17:27:17 -0500 Message-Id: <20170614222729.16521-2-jeremy.linton@arm.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170614222729.16521-1-jeremy.linton@arm.com> References: <20170614222729.16521-1-jeremy.linton@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The kernel and its modules have sections containing the enum string to value conversions. Rename this section because we intend to store more than enums in it. Signed-off-by: Jeremy Linton --- include/asm-generic/vmlinux.lds.h | 6 +++--- include/trace/trace_events.h | 2 +- kernel/module.c | 2 +- kernel/trace/trace.c | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) -- 2.9.4 diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 314a0b9..800f9f9 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -125,9 +125,9 @@ VMLINUX_SYMBOL(__start_ftrace_events) = .; \ KEEP(*(_ftrace_events)) \ VMLINUX_SYMBOL(__stop_ftrace_events) = .; \ - VMLINUX_SYMBOL(__start_ftrace_enum_maps) = .; \ - KEEP(*(_ftrace_enum_map)) \ - VMLINUX_SYMBOL(__stop_ftrace_enum_maps) = .; + VMLINUX_SYMBOL(__start_ftrace_eval_maps) = .; \ + KEEP(*(_ftrace_eval_map)) \ + VMLINUX_SYMBOL(__stop_ftrace_eval_maps) = .; #else #define FTRACE_EVENTS() #endif diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h index 00f6431..4bdd840 100644 --- a/include/trace/trace_events.h +++ b/include/trace/trace_events.h @@ -43,7 +43,7 @@ TRACE_MAKE_SYSTEM_STR(); .enum_value = a \ }; \ static struct trace_enum_map __used \ - __attribute__((section("_ftrace_enum_map"))) \ + __attribute__((section("_ftrace_eval_map"))) \ *TRACE_SYSTEM##_##a = &__##TRACE_SYSTEM##_##a /* diff --git a/kernel/module.c b/kernel/module.c index 4a3665f..9ec4713 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -3077,7 +3077,7 @@ 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_enum_map", + mod->trace_enums = section_objs(info, "_ftrace_eval_map", sizeof(*mod->trace_enums), &mod->num_trace_enums); #endif diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index c4536c4..ce564c2 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -7704,15 +7704,15 @@ struct dentry *tracing_init_dentry(void) return NULL; } -extern struct trace_enum_map *__start_ftrace_enum_maps[]; -extern struct trace_enum_map *__stop_ftrace_enum_maps[]; +extern struct trace_enum_map *__start_ftrace_eval_maps[]; +extern struct trace_enum_map *__stop_ftrace_eval_maps[]; static void __init trace_enum_init(void) { int len; - len = __stop_ftrace_enum_maps - __start_ftrace_enum_maps; - trace_insert_enum_map(NULL, __start_ftrace_enum_maps, len); + len = __stop_ftrace_eval_maps - __start_ftrace_eval_maps; + trace_insert_enum_map(NULL, __start_ftrace_eval_maps, len); } #ifdef CONFIG_MODULES From patchwork Wed Jun 14 22:27:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 105608 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp513009qgd; Wed, 14 Jun 2017 15:30:29 -0700 (PDT) X-Received: by 10.84.217.134 with SMTP id p6mr2498524pli.192.1497479429823; Wed, 14 Jun 2017 15:30:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497479429; cv=none; d=google.com; s=arc-20160816; b=vgKS9tCfc/vSMdkathei0crguydO/3pT2Tl5sWY0mx6bqEIMMbdlMn9wBmCN4yVLRc hel8L8io140VuNFEL1uamGqQSavkyx7YVAxp0JjTZs8IprSSiEXWco+vMjPG8p5rZwGs T9vecOmsUY9FDWTbSfsRD3Tn5O3VBhnVGyjL6CqvyXoqBgwM1nK1+BXfBf0n4usACxn/ S0S+uppDqR1SF0vTAsk6gMInwmFaNoVNKaA/YYuiqHqq66YCIdPiF0G8Cg230PgyugSY uiGCfFnlryMvKuEbvqD9u8krbFouoqgndUxrsg1uvJxwCmVEXILgY87cetn3Dj8Djs6q 6JZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=wWZDXkVr6H26vo+QvK6/ldVAudgoDGG2ueYp+W6eEjM=; b=sdehC4q90smSl+vuxTyTE+zrqt+XHVwh/c+ppBWROL9PVUPp4weYWzOYEYEfLTJ9fn b55E0KpbF66Vez3QSfFyRQ3tT6xEvwadtiP7X/ypBT5j4Lazs3vgUpnVAsrNr6rm9QP4 QQZZrX4e/MG/uFxUKq56eiJnDqO1t4Ao/AuLxAXIlDO+R8R8TKEAAe8BLwg6C4XYrMnT iRVxzcieC9fF1iQmdPpufZH9MyQcnTlF8u2riBVvoHkms2w8N7l/1VsGFsfGDd3rp75Z /7t85SrEdT0mUtX+L4M4vECwQ43TpmklCUey8wGzyOvle875whvOoUVXEObBhK7Ss0kg HLfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g21si840807pgn.445.2017.06.14.15.30.29; Wed, 14 Jun 2017 15:30:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753092AbdFNWaV (ORCPT + 25 others); Wed, 14 Jun 2017 18:30:21 -0400 Received: from foss.arm.com ([217.140.101.70]:39592 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752272AbdFNW1c (ORCPT ); Wed, 14 Jun 2017 18:27:32 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EE72215B2; Wed, 14 Jun 2017 15:27:31 -0700 (PDT) Received: from beelzebub.ast.arm.com (beelzebub.austin.arm.com [10.118.12.119]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 656D43F3E1; Wed, 14 Jun 2017 15:27:31 -0700 (PDT) From: Jeremy Linton To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, rostedt@goodmis.org, mingo@redhat.com, rusty@rustcorp.com.au, jeyu@redhat.com, kirill.shutemov@linux.intel.com, christoffer.dall@linaro.org, marc.zyngier@arm.com, jcm@jonmasters.org, clemens@ladisch.de, perex@perex.cz Subject: [PATCH v2 02/13] trace: rename trace_enum_map to trace_eval_map Date: Wed, 14 Jun 2017 17:27:18 -0500 Message-Id: <20170614222729.16521-3-jeremy.linton@arm.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170614222729.16521-1-jeremy.linton@arm.com> References: <20170614222729.16521-1-jeremy.linton@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Each enum is loaded into the trace_enum_map, as we are now using this for more than enums rename it. Signed-off-by: Jeremy Linton --- include/linux/module.h | 2 +- include/linux/tracepoint.h | 6 +++--- include/trace/trace_events.h | 8 ++++---- kernel/trace/trace.c | 24 ++++++++++++------------ kernel/trace/trace.h | 4 ++-- kernel/trace/trace_events.c | 14 +++++++------- 6 files changed, 29 insertions(+), 29 deletions(-) -- 2.9.4 diff --git a/include/linux/module.h b/include/linux/module.h index 21f5639..46b4804 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -442,7 +442,7 @@ struct module { #ifdef CONFIG_EVENT_TRACING struct trace_event_call **trace_events; unsigned int num_trace_events; - struct trace_enum_map **trace_enums; + struct trace_eval_map **trace_enums; unsigned int num_trace_enums; #endif #ifdef CONFIG_FTRACE_MCOUNT_RECORD diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index cc48cb2..f7b0f55 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h @@ -25,10 +25,10 @@ struct module; struct tracepoint; struct notifier_block; -struct trace_enum_map { +struct trace_eval_map { const char *system; - const char *enum_string; - unsigned long enum_value; + const char *eval_string; + unsigned long eval_value; }; #define TRACEPOINT_DEFAULT_PRIO 10 diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h index 4bdd840..49cce5f 100644 --- a/include/trace/trace_events.h +++ b/include/trace/trace_events.h @@ -35,14 +35,14 @@ TRACE_MAKE_SYSTEM_STR(); #undef TRACE_DEFINE_ENUM #define TRACE_DEFINE_ENUM(a) \ - static struct trace_enum_map __used __initdata \ + static struct trace_eval_map __used __initdata \ __##TRACE_SYSTEM##_##a = \ { \ .system = TRACE_SYSTEM_STRING, \ - .enum_string = #a, \ - .enum_value = a \ + .eval_string = #a, \ + .eval_value = a \ }; \ - static struct trace_enum_map __used \ + static struct trace_eval_map __used \ __attribute__((section("_ftrace_eval_map"))) \ *TRACE_SYSTEM##_##a = &__##TRACE_SYSTEM##_##a diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index ce564c2..f82764b 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -132,7 +132,7 @@ union trace_enum_map_item; struct trace_enum_map_tail { /* * "end" is first and points to NULL as it must be different - * than "mod" or "enum_string" + * than "mod" or "eval_string" */ union trace_enum_map_item *next; const char *end; /* points to NULL */ @@ -148,7 +148,7 @@ static DEFINE_MUTEX(trace_enum_mutex); * pointer to the next array of saved enum_map items. */ union trace_enum_map_item { - struct trace_enum_map map; + struct trace_eval_map map; struct trace_enum_map_head head; struct trace_enum_map_tail tail; }; @@ -4721,7 +4721,7 @@ static const struct file_operations tracing_saved_cmdlines_size_fops = { static union trace_enum_map_item * update_enum_map(union trace_enum_map_item *ptr) { - if (!ptr->map.enum_string) { + if (!ptr->map.eval_string) { if (ptr->tail.next) { ptr = ptr->tail.next; /* Set ptr to the next real item (skip head) */ @@ -4781,7 +4781,7 @@ static int enum_map_show(struct seq_file *m, void *v) union trace_enum_map_item *ptr = v; seq_printf(m, "%s %ld (%s)\n", - ptr->map.enum_string, ptr->map.enum_value, + ptr->map.eval_string, ptr->map.eval_value, ptr->map.system); return 0; @@ -4817,11 +4817,11 @@ trace_enum_jmp_to_tail(union trace_enum_map_item *ptr) } static void -trace_insert_enum_map_file(struct module *mod, struct trace_enum_map **start, +trace_insert_enum_map_file(struct module *mod, struct trace_eval_map **start, int len) { - struct trace_enum_map **stop; - struct trace_enum_map **map; + struct trace_eval_map **stop; + struct trace_eval_map **map; union trace_enum_map_item *map_array; union trace_enum_map_item *ptr; @@ -4875,13 +4875,13 @@ static void trace_create_enum_file(struct dentry *d_tracer) #else /* CONFIG_TRACE_ENUM_MAP_FILE */ static inline void trace_create_enum_file(struct dentry *d_tracer) { } static inline void trace_insert_enum_map_file(struct module *mod, - struct trace_enum_map **start, int len) { } + struct trace_eval_map **start, int len) { } #endif /* !CONFIG_TRACE_ENUM_MAP_FILE */ static void trace_insert_enum_map(struct module *mod, - struct trace_enum_map **start, int len) + struct trace_eval_map **start, int len) { - struct trace_enum_map **map; + struct trace_eval_map **map; if (len <= 0) return; @@ -7704,8 +7704,8 @@ struct dentry *tracing_init_dentry(void) return NULL; } -extern struct trace_enum_map *__start_ftrace_eval_maps[]; -extern struct trace_enum_map *__stop_ftrace_eval_maps[]; +extern struct trace_eval_map *__start_ftrace_eval_maps[]; +extern struct trace_eval_map *__stop_ftrace_eval_maps[]; static void __init trace_enum_init(void) { diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 291a1bc..75d5e27 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -1768,10 +1768,10 @@ static inline const char *get_syscall_name(int syscall) #ifdef CONFIG_EVENT_TRACING void trace_event_init(void); -void trace_event_enum_update(struct trace_enum_map **map, int len); +void trace_event_enum_update(struct trace_eval_map **map, int len); #else static inline void __init trace_event_init(void) { } -static inline void trace_event_enum_update(struct trace_enum_map **map, int len) { } +static inline void trace_event_enum_update(struct trace_eval_map **map, int len) { } #endif extern struct trace_iterator *tracepoint_print_iter; diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index e7973e1..cf5b9aa 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -2067,18 +2067,18 @@ __register_event(struct trace_event_call *call, struct module *mod) return 0; } -static char *enum_replace(char *ptr, struct trace_enum_map *map, int len) +static char *enum_replace(char *ptr, struct trace_eval_map *map, int len) { int rlen; int elen; /* Find the length of the enum value as a string */ - elen = snprintf(ptr, 0, "%ld", map->enum_value); + elen = snprintf(ptr, 0, "%ld", map->eval_value); /* Make sure there's enough room to replace the string with the value */ if (len < elen) return NULL; - snprintf(ptr, elen + 1, "%ld", map->enum_value); + snprintf(ptr, elen + 1, "%ld", map->eval_value); /* Get the rest of the string of ptr */ rlen = strlen(ptr + len); @@ -2090,11 +2090,11 @@ static char *enum_replace(char *ptr, struct trace_enum_map *map, int len) } static void update_event_printk(struct trace_event_call *call, - struct trace_enum_map *map) + struct trace_eval_map *map) { char *ptr; int quote = 0; - int len = strlen(map->enum_string); + int len = strlen(map->eval_string); for (ptr = call->print_fmt; *ptr; ptr++) { if (*ptr == '\\') { @@ -2125,7 +2125,7 @@ static void update_event_printk(struct trace_event_call *call, continue; } if (isalpha(*ptr) || *ptr == '_') { - if (strncmp(map->enum_string, ptr, len) == 0 && + if (strncmp(map->eval_string, ptr, len) == 0 && !isalnum(ptr[len]) && ptr[len] != '_') { ptr = enum_replace(ptr, map, len); /* Hmm, enum string smaller than value */ @@ -2165,7 +2165,7 @@ static void update_event_printk(struct trace_event_call *call, } } -void trace_event_enum_update(struct trace_enum_map **map, int len) +void trace_event_enum_update(struct trace_eval_map **map, int len) { struct trace_event_call *call, *p; const char *last_system = NULL; From patchwork Wed Jun 14 22:27:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 105607 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp512836qgd; Wed, 14 Jun 2017 15:30:08 -0700 (PDT) X-Received: by 10.84.232.206 with SMTP id x14mr2504148plm.7.1497479408033; Wed, 14 Jun 2017 15:30:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497479408; cv=none; d=google.com; s=arc-20160816; b=jrbru2oEqz6k95RhXl/OPo0f2eXMM4s+X4IrFmZhwk19XFY/nBkxQQxOX8NMhKMt6V CyigV3ZwUKhwYWku28v76i2+nje52hTZFBck3yaMOS6pjL7DNved2xd7sKn8u5jE15y7 GFJ1kRS69sYBq/mYXIgVQa2tND0SNFJVfRH02ptfKUUF3OxHMo1IxRXoWTOxYYr9GB+2 W3XXHQnVPKpLDmtWHJF8C+aHJTBRbi3J24KoJp+zonb9p5rKfww/GU287VV1Gs/3HUdw Hfwm+TaiaAmaB4XLBFg02vyWl2pqJa5AoMjiIEGrwE5LAVdgxLyoc8IYXHq64hlbUfvQ /RPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=RRVnIQsYIjdFHGS0wEeeYfxZkpIKrjKqlONnhU/OCLM=; b=IIcd8AxLX+Kf6rTk0HjzhKDbHLn4O8ofV+zOw25P77lLKOi2WUtFCjl5r8icddnIts /bHNqyaFypmCa1xsEyxzwxE/I2RFk0hQELrxMoFAOhg9KbFWCVGlRWByFIOtRoPk0UNF GwV090TkHMZi0mpZDc1vnXOhn/aprJCt+nUw2c2AD17cT4fNgMb4PSvnQcKviM0/9c2+ tfxD+wMDd7v+LPE5+Rp7VWa3+03XWTMMs7RVIeaRZ6Hi07eW6/TcdssJuILEgxO6ZVpu PikTOEjDmeR/cn2DADqAI7CrK8tAYlHVoMadzPTY+8vGzXBQz+0FSqY3fS3VNrwGPYN8 K8lQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v4si854093plk.237.2017.06.14.15.30.07; Wed, 14 Jun 2017 15:30:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753065AbdFNWaA (ORCPT + 25 others); Wed, 14 Jun 2017 18:30:00 -0400 Received: from foss.arm.com ([217.140.101.70]:39610 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752546AbdFNW1d (ORCPT ); Wed, 14 Jun 2017 18:27:33 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8B11B15BF; Wed, 14 Jun 2017 15:27:32 -0700 (PDT) Received: from beelzebub.ast.arm.com (beelzebub.austin.arm.com [10.118.12.119]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 02E393F3E1; Wed, 14 Jun 2017 15:27:31 -0700 (PDT) From: Jeremy Linton To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, rostedt@goodmis.org, mingo@redhat.com, rusty@rustcorp.com.au, jeyu@redhat.com, kirill.shutemov@linux.intel.com, christoffer.dall@linaro.org, marc.zyngier@arm.com, jcm@jonmasters.org, clemens@ladisch.de, perex@perex.cz Subject: [PATCH v2 03/13] trace: rename struct module entry for trace enums Date: Wed, 14 Jun 2017 17:27:19 -0500 Message-Id: <20170614222729.16521-4-jeremy.linton@arm.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170614222729.16521-1-jeremy.linton@arm.com> References: <20170614222729.16521-1-jeremy.linton@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- include/linux/module.h | 4 ++-- kernel/module.c | 6 +++--- kernel/trace/trace.c | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) -- 2.9.4 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); From patchwork Wed Jun 14 22:27:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 105605 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp512677qgd; Wed, 14 Jun 2017 15:29:42 -0700 (PDT) X-Received: by 10.98.129.131 with SMTP id t125mr2112095pfd.173.1497479382765; Wed, 14 Jun 2017 15:29:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497479382; cv=none; d=google.com; s=arc-20160816; b=cjrIkrPgGAtVo4gq609VoPg36ye8YUnpe/tbvlX8GAlXeOh55z4QOvCf3pNjuKDyJM tyoRBEPxS34cUuk9yUivqMKX8/lW6+i6SeyAYk4U9kpC4T3aF/Rr7nvZ9jaUhgB+zgZr MGK1O6rCsnLd8L6ceMN/INUU1/NK/iV5auHHPdYC6JCe5QiE6HxfNx/3ui71/FznqxM+ ritBA5DzFy/l8/VLrk+BjClDibvYL43C8+2WqA/Kv2IQgljZtsraqNkL/UG/6RmyYK6q J+KugG0fR91PBzqXWeGycfIAfUMK47mElvYq/CV3jbrnLv54T3AA7h2t2XnquVbkejMe +mGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=p1JkrG9tTvnKbF113UL9G1yQysWnMYckgQ9lhrOV+do=; b=T85Rfd+D7v74H1z7+NDqGj1LM8OoGfMF5mDn47u2lHuZEYkso4acSAIjPKGyb4Lj3N Txo6+MzjCt8ACsIdGgq44iXtSF26tnZmq2Av2bUUPPB5EPKB5q7JbQEOZSsdDA19GTts 6zuYObiKMqHbG84TiaAc+TNghRPJzqKyuiHT0KzDcy0m9u2mO68K6UaYx5r/sGEa98q9 667Ei2Cd9Z2w5IcpR2sK//XZvtcNJcc247lk31g47PC1802z2+e5X/TWhiUT3v6abU2D rsWRHFDY4cn0MpJZr+xGpnAP3J+k7C+cmnZttYQBSJowDEjGk+QKAeABpXXcQfwUB0v5 ufeA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i5si831877pgt.253.2017.06.14.15.29.42; Wed, 14 Jun 2017 15:29:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753030AbdFNW3e (ORCPT + 25 others); Wed, 14 Jun 2017 18:29:34 -0400 Received: from foss.arm.com ([217.140.101.70]:39622 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752595AbdFNW1d (ORCPT ); Wed, 14 Jun 2017 18:27:33 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2807C1682; Wed, 14 Jun 2017 15:27:33 -0700 (PDT) Received: from beelzebub.ast.arm.com (beelzebub.austin.arm.com [10.118.12.119]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 93ABB3F3E1; Wed, 14 Jun 2017 15:27:32 -0700 (PDT) From: Jeremy Linton To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, rostedt@goodmis.org, mingo@redhat.com, rusty@rustcorp.com.au, jeyu@redhat.com, kirill.shutemov@linux.intel.com, christoffer.dall@linaro.org, marc.zyngier@arm.com, jcm@jonmasters.org, clemens@ladisch.de, perex@perex.cz Subject: [PATCH v2 04/13] trace: rename trace enum data structures in trace.c Date: Wed, 14 Jun 2017 17:27:20 -0500 Message-Id: <20170614222729.16521-5-jeremy.linton@arm.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170614222729.16521-1-jeremy.linton@arm.com> References: <20170614222729.16521-1-jeremy.linton@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The enum map entries can be exported to userspace via a sys enum_map file. Rename those functions and structures to reflect the fact that we are using them for more than enums. Signed-off-by: Jeremy Linton --- kernel/trace/trace.c | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) -- 2.9.4 diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 85f0e3c..af6ec07 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -122,38 +122,38 @@ int __disable_trace_on_warning; #ifdef CONFIG_TRACE_ENUM_MAP_FILE /* Map of enums to their values, for "enum_map" file */ -struct trace_enum_map_head { +struct trace_eval_map_head { struct module *mod; unsigned long length; }; -union trace_enum_map_item; +union trace_eval_map_item; -struct trace_enum_map_tail { +struct trace_eval_map_tail { /* * "end" is first and points to NULL as it must be different * than "mod" or "eval_string" */ - union trace_enum_map_item *next; + union trace_eval_map_item *next; const char *end; /* points to NULL */ }; static DEFINE_MUTEX(trace_enum_mutex); /* - * The trace_enum_maps are saved in an array with two extra elements, + * The trace_eval_maps are saved in an array with two extra elements, * one at the beginning, and one at the end. The beginning item contains * the count of the saved maps (head.length), and the module they * belong to if not built in (head.mod). The ending item contains a * pointer to the next array of saved enum_map items. */ -union trace_enum_map_item { +union trace_eval_map_item { struct trace_eval_map map; - struct trace_enum_map_head head; - struct trace_enum_map_tail tail; + struct trace_eval_map_head head; + struct trace_eval_map_tail tail; }; -static union trace_enum_map_item *trace_enum_maps; +static union trace_eval_map_item *trace_eval_maps; #endif /* CONFIG_TRACE_ENUM_MAP_FILE */ static int tracing_set_tracer(struct trace_array *tr, const char *buf); @@ -4718,8 +4718,8 @@ static const struct file_operations tracing_saved_cmdlines_size_fops = { }; #ifdef CONFIG_TRACE_ENUM_MAP_FILE -static union trace_enum_map_item * -update_enum_map(union trace_enum_map_item *ptr) +static union trace_eval_map_item * +update_enum_map(union trace_eval_map_item *ptr) { if (!ptr->map.eval_string) { if (ptr->tail.next) { @@ -4734,7 +4734,7 @@ update_enum_map(union trace_enum_map_item *ptr) static void *enum_map_next(struct seq_file *m, void *v, loff_t *pos) { - union trace_enum_map_item *ptr = v; + union trace_eval_map_item *ptr = v; /* * Paranoid! If ptr points to end, we don't want to increment past it. @@ -4755,12 +4755,12 @@ static void *enum_map_next(struct seq_file *m, void *v, loff_t *pos) static void *enum_map_start(struct seq_file *m, loff_t *pos) { - union trace_enum_map_item *v; + union trace_eval_map_item *v; loff_t l = 0; mutex_lock(&trace_enum_mutex); - v = trace_enum_maps; + v = trace_eval_maps; if (v) v++; @@ -4778,7 +4778,7 @@ static void enum_map_stop(struct seq_file *m, void *v) static int enum_map_show(struct seq_file *m, void *v) { - union trace_enum_map_item *ptr = v; + union trace_eval_map_item *ptr = v; seq_printf(m, "%s %ld (%s)\n", ptr->map.eval_string, ptr->map.eval_value, @@ -4809,8 +4809,8 @@ static const struct file_operations tracing_enum_map_fops = { .release = seq_release, }; -static inline union trace_enum_map_item * -trace_enum_jmp_to_tail(union trace_enum_map_item *ptr) +static inline union trace_eval_map_item * +trace_enum_jmp_to_tail(union trace_eval_map_item *ptr) { /* Return tail of array given the head */ return ptr + ptr->head.length + 1; @@ -4822,13 +4822,13 @@ trace_insert_enum_map_file(struct module *mod, struct trace_eval_map **start, { struct trace_eval_map **stop; struct trace_eval_map **map; - union trace_enum_map_item *map_array; - union trace_enum_map_item *ptr; + union trace_eval_map_item *map_array; + union trace_eval_map_item *ptr; stop = start + len; /* - * The trace_enum_maps contains the map plus a head and tail item, + * The trace_eval_maps contains the map plus a head and tail item, * where the head holds the module and length of array, and the * tail holds a pointer to the next list. */ @@ -4840,10 +4840,10 @@ trace_insert_enum_map_file(struct module *mod, struct trace_eval_map **start, mutex_lock(&trace_enum_mutex); - if (!trace_enum_maps) - trace_enum_maps = map_array; + if (!trace_eval_maps) + trace_eval_maps = map_array; else { - ptr = trace_enum_maps; + ptr = trace_eval_maps; for (;;) { ptr = trace_enum_jmp_to_tail(ptr); if (!ptr->tail.next) @@ -7734,15 +7734,15 @@ static void trace_module_add_enums(struct module *mod) #ifdef CONFIG_TRACE_ENUM_MAP_FILE static void trace_module_remove_enums(struct module *mod) { - union trace_enum_map_item *map; - union trace_enum_map_item **last = &trace_enum_maps; + union trace_eval_map_item *map; + union trace_eval_map_item **last = &trace_eval_maps; if (!mod->num_trace_evals) return; mutex_lock(&trace_enum_mutex); - map = trace_enum_maps; + map = trace_eval_maps; while (map) { if (map->head.mod == mod) From patchwork Wed Jun 14 22:27:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 105606 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp512736qgd; Wed, 14 Jun 2017 15:29:54 -0700 (PDT) X-Received: by 10.99.176.77 with SMTP id z13mr2172494pgo.78.1497479394136; Wed, 14 Jun 2017 15:29:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497479394; cv=none; d=google.com; s=arc-20160816; b=K1zyLN34pfQ0fzg5VcLG34xNyeJjx+HAyz0IBerKki084NfYB+/HxkeyZ4Dbkejr5B W+UbR3lduxvOgt47RMHtUKiD2HCZZCFTS9P6jJg0+XtBrD1cMcmK7EJ6HOXDR/uEJ3C9 igrFhBA3a3YIeFcMueLjSoRFxy/dQp8+m1c0W6nqJqPZj0/MUxs9VS3Hx5eJe8Q8Xmhk GRwhaQ041oisVGsDDowKXCOIS0gmVJT7mqdDg4gxIIqh1ujaUHUniP9za1DkW7RkoszH kYy9M7ThlH5eGpYfR0S+xoRkkbyFDWnM66ix7nJxYW/q69kRkHzt5CAXhoolmRNB5ybW Kfag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=gj3sMUgHXQHtCSz9C1qoE3Xi/5GAJlgctnyNztbGxzk=; b=s8GCD2UuqDvwp8pfks3PtN0AVeTP4ovDIxtXlWfgl3ZIQQZnDSF8PNIN6FaeMsC1fz +KU3/C6DC718Q2M3e87YEbHKVIChWcX5d+jCIZ7pTPskVV8poG+Ois7CJaDZq20vef8+ DBXtNVPdGHwMtZu13XRdYkBjE0ighs/kvK53dGyOMA9CU9yt8L11eezqQDJg+x1T/9zg Du4bifNloRI0rItXg0zM+1Mt9lq+UbarQwsvAUL/QJFqcJ75V1l0lqVYxTZpCZR/ERvZ EsztL3hZTYvVq0QkSMO6nLwI8DctNZfAkp+PQ5PsaP2UCi9sdHc/wnF0nynKmI/0woaD CZsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t5si896224plj.98.2017.06.14.15.29.53; Wed, 14 Jun 2017 15:29:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753006AbdFNW3d (ORCPT + 25 others); Wed, 14 Jun 2017 18:29:33 -0400 Received: from foss.arm.com ([217.140.101.70]:39650 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751600AbdFNW1e (ORCPT ); Wed, 14 Jun 2017 18:27:34 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B88D71688; Wed, 14 Jun 2017 15:27:33 -0700 (PDT) Received: from beelzebub.ast.arm.com (beelzebub.austin.arm.com [10.118.12.119]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3059A3F3E1; Wed, 14 Jun 2017 15:27:33 -0700 (PDT) From: Jeremy Linton To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, rostedt@goodmis.org, mingo@redhat.com, rusty@rustcorp.com.au, jeyu@redhat.com, kirill.shutemov@linux.intel.com, christoffer.dall@linaro.org, marc.zyngier@arm.com, jcm@jonmasters.org, clemens@ladisch.de, perex@perex.cz Subject: [PATCH v2 05/13] trace: rename trace_enum_mutex to trace_eval_mutex Date: Wed, 14 Jun 2017 17:27:21 -0500 Message-Id: <20170614222729.16521-6-jeremy.linton@arm.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170614222729.16521-1-jeremy.linton@arm.com> References: <20170614222729.16521-1-jeremy.linton@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is a lock protecting the trace_enum_map, rename it to reflect the use by more than enums. Signed-off-by: Jeremy Linton --- kernel/trace/trace.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.9.4 diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index af6ec07..e1bc56c 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -138,7 +138,7 @@ struct trace_eval_map_tail { const char *end; /* points to NULL */ }; -static DEFINE_MUTEX(trace_enum_mutex); +static DEFINE_MUTEX(trace_eval_mutex); /* * The trace_eval_maps are saved in an array with two extra elements, @@ -4758,7 +4758,7 @@ static void *enum_map_start(struct seq_file *m, loff_t *pos) union trace_eval_map_item *v; loff_t l = 0; - mutex_lock(&trace_enum_mutex); + mutex_lock(&trace_eval_mutex); v = trace_eval_maps; if (v) @@ -4773,7 +4773,7 @@ static void *enum_map_start(struct seq_file *m, loff_t *pos) static void enum_map_stop(struct seq_file *m, void *v) { - mutex_unlock(&trace_enum_mutex); + mutex_unlock(&trace_eval_mutex); } static int enum_map_show(struct seq_file *m, void *v) @@ -4838,7 +4838,7 @@ trace_insert_enum_map_file(struct module *mod, struct trace_eval_map **start, return; } - mutex_lock(&trace_enum_mutex); + mutex_lock(&trace_eval_mutex); if (!trace_eval_maps) trace_eval_maps = map_array; @@ -4863,7 +4863,7 @@ trace_insert_enum_map_file(struct module *mod, struct trace_eval_map **start, } memset(map_array, 0, sizeof(*map_array)); - mutex_unlock(&trace_enum_mutex); + mutex_unlock(&trace_eval_mutex); } static void trace_create_enum_file(struct dentry *d_tracer) @@ -7740,7 +7740,7 @@ static void trace_module_remove_enums(struct module *mod) if (!mod->num_trace_evals) return; - mutex_lock(&trace_enum_mutex); + mutex_lock(&trace_eval_mutex); map = trace_eval_maps; @@ -7757,7 +7757,7 @@ static void trace_module_remove_enums(struct module *mod) *last = trace_enum_jmp_to_tail(map)->tail.next; kfree(map); out: - mutex_unlock(&trace_enum_mutex); + mutex_unlock(&trace_eval_mutex); } #else static inline void trace_module_remove_enums(struct module *mod) { } From patchwork Wed Jun 14 22:27:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 105604 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp512593qgd; Wed, 14 Jun 2017 15:29:25 -0700 (PDT) X-Received: by 10.84.233.141 with SMTP id l13mr2533439plk.298.1497479365299; Wed, 14 Jun 2017 15:29:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497479365; cv=none; d=google.com; s=arc-20160816; b=r1fmrAgRxQ6ryd0ifP1kOrr4n4P4f1AYrVA7LFbyr/5H6WHTyP68akCtZup0V/kjNW oOiG3zMrADhMy9HLtrP5+Df/p9WppPn0ZjFEJ4xAwzCuhuUyfkvuwlfdJIIHXuizQ9JQ 1Vq9wuhxoR6Vqg2V3ZKOTQAMcBb37uDF87HWOEYHzvbDhwNAgj+th7gM5AUacQRk8l0M 4sje0GEM9unMYEdi7SQjDSn5ai6ZED+xVKiGuk4j8x5WC4PINBwV4O07pbbHHqBCJ/KH cSOQOl0nMLjpy0E0D0K+8IGX2boXoym9mIGeOOeo3WcEqvY67prWf/hODOxcmeczVDow I8SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=GUx7+JpHdmxk5KhW0Mz5PQRnvzOHodCSqd+InJ2gY58=; b=Kl+Xc/AOCpEkaQ7HA1zD0l91Y6QK/+xNmLS1QikzunpvODBA9jrC7sEJOYOcyc2NuO fEUD+mzD3Gn61ms+XEprSwSv331xxrnbktUfo+xnDOIwqBKgyH2tEJfa19Rq71DcvG5M gEPUklsquYb0rueiv2Ff5X3RTS+2/rPbY62NW/r3j8pyQhh5R2Cipq9y4x6jIScGU+wN 1fAJhssYMQCOjWpCOTGXXRKcDgKk15jWbZZMBqrcjTp7s4I+9YjiDQHVThbQo6XKGS6M L7GXZu4xa73Gs4QA4UDWNteZJOjmwM/tpmndlen9eV/Lyt7+Vca2F7dWim41OvYWI+sc R6rw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q7si913063pli.267.2017.06.14.15.29.25; Wed, 14 Jun 2017 15:29:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752963AbdFNW3S (ORCPT + 25 others); Wed, 14 Jun 2017 18:29:18 -0400 Received: from foss.arm.com ([217.140.101.70]:39610 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752097AbdFNW1e (ORCPT ); Wed, 14 Jun 2017 18:27:34 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5560616A3; Wed, 14 Jun 2017 15:27:34 -0700 (PDT) Received: from beelzebub.ast.arm.com (beelzebub.austin.arm.com [10.118.12.119]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C12553F3E1; Wed, 14 Jun 2017 15:27:33 -0700 (PDT) From: Jeremy Linton To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, rostedt@goodmis.org, mingo@redhat.com, rusty@rustcorp.com.au, jeyu@redhat.com, kirill.shutemov@linux.intel.com, christoffer.dall@linaro.org, marc.zyngier@arm.com, jcm@jonmasters.org, clemens@ladisch.de, perex@perex.cz Subject: [PATCH v2 06/13] trace: rename trace.c enum functions Date: Wed, 14 Jun 2017 17:27:22 -0500 Message-Id: <20170614222729.16521-7-jeremy.linton@arm.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170614222729.16521-1-jeremy.linton@arm.com> References: <20170614222729.16521-1-jeremy.linton@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Rename the init and trace_enum_jmp_to_tail() routines to reflect their use by more than enumerated types. Signed-off-by: Jeremy Linton --- kernel/trace/trace.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) -- 2.9.4 diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index e1bc56c..5eda252 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -4810,7 +4810,7 @@ static const struct file_operations tracing_enum_map_fops = { }; static inline union trace_eval_map_item * -trace_enum_jmp_to_tail(union trace_eval_map_item *ptr) +trace_eval_jmp_to_tail(union trace_eval_map_item *ptr) { /* Return tail of array given the head */ return ptr + ptr->head.length + 1; @@ -4845,7 +4845,7 @@ trace_insert_enum_map_file(struct module *mod, struct trace_eval_map **start, else { ptr = trace_eval_maps; for (;;) { - ptr = trace_enum_jmp_to_tail(ptr); + ptr = trace_eval_jmp_to_tail(ptr); if (!ptr->tail.next) break; ptr = ptr->tail.next; @@ -7707,7 +7707,7 @@ struct dentry *tracing_init_dentry(void) extern struct trace_eval_map *__start_ftrace_eval_maps[]; extern struct trace_eval_map *__stop_ftrace_eval_maps[]; -static void __init trace_enum_init(void) +static void __init trace_eval_init(void) { int len; @@ -7747,14 +7747,14 @@ static void trace_module_remove_enums(struct module *mod) while (map) { if (map->head.mod == mod) break; - map = trace_enum_jmp_to_tail(map); + map = trace_eval_jmp_to_tail(map); last = &map->tail.next; map = map->tail.next; } if (!map) goto out; - *last = trace_enum_jmp_to_tail(map)->tail.next; + *last = trace_eval_jmp_to_tail(map)->tail.next; kfree(map); out: mutex_unlock(&trace_eval_mutex); @@ -7811,7 +7811,7 @@ static __init int tracer_init_tracefs(void) trace_create_file("saved_cmdlines_size", 0644, d_tracer, NULL, &tracing_saved_cmdlines_size_fops); - trace_enum_init(); + trace_eval_init(); trace_create_enum_file(d_tracer); From patchwork Wed Jun 14 22:27:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 105603 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp512526qgd; Wed, 14 Jun 2017 15:29:10 -0700 (PDT) X-Received: by 10.84.228.194 with SMTP id y2mr2492041pli.13.1497479350106; Wed, 14 Jun 2017 15:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497479350; cv=none; d=google.com; s=arc-20160816; b=xousKfJyEsTY96SAxTUfzyg9jzGAXXEvemtz12ULdKahR3bneuh2+/Q4zRyza48p7g iFpDDWYxFZTrt0ItwHSN+ajePYp8uwtqPWypLNkmESjkv1eqnF1Xtx4A5nSkhPbPfh3R on4TMjvYtMOw0c2EZAPFt1pDtG95rY/kXIow0q7oZ/7zTy7EQjFQZoJ+pLg/bycYv7mU /9scT18vNxvTI+XtQULhSeVMSKguicRQppg5GV85iTVKzRJTRQN+oCP+VQgEGRGCO5gJ pYplLNwQ3MB+t+XYU41WYRtQBCi9wNScJ17ygtrgxGr2YM+O70QaFs6D/PDWtZuNl/Sv KT3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=y4leBjbHV8wrj+69qAAsLKEJacsvXqYXNGBEeY1nsrM=; b=JcqJdAEaw7wB1qNzyr+8gGjt5og7KST3wE27l1J4is6/Dgfn7z2OyRcl8QOLorfjDi 54D1JXu9bx92Zsx8jxUGUZQNHaMaBkiCSL10JGdVSTlnToFJjHMEbPWLQcCg4IsaJH3T TNKmF2sggusW1/ayv+fV5DA1C8GZbe5fcrQig32srUCaCjCScIM+MMf2bgwlrIwCgM5L 4QnVpeq3vdhtjZuJZrqkPe8o7H7maBaX8gcBQymmzjavT3JoZQiv1UdZ/zYlKhfw7aSB ddgJURXlACUVIV6iA3ss1lzjRYyUmrGxWX/XaRLvuT2IIeqVWvp9savydmqVuBNX1zRe yHyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v12si878015plk.292.2017.06.14.15.29.09; Wed, 14 Jun 2017 15:29:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752918AbdFNW3C (ORCPT + 25 others); Wed, 14 Jun 2017 18:29:02 -0400 Received: from foss.arm.com ([217.140.101.70]:39670 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752657AbdFNW1f (ORCPT ); Wed, 14 Jun 2017 18:27:35 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E63E11715; Wed, 14 Jun 2017 15:27:34 -0700 (PDT) Received: from beelzebub.ast.arm.com (beelzebub.austin.arm.com [10.118.12.119]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5E0443F3E1; Wed, 14 Jun 2017 15:27:34 -0700 (PDT) From: Jeremy Linton To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, rostedt@goodmis.org, mingo@redhat.com, rusty@rustcorp.com.au, jeyu@redhat.com, kirill.shutemov@linux.intel.com, christoffer.dall@linaro.org, marc.zyngier@arm.com, jcm@jonmasters.org, clemens@ladisch.de, perex@perex.cz Subject: [PATCH v2 07/13] trace: rename enum_map functions Date: Wed, 14 Jun 2017 17:27:23 -0500 Message-Id: <20170614222729.16521-8-jeremy.linton@arm.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170614222729.16521-1-jeremy.linton@arm.com> References: <20170614222729.16521-1-jeremy.linton@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Rename the core trace enum routines to use eval, to reflect their use by more than just enum to value mapping. Signed-off-by: Jeremy Linton --- kernel/trace/trace.c | 74 ++++++++++++++++++++++----------------------- kernel/trace/trace.h | 4 +-- kernel/trace/trace_events.c | 2 +- 3 files changed, 40 insertions(+), 40 deletions(-) -- 2.9.4 diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 5eda252..676c808 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -145,7 +145,7 @@ static DEFINE_MUTEX(trace_eval_mutex); * one at the beginning, and one at the end. The beginning item contains * the count of the saved maps (head.length), and the module they * belong to if not built in (head.mod). The ending item contains a - * pointer to the next array of saved enum_map items. + * pointer to the next array of saved enum_eval/enum_map items. */ union trace_eval_map_item { struct trace_eval_map map; @@ -1141,9 +1141,9 @@ unsigned long nsecs_to_usecs(unsigned long nsecs) /* * TRACE_FLAGS is defined as a tuple matching bit masks with strings. - * It uses C(a, b) where 'a' is the enum name and 'b' is the string that + * It uses C(a, b) where 'a' is the eval (enum) name and 'b' is the string that * matches it. By defining "C(a, b) b", TRACE_FLAGS becomes a list - * of strings in the order that the enums were defined. + * of strings in the order that the evals (enum) were defined. */ #undef C #define C(a, b) b @@ -4719,7 +4719,7 @@ static const struct file_operations tracing_saved_cmdlines_size_fops = { #ifdef CONFIG_TRACE_ENUM_MAP_FILE static union trace_eval_map_item * -update_enum_map(union trace_eval_map_item *ptr) +update_eval_map(union trace_eval_map_item *ptr) { if (!ptr->map.eval_string) { if (ptr->tail.next) { @@ -4732,7 +4732,7 @@ update_enum_map(union trace_eval_map_item *ptr) return ptr; } -static void *enum_map_next(struct seq_file *m, void *v, loff_t *pos) +static void *eval_map_next(struct seq_file *m, void *v, loff_t *pos) { union trace_eval_map_item *ptr = v; @@ -4740,7 +4740,7 @@ static void *enum_map_next(struct seq_file *m, void *v, loff_t *pos) * Paranoid! If ptr points to end, we don't want to increment past it. * This really should never happen. */ - ptr = update_enum_map(ptr); + ptr = update_eval_map(ptr); if (WARN_ON_ONCE(!ptr)) return NULL; @@ -4748,12 +4748,12 @@ static void *enum_map_next(struct seq_file *m, void *v, loff_t *pos) (*pos)++; - ptr = update_enum_map(ptr); + ptr = update_eval_map(ptr); return ptr; } -static void *enum_map_start(struct seq_file *m, loff_t *pos) +static void *eval_map_start(struct seq_file *m, loff_t *pos) { union trace_eval_map_item *v; loff_t l = 0; @@ -4765,18 +4765,18 @@ static void *enum_map_start(struct seq_file *m, loff_t *pos) v++; while (v && l < *pos) { - v = enum_map_next(m, v, &l); + v = eval_map_next(m, v, &l); } return v; } -static void enum_map_stop(struct seq_file *m, void *v) +static void eval_map_stop(struct seq_file *m, void *v) { mutex_unlock(&trace_eval_mutex); } -static int enum_map_show(struct seq_file *m, void *v) +static int eval_map_show(struct seq_file *m, void *v) { union trace_eval_map_item *ptr = v; @@ -4787,23 +4787,23 @@ static int enum_map_show(struct seq_file *m, void *v) return 0; } -static const struct seq_operations tracing_enum_map_seq_ops = { - .start = enum_map_start, - .next = enum_map_next, - .stop = enum_map_stop, - .show = enum_map_show, +static const struct seq_operations tracing_eval_map_seq_ops = { + .start = eval_map_start, + .next = eval_map_next, + .stop = eval_map_stop, + .show = eval_map_show, }; -static int tracing_enum_map_open(struct inode *inode, struct file *filp) +static int tracing_eval_map_open(struct inode *inode, struct file *filp) { if (tracing_disabled) return -ENODEV; - return seq_open(filp, &tracing_enum_map_seq_ops); + return seq_open(filp, &tracing_eval_map_seq_ops); } -static const struct file_operations tracing_enum_map_fops = { - .open = tracing_enum_map_open, +static const struct file_operations tracing_eval_map_fops = { + .open = tracing_eval_map_open, .read = seq_read, .llseek = seq_lseek, .release = seq_release, @@ -4817,7 +4817,7 @@ trace_eval_jmp_to_tail(union trace_eval_map_item *ptr) } static void -trace_insert_enum_map_file(struct module *mod, struct trace_eval_map **start, +trace_insert_eval_map_file(struct module *mod, struct trace_eval_map **start, int len) { struct trace_eval_map **stop; @@ -4834,7 +4834,7 @@ trace_insert_enum_map_file(struct module *mod, struct trace_eval_map **start, */ map_array = kmalloc(sizeof(*map_array) * (len + 2), GFP_KERNEL); if (!map_array) { - pr_warn("Unable to allocate trace enum mapping\n"); + pr_warn("Unable to allocate trace eval mapping\n"); return; } @@ -4866,19 +4866,19 @@ trace_insert_enum_map_file(struct module *mod, struct trace_eval_map **start, mutex_unlock(&trace_eval_mutex); } -static void trace_create_enum_file(struct dentry *d_tracer) +static void trace_create_eval_file(struct dentry *d_tracer) { trace_create_file("enum_map", 0444, d_tracer, - NULL, &tracing_enum_map_fops); + NULL, &tracing_eval_map_fops); } #else /* CONFIG_TRACE_ENUM_MAP_FILE */ -static inline void trace_create_enum_file(struct dentry *d_tracer) { } -static inline void trace_insert_enum_map_file(struct module *mod, +static inline void trace_create_eval_file(struct dentry *d_tracer) { } +static inline void trace_insert_eval_map_file(struct module *mod, struct trace_eval_map **start, int len) { } #endif /* !CONFIG_TRACE_ENUM_MAP_FILE */ -static void trace_insert_enum_map(struct module *mod, +static void trace_insert_eval_map(struct module *mod, struct trace_eval_map **start, int len) { struct trace_eval_map **map; @@ -4888,9 +4888,9 @@ static void trace_insert_enum_map(struct module *mod, map = start; - trace_event_enum_update(map, len); + trace_event_eval_update(map, len); - trace_insert_enum_map_file(mod, start, len); + trace_insert_eval_map_file(mod, start, len); } static ssize_t @@ -7712,11 +7712,11 @@ static void __init trace_eval_init(void) int len; len = __stop_ftrace_eval_maps - __start_ftrace_eval_maps; - trace_insert_enum_map(NULL, __start_ftrace_eval_maps, len); + trace_insert_eval_map(NULL, __start_ftrace_eval_maps, len); } #ifdef CONFIG_MODULES -static void trace_module_add_enums(struct module *mod) +static void trace_module_add_evals(struct module *mod) { if (!mod->num_trace_evals) return; @@ -7728,11 +7728,11 @@ static void trace_module_add_enums(struct module *mod) if (trace_module_has_bad_taint(mod)) return; - trace_insert_enum_map(mod, mod->trace_evals, mod->num_trace_evals); + trace_insert_eval_map(mod, mod->trace_evals, mod->num_trace_evals); } #ifdef CONFIG_TRACE_ENUM_MAP_FILE -static void trace_module_remove_enums(struct module *mod) +static void trace_module_remove_evals(struct module *mod) { union trace_eval_map_item *map; union trace_eval_map_item **last = &trace_eval_maps; @@ -7760,7 +7760,7 @@ static void trace_module_remove_enums(struct module *mod) mutex_unlock(&trace_eval_mutex); } #else -static inline void trace_module_remove_enums(struct module *mod) { } +static inline void trace_module_remove_evals(struct module *mod) { } #endif /* CONFIG_TRACE_ENUM_MAP_FILE */ static int trace_module_notify(struct notifier_block *self, @@ -7770,10 +7770,10 @@ static int trace_module_notify(struct notifier_block *self, switch (val) { case MODULE_STATE_COMING: - trace_module_add_enums(mod); + trace_module_add_evals(mod); break; case MODULE_STATE_GOING: - trace_module_remove_enums(mod); + trace_module_remove_evals(mod); break; } @@ -7813,7 +7813,7 @@ static __init int tracer_init_tracefs(void) trace_eval_init(); - trace_create_enum_file(d_tracer); + trace_create_eval_file(d_tracer); #ifdef CONFIG_MODULES register_module_notifier(&trace_module_nb); diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 75d5e27..5f451a6 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -1768,10 +1768,10 @@ static inline const char *get_syscall_name(int syscall) #ifdef CONFIG_EVENT_TRACING void trace_event_init(void); -void trace_event_enum_update(struct trace_eval_map **map, int len); +void trace_event_eval_update(struct trace_eval_map **map, int len); #else static inline void __init trace_event_init(void) { } -static inline void trace_event_enum_update(struct trace_eval_map **map, int len) { } +static inline void trace_event_eval_update(struct trace_eval_map **map, int len) { } #endif extern struct trace_iterator *tracepoint_print_iter; diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index cf5b9aa..e6897b0 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -2165,7 +2165,7 @@ static void update_event_printk(struct trace_event_call *call, } } -void trace_event_enum_update(struct trace_eval_map **map, int len) +void trace_event_eval_update(struct trace_eval_map **map, int len) { struct trace_event_call *call, *p; const char *last_system = NULL; From patchwork Wed Jun 14 22:27:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 105597 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp512074qgd; Wed, 14 Jun 2017 15:27:42 -0700 (PDT) X-Received: by 10.99.97.137 with SMTP id v131mr2097022pgb.235.1497479262627; Wed, 14 Jun 2017 15:27:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497479262; cv=none; d=google.com; s=arc-20160816; b=b+vyf0o4k7/vtep6kiU+5OuznKv22orH14VkojEbojUvFlKkcCND3hK+Ii933K2vE/ hjUfDLxwzqQwllxiEXbwgXR1RJ1QtMr84dsTv6dem+XDdwLXY3HzdSY2B2i+AqE47hbA /27Pfl/Wv2xDrDccVYylJU9cDQIUZhXOxLdrO0n6A05czRGOWugHmqf/u7BzNRUTPDR1 TzEBLIVitezli0Lsy5LO3Ie8WNMXOza8jWD3LHdvuOnQzS3lNIsUqMU5lUvIbhMRhyHt WT9yhAfKL+T7YiBE0vV8V3cli5fOl8yBWtXIb3Q+o5qKe+rGFcWeY8LcaD2dSE897wT0 dWLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=yFI65RvVtTM2ME5CyF/sgnN3FuRqBBLtJxdISzo+HMk=; b=SHvVoo3Byz172G7c/Y/+IjE5WjC6dxtoDNNR2LFTYX4K8upw8hEsEv1Ibq66AGF83n 4ojnfWfWugYCBSwrbskqnP5+q0cGOmuLvspts9ZBxG3bofFTlOXJVljC+15Am2cD+87p yXWDwjPjlPiIs2iwjwRHbo35GS7K7ApA+8mFBU9GerBwKnvDmq4GEsfkAp4ZC6PwihRj dUzytISBOKMgCiBj7HKxuhWXuJgday+yWzpfxWE3QNsuv1/2xZmTz9qtcdPdCzeh5XPp /492dx2yMIJI4/v638zHSRj/wMlWrY4Bqzm3AhnxiQAn3yw8S8isPzQkaEA/x7psHc6O 72cg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si886660plh.539.2017.06.14.15.27.42; Wed, 14 Jun 2017 15:27:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752731AbdFNW1i (ORCPT + 25 others); Wed, 14 Jun 2017 18:27:38 -0400 Received: from foss.arm.com ([217.140.101.70]:39680 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752661AbdFNW1g (ORCPT ); Wed, 14 Jun 2017 18:27:36 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 84534174E; Wed, 14 Jun 2017 15:27:35 -0700 (PDT) Received: from beelzebub.ast.arm.com (beelzebub.austin.arm.com [10.118.12.119]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id EEFC63F3E1; Wed, 14 Jun 2017 15:27:34 -0700 (PDT) From: Jeremy Linton To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, rostedt@goodmis.org, mingo@redhat.com, rusty@rustcorp.com.au, jeyu@redhat.com, kirill.shutemov@linux.intel.com, christoffer.dall@linaro.org, marc.zyngier@arm.com, jcm@jonmasters.org, clemens@ladisch.de, perex@perex.cz Subject: [PATCH v2 08/13] tracing: Rename enum_replace to eval_replace Date: Wed, 14 Jun 2017 17:27:24 -0500 Message-Id: <20170614222729.16521-9-jeremy.linton@arm.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170614222729.16521-1-jeremy.linton@arm.com> References: <20170614222729.16521-1-jeremy.linton@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The enum_replace stanza works as is for sizeof() calls as well as enums. Rename it as well. Signed-off-by: Jeremy Linton --- kernel/trace/trace_events.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) -- 2.9.4 diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index e6897b0..83dfd0d 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -2067,12 +2067,12 @@ __register_event(struct trace_event_call *call, struct module *mod) return 0; } -static char *enum_replace(char *ptr, struct trace_eval_map *map, int len) +static char *eval_replace(char *ptr, struct trace_eval_map *map, int len) { int rlen; int elen; - /* Find the length of the enum value as a string */ + /* Find the length of the eval value as a string */ elen = snprintf(ptr, 0, "%ld", map->eval_value); /* Make sure there's enough room to replace the string with the value */ if (len < elen) @@ -2127,14 +2127,14 @@ static void update_event_printk(struct trace_event_call *call, if (isalpha(*ptr) || *ptr == '_') { if (strncmp(map->eval_string, ptr, len) == 0 && !isalnum(ptr[len]) && ptr[len] != '_') { - ptr = enum_replace(ptr, map, len); - /* Hmm, enum string smaller than value */ + ptr = eval_replace(ptr, map, len); + /* enum/sizeof string smaller than value */ if (WARN_ON_ONCE(!ptr)) return; /* - * No need to decrement here, as enum_replace() + * No need to decrement here, as eval_replace() * returns the pointer to the character passed - * the enum, and two enums can not be placed + * the eval, and two evals can not be placed * back to back without something in between. * We can skip that something in between. */ From patchwork Wed Jun 14 22:27:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 105599 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp512105qgd; Wed, 14 Jun 2017 15:27:50 -0700 (PDT) X-Received: by 10.98.43.206 with SMTP id r197mr2062828pfr.202.1497479270723; Wed, 14 Jun 2017 15:27:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497479270; cv=none; d=google.com; s=arc-20160816; b=Nxw2X/DV5xzEl5qCrvgpgWabdyq82VZ4HN2bhkvpdxDJYa4cT4LrfRi52+72U/hN15 a+9a36fbvuJwRfCcjFNfC40s3Zh36dvGCMVB7fJIFdZBXXTXiuYUlF4k2KiHbO41CqQS HWBfus5Xsp3T2JDkkC+CuJScCwvFKxQ65B3RqDJTmTB427egbJsXT6wczjx7ocVELQN2 Obh90Mgs8sTcED17F0vk7z1jcf8IhhJ4bPk/nrfXgq77CfWMZ6ZawMDw5QPy3sSNyb5v PtdiQvrbs6S8PRB4wA5vTdI2AF9l9wQ7tuY5F22EJWG3I4BcfxnztOHpD1OCsB7bzRt3 +V2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=BulRlMTc/fiEUAu1YYc9qhiy8lNl/tT5Xz6dLO9DMNQ=; b=ATBnJumz05Z3M3CKnxCFgBmhP0wquzgory11E46qGgQYCG+ZcJDgTFA9z5szHQ/XIG iWQ+MXI7sm0xkZC2VxrcyV7nan20mno5pUur6d6kcBn8DV4pSwDsHxwaVlFYr8ckpb7P FwYdrZRV+Gcew3nHu2+XQpF2qU6IY3Fy7T5ASxH2jVs6xuxcekOah/EDrhJrpeg6+1dS 1N6DrJVFAER2axFi/WFiFxpzOhfZy+v+Q1dwQOlpmwZsQSHgLUVYshnAstguxEUaRYv9 fY13gFq0PgQdzmR+mf21wa9hKQWX2UjKDOeIIfCJIwSFPhmPaGmINsPXQ9rRHshRHJPS 67bQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c1si843833pld.242.2017.06.14.15.27.50; Wed, 14 Jun 2017 15:27:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752802AbdFNW1n (ORCPT + 25 others); Wed, 14 Jun 2017 18:27:43 -0400 Received: from foss.arm.com ([217.140.101.70]:39692 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752712AbdFNW1l (ORCPT ); Wed, 14 Jun 2017 18:27:41 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1FB201991; Wed, 14 Jun 2017 15:27:36 -0700 (PDT) Received: from beelzebub.ast.arm.com (beelzebub.austin.arm.com [10.118.12.119]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8B9923F3E1; Wed, 14 Jun 2017 15:27:35 -0700 (PDT) From: Jeremy Linton To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, rostedt@goodmis.org, mingo@redhat.com, rusty@rustcorp.com.au, jeyu@redhat.com, kirill.shutemov@linux.intel.com, christoffer.dall@linaro.org, marc.zyngier@arm.com, jcm@jonmasters.org, clemens@ladisch.de, perex@perex.cz Subject: [PATCH v2 09/13] tracing: define TRACE_DEFINE_SIZEOF() macro to map sizeof's to their values Date: Wed, 14 Jun 2017 17:27:25 -0500 Message-Id: <20170614222729.16521-10-jeremy.linton@arm.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170614222729.16521-1-jeremy.linton@arm.com> References: <20170614222729.16521-1-jeremy.linton@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Perf has a problem that if sizeof() macros are used within TRACE_EVENT() macro's they end up in userspace as "sizeof(kernel structure)" which cannot properly be parsed. Add a macro which can forward this data through the eval_map for userspace utilization. Signed-off-by: Jeremy Linton --- include/linux/tracepoint.h | 1 + include/trace/trace_events.h | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) -- 2.9.4 diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index f7b0f55..a26ffbe 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h @@ -88,6 +88,7 @@ extern void syscall_unregfunc(void); #define PARAMS(args...) args #define TRACE_DEFINE_ENUM(x) +#define TRACE_DEFINE_SIZEOF(x) #endif /* _LINUX_TRACEPOINT_H */ diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h index 49cce5f..3976fa1 100644 --- a/include/trace/trace_events.h +++ b/include/trace/trace_events.h @@ -46,6 +46,19 @@ TRACE_MAKE_SYSTEM_STR(); __attribute__((section("_ftrace_eval_map"))) \ *TRACE_SYSTEM##_##a = &__##TRACE_SYSTEM##_##a +#undef TRACE_DEFINE_SIZEOF +#define TRACE_DEFINE_SIZEOF(a) \ + static struct trace_eval_map __used __initdata \ + __##TRACE_SYSTEM##_##a = \ + { \ + .system = TRACE_SYSTEM_STRING, \ + .eval_string = "sizeof(" #a ")", \ + .eval_value = sizeof(a) \ + }; \ + static struct trace_eval_map __used \ + __attribute__((section("_ftrace_eval_map"))) \ + *TRACE_SYSTEM##_##a = &__##TRACE_SYSTEM##_##a + /* * DECLARE_EVENT_CLASS can be used to add a generic function * handlers for events. That is, if all events have the same @@ -158,6 +171,9 @@ TRACE_MAKE_SYSTEM_STR(); #undef TRACE_DEFINE_ENUM #define TRACE_DEFINE_ENUM(a) +#undef TRACE_DEFINE_SIZEOF +#define TRACE_DEFINE_SIZEOF(a) + #undef __field #define __field(type, item) From patchwork Wed Jun 14 22:27:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 105600 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp512193qgd; Wed, 14 Jun 2017 15:28:09 -0700 (PDT) X-Received: by 10.84.231.134 with SMTP id g6mr2504417plk.86.1497479288963; Wed, 14 Jun 2017 15:28:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497479288; cv=none; d=google.com; s=arc-20160816; b=MgIAhzgEAccsItGJ0ugA0jQcQtZ6poGGXOl440ai0pF8+sWANlo9aMNjDGsWHmbwr0 xIAaYd1MCJBeHAM8uU7viNtLo6CmQfzgustBgq5Svmf/QHOFl6VvkF5wRVCx89dw/f77 JNOvs9KHRMxPB2E3TDnt5a1/lN7Ebws0K2LR50t59Y03vzQ3AEmgsdHFMBDwVbq97gIy CsU06+xKg524iettoU8rA49XcOIG7fRFTEpyPGzEXfq7znez/61Br7rujyE+f0mOeeSf FEPSajG+cdfimuOCuqvqRBruhpS6y+L5U8e4j3zV3RwFR6CCqp3ngZT6tW9LAtAzJeax 1vxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=pviJS4FN39ENaGUiIetOSwNB2DA9OOiwvpKC1MNjcbw=; b=yvIGqb57vKq9ZCrYVnBEnd42FnGcmjRKRUmRZk5l0aN9bTAu3ZV5AvFf6cCcCBsDl5 +tZG5X61s1TY6/HcG/7YZrQ0oiZGr9aGwDauzEyu4WZFCGTyIVByprBpgkc/2cOOc3QA wa5oBhjeQDsAmHI7AdqMKJcJPryWkisrYcrErMHXzA3ewSSlP+lDzLojxQXkR3pLGJkJ Nil+/OHKo4la0PzbqVIxP4+ddQjaR0osmehY4HdA3/TmxegHQ8GRQ9mh8u0hGjpeoStn LLK6kltgufrvSPrvIsOuQ8EI3CUOfRBQT5C+x5Tc3o9ZYDYNJRtc2wSxDH41hQ1tSdq1 l8+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q63si844114pfk.166.2017.06.14.15.28.08; Wed, 14 Jun 2017 15:28:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752831AbdFNW14 (ORCPT + 25 others); Wed, 14 Jun 2017 18:27:56 -0400 Received: from foss.arm.com ([217.140.101.70]:39702 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752771AbdFNW1m (ORCPT ); Wed, 14 Jun 2017 18:27:42 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B09681993; Wed, 14 Jun 2017 15:27:36 -0700 (PDT) Received: from beelzebub.ast.arm.com (beelzebub.austin.arm.com [10.118.12.119]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 284823F3E1; Wed, 14 Jun 2017 15:27:36 -0700 (PDT) From: Jeremy Linton To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, rostedt@goodmis.org, mingo@redhat.com, rusty@rustcorp.com.au, jeyu@redhat.com, kirill.shutemov@linux.intel.com, christoffer.dall@linaro.org, marc.zyngier@arm.com, jcm@jonmasters.org, clemens@ladisch.de, perex@perex.cz Subject: [PATCH v2 10/13] tracing: Update sample file to describe the new macro Date: Wed, 14 Jun 2017 17:27:26 -0500 Message-Id: <20170614222729.16521-11-jeremy.linton@arm.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170614222729.16521-1-jeremy.linton@arm.com> References: <20170614222729.16521-1-jeremy.linton@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a blurb in the trace sample file to describe the macro used to add sizeof to value conversions. Signed-off-by: Jeremy Linton --- samples/trace_events/trace-events-sample.h | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) -- 2.9.4 diff --git a/samples/trace_events/trace-events-sample.h b/samples/trace_events/trace-events-sample.h index 76a75ab..a7431d4 100644 --- a/samples/trace_events/trace-events-sample.h +++ b/samples/trace_events/trace-events-sample.h @@ -225,26 +225,36 @@ TRACE_DEFINE_ENUM(TRACE_SAMPLE_FOO); TRACE_DEFINE_ENUM(TRACE_SAMPLE_BAR); TRACE_DEFINE_ENUM(TRACE_SAMPLE_ZOO); +/* + * The same problem as above applies to sizeof(), so there is also + * a macro to solve that problem. In the case show below foo_bar/format + * contains a string "__print_array(...,sizeof(phys_addr_t))" for which + * the sizeof() result varies depending on the kernel. Adding the following + * macro decodes the size before transferring it to userspace. + */ + +TRACE_DEFINE_SIZEOF(phys_addr_t); + TRACE_EVENT(foo_bar, - TP_PROTO(const char *foo, int bar, const int *lst, + TP_PROTO(const char *foo, int bar, const phys_addr_t *lst, const char *string, const struct cpumask *mask), TP_ARGS(foo, bar, lst, string, mask), TP_STRUCT__entry( - __array( char, foo, 10 ) - __field( int, bar ) - __dynamic_array(int, list, __length_of(lst)) - __string( str, string ) - __bitmask( cpus, num_possible_cpus() ) + __array( char, foo, 10 ) + __field( int, bar ) + __dynamic_array(phys_addr_t, list, __length_of(lst) ) + __string( str, string ) + __bitmask( cpus, num_possible_cpus() ) ), TP_fast_assign( strlcpy(__entry->foo, foo, 10); __entry->bar = bar; memcpy(__get_dynamic_array(list), lst, - __length_of(lst) * sizeof(int)); + __length_of(lst) * sizeof(phys_addr_t)); __assign_str(str, string); __assign_bitmask(cpus, cpumask_bits(mask), num_possible_cpus()); ), @@ -291,8 +301,8 @@ TRACE_EVENT(foo_bar, * This prints out the array that is defined by __array in a nice format. */ __print_array(__get_dynamic_array(list), - __get_dynamic_array_len(list) / sizeof(int), - sizeof(int)), + __get_dynamic_array_len(list) / sizeof(phys_addr_t), + sizeof(phys_addr_t)), __get_str(str), __get_bitmask(cpus)) ); From patchwork Wed Jun 14 22:27:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 105602 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp512460qgd; Wed, 14 Jun 2017 15:28:57 -0700 (PDT) X-Received: by 10.98.218.25 with SMTP id c25mr2155847pfh.118.1497479337693; Wed, 14 Jun 2017 15:28:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497479337; cv=none; d=google.com; s=arc-20160816; b=Z8cLOqH88GjzE30GgYqcLPnJiJvWdYSo0fr0FFFEXQ3ITQiixYIMf2shWxjm3OvA4n 3pVh6Me7A4dd/31S/92VPvV5VWtxmx1d7E8FptNjMYAe2H7pRf3qwdrgC9Wqr3X8jztO f8bFQwubZEuTjo1bAfqI9Mrec/CjRIQ4ecD9qP2uK2QDMd4fi055WkJd0ngkMO6OxA+m crVyj15AjuZAOJPJnQQ1xsiptZmctdBQu/2AeHhaIApTnDeujZ+6NDfo1eBqQnXpsmpZ 7DOSKzfAu9OaMnH3qirnLXKpr6shVo6zkOIm5Scss7Y4+8Xs6O0V/zwG8zQDA5NDsUtH aWqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Q7Bsik+1Zdm+4FLcEkRcz5h8xSr2Nl7E9Ujdn03Ud+k=; b=nGHr5CWgSNzVEp3Et8lcC68VsyAg0imRGoxV+9dqtbRqbiiDnQe+Qn2z/7ASS3hRnj aDK5qZm5WhSS0FXbdXTzAu8leQ5pzYs0Hy/QiNIGDyxWnmFA+cu1hPZW+vSWkujEwv8l mQqBg118ap5gGihahH6OhI0yOyq11bQERQ3ry9l/0Bzmdz6p1kN2GL8oKmz7VcUawuQ0 PkaxvxERM26V9IZKd3Aw8tZjD9kw81xVW8HW4SLBCpPc53FnPk0kjHoAv00NhrSazhEa zKjPWGiUm/ymFHENMBWkXRPxeoMm0tJaH/qqY3bFvqlDjr9bD9fjXRNUbl57OYaT1Wep /2qw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h11si863056pln.492.2017.06.14.15.28.57; Wed, 14 Jun 2017 15:28:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752875AbdFNW2l (ORCPT + 25 others); Wed, 14 Jun 2017 18:28:41 -0400 Received: from foss.arm.com ([217.140.101.70]:39706 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752080AbdFNW1h (ORCPT ); Wed, 14 Jun 2017 18:27:37 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4D384199B; Wed, 14 Jun 2017 15:27:37 -0700 (PDT) Received: from beelzebub.ast.arm.com (beelzebub.austin.arm.com [10.118.12.119]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B91F03F3E1; Wed, 14 Jun 2017 15:27:36 -0700 (PDT) From: Jeremy Linton To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, rostedt@goodmis.org, mingo@redhat.com, rusty@rustcorp.com.au, jeyu@redhat.com, kirill.shutemov@linux.intel.com, christoffer.dall@linaro.org, marc.zyngier@arm.com, jcm@jonmasters.org, clemens@ladisch.de, perex@perex.cz Subject: [PATCH v2 11/13] tracing: Add TRACE_DEFINE_SIZEOF() macros Date: Wed, 14 Jun 2017 17:27:27 -0500 Message-Id: <20170614222729.16521-12-jeremy.linton@arm.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170614222729.16521-1-jeremy.linton@arm.com> References: <20170614222729.16521-1-jeremy.linton@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are a few places in the kernel where sizeof() is already being used. Update those locations with TRACE_DEFINE_SIZEOF. Signed-off-by: Jeremy Linton --- arch/arm64/kvm/trace.h | 2 ++ drivers/net/fjes/fjes_trace.h | 2 ++ include/trace/events/xen.h | 13 +++++++++++-- 3 files changed, 15 insertions(+), 2 deletions(-) -- 2.9.4 diff --git a/arch/arm64/kvm/trace.h b/arch/arm64/kvm/trace.h index 7fb0008..5188c70 100644 --- a/arch/arm64/kvm/trace.h +++ b/arch/arm64/kvm/trace.h @@ -93,6 +93,8 @@ TRACE_EVENT(kvm_arm_set_dreg32, TP_printk("%s: 0x%08x", __entry->name, __entry->value) ); +TRACE_DEFINE_SIZEOF(__u64); + TRACE_EVENT(kvm_arm_set_regset, TP_PROTO(const char *type, int len, __u64 *control, __u64 *value), TP_ARGS(type, len, control, value), diff --git a/drivers/net/fjes/fjes_trace.h b/drivers/net/fjes/fjes_trace.h index cca01a1..d9c8ca6 100644 --- a/drivers/net/fjes/fjes_trace.h +++ b/drivers/net/fjes/fjes_trace.h @@ -62,6 +62,8 @@ TRACE_EVENT(fjes_hw_issue_request_command, __entry->cs_complete, __entry->timeout, __entry->ret) ); +TRACE_DEFINE_SIZEOF(u8); + TRACE_EVENT(fjes_hw_request_info, TP_PROTO(struct fjes_hw *hw, union fjes_device_command_res *res_buf), TP_ARGS(hw, res_buf), diff --git a/include/trace/events/xen.h b/include/trace/events/xen.h index 31acce9..b70a38b 100644 --- a/include/trace/events/xen.h +++ b/include/trace/events/xen.h @@ -30,6 +30,8 @@ DECLARE_EVENT_CLASS(xen_mc__batch, DEFINE_XEN_MC_BATCH(xen_mc_batch); DEFINE_XEN_MC_BATCH(xen_mc_issue); +TRACE_DEFINE_SIZEOF(ulong); + TRACE_EVENT(xen_mc_entry, TP_PROTO(struct multicall_entry *mc, unsigned nargs), TP_ARGS(mc, nargs), @@ -40,8 +42,8 @@ TRACE_EVENT(xen_mc_entry, ), TP_fast_assign(__entry->op = mc->op; __entry->nargs = nargs; - memcpy(__entry->args, mc->args, sizeof(unsigned long) * nargs); - memset(__entry->args + nargs, 0, sizeof(unsigned long) * (6 - nargs)); + memcpy(__entry->args, mc->args, sizeof(ulong) * nargs); + memset(__entry->args + nargs, 0, sizeof(ulong) * (6 - nargs)); ), TP_printk("op %u%s args [%lx, %lx, %lx, %lx, %lx, %lx]", __entry->op, xen_hypercall_name(__entry->op), @@ -122,6 +124,7 @@ TRACE_EVENT(xen_mc_extend_args, __entry->res == XEN_MC_XE_NO_SPACE ? "NO_SPACE" : "???") ); +TRACE_DEFINE_SIZEOF(pteval_t); /* mmu */ DECLARE_EVENT_CLASS(xen_mmu__set_pte, TP_PROTO(pte_t *ptep, pte_t pteval), @@ -199,6 +202,8 @@ TRACE_EVENT(xen_mmu_pte_clear, __entry->mm, __entry->addr, __entry->ptep) ); +TRACE_DEFINE_SIZEOF(pmdval_t); + TRACE_EVENT(xen_mmu_set_pmd, TP_PROTO(pmd_t *pmdp, pmd_t pmdval), TP_ARGS(pmdp, pmdval), @@ -226,6 +231,8 @@ TRACE_EVENT(xen_mmu_pmd_clear, #if CONFIG_PGTABLE_LEVELS >= 4 +TRACE_DEFINE_SIZEOF(pudval_t); + TRACE_EVENT(xen_mmu_set_pud, TP_PROTO(pud_t *pudp, pud_t pudval), TP_ARGS(pudp, pudval), @@ -241,6 +248,8 @@ TRACE_EVENT(xen_mmu_set_pud, (int)sizeof(pudval_t) * 2, (unsigned long long)__entry->pudval) ); +TRACE_DEFINE_SIZEOF(p4dval_t); + TRACE_EVENT(xen_mmu_set_p4d, TP_PROTO(p4d_t *p4dp, p4d_t *user_p4dp, p4d_t p4dval), TP_ARGS(p4dp, user_p4dp, p4dval), From patchwork Wed Jun 14 22:27:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 105601 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp512319qgd; Wed, 14 Jun 2017 15:28:33 -0700 (PDT) X-Received: by 10.101.76.136 with SMTP id m8mr2099697pgt.159.1497479313259; Wed, 14 Jun 2017 15:28:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497479313; cv=none; d=google.com; s=arc-20160816; b=P8p8ieDgTMpyKMAFtsL96dGF0lxFzOMlQhEjJ5buw1zKf6NNgg+wBgLdHqskGbr9G7 LqSMgsXrGaKtAaPqLMelSJBGLg58cxOsyLiYiCgFZ19sYM+OsIPF1OlR1yolLMxDUC7o eqU9XDjA1VgXTCgzpU4Yx89oAZpCgwPcSzV0IPCpWc7CqetqwSyMg3MXethAs9OWiOuy JOIPpxFCGlvh9UI4i9+ppFnAkfmVd/acQIumMO5XYS+oM0znkA36uCZj8esRLJNBN/Ee 6UYymFAY/y/n82FVfUsYDysXJQY+iLkdqQK0Sr4QqB4xnSNsU1Povkep8+hcAuAb5uCa Vx/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=yvkPOZ6DRt3RvUy8f41O06+K/mPhqhHLx6SFA4JH/Wg=; b=kyp0Nv0YdvNL45IuQDdo7cJxxLeM2hknvLfW81Dl7N3lexJMFfLf6yTQPiSs4Z6fT5 DNhxsLnK3fyYkFqqQ1EA6bloeT+nu2nmd8eCrUCh2CieIQFuQ6bsLfV5hOwN3PZVuKru nuHxgiiPPMJZK450seZvimlBAaPEEjtLPKde2bYM13gYJPLyM9vMhTQw7l+nPSP+YZZ4 ygJlogeXosLYC2jGDHBc5aFwKRVU2ZcrmL/Bx/w7pAlvZLPBjRXtN50EEbQ4zQKhm9r2 qW5EPsAJ+8MIo/LvdCkZorm3boRdjpQb+Wj/3g+2AKpoWFvzMBSTqA9yA/lHubAOTz/A yqsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j2si856723pfe.51.2017.06.14.15.28.32; Wed, 14 Jun 2017 15:28:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752850AbdFNW2U (ORCPT + 25 others); Wed, 14 Jun 2017 18:28:20 -0400 Received: from foss.arm.com ([217.140.101.70]:39708 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752700AbdFNW1i (ORCPT ); Wed, 14 Jun 2017 18:27:38 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DE3A219BF; Wed, 14 Jun 2017 15:27:37 -0700 (PDT) Received: from beelzebub.ast.arm.com (beelzebub.austin.arm.com [10.118.12.119]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 55C413F5C9; Wed, 14 Jun 2017 15:27:37 -0700 (PDT) From: Jeremy Linton To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, rostedt@goodmis.org, mingo@redhat.com, rusty@rustcorp.com.au, jeyu@redhat.com, kirill.shutemov@linux.intel.com, christoffer.dall@linaro.org, marc.zyngier@arm.com, jcm@jonmasters.org, clemens@ladisch.de, perex@perex.cz Subject: [PATCH v2 12/13] tracing: Replace some magic constants with sizeof() Date: Wed, 14 Jun 2017 17:27:28 -0500 Message-Id: <20170614222729.16521-13-jeremy.linton@arm.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170614222729.16521-1-jeremy.linton@arm.com> References: <20170614222729.16521-1-jeremy.linton@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that sizeof() works in TP_printk, lets replace a few cases in the kernel where the element size is hardcoded rather than using sizeof(). Signed-off-by: Jeremy Linton --- include/trace/events/thermal.h | 4 +++- include/trace/events/thermal_power_allocator.h | 4 ++-- sound/firewire/motu/amdtp-motu-trace.h | 12 ++++++++---- 3 files changed, 13 insertions(+), 7 deletions(-) -- 2.9.4 diff --git a/include/trace/events/thermal.h b/include/trace/events/thermal.h index 6cde5b3..fad25224 100644 --- a/include/trace/events/thermal.h +++ b/include/trace/events/thermal.h @@ -90,6 +90,8 @@ TRACE_EVENT(thermal_zone_trip, show_tzt_type(__entry->trip_type)) ); +TRACE_DEFINE_SIZEOF(u32); + TRACE_EVENT(thermal_power_cpu_get_power, TP_PROTO(const struct cpumask *cpus, unsigned long freq, u32 *load, size_t load_len, u32 dynamic_power, u32 static_power), @@ -118,7 +120,7 @@ TRACE_EVENT(thermal_power_cpu_get_power, TP_printk("cpus=%s freq=%lu load={%s} dynamic_power=%d static_power=%d", __get_bitmask(cpumask), __entry->freq, - __print_array(__get_dynamic_array(load), __entry->load_len, 4), + __print_array(__get_dynamic_array(load), __entry->load_len, sizeof(u32)), __entry->dynamic_power, __entry->static_power) ); diff --git a/include/trace/events/thermal_power_allocator.h b/include/trace/events/thermal_power_allocator.h index 5afae8f..5f0ef92 100644 --- a/include/trace/events/thermal_power_allocator.h +++ b/include/trace/events/thermal_power_allocator.h @@ -45,10 +45,10 @@ TRACE_EVENT(thermal_power_allocator, TP_printk("thermal_zone_id=%d req_power={%s} total_req_power=%u granted_power={%s} total_granted_power=%u power_range=%u max_allocatable_power=%u current_temperature=%d delta_temperature=%d", __entry->tz_id, __print_array(__get_dynamic_array(req_power), - __entry->num_actors, 4), + __entry->num_actors, sizeof(u32)), __entry->total_req_power, __print_array(__get_dynamic_array(granted_power), - __entry->num_actors, 4), + __entry->num_actors, sizeof(u32)), __entry->total_granted_power, __entry->power_range, __entry->max_allocatable_power, __entry->current_temp, __entry->delta_temp) diff --git a/sound/firewire/motu/amdtp-motu-trace.h b/sound/firewire/motu/amdtp-motu-trace.h index cd0cbfa9..22babfa 100644 --- a/sound/firewire/motu/amdtp-motu-trace.h +++ b/sound/firewire/motu/amdtp-motu-trace.h @@ -18,6 +18,8 @@ static void copy_sph(u32 *frame, __be32 *buffer, unsigned int data_blocks, static void copy_message(u64 *frames, __be32 *buffer, unsigned int data_blocks, unsigned int data_block_quadlets); +TRACE_DEFINE_SIZEOF(u32); + TRACE_EVENT(in_data_block_sph, TP_PROTO(struct amdtp_stream *s, unsigned int data_blocks, __be32 *buffer), TP_ARGS(s, data_blocks, buffer), @@ -38,7 +40,7 @@ TRACE_EVENT(in_data_block_sph, __entry->src, __entry->dst, __entry->data_blocks, - __print_array(__get_dynamic_array(tstamps), __entry->data_blocks, 4) + __print_array(__get_dynamic_array(tstamps), __entry->data_blocks, sizeof(u32)) ) ); @@ -62,10 +64,12 @@ TRACE_EVENT(out_data_block_sph, __entry->src, __entry->dst, __entry->data_blocks, - __print_array(__get_dynamic_array(tstamps), __entry->data_blocks, 4) + __print_array(__get_dynamic_array(tstamps), __entry->data_blocks, sizeof(u32)) ) ); +TRACE_DEFINE_SIZEOF(u64); + TRACE_EVENT(in_data_block_message, TP_PROTO(struct amdtp_stream *s, unsigned int data_blocks, __be32 *buffer), TP_ARGS(s, data_blocks, buffer), @@ -86,7 +90,7 @@ TRACE_EVENT(in_data_block_message, __entry->src, __entry->dst, __entry->data_blocks, - __print_array(__get_dynamic_array(messages), __entry->data_blocks, 8) + __print_array(__get_dynamic_array(messages), __entry->data_blocks, sizeof(u64)) ) ); @@ -110,7 +114,7 @@ TRACE_EVENT(out_data_block_message, __entry->src, __entry->dst, __entry->data_blocks, - __print_array(__get_dynamic_array(messages), __entry->data_blocks, 8) + __print_array(__get_dynamic_array(messages), __entry->data_blocks, sizeof(u64)) ) ); From patchwork Wed Jun 14 22:27:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 105598 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp512076qgd; Wed, 14 Jun 2017 15:27:43 -0700 (PDT) X-Received: by 10.98.166.18 with SMTP id t18mr2079598pfe.66.1497479263030; Wed, 14 Jun 2017 15:27:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497479263; cv=none; d=google.com; s=arc-20160816; b=kO2LhyhQlB9dH3YfbssdT2J0pg+FFIVPg2Ia7NzqSt4xe6J2qkvLXy6CK5EUeQxC5+ 1aXNMlqjt6ZuBcrrTXj2Kgk1zPdKwHibm8oyvVW2QYtE3QhG/21ZfDlLJEC8NBko1eKk QkEO74IRDQAKDtZohhghePEeTLkYt135fFuKZj9h0zLeKwZshXdm8MxvplKbjb38utCt 1eFgNUF1PCt9dp2WzvmW0gTCS/zOVUPVvrjfKdxsTpyPGR2vPvIFKJcfiIrtMrAG3rPc 472z5mz9Kaz3y1xLP8wATTaD3PuCGja15YfbdNEcS2AhLSkO3eHTKMPgZ8EjonvTCRqF sg3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=qK9qPoAUEDhhWWaNWpWh8AdB2ZBsxjsBW5nESsFi4r4=; b=lRO18oiZtUCJFAd6OxdFDsNYX9CvVYJf0OoS5Hna2qBuS9dRbNe29/2kEBy5247zWO T7Jwmpc+cgr7ktzR8AB3P4YwRKeVPUwEciVof8ImWDBDTT/nuK34azmwrd76a0PF5qdw aY5ndoWreR2yipscpzJ3jOICQZR/tx8f68zmG/TYQHClP+VlWzlxgX2GPhWExGoKojw7 OQkNVQNyVcw7sx7QKzwLawd5MOJZl27/IB25IgjC8e8W+/YY3zC9FKJ8wwZE4kZP2eXH 6jWIziouXgy4AzX+8+wWsJrX+FcjmzacQIwUoONJPPI9RYuj6WWmewmotNBpzbiS2MRH rNPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si886660plh.539.2017.06.14.15.27.42; Wed, 14 Jun 2017 15:27:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752768AbdFNW1k (ORCPT + 25 others); Wed, 14 Jun 2017 18:27:40 -0400 Received: from foss.arm.com ([217.140.101.70]:39706 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752712AbdFNW1i (ORCPT ); Wed, 14 Jun 2017 18:27:38 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7ADF119CC; Wed, 14 Jun 2017 15:27:38 -0700 (PDT) Received: from beelzebub.ast.arm.com (beelzebub.austin.arm.com [10.118.12.119]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E6D823F3E1; Wed, 14 Jun 2017 15:27:37 -0700 (PDT) From: Jeremy Linton To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, rostedt@goodmis.org, mingo@redhat.com, rusty@rustcorp.com.au, jeyu@redhat.com, kirill.shutemov@linux.intel.com, christoffer.dall@linaro.org, marc.zyngier@arm.com, jcm@jonmasters.org, clemens@ladisch.de, perex@perex.cz Subject: [PATCH v2 13/13] tracing: Rename and update the enum_map file Date: Wed, 14 Jun 2017 17:27:29 -0500 Message-Id: <20170614222729.16521-14-jeremy.linton@arm.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170614222729.16521-1-jeremy.linton@arm.com> References: <20170614222729.16521-1-jeremy.linton@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The enum_map file is used to display a list of symbol to name conversions. As its now used to resolve sizeof lets update the name and description. Signed-off-by: Jeremy Linton --- kernel/trace/Kconfig | 22 +++++++++++----------- kernel/trace/trace.c | 20 ++++++++++---------- 2 files changed, 21 insertions(+), 21 deletions(-) -- 2.9.4 diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index 7e06f04..434c840 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig @@ -667,30 +667,30 @@ config RING_BUFFER_STARTUP_TEST If unsure, say N -config TRACE_ENUM_MAP_FILE - bool "Show enum mappings for trace events" +config TRACE_EVAL_MAP_FILE + bool "Show eval mappings for trace events" depends on TRACING help - The "print fmt" of the trace events will show the enum names instead - of their values. This can cause problems for user space tools that - use this string to parse the raw data as user space does not know + The "print fmt" of the trace events will show the enum/sizeof names + instead of their values. This can cause problems for user space tools + that use this string to parse the raw data as user space does not know how to convert the string to its value. To fix this, there's a special macro in the kernel that can be used - to convert the enum into its value. If this macro is used, then the - print fmt strings will have the enums converted to their values. + to convert an enum/sizeof into its value. If this macro is used, then + the print fmt strings will be converted to their values. If something does not get converted properly, this option can be - used to show what enums the kernel tried to convert. + used to show what enums/sizeof the kernel tried to convert. - This option is for debugging the enum conversions. A file is created - in the tracing directory called "enum_map" that will show the enum + This option is for debugging the conversions. A file is created + in the tracing directory called "eval_map" that will show the names matched with their values and what trace event system they belong too. Normally, the mapping of the strings to values will be freed after boot up or module load. With this option, they will not be freed, as - they are needed for the "enum_map" file. Enabling this option will + they are needed for the "eval_map" file. Enabling this option will increase the memory footprint of the running kernel. If unsure, say N diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 676c808..7297e9d 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -120,8 +120,8 @@ enum ftrace_dump_mode ftrace_dump_on_oops; /* When set, tracing will stop when a WARN*() is hit */ int __disable_trace_on_warning; -#ifdef CONFIG_TRACE_ENUM_MAP_FILE -/* Map of enums to their values, for "enum_map" file */ +#ifdef CONFIG_TRACE_EVAL_MAP_FILE +/* Map of enums to their values, for "eval_map" file */ struct trace_eval_map_head { struct module *mod; unsigned long length; @@ -145,7 +145,7 @@ static DEFINE_MUTEX(trace_eval_mutex); * one at the beginning, and one at the end. The beginning item contains * the count of the saved maps (head.length), and the module they * belong to if not built in (head.mod). The ending item contains a - * pointer to the next array of saved enum_eval/enum_map items. + * pointer to the next array of saved eval_map items. */ union trace_eval_map_item { struct trace_eval_map map; @@ -154,7 +154,7 @@ union trace_eval_map_item { }; static union trace_eval_map_item *trace_eval_maps; -#endif /* CONFIG_TRACE_ENUM_MAP_FILE */ +#endif /* CONFIG_TRACE_EVAL_MAP_FILE */ static int tracing_set_tracer(struct trace_array *tr, const char *buf); @@ -4717,7 +4717,7 @@ static const struct file_operations tracing_saved_cmdlines_size_fops = { .write = tracing_saved_cmdlines_size_write, }; -#ifdef CONFIG_TRACE_ENUM_MAP_FILE +#ifdef CONFIG_TRACE_EVAL_MAP_FILE static union trace_eval_map_item * update_eval_map(union trace_eval_map_item *ptr) { @@ -4868,15 +4868,15 @@ trace_insert_eval_map_file(struct module *mod, struct trace_eval_map **start, static void trace_create_eval_file(struct dentry *d_tracer) { - trace_create_file("enum_map", 0444, d_tracer, + trace_create_file("eval_map", 0444, d_tracer, NULL, &tracing_eval_map_fops); } -#else /* CONFIG_TRACE_ENUM_MAP_FILE */ +#else /* CONFIG_TRACE_EVAL_MAP_FILE */ static inline void trace_create_eval_file(struct dentry *d_tracer) { } static inline void trace_insert_eval_map_file(struct module *mod, struct trace_eval_map **start, int len) { } -#endif /* !CONFIG_TRACE_ENUM_MAP_FILE */ +#endif /* !CONFIG_TRACE_EVAL_MAP_FILE */ static void trace_insert_eval_map(struct module *mod, struct trace_eval_map **start, int len) @@ -7731,7 +7731,7 @@ static void trace_module_add_evals(struct module *mod) trace_insert_eval_map(mod, mod->trace_evals, mod->num_trace_evals); } -#ifdef CONFIG_TRACE_ENUM_MAP_FILE +#ifdef CONFIG_TRACE_EVAL_MAP_FILE static void trace_module_remove_evals(struct module *mod) { union trace_eval_map_item *map; @@ -7761,7 +7761,7 @@ static void trace_module_remove_evals(struct module *mod) } #else static inline void trace_module_remove_evals(struct module *mod) { } -#endif /* CONFIG_TRACE_ENUM_MAP_FILE */ +#endif /* CONFIG_TRACE_EVAL_MAP_FILE */ static int trace_module_notify(struct notifier_block *self, unsigned long val, void *data)