Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1033941imm; Fri, 13 Jul 2018 10:17:52 -0700 (PDT) X-Google-Smtp-Source: AAOMgpegLBxFMSXUGsKuPhVuJRGN/iOl3v1MwO3wENmTiRNcbK3PmI6z1Iq8pPHxfrcbIs/QrwNW X-Received: by 2002:a63:26c3:: with SMTP id m186-v6mr6901766pgm.56.1531502272659; Fri, 13 Jul 2018 10:17:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531502272; cv=none; d=google.com; s=arc-20160816; b=Q7NlMJhFeFePg2qcqbkgKSKBLXbZXf3GhN6sEaBPzMEv8BqnvakOzMXz3j20TzRXmT EYTWWQNvI83wwZVWag5+Vcvf4NQESkQmP8QTeCB6DWUKZUbdR4lsV6JJA4wEbIfZuw0k sw+UbTkhwIbwsv/4AVjw9bUaEatR/TFHMrIpVaRnFKvaOw54Pll25UBUXGSK0lrvcgX2 cPW3i3IVKPYVZj92i2sw44u7fM+FMBDNuGuHHmhqzjzKrrFp9huTQ1GHfr1pBpEGTfBk 1VvOu29L7KaCM/ZnRZcT5V9a/mS2m1IbawSU+ooc3IaYGyzXQ9a5OS8EYvvnCdW/tdSw YBvg== 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=kAQ9MBsPAI0VhRcVIa5IuhT/CgMlRAVlCTHkwU3boDM=; b=bztAvhU10OJ8RGHPysxIacpK72XXkiojyPmq15uEu4+XP78SVrIcWQtUibw+xWcPu2 McqogZvdbAz2RfuUnkd7LmOTpLSbTnBETArXz6iKUna8g0yMEcYGKfouZT78ByixyZo7 6uercm4F2L9i/2ApNVjXgMFULfMprC2YbeuMaQBon+QItxEUoY1B0XeZZtjIDMf/wkFL wNEj+EwQIChNStB+IYI8mONXQYlePN2vCcfnttQS8Pr1jwTBCVHECdZxIQSFWdvfLLSS pWiasgRS6P9wa8qpa9ghfQVu3UBv83wl0Ud9BsHtI6Hwq1srBebx6yG/87YcJUdCtsfK 4Z2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="V/pg7Q1r"; 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 p13-v6si14902445pgg.616.2018.07.13.10.17.37; Fri, 13 Jul 2018 10:17:52 -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="V/pg7Q1r"; 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 S1730595AbeGMRcc (ORCPT + 99 others); Fri, 13 Jul 2018 13:32:32 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:36107 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729735AbeGMRcc (ORCPT ); Fri, 13 Jul 2018 13:32:32 -0400 Received: by mail-it0-f68.google.com with SMTP id j185-v6so12524180ite.1 for ; Fri, 13 Jul 2018 10:17:00 -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=kAQ9MBsPAI0VhRcVIa5IuhT/CgMlRAVlCTHkwU3boDM=; b=V/pg7Q1r84qWKDvFb8FBI2l7RWR0NVXtQFZtoUXxbJrXs33aRll28nv+BVuYAEgqQb G3VQh0L8axB/PEQTzpz/zSO/sjPbElxhxEZqVyawePT9wIPcTJXSkk427prL0LI5pEpQ JwTdEIpmLY25zvnUSipviPJzWd6rpOAh4SMAc= 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=kAQ9MBsPAI0VhRcVIa5IuhT/CgMlRAVlCTHkwU3boDM=; b=CajCivQ4zJTPouxeNpD9xcd568wwbwnwndH9MJEyalp7+CfThJYZNnvxTLk7j4vCB8 ueJqFX9v/KBNr4aga6fOJcws8JOuwTvNGxRmpeeWXcUqLXaGJRjtya8JeoWWDylyxr+D khAm2QhjgucoyPN3tYYl2kjwbybdvOwo4BazJL7vH8meSeMjBX5c1jEf+EbGXO1S/9/6 c+tUpS4qcJabR6/6hFkaz1ZWXhyUWhWcs1vx9OCNLavA/a/9pdpDSbrFV+Sf65CjM90u yEAguqUkUgkGBrcajiwmV521DKKzoNIpa42C7Rv0xmHMlqfwY7+0CiZ0mdegpHFs0ljo kGeA== X-Gm-Message-State: AOUpUlFCi/3oKAwRgsf+uNm6ZKJR21s3gZcCJx22JEDaOSdxoV+iN0ZS 0AMob0e3YRGE3SkQtSXdjI+GihXapUG00l/3iOk= X-Received: by 2002:a02:1bdc:: with SMTP id 89-v6mr6057200jas.72.1531502220152; Fri, 13 Jul 2018 10:17:00 -0700 (PDT) MIME-Version: 1.0 References: <20180712134821.GT2494@hirez.programming.kicks-ass.net> <20180712172838.GU3593@linux.vnet.ibm.com> <20180712180511.GP2476@hirez.programming.kicks-ass.net> <11b27d32-4a8a-3f84-0f25-723095ef1076@nvidia.com> <20180713090637.GA10601@andrea> <20180713093524.GC32020@arm.com> In-Reply-To: <20180713093524.GC32020@arm.com> From: Linus Torvalds Date: Fri, 13 Jul 2018 10:16:48 -0700 Message-ID: Subject: Re: [PATCH v2] tools/memory-model: Add extra ordering for locks and remove it for ordinary release/acquire To: Will Deacon Cc: andrea.parri@amarulasolutions.com, Daniel Lustig , Peter Zijlstra , Paul McKenney , Alan Stern , Akira Yokosawa , Boqun Feng , 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 Fri, Jul 13, 2018 at 2:34 AM Will Deacon wrote: > > And, since we're stating preferences, I'll reiterate my preference towards: > > * RCsc unlock/lock > * RCpc release/acquire Yes, I think this would be best. We *used* to have pretty heavy-weight locking rules for various reasons, and we relaxed them for reasons that weren't perhaps always the right ones. Locking is pretty heavy-weight in general, and meant to be the "I don't really have to think about this very much" option. Then not being serializing enough to confuse people when it allows odd behavior (on _some_ architectures) does not sound like a great idea. In contrast, when you do release/acquire or any of the other "I know what I'm doing" things, I think we want the minimal serialization implied by the very specialized op. > * Not fussed about atomic rmws, but having them closer to RCsc would > make it easier to implement and reason about generic locking > implementations I would prefer that rmw's be RCsc by default, but that there are then "relaxed" versions of it that aren't. For example, one common case of rmw has nothing to do with any ordering at all: statistics gathering. It usually has absolutely zero need for any ordering per se, and all it wants is cache coherence. Yes, yes, the really crticial stuff we then use percpu counters for and a lot of clever software, but there's a lot of cases where that isn't practical or isn't _quite_ important enough. So "atomic_add()" being RCsc sounds like a nice tight requirement, but then architectures who can do it cheaper could have "atomic_add_relaxed()" that has no inherent ordering at all. But let's see what the powerpc people find about the actual performance impact of being RCsc on locking. Real numbers for real loads would be nice. Linus