Received: by 10.213.65.68 with SMTP id h4csp810637imn; Wed, 28 Mar 2018 13:14:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx48Vje4FxxLOuBNKaXnDTHIBLHT5D2BQhr7jzmE/WOeEKcGiMuLk65Hp7R64Q5Ywllf7tVOW X-Received: by 10.101.76.10 with SMTP id u10mr3555981pgq.445.1522268053015; Wed, 28 Mar 2018 13:14:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522268052; cv=none; d=google.com; s=arc-20160816; b=vrsu2IQY7rqjDzcLWQ0ZarLQaQ2msF7KoSCzzRKTBOg+cFkmf3BUbklsdK95dXSLvP qFz5+u/ZzNwjY1micdZUKaGWAi5r5HZSp01rlDdsc+a6EL2FPjITBVtUEap0Rsp5W+FG leDFw7xGHTlm70pXCFf7zI+14TK55REUg0gBZztqk+SCVvr15xrIFKX0agfMSc+eml7A AiPlXD0XZknJPbRfg/urqmTtDIWv/FkDQbvismIDkgD923jd6Uoghb/3HzmVZeTj1c91 IEwIVjaxOIWKnYzNj18JVAbpmF/V+VteyubvHn7CppkvFNFhCFTsy7a82RAspVE4uwDQ QkLQ== 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=/zVQLa6UF+nZ+2cdaWdPLJSRimCX8NzXcwncNYw6ndc=; b=ghH2r7xnwEX3KsqNf8l/u+2FiC9NqBOb+So+MJyDX7dPtMyX7cWC7LD4dKH/980w8u eG8Cc6b7uhlEZN3fRpOOiCLMUQcu/sjez2XAwwLBZmBZBihGUeUwbBh9j1FJKXdbWas4 Y66r9vvThlfx4JBtXIn7VtzbVMtCE3d/RgWu65Y/1kze3a+/SkvwDfRkhbq+dI89gsdL PiQoIN93k0biAyne+PFVLZyJHxh2U3vCIXPpkl2WnBY9mfTKoVEOS2qQVyPaqM1IASWH 0Wq+k09snTFWGc5cD5kGH7jL7tkX0ejGYWUlFkneBTrjUDeFFH2AiGV4Z6yTdzJKWwiy GT7Q== 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 h3si2551059pgf.314.2018.03.28.13.13.58; Wed, 28 Mar 2018 13:14:12 -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 S1753583AbeC1ULP (ORCPT + 99 others); Wed, 28 Mar 2018 16:11:15 -0400 Received: from mga11.intel.com ([192.55.52.93]:61122 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753533AbeC1ULM (ORCPT ); Wed, 28 Mar 2018 16:11:12 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Mar 2018 13:11:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,373,1517904000"; d="scan'208";a="43008348" Received: from tzanussi-mobl.amr.corp.intel.com (HELO localhost) ([10.252.193.206]) by orsmga001.jf.intel.com with ESMTP; 28 Mar 2018 13:11:09 -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/4] tracing: Add action comparisons when testing matching hist triggers Date: Wed, 28 Mar 2018 15:10:55 -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 Actions also need to be considered when checking for matching triggers - triggers differing only by action should be allowed, but currently aren't because the matching check ignores the action and erroneously returns -EEXIST. Add and call an actions_match() function to address that. Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index 468e43f..ae84470 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -4363,6 +4363,53 @@ static void print_onmatch_spec(struct seq_file *m, seq_puts(m, ")"); } +static bool actions_match(struct hist_trigger_data *hist_data, + struct hist_trigger_data *hist_data_test) +{ + unsigned int i, j; + + if (hist_data->n_actions != hist_data_test->n_actions) + return false; + + for (i = 0; i < hist_data->n_actions; i++) { + struct action_data *data = hist_data->actions[i]; + struct action_data *data_test = hist_data_test->actions[i]; + + if (data->fn != data_test->fn) + return false; + + if (data->n_params != data_test->n_params) + return false; + + for (j = 0; j < data->n_params; j++) { + if (strcmp(data->params[j], data_test->params[j]) != 0) + return false; + } + + if (data->fn == action_trace) { + if (strcmp(data->onmatch.synth_event_name, + data_test->onmatch.synth_event_name) != 0) + return false; + if (strcmp(data->onmatch.match_event_system, + data_test->onmatch.match_event_system) != 0) + return false; + if (strcmp(data->onmatch.match_event, + data_test->onmatch.match_event) != 0) + return false; + } else if (data->fn == onmax_save) { + if (strcmp(data->onmax.var_str, + data_test->onmax.var_str) != 0) + return false; + if (strcmp(data->onmax.fn_name, + data_test->onmax.fn_name) != 0) + return false; + } + } + + return true; +} + + static void print_actions_spec(struct seq_file *m, struct hist_trigger_data *hist_data) { @@ -5173,6 +5220,9 @@ static bool hist_trigger_match(struct event_trigger_data *data, (strcmp(data->filter_str, data_test->filter_str) != 0)) return false; + if (!actions_match(hist_data, hist_data_test)) + return false; + return true; } -- 1.9.3