Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1108901imm; Fri, 15 Jun 2018 11:19:55 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKc9yO69PPVwxZZr1a5QJzwscYhYjRWI93cQm6miejaZOSMgY20Ocao9OSREGuXszf4lT9o X-Received: by 2002:a65:5c46:: with SMTP id v6-v6mr2558123pgr.127.1529086795055; Fri, 15 Jun 2018 11:19:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529086795; cv=none; d=google.com; s=arc-20160816; b=mNa7ViamGn93RygDuQIdDQq2yuwQP9awQwqopvPYrDcp+u+JiMJcv8YWj3ByG/aFrq id3XTmf6bIdtGnwyTSQNwnJXTmey4LdxEbaDpxrU8vvtmiBtvlPBmCLn8jP8Caiex0Jh ECUkbnhmpjGr9rGh8vSiaSFCesSmDXU++66kJ4PLZwRWwRjkDNi/k5VD262rpCLKwF0Y ean7NGPzc2E8QC5gFtPEEqmSKLi4NRFqa7aDzl8LEMYC9+zVon+hnhy8nqjdQoYXHVXg qkjiz4hkrDLwEMSvB/PVs7wioX5gD5+AFHWdJfU8hSk7MjG/LGqDuyDVz5U02tgUjpkw n3hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=Dt3YyKahDoj24TpB4or88lOmNtPYtWcdPlC7U2wGV/A=; b=Qok/tGcsp/EmC6hfpkT6xcmRqkG5OJgBF+sB8CET/jB0j+GnPgCnoh/C4qfk1nffwF IJwGfFS9f/BIOMUPJ1HpqPXnNR1oI1k/wKxMtqshEZJjhcYx/Qqrz/Fx23WvDNgUF1VH vL5ZKhvQ46upAw9VThgMpd+alb5IA47wa8Sj45NTXCaMCgQ9Q157zCQfzrWtB361MJXl 772eb7EddkGIpcXf852s03X9nH3Vq2XG7nahDxtU+CMlLgYXjt16drl+Oisv1aaRMSOr ey7FXoTc5hKagpFHq+C2YtIMUHaVo/BEYnG6e5990FRGIXw5srCDtq42YOifcPZHLcwh 6lwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=HEU8jOZN; 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 e5-v6si6921329pgs.449.2018.06.15.11.19.40; Fri, 15 Jun 2018 11:19:55 -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; dkim=pass header.i=@joelfernandes.org header.s=google header.b=HEU8jOZN; 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 S1756355AbeFOSSK (ORCPT + 99 others); Fri, 15 Jun 2018 14:18:10 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:33261 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756331AbeFOSSI (ORCPT ); Fri, 15 Jun 2018 14:18:08 -0400 Received: by mail-pl0-f68.google.com with SMTP id 6-v6so5210494plb.0 for ; Fri, 15 Jun 2018 11:18:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Dt3YyKahDoj24TpB4or88lOmNtPYtWcdPlC7U2wGV/A=; b=HEU8jOZNGvmbx9JLPpHv6KkDojBqfCdhFHsqKtjuA7TLcNBaUR/m5X+s3FomPpKoO7 K1qUeyLZC3xIGHzr+ICdf/kq/qACtVkE/4Tyy4O78kk3b5SBHK20h4m+pKYf1Dc29Mpn 6oSSWIu4xPHxJIOeVImfcut+kOtaD6AQwZ608= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Dt3YyKahDoj24TpB4or88lOmNtPYtWcdPlC7U2wGV/A=; b=QBLYInP+R+ZBMYDd+F32Vn86kyVFAs8kUEEOiQXqLRiKU51dgTOy/p1qQxihTrGFk9 U6N9Y9CFgPKWoTwRSDWzndLaEydPJRZFfnTMhyoG0ZLwzhEpAT6lg73uZ3BZVU2p6YPb kh13SKgOwmY8jygZx7R7U2Kj0ZOQ2dm5wLy3zG+uYkjr7/mO7w1GXIjiWvVDMoQTPS1v Nkt6dkNUBjBYtSQ73i4ucq7JuDlYZ4sun72QUAbm/dGg87+ApaY7C8dtH5+NYVx4SoX/ vAkLtxRIk9H4N4XKUCqpuYWba1KMbbmPacfciQlnpTMuhs/0Tuz3ZIr4jsec6w9deE0G jfaQ== X-Gm-Message-State: APt69E3bUFpN67YE0jdGc4uaK17zsc602ZvNCrJtU9pejHTcOVWXImHq ArcHVLw2V7Dtd/buUsOaPRMU/KqnhKg= X-Received: by 2002:a17:902:650a:: with SMTP id b10-v6mr3250034plk.45.1529086687830; Fri, 15 Jun 2018 11:18:07 -0700 (PDT) Received: from localhost ([2620:0:1000:1600:3122:ea9c:d178:eb]) by smtp.gmail.com with ESMTPSA id g66-v6sm18511513pfk.99.2018.06.15.11.18.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Jun 2018 11:18:07 -0700 (PDT) Date: Fri, 15 Jun 2018 11:18:06 -0700 From: Joel Fernandes To: Steven Rostedt Cc: Joel Fernandes , kernel-team@android.com, "Joel Fernandes (Google)" , Ingo Molnar , Steven Rostedt , tglx@linutronix.de, mhiramat@kernel.org, namhyung@kernel.org, mathieu.desnoyers@efficios.com, linux-rt-users@vger.kernel.org, Tom Zanussi , peterz@infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC] tracing: Call triggers only if event passes filter checks Message-ID: <20180615181806.GA60478@joelaf.mtv.corp.google.com> References: <20180615010113.127718-1-joel@joelfernandes.org> <20180615121603.33007151@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180615121603.33007151@gandalf.local.home> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 15, 2018 at 12:16:03PM -0400, Steven Rostedt wrote: > On Thu, 14 Jun 2018 18:01:13 -0700 > Joel Fernandes wrote: > > > From: "Joel Fernandes (Google)" > > > > Currently, trace event triggers are called regardless of if the event > > filter checks pass or fail. Thus if one were to enable event triggers > > and filters at the same time, then the triggers will always be called > > even if the filter checks didn't pass. > > > > This is a problem for a usecase I was experimenting with: measuring the > > time preemption is disabled using synthetic events and dump the stack > > using the stacktrace trigger if the total preempt off time was greater > > than a threshold. Following are the commands for the same: > > > > Create synthetic event: > > > > echo 'preemptdisable u64 lat' >> \ > > /sys/kernel/debug/tracing/synthetic_events > > > > echo 'hist:keys=cpu:ts0=common_timestamp.usecs:scpu=cpu' >> \ > > /sys/kernel/debug/tracing/events/preemptirq/preempt_disable/trigger > > > > echo 'hist:keys=cpu:wakeup_lat=common_timestamp.usecs-$ts0:\ > > onmatch(preemptirq.preempt_disable).preemptdisable($wakeup_lat)' >> \ > > /sys/kernel/debug/tracing/events/preemptirq/preempt_enable/trigger > > > > Enable synthetic event: > > > > echo stacktrace > /sys/kernel/debug/tracing/events/synthetic/preemptdisable/trigger > > echo 'lat > 400' > /sys/kernel/debug/tracing/events/synthetic/preemptdisable/filter > > echo 1 > /sys/kernel/debug/tracing/events/synthetic/preemptdisable/enable > > > > With the patch, the stacktrace is triggered only if the filter checks > > passed. It also seems sensible to call triggers only if filter checks > > pass so lets do that. > > No, it worked as expected. The filter is only to be used it the event > should be recorded or not. What you wanted to do is: > > echo 'stacktrace if lat > 400' > events/synthetic/preemptdisable/trigger Thanks, that worked! I was thinking at some point we should add these synthetic event 'recipes' to the kernel tree as scripts or documentation, or something like that. Do you have any suggestions on where to add these? A recipe would be 'report preemptoff times > threshold us' or 'wake up latency > threshold us'. I think there will be quite a few such useful ones. Another idea could be to make the 'recipes' a part of ftrace itself. Something like a 'built in' synthetic event that will set itself up when its enabled without needing to create the hist triggers and other triggers explicitly. Thoughts? thanks! - Joel PS: Your reply also went a weird address (barclay something) on CC. Wondering what happened. The headers in my original email seemed correct. I have included back the CC list.