Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3873690imm; Tue, 17 Jul 2018 11:46:05 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfKl0r2XTxW6S87mWZ2PEqerMxmuLH9gBv4k/DKNMdvqDRl+GYgmd920EuLBUFCXqH/l4YZ X-Received: by 2002:a17:902:aa46:: with SMTP id c6-v6mr2682042plr.313.1531853165096; Tue, 17 Jul 2018 11:46:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531853165; cv=none; d=google.com; s=arc-20160816; b=dzwVrPraRHeaKJw1ZPTZ1RgkZmoJVKu4CNH+2pax753/8mOWBWwZuntVfSTSTHW1qX 2dZqvjX2l96/4XBy4oc8kcHoVQ3Kh65iEb//DWrcbEEi9pgSy0QD7ev0pf/b4yVcAc/F mq35hbu0Z0jzRJQGGi6F93HlymbYBvQiOi0CkajaU/3Gxpq1FFjWg/H9BALzYooR19Y3 RWzCOaRhiJUI8u+8aMwOJU/OJCjTCMJGoR4f/L5iqM0FznUJykevhYB23Ows+v4hgeKo xGS83hqxPZ6cfltGDRVEQDEmP5f1RoUTIyAXiSzRKzOxdqCJhTgjZKCUi33/YN6FDIXx jDMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=nP+IVL6dzBbjNNvLswznm/EY2YD7ehMimouwsjnS3Ps=; b=aj/yepJrPFWsMGDr7jsxePJVm6qOL/1ZyanBaWSmxaniMKHAb7Uc4q39ON39MNNrWg 4XRfMwlAUfjGlvI74JjTNZy86MizWXckUMRF1yVnk3yNTMo8lo3lRtTBw56ZBe3T0DFW lONGuYEEj9srm0AjE2dH7/3+werwaTt2z5cwqAwX7ALQkXAaeuDyQ12zihiS2+oJ+6O5 jHh+f67DYqSiGQO5Lmf/8NDEbau6nvemF/++Qez3SJoM3QW5m4vRv/IICInY7HySjSQ2 ovEPiBXJVqAvU4RpDpYcf0rCpIWee1UueOg+rgkDudJiYR0S0N7aZ4MezPC7dzZV2CWM cazw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Fw8ut94W; 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 q9-v6si1581367pgc.685.2018.07.17.11.45.49; Tue, 17 Jul 2018 11:46:05 -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; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Fw8ut94W; 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 S1730565AbeGQTSb (ORCPT + 99 others); Tue, 17 Jul 2018 15:18:31 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:35214 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729741AbeGQTSa (ORCPT ); Tue, 17 Jul 2018 15:18:30 -0400 Received: by mail-it0-f65.google.com with SMTP id q20-v6so613486ith.0 for ; Tue, 17 Jul 2018 11:44:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nP+IVL6dzBbjNNvLswznm/EY2YD7ehMimouwsjnS3Ps=; b=Fw8ut94W814zvGfTq8XHp9NurUhEa4E5L9UAuOjwHUc6FWt3t+/xUIrzJ8cx6g+nhS MVIaxviT6lvuwCxswV5+oJdKsUke7s1H03D7BLonTiVC37KZfJig+vjuu6aYFZrNzTAP CL67PBGzqYLxVjNZK0AY2aNznHQzfFk3k8Euw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nP+IVL6dzBbjNNvLswznm/EY2YD7ehMimouwsjnS3Ps=; b=g8StP56lX9WK/1+0YMINzG7Kh96/RpPjnBqhJUNpslZNsAfDQXpwJtkdeDcC8HdFp3 OjIl8u2R1OI1uoVyeeaGrnH08B/kIHICXdY+QYVrukyl+vgXSQ2AjBzbWDhw2Asq2XNW WnhcRa7fwnCTGezL46xa0dhqkucT9jZlD6sp1Ef+l955BAbGM/ZiQYu4idnH9fnhZfqZ ssJq0djeRwQPA1p7cRdNP3oP4iZUNjAiR1pkqg4a6RYwrzp3V2WSOBzqwkltRq0ZUPs1 NJe2xshf3ksFGt91/i1FNXxyaSPiw2tzjcEfaztRYfS0uDgtmam0yiChj5Hs80lf6qOp GijA== X-Gm-Message-State: AOUpUlGuKWfTddu6p86kgqN2iEsqsUrodXk7j47X6BEppWRHu7b3gUed BcXhaJNfVLdb7IjFhZ4bJypNJ0IZyBnhFcDtwE8= X-Received: by 2002:a24:5002:: with SMTP id m2-v6mr2567866itb.16.1531853074789; Tue, 17 Jul 2018 11:44:34 -0700 (PDT) MIME-Version: 1.0 References: <20180712172838.GU3593@linux.vnet.ibm.com> <20180712180511.GP2476@hirez.programming.kicks-ass.net> <20180713110851.GY2494@hirez.programming.kicks-ass.net> <87tvp3xonl.fsf@concordia.ellerman.id.au> <20180713164239.GZ2494@hirez.programming.kicks-ass.net> <87601fz1kc.fsf@concordia.ellerman.id.au> <87va9dyl8y.fsf@concordia.ellerman.id.au> <20180717183341.GQ12945@linux.vnet.ibm.com> In-Reply-To: <20180717183341.GQ12945@linux.vnet.ibm.com> From: Linus Torvalds Date: Tue, 17 Jul 2018 11:44:23 -0700 Message-ID: Subject: Re: [PATCH v2] tools/memory-model: Add extra ordering for locks and remove it for ordinary release/acquire To: Paul McKenney Cc: Michael Ellerman , Peter Zijlstra , Alan Stern , andrea.parri@amarulasolutions.com, Will Deacon , Akira Yokosawa , Boqun Feng , Daniel Lustig , David Howells , Jade Alglave , Luc Maranget , Nick Piggin , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 17, 2018 at 11:31 AM Paul E. McKenney wrote: > > The isync provides ordering roughly similar to lwsync, but nowhere near > as strong as sync, and it is sync that would be needed to cause lock > acquisition to provide full ordering. That's only true when looking at isync in isolation. Read the part I quoted. The AIX documentation implies that the *sequence* of load-compare-conditional branch-isync is a memory barrier, even if isync on its own is now. So I'm just saying that (a) isync-on-lock is supposed to be much cheaper than sync-on-lock (b) the AIX documentation at least implies that isync-on-lock (when used together the the whole locking sequence) is actually a memory barrier Now, admittedly the powerpc barrier instructions are unfathomable crazy stuff, so who knows. But: (a) lwsync is a memory barrier for all the "easy" cases (ie load->store, load->load, and store->load). (b) lwsync is *not* a memory barrier for the store->load case. (c) isync *is* (when in that *sequence*) a memory barrier for a store->load case (and has to be: loads inside a spinlocked region MUST NOT be done earlier than stores outside of it!). So a unlock/lock sequence where the unlock is using lwsync, and the lock is using isync, should in fact be a full memory barrier (which is the semantics we're looking for). So doing performance testing on sync/lwsync (for lock/unlock respectively) seems the wrong thing to do. Please test the isync/lwsync case instead. Hmm? What am I missing? Linus