Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp222768imm; Mon, 4 Jun 2018 16:18:36 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJdL8l/Mw7Js9ccNzxu5P2BSNmHiMR2GT1Zkwv8BfNYyTGvSlOKbLBaJ+e0LCiZbPSZzPRN X-Received: by 2002:a62:8a83:: with SMTP id o3-v6mr6459780pfk.12.1528154316769; Mon, 04 Jun 2018 16:18:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528154316; cv=none; d=google.com; s=arc-20160816; b=ChtfcT1G4XFWV9Ipi4eO8SNMrpvJKtoHYvQSj6bQ/9/rovoVF2JrrkdfEXEuqz97t4 Lv18JH2ppZUpxZJc/kYeDjwbxjJNdyvZ7Ff+EKaZbYz+NSYaUTwzYCmjVlwb6Bt7nHOm aIdPH9GmzIB/E+Q2R4g44DezMzYd63OZAE+hIhi+f5qT2nPLQFJi8McsEeVmryl++guG LepzN9YUBw/0gFg/+XzRykioaC05oAcw0+ZSSGoVefDUqY0CSW3718W64n07ONF8igCF C/JJ+LWDf3vI8jJ2H/xGmeVEy5ZTM8i1Qefh2hjxtlT6cFkn9/abIE9Akv3BgifQ3nbw uM8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature :arc-authentication-results; bh=xwHoLhsNaC+79qTMkhk/QQ4DNsysUK01zqMiW9asE4I=; b=hsFV30nR+QSWgEMq0JhL+kEc2owmPrdOqXXoN6/7syQNmTT7rLExwfV3M2DzeO6sD9 1rZtS6JCOuw5W1mXxjzocOaw94ucCapY5Wr0AXyF2rZRTxlDZ2gTPm5HDjCHr2qICfVH sysgwiXIQJqwWyBjxxieZAdrqoUC/vkm1cnw2EDtoWOXPrJ8+ixO9hdr/GsRLgiXDXKV Dx+L7TT647QwW9O1hRcvYNLIUknHF8Se02umjbMCmJzET46lPOpdRXWCRWk3RsNOxknW uuvrEOatKmcygIWW5qpcL3NgP/1SUsrnClN4b3yj7eHJ78908jBbhn5fagWq8qyqn5Vm buZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=RaPGL/Bp; 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 z31-v6si47772270plb.200.2018.06.04.16.18.22; Mon, 04 Jun 2018 16:18: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=pass header.i=@sifive.com header.s=google header.b=RaPGL/Bp; 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 S1752125AbeFDXRr (ORCPT + 99 others); Mon, 4 Jun 2018 19:17:47 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:33448 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752055AbeFDXR0 (ORCPT ); Mon, 4 Jun 2018 19:17:26 -0400 Received: by mail-pl0-f68.google.com with SMTP id n10-v6so277029plp.0 for ; Mon, 04 Jun 2018 16:17:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=xwHoLhsNaC+79qTMkhk/QQ4DNsysUK01zqMiW9asE4I=; b=RaPGL/BpJTKLwyxhyDpJAEBXvsLYR5R5gWqwd2riMFeiRgxp1aCQfMAJhbNCvAkqGO 2bieWnD4RKEnTk1rUUCnT4tJApDTnCXpLzFnxsgYR1vMNkJbGawDpHQtW0E+rrmnrPjD dqxJJHVTYWOmVaGFVER+wjXBLwJ9Mc+07OB5k1zFlbHcwQhCpo9RrTER98r4yDC5y/oN QHi80di3X6sPcqANTz4FIJkTQ2JXW0NMst7RwWW5cfwo1L2+jqfY8cfR03Dw5ESRjPpq tNiWJ9yn1uLr+M3Ly98KbZGyk1nQA7YJ0gsI29chT9W5pnVixOPARX8D6r0cxbUBaNyq 01TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=xwHoLhsNaC+79qTMkhk/QQ4DNsysUK01zqMiW9asE4I=; b=gLzKAwGZ1AHskoyntUBxfX9Hg8oi24GDECBATolzIB5pfULLay1ulqr7gZC/drB/Y4 qnY9damIcEbwSNAFe4VxDlBlH+MivwWTunelviLqt81FxXSIK3f3+zs4J1fBlmhnhPKt UB1+nwx9Qdghm2K/qlSBLtP9Ej5RnmIt4am6CNQ/xn5CcsRPiJRTHV23uQcD8+m4ZrUv XVw3LzHT5cHAbaKChE2BW3XCocfProfWlqTpr1QmjvNBAR0XImu/I9ghmyKFDmCZgtOd tL6D0oOowXI5nm1+ptMiV+WPyL82EOh1q1WbJw8dCPmRui+XN6EYBzQ4MGkT75/15BYS 0pTQ== X-Gm-Message-State: ALKqPwdKwwerItik8twF6/3DrKDhhm9elgT0Ncxv58n5HnjNiDp9PeAL RyvOtprrODXvLQp3us9ZKVUIA89frAI= X-Received: by 2002:a17:902:7c84:: with SMTP id y4-v6mr24176184pll.262.1528154245850; Mon, 04 Jun 2018 16:17:25 -0700 (PDT) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id b84-v6sm53134433pfm.123.2018.06.04.16.17.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jun 2018 16:17:25 -0700 (PDT) Date: Mon, 04 Jun 2018 16:17:25 -0700 (PDT) X-Google-Original-Date: Mon, 04 Jun 2018 15:53:36 PDT (-0700) Subject: Re: [PATCHv2 03/16] atomics/treewide: make atomic64_inc_not_zero() optional In-Reply-To: <20180529154346.3168-4-mark.rutland@arm.com> CC: linux-kernel@vger.kernel.org, mark.rutland@arm.com, boqun.feng@gmail.com, Will Deacon From: Palmer Dabbelt To: mark.rutland@arm.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 29 May 2018 08:43:33 PDT (-0700), mark.rutland@arm.com wrote: > We define a trivial fallback for atomic_inc_not_zero(), but don't do > the same for atmic64_inc_not_zero(), leading most architectures to > define the same boilerplate. atmic64 > Let's add a fallback in , and remove the redundant > implementations. Note that atomic64_add_unless() is always defined in > , and promotes its arguments to the requisite types, so > we need not do this explicitly. > > There should be no functional change as a result of this patch. > > Signed-off-by: Mark Rutland > Acked-by: Peter Zijlstra (Intel) > Cc: Boqun Feng > Cc: Will Deacon > --- > arch/alpha/include/asm/atomic.h | 2 -- > arch/arc/include/asm/atomic.h | 1 - > arch/arm/include/asm/atomic.h | 1 - > arch/arm64/include/asm/atomic.h | 2 -- > arch/ia64/include/asm/atomic.h | 2 -- > arch/mips/include/asm/atomic.h | 2 -- > arch/parisc/include/asm/atomic.h | 2 -- > arch/powerpc/include/asm/atomic.h | 1 + > arch/riscv/include/asm/atomic.h | 7 ------- > arch/s390/include/asm/atomic.h | 1 - > arch/sparc/include/asm/atomic_64.h | 2 -- > arch/x86/include/asm/atomic64_32.h | 2 +- > arch/x86/include/asm/atomic64_64.h | 2 -- > include/asm-generic/atomic-instrumented.h | 3 +++ > include/asm-generic/atomic64.h | 1 - > include/linux/atomic.h | 11 +++++++++++ > 16 files changed, 16 insertions(+), 26 deletions(-) > [...] > diff --git a/arch/riscv/include/asm/atomic.h b/arch/riscv/include/asm/atomic.h > index 0e27e050ba14..18259e90f57e 100644 > --- a/arch/riscv/include/asm/atomic.h > +++ b/arch/riscv/include/asm/atomic.h > @@ -375,13 +375,6 @@ static __always_inline int atomic64_add_unless(atomic64_t *v, long a, long u) > } > #endif > > -#ifndef CONFIG_GENERIC_ATOMIC64 > -static __always_inline long atomic64_inc_not_zero(atomic64_t *v) > -{ > - return atomic64_add_unless(v, 1, 0); > -} > -#endif > - > /* > * atomic_{cmp,}xchg is required to have exactly the same ordering semantics as > * {cmp,}xchg and the operations that return, so they need a full barrier. Acked-by: Palmer Dabbelt Thanks!