Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754572AbcCBTwD (ORCPT ); Wed, 2 Mar 2016 14:52:03 -0500 Received: from mga02.intel.com ([134.134.136.20]:32965 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752781AbcCBTwB (ORCPT ); Wed, 2 Mar 2016 14:52:01 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,530,1449561600"; d="scan'208";a="899673206" Message-ID: <1456948317.8577.48.camel@tzanussi-mobl.amr.corp.intel.com> Subject: Re: [PATCH v15 10/23] tracing: Add hist trigger 'execname' modifier From: Tom Zanussi To: Steven Rostedt Cc: masami.hiramatsu.pt@hitachi.com, namhyung@kernel.org, josh@joshtriplett.org, andi@firstfloor.org, mathieu.desnoyers@efficios.com, peterz@infradead.org, linux-kernel@vger.kernel.org Date: Wed, 02 Mar 2016 13:51:57 -0600 In-Reply-To: <20160302123931.37f28d4a@gandalf.local.home> References: <733e60a8acc79f777502cbe6c98d5abd2c33a17e.1456501855.git.tom.zanussi@linux.intel.com> <20160302123931.37f28d4a@gandalf.local.home> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4 (3.10.4-4.fc20) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1804 Lines: 66 Hi Steve, On Wed, 2016-03-02 at 12:39 -0500, Steven Rostedt wrote: > On Fri, 26 Feb 2016 10:01:13 -0600 > Tom Zanussi wrote: > > > > +static void hist_trigger_elt_copy(struct tracing_map_elt *to, > > + struct tracing_map_elt *from) > > +{ > > + char *comm_from = from->private_data; > > + char *comm_to = to->private_data; > > + > > + if (comm_from) > > + memcpy(comm_to, comm_from, TASK_COMM_LEN + 1); > > +} > > + > > +static void hist_trigger_elt_init(struct tracing_map_elt *elt) > > +{ > > + char *comm = elt->private_data; > > + > > + if (comm) > > + save_comm(comm, current); > > +} > > + > > +static const struct tracing_map_ops hist_trigger_ops = { > > + .elt_alloc = hist_trigger_elt_alloc, > > + .elt_copy = hist_trigger_elt_copy, > > + .elt_free = hist_trigger_elt_free, > > + .elt_init = hist_trigger_elt_init, > > These are only used for saving or displaying comm. Wouldn't adding that > in the name be better. Otherwise it looks like they are more generic. I > find that dangerous, especially since they just assume that the > private_data is a string. > > What about hist_trigger_elt_comm_* > > ? Yeah, I think that makes it clearer - I'll rename those to be more explicit. Thanks, Tom > > -- Steve > > > +}; > > + > > static void destroy_hist_field(struct hist_field *hist_field) > > { > > kfree(hist_field); > > @@ -399,6 +467,9 @@ static int create_key_field(struct hist_trigger_data *hist_data, > > flags |= HIST_FIELD_FL_SYM; > > else if (strcmp(field_str, "sym-offset") == 0) > > flags |= HIST_FIELD_FL_SYM_OFFSET; > > + else if ((strcmp(field_str, "execname") == 0) && > > + (strcmp(field_name, "common_pid") == 0)) > > + flags |= HIST_FIELD_FL_EXECNAME; > > else { > > ret = -EINVAL; > > goto out;