From patchwork Fri Jun 16 17:07:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 105757 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp1404691qgd; Fri, 16 Jun 2017 10:08:08 -0700 (PDT) X-Received: by 10.84.151.99 with SMTP id i90mr14013434pli.81.1497632887898; Fri, 16 Jun 2017 10:08:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497632887; cv=none; d=google.com; s=arc-20160816; b=IUdeYSbkytGEccrNfqRLZaDPOEVtYRwHN1rK7A2zTYGGRm4CU5XMbC1E18R6pU43zy WasgzSlSXw5ViNcvQfqlEHs3pM5ILxfSf25RfFLrDOGhrJBbHIJwtVRB9PIWSSD9YkOz PELxfIyMUlCTO84o+wyoUPLxnt2O9DfZ6oO+KdWVWH+khjU2Wb9yAcfaVhuNuE7gWjmd HEhNDHdHgflCuXJmX8JApswmflFRL9JHkvvqRsrTXXTy5WyWmptqwNJlrn/KkDen1aLN DJ7lGcvL1+KXJaYl9D01/iexO99nlWi7+aYBKI11kiDef/Xt1MvMjN/2AFCT+eyO9cg6 zmYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Lz/E2yNEJxrdvKdZKUr/hvY2ynhnYDkGv2kQMASSepI=; b=N0xGr/F2VT1V40igc6gkwCO5JVH+GxPzb/Qf+W+2Fe+WoMeeQoaLNHa8CsuVl8hu1L G/fxkPuJWMLmRjuiJgVBoMV2zVfTT06aMXIsVttvdMOoo+1NS6cZxsBtQ2RgWEpHp9U2 a/6JKSt2ybdD8AthcyZvILOo5DkqpHELQGQJfW/4cgw5d7KIDf9Y6LKk8SPemiWEAgjM 7Zd43aa36kSr6CZVkwmPZdA9MxakY+D2DzdrxQdaDaDw1EiOwURfFS/9DmupLoj+SNVI vaTqs/K0yUstpG7jckUchf/uS8Uu7NrSr3YmNOqSBa9aOP9VSP45EKxwwTXsjIidvnes 06KQ== 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 g16si2397448pli.354.2017.06.16.10.08.07; Fri, 16 Jun 2017 10:08:07 -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 S1752371AbdFPRHj (ORCPT + 25 others); Fri, 16 Jun 2017 13:07:39 -0400 Received: from foss.arm.com ([217.140.101.70]:59764 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750827AbdFPRHh (ORCPT ); Fri, 16 Jun 2017 13:07: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 C39AB1596; Fri, 16 Jun 2017 10:07: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 899093F5C1; Fri, 16 Jun 2017 10:07:36 -0700 (PDT) From: Jeremy Linton To: rostedt@goodmis.org Cc: linux-kernel@vger.kernel.org, trivial@kernel.org Subject: [PATCH v2 1/2] tracing: trivial: Fix spelling mistakes in trace sample Date: Fri, 16 Jun 2017 12:07:35 -0500 Message-Id: <20170616170736.25198-1-jeremy.linton@arm.com> X-Mailer: git-send-email 2.9.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The trace sample file has a couple mispellings, lets fix them. Signed-off-by: Jeremy Linton --- samples/trace_events/trace-events-sample.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.9.4 diff --git a/samples/trace_events/trace-events-sample.h b/samples/trace_events/trace-events-sample.h index 76a75ab..b385814 100644 --- a/samples/trace_events/trace-events-sample.h +++ b/samples/trace_events/trace-events-sample.h @@ -95,7 +95,7 @@ * __entry->bar.x = y; * __array: There are three fields (type, name, size). The type is the - * type of elements in teh array, the name is the name of the array. + * type of elements in the array, the name is the name of the array. * size is the number of items in the array (not the total size). * * __array( char, foo, 10) is the same as saying: char foo[10]; @@ -112,7 +112,7 @@ * type is the type of the element, name is the name of the array. * The size is different than __array. It is not a static number, * but the algorithm to figure out the length of the array for the - * specific instance of tracepoint. Again, size is the numebr of + * specific instance of tracepoint. Again, size is the number of * items in the array, not the total length in bytes. * * __dynamic_array( int, foo, bar) is similar to: int foo[bar]; @@ -125,9 +125,9 @@ * Notice, that "__entry" is not needed here. * * __string: This is a special kind of __dynamic_array. It expects to - * have a nul terminated character array passed to it (it allows + * have a null terminated character array passed to it (it allows * for NULL too, which would be converted into "(null)"). __string - * takes two paramenter (name, src), where name is the name of + * takes two parameter (name, src), where name is the name of * the string saved, and src is the string to copy into the * ring buffer. * @@ -444,7 +444,7 @@ DECLARE_EVENT_CLASS(foo_template, /* * Here's a better way for the previous samples (except, the first - * exmaple had more fields and could not be used here). + * example had more fields and could not be used here). */ DEFINE_EVENT(foo_template, foo_with_template_simple, TP_PROTO(const char *foo, int bar), From patchwork Fri Jun 16 17:07:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 105756 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp1404496qgd; Fri, 16 Jun 2017 10:07:43 -0700 (PDT) X-Received: by 10.98.178.215 with SMTP id z84mr12135887pfl.71.1497632862988; Fri, 16 Jun 2017 10:07:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497632862; cv=none; d=google.com; s=arc-20160816; b=h8oCT+x5R0YDqSXkJaLxjDKizXoZXrWdY2xXp2oXlVlK8SyRrWzRrTeUHAsQV85E1H 8Vem43qWmm+QZjqjAzc23Mnpgw88NJbVSXCnUH+VXMmdOIPr+DBt8BYkHD4qak2FCMMn bFrNqLI2l3rfjkiIyBJuqrONWBkcwlj9B2Oy22RYl86AX3/IjEZ9A98Bsq7Q4oT/+KvV WsL20jdABdz8SBjYd/YV/SiazdWiin8UECPFvPUjSv8h9XJRsms0dQ5CIwFV8W81bmSj DyGdPbUswYn2+aSPDF8/hVRrScl2iM/15I6dfm417wXJFXFzPGfI87mawh76th32MYjW yVDA== 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=tsGhzmSbmBnFYs0rvbKA08z0OKoA/Kco5oooSrgi6KE=; b=SYgf16uMuRnCSm29NtjpBZJO2K7m5BfYbzPUurYEYpnCwZIM76s/NfkBzX0UcWvvZq GKtVYuXXEghHvPH0mo3t2XVW7hrboEcZoovq/c7u0gEKsxecoaGw0efdFhIdVux3C575 135GQTNd0xitG/Bek5afP5/QtQSAM+xq4AL3emPdjg23qQk5gidpE37NnxI65/LTU63C SCcVrqEWYLqDApTJQg5QrUW7wBk1r3gxBWPrMeRPzvQaDEJRignImAwE63fwsZh94duZ bQejuvlHbLBG9iFD0QAx2Evfu9/mKMeVn33pJmMR49mj+juxmMlFP4mqonZXsVW8yR7V Xk+Q== 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 j23si2377424pfj.308.2017.06.16.10.07.42; Fri, 16 Jun 2017 10:07: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 S1752420AbdFPRHk (ORCPT + 25 others); Fri, 16 Jun 2017 13:07:40 -0400 Received: from foss.arm.com ([217.140.101.70]:59768 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750864AbdFPRHh (ORCPT ); Fri, 16 Jun 2017 13:07: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 0D41915AD; Fri, 16 Jun 2017 10:07: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 C96633F41F; Fri, 16 Jun 2017 10:07:36 -0700 (PDT) From: Jeremy Linton To: rostedt@goodmis.org Cc: linux-kernel@vger.kernel.org, trivial@kernel.org Subject: [PATCH v2 2/2] tracing: Document the use of TRACE_DEFINE_SIZEOF Date: Fri, 16 Jun 2017 12:07:36 -0500 Message-Id: <20170616170736.25198-2-jeremy.linton@arm.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170616170736.25198-1-jeremy.linton@arm.com> References: <20170616170736.25198-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 now corrects the use of sizeof() in the trace format files. Lets document how to make use of that feature. 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 b385814..0b45272 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 user space. + */ + +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)) );