From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755912AbcBBR4Q (ORCPT ); Tue, 2 Feb 2016 12:56:16 -0500 Received: from mail-ig0-f180.google.com ([209.85.213.180]:36713 "EHLO mail-ig0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755144AbcBBR4P (ORCPT ); Tue, 2 Feb 2016 12:56:15 -0500 MIME-Version: 1.0 In-Reply-To: <20160202120252.GI6719@linux.vnet.ibm.com> References: <20160128095718.GC30928@arm.com> <20160128223131.GV4503@linux.vnet.ibm.com> <20160129095958.GA4541@arm.com> <20160129102253.GG4503@linux.vnet.ibm.com> <20160201135621.GD6828@arm.com> <20160202035458.GF6719@linux.vnet.ibm.com> <20160202051904.GC1239@fixme-laptop.cn.ibm.com> <20160202064433.GG6719@linux.vnet.ibm.com> <20160202120252.GI6719@linux.vnet.ibm.com> Date: Tue, 2 Feb 2016 09:56:14 -0800 X-Google-Sender-Auth: Z7t3aoqBRbge9Wi2B1Tm7Ez-Jfk Message-ID: Subject: Re: [RFC][PATCH] mips: Fix arch_spin_unlock() From: Linus Torvalds To: Paul McKenney Cc: Boqun Feng , Will Deacon , Peter Zijlstra , "Maciej W. Rozycki" , David Daney , =?UTF-8?B?TcOlbnMgUnVsbGfDpXJk?= , Ralf Baechle , Linux Kernel Mailing List Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 2, 2016 at 4:02 AM, Paul E. McKenney wrote: > > The sorts of things I am really worried about are abominations like this > (and far worse): That one doesn't have any causal chain that I can see, so I agree that it's an abomination, but it also doesn't act as an argument. > r1 == 1 && r2 == 1 && c == 2 && r3 == 0 ??? What do you see as the problem here? The above can happen in a strictly ordered situation: thread2 runs first (c == 2, r3 = 0), then thread3 runs (d = 1, a = 1) then thread0 runs (r1 = 1) and then thread1 starts running but the store to c doesn't complete (now r2 = 1). So there's no reason for your case to not happen, but the real issue is that there is no causal relationship that your example describes, so it's not even interesting. Causality breaking is what really screws with peoples minds. The reason transitivity is important (and why smp_read_barrier_depends() is so annoying) is because causal breaks make peoples minds twist in bad ways. Sadly, memory orderings are very seldom described as honoring causality, and instead people have the crazy litmus tests. Linus