mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: guoren@kernel.org
To: guoren@kernel.org, conor@kernel.org, alexghiti@rivosinc.com
Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	paul.walmsley@sifive.com, palmer@dabbelt.com, bjorn@rivosinc.com,
	leobras@redhat.com, peterz@infradead.org, parri.andrea@gmail.com,
	longman@redhat.com, boqun.feng@gmail.com, arnd@arndb.de,
	will@kernel.org, corbet@lwn.net,
	Guo Ren <guoren@linux.alibaba.com>
Subject: [PATCH] riscv: Add riscv_force_qspinlock for early_param
Date: Fri, 13 Dec 2024 23:35:10 -0500	[thread overview]
Message-ID: <20241214043510.3795984-1-guoren@kernel.org> (raw)

From: Guo Ren <guoren@linux.alibaba.com>

When CONFIG_RISCV_COMBO_SPINLOCKS is enabled, permit qspinlock
force enabled. See the Kconfig entry for RISCV_COMBO_SPINLOCKS.

Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Signed-off-by: Guo Ren <guoren@kernel.org>
---
 Documentation/admin-guide/kernel-parameters.txt |  5 +++++
 arch/riscv/kernel/setup.c                       | 13 ++++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 3872bc6ec49d..43d0df2922b2 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -5887,6 +5887,11 @@
 			[KNL] Disable ring 3 MONITOR/MWAIT feature on supported
 			CPUs.
 
+	riscv_force_qspinlock [RISCV, EARLY]
+			When CONFIG_RISCV_COMBO_SPINLOCKS is enabled, permit
+			qspinlock force enabled. See the Kconfig entry for
+			RISCV_COMBO_SPINLOCKS.
+
 	riscv_isa_fallback [RISCV,EARLY]
 			When CONFIG_RISCV_ISA_FALLBACK is not enabled, permit
 			falling back to detecting extension support by parsing
diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index 45010e71df86..74b13bc64c9c 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -247,6 +247,15 @@ static void __init parse_dtb(void)
 #if defined(CONFIG_RISCV_COMBO_SPINLOCKS)
 DEFINE_STATIC_KEY_TRUE(qspinlock_key);
 EXPORT_SYMBOL(qspinlock_key);
+
+static bool force_qspinlock;
+
+static int __init riscv_force_qspinlock(char *p)
+{
+	force_qspinlock = true;
+	return 0;
+}
+early_param("riscv_force_qspinlock", riscv_force_qspinlock);
 #endif
 
 static void __init riscv_spinlock_init(void)
@@ -267,7 +276,9 @@ static void __init riscv_spinlock_init(void)
 		using_ext = "using Ziccrse";
 	}
 #if defined(CONFIG_RISCV_COMBO_SPINLOCKS)
-	else {
+	else if (force_qspinlock) {
+		using_ext = "force";
+	} else {
 		static_branch_disable(&qspinlock_key);
 		pr_info("Ticket spinlock: enabled\n");
 		return;
-- 
2.40.1


             reply	other threads:[~2024-12-14  4:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-14  4:35 guoren [this message]
2024-12-16  9:14 ` Alexandre Ghiti
2024-12-22  4:03   ` Guo Ren
2025-02-26  9:27     ` Alexandre Ghiti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241214043510.3795984-1-guoren@kernel.org \
    --to=guoren@kernel.org \
    --cc=alexghiti@rivosinc.com \
    --cc=arnd@arndb.de \
    --cc=bjorn@rivosinc.com \
    --cc=boqun.feng@gmail.com \
    --cc=conor@kernel.org \
    --cc=corbet@lwn.net \
    --cc=guoren@linux.alibaba.com \
    --cc=leobras@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=longman@redhat.com \
    --cc=palmer@dabbelt.com \
    --cc=parri.andrea@gmail.com \
    --cc=paul.walmsley@sifive.com \
    --cc=peterz@infradead.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®