Received: by 10.213.65.68 with SMTP id h4csp1488520imn; Wed, 4 Apr 2018 21:14:54 -0700 (PDT) X-Google-Smtp-Source: AIpwx49ahoVDNHHTZI5FuHJlVECf6qGU867FyBs5AXcISHameqJiloTgqGcAgs2Al+Jhcxy4870W X-Received: by 2002:a17:902:8490:: with SMTP id c16-v6mr21598003plo.132.1522901693987; Wed, 04 Apr 2018 21:14:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522901693; cv=none; d=google.com; s=arc-20160816; b=B5GMOv41uHCI+ymDUrvkHXgZE22iZ1s4aEYmOtM5ekOXxmcTqSeLI7cr7vi9QG7nBJ 81itqgRg65RryKj6bq0tPxC5MzrdWtnBqculHQ1oy7DnlHaQDz+tVx4ly8rNrb5UZZFC FqTMGVi7T68KBRE+F/kDv1vV2YWCd8PdrhgIrYhATcAZVqFMqlmnwJJoixfv2zroH1wR r+BHHaIGVADyumTFO1LF9ILXHY/jmM8ryFtIwVxYFWLAdSDFehj4od7AgghWSTpA9NzV sUD9/GregllMmONkNYC1IYwmzV3j7Wpy1WAUGKzOCXDDOf7NLzw5o2bmYizdtYnu+DqN +R/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dmarc-filter:arc-authentication-results; bh=KwnJxcrupeBtW3lKGCNPPQjso1TFAmeyM3HDCrmEtUE=; b=CJ/twqTcp0fBdFygQyGJick00qZp2wT9M5Vk94hxnT5XPk5s3Xw72qGHZaMoRsUojn /gc8xDbNixOmFP2Zu5vzXZTCU3DYubtFkTHVElrlpb2YItTUtGVONfT9xfvVX1PBsZ7w zwrugEGdvWBRWef+ac3IUrWyxeIBhq4+1aHEyInj+36pfgqJqrbxQCADjP3Y8Cvjf21v eWg8S8qWfF9ZxtwWvfTKs7oy6w3upgS8P1u+ybLrjzwhH5oP4LBevoxsGzoutN4G3A4e i07UE6t2U3Cn1Grlse0HnNqh10+Aq54AS0VJrEHNz727Uh8N5OwYHvB6vHIdf/ps0XYU hxmw== 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 p3si4855349pgr.782.2018.04.04.21.14.38; Wed, 04 Apr 2018 21:14:53 -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 S1752128AbeDEDuX (ORCPT + 99 others); Wed, 4 Apr 2018 23:50:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:55742 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751097AbeDEDuV (ORCPT ); Wed, 4 Apr 2018 23:50:21 -0400 Received: from devbox (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5194C20838; Thu, 5 Apr 2018 03:50:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5194C20838 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=mhiramat@kernel.org Date: Thu, 5 Apr 2018 12:50:16 +0900 From: Masami Hiramatsu To: Tom Zanussi Cc: rostedt@goodmis.org, tglx@linutronix.de, 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 Subject: Re: [PATCH 3/4] tracing: Add action comparisons when testing matching hist triggers Message-Id: <20180405125016.6460a0ab372061ecf49f471a@kernel.org> In-Reply-To: <1522855023.32118.14.camel@tzanussi-mobl.amr.corp.intel.com> References: <20180403001025.6dfed9403d50d20104e54458@kernel.org> <1522688973.3254.8.camel@tzanussi-mobl.amr.corp.intel.com> <20180404213338.5bcd14994d8e0142b5bfefc6@kernel.org> <1522855023.32118.14.camel@tzanussi-mobl.amr.corp.intel.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 04 Apr 2018 10:17:03 -0500 Tom Zanussi wrote: > Hi Masami, > > On Wed, 2018-04-04 at 21:33 +0900, Masami Hiramatsu wrote: > > Hi Tom, > > > > On Mon, 02 Apr 2018 12:09:33 -0500 > > Tom Zanussi wrote: > > > > > after: > > > > > > # echo 'wakeup_latency u64 lat; pid_t pid' >> /sys/kernel/debug/tracing/synthetic_events > > > # echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="cyclictest"' >> /sys/kernel/debug/tracing/events/sched/sched_wakeup/trigger > > > # echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0 if next_comm=="cyclictest"' >> /sys/kernel/debug/tracing/events/sched/sched_switch/trigger > > > # echo 'hist:keys=next_pid:onmatch(sched.sched_wakeup).wakeup_latency(sched.sched_switch.$wakeup_lat,next_pid) if next_comm=="cyclictest"' >> /sys/kernel/debug/tracing/events/sched/sched_switch/trigger > > > # echo 'hist:keys=next_pid:onmatch(sched.sched_wakeup).wakeup_latency(sched.sched_switch.$wakeup_lat,prev_pid) if next_comm=="cyclictest"' >> /sys/kernel/debug/tracing/events/sched/sched_switch/trigger > > > # echo 'hist:keys=next_pid if next_comm=="cyclictest"' >> /sys/kernel/debug/tracing/events/sched/sched_switch/trigger > > > > I ensured this sequence has no problem. > > After above sequence, the trigger file shows > > > > ====== > > # cat events/sched/sched_switch/trigger > > hist:keys=next_pid:vals=hitcount:wakeup_lat=common_timestamp.usecs-$ts0:sort=hitcount:size=2048:clock=global if next_comm=="cyclictest" [active] > > hist:keys=next_pid:vals=hitcount:sort=hitcount:size=2048:onmatch(sched.sched_wakeup).wakeup_latency(sched.sched_switch.$wakeup_lat,next_pid) if next_comm=="cyclictest" [active] > > hist:keys=next_pid:vals=hitcount:sort=hitcount:size=2048:onmatch(sched.sched_wakeup).wakeup_latency(sched.sched_switch.$wakeup_lat,prev_pid) if next_comm=="cyclictest" [active] > > hist:keys=next_pid:vals=hitcount:sort=hitcount:size=2048 if next_comm=="cyclictest" [active] > > ====== > > > > So I clear the last one > > > > ====== > > # echo '!hist:keys=next_pid if next_comm=="cyclictest"' >> events/sched/sched_switch/trigger > > # > > ====== > > > > OK, it should be removed. I can not see it anymore on the trigger file. > > > > ====== > > # cat events/sched/sched_switch/trigger > > hist:keys=next_pid:vals=hitcount:wakeup_lat=common_timestamp.usecs-$ts0:sort=hitcount:size=2048:clock=global if next_comm=="cyclictest" [active] > > hist:keys=next_pid:vals=hitcount:sort=hitcount:size=2048:onmatch(sched.sched_wakeup).wakeup_latency(sched.sched_switch.$wakeup_lat,next_pid) if next_comm=="cyclictest" [active] > > hist:keys=next_pid:vals=hitcount:sort=hitcount:size=2048:onmatch(sched.sched_wakeup).wakeup_latency(sched.sched_switch.$wakeup_lat,prev_pid) if next_comm=="cyclictest" [active] > > ====== > > > > But when I missed to remove it again, it is accepted (is not an error?) > > > > ====== > > # echo '!hist:keys=next_pid if next_comm=="cyclictest"' >> events/sched/sched_switch/trigger > > # > > ====== > > This is consistent with existing behavior, not only for the hist > triggers but ftrace in general I think e.g. > > # echo 'traceoff:1 if nr_rq > 1' >> /sys/kernel/debug/tracing/events/block/block_unplug/trigger > # echo '!traceoff:1 if nr_rq > 1' >> /sys/kernel/debug/tracing/events/block/block_unplug/trigger > # echo '!traceoff:1 if nr_rq > 1' >> /sys/kernel/debug/tracing/events/block/block_unplug/trigger > > # echo 'try_to_wake_up:enable_event:sched:sched_switch:2' >> set_ftrace_filter > # echo '!try_to_wake_up:enable_event:sched:sched_switch:2' >> set_ftrace_filter > # echo '!try_to_wake_up:enable_event:sched:sched_switch:2' >> set_ftrace_filter > > Neither produces an error trying to remove an already-removed trigger. > Or are you thinking about something else? Hmm, OK, it is ftrace's behavior. > > Hmm... anyway, let's clear others too. > > > > ====== > > # echo '!hist:keys=next_pid:onmatch(sched.sched_wakeup).wakeup_latency(sched.sched_switch.$wakeup_lat,next_pid) if next_comm=="cyclictest"' >> events/sched/sched_switch/trigger > > # echo '!hist:keys=next_pid:onmatch(sched.sched_wakeup).wakeup_latency(sched.sched_switch.$wakeup_lat,prev_pid) if next_comm=="cyclictest"' >> events/sched/sched_switch/trigger > > # cat events/sched/sched_switch/trigger > > # Available triggers: > > # traceon traceoff snapshot stacktrace enable_event disable_event enable_hist disable_hist hist > > ====== > > > > OK, it is cleared now. > > > > Now I test it again. > > > > ====== > > # echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="cyclictest"' >> events/sched/sched_wakeup/trigger > > sh: write error: Invalid argument > > ====== > > > > Oops, what's the error? > > > > ====== > > # cat events/sched/sched_switch/hist > > > > ERROR: Variable already defined: ts0 > > Last command: keys=pid:ts0=common_timestamp.usecs if comm=="cyclictest" > > ====== > > > > Hmm, but ts0 is defined on sched_wakeup - you removed the triggers on > sched_switch, but I didn't see where you removed the sched_wakeup > trigger defining ts0... Ah, I confused that the sched_switch and sched_wakeup... Can you print out the error with which event we should see? e.g. ERROR: Variable already defined at sched_wakeup: ts0 And this shows the good reason why we should reject removing unexist trigger (with -ENOENT). If I find I can not remove 'hist:keys=pid:ts0=...' from sched_switch, it helps me to notice my mistake. > > Hmm, how can I undef ts0 and test it again? > > You should be able to remove the sched_wakeup trigger defining ts0 and > after doing that test again. At least I was able to: > > # echo '!hist:keys=pid:ts0=common_timestamp.usecs if comm=="cyclictest"' >> > events/sched/sched_wakeup/trigger > > # echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="cyclictest"' > >> events/sched/sched_wakeup/trigger OK, anyway this works good to me too. Tested-by: Masami Hiramatsu Thanks, -- Masami Hiramatsu