From patchwork Wed May 23 13:35:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 136650 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp906509lji; Wed, 23 May 2018 06:35:46 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoGsuNKx6kR+9vxi0cu7RtvzSQvB0GtE0j9MSA0ItwoQ1sAmKN1eYe3AFF3AOSIWmhBbYts X-Received: by 2002:a63:6741:: with SMTP id b62-v6mr2406038pgc.5.1527082545912; Wed, 23 May 2018 06:35:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527082545; cv=none; d=google.com; s=arc-20160816; b=tIWv59Wlu0/rVMy/2VH2zcH2IXRIT4mXRafkOVvRqGW8MrdhVRJBUhVNAdRyN2/UbH GTgQv+4G3NGoZaWnT+398jCMNre5tMm3VFbfxRJYDaNvwy0F2aC8HU+QzB/k4YxNUxG4 olcuak1K6fBXjCljX6RY3M1G40mIFmKtWWUtbUd5dzx0cs++YqR108Dn3sPj0p8QgVxq yFwyVdZ5zVysEnaMC9YntqehvQE2fxM6U9atD4JUbJ5Ql7GdqCgCEJ4mZuqCjfgFOQLx NQ3jNhH+uE6jE4MX5+hwxDOpCVBVTbp8cCTgRBayt8LZ149Av3jx6HXFzhKMxBGAWI9x YS3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=FnkNTBqCCcgEbTiWBatrNNSxC4HkbNOCgsBop3weY3E=; b=pd3FK/e25vrja1w8DCcko4P3y3EX7Gld88r2uHwVhyiCoUmvl4aBLW0jdIZ+b4otZ8 gkoSXq9fViq+Yn+xLbScwju2lqmBVR2MmuqMCTxuARsIJgBrabcM4IW1ZGYs6d7NZ0r4 J+gRrXC1DBQR7XJd6YPmr7X3Gj4eVb+NCfdcqnLdV0c8saN6dDKgFHQXQrvRGsziNeRJ sO1RGije4PT2hqg5C9K5Cy5GVAqcu56mRL23UM511r0dpviADx2gopB2ZMJewAG4Owby 5SQbk7gi+qIpHA15HYaZDKwtzZGkTVuBGustGI4K/StRXd0INDG0ZIBrjd5kQY7lUBdh cG9w== 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 x7-v6si8666323pgt.559.2018.05.23.06.35.45; Wed, 23 May 2018 06:35:45 -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 S933088AbeEWNfn (ORCPT + 30 others); Wed, 23 May 2018 09:35:43 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:55266 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932876AbeEWNfm (ORCPT ); Wed, 23 May 2018 09:35:42 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AEE5580D; Wed, 23 May 2018 06:35:41 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0FCD33F24A; Wed, 23 May 2018 06:35:38 -0700 (PDT) From: Mark Rutland To: linux-kernel@vger.kernel.org Cc: Mark Rutland , Boqun Feng , Peter Zijlstra , Will Deacon , Arnd Bergmann , Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta , Russell King , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Palmer Dabbelt , Albert Ou Subject: [PATCH 00/13] atomics: API cleanups Date: Wed, 23 May 2018 14:35:20 +0100 Message-Id: <20180523133533.1076-1-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series contains a few cleanups of the atomic API, fixing an inconsistency between atomic_* and atomic64_*, and minimizing repetition in arch code. This is nicer for arch code, and the improved regularity will help when generating the atomic headers in future. The bulk of the patches reorganise things so architectures consistently provide _fetch_add_unless(), with atomic_fetch_add_unless() provided as a wrapper by core code. A generic fallback is provided for _fetch_add_unless(), based on _read() and _try_cmpxchg(). Other patches in the series add common fallbacks for: * atomic64_inc_not_zero() * _inc_and_test() * _dec_and_test() * _sub_and_test() * add_negative() ... as almost all architectures provide identical implementation of these today. The end result is a strongly negative diffstat, though grows by a reasonable amount. When we generate the headers, we can halve this by templating the various fallbacks for atomic{,64}_t. I've pushed this out to my atomics/api-cleanup branch [1] on kernel.org. Thanks, Mark. [1] git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git atomics/api-cleanup Mark Rutland (13): atomics/treewide: s/__atomic_add_unless/atomic_fetch_add_unless/ atomics/treewide: remove redundant atomic_inc_not_zero() definitions atomics/treewide: make atomic64_inc_not_zero() optional atomics/treewide: make atomic_fetch_add_unless() optional atomics: prepare for atomic64_fetch_add_unless() atomics/generic: define atomic64_fetch_add_unless() atomics/alpha: define atomic64_fetch_add_unless() atomics/arc: define atomic64_fetch_add_unless() atomics/arm: define atomic64_fetch_add_unless() atomics/powerpc: define atomic64_fetch_add_unless() atomics/riscv: define atomic64_fetch_add_unless() atomics/treewide: make atomic64_fetch_add_unless() optional atomics/treewide: make test ops optional arch/alpha/include/asm/atomic.h | 43 +++---- arch/arc/include/asm/atomic.h | 66 ++-------- arch/arm/include/asm/atomic.h | 43 ++----- arch/arm64/include/asm/atomic.h | 23 ---- arch/h8300/include/asm/atomic.h | 8 +- arch/hexagon/include/asm/atomic.h | 12 +- arch/ia64/include/asm/atomic.h | 56 --------- arch/m68k/include/asm/atomic.h | 19 +-- arch/mips/include/asm/atomic.h | 134 -------------------- arch/openrisc/include/asm/atomic.h | 4 +- arch/parisc/include/asm/atomic.h | 72 ----------- arch/powerpc/include/asm/atomic.h | 47 ++----- arch/riscv/include/asm/atomic.h | 27 +--- arch/s390/include/asm/atomic.h | 40 ------ arch/sh/include/asm/atomic.h | 29 ----- arch/sparc/include/asm/atomic_32.h | 19 +-- arch/sparc/include/asm/atomic_64.h | 52 -------- arch/sparc/lib/atomic32.c | 4 +- arch/x86/include/asm/atomic.h | 25 +--- arch/x86/include/asm/atomic64_32.h | 54 -------- arch/x86/include/asm/atomic64_64.h | 25 +--- arch/xtensa/include/asm/atomic.h | 66 ---------- drivers/block/rbd.c | 2 +- drivers/infiniband/core/rdma_core.c | 2 +- fs/afs/rxrpc.c | 2 +- include/asm-generic/atomic-instrumented.h | 42 ++++++- include/asm-generic/atomic.h | 20 --- include/asm-generic/atomic64.h | 8 +- include/linux/atomic.h | 198 +++++++++++++++++++++++++++++- kernel/bpf/syscall.c | 4 +- lib/atomic64.c | 13 +- net/rxrpc/call_object.c | 2 +- net/rxrpc/conn_object.c | 4 +- net/rxrpc/local_object.c | 2 +- net/rxrpc/peer_object.c | 2 +- 35 files changed, 329 insertions(+), 840 deletions(-) -- 2.11.0 Acked-by: Peter Zijlstra (Intel)