Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1955586imm; Sat, 16 Jun 2018 06:44:14 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLyhl2NfpEDVIM7bm+LZwqePPl3e18r75O4+a0KGKjZ59j/nBYWN6TsIB1m/Qh2Eyr/6MNq X-Received: by 2002:a17:902:1029:: with SMTP id b38-v6mr6577867pla.277.1529156654803; Sat, 16 Jun 2018 06:44:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529156654; cv=none; d=google.com; s=arc-20160816; b=I4/66QpWKGVecmyeBYLF5fkGekm8kB5fIOo9nazYt+xuUC7qELC5G6jk6Y2il9Fe5N KhHYwHmPJ8wOuBhF+GiApisVrqZJZCyYhRQPelXv1vuNy26gDH2UkK5RnMn8J97W198C 5HWNZ7mL13uGAp3V4C5jBtb5aK4GyCRFWeVAQD9/MIUiRilH1FvVYF+ZIzy1Oa9ZlAuB 2f5Mnc7wezR37XfludvDFFg1YSSB66Ai+6EznX1udk8F2cjXpXt0rGvT8AEKupFED1Ub JZWRAG1L7XuTEbi9zsVjka+JhwCqjI7Ap2qWhT3I3mI1yOE+RYZ65q8lznXPpo2iqnqN IZFQ== 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 :dkim-signature:arc-authentication-results; bh=tcuVJafUjfp606p5NiilQzwkiYWwOOq3Z9E4hTXUATI=; b=hmxYzPAy2fybbwqkF8yjF4G1DztbPHG/ge05/ujW79M133fYDH9m9WJmq+dDjVXvRs FwgrjKzaemmeMA+KVcHM7yKyKO1LDD9vIjBBWhHYKZQ/Fbhb5BcGJcJCirUweWO7JHXA qEPfg9aAE8EhsGvgQt8T56Sjt8j7h1lQKxpbcNAnYjohdsTniMbrT+A7YtfCUcW06j/R j3557QTtjs/F8RQEAWSnmYOdHKkQkKQbbw6jGrAWixVBSqtmVqxG5URb+dBqWbMb9ECX L24K18AgA2pCFtSqIlNecGIchJTM10YqlPi22/oBFPRuWuMpVUeGbw1ltJIKkj2sT10p LXNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gWRID9Q0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h5-v6si8574398pgn.660.2018.06.16.06.43.59; Sat, 16 Jun 2018 06:44:14 -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=@kernel.org header.s=default header.b=gWRID9Q0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932909AbeFPNne (ORCPT + 99 others); Sat, 16 Jun 2018 09:43:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:56504 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932719AbeFPNnd (ORCPT ); Sat, 16 Jun 2018 09:43:33 -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 1F46C2088E; Sat, 16 Jun 2018 13:43:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1529156612; bh=uYwP+hLfFsnuAzJU+RY4snGMjrLr4anNvc1JNvDjZCg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gWRID9Q0X7d9k3JIUtLfSwiW4HlwjXIprHpJ/R7CF2vtNZ3faodrpmsSfji2Cjx7B sTNe4C6A5wqIHIWRPV2Hi0d8NOu+6txdzO1Rg43Bj+Cf2uJL1tHoF/i92wUs2LdPiA N72aNNpoqFltOb3jAU2Wc+KOr6vYuo4ySQWqOjsY= Date: Sat, 16 Jun 2018 22:43:29 +0900 From: Masami Hiramatsu To: Joel Fernandes Cc: linux-kernel@vger.kernel.org, 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 Subject: Re: [PATCH RFC] tracing: Call triggers only if event passes filter checks Message-Id: <20180616224329.02e37ef4aee72c7d5685818e@kernel.org> In-Reply-To: <20180615010113.127718-1-joel@joelfernandes.org> References: <20180615010113.127718-1-joel@joelfernandes.org> 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 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 Have you tried if statement as below? echo "stacktrace if lat > 400" > /sys/kernel/debug/tracing/events/synthetic/preemptdisable/trigger As my understanding, filter is used for controlling "recording the event" and trigger is out of its scope. Trigger itself has own filter as "if statement", so you should use it. Thank you, -- Masami Hiramatsu