Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp310466imm; Tue, 15 May 2018 01:56:36 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrFetgGE3aW+Gg8BSz7/BqpqTOWKjCV7C4yJS7tMNApW+TOrqS1dXH6U3xnxTIlNkJA+ete X-Received: by 2002:a63:85c1:: with SMTP id u184-v6mr11522904pgd.442.1526374596237; Tue, 15 May 2018 01:56:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526374596; cv=none; d=google.com; s=arc-20160816; b=yMGTe/y+zBOrIUqhENzeM54ILl9OQNtWm0dUttfxpajB/S6bLDJmQ9xKpSGp/WbLAK iaKzNsZLxrEi4TBMMrernqYdzST77UhNV2prhiz7igu+vs5I8Bo/+Ua0jCEZltS5LRPD +GcnfmjFaqvGqXduiSFxUE/wsp5tatgKgRvTGkzNIGw7SMoEiBhRD+cWH7MyAdb9CbpQ qSxqFr9m3WI8Z2Szx+75S8Tk6HpXk54JHg3NDq9WhvBjUR58WPAMpWX1avfm3S7z+4+A lqeBt7vc/4h5M+4DY28uYvM5EbG6p3ht2gQdJBNIe0+FafY71asKaclbWjTwKoRR3T8A Cy1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=6KXfLmEj8VN4Ytk+7QzJkCfn/soRUZDAsheXe4mQas4=; b=oQxddayd4Rsrvym+6vb1ag50OGW2rkWnZ8yPDYpvTgB250RymMbmfLH7UxO9vFIbTH oIYBXYSKd0EiKX3C52mWNacM7iGLy1sHonNH2COJsUyK+5eUvb/ZmmdYPsojhofY2nrk gZACDo9MrycTMk/z9z7BAS+4YTdfN5yuAtTZVgmT5egpcYZOe68xBhFvfCictHGFYl81 RaznEsvu7AeRnKu+UYtwwe3yB8N9lKc1XE2nQ00vlwAG6qcZWoM4Zo1aJPeBgHdipxle Bg16uAwBBKhWSzKxi/i/u0IhVxnXDQicQcItCrWboj6NZihW0CYDVrfoB7oPhnxjDPJN MoFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Xj4hwYE8; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k13-v6si495577pgo.662.2018.05.15.01.56.21; Tue, 15 May 2018 01:56:36 -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=fail header.i=@gmail.com header.s=20161025 header.b=Xj4hwYE8; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752685AbeEOIyZ (ORCPT + 99 others); Tue, 15 May 2018 04:54:25 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:55393 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752346AbeEOIyV (ORCPT ); Tue, 15 May 2018 04:54:21 -0400 Received: by mail-wm0-f66.google.com with SMTP id a8-v6so17919835wmg.5; Tue, 15 May 2018 01:54:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=6KXfLmEj8VN4Ytk+7QzJkCfn/soRUZDAsheXe4mQas4=; b=Xj4hwYE8OZZ+x4QnCx+4dQ8aZsLp7W2lcKCJfzMZsZh0st3Nihkhn/197nkQh6aXdy ChDf01HRxI3bFNS7RoqLrGUR64KRBGBI+sYB0lYTAMscAe7p/TRYg6hKA0gwHReNaUKQ 35Un0sPfgmT2C8sEgdITbCgzEVy/hfQqWtTOFxjaU2X7VHBAve6fxs6f/TP6xee9DwHg oCobvp1kZlvsmLcsG+EM6Cl3MLexpKkVh+SkmAqVBUPiKEtoFjOKQ6bxIxajOz0tXf4I 5WF7EqHxwKANGNfqMIr754xbrc+RaXHKZw5/VDh8BLbEzIgqjTFa1KusB/+3YhGZ8q8J ZgSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=6KXfLmEj8VN4Ytk+7QzJkCfn/soRUZDAsheXe4mQas4=; b=MqFXrTWVwC3xDcnFJBnIy31y3GCF/gihmSSBIPq/tGhIEZNjs6VV0eDhKVk72SApnL kfMRa5O7JxV2aSgBbVbxK3I9cysPTHiaihROYbwgRjI/QiQLOj7Vwic512Z/wEVeIJtw wYLf6mG90+F7rKmmde0d9pNqhQNjjZV3yiazu8ZoqysKmTxzVvCIixJiNkUsKFWg44lj dhL7OuCXOWyXVxPuy5CrH7NTljPeM80A0XzL4zfTxk6tdYX/JFyLDgKlY7uUNYFiFHDj jFI/PBR/WHBAjgsWTMNqivghLMYXuZ/xBqBdsIFzsOUNe42ldLGNV4z4YuWxnbcUmhr0 ikMA== X-Gm-Message-State: ALKqPwe5aBNXk4RQlIHyE/t0g/E8OQVnwjCIs59MhtadLqH/y5P6Upmn FEwL64TC/P4ljpDYnbqfSnk= X-Received: by 2002:a1c:b78a:: with SMTP id h132-v6mr6658854wmf.21.1526374459841; Tue, 15 May 2018 01:54:19 -0700 (PDT) Received: from gmail.com (2E8B0CD5.catv.pool.telekom.hu. [46.139.12.213]) by smtp.gmail.com with ESMTPSA id o12-v6sm13774101wri.78.2018.05.15.01.54.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 May 2018 01:54:19 -0700 (PDT) Date: Tue, 15 May 2018 10:54:17 +0200 From: Ingo Molnar To: Will Deacon Cc: Peter Zijlstra , linux-kernel@vger.kernel.org, akpm@linux-foundation.org, mark.rutland@arm.com, torvalds@linux-foundation.org, paulmck@linux.vnet.ibm.com, tglx@linutronix.de, hpa@zytor.com, linux-tip-commits@vger.kernel.org Subject: Re: [tip:locking/core] locking/atomics: Simplify the op definitions in atomic.h some more Message-ID: <20180515085417.GB30420@gmail.com> References: <20180505083635.622xmcvb42dw5xxh@gmail.com> <20180509073327.GE12217@hirez.programming.kicks-ass.net> <20180509130316.GB20254@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180509130316.GB20254@arm.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Will Deacon wrote: > With this patch, we're already seeing arch code (powerpc, risc-v) having > to add what is basically boiler-plate code, and it seems like we're just > doing this to make the generic code more readable! I'd much prefer we kept > the arch code simple, and took on the complexity burden in the generic code > where it can be looked after in one place. For PowerPC this is not really true, the patch has this effect: 2 files changed, 28 insertions(+), 20 deletions(-) and made it more obvious where the arch gets its low level definitions from. For RISC-V it's true: arch/riscv/include/asm/atomic.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) but even before this it was already largely boilerplate: #define atomic_inc_return_relaxed atomic_inc_return_relaxed #define atomic_dec_return_relaxed atomic_dec_return_relaxed #define atomic_inc_return atomic_inc_return #define atomic_dec_return atomic_dec_return #define atomic_fetch_inc_relaxed atomic_fetch_inc_relaxed #define atomic_fetch_dec_relaxed atomic_fetch_dec_relaxed #define atomic_fetch_inc atomic_fetch_inc #define atomic_fetch_dec atomic_fetch_dec #ifndef CONFIG_GENERIC_ATOMIC64 #define atomic64_inc_return_relaxed atomic64_inc_return_relaxed #define atomic64_dec_return_relaxed atomic64_dec_return_relaxed #define atomic64_inc_return atomic64_inc_return #define atomic64_dec_return atomic64_dec_return #define atomic64_fetch_inc_relaxed atomic64_fetch_inc_relaxed #define atomic64_fetch_dec_relaxed atomic64_fetch_dec_relaxed #define atomic64_fetch_inc atomic64_fetch_inc #define atomic64_fetch_dec atomic64_fetch_dec #endif What this change does it that it makes _all_ the low level ops obviously mapped in the low level header, if an arch decides to implement the _relaxed variants itself. Not half of them in the low level header, half of them in the generic header... Thanks, Ingo