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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A03CC43334 for ; Mon, 20 Jun 2022 21:16:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245567AbiFTVQ1 (ORCPT ); Mon, 20 Jun 2022 17:16:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237153AbiFTVQW (ORCPT ); Mon, 20 Jun 2022 17:16:22 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5905F65B2 for ; Mon, 20 Jun 2022 14:16:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655759780; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lZhHQwIP7ahDScS1KF5bFADmc8igjElNlRZM3fUDtks=; b=Aku/YqSi1tzcJb9WAMiLFNEtn/biQmAumDfGt+VOOe3RRIjdMs8cv81Y/PD3SQPrfARXdI ZUVPJTshyprO9B+ccy8uItO0DdMHGuEjPUC2hWCw4/ySMJXp5ePrSLKM/QFTw4iGLyRzjj xrVPFE6ktzyXkbQPkrYrhAe6wlAO870= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-363-vY5Lfy5bNyG3eOm35UQymw-1; Mon, 20 Jun 2022 17:16:17 -0400 X-MC-Unique: vY5Lfy5bNyG3eOm35UQymw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 68E2E3C02B75; Mon, 20 Jun 2022 21:16:16 +0000 (UTC) Received: from [10.22.32.175] (unknown [10.22.32.175]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB067141510C; Mon, 20 Jun 2022 21:16:15 +0000 (UTC) Message-ID: Date: Mon, 20 Jun 2022 17:16:15 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH V5] riscv: Add qspinlock support Content-Language: en-US To: Arnd Bergmann , Guo Ren Cc: Palmer Dabbelt , Peter Zijlstra , Boqun Feng , linux-riscv , linux-arch , Linux Kernel Mailing List , Guo Ren References: <20220620155404.1968739-1-guoren@kernel.org> From: Waiman Long In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/20/22 16:42, Arnd Bergmann wrote: > On Mon, Jun 20, 2022 at 5:54 PM wrote: >>> +config RISCV_USE_QUEUED_SPINLOCKS >> + bool "Using queued spinlock instead of ticket-lock" > Maybe we can just make ARCH_USE_QUEUED_SPINLOCKS > user visible and give users the choice between the two generic > implementations across all architectures that support the qspinlock > variant. > > In arch/riscv, you'd then just have a > > select ARCH_HAVE_QUEUED_SPINLOCKS > > diff --git a/arch/riscv/include/asm/spinlock.h > b/arch/riscv/include/asm/spinlock.h >> new file mode 100644 >> index 000000000000..fd3fd09cff52 >> --- /dev/null >> +++ b/arch/riscv/include/asm/spinlock.h >> @@ -0,0 +1,12 @@ >> +/* SPDX-License-Identifier: GPL-2.0 */ >> +#ifndef __ASM_SPINLOCK_H >> +#define __ASM_SPINLOCK_H >> + >> +#ifdef CONFIG_ARCH_USE_QUEUED_SPINLOCKS >> +#include >> +#include >> +#else >> +#include >> +#endif >> + > Along the same lines: > > I think I'd prefer the header changes to be done in the asm-generic > version of this file, so this can be shared across all architectures > that want to give the choice between ticket and queued spinlock. I concur. Qspinlock is only needed if we want to support systems with a large number of CPUs. For systems with a small number of CPUs. It doesn't matter if qspinlock or the ticket lock is being used. Cheers, Longman