Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3112116pxm; Mon, 28 Feb 2022 12:15:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJyc20q3W7VY6VZSFtLx8dCtpnaB74GCgazmBvl4kyiumcLiD9n2qVcsfl1ZMkiMqw9Pjkcz X-Received: by 2002:a17:90b:fd5:b0:1bd:2757:24a2 with SMTP id gd21-20020a17090b0fd500b001bd275724a2mr11433115pjb.141.1646079336175; Mon, 28 Feb 2022 12:15:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646079336; cv=none; d=google.com; s=arc-20160816; b=O9SJuK8RwCiqDH4+HDyOHODU4eg2PGxU6iWtJ0FzAYmXNE/gDUzBDXPzfdlO+eCj+4 OgHH5t5tEJFbesglquqx1Vw8CbL02fQLivuP4YSoLkEeufM9b92ttC7MYn9n7NBiMXCC J0jmjB/stAp62LXxf9cpWs6vNnRuaygil8UIaelUc6wf+5RYZT8hmKNzAiPPa+Kt3OpM bEASv18MHoup698psK9O2qKRbbZAazdx0suz3mrPw1C5mC4qnaVAfvnZtWybdGes0k21 TCgPCFFVvLMENNXaABJo4h4jRgpdhqFCMlWylwtrwP7F/K+PShxEiu4tMkwx6XamRyg0 qQIQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wqhdo0vk6Rs/YwRS/0kM/7hSAmrnha/GINhFH/Sy2ag=; b=LQqBiEfj+67FoMulNZB/absAWeCCVK8NLbJelO+s9DGm+JauzDUV07L6EqXlApBrXH 58AQLjkBokzeZMW0vVErNhdsMzz/OYR9T/f/Q7rW2CCVtAzFsxc8vkknEfJh7hQeDlXA 401AgL5QpOWcBfia/wK8M4840ATMFayTjAsdBzPsAgPJIZ1WOaFxym7irnyWNgBYE5Aa JvcqxsRTPAA86yqWWygtJME2Rh8Iht5NPqLKoNVgr6b02A4DuRx0R9t6DIok5KScxn1y q7zxUsojPBJuqDCVwCvuWQXIdNc6LOKFpnyMwIWEa2m/QW2p779d0QJbgfvcV6sKLjfB 1TGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=U8FXphQh; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id a4-20020a17090a854400b001bca943b6ccsi342601pjw.150.2022.02.28.12.15.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 12:15:36 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=U8FXphQh; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 15EBE179259; Mon, 28 Feb 2022 11:37:45 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240330AbiB1SIl (ORCPT + 99 others); Mon, 28 Feb 2022 13:08:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240651AbiB1SDp (ORCPT ); Mon, 28 Feb 2022 13:03:45 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CBE5F13; Mon, 28 Feb 2022 09:47:33 -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 sin.source.kernel.org (Postfix) with ESMTPS id BC09BCE177C; Mon, 28 Feb 2022 17:47:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFC46C340E7; Mon, 28 Feb 2022 17:47:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646070448; bh=KCalSnuWuzSfa+L8A6ehOYwa/W3kEiG0HRBRIYFecX0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U8FXphQhAAxjNe1ItEAsKlvq9nxSlfzJZOBKX+TFsqSS78s7TYpxmhKiaQm9jI9NM hRQzFFqhksQACmHDOAKsdDU+HZdOKOfbySIQRI+u68berykztgelhYTSoYqkni5svF lL03AzydyWQdCAQZrViLZF2pKRZQz9nqEko3B5Xs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Bristot de Oliveira , Tom Zanussi , "Steven Rostedt (Google)" Subject: [PATCH 5.16 113/164] tracing: Have traceon and traceoff trigger honor the instance Date: Mon, 28 Feb 2022 18:24:35 +0100 Message-Id: <20220228172410.703348887@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172359.567256961@linuxfoundation.org> References: <20220228172359.567256961@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 From: Steven Rostedt (Google) commit 302e9edd54985f584cfc180098f3554774126969 upstream. 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. Link: https://lkml.kernel.org/r/20220223223837.14f94ec3@rorschach.local.home Cc: stable@vger.kernel.org Fixes: ae63b31e4d0e2 ("tracing: Separate out trace events from global variables") Tested-by: Daniel Bristot de Oliveira Reviewed-by: Tom Zanussi Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace_events_trigger.c | 52 +++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 6 deletions(-) --- a/kernel/trace/trace_events_trigger.c +++ b/kernel/trace/trace_events_trigger.c @@ -955,6 +955,16 @@ traceon_trigger(struct event_trigger_dat 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; @@ -966,8 +976,15 @@ traceon_count_trigger(struct event_trigg 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; @@ -975,7 +992,10 @@ traceon_count_trigger(struct event_trigg if (data->count != -1) (data->count)--; - tracing_on(); + if (file) + tracer_tracing_on(file->tr); + else + tracing_on(); } static void @@ -983,6 +1003,16 @@ traceoff_trigger(struct event_trigger_da 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; @@ -994,8 +1024,15 @@ traceoff_count_trigger(struct event_trig 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; @@ -1003,7 +1040,10 @@ traceoff_count_trigger(struct event_trig if (data->count != -1) (data->count)--; - tracing_off(); + if (file) + tracer_tracing_off(file->tr); + else + tracing_off(); } static int