Received: by 2002:ab2:788f:0:b0:1ee:8f2e:70ae with SMTP id b15csp111470lqi; Wed, 6 Mar 2024 11:28:03 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWdwRqCXzJS2RN4zGjKB1yPwEtG+zakNUtY61GRWyQFuHqc5pa6icLc4VvFNIs4iHAmZc/OnGUsJAFTBW/+zikSz0NuD/N8XvgsU9s3AA== X-Google-Smtp-Source: AGHT+IFAnB1FolRWptQA0Egjn6lDbPCPklQKwzgHUyI2tMrhE0IYs0hQLmF2dBeq6Xy5BH3CTaaJ X-Received: by 2002:a2e:a0d8:0:b0:2d3:3305:c380 with SMTP id f24-20020a2ea0d8000000b002d33305c380mr4479ljm.5.1709753283737; Wed, 06 Mar 2024 11:28:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709753283; cv=pass; d=google.com; s=arc-20160816; b=r4dHQyHJbuap8rBbH5KbMheN/Pu7H8zHcmGjS4TFIMzsbFGXXaWngRkF0zGzGpuI1A EGEZwNy8TEhj36T8FBd3mKP+3lTgA8zi+taT+TTgsER/MrfbxzK/+vlNKX+8CX8dQnEn pyhc/rSy0NQzx6Gwviu3/UD/l9nOKc7VCcfoBcr51UwZ/UxPqeQcLKPFuX9ymGiBFx1X H2CUaAxtq6v5fXAxLPkBUQ2WmlLDj9w2o634T2dASEXfGyDAWDt4bkPXvbn2Bt0x2Qmo u139iUZZqzl9zOVS7gzJOxF6G/q0sg+cMt49/5K7r36JuMrYPU61v9pWdXzzhzgMAe0a HxkA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=z2w7z8ybAhp0MNUwIXPYOARG82rdSVFWAVwXlDOSGiE=; fh=0ZKt23KdefNcKHM9dl/qRFqf2XobvPXSoEAzxzGeMEc=; b=IfW7JGoVKiECmBr/VKm9B65/xJ3L+tsjF/vkbR+dvWq3ZIzZ1EsM76Xt5pKOel1XC8 IyXDJRnhIdNLbquzTLrmbpex+pGvBmbftIJaY6Y1FSG6pdUWye5+qOLyfVL3oRTBkZ4i glzF1c4LlJG29ZbJemHRY7jRoPmnLm8uAncBFPZhg7zPJ7IrbU0h4oFvnVxVJO15gJ0L 9DYoZao63NGp0AtlmX++N8UVRJdkjsTs+xsbWwUMI6J63UPh585QroN0+HUo05WxwqJz zco5M/GZZ4JjfEP4On0KoyCcZUUuwFT1yLX1zyEowO9Z3eU9PLhp4LbW6X+7B9s3gW5b uMCw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=a4F5+Yed; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-94477-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94477-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id r22-20020a50d696000000b005664c403c45si6319965edi.317.2024.03.06.11.28.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 11:28:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-94477-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=a4F5+Yed; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-94477-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94477-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 0B06A1F247D7 for ; Wed, 6 Mar 2024 19:27:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B4B56692E6; Wed, 6 Mar 2024 19:27:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="a4F5+Yed" Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5DE913E7F8 for ; Wed, 6 Mar 2024 19:27:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709753246; cv=none; b=O+sPr6r+mwItI988Jyep/rAVCw4pkMI5T1O7ZxKVPJfvv9pLo2LEK/S6EV9CqpMUTfcuIodfR+DzkkGWwjKrMVswsxxHuuDK1Er2DpMLJFDlqDugvw0ccizeT7LcCotAUubMs98KchOJHdJldbUiwLQ8asNO65ViCbcwnBBrYK8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709753246; c=relaxed/simple; bh=biMnzxi6lyL4tJNfmpHNxn2LaDWRe4gzMKaFKNTV9dI=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=JNRnSeSXF8h7l5ECw8jSsmMhXSmAFiv2UPfqE5+bRtn4NmCLJsF6RD4nebWF9IO2z3wSNAoMqjRsoMKQbR9CluLrzKj638JUt+l0W1uD+rr95VeD4+P+sSf1gAojfZDRKeFRNOmAdATGJabm40aGOUwqlBJ8/fLeR+zei0UZsmo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=a4F5+Yed; arc=none smtp.client-ip=209.85.167.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-5131f3fc695so30908e87.1 for ; Wed, 06 Mar 2024 11:27:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1709753243; x=1710358043; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=z2w7z8ybAhp0MNUwIXPYOARG82rdSVFWAVwXlDOSGiE=; b=a4F5+Yedmw2o1YViXTjGIFjp1dnhjAZoNpa/4DrV3c8X0RmNFy68Y4vxrGnt5HmM3P Hz0JT4jrnqUJE3wuISJZEpjJfDGl/PJlcajfGPEziwH1mr+81EqD0rcZWffWbISqcD98 2a6otZkUEPuV7OVkuARvsGu2eo1kCKk2PZTiM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709753243; x=1710358043; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=z2w7z8ybAhp0MNUwIXPYOARG82rdSVFWAVwXlDOSGiE=; b=Amkp/FjZ7EdqfhaRDDbweKD4LvZJ2mIYudkO7hY+yoZH5Q1LEJ/xi0qlHSzhyXtGj1 wpejonLKikl1CKWcBaDScwMWWPvn2vPKZlxoedARxrumD6mUAHhKx3wqlHvPtjgJ06Mj mFwfNPOjnrkzY5fURbMdVI7MfR3PvEgo5JimqGBKr2rDWFZlnlsrYJVkOhR7Y+lpm2AJ idwu3n8np8ahzofFmaXTdwKOg0s/jiZ5757jXBdvnlgYT5ucRqkKKbsHbgN2Io9ttJzU T7J1/4TXodXurw/N3Pu5IEPvQDWFUCdFkV7rULSSQXexcVCOYqfnFq9zzcmIPC2BAOPc YjYg== X-Forwarded-Encrypted: i=1; AJvYcCXxhyVsWWKsMeJn1v5DziHCIupbFR6t8ePXoIrpMdTuQY3+AWpUKMThzSc62EOi1TBLkKuYryrud6kDFPcE52J9Di4hLaAwaXFza20x X-Gm-Message-State: AOJu0YwpBR4xZIqOPWa1kRUr6B7IDI7n57UeyTwSK/VIdgBxbdnfeecn JgihEuEzkIEimCh720zYo7ZwZXWk3zyN0fiMnt6I4VZafoqTbysTwhm58mj2QmYupviUdXrJzFs wUN8= X-Received: by 2002:a05:6512:281a:b0:513:24b8:a7b1 with SMTP id cf26-20020a056512281a00b0051324b8a7b1mr41424lfb.47.1709753242885; Wed, 06 Mar 2024 11:27:22 -0800 (PST) Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com. [209.85.167.43]) by smtp.gmail.com with ESMTPSA id t26-20020ac24c1a000000b005131f4fca05sm2710186lfq.152.2024.03.06.11.27.21 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Mar 2024 11:27:22 -0800 (PST) Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-5135486cfccso49114e87.0 for ; Wed, 06 Mar 2024 11:27:21 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCV8asXPpDAr1lZsfM4AWZrmhckcho2cGudn2xuyN0Ine3zw3p7miGQMQpx2mVsnQWhdDYnYT7+kzeEbeQND4NE2U5cvifaWr7020dD4 X-Received: by 2002:a05:6512:3b9f:b0:512:a4ce:abaa with SMTP id g31-20020a0565123b9f00b00512a4ceabaamr54463lfv.48.1709753241495; Wed, 06 Mar 2024 11:27:21 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240306103719.1d241b93@gandalf.local.home> <27665890-8314-4252-8622-1e019fee27e4@paulmck-laptop> <20240306130103.6da71ddf@gandalf.local.home> <20240306135504.2b3872ef@gandalf.local.home> In-Reply-To: From: Linus Torvalds Date: Wed, 6 Mar 2024 11:27:04 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] rcutorture: Fix rcu_torture_pipe_update_one()/rcu_torture_writer() data race and concurrency bug To: Steven Rostedt Cc: "Paul E. McKenney" , 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, mathieu.desnoyers@efficios.com, qiang.zhang1211@gmail.com, quic_neeraju@quicinc.com, rcu@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Wed, 6 Mar 2024 at 11:01, Linus Torvalds wrote: > > In some individual tracing C file where it has a comment above it how > it's braindamaged and unsafe and talking about why it's ok in that > particular context? Go wild. Actually, I take that back. Even in a random C file, the naming makes no sense. There's no "once" about it. So if you want to do something like #define UNSAFE_INCREMENTISH(x) (WRITE_ONCE(a, READ_ONCE(a) + 1)) then that's fine, I guess. Because that's what the operation is. It's not safe, and it's not an increment, but it _approximates_ an increment most of the time. So UNSAFE_INCREMENTISH() pretty much perfectly describes what it is doing. Note that you'll also almost certainly end up with worse code generation, ie don't expect to see a single "inc" instruction (or "add $1") for the above. Because at least for gcc, the volatiles involved with those "ONCE" operations end up often generating much worse code, so rather than an "inc" instruction, you'll almost certainly get "load+add+store" and the inevitable code expansion and extra register use. I really don't know what you want to do, but it smells bad. A big comment about why you'd want that "incrementish" operation will be needed. To me, this smells like "Steven did something fundamentally wrong again, some tool is now complaining about it, and Steven doesn't want to fix the problem but instead paper over it again". Not a good look. But I don't have a link to the original report, and I'm not thrilled enough about this to go looking for it. Linus