Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6882253rdb; Fri, 15 Dec 2023 10:43:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IFM4e8hEdcT+r9X6wDThen1L6JWfrgt8XWosvf2dkK14r1+ML/IIvcgV+jkpj1HT3IN5LaT X-Received: by 2002:a05:622a:1312:b0:425:8d76:28a0 with SMTP id v18-20020a05622a131200b004258d7628a0mr15038747qtk.116.1702665825363; Fri, 15 Dec 2023 10:43:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702665825; cv=none; d=google.com; s=arc-20160816; b=XB92zF3znDXgollqrWPKWb1TgfiW3Y/t/UVGtsXlRI5dTIuEHbwo2R9xZHc1UeYYYF Ys/bvI/8L07cKYD+4o6UUlWkywEXOBqmvYeZ9xeGQl+JXCUHsyx4S5WY5Lg0srjxhHNn MsWuFS/aVj9JMIubtSj42zGK/5OL9uJ39t+5nvfWhLyJzikIX6xElqIANzCk1OqFszEY RKyCvfIFrF6nTWW13GyqFzZjIJWYMYwDrjSyeNeCYpjdQDXcMUE764l3UHW47q26IjFC /AWIkQPwK+Du6WSz5jhz1DgRbkjzeB19uVAuCpAe3ozbHptXXiSyrcm8PpdkOA9aEiys ZEVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=LVEd56sLqHKTEbyTYlx086Hs3mBYsKRfjIXUVJU4VHo=; fh=UZpTDzkhzZ9L8G7jwsdcfgvh6xD2n8fD+pbOm7SKsOE=; b=E7D1TfeRHVkQWCork/x2AScuxmuHWXOZg4ZUXrdjXFqYUPHAbymyW69q4mJW8RCPEF uRfmkGidt1dVmn7Em8qaOjJKONREwW/4wgYNcv3gVQy9zlHuDKeYGFycVq1ck3EaRn0Z g7Pq2RcvefKT2StLkoTSTjMUAWpse1FghpWITLdw7lePC42Z5usB+ZCvC8YAgddI1v3N wbkT2/sg2H6rABa+GgEQx1buHfsz+HLW2qj/ORLoY4WOvJSLZv05liAbJ2cXnWDExUI+ kMgjG76KXheNlBEbHuso5FAw1OTsnyXJAWTgp7To2rTiIaXv07UC5gwgTWR4XpT+XVZu wxwg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1539-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1539-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id w15-20020a05622a134f00b00425e75b5a54si8810930qtk.343.2023.12.15.10.43.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 10:43:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1539-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1539-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1539-linux.lists.archive=gmail.com@vger.kernel.org" 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 1EEA51C23FB4 for ; Fri, 15 Dec 2023 18:43:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D78E73C481; Fri, 15 Dec 2023 18:43:38 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 6945146528; Fri, 15 Dec 2023 18:43:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79E72C433C8; Fri, 15 Dec 2023 18:43:37 +0000 (UTC) Date: Fri, 15 Dec 2023 13:43:35 -0500 From: Steven Rostedt To: Mathieu Desnoyers Cc: LKML , Linux trace kernel , Masami Hiramatsu , Mark Rutland Subject: Re: [PATCH] tracing: Add disable-filter-buf option Message-ID: <20231215134335.2388aba5@rorschach.local.home> In-Reply-To: References: <20231215102633.7a24cb77@rorschach.local.home> <21936075-3858-446a-9391-a38e8d8968e7@efficios.com> <20231215120417.567d5ea4@rorschach.local.home> <20231215123458.63f57238@rorschach.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 15 Dec 2023 13:25:07 -0500 Mathieu Desnoyers wrote: > > I am not against exposing an ABI that allows userspace to alter the > filter behavior. I disagree on the way you plan to expose the ABI. These are no different than the knobs for sched_debug > > Exposing this option as an ABI in this way exposes too much internal > ring buffer implementation details to userspace. There's already lots of exposure using options. The options are just knobs, nothing more. > > It exposes the following details which IMHO should be hidden or > configurable in a way that allows moving to a whole new mechanism > which will have significantly different characteristics in the > future: > > It exposes that: > > - filtering uses a copy to a temporary buffer, and > - that this copy is enabled by default. > > Once exposed, those design constraints become immutable due to ABI. No it is not. There is no such thing as "immutable ABI". The rule is "don't break user space" If this functionality in the kernel goes away, the knob could become a nop, and I doubt any user space will break because of it. That is, the only burden is keeping this option exposed. But it could be just like that light switch that has nothing connected to it. It's still there, but does nothing if you switch it. This knob can act the same way. This does not in anyway prevent future innovation. > > > > > The option is just a way to say "I don't want to do the copy into the > > buffer, I want to go directly into it" > > My main concern is how this concept, once exposed to userspace, > becomes not only an internal implementation detail, but a fundamental > part of the design which cannot ever go away without breaking the ABI > or making parts of the ABI irrelevant. Again, it's not about breaking ABI. Linus himself stated that Linux constantly breaks ABI. As long as breaking ABI doesn't break user space, it's OK. I've broken tracing ABI several times over the last decade, and nobody complained. It's *how" you break it. It's similar to the tree falling in the forest. If you break ABI and no user space application notices, did you really break ABI? > > I can make a parallel with the scheduler: this is as if the sched > feature knobs (which are there only for development/debugging purposes) > would all be exposed as userspace ABI. This would seriously > limit the evolution of the scheduler design in the future. I see this > as the same problem at the ring buffer level. Heh, I mentioned sched before reading this. Again, it's whether or not userspace can notice if behavior changes or not. If it can't notice, it didn't break. > > > > >> > >> I don't care about the implementation, I care about the ABI, and > >> I feel that your reply is not addressing my concern at all. > > > > Maybe I don't understand your concern. > > > > It's an on/off switch (like all options are). This is just a way to say > > "I want to indirect copying of the event before filtering or not". > > Not all tracefs options are booleans. The "current_tracer" file ABI "current_trace" is not an option. Look in /sys/kernel/tracing/options. They are all boolean. > exposes a string input/output parameter. I would recommend the same > for the equivalent of a "current_filter" file. I still do not see the benefit. The "current_filter" would expose just as much implementation that I can see. This option is just an knob to turn it on or off. Most options, nobody knows about, and are seldom used by anyone but me ;-) Once you put a file in the main directory, it become much more likely to be used. > > > > > The "input-argument" part above may never happen. What's different > > between tracefs and LTTng, is that all events are created by the > > subsystem not by me. You don't use the TRACE_EVENT() macro, but you > > need to manually create each event you care about yourself. It's more > > of a burden but you also then have the luxury of hooking to the input > > portion. That is not exposed, and that is by design. As that could > > possibly make all tracepoints an ABI, and you'll have people like > > peterz nacking any new tracepoint in the scheduler. He doesn't allow > > trace events anymore because of that exposure. > > I'm not arguing for moving to the input-argument scheme, I just used > this as an hypothetical example to show why we should not expose > internal implementation details to userspace which will prevent future > evolution only for the sake of having debugging knobs. Again, this is just a knob in the options directory, and not a full fledge feature. Options are not always guaranteed to be there, depending on the config. There's some options that are even created by what tracer is in "current_tracer". I added this mainly to be able to add a kselftest to stress test the discard code. If it would make you feel better, I could even add a config around it to have it only exposed if the config is enabled. -- Steve