Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5104783ybe; Tue, 17 Sep 2019 02:41:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7CRKUhdNbfPffXfGCPRteGe8E7aEK4E7yrMmzQyuPlpd6aWsxEEonM0WxOsAfmMEteWv3 X-Received: by 2002:a50:be87:: with SMTP id b7mr3682144edk.37.1568713292347; Tue, 17 Sep 2019 02:41:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568713292; cv=none; d=google.com; s=arc-20160816; b=GJW4iJ81pLL7IwRbmohspIuZfEtFcQm0fyMn7yeYl17odtR78wDBgUoYHn7PKfHO2W cGOC8SGCj9NqT0Jaro+IN96sznOQL+4wHkL76aHGV2GfOflkouXJ50I6FjpZqC63wZtj N6a6l/Z9rBaW+4BpLxLU35ru9KBwtY0Vax155p4T31rfeCE0PSrtPPvBbSirCE/YGypU gsYuJDHoPXG5EkfDUl913tV937u7xmCH6hMXUT/w4OrNBrZ6g0oLqsc53Ovg+rQAycdb bBPl9UsPaeo8u4VPSlNzkWxfNNCxsupu+Wi4axsmU69WoamGlD+CIZR0f9Ak9IwXyblK G0Xw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=eMqcSWgeQX0Zhq0+N6kVQb8KTwuBFvqjlxg8EJsoEUQ=; b=LBcgy4DJ20KwSw6m+2/OgxPhsJLKAKUp0Wyqn9FQeooBRx9ZHzxa5xtylVj8HQnYQD u/Inl2mS5h+yAtH8JQ7Q1QZDP5X1MZHzOrB+tTimrjUZsSTAkJsKm/r5kJFPp+DEINcw cfwMAVLJQhsoQJSZGuidTz8AmOhHk96Gk/3Q83IW1G9v7lhkA1+bRH+B2ybbtq2C4JyX tJFKgRsrcUbqwfBrCfxanEPAC8/iIYSUROr5TaFtMcflnsiuI4otzY3WBeT2mToCnY3r ac2+Z6zslghdI0rGZ7TzVJqx52p+f892VpxynqRcxLGSZn2HVoh6VWA1P2Gy9XriOZnB +MAA== 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 h12si926022edq.437.2019.09.17.02.41.09; Tue, 17 Sep 2019 02:41:32 -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 S2391509AbfIQGZ5 (ORCPT + 99 others); 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