From patchwork Wed Jun 14 22:27:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 105595 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp512068qgd; Wed, 14 Jun 2017 15:27:41 -0700 (PDT) X-Received: by 10.84.236.1 with SMTP id q1mr2518282plk.187.1497479261858; Wed, 14 Jun 2017 15:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497479261; cv=none; d=google.com; s=arc-20160816; b=HM9gT5aX1cTaR3PAwElOsiGmlSwfM5iM2e+Ib3p035oVy+j55XD37FUG0jZ47Byg8N /n+iZbSSFQ7q6GvVL1/N8A87i9RwB3c8hFAgExF7enMUo1wigP59n14+xbHMKFSbce2P LQB1kSNEAx+6D9SxQrpu4K6QPtOP3F18vjx5sdNZVp20MmPAIVht2HQ6Mc6SHBMgB7ic xMvORC3XchhmbL4afSEpUPNJ/fXm1uCfN3VViuY3C7h7eEjO10nIrJrcIFDNcXIKCMQT 5JLl04RRQqxzfDym99SWiE/h8RzG7HuT62YWbOveP56JJAuh5ihfqN9gVYiqPNQjmMIM ikGw== 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=zxocKt6poIJbXyl9XIWcXO3n9HQ/U87z9dUMAhHbadE=; b=Smf2c2nm95eM/RL++pw/8ggjrq8uWMQmLUj9J5pR5w5DR9leNq/P2QE7BD/y7fHByF NHGzXZVkB3a01Wwlz9sMEMqBWB3m5dECcf+GBUJzy3F049nicYAmo/gEACl9NJ9I+F9z ZdpvIQZUhSVVD8QO8z3/UwFG0JOTW/8omqoJo8Gsrda/x/Ay2Ov4ZF71q3xUL4GnBUy/ QDPg7wn6HWByoof2qnoGBDiZng9zyj5OWMYt9g91UnTeDb756vB0gLL+NRLwKjSSc2JN ESMS/bkxF4ppzOASL8zpyE3R2HyK0lmHlEAhFCwHOsaM3RVjaWXJo/uA4OmqgF0RVy07 2RiA== 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:41 -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 S1752607AbdFNW1d (ORCPT + 25 others); Wed, 14 Jun 2017 18:27:33 -0400 Received: from foss.arm.com ([217.140.101.70]:39548 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751600AbdFNW1b (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 C165C80D; Wed, 14 Jun 2017 15:27:30 -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 376213F3E1; 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 00/13] trace: add the ability to parse sizeof() Date: Wed, 14 Jun 2017 17:27:16 -0500 Message-Id: <20170614222729.16521-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 There are a few cases of sizeof() embedded in TRACE_EVENT() macros. That is a problem because "sizeof(structure)" is passed to userspace, which doesn't know how to decode the size of kernel data structures. There was a similar problem with enums. Rather than recreating much of the enum infrastructure lets simply extend it, and append additional symbols into the enum_map that can translate string sizeof() calls into values. Of course that means that much of the infrastructure is now poorly named so we go through and replace instances describing "enum" with "eval" to indicate a generic C expression to numerical evaluation routine. v1->v2: Modify the sample trace file to reflect a more reasonable example Add an additional TRACE_DEFINE_SIZEOF() for fjes_hw_request_info Add an additional patch to convert some hardcoded size values to sizeof Jeremy Linton (13): trace: rename kernel enum section to eval trace: rename trace_enum_map to trace_eval_map trace: rename struct module entry for trace enums trace: rename trace enum data structures in trace.c trace: rename trace_enum_mutex to trace_eval_mutex trace: rename trace.c enum functions trace: rename enum_map functions tracing: Rename enum_replace to eval_replace tracing: define TRACE_DEFINE_SIZEOF() macro to map sizeof's to their values tracing: Update sample file to describe the new macro tracing: Add TRACE_DEFINE_SIZEOF() macros tracing: Replace some majic constants with sizeof() tracing: Rename and update the enum_map file arch/arm64/kvm/trace.h | 2 + drivers/net/fjes/fjes_trace.h | 2 + include/asm-generic/vmlinux.lds.h | 6 +- include/linux/module.h | 4 +- include/linux/tracepoint.h | 7 +- include/trace/events/thermal.h | 4 +- include/trace/events/thermal_power_allocator.h | 4 +- include/trace/events/xen.h | 13 +- include/trace/trace_events.h | 26 +++- kernel/module.c | 6 +- kernel/trace/Kconfig | 22 +-- kernel/trace/trace.c | 194 ++++++++++++------------- kernel/trace/trace.h | 4 +- kernel/trace/trace_events.c | 24 +-- samples/trace_events/trace-events-sample.h | 28 ++-- sound/firewire/motu/amdtp-motu-trace.h | 12 +- 16 files changed, 202 insertions(+), 156 deletions(-) -- 2.9.4