Received: by 10.213.65.68 with SMTP id h4csp852831imn; Wed, 4 Apr 2018 08:19:19 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+rokH2Ppd39TYfOYiUUS+UDj+WVTilWBWGV8sRTnFYB1rTdmRhtBPs+B93pKQDeMf/vOXB X-Received: by 10.98.9.147 with SMTP id 19mr7654671pfj.125.1522855159814; Wed, 04 Apr 2018 08:19:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522855159; cv=none; d=google.com; s=arc-20160816; b=onqGMXOgayul1EcjENQmpPv5ASYAJEZriWg79sizyISp0y6+ON6TrIzRIiTOGRtV0S yKsfXeHoW4AMZTgi/zMivEnkIxqVUT1MyQIyeGmyohfCT+Z2/URPhDHvUmgkO8Y+vrJU WhuS95tQOUsNvzK+iNVnznu+wdWPMtQiPT4fQSW3/kcgLYWvOGH/t3iuCHGCfXS4JOdJ 8z62W8zxOhzM3OwCnyOQTdpD3ro25KJrns4oaZw9rhBnJgiDYSFsO8c/MBA0Lek5iJ/p Uaqd9V8eNxtCTLAVS/x2i1gub04KqMDA/FtoqrRKQBSunY3DeHtHFm9/qGp3rM3xl0JK Bd1g== 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:date:cc:to:from:subject:message-id :arc-authentication-results; bh=voGG2oDTEGYcWKJtXFKurmKebTQ7Pm3gC2OZSjrkIjA=; b=E5FuNd6XSdGL016q5ab9S25g/niSnZo/LQ7cbH0LbQsHukls33ePvKrlgvCg7W6sHz 0Jeiay/HWCIts9ZGmDZgmGWnjsH6F7fS8AbJ0tOe+Htmb3slhagjdWaK+7yAcqviqqlf 10P/MWMz73JA+IjFwLywFQzgga5exHpUp5GXhpJFV3/0uC8CXZgdDMW75Fa//djtiLvl nP3SsZS8LZuffnU7zbVTT5r0KDt6tfwRcSXaNzSe7mLg+Oe2EwVU/tPT0Gg9YwQs9Bfw UlMIXCXlPZFi4IAQGxnKfkGeniG7dij88WNqrLJAOFrPHbD3Lc8YBEOaps8Stotk8GDj MVww== 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 c27si3792802pgn.223.2018.04.04.08.19.05; Wed, 04 Apr 2018 08:19:19 -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 S1751932AbeDDPRH (ORCPT + 99 others); Wed, 4 Apr 2018 11:17:07 -0400 Received: from mga05.intel.com ([192.55.52.43]:7764 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751447AbeDDPRG (ORCPT ); Wed, 4 Apr 2018 11:17:06 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Apr 2018 08:17:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,406,1517904000"; d="scan'208";a="30984765" Received: from tzanussi-mobl.amr.corp.intel.com (HELO [10.252.139.199]) ([10.252.139.199]) by orsmga008.jf.intel.com with ESMTP; 04 Apr 2018 08:17:03 -0700 Message-ID: <1522855023.32118.14.camel@tzanussi-mobl.amr.corp.intel.com> Subject: Re: [PATCH 3/4] tracing: Add action comparisons when testing matching hist triggers From: Tom Zanussi To: Masami Hiramatsu 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 Date: Wed, 04 Apr 2018 10:17:03 -0500 In-Reply-To: <20180404213338.5bcd14994d8e0142b5bfefc6@kernel.org> References: <20180403001025.6dfed9403d50d20104e54458@kernel.org> <1522688973.3254.8.camel@tzanussi-mobl.amr.corp.intel.com> <20180404213338.5bcd14994d8e0142b5bfefc6@kernel.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4 (3.10.4-4.fc20) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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... 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... > 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 Thanks, Tom > If I can not clean it, the testcase must fail on the 2nd time. > > Thank you, >