Received: by 2002:ab2:788f:0:b0:1ee:8f2e:70ae with SMTP id b15csp307141lqi; Wed, 6 Mar 2024 19:06:32 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXJi1xoIXIVXzhoQisVtMg+oss3lOsolz4b+J7MMvM6JahQ5Fui7+xDJcdH3g+WLoX9sTRvAm1vrTlEX6Bu73lNHn5WpbRy11PLuLIdeA== X-Google-Smtp-Source: AGHT+IHvxUPVN7z1XXZvrpWE3Rve4EjHKUljSmYg0rcfABld+iuExPPVI7zs03roheCLJ9Yfy9jy X-Received: by 2002:ac2:4d0a:0:b0:513:46f1:f9cf with SMTP id r10-20020ac24d0a000000b0051346f1f9cfmr486330lfi.59.1709780792835; Wed, 06 Mar 2024 19:06:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709780792; cv=pass; d=google.com; s=arc-20160816; b=DSUF3OhkBu49yE1wUkMOaU0bRB1In5pmxGc5OewF2cNXpBpaTyeNi9IGb82X2fBfpM TRYzzUMfFWxNfHYPoZ06CB7K+cPDXV59IOA/7gb4H9bdVPaxlBfL0nbSY7AHbl+Pqq// zdstGydeyWCJaOliBVvi8fXuPbi0VU3t2fkjyBtPeNMD0GOTdsg9W8wzxS0bzkjMj3Wg tOmSPg/P80UloOEXaFCwxAJNXVvNm99LPNyUXUbompmFC+ZT6EHFwZE+V+mKFpqJFuHv GbZ7cSRGR8sUfXK/HQ0P42w8/G7+MWAyz8lp0zAtHtAaBi3v/7l00DyHfhVFM155P7pF /2lA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=FUoDyql8NQvBd8ffzAC2U9O3vmmu8F02QpSNE1xsSOw=; fh=5PcquSUNT0GC1HhaRSyQXuVNAaSAT+PIcv3z8DKrm+k=; b=TYZcvPYtJM/GDbOCAvjLfhfciPvHbIAOEqdeAwSfIAB/Xl4jqGlUOpq+TesvlLfwSz K3LUGmXSP2ZJnr7jL0N5FxC023LasgerWqvat0woqgs4z1a0lwUXGz+KsWhn7Kz1187N 3gCg5AVEOPP0gxS0PQW9KTKaRnSJKo5LDxxlOsn2hYeX5iv7+9arlA88MUrR1c1tp6bK v7FmMeXpI7ElxfL2+ag979f64oE2z/JWzy5wr6aIFoZW591a8tvyB6ZZTItYj8S2wF5Q +KdsBGG/Pplzv6bRcBo/IK+5Mrd9F+CT32jL+e65YwaMmFsnuathemc8bR49TpxUovSd c68w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=UbebClws; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-94906-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94906-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id o6-20020a17090611c600b00a45ae8e01c0si1670363eja.1050.2024.03.06.19.06.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 19:06:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-94906-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; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=UbebClws; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-94906-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94906-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com 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 8DE061F21C0F for ; Thu, 7 Mar 2024 03:06:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 81F1A10A0D; Thu, 7 Mar 2024 03:06:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="UbebClws" Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) (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 89E86CA62; Thu, 7 Mar 2024 03:06:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=167.114.26.122 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709780777; cv=none; b=FLBsXUKHf0JXLMyxwvh59VUKihCC5H05KAgGUhnRVbwqHyFjSqEus0N4IQl5YzBqxVtILV1oBhhuoO9XsvQexeWPTi807xYRAwXgherG19qwMq1HPdmWK3GgZnqb8O/rGp5ys75ogYeHGgmBqWoB4nKc10czZgmmpcH2CqCig+c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709780777; c=relaxed/simple; bh=9mP0EJZ5E3oSsjpDu7iTl0ddJg7+xj8Uhkioumdgbps=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=EdllFLndJrtju6l34c1lNGZNKu4GGRY8s4mekCbAUvsXv7yoPS9UhOPPGxY5TtKl4ZPs/s4ywqKPHf3ADS8u27zcyMEOClJKaE9UzAyIB5BKJE+n3sdrQ34RKTcGv9wYaADJo/M6kh5OyQlI56MepGKtg9N7+eBDnaUnIwyBCQk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com; spf=pass smtp.mailfrom=efficios.com; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b=UbebClws; arc=none smtp.client-ip=167.114.26.122 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1709780773; bh=9mP0EJZ5E3oSsjpDu7iTl0ddJg7+xj8Uhkioumdgbps=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=UbebClwsLIxdCMMqed0pnzib3A4ttXjas8h8rvHYyJqNJIYheJgbGnTOMOSfCg9tA 6zDCypsBDGj761BVI7yGg7yQFPr0NGM+YB6TtUS8zRCa9LOrUESrJ5FF+6sV5W91ag vxwhIqJyHSAEZs87VrleunK51fLqLsVnzToddllU3mHFbczMhF2QdD1ofpcqGePecq N4Gi/offJnzTcRRwxYdMu1g8FhvNkgK6wdvkPGMkTxnD/0yeYK2anZ4TzGkAWdtCq7 So/s6vPP6ZoT7xXT9X7YL5uMac/PRmwUw8uy9X7p5elN0oD8ZvaC+ESjlAsztPyKg5 m7vLn3uZE/BAg== Received: from [IPV6:2606:6d00:100:4000:cacb:9855:de1f:ded2] (unknown [IPv6:2606:6d00:100:4000:cacb:9855:de1f:ded2]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TqvMS6c9BzgSw; Wed, 6 Mar 2024 22:06:12 -0500 (EST) Message-ID: <851dc594-d2ea-4050-b7c6-e33a1cddf3a1@efficios.com> Date: Wed, 6 Mar 2024 22:06:21 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] rcutorture: Fix rcu_torture_pipe_update_one()/rcu_torture_writer() data race and concurrency bug Content-Language: en-US To: Linus Torvalds , paulmck@kernel.org Cc: Steven Rostedt , linke li , joel@joelfernandes.org, boqun.feng@gmail.com, dave@stgolabs.net, frederic@kernel.org, jiangshanlai@gmail.com, josh@joshtriplett.org, linux-kernel@vger.kernel.org, qiang.zhang1211@gmail.com, quic_neeraju@quicinc.com, rcu@vger.kernel.org References: <20240306103719.1d241b93@gandalf.local.home> <27665890-8314-4252-8622-1e019fee27e4@paulmck-laptop> <20240306130103.6da71ddf@gandalf.local.home> <20240306135504.2b3872ef@gandalf.local.home> <20240306142738.7b66a716@rorschach.local.home> <83b47424-e5e0-46de-aa63-d413a5aa6cec@paulmck-laptop> From: Mathieu Desnoyers In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024-03-06 21:43, Linus Torvalds wrote: [...] > > Honestly, this all makes me think that we'd be *much* better off > showing the real "handoff" with smp_store_release() and > smp_load_acquire(). We've done something similar in liburcu (userspace code) to allow Thread Sanitizer to understand the happens-before relationships within the RCU implementations and lock-free data structures. Moving to load-acquire/store-release (C11 model in our case) allowed us to provide enough happens-before relationship for Thread Sanitizer to understand what is happening under the hood in liburcu and perform relevant race detection of user code. As far as the WRITE_ONCE(x, READ_ONCE(x) + 1) pattern is concerned, the only valid use-case I can think of is split counters or RCU implementations where there is a single updater doing the increment, and one or more concurrent reader threads that need to snapshot a consistent value with READ_ONCE(). Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com