Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6146907pxv; Thu, 29 Jul 2021 07:35:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRwHllY8ch6VNLJLk9dT+pacSygBmzHzC9vw0GEJsmWQA+5zLjzQLvrGjCO0FayadB9rxP X-Received: by 2002:a05:6e02:b4b:: with SMTP id f11mr3947621ilu.130.1627569325925; Thu, 29 Jul 2021 07:35:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627569325; cv=none; d=google.com; s=arc-20160816; b=0ZjmyEIOrl5WukpVIVVto9qO54vCV9wpTEM+Ocp+WzzGJdO0h3nFKHZIn6hHdAUZum 916cLj6UK13aNpxHN8VK+wYMsSHorCrB4Ogb7o7l2nfMB1uEyR9/3FxoHCEKeYNh/qWR W4cd7S4vg2WLKljsEzPRIJ0TQ95IFeUHMzGSZ7CrjrqpUlImQN2Hkt/pbzlmwTqUsMIb v/FASGAqs6m5GJqCZ18Sa4xonVpNzM0mxr8SLjrNCYqolErRE7nLU/Gdzo+tKtUhZA+1 LyUYX+rX5fSMfpc0kABn4pOw74RHHxaCEfPHHRD0OuiDjH2AwO4Zcx5VJEqKRvYRR5fE Rs4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=vAoQu8oegTHtt7mrzHGcsp/kArP4rgvVgKkI9HmP4gQ=; b=bkEIRPdsVJoEI+jGvf/K2mxPCcfanOzAwIUsF2wIV+3U+A0P1XLx9/FJwmzgZjg5On mfvxIifHy6dWJBnYVj9oCpiqRHLG2pAb1kp3Hx1sEcb2G8bxbKToqfgNTuH+OObJVRRK 2cZrQDYFl1tc2kN7dSCR2vdWwzxvKHcve6uysn/RUggu5IaG4TYjOeAQs+S0EPeHbkhq zVtP9BP62qzlLMQjxnywThatVhG+jKJ2K3kbP9j13QusePpexfLoV9kpMABSurJKstR7 Q908hxzNeyjP9VbDsU+n/1Np90OwwqQRxR+sQWToBDr6QnK0HZAlQI15JI7v80q69tpV F5pA== ARC-Authentication-Results: i=1; mx.google.com; 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 a5si1921801ioo.37.2021.07.29.07.35.05; Thu, 29 Jul 2021 07:35: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; 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 S237518AbhG2Od5 (ORCPT + 99 others); Thu, 29 Jul 2021 10:33:57 -0400 Received: from elvis.franken.de ([193.175.24.41]:33299 "EHLO elvis.franken.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237573AbhG2Od4 (ORCPT ); Thu, 29 Jul 2021 10:33:56 -0400 Received: from uucp (helo=alpha) by elvis.franken.de with local-bsmtp (Exim 3.36 #1) id 1m976b-0004ov-00; Thu, 29 Jul 2021 16:33:49 +0200 Received: by alpha.franken.de (Postfix, from userid 1000) id 3E8D5C257B; Thu, 29 Jul 2021 16:33:07 +0200 (CEST) Date: Thu, 29 Jul 2021 16:33:07 +0200 From: Thomas Bogendoerfer To: hev Cc: Rui Wang , Peter Zijlstra , Will Deacon , Boqun Feng , linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org Subject: Re: [RFC PATCH] locking/atomic: arch/mips: Fix atomic{_64,}_sub_if_positive Message-ID: <20210729143307.GA13231@alpha.franken.de> References: <20210729082549.144559-1-wangrui@loongson.cn> <20210729095342.GB8286@alpha.franken.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 29, 2021 at 08:31:11PM +0800, hev wrote: > 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? in that case, let's keep it. There is a fallback for atomic_dec_if_positive, that's why I didn't notice where it is used. Thomas. -- Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]