Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp632826pxm; Fri, 25 Feb 2022 15:44:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJxGBGXDXDtPaPqvH/wmyHXUQRRJWTwY6k3FPMejlh9tWtS1iJ6AkhCyptAo804G8HulgNpa X-Received: by 2002:a17:906:18b2:b0:6d0:ee54:1add with SMTP id c18-20020a17090618b200b006d0ee541addmr7869948ejf.499.1645832683814; Fri, 25 Feb 2022 15:44:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645832683; cv=none; d=google.com; s=arc-20160816; b=iPueGa7Q6IjwAQ8e0XosvJEcZUh7zEzDCZtQLqGr0J2VG+UJ+OsDAuaaX7YuMGEI1J E6JoiCGMPgK/z0BTfZidcfQd7S4DFfnsFWcrsRAu5DfpQGlR98y35PXJq/W69N+/SbLz 9CUsJ7O7Meiuj1BoYAkku+l1B50ooxATEGM+QruiT3KSuqOsThaIV0Ps44rcj2bcwu6M 1LAxjETvRb/0WT72+nBjBLibh0ykaYYN+0PP+TyFy2mEGZ/Q6HkS/NSiexl6UY4zvbag ubz3Xj3gsHahsIIVtdNIpqWDRo+pE+ZiH/rEiyzZnumoyQ6lK7hTo61pgEU05IYhSmG+ IKrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=bN3Py078Pxpz7h9WyQ0MXubU+XbNvv/2Z7nGBycxXus=; b=Ctm5YBmAHexDtYt8gZ5gR3igKABeFxfAJcMLtf+dc+lnaMnlv6fokkG5IU2Sv9zime HL2ymN63BcDY+Yk8yYlgpSCXZCUoWyJb3gaDsoSUpGq+P4KLr5qTudtVKgQijYL8xFWZ 5CkXyXeqJOzn0d0+A97fBzFduYq9Jfa1TkuCMK0Aq5dhH7NKWf3HyceX/n8CswN+mo96 99q+sSLbA+2THM+kcdpMVNT7HQqmFK7fS3CfZt/m5r5XwKVNrEVK/bHga64TWM/8/1ni Hy639YNhd2A4wzuWQWnVHmsk+djjWIcADbTb04c59hwJJN+R7f1OkMyG178W8XESoPRc arWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fO4bx2GV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g6-20020a170906198600b006d637ebb31dsi1899354ejd.544.2022.02.25.15.44.13; Fri, 25 Feb 2022 15:44:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fO4bx2GV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S243441AbiBYRA4 (ORCPT + 99 others); Fri, 25 Feb 2022 12:00:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243225AbiBYRAz (ORCPT ); Fri, 25 Feb 2022 12:00:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47CB71D5291 for ; Fri, 25 Feb 2022 09:00:23 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F1FBDB832A2 for ; Fri, 25 Feb 2022 17:00:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D1C5C340E7; Fri, 25 Feb 2022 17:00:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645808420; bh=E4j8an9bJegwO5xzbv9+7z6wuEl0aLY1a9qiqGtx/eg=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=fO4bx2GVX8ZzgQtfq8wjZFHegj/Zz/WGuDV5UBugC2T4Xh3JtFAdo///nf9+bkZB1 gMgewnhmgpRmfWhcuoSl2+J+msRfmSyam1OvYyMWMcFOcEq6D4M/LiiK7lBzj4vE0W eIqszhMYXQD2m7qLTEqxkaCcc7XTGDeiMRysvmw0PG4vg5HU7mGJCNUC9ROdFhgptr fbq65c30E+Pe5dCqsKFN4tS0FW5II/+qsHMGcVv+IIEa1d4Y9xjP0u+lVrc0lgim9j wXKbIXKlRaGe7vv0UYvtIEZA/XNW/f/GUObtMX0sJo6pQM8N8HSdW4tDP+8CGVHL5K 7KOFbgY53RpOg== Message-ID: Subject: Re: [PATCH] tracing: Have traceon and traceoff trigger honor the instance From: Tom Zanussi To: Steven Rostedt , LKML Cc: Ingo Molnar , Andrew Morton , Daniel Bristot de Oliveira Date: Fri, 25 Feb 2022 11:00:18 -0600 In-Reply-To: <20220223223837.14f94ec3@rorschach.local.home> References: <20220223223837.14f94ec3@rorschach.local.home> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Steve, On Wed, 2022-02-23 at 22:38 -0500, Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > If a trigger is set on an event to disable or enable tracing within > an > instance, then tracing should be disabled or enabled in the instance > and > not at the top level, which is confusing to users. > > Cc: stable@vger.kernel.org > Fixes: ae63b31e4d0e2 ("tracing: Separate out trace events from global > variables") > Signed-off-by: Steven Rostedt (Google) > --- > kernel/trace/trace_events_trigger.c | 52 +++++++++++++++++++++++++ > ---- > 1 file changed, 46 insertions(+), 6 deletions(-) > > diff --git a/kernel/trace/trace_events_trigger.c > b/kernel/trace/trace_events_trigger.c > index e0d50c9577f3..efe563140f27 100644 > --- a/kernel/trace/trace_events_trigger.c > +++ b/kernel/trace/trace_events_trigger.c > @@ -1295,6 +1295,16 @@ traceon_trigger(struct event_trigger_data > *data, > struct trace_buffer *buffer, void *rec, > struct ring_buffer_event *event) > { > + struct trace_event_file *file = data->private_data; > + > + if (file) { > + if (tracer_tracing_is_on(file->tr)) > + return; > + > + tracer_tracing_on(file->tr); > + return; > + } > + > if (tracing_is_on()) > return; > > @@ -1306,8 +1316,15 @@ traceon_count_trigger(struct > event_trigger_data *data, > struct trace_buffer *buffer, void *rec, > struct ring_buffer_event *event) > { > - if (tracing_is_on()) > - return; > + struct trace_event_file *file = data->private_data; > + > + if (file) { > + if (tracer_tracing_is_on(file->tr)) > + return; > + } else { > + if (tracing_is_on()) > + return; > + } > > if (!data->count) > return; > @@ -1315,7 +1332,10 @@ traceon_count_trigger(struct > event_trigger_data *data, > if (data->count != -1) > (data->count)--; > > - tracing_on(); > + if (file) > + tracer_tracing_on(file->tr); > + else > + tracing_on(); > } > > static void > @@ -1323,6 +1343,16 @@ traceoff_trigger(struct event_trigger_data > *data, > struct trace_buffer *buffer, void *rec, > struct ring_buffer_event *event) > { > + struct trace_event_file *file = data->private_data; > + > + if (file) { > + if (!tracer_tracing_is_on(file->tr)) > + return; > + > + tracer_tracing_off(file->tr); > + return; > + } > + > if (!tracing_is_on()) > return; > > @@ -1334,8 +1364,15 @@ traceoff_count_trigger(struct > event_trigger_data *data, > struct trace_buffer *buffer, void *rec, > struct ring_buffer_event *event) > { > - if (!tracing_is_on()) > - return; > + struct trace_event_file *file = data->private_data; > + > + if (file) { > + if (!tracer_tracing_is_on(file->tr)) > + return; > + } else { > + if (!tracing_is_on()) > + return; > + } > > if (!data->count) > return; > @@ -1343,7 +1380,10 @@ traceoff_count_trigger(struct > event_trigger_data *data, > if (data->count != -1) > (data->count)--; > > - tracing_off(); > + if (file) > + tracer_tracing_off(file->tr); > + else > + tracing_off(); > } > > static int Looks good, Reviewed-by: Tom Zanussi Thanks, Tom