Received: by 10.223.164.202 with SMTP id h10csp687000wrb; Thu, 9 Nov 2017 12:42:45 -0800 (PST) X-Google-Smtp-Source: ABhQp+T459BWT9Vg3h2xYlntOsKA0LPVVnccgZGYmnMXkmyzwULu1WbeyHlw3XErkqbYWisw1EqK X-Received: by 10.99.150.2 with SMTP id c2mr1648870pge.386.1510260165600; Thu, 09 Nov 2017 12:42:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510260165; cv=none; d=google.com; s=arc-20160816; b=QIuRR+ER4v0Dz3AYHQLdwfITdDwdurFscp/LKvWz0lL0wUMmwGr9/R8VSlVIQeFTIs Qv0q3YSvP8dMRmQhc+CFxcHXTQw9LouX6J2tfQa3uaORiDhaVidZDjgfHlGM/Gyftia0 OHwFEkV0FaIlTk+255G30Ljm2NiNXn7LixIj9bN/mj0n66W4665DJzMwzJb/xCKIpW3x DJn8xADAXu7Y1+Q25kRnwpNkNS23KPMVCMTYJlQ97DZfCPJHaVWkvb4mTTaI7Zz47wPD Wg1PdGQXpRMzwbEpmUfjcpgNAY/DXJpDID3S/Qhl9LpqLulkthSjncgEvhdyuFwxep1s r9LQ== 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:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=dN1j4rX1tu0pJNfxzoWcF+i7bdnOw9+2qbzD7lh87vU=; b=EUCmbqoI9wKlkvU4Y1y5hh9i/RUlOg7Uj6QSYSJHp++dmI16rsxfhj/+qMHfQb3SKr MSGM6E2KMN0jLcU8c5cK7B+1LopxVmRKy2VruL3W5tckhl/sByRQ7jYwSXd21m/A4oPM K05/pz5tTyssOfgF3eK7ZCN4DL0ku4dpHf2ryp8GcGdK0UzeYsCLexrSRE6UnV+/wYxy YRi60IG19TFgt42rjRIwBb+p+6xyBr9ENa7ZHmWWQVE4EJPZsQU46KxGTzjmeDBSMHzr bBk+rM2g0UsD0M8J2m10eEw46tFLrn9mS6u+iGPFdqSvhHqKWNswdKnExST35UZ9uj7V 6n7A== 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 137si4457762pge.666.2017.11.09.12.42.11; Thu, 09 Nov 2017 12:42:45 -0800 (PST) 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 S1755350AbdKIUjr (ORCPT + 83 others); Thu, 9 Nov 2017 15:39:47 -0500 Received: from mga01.intel.com ([192.55.52.88]:4840 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754944AbdKIUfU (ORCPT ); Thu, 9 Nov 2017 15:35:20 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Nov 2017 12:35:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,370,1505804400"; d="scan'208";a="883001" Received: from dkusalov-mobl4.amr.corp.intel.com (HELO localhost) ([10.254.117.34]) by fmsmga001.fm.intel.com with ESMTP; 09 Nov 2017 12:35:18 -0800 From: Tom Zanussi To: rostedt@goodmis.org Cc: tglx@linutronix.de, mhiramat@kernel.org, namhyung@kernel.org, vedang.patel@intel.com, bigeasy@linutronix.de, joel.opensrc@gmail.com, joelaf@google.com, mathieu.desnoyers@efficios.com, baohong.liu@intel.com, rajvi.jingar@intel.com, julia@ni.com, linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org, Tom Zanussi Subject: [PATCH v5 21/37] tracing: Add hist_field 'type' field Date: Thu, 9 Nov 2017 14:33:52 -0600 Message-Id: X-Mailer: git-send-email 1.9.3 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Future support for synthetic events requires hist_field 'type' information, so add a field for that. Also, make other hist_field attribute usage consistent (size, is_signed, etc). Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index 8c6e062..14fd84f 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -54,6 +54,7 @@ struct hist_field { unsigned int size; unsigned int offset; unsigned int is_signed; + const char *type; struct hist_field *operands[HIST_FIELD_OPERANDS_MAX]; struct hist_trigger_data *hist_data; struct hist_var var; @@ -670,6 +671,7 @@ static void destroy_hist_field(struct hist_field *hist_field, kfree(hist_field->var.name); kfree(hist_field->name); + kfree(hist_field->type); kfree(hist_field); } @@ -695,6 +697,10 @@ static struct hist_field *create_hist_field(struct hist_trigger_data *hist_data, if (flags & HIST_FIELD_FL_HITCOUNT) { hist_field->fn = hist_field_counter; + hist_field->size = sizeof(u64); + hist_field->type = kstrdup("u64", GFP_KERNEL); + if (!hist_field->type) + goto free; goto out; } @@ -708,12 +714,18 @@ static struct hist_field *create_hist_field(struct hist_trigger_data *hist_data, hist_field->fn = hist_field_log2; hist_field->operands[0] = create_hist_field(hist_data, field, fl, NULL); hist_field->size = hist_field->operands[0]->size; + hist_field->type = kstrdup(hist_field->operands[0]->type, GFP_KERNEL); + if (!hist_field->type) + goto free; goto out; } if (flags & HIST_FIELD_FL_TIMESTAMP) { hist_field->fn = hist_field_timestamp; hist_field->size = sizeof(u64); + hist_field->type = kstrdup("u64", GFP_KERNEL); + if (!hist_field->type) + goto free; goto out; } @@ -723,6 +735,11 @@ static struct hist_field *create_hist_field(struct hist_trigger_data *hist_data, if (is_string_field(field)) { flags |= HIST_FIELD_FL_STRING; + hist_field->size = MAX_FILTER_STR_VAL; + hist_field->type = kstrdup(field->type, GFP_KERNEL); + if (!hist_field->type) + goto free; + if (field->filter_type == FILTER_STATIC_STRING) hist_field->fn = hist_field_string; else if (field->filter_type == FILTER_DYN_STRING) @@ -730,6 +747,12 @@ static struct hist_field *create_hist_field(struct hist_trigger_data *hist_data, else hist_field->fn = hist_field_pstring; } else { + hist_field->size = field->size; + hist_field->is_signed = field->is_signed; + hist_field->type = kstrdup(field->type, GFP_KERNEL); + if (!hist_field->type) + goto free; + hist_field->fn = select_value_fn(field->size, field->is_signed); if (!hist_field->fn) { @@ -939,6 +962,11 @@ static struct hist_field *parse_unary(struct hist_trigger_data *hist_data, expr->operands[0] = operand1; expr->operator = FIELD_OP_UNARY_MINUS; expr->name = expr_str(expr, 0); + expr->type = kstrdup(operand1->type, GFP_KERNEL); + if (!expr->type) { + ret = -ENOMEM; + goto free; + } return expr; free: @@ -1028,6 +1056,11 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data, expr->operands[1] = operand2; expr->operator = field_op; expr->name = expr_str(expr, 0); + expr->type = kstrdup(operand1->type, GFP_KERNEL); + if (!expr->type) { + ret = -ENOMEM; + goto free; + } switch (field_op) { case FIELD_OP_MINUS: -- 1.9.3 From 1583605784302738297@xxx Thu Nov 09 16:16:03 +0000 2017 X-GM-THRID: 1583605784302738297 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread