From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FB79C4CEC9 for ; Tue, 17 Sep 2019 06:25:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4D52D20644 for ; Tue, 17 Sep 2019 06:25:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391598AbfIQGZ5 (ORCPT ); Tue, 17 Sep 2019 02:25:57 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:2231 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727801AbfIQGZ5 (ORCPT ); Tue, 17 Sep 2019 02:25:57 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 8630A4953779977C334E; Tue, 17 Sep 2019 14:25:55 +0800 (CST) Received: from [127.0.0.1] (10.177.223.23) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.439.0; Tue, 17 Sep 2019 14:25:51 +0800 Subject: Re: [PATCH v4 1/5] locking/qspinlock: Rename arch_mcs_spin_unlock_contended to arch_mcs_pass_lock and make it more generic To: Alex Kogan , , , , , , , , , , , , , , CC: , , , References: <20190906142541.34061-1-alex.kogan@oracle.com> <20190906142541.34061-2-alex.kogan@oracle.com> From: Hanjun Guo Message-ID: <22a45ca4-fcae-c805-596e-67f1809eb1dd@huawei.com> Date: Tue, 17 Sep 2019 14:25:45 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20190906142541.34061-2-alex.kogan@oracle.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.223.23] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alex, On 2019/9/6 22:25, Alex Kogan wrote: > The new macro should accept the value to be stored into the lock argument > as another argument. This allows using the same macro in cases where the > value to be stored when passing the lock is different from 1. > > Signed-off-by: Alex Kogan > Reviewed-by: Steve Sistare > --- > arch/arm/include/asm/mcs_spinlock.h | 4 ++-- > kernel/locking/mcs_spinlock.h | 6 +++--- > kernel/locking/qspinlock.c | 2 +- > 3 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/arch/arm/include/asm/mcs_spinlock.h b/arch/arm/include/asm/mcs_spinlock.h > index 529d2cf4d06f..f3f9efdcd2ca 100644 > --- a/arch/arm/include/asm/mcs_spinlock.h > +++ b/arch/arm/include/asm/mcs_spinlock.h > @@ -14,9 +14,9 @@ do { \ > wfe(); \ > } while (0) \ > > -#define arch_mcs_spin_unlock_contended(lock) \ > +#define arch_mcs_pass_lock(lock, val) \ arch_mcs_spin_unlock_contended() has a matching function arch_mcs_spin_lock_contended(), please see include/asm-generic/mcs_spinlock.h, so if we update this function name, should we update the matching one as well? and update the relevant comments as well? > do { \ > - smp_store_release(lock, 1); \ > + smp_store_release((lock), (val)); \ > dsb_sev(); \ > } while (0) > > diff --git a/kernel/locking/mcs_spinlock.h b/kernel/locking/mcs_spinlock.h > index 5e10153b4d3c..84327ca21650 100644 > --- a/kernel/locking/mcs_spinlock.h > +++ b/kernel/locking/mcs_spinlock.h > @@ -41,8 +41,8 @@ do { \ > * operations in the critical section has been completed before > * unlocking. > */ > -#define arch_mcs_spin_unlock_contended(l) \ Before this line of the code, there is: #ifndef arch_mcs_spin_lock_contended ... #define arch_mcs_spin_lock_contended(l) \ So #ifndef should be updated too. Thanks Hanjun