Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6774169rdb; Fri, 15 Dec 2023 08:02:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IFz/nsGzo6hOtxbQmQkrgAULD1ZXZMzbAN1VyoWhN4vdePaFCpavf1sGkbYz+lAP+A77PSk X-Received: by 2002:a17:90a:7d0c:b0:286:e5c7:c210 with SMTP id g12-20020a17090a7d0c00b00286e5c7c210mr5888815pjl.10.1702656157575; Fri, 15 Dec 2023 08:02:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702656157; cv=none; d=google.com; s=arc-20160816; b=HC5lKJiSIb6bSbsO24j8UCKru19O/Y3N3tSrd9+Qjv2Ux3rxEmvu1clPsJRMFusQEV lwiB1xG4B7LM+rQVLDI7VlGwbZc78pu3EN2jAVe4sdHcKPXvGhOe8JROeJIdvOfa/MyP 8n3mLzQA9IIMdYiCl6Ozr7i6wleZlMxaJhQC6HMp9pdHmC76jfq/GWzqIqPNX5SnPuLr URC7LXmocop1CUlZYQH/YePekZxdPof2SoX1+OV1t0UreRIGcwPsyZ93n9d+eq+YqKfn guAVGNbUF3T9qeHaCF0TQiC9hC+5PeuqpOPZ96j0ulN+usCFOARQ5twOo/lseHvWIN6V 5apA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=yneblehmhwxfE9N9GDbI3tJKFMVTc8Ybtc9y+IoupTc=; fh=i6ufS620BBDoAP7cFo0KkGxYTKVAd29biw2Lu8O9lss=; b=bdHmr9Tj5ImieMJ4pmncRW5uZHyZ1eJTYPEJUbJNZVYkuolXFLbaV5f+iUTObedquL y7hBMAjxG9o25df2H7JYOgWlUIcbFtLRoO4ARv2kcXifU5+Iz9+c4+iXXv+Xe1LTWJLS 1c/ljnMe5rpaR66ph2a6SqdXWmh29MP2UL2vWB+lryI1mh5ByCcvm+0tmpbZO1SJD2Xy rGCtI5FUqdQQL4h9GTp4whbaFdnMrEEGP4GuLXCo9n+HNKEct+NDtfN3JvgLTMpdeAUa 9Swx8SWVY5M/7K0NKiwYPBa98KlRzeNr4/hG8oZZoL1Kl5EZ5I2gT7NR9zqY/eYKRyyh j/fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=ta7wbS5o; spf=pass (google.com: domain of linux-kernel+bounces-1244-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1244-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id y2-20020a17090a134200b0028b3d5a8c4asi367417pjf.95.2023.12.15.08.02.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 08:02:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1244-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=ta7wbS5o; spf=pass (google.com: domain of linux-kernel+bounces-1244-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1244-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2ABCFB23826 for ; Fri, 15 Dec 2023 16:01:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C31D39FE4; Fri, 15 Dec 2023 16:01:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="ta7wbS5o" X-Original-To: linux-kernel@vger.kernel.org Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BF613717F; Fri, 15 Dec 2023 16:01:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1702655619; bh=qzMh8frRtGFJ29d3oqzMz4SSOiBgHf2UGDFCUl3N0Qs=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ta7wbS5oraWz0ep2zIvINP7c9WekLU3kFt+X+NJ8w5tsCzd/GIRB6a3jCcZJPGnR+ nb5uI/OGJVM8G2Gn/cymcMc49MnwbY9E/+bAHtSXcWFeOisE9kRKEN1q02IXBzTzNg 1DlnKIKyb8sxU590pphymOGppXtXTwnE5xrM+WzUBZXWcM4iHip9dHyu028A9b5HXk 6kVfIgazFe74ldumJXULV971fJRrPi3PqSfOo4sJjKJZGtPRuk3p6PbL023cBed2DI jDpNTdypdAmNcBfWuPMd3ft5Qws4wBQtIvq1lBrB1kuHHcpLOoWictFQJ3/YdzI3+z W4u/m/fLbgm2Q== Received: from [172.16.0.134] (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4SsDKH3vG5zGb7; Fri, 15 Dec 2023 10:53:39 -0500 (EST) Message-ID: <21936075-3858-446a-9391-a38e8d8968e7@efficios.com> Date: Fri, 15 Dec 2023 10:53:39 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] tracing: Add disable-filter-buf option Content-Language: en-US To: Steven Rostedt , LKML , Linux trace kernel Cc: Masami Hiramatsu , Mark Rutland References: <20231215102633.7a24cb77@rorschach.local.home> From: Mathieu Desnoyers In-Reply-To: <20231215102633.7a24cb77@rorschach.local.home> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2023-12-15 10:26, Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > Normally, when the filter is enabled, a temporary buffer is created to > copy the event data into it to perform the filtering logic. If the filter > passes and the event should be recorded, then the event is copied from the > temporary buffer into the ring buffer. If the event is to be discarded > then it is simply dropped. If another event comes in via an interrupt, it > will not use the temporary buffer as it is busy and will write directly > into the ring buffer. > > The disable-filter-buf option will disable the temporary buffer and always > write into the ring buffer. This will avoid the copy when the event is to > be recorded, but also adds a bit more overhead on the discard, and if > another event were to interrupt the event that is to be discarded, then > the event will not be removed from the ring buffer but instead converted > to padding that will not be read by the reader. Padding will still take up > space on the ring buffer. > > This option can be beneficial if most events are recorded and not > discarded, or simply for debugging the discard functionality of the ring > buffer. > > Also fix some whitespace (that was fixed by editing this in vscode). I'm not convinced that a boolean state is what you need here. Yes, today you are in a position where you have two options: a) use the filter buffer, which falls back on copy to ring buffer if nested, b) disable the filter buffer, and thus always copy to ring buffer before filtering, But I think it would not be far-fetched to improve the implementation of the filter-buffer to have one filter-buffer per nesting level (per execution context), or just implement the filter buffer as a per-cpu stack, which would remove the need to fall back on copy to ring buffer when nested. Or you could even do like LTTng and filter on the input arguments directly. But each of these changes would add yet another boolean tunable, which can quickly make the mix hard to understand from a user perspective. So rather than stacking tons of "on/off" switches for filter features, how about you let users express the mechanism they want to use for filtering with a string instead ? e.g. filter-method="temp-buffer" filter-method="ring-buffer" filter-method="input-arguments" ? Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com