From patchwork Thu Jun 15 10:52:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 105631 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp740376qgd; Thu, 15 Jun 2017 03:53:03 -0700 (PDT) X-Received: by 10.84.175.132 with SMTP id t4mr5553214plb.18.1497523983665; Thu, 15 Jun 2017 03:53:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497523983; cv=none; d=google.com; s=arc-20160816; b=y7jl4V/CPKwpIoK6kp6KDYovy2DZCOOTLXvAJ5vneJiFOkxhvhRnzlxvi4iXysH9NT y6dhGbeLPQ7IwypAra/N9ArfRhPFTcoWUSCe6ZhpTaJA7Ej9d68TPxlMRnyGOasZRsZc zAaPZSsyqr8LotutOE6GoBTiAdNEgZpgqMKUe99xSoMA/V1iGBlkzPiwKL49TnMlOLDL 6v9feWV7YOZbvacf7zHX80r7L4lcsW/com+EJFawjtUhE+JmjCaciSc8c8O8dJkgdOW6 XJ/ZsHDHelCEWzdmhrT6dsXQCfbnQ2NXspe/o9HMIWTtbW99kpW4f3igGhrJudU2HOAa 4c/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition:mime-version :references:subject:cc:to:from:date:user-agent:message-id :dmarc-filter:arc-authentication-results; bh=GvjxrSTXVdL+pEwhip/Vzb7hgfS1pHpmDls6MMKxZ1Q=; b=AyzkDTTApKC6mQ3+7Z+mlCsf7aIQtiNCzsLCVRX8iYKGOJ+wrRE9Sf4bCTxqKYfzeM HrfdavEW12aIfpOBk0cZTtpo/So+CFk8vYiXqmat+zUwHx2s/wHUrUHrAUnNqDLWzZfI 7oxIZhNYvRFm+iSCXIBtvuhqvhXYZMxpKDUJAQv/4JS5byglBf6GFl4LgZkgXsiDrHJF Zqef0K6FdOhkcxerGqXTumqhAZ710siUMI9dFZzLhLVsjn6DsMTa091/wK3iyXd/rhoB y+w8y3s1JMoPbBCICdLmndtlsCOkMJvFGzpJthgggYPu679YbMjdujM2I36ktO33bHFW 6vfQ== 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 34si2042624plz.544.2017.06.15.03.53.03; Thu, 15 Jun 2017 03:53:03 -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 S1752439AbdFOKxA (ORCPT + 25 others); Thu, 15 Jun 2017 06:53:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:40574 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752272AbdFOKw4 (ORCPT ); Thu, 15 Jun 2017 06:52:56 -0400 Received: from gandalf.local.home (cpe-67-246-153-56.stny.res.rr.com [67.246.153.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E9134239E3; Thu, 15 Jun 2017 10:52:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E9134239E3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=rostedt@goodmis.org Received: from rostedt by gandalf.local.home with local (Exim 4.87) (envelope-from ) id 1dLSOU-0003MJ-7u; Thu, 15 Jun 2017 06:52:54 -0400 Message-Id: <20170615105254.144480148@goodmis.org> User-Agent: quilt/0.63-1 Date: Thu, 15 Jun 2017 06:52:33 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Andrew Morton , Jeremy Linton Subject: [for-next][PATCH 10/12] tracing: define TRACE_DEFINE_SIZEOF() macro to map sizeofs to their values References: <20170615105223.551999981@goodmis.org> MIME-Version: 1.0 Content-Disposition: inline; filename=0010-tracing-define-TRACE_DEFINE_SIZEOF-macro-to-map-size.patch Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jeremy Linton 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. Link: http://lkml.kernel.org/r/20170531215653.3240-10-jeremy.linton@arm.com Signed-off-by: Jeremy Linton Signed-off-by: Steven Rostedt (VMware) --- include/linux/tracepoint.h | 1 + include/trace/trace_events.h | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) -- 2.10.2 diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index f7b0f5525e46..a26ffbe09e71 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 49cce5fb54ee..3976fa1f6e42 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)