Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp268997rdh; Wed, 7 Feb 2024 04:28:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IG6sYQQFVHSSznJSQjwLyNcAvMcOA57BC4vADC6HN5I7MLQgU3mbeKUnq7FVbMIQMU/wFw/ X-Received: by 2002:ac2:43cf:0:b0:511:694b:245a with SMTP id u15-20020ac243cf000000b00511694b245amr307708lfl.58.1707308908204; Wed, 07 Feb 2024 04:28:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707308908; cv=pass; d=google.com; s=arc-20160816; b=sw5kne4/vC5Z6xuvMndUL4cyIgG1Olp5joGpYlohils94wZeft48PuOTFTblK32UN4 R1HYC3iDcOKiH3W8bsBlNG+VZ2bQ8Ua0UbNdzOvdJ+KGjgEdxjxPMkN9ijD5irH9eVAY k9fmJnMs7e1bG4w2hwGtQleqSK2kUIzmLzs02xcTmE7jxIWVYhxU0+RI0Q8TUI5N7gBT M6IEzNcWvZJQs3EIk/cl2Ff05leUD0RKDCFDX4q30rXLOivyk0eMNbdl+8V9Ti1gJQAS jsVBBhccuHLcFSjrpXa0K4JNVi+lV6k3I0LN+0wIp6OKNvBpNpiryC1zskPAUooOyUmW fHgQ== 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=ti4mDYFQdrPnBmm+RATrpZR8XvBljEKUc7F54UcGzT8=; fh=+JIT1iFBPkvCQZ9ObCkt2phoL6l/908KwnqwM+dMV/k=; b=cBO3/41XcbOuyoNqWTfcJvqnsadn9TJJY1uNqgWSFPgPF1oVdI4aJmyfYL0IywDWdN WBYUm2KvA8tvDy/ySbtQ8yIkeaTKvOCzx3Bd6UVFNEwuzWO92lluyLIWTxJim5y3Gfl5 rBOG2cv0yWUbbGKDFhJBTOnui9c74bNsTytdMS9XjIIzXNwYUgwDDCmbyfpMNojnnctx nDZ2A6a7tIMiQSCqEiF+aFdGXGzSzq6KxjWvPPGqTzETWqVvlWEZCfj9c21q7aNUN1fR VP9pOz7flnuPbuEgOB85tQZF501Dln9Vbo0EWZanmfySrFB5syR2jw/7k4ubFO3Ucyf7 iTWw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-56483-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56483-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCVkZHxqQYICWvoLhJ/kVuU1xGMMus62v2yrIWpktUE25/q6juSjdzFi4iOpoKL0QWGJyNW9aWLLaM0trc9R3FQnXgk0OzCi0D0uhoUOlw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ch21-20020a170906c2d500b00a3854ab9be9si944503ejb.675.2024.02.07.04.28.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 04:28:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56483-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-56483-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56483-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 am.mirrors.kernel.org (Postfix) with ESMTPS id E20B61F23014 for ; Wed, 7 Feb 2024 12:28:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BA7E75A0F9; Wed, 7 Feb 2024 12:28:20 +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 4161759B5B; Wed, 7 Feb 2024 12:28:19 +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=1707308900; cv=none; b=nYXRs43CkKR12/sySfrnvj6cWkzCEO/ID+64QCiBCPOhnhe0TBOEnBRfsLTGfAdGkehfhisBHISy726ZNVlTRE3jiZaIcKPStMqDmC5UubJ+n/Kdwy0dQUqzwglRKY1GMLoon8jX7i2mPS9iRnT9hIOcghpGS7MIh931Ikjrocw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707308900; c=relaxed/simple; bh=bB8ao9k5FwzcKPDglzpXKInrfcRJlfz/wXfTNITCd4A=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TdLGvn3ujPhtOXo4O7mFhwWPV6+C3tSRaA81e+4LM3V0PV+t6zs0XLgxfD1s0/H5Rqv6+IxQzFk+rC0wtlntLxs3Md9aMB3imZcaHb8XISHfKsXToAfbfnKVxbn2TjnROIDyP9oEV/jGQjV9arQ78SUy6fNaChYKpNakqS7pT58= 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 2DE19C43390; Wed, 7 Feb 2024 12:28:17 +0000 (UTC) Date: Wed, 7 Feb 2024 07:28:12 -0500 From: Steven Rostedt To: Mete Durlu Cc: Sven Schnelle , 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: <20240207072812.4a29235f@rorschach.local.home> In-Reply-To: <9a062196-ccbe-440e-a2f9-23eb8c5eb837@linux.ibm.com> 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> 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, 7 Feb 2024 13:07:36 +0100 Mete Durlu wrote: > wouldn't the following scenario explain the behavior we are seeing. > When using event triggers, trace uses lockless ringbuffer control paths. > If cmdline update and trace output reading is happening on different > cpus, the ordering can get messed up. > > 1. event happens and trace trigger tells ring buffer to stop writes > 2. (on cpu#1)test calculates checksum on current state of trace > output. > 3. (on cpu#2)not knowing about the trace buffers status yet, writer adds > a one last entry which would collide with a pid in cmdline map before > actually stopping. While (on cpu#1) checksum is being calculated, new > saved cmdlines entry is waiting for spinlocks to be unlocked and then > gets added. > 4. test calculates checksum again and finds that the trace output has > changed. <...> is put on collided pid. But the failure is here: on=`cat tracing_on` if [ $on != "0" ]; then fail "Tracing is not off" fi csum1=`md5sum trace` sleep $SLEEP_TIME csum2=`md5sum trace` if [ "$csum1" != "$csum2" ]; then fail "Tracing file is still changing" fi 1. tracing is off 2. do checksum of trace 3. sleep 4. do another checksum of trace 5. compare the two checksums Now how did they come up differently in that amount of time? The saved_cmdlines really should not have been updated. (note, I'm not against the patch, I just want to understand why this test really failed). -- Steve