Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1981977imm; Fri, 7 Sep 2018 09:03:07 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaLfocbvp2ZqTv9JFAS8F/HARVPfdQF0zs2MtyhS9KRSgJ/7MLDVz4tW7YzHoUNvTSqyEYD X-Received: by 2002:a63:f14d:: with SMTP id o13-v6mr8869998pgk.236.1536336187765; Fri, 07 Sep 2018 09:03:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536336187; cv=none; d=google.com; s=arc-20160816; b=SGSDo9zxUnRmi+XEXgMlmROMiMVrAdBjrtWl/jPVgz5dU+2YDpYCjpRvxjAunRVgf/ zUe8UUkLLn2Qh+zYkhS6z09P1CB2vZP+SKsh5hrpYMd73RacmTs59F/LhqpZC/qob0kW +uwEuPlu0FmhtHZOUYOjnyPt27i89AKm4Of+hGaTJnSK75z8wIoV6PPjhQJLIrukSJUt +jCMfX7sKtGjxs8QRb+xJl3/diKp7+JaBkPDlQm2QJjbKQnX1QQE5qZzlqweaXCyVL/1 wL+mwlKPawgLZeviB3UwxQNlq07WQhGX6HXkqCDc6xto8JiNt6WVXYDsfyorRPVf8hAc Lyqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=ldLcx1vXzFMbYKVw8Yr3PY/SLh2Xq3RvejTPE3s7j0o=; b=uMCVMS+Gxvaxn9HoRCpMik0DqdtyrPNZisMd5dBMfLn/hfbqCT2nM6k5+XHCJfpEuk PdhHTnloEGtSYLXkPtJr+n9iyhsGGoADHBZOIDdx3Orm9I1zmG9X1vL/wXchuoYjCx/V RyvbEY7+zHbbbhsSqmYuLLWGuMKdLtUyyD5leAsaez0o8BGxLSL/LpasBAGPcSJuNclQ BeSuCwKNHeyQVHuNRoO7WylwiGhSO/uUEVyYb7IdgY9ORdZu5bmi34hOCumFIFQXj/vL ynrPKCQfQTZbJwc00Mfw0qhbnavif7e8EUYxPb0OzVJpYQNVfHrNceBATqYVcXLU3rS9 prDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o13-v6si8157574pll.86.2018.09.07.09.02.48; Fri, 07 Sep 2018 09:03:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727827AbeIGUly (ORCPT + 99 others); Fri, 7 Sep 2018 16:41:54 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:56528 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726598AbeIGUlx (ORCPT ); Fri, 7 Sep 2018 16:41:53 -0400 Received: (qmail 4424 invoked by uid 2102); 7 Sep 2018 12:00:19 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 7 Sep 2018 12:00:19 -0400 Date: Fri, 7 Sep 2018 12:00:19 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Andrea Parri cc: Will Deacon , Andrea Parri , "Paul E. McKenney" , Kernel development list , , , , , , , Jade Alglave , Luc Maranget , , Palmer Dabbelt , Daniel Lustig Subject: Re: [PATCH RFC LKMM 1/7] tools/memory-model: Add extra ordering for locks and remove it for ordinary release/acquire In-Reply-To: <20180906093655.GA9653@andrea> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 6 Sep 2018, Andrea Parri wrote: > > Have you noticed any part of the generic code that relies on ordinary > > acquire-release (rather than atomic RMW acquire-release) in order to > > implement locking constructs? > > There are several places in code where the "lock-acquire" seems to be > provided by an atomic_cond_read_acquire/smp_cond_load_acquire: I have > mentioned one in qspinlock in this thread; qrwlock and mcs_spinlock > provide other examples (grep for the primitives...). > > As long as we don't consider these primitive as RMW (which would seem > odd...) or as acquire for which "most people expect strong ordering" > (see above), these provides other examples for the _gap_ I mentioned. Okay, now I understand your objection. It does appear that on RISC-V, if nowhere else, the current implementations of qspinlock, qrwlock, etc. will not provide "RCtso" ordering. The discussions surrounding this topic have been so lengthy and confusing that I have lost track of any comments Palmer or Daniel may have made concerning this potential problem. One possible resolution would be to define smp_cond_load_acquire() specially on RISC-V so that it provided the same ordering guarantees as RMW-acquire. (Plus adding a comment in the asm-generic/barrier.h pointing out the necessity for the stronger guarantee on all architectures.) Another would be to replace the usages of atomic/smp_cond_load_acquire in the locking constructs with a new function that would otherwise be the same but would provide the ordering guarantee we want. Do you think either of these would be an adequate fix? Alan