Received: by 10.192.165.156 with SMTP id m28csp2094410imm; Thu, 12 Apr 2018 08:31:10 -0700 (PDT) X-Google-Smtp-Source: AIpwx48Sei90a8OE7YGSt1EoTPTWnGVzQ1Tcpg/b3MhOuvTLLMl+H54LlNqIiVPNgg0bs6+4WKhh X-Received: by 2002:a17:902:b786:: with SMTP id e6-v6mr1535651pls.246.1523547070874; Thu, 12 Apr 2018 08:31:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523547070; cv=none; d=google.com; s=arc-20160816; b=aLkmuKsFKdOMY/0S5p0+Rf+Pw1Ol4ovlRt+9oM/wjctjkH8QCBRt6rD4PjChsM6hiF et1y5Vk0g8DrQ5JmUaPNaXEmTTDRMoCvjmDS70fKZsLP97qZFAHugLTnextVy7uB/XRt o+MAoU/KFM5HCBwxzc0LeDTEbOSU7z7BaE15eGMTyfDKBSr1OT78v7McMCuPmHIPfpTV VuPOPnSdzlC70HgBBFkbZ5/aEJZ2An32Am6P284zG6VbXCiSkfibxVBuZFToje8yRaVC JbD8kLSTIBogP8iAftihKIasCMI9tr1nORqnLBz3XPzpwEiroCcCuRYhyXrhkc7aIgk5 mcqA== 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=KHJ+OVq9vayniuN4YW+96rqaFu0Q+h64PJHl5mzcYdE=; b=CXfdO41xP52MeyBXQReShYpj+8F8HalL3tLYAqdNQKwMDTwlOnQkMWcmkvUH8G4cxQ CIlcSsg85cRd2lq5xEUt9eSFg+NOe6fM7GB9tPQLY6ltbif3iCX0dBXtAKUpDPtf98+6 OqlbywmslVS+9qB5V9AsIBJaOadLjVY8xeZZY8hh6NRCDTELQnQCfOA9aCKjmYiN1ZAA j5bwKIPhQyTtvUVHsXJcznUFxle8wUL8katjtE43GyGSHwqTZcqvhbGgnHw+swvW4URS 4ErfMdVHn98yw7LXbw0PqEzpcxH/2eJfcBNG55YwtsxtAdTi5pcGIcz78rEEdX2fEqss 69pg== 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 o1-v6si3446702pld.255.2018.04.12.08.30.33; Thu, 12 Apr 2018 08:31:10 -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 S1754141AbeDLPWf (ORCPT + 99 others); Thu, 12 Apr 2018 11:22:35 -0400 Received: from mga06.intel.com ([134.134.136.31]:9246 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753998AbeDLPWb (ORCPT ); Thu, 12 Apr 2018 11:22:31 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Apr 2018 08:22:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,442,1517904000"; d="scan'208";a="42820533" Received: from cbeckton-mobl.amr.corp.intel.com (HELO [10.255.230.227]) ([10.255.230.227]) by orsmga003.jf.intel.com with ESMTP; 12 Apr 2018 08:22:29 -0700 Message-ID: <1523546543.9119.5.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: Thu, 12 Apr 2018 10:22:23 -0500 In-Reply-To: <20180407211638.ca984867724d459031be3aa7@kernel.org> 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> <20180405125016.6460a0ab372061ecf49f471a@kernel.org> <1522971253.32118.47.camel@tzanussi-mobl.amr.corp.intel.com> <20180406105309.b50ea1a21d2cbd9b0e39dbfd@kernel.org> <1523033249.32118.85.camel@tzanussi-mobl.amr.corp.intel.com> <20180407211638.ca984867724d459031be3aa7@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, Sorry for the delay in replying - was off for a few days.. On Sat, 2018-04-07 at 21:16 +0900, Masami Hiramatsu wrote: > On Fri, 06 Apr 2018 11:47:29 -0500 > Tom Zanussi wrote: > > > > > > Can you print out the error with which event we should see? e.g. > > > > > > > > > > ERROR: Variable already defined at sched_wakeup: ts0 > > > > > > > > > > > > > How about printing the event name along with the last command, for any > > > > error? : > > > > > > > > ERROR: Variable already defined: ts0 > > > > Last command: [sched:sched_wakeup] keys=pid:ts0=common_timestamp.usecs if comm=="cyclictest" > > > > > > Hmm, is the Last command shows the last command on sched_wakeup ? or sched_switch?? > > > > > > > Just the last command that executed with an error - it's a global set by > > the last command that failed, kind of like errno. > > > > In this case, the last error was for the command listed, on the > > sched_wakeup event. Even if you see it by reading a different hist > > file, the last error is still the same - we don't keep a last error for > > each event. > > OK, in that case, it may not be useful for my case. > I need to know why the error happens and where should I see to solve it. > > > > > > [...] > > > > Before: > > > > > > > > # 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:ts0=common_timestamp.usecs if comm=="cyclictest"' >> /sys/kernel/debug/tracing/events/sched/sched_switch/trigger > > > > > > > > And other commands making us think we cleared everything out so the > > > > below error is a surprise > > > > > > > > # echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="cyclictest"' >> /sys/kernel/debug/tracing/events/sched/sched_wakeup/trigger > > > > -su: echo: write error: Invalid argument > > > > > > No, my senario is different. > > > > > > Your senario tries > > > 1) define ts0 on sched_wakeup > > > 2) remove ts0 from sched_switch (but silently failed) > > > 3) re-define ts0 on sched_wakeup and get an error > > > > > > In this case, user can dump sched_wakeup/trigger and see there is already ts0 defined. > > > > > > My senario is a bit different > > > 1) define ts0 on sched_wakeup > > > 2) remove ts0 from sched_switch (but silently failed) > > > 3) re-define ts0 on *sched_switch* and get an error > > > > > > The 3rd operation failed on "sched_switch" not on "sched_wakeup". In this case we will totally lost where the ts0 defined. > > > That's why I have asked you to show "where the ts0 is defined" at error line. > > > > > > > Your scenario should work, which is why I assumed my scenario. Anyway, > > this I think corresponds to your scenario, which works for me: > > > > # 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:ts0=common_timestamp.usecs if comm=="cyclictest"' >> /sys/kernel/debug/tracing/events/sched/sched_switch/trigger > > # echo 'hist:keys=next_pid:ts0=common_timestamp.usecs if comm=="cyclictest"' >> /sys/kernel/debug/tracing/events/sched/sched_switch/trigger > > Hmm, is it possible to redefine ts0 on different event?? > In that case, will ts0 be updated on both sched_switch and sched_wakeup? > It's not really redefining ts0 - those are separate variables on two different events that happen to have the same name (thus the need to disambiguate when referencing them in later expressions). And yes, they are updated separately whenever the corresponding event occurs. > > > > I also tried this, which works too: > > > > # 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:ts0=common_timestamp.usecs if comm=="cyclictest"' >> /sys/kernel/debug/tracing/events/sched/sched_switch/trigger > > # echo '!hist:keys=next_pid:ts0=common_timestamp.usecs if comm=="cyclictest"' >> /sys/kernel/debug/tracing/events/sched/sched_switch/trigger > > # echo '!hist:keys=next_pid:ts0=common_timestamp.usecs if comm=="cyclictest"' >> /sys/kernel/debug/tracing/events/sched/sched_switch/trigger > > # echo 'hist:keys=next_pid:ts0=common_timestamp.usecs if comm=="cyclictest"' >> /sys/kernel/debug/tracing/events/sched/sched_switch/trigger > > > > When I looked at the details of what you did in your script, it > > corresponded to my scenario - the error you saw was because you didn't > > remove the sched_wakeup trigger though you apparently thought you did, > > and then tried to do it again (according to your script, the command > > that failed was to sched_wakeup, and then you looked at sched_switch and > > saw the error). > > Ah, I got it! I mixed it up, sorry. > > BTW, if I defied ts0 at sched_wakeup > > ==== > [root@devbox ~]# echo 'wakeup_latency u64 lat; pid_t pid' >> /sys/kernel/debug/tracing/synthetic_events > [root@devbox ~]# echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="cyclictest"' >> /sys/kernel/debug/tracing/events/sched/sched_wakeup/trigger > ==== > > and do it again, > > ==== > [root@devbox ~]# echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="cyclictest"' >> /sys/kernel/debug/tracing/events/sched/sched_wakeup/trigger > -bash: echo: write error: Invalid argument > [root@devbox ~]# cat /sys/kernel/debug/tracing/events/sched/sched_wakeup/hist > # event histogram > # > # trigger info: hist:keys=pid:vals=hitcount:ts0=common_timestamp:sort=hitcount:size=2048:clock=global if comm=="cyclictest" [active] > # > > > Totals: > Hits: 0 > Entries: 0 > Dropped: 0 > > ERROR: Variable already defined: ts0 > Last command: keys=pid:ts0=common_timestamp.usecs if comm=="cyclictest" > ==== > > OK, I got this error message. > However, if I write same command on sched_switch, > > ==== > [root@devbox ~]# echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="cyclictest"' >> /sys/kernel/debug/tracing/events/sched/sched_switch/trigger > -bash: echo: write error: Invalid argument > ==== > > This gets error because there is no "pid" argument in the event, but > > ==== > [root@devbox ~]# cat /sys/kernel/debug/tracing/events/sched/sched_wakeup/hist# event histogram > # > # trigger info: hist:keys=pid:vals=hitcount:ts0=common_timestamp:sort=hitcount:size=2048:clock=global if comm=="cyclictest" [active] > # > > > Totals: > Hits: 0 > Entries: 0 > Dropped: 0 > [root@devbox ~]# > ==== > > I can't see the corresponding error message... Right, that's because I forgot to generate an error message for that. The patchset I just posted adds an error message for that - thanks for pointing it out. Tom