Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6058638pxv; Thu, 29 Jul 2021 05:34:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXTOP4Ze7vHLZYPWTvp6LNEDoxPlJ2U/5e7ST0R5Pddy+Smp2ZCXDChOi7ZJmPvkGm8yUk X-Received: by 2002:a17:906:5e11:: with SMTP id n17mr4335239eju.470.1627562065652; Thu, 29 Jul 2021 05:34:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627562065; cv=none; d=google.com; s=arc-20160816; b=tHKOyiXOVs3Vmn2CYDSRkFOZZ4v97f9b7d5kE165TfaAOqPRevow+0Bm1NHdBwuYR3 t0EQ9Y+K05VZrBE+ojREeyr5Dr2XeCOmGQFdCosuSXS5xir3yq/99XAVf1eM1+O4NO+9 Rbq3bCbZM7nXt8hN3swpXnXfcY/nLno6XOq1BR/8jKzqGL6P88mkz+QUqhQtyi4NyCF7 y/x4uvlaLRPPih3GeXor91fLoGIiCajj+NslJ3L9L4dZW1hacHAEXvvzwbAgtexLsVMD BqUQxE+RiZk16MVJIks/Y4+MQB0hMxYCg5aBzskZEZVmjZ5z/32LLyw0t1pG69xRzI31 rXYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=pAlRh+wkGLyuqbFE3mr2cV+7ToRtmCbSYmRIkhraGpE=; b=xJnqiM9xlXUqNwxFKQ1yTYhN0415iYfKnROtFGivumJLv/h1qiQe7aGsJ8jhvrIi5R xfi5QcjBSckniPfWDHtM35dbtBvf7WZMfbQz4u8iRcuHWzFUtk1t5sc7VJRK3zVZ+OUs 0xzQqOT/vh/c5VXFGECFH3VqBSe9hLQ2upfZB4UhlfPXcOjkKt67YXAq2YHe93eGGvql rDv1ebOUL5lCJ/9t8OIdFtB2oa2LOhc25k8TaL6p6U2pkeOoK7CXuQWcnVBL5/OGUKWj w59IjYuC4hdWbUhu540HuJchO89R+8oMD/S2RLToduokjiewk+Zq5Di+JFm04tzyZEgm Uo1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hev-cc.20150623.gappssmtp.com header.s=20150623 header.b=UI0iLaZS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id la20si2902159ejc.685.2021.07.29.05.33.53; Thu, 29 Jul 2021 05:34:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@hev-cc.20150623.gappssmtp.com header.s=20150623 header.b=UI0iLaZS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235199AbhG2Mb0 (ORCPT + 99 others); Thu, 29 Jul 2021 08:31:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235692AbhG2Mb0 (ORCPT ); Thu, 29 Jul 2021 08:31:26 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06E0FC0613C1 for ; Thu, 29 Jul 2021 05:31:23 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id gn26so10447802ejc.3 for ; Thu, 29 Jul 2021 05:31:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hev-cc.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pAlRh+wkGLyuqbFE3mr2cV+7ToRtmCbSYmRIkhraGpE=; b=UI0iLaZSvS2VBycjWJ/oRfi0kO5sohzTVNh1WgPnrZKPdTOryFS+e7uxhmd6Z1uBIC CU2dSKnfGAlPK9OM4zTEvLDAJcBSw1df9hlTEZhB9amzZSekW26AIelZyLezbD0c4elT 9q8iMeE6novwkdTrpFFKvOFebBVLr7RRVfmYc8zgcuWYilzNNp9nIZOL6MEKOeRgDaCi y1tRwo2yHwlU08DPzyNbU19XpiGdfHKFa54a9hUJ+9M7a9nvNacGZ7VkF6nSQbN4PUNg qu6ciUNGDV/epCrMmYb5lvjd8MtuCgY2rWyVCYjCbDfx4la1A7LB3DJZadO6pb1xLgHX 99gg== 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=pAlRh+wkGLyuqbFE3mr2cV+7ToRtmCbSYmRIkhraGpE=; b=ol+4gpMHCaHWGxOSxL7WW2EyvqAuxnk3h/IxT/K3kUmIRvLM8QC3cS5tVbECr2THUk AuMEtAevVo/E1HbtJqdnYP0vdR6kWoODc97zg2joBRK32xxrvKX8XC6r4dy8rZ88nI/1 e9Io+EJZInjlWqPlwYnn9tIJYVpXa9/8F3MXzoBsiBtW41Tm3xunWlkYv0V0WXC15l8q UE5HxqdDtgJVLCVxCGqmHJ7cOxKPDWnVP2xTnamcY0kM2X6cayLGCFJYE0bt/DK9QvT8 z8Q2iHSYk9A1AkCwlaY7otwCn4Icjm1FK8aZpPXwXIzz0CYmYQ2snOFiuEnpv5aUM03l Z8YA== X-Gm-Message-State: AOAM533RGwBWr9xPps6oZrTh2eUqo4B9EEK3UiTbcsEQ+M2Ph9K8lStJ A9ztePQwp/dbuR3GZA95yqdywPlVZeAqmipTHl00Og== X-Received: by 2002:a17:906:ce4c:: with SMTP id se12mr4515044ejb.292.1627561881596; Thu, 29 Jul 2021 05:31:21 -0700 (PDT) MIME-Version: 1.0 References: <20210729082549.144559-1-wangrui@loongson.cn> <20210729095342.GB8286@alpha.franken.de> In-Reply-To: <20210729095342.GB8286@alpha.franken.de> From: hev Date: Thu, 29 Jul 2021 20:31:11 +0800 Message-ID: Subject: Re: [RFC PATCH] locking/atomic: arch/mips: Fix atomic{_64,}_sub_if_positive To: Thomas Bogendoerfer Cc: Rui Wang , Peter Zijlstra , Will Deacon , Boqun Feng , linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Thomas, On Thu, Jul 29, 2021 at 5:53 PM Thomas Bogendoerfer wrote: > > On Thu, Jul 29, 2021 at 04:25:49PM +0800, Rui Wang wrote: > > This looks like a typo and that caused atomic64 test failed. > > > > Signed-off-by: Rui Wang > > Signed-off-by: hev > > --- > > arch/mips/include/asm/atomic.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h > > index 95e1f7f3597f..a0b9e7c1e4fc 100644 > > --- a/arch/mips/include/asm/atomic.h > > +++ b/arch/mips/include/asm/atomic.h > > @@ -206,7 +206,7 @@ ATOMIC_OPS(atomic64, xor, s64, ^=, xor, lld, scd) > > * The function returns the old value of @v minus @i. > > */ > > #define ATOMIC_SIP_OP(pfx, type, op, ll, sc) \ > > -static __inline__ int arch_##pfx##_sub_if_positive(type i, pfx##_t * v) \ > > +static __inline__ type arch_##pfx##_sub_if_positive(type i, pfx##_t * v) \ > > { \ > > type temp, result; \ > > \ > > sub_if_postive looks unused to me. Could you send a patch removing it > instead ? riscv also has a sub_if_positive implementation, which looks > unused. I found atomic{_64,}_dec_if_postive is based on sub_if_postive, and used in many places: kernel/kmod.c: if (atomic_dec_if_positive(&kmod_concurrent_max) < 0) { kernel/kmod.c: atomic_dec_if_positive(&kmod_concurrent_max) >= 0, kernel/module.c: ret = atomic_dec_if_positive(&module->refcnt); ... drivers/net/ethernet/mellanox/mlx5/core/eswitch.c: atomic64_dec_if_positive(&esw->user_count); drivers/net/netdevsim/fib.c: atomic64_dec_if_positive(&entry->num); drivers/net/netdevsim/fib.c: atomic64_dec_if_positive(&entry->num); Are you sure to remove it? Regards, Rui > > Thomas. > > -- > Crap can work. Given enough thrust pigs will fly, but it's not necessarily a > good idea. [ RFC1925, 2.3 ]