diff mbox series

riscv: Add riscv_force_qspinlock for early_param

Message ID 20241214043510.3795984-1-guoren@kernel.org (mailing list archive)
State New
Headers show
Series riscv: Add riscv_force_qspinlock for early_param | expand

Checks

Context Check Description
conchuod/vmtest-for-next-PR success PR summary
conchuod/patch-1-test-1 success .github/scripts/patches/tests/build_rv32_defconfig.sh took 103.07s
conchuod/patch-1-test-2 success .github/scripts/patches/tests/build_rv64_clang_allmodconfig.sh took 1025.62s
conchuod/patch-1-test-3 success .github/scripts/patches/tests/build_rv64_gcc_allmodconfig.sh took 1214.09s
conchuod/patch-1-test-4 success .github/scripts/patches/tests/build_rv64_nommu_k210_defconfig.sh took 16.09s
conchuod/patch-1-test-5 success .github/scripts/patches/tests/build_rv64_nommu_virt_defconfig.sh took 17.33s
conchuod/patch-1-test-6 success .github/scripts/patches/tests/checkpatch.sh took 0.55s
conchuod/patch-1-test-7 success .github/scripts/patches/tests/dtb_warn_rv64.sh took 36.38s
conchuod/patch-1-test-8 success .github/scripts/patches/tests/header_inline.sh took 0.00s
conchuod/patch-1-test-9 success .github/scripts/patches/tests/kdoc.sh took 0.51s
conchuod/patch-1-test-10 success .github/scripts/patches/tests/module_param.sh took 0.02s
conchuod/patch-1-test-11 success .github/scripts/patches/tests/verify_fixes.sh took 0.00s
conchuod/patch-1-test-12 success .github/scripts/patches/tests/verify_signedoff.sh took 0.02s

Commit Message

Guo Ren Dec. 14, 2024, 4:35 a.m. UTC
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(-)

Comments

Alexandre Ghiti Dec. 16, 2024, 9:14 a.m. UTC | #1
Hi Guo,

On 14/12/2024 05:35, guoren@kernel.org wrote:
> 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;


What's the use case for this early param? To me that implies that a 
platform may have another extension which would allow the usage of 
qspinlock, so why not listing it in riscv_spinlock_init() instead?

Thanks,

Alex
diff mbox series

Patch

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;