[for-next,12/13] tracing: Fix snapshot counter going between two tracers that use it
Message ID | 20240223141903.347912102@goodmis.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-78465-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp614024dyb; Fri, 23 Feb 2024 06:19:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUdmCsZrj0p9P+7hvseGa8DnXI90h9iHOfY+SClq10E92GzV2vwmHaet/Vn4sYf8uf8rS9VrcZaK202R0LThxxg403qPQ== X-Google-Smtp-Source: AGHT+IH8WhM3ovRGQsLHo+F/Y3xt2SbcgDjwzf8D0OBv97SoBHHwT7mlpZVKLqRnYVe+nKcZOnwL X-Received: by 2002:a05:6a00:4f89:b0:6e4:8d20:66ed with SMTP id ld9-20020a056a004f8900b006e48d2066edmr8781837pfb.3.1708697977494; Fri, 23 Feb 2024 06:19:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708697977; cv=pass; d=google.com; s=arc-20160816; b=djdJcuJrapG8qNhHVHcxv14dU+ryTjhHWKIUyXfD1GvSTUDCajbGo9padLDZSYqha1 eaEGELNoiSxEF9RZrCt2wQgAX+WnRd8tX+mplA17TWqHICWyDoCprZ+DS7+nINTyCVCd +lQI/30FMXyiQso6cFqWc1EItN15nkhKxP+rdlqCEcPts97SS330W+Uev6PbswWzF9LZ lSJCurGO0yXbG7QXp3HyZIP07ytN2Qu1jC2nGTKR54BanvMMaiBHZnGDFtRwDwufwZr4 cEUOUS4sLX98h9Vx5y/6kb8wOZTcY0PCY5adtfW7xH/gR0NyKqcuoz2ohzq6t63Nh2yg YZQg== ARC-Message-Signature: i=2; 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=C5+AGh4zdaJfQhNkAJbgU49ZxT/YAONw70FOvbi6KW4=; fh=5BBsyHlB8a39iZRylNlRwq68Y8N1HTURv9NhE+MQefE=; b=nt7m6jPuRWppeHuQVbuHZExr0PtTYrLmCQqPlXkS3XugYeO9Hh1RjR0Qd7qcCdqrD5 CFlhUu0+g9CTNjE0SUK5Rj9CTLFy5h7MhCkSxtYQHzL+4SpPw6gy3fcX6VwXn10RFDKB kElsiTY65k6Du0YX2Ca7Aur1khfOnr+1BbliqetgbsvAW1iJrMgRXmauzMGUOw50mbD3 SyoA3NAUoDdccpismIgShguB076M+b/mL9r4G27V3BXZOZK+lbFXmE07EQEaSNLoKbAj 6HOvLniV+P8WS45qoa+91wbIkAo0ZkhlYiEk+3shKC4aIMyB1Ur3NlB0jjnxnwo/bN9e r/tQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-78465-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78465-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id a27-20020a630b5b000000b005dc87f9cc80si11801327pgl.553.2024.02.23.06.19.37 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 06:19:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78465-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-78465-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78465-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 4FD18285246 for <ouuuleilei@gmail.com>; Fri, 23 Feb 2024 14:19:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9F6768662D; Fri, 23 Feb 2024 14:17:13 +0000 (UTC) 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 9FC3B823D9 for <linux-kernel@vger.kernel.org>; Fri, 23 Feb 2024 14:17:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708697830; cv=none; b=PkyqrRVIRGLfQqMOmEhw8l/8bVL7/PrhzfZ2c7hkUiQuXZbSgMpgy6MAWeuBuw7MwwjtDE7mCtmNWU2VDpoqsXeM6OROOuNQy2thyjdL4p2GAeX40DOSfFqzcQQyBcQzob73/tJfoApaI5/jnMjMyrUCTlzGN37PPwxX20bRuhI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708697830; c=relaxed/simple; bh=SSAkBsKZDXS3J7H5zDJ3fM4StROONFq7WOqxGyruuNk=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=JlqaSG1tA/xd47yOlaOmX2UFbXGjNm92lgBga0dgbp8WFFNVrSLccWhZfZhaKL38tVJ9efe0YsPgn68Q1HImqUiY7j0X3H7Sz1fYc4VdYtEx+VzZVHqMm1/goLW+yhYUCfgR/4CQGwthXahSBt0AARjPdXXPODzp1jA9xT0c4OI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80E06C43142; Fri, 23 Feb 2024 14:17:10 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from <rostedt@goodmis.org>) id 1rdWOF-000000077Qf-23xN; Fri, 23 Feb 2024 09:19:03 -0500 Message-ID: <20240223141903.347912102@goodmis.org> User-Agent: quilt/0.67 Date: Fri, 23 Feb 2024 09:18:50 -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>, Vincent Donnefort <vdonnefort@google.com> Subject: [for-next][PATCH 12/13] tracing: Fix snapshot counter going between two tracers that use it References: <20240223141838.985298316@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: 1791699690757077431 X-GMAIL-MSGID: 1791699690757077431 |
Series |
tracing: Updates for 6.9
|
|
Commit Message
Steven Rostedt
Feb. 23, 2024, 2:18 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org> Running the ftrace selftests caused the ring buffer mapping test to fail. Investigating, I found that the snapshot counter would be incremented every time a tracer that uses the snapshot is enabled even if the snapshot was used by the previous tracer. That is: # cd /sys/kernel/tracing # echo wakeup_rt > current_tracer # echo wakeup_dl > current_tracer # echo nop > current_tracer would leave the snapshot counter at 1 and not zero. That's because the enabling of wakeup_dl would increment the counter again but the setting the tracer to nop would only decrement it once. Do not arm the snapshot for a tracer if the previous tracer already had it armed. Link: https://lore.kernel.org/linux-trace-kernel/20240223013344.570525723@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: Vincent Donnefort <vdonnefort@google.com> Fixes: 16f7e48ffc53a ("tracing: Add snapshot refcount") Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> --- kernel/trace/trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index f56b3275c676..1bcfbc21fb3e 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -6148,7 +6148,7 @@ int tracing_set_tracer(struct trace_array *tr, const char *buf) tracing_disarm_snapshot(tr); } - if (t->use_max_tr) { + if (!had_max_tr && t->use_max_tr) { ret = tracing_arm_snapshot_locked(tr); if (ret) goto out;