[for-next,10/16] tracing: Stop the tracing while changing the ring buffer subbuf size
Message ID | 20231221161105.083563911@goodmis.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-8734-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp518716dyi; Thu, 21 Dec 2023 08:14:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IEwdb4sjjJ008i8OM10PJoFAY9lygd9nvhO/gSFk8/xnfn98jvWops9ZiBax75CXhZx8WpZ X-Received: by 2002:a17:902:fc8e:b0:1d3:fbf6:4d94 with SMTP id mf14-20020a170902fc8e00b001d3fbf64d94mr1847697plb.75.1703175273481; Thu, 21 Dec 2023 08:14:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703175273; cv=none; d=google.com; s=arc-20160816; b=bBY6JugsiLNwSf4oEP08eHOeBpEPCtIzsDAiweXuJbduAYTIAq3ZmN+gU1cyc4VZg0 k7xZ62h23L1kr8ZEmNtfTM7QKauN+rYH4PXY6S5KaAmrS4xLdkP/lKSZ1B8APbybsTjN tLUmbJzNzMq7xtAe5njoCosrnkb4XmaAEmZeLxq8TrbLsX6KoAp4rKZpgFAQhjurg1v0 xmqSDwkXUDQbmZ7YMclIFRB7hs/E3suKN2VzDRKOgrspB9D7HNYWiXzIUxq1/xrdqxjl CQFYTaoBo5tXE/PTF1n8vCJhcGrBXI4PCFqXxrSdgqJARDWQwkOa6TRk/uhcopUnvQfF pMQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:subject:cc:to:from:date:user-agent:message-id; bh=5hNWDqgSFY9AXxJ8P0I9Rkvn5qtR5h3YHL9ykj1XeeM=; fh=e3UoLP0GGIVG/JuDivUt2G6X10h9sIOfzt1IJTPiLuw=; b=AD5YdoLmlQLFBH/VEmhgf59nCQuj3Uc2A5UFQvStbdPpQPlFh9uBtBDWwMRHDcWFFg GpYK4S+AiGj8E4a7zc65JMYY46TjbmJL4oKf06xA8M5GQFsK9rFTHM7WHQpXPx9bcZEw w7GsNxNdXyjEW0k/0KmmH5B3xfj3upaRDmAleJAPXEcGwp0NL19t0vvjsUHz+oB/tJHl j4b4/A1KH2Gdj22Gra8SucjolYYXBbe+jn0tndIq92cSZj2kgisCtZvMQexkuVUFLlXL ed9cKrIdcYLJEYBV+i7Nk43BcdlZqhu2sKhPlgz9FPRAI2pkQhpcs8Bl84gfhq4TrWdp G8Fg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-8734-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8734-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id o17-20020a170902d4d100b001d0a0ee28e0si1722310plg.288.2023.12.21.08.14.32 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 08:14:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8734-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-8734-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8734-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id C1E7FB233F7 for <ouuuleilei@gmail.com>; Thu, 21 Dec 2023 16:13:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8266473182; Thu, 21 Dec 2023 16:10:03 +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 B3AE2634E1 for <linux-kernel@vger.kernel.org>; Thu, 21 Dec 2023 16:10:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 522E4C433CA; Thu, 21 Dec 2023 16:10:01 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from <rostedt@goodmis.org>) id 1rGLdZ-000000041L3-1Jnc; Thu, 21 Dec 2023 11:11:05 -0500 Message-ID: <20231221161105.083563911@goodmis.org> User-Agent: quilt/0.67 Date: Thu, 21 Dec 2023 11:10:34 -0500 From: Steven Rostedt <rostedt@goodmis.org> To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu <mhiramat@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Mathieu Desnoyers <mathieu.desnoyers@efficios.com>, Andrew Morton <akpm@linux-foundation.org>, Tzvetomir Stoyanov <tz.stoyanov@gmail.com>, Vincent Donnefort <vdonnefort@google.com>, Kent Overstreet <kent.overstreet@gmail.com> Subject: [for-next][PATCH 10/16] tracing: Stop the tracing while changing the ring buffer subbuf size References: <20231221161024.478795180@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785908715540060673 X-GMAIL-MSGID: 1785908715540060673 |
Series |
tracing: Add dynamic sub-buffer size for 6.8
|
|
Commit Message
Steven Rostedt
Dec. 21, 2023, 4:10 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org> Because the main buffer and the snapshot buffer need to be the same for some tracers, otherwise it will fail and disable all tracing, the tracers need to be stopped while updating the sub buffer sizes so that the tracers see the main and snapshot buffers with the same sub buffer size. Link: https://lore.kernel.org/linux-trace-kernel/20231219185630.353222794@goodmis.org Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Tzvetomir Stoyanov <tz.stoyanov@gmail.com> Cc: Vincent Donnefort <vdonnefort@google.com> Cc: Kent Overstreet <kent.overstreet@gmail.com> Fixes: 2808e31ec12e ("ring-buffer: Add interface for configuring trace sub buffer size") Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> --- kernel/trace/trace.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 2439e00aa4ce..82303bd2bba1 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -9412,13 +9412,16 @@ buffer_order_write(struct file *filp, const char __user *ubuf, if (val < 0 || val > 7) return -EINVAL; + /* Do not allow tracing while changing the order of the ring buffer */ + tracing_stop_tr(tr); + old_order = ring_buffer_subbuf_order_get(tr->array_buffer.buffer); if (old_order == val) - return 0; + goto out; ret = ring_buffer_subbuf_order_set(tr->array_buffer.buffer, val); if (ret) - return 0; + goto out; #ifdef CONFIG_TRACER_MAX_TRACE @@ -9445,11 +9448,15 @@ buffer_order_write(struct file *filp, const char __user *ubuf, */ tracing_disabled = 1; } - return ret; + goto out; } out_max: #endif (*ppos)++; + out: + if (ret) + cnt = ret; + tracing_start_tr(tr); return cnt; }