From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (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 00CE521516F for ; Wed, 22 Jan 2025 19:11:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737573092; cv=none; b=UeTu4ZZE2YWj97sCoLQfyuwDbj4MbELkAEKA+gaSbGqZhu0ftHPIONsfFLJrXIx0iy87lo2KvyDHdpuAQk49qpkRbESmy6t6vs3SqZTBHAXlr06L7kvueWc21W0+rd6NYhNhCe9yGENoZTvAoH82QONvxWWn58MC5BC5umrB2F8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737573092; c=relaxed/simple; bh=Z1yqNPZlOeRExYM4QTHz8AnmHzshpip7umUeC08sWaQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=vFAVS8KFeGkcbHdMPzt/5WiJE8WbjXPr/m+cEvcU7csP/lF7ExVAqrRkpqgUKOob7lcsSNqa6MP1BjSEnkDuVtilr5I2k36uf6f7jJe63L+cAj+j35Ko4N3tRGxHF0JeL3I8v8QLYeGwvYLR8l2/tn6PLVR6ODYcMa5Jjio0cGQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rowland.harvard.edu; spf=fail smtp.mailfrom=g.harvard.edu; dkim=pass (2048-bit key) header.d=rowland.harvard.edu header.i=@rowland.harvard.edu header.b=tta0eihV; arc=none smtp.client-ip=209.85.222.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rowland.harvard.edu Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=g.harvard.edu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rowland.harvard.edu header.i=@rowland.harvard.edu header.b="tta0eihV" Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-7b7041273ddso2838885a.3 for ; Wed, 22 Jan 2025 11:11:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rowland.harvard.edu; s=google; t=1737573090; x=1738177890; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=GMK9+KLD3vkM1I8BSPYO4/dY05c/HFcM+aj2IVm+X2U=; b=tta0eihVldc34u5tgv6Ujjjfy/cG6jeyPlfyojUWROl9X21T4jC3BfaycuHyuEMZy2 Q/0W07CLKc2bYhtAe8aWsFdmagY0omUSXM7qkZ7zwhUuQJ+bVw4/0ohCOfCASCUvQS3U 4S03sT+e63Lpv8fzN2Yva9Wc0bU4nbovC/qj7U+PcMf0mDdlvvKdOGoSFLQYe5nfikft Mh+CbXvnOyOzVVGreRBzIhvrDwzPeBXJ6B6z0qIUbfl1qwQGffldMT4XNLstbDV3qKNf lJSzrsQkbxYWEk2GW/q3awrMJj5P73EJ+ZkEjxXn/RG6R58In3cbMhK5+aUKQ/d1FXBr BgBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737573090; x=1738177890; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=GMK9+KLD3vkM1I8BSPYO4/dY05c/HFcM+aj2IVm+X2U=; b=gRGOihyl697D5QFlq7abc2v/RVAQsIJxYnN+yVPtlBj9xjBSJFTmNuQKFck3aAqCIn CXy8r5xsCfuf0+zUh3KGeDrae2olbH8XGtBcrit3rmYQ+iVkZxa4bIgb2r8h7iTHnaMC KoOEV5IbavwAF7acidie5HkNBpeWFese0s5ihQeB7PpdXJyRCLHKbn57PaHgH34KQxc2 ah0WYNd7FeINkmOnpI1fxNadi8113AKy/2kac/MOVKozXv3uGj/475dh4yCC+OQY/JFE 3S6eqRPLwq5brjfSlJK39VohzBqlDmLRigDwBRodbB/CyvK8FX00LgdepLd1ctX8g4zM BB6g== X-Forwarded-Encrypted: i=1; AJvYcCVV782d0HKBi3vjBkqBOMx3ROaz6YXJ+i0/q53wpw4smxdCYi5ft5YlIpXpGMzGW9hjKFTcCWlsWaXr9Dg=@vger.kernel.org X-Gm-Message-State: AOJu0Yy3FYrRylq3cMv+ZNS+s8/Cv+mV+2YY/ZXhhXGqEgoJMpYEOvey 7e9tuq5Ft9VeG313mmdFBSBLTrATdrmiOQ/z1TWppI8R0/i07dIsfPC+qYqKAg== X-Gm-Gg: ASbGnct4NWNSzfCYAdZoArHwE8X1xPTlLKBPSIJsjxhIomFP2mYpgzVzTXPiCHPsLvA XNfMOif8i7KSOeTikHh/BhRogRG9vDvHC7g6ieJBd9etVC1K0TtaDmAVDkhJXo5ZD19mHrgRWE4 zHLENf+o/0j3A8WKOtWDYIMWgQksC/Af951KRxHpCV+oI9jQmmariQU2uN+d17YChxdquYVzBAR NrstcRbRxf90hCkWEGlj11sMuUngZ6gwlPfPnFwIeqGZ0O0PijCvQSK2grytC5thqCIjggWAvNO n/iJO5ruyTcySfKQJp6tkFVJT51QUJzt0nbor7ve52e7gRZgf+rkvb9+O6stkek= X-Google-Smtp-Source: AGHT+IHL5mVDMgQlokSRrg14Grt/a6zCGRAUDF87pLjqVh8P9AlGpiW9ekWgTiH8jWlNxokqwkWomQ== X-Received: by 2002:a05:620a:1916:b0:7b6:dc74:829f with SMTP id af79cd13be357-7be6320c0acmr4144838485a.7.1737573089761; Wed, 22 Jan 2025 11:11:29 -0800 (PST) Received: from rowland.harvard.edu (nat-65-112-8-51.harvard-secure.wrls.harvard.edu. [65.112.8.51]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7be61473bd7sm686884985a.23.2025.01.22.11.11.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2025 11:11:29 -0800 (PST) Date: Wed, 22 Jan 2025 14:11:26 -0500 From: Alan Stern To: Jonas Oberhauser Cc: paulmck@kernel.org, parri.andrea@gmail.com, will@kernel.org, peterz@infradead.org, boqun.feng@gmail.com, npiggin@gmail.com, dhowells@redhat.com, j.alglave@ucl.ac.uk, luc.maranget@inria.fr, akiyks@gmail.com, dlustig@nvidia.com, joel@joelfernandes.org, urezki@gmail.com, quic_neeraju@quicinc.com, frederic@kernel.org, linux-kernel@vger.kernel.org, lkmm@lists.linux.dev, hernan.poncedeleon@huaweicloud.com Subject: Re: [RFC] tools/memory-model: Rule out OOTA Message-ID: References: <21ec2b32-69ce-46bf-8d44-06149e71ba6c@paulmck-laptop> <0c0fcfb7-dbef-426b-ac54-583c85fbba9d@huaweicloud.com> <1cea1fcd-827c-455e-93b7-f4d606bf4993@paulmck-laptop> <1147ad3e-e3ad-4fa1-9a63-772ba136ea9a@huaweicloud.com> <1668d0b4-4060-4eac-b8b1-46ca0d1dbce9@rowland.harvard.edu> <96059c09-3993-4f41-b3c2-54fe767c073a@rowland.harvard.edu> <2139f8ce-63fa-4231-864b-500ee2645811@huaweicloud.com> 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-Disposition: inline In-Reply-To: On Wed, Jan 22, 2025 at 04:46:03AM +0100, Jonas Oberhauser wrote: > > > > > Yes. Actually I wonder if you put this "all loads are volatile" restriction, > > > > > can a globally analysing compiler still have any optimizations that a > > > > > locally analysing compiler can not? > > > > > > > > Yes, although whether they are pertinent is open to question. For > > > > example, a globally optimizing compiler may observe that no thread ever > > > > reads the value of a particular shared variable and then eliminate that > > > > variable. > > > > > > Oh, I meant the "all atomic objects is volatile" restriction, not just the > > > loads. In that case, all stores the object - even if never read - still need > > > to be generated. > > > > > > Are there still any optimizations? > > > > Perhaps not any that affect shared variable accesses. In a way, that > > was the intention. > > Yes, but it becomes a bit strange then to treat the "globally analyzing > compiler" as a harder problem. You have made a globally analyzing compiler > that can not globally analyze. I understand that makes the argument > feasible, but I am not sure if this is how compilers really behave (or at > least will still behave in the future). There's still an important difference. A globally optimizing compiler is allowed to generate different object code for a thread (containing the same source code) in different programs, depending on the source for the other threads. A locally analyzing compiler is not allowed to do this; it will always generate the same object code for threads containing the same source code, regardless of what the rest of the program does. Alan