Received: by 10.192.165.148 with SMTP id m20csp148887imm; Thu, 26 Apr 2018 18:07:34 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpHFzi9ZIOXFCvtXnXsjQluzNH0ZTp0apdW1+xTRi36rJwha6+Fu+C5qdLQcCcYBqejcB7x X-Received: by 2002:a65:5608:: with SMTP id l8-v6mr266882pgs.182.1524791254189; Thu, 26 Apr 2018 18:07:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524791254; cv=none; d=google.com; s=arc-20160816; b=cLQ8iptNrGeqWk6L+Xpek+c0KCvsoUrAdtb+Q2MXpO3DZdJqHYsuTasS8jmBrVPoS1 Z7lMyCoBJP0xGKu8N+FjoXPDMYsu1KRQ/ojz2xyDNfB8hPtZseVN+qvm6f+jFyBq2LQw uCW3AqQC/mNiJCIBFG1dB/NIZBM0Vwg6hy7NvJOModxyhQjYknPTIWMoCT2dOfHyPukv anceigkx3bGq11N02/0dmZKKR0YSF4X8MEUQ/N0CTqxi1Q2NkocHW/ADHNttX7617Fk8 EViriLpl0jxYkmREio3VM6TiA1qIz7NU3UTC3dn41SHTd9DcweAGFpsPZ2BqfWts3B3l bNRA== 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=H0awojUzg1KADueekW6ViZtt8StY12XYQo01kuyp20A=; b=PJ3pg3ZXXpkmiZ9XLqPHz/BbXhiGQO0hzgXC/WJkl9KChi6ABa09LqMDy4v1NPVrOP h8/UGR6djKs0/nurl/UyqLvHx5sTxCDgNPiSzyYyQhUHLeWuC6UzvB2m2mIxdVDSeiHV XVwUkrO6BUCqxS993vh8W/k1KGY/NQbK1zDKYOhbWPvsdfgWakkmARl4ibCpp8iKjabu Gr9LWbV8B+LbiW6DwwRbkkhO2LebJWOJqsMcxA4srQYgTX/gnkcAZZlA2sBYb1wOSLxe RrcwGPTzB7d6Sz1RmXWuk5dkezRNTPTAYFExds28LHtZCaOIgzrxr+lc3CQWpFNHuoCH U4Ug== 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 d1-v6si130284plr.410.2018.04.26.18.07.19; Thu, 26 Apr 2018 18:07:34 -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 S1757249AbeD0BFc (ORCPT + 99 others); Thu, 26 Apr 2018 21:05:32 -0400 Received: from mga01.intel.com ([192.55.52.88]:41699 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755801AbeD0BFa (ORCPT ); Thu, 26 Apr 2018 21:05:30 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Apr 2018 18:05:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,333,1520924400"; d="scan'208";a="40939562" Received: from rpastern-mobl3.ger.corp.intel.com (HELO localhost) ([10.255.87.27]) by fmsmga002.fm.intel.com with ESMTP; 26 Apr 2018 18:05:25 -0700 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, fengguang.wu@intel.com, linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org, Tom Zanussi Subject: [PATCH 3/3] tracing: Add field modifier parsing hist error for hist triggers Date: Thu, 26 Apr 2018 20:04:49 -0500 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 If the user specifies an invalid field modifier for a hist trigger, the current code correctly flags that as an error, but doesn't tell the user what happened. Fix this by invoking hist_err() with an appropriate message when invalid modifiers are specified. Before: # echo 'hist:keys=pid:ts0=common_timestamp.junkusecs' >> /sys/kernel/debug/tracing/events/sched/sched_wakeup/trigger -su: echo: write error: Invalid argument # cat /sys/kernel/debug/tracing/events/sched/sched_wakeup/hist After: # echo 'hist:keys=pid:ts0=common_timestamp.junkusecs' >> /sys/kernel/debug/tracing/events/sched/sched_wakeup/trigger -su: echo: write error: Invalid argument # cat /sys/kernel/debug/tracing/events/sched/sched_wakeup/hist ERROR: Invalid field modifier: junkusecs Last command: keys=pid:ts0=common_timestamp.junkusecs Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index f231fa2..b9061ed 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -2466,6 +2466,7 @@ static struct hist_field *parse_var_ref(struct hist_trigger_data *hist_data, else if (strcmp(modifier, "usecs") == 0) *flags |= HIST_FIELD_FL_TIMESTAMP_USECS; else { + hist_err("Invalid field modifier: ", modifier); field = ERR_PTR(-EINVAL); goto out; } -- 1.9.3