Received: by 10.192.165.148 with SMTP id m20csp149048imm; Thu, 26 Apr 2018 18:07:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqbWUuBIrGHc26/FKs+oVDxNBHUJ943GN8mns514sTmROafRVtULbs7m7aztOLY0JeD2svy X-Received: by 2002:a63:b60d:: with SMTP id j13-v6mr240714pgf.451.1524791268567; Thu, 26 Apr 2018 18:07:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524791268; cv=none; d=google.com; s=arc-20160816; b=j/z4Fa/wMqi1KA5ckR/OP557Y8g2G0U2OveU+kmgv/iBeDwDhJkCr+v3Wq3zVX9ua1 nEbjZoPXpJXvwfKdRGr+2zan/E5SayYgqwcX2H8YXaSzqMzYYwzoHwUgIPIJtDuJkpas 1U2SQ8u7qMOj6pkDQ/nEnSFvhO2BC9Gz2KcZ8HhdsY8bEZXfhFRwQWcWt7pNHVLftB1m eqHS3pRI418PrGXYvUcmzrYq/hS4g18XeYQHLqKrFFdkjV4Z7IvThiXvAJXyvKN5D7+p zSW1XKSYr3n/ayn6KOJqGg1KsljI58CQMQc+VJ7PaDjK5Cnc7vxZ/TsuIg7GJJL6qxQ3 sp+Q== 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=WbyAaAkjjJimDICA78Pvx0lLHIF8tf7iC/4lGpQTFiQ=; b=UBbIFogtQtuTp62YWiRiJWIDugBTXWR5VUc8UIknF3Yh1BZ1tfQTMCTrLPczyQFxmp 0Z0UGY91lAcCYtbCM+I2MWU8iHYKGtB7ulhaDytFevUVKTQPN6XmPTtDjI7TShoOQU8u deawadfhA79uyBJtDzg0YFywchMtQ+ZDcEqbQCb2Y2MS4UtFLSxyMj3SGJOSfitTc1CM qslQGvnYQlxLVp73baQMtaBuEsgKfwfUFzbopu3A1GRvezH9ll0kXZdUzYlYLBTjyk8k wEwCSzytr9eaTMFVVF1yhVLC0LUmL5O0fR5YcA84NiSkFgjW6yvwuBw7FQ6w0cCFOB1x Mdhw== 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 p23-v6si136241pgv.153.2018.04.26.18.07.34; Thu, 26 Apr 2018 18:07: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; 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 S1757226AbeD0BFS (ORCPT + 99 others); Thu, 26 Apr 2018 21:05:18 -0400 Received: from mga07.intel.com ([134.134.136.100]:37459 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757164AbeD0BFR (ORCPT ); Thu, 26 Apr 2018 21:05:17 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Apr 2018 18:05:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,333,1520924400"; d="scan'208";a="223760098" Received: from rpastern-mobl3.ger.corp.intel.com (HELO localhost) ([10.255.87.27]) by fmsmga006.fm.intel.com with ESMTP; 26 Apr 2018 18:05:11 -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 2/3] tracing: Add field parsing hist error for hist triggers Date: Thu, 26 Apr 2018 20:04:48 -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 a nonexistent field 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 nonexistent fields are specified. Before: # echo 'hist:keys=pid:ts0=common_timestamp.usecs' >> /sys/kernel/debug/tracing/events/sched/sched_switch/trigger -su: echo: write error: Invalid argument # cat /sys/kernel/debug/tracing/events/sched/sched_switch/hist After: # echo 'hist:keys=pid:ts0=common_timestamp.usecs' >> /sys/kernel/debug/tracing/events/sched/sched_switch/trigger -su: echo: write error: Invalid argument # cat /sys/kernel/debug/tracing/events/sched/sched_switch/hist ERROR: Couldn't find field: pid Last command: keys=pid:ts0=common_timestamp.usecs Signed-off-by: Tom Zanussi Reported-by: Masami Hiramatsu --- 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 66c87be..f231fa2 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -2481,6 +2481,7 @@ static struct hist_field *parse_var_ref(struct hist_trigger_data *hist_data, else { field = trace_find_event_field(file->event_call, field_name); if (!field || !field->size) { + hist_err("Couldn't find field: ", field_name); field = ERR_PTR(-EINVAL); goto out; } -- 1.9.3