From patchwork Wed Aug 31 06:05:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 75037 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp159070qga; Tue, 30 Aug 2016 23:05:49 -0700 (PDT) X-Received: by 10.66.17.164 with SMTP id p4mr10829657pad.136.1472623548961; Tue, 30 Aug 2016 23:05:48 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u87si49121643pfa.1.2016.08.30.23.05.48; Tue, 30 Aug 2016 23:05:48 -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; dkim=pass header.i=@linaro.org; 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; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753144AbcHaGFo (ORCPT + 27 others); Wed, 31 Aug 2016 02:05:44 -0400 Received: from mail-ua0-f176.google.com ([209.85.217.176]:33595 "EHLO mail-ua0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751136AbcHaGFm (ORCPT ); Wed, 31 Aug 2016 02:05:42 -0400 Received: by mail-ua0-f176.google.com with SMTP id l94so71414149ual.0 for ; Tue, 30 Aug 2016 23:05:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=E8JAr3L/TF/9bFS7sH/x7eCMj2GgEQGrbeYSvUW4wxo=; b=hjzwzd6dycTaaBaWUn0pXlvEyeDsSEZwBCH3fBIWoRGf/0ZEJyjbeQwzztQTgODvr4 wz6DgI7FY447QYU+3V8huszGsujpes+sq0fu6SbMr5ThtGHZVqLyD38Q7cZCThNn/nnh blNYUJlKBWJkwTFtID2JDj2GUXTNnj6LdmcF4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=E8JAr3L/TF/9bFS7sH/x7eCMj2GgEQGrbeYSvUW4wxo=; b=XHfyjeEoYSfw7pH00GZX3O6qgx4l+RbAhioINptXUawE2ZO8YQNUM3bSnis7dalgFP LktXVcHeDTSSAXlTkXaoN8XiQpOVVm2g0piSKkFcLYPilojv3GLQ/ARGrMSvMEDWfwok NrQ05ItCS/2pHoO3Z2rD9b3mbvQWTry6deR5uWnA05PcX29lYfm1lhjFk4/6XHOmR2LN jFwaiYnWiU9RjMVg7rhgGjalkJcpzsYc3E+xEQUShKCKjJdJsiVupURdBQbJ512dQv0I RXRy4NAcv4N8CNuru2o2GCdfzmR86CJ7ajoRaeCX/cHCUGp1DXNKDSfbZLiQYljxlhj/ DTHw== X-Gm-Message-State: AE9vXwOU+LWQqfB3zW7ByVgpP9wGXD+5v1CWPtQxgig+YFwZcUQ7Et2IfgGCMThNwAZizsS61GdLOl7NPGS+EmaD X-Received: by 10.31.153.17 with SMTP id b17mr4472152vke.142.1472623541048; Tue, 30 Aug 2016 23:05:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.115.134 with HTTP; Tue, 30 Aug 2016 23:05:40 -0700 (PDT) In-Reply-To: References: <1472453728-577-1-git-send-email-binoy.jayan@linaro.org> <1472453728-577-3-git-send-email-binoy.jayan@linaro.org> <20160830095238.57d4e781@gandalf.local.home> <866e5451-6367-f0c5-b2c6-1ce5e5737fe1@bmw-carit.de> <498d04b6-a0ac-1442-9c65-154f5c4923be@bmw-carit.de> From: Binoy Jayan Date: Wed, 31 Aug 2016 11:35:40 +0530 Message-ID: Subject: Re: [PATCH v3 2/3] tracing: Add trace_irqsoff tracepoints To: Daniel Wagner Cc: Steven Rostedt , Ingo Molnar , Arnd Bergmann , linaro-kernel@lists.linaro.org, Carsten Emde , Linux kernel mailing list , Masami Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Daniel/Steven, On 30 August 2016 at 20:32, Daniel Wagner wrote: > On 08/30/2016 04:20 PM, Daniel Wagner wrote: >> Just setting the size of the type is not enough. The hist_field_* >> getter function want to know the offset too: > > With this hack here it should work. The COMM generic field is handled via > the tracing_map_ops. We could do it also there but than we need to > a condition in the trace_map_ops if it is COMM or CPU. > This shortcut here avoids it: > diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c > index f3a960e..77073b7 100644 > --- a/kernel/trace/trace_events_hist.c > +++ b/kernel/trace/trace_events_hist.c > @@ -556,6 +567,11 @@ static int create_key_field(struct hist_trigger_data *hist_data, > key_size = MAX_FILTER_STR_VAL; > else > key_size = field->size; > + > + // strcmp(field_name, "cpu") would also work to figure > + // out if this is a one of the generic fields. > + if (field->filter_type == FILTER_CPU) > + flags |= HIST_FIELD_FL_CPU; > } > > hist_data->fields[key_idx] = create_hist_field(field, flags); I applied Daniel's fix and it seems to work. Can we use the following instead on top of your patch? Like how the other keys are compared against respective fields? flags |= HIST_FIELD_FL_HEX; @@ -568,11 +574,6 @@ static int create_key_field(struct hist_trigger_data *hist_data, else key_size = field->size; - // strcmp(field_name, "cpu") would also work to figure - // out if this is a one of the generic fields. - if (field->filter_type == FILTER_CPU) - flags |= HIST_FIELD_FL_CPU; - } hist_data->fields[key_idx] = create_hist_field(field, flags); - Binoy diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index 46203b7..963a121 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -537,6 +537,12 @@ static int create_key_field(struct hist_trigger_data *hist_data, } else { char *field_name = strsep(&field_str, "."); + /* Cannot keep these 2 lines in side the if() below + * as field_str would be NULL for the key 'cpu' + */ + if (strcmp(field_name, "cpu") == 0) + flags |= HIST_FIELD_FL_CPU; + if (field_str) { if (strcmp(field_str, "hex") == 0)