Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp393192rdh; Wed, 7 Feb 2024 07:47:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IFPg397LGRGgWvDoJfaSeo6pWPlsvG/FB3TgtROGKCbtofv2mKbJintzEwvEsNWwc++f7Jo X-Received: by 2002:a17:902:780e:b0:1d9:8770:a359 with SMTP id p14-20020a170902780e00b001d98770a359mr3923226pll.40.1707320837724; Wed, 07 Feb 2024 07:47:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707320837; cv=pass; d=google.com; s=arc-20160816; b=j55Iq49+DdsllK6zcLmSEfFh88zufzNEjf74dZDMYCniszrgWnZyoEVE2dV9vnSLwL ZC4NY6C9oAZRxfp48seiAUsE1OMVHtuQdfZB7k8sKxO5zU5oufdvvv1Fo1gUFh3s6Xnt wjfM2NW6+yhZaqNER75PaYsk7EOP6ANP2yumWTox0A2uZkMW3aWnF06LeOuIAVNt85bL 1V+wZ+sWzjzUWLNerH0QbsJYdRvh1hmomlweNLYoze9yajlyDuYYtRXwvN/GhqqQHxTc jm/STnHAZM/quHzLsG3ST1FzyRS+Wyzd5miuGUWow7hds4I3PKYlBaMcJ9HKLhEzZc0y fHHA== ARC-Message-Signature: i=2; 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=mdsQHNPnx6pQIIvEXsYl0y+fhEZEYseIari6Ser5iQs=; fh=46VZit1qjW3E6SaWYcYZzcutgg1HU6tMJngpWmTzQaI=; b=fx1jDL1Bw4AgcCq4Qv67hUuSIK/lckXwRz55T4rZ+t5/8E8tok5WbmuXErz9epJjI5 1X1EdrbFMZ+qbWpwOnUxiNJ1oPPS6jQt4dvVUE3OMK0R50kbo+oeMnfAUe8ue0BZ8G1+ H9ZNiNLbhK71vwK5+RZyks5T8kIOoD4dNJbb5qwvSIz6b937gT0HMSMpRvnrQgzmCs3o YoXrA35UXAv1I09G3kIKTysGBOQLbAzLN1G/vDQslgsc1NtYIJ5kSRJeiJI/HhKzWxRr SqT+cGYLfaGMaAqfTsYCEa3PjHZWgW2Uc/ZXIpOv0fSMroz77fVzSla06hDSL/2FpbpV jAUw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-56738-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56738-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCXXFOwnanEUhkuoH4s0uYpY+vb9VZwxUs/9/ZIDaPXiFUUZ2NCCboGJbNDKkFz8Y3smMlm+8U5H2JuvTEej0Ozc2AsjuCx/snEvOVYJUg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id z6-20020a170903018600b001d6e8fa5b3asi1914760plg.610.2024.02.07.07.47.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 07:47:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56738-linux.lists.archive=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-56738-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56738-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 17718287AF0 for ; Wed, 7 Feb 2024 15:47:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D2B98002F; Wed, 7 Feb 2024 15:47:10 +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 D641B7FBDE; Wed, 7 Feb 2024 15:47:09 +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=1707320829; cv=none; b=in4zsczbZ19tRAEAPqiwx6VxejN9G6y9N/DH+XUys3TmSh/ENeQp+aWXu/qxn5XMLDvYpeo+wQEUNyFgQDkLEhDVdmrtuBuQ/nLdzhzOOkhaodPkexUjaJx0Lk/Fcvt06gMGnMCPFW0UOs+x6ZPCJB3QmL4L1crSfWeLc1OwHjs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707320829; c=relaxed/simple; bh=OjwsOP8AG5skKI4fhs6803ooEFYrGsVmNA28weA5DaU=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JMckhjV7R44HvAvt6JX4FkNenE8sjGbE368J1ZnGfiUzVrHjUqii6omKQOImiH3Kf/CmD3mxF32/lXU8y0ONw25zdvJDX9JpzRUUNd2kioaHvE2vqSvfgqd7zpLnE7iZyNLAKbBNmC0p3E8eGRo41t3L9S7b6eZauiWomo9GGyc= 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 E7176C433F1; Wed, 7 Feb 2024 15:47:07 +0000 (UTC) Date: Wed, 7 Feb 2024 10:47:03 -0500 From: Steven Rostedt To: Sven Schnelle Cc: Mete Durlu , Masami Hiramatsu , Mathieu Desnoyers , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: Re: [PATCH] tracing: use ring_buffer_record_is_set_on() in tracer_tracing_is_on() Message-ID: <20240207104703.071ee985@rorschach.local.home> In-Reply-To: References: <20240205065340.2848065-1-svens@linux.ibm.com> <20240205075504.1b55f29c@rorschach.local.home> <20240205092353.523cc1ef@rorschach.local.home> <20240206060113.39c0f5bc@rorschach.local.home> <20240207060923.182ecb55@rorschach.local.home> <9a062196-ccbe-440e-a2f9-23eb8c5eb837@linux.ibm.com> <20240207072812.4a29235f@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 Wed, 07 Feb 2024 14:33:21 +0100 Sven Schnelle wrote: > My assumption without reading the code is that something like this > happens: > > CPU0 CPU1 > [ringbuffer enabled] > ring_buffer_write() > if (atomic_read(&buffer->record_disabled)) > goto out; > echo 0 > tracing_on > record_disabled |= RB_BUFFER_OFF > csum1=`md5sum trace` Note, the CPU1 is performing with preemption disabled, so for this to happen, something really bad happened on CPU0 to delay preempt disabled section so long to allow the trace to be read. Perhaps we should have the return of the echo 0 > tracing_on require a synchronize_rcu() to make sure all ring buffers see it disabled before it returns. But unless your system is doing something really stressed to cause the preempt disabled section to take so long, I highly doubt this was the race. -- Steve > [adds trace entry to ring buffer, > overwriting savedcmd_lines entry because > it thinks ring buffer is enabled] > csum2=`md5sum trace`