All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <ajones@ventanamicro.com>
To: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-doc@vger.kernel.org
Cc: paul.walmsley@sifive.com, palmer@dabbelt.com,
	charlie@rivosinc.com, cleger@rivosinc.com, alex@ghiti.fr,
	Anup Patel <apatel@ventanamicro.com>,
	corbet@lwn.net, Alexandre Ghiti <alexghiti@rivosinc.com>
Subject: [PATCH v3 6/8] riscv: Fix set up of vector cpu hotplug callback
Date: Tue,  4 Mar 2025 13:00:21 +0100	[thread overview]
Message-ID: <20250304120014.143628-16-ajones@ventanamicro.com> (raw)
In-Reply-To: <20250304120014.143628-10-ajones@ventanamicro.com>

Whether or not we have RISCV_PROBE_VECTOR_UNALIGNED_ACCESS we need to
set up a cpu hotplug callback to check if we have vector at all,
since, when we don't have vector, we need to set
vector_misaligned_access to unsupported rather than leave it the
default of unknown.

Fixes: e7c9d66e313b ("RISC-V: Report vector unaligned access speed hwprobe")
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
---
 arch/riscv/kernel/unaligned_access_speed.c | 31 +++++++++++-----------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/arch/riscv/kernel/unaligned_access_speed.c b/arch/riscv/kernel/unaligned_access_speed.c
index c9d3237649bb..d9d4ca1fadc7 100644
--- a/arch/riscv/kernel/unaligned_access_speed.c
+++ b/arch/riscv/kernel/unaligned_access_speed.c
@@ -356,6 +356,20 @@ static void check_vector_unaligned_access(struct work_struct *work __always_unus
 	per_cpu(vector_misaligned_access, cpu) = speed;
 }
 
+/* Measure unaligned access speed on all CPUs present at boot in parallel. */
+static int __init vec_check_unaligned_access_speed_all_cpus(void *unused __always_unused)
+{
+	schedule_on_each_cpu(check_vector_unaligned_access);
+
+	return 0;
+}
+#else /* CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS */
+static int __init vec_check_unaligned_access_speed_all_cpus(void *unused __always_unused)
+{
+	return 0;
+}
+#endif
+
 static int riscv_online_cpu_vec(unsigned int cpu)
 {
 	if (!has_vector()) {
@@ -363,27 +377,16 @@ static int riscv_online_cpu_vec(unsigned int cpu)
 		return 0;
 	}
 
+#ifdef CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS
 	if (per_cpu(vector_misaligned_access, cpu) != RISCV_HWPROBE_MISALIGNED_VECTOR_UNKNOWN)
 		return 0;
 
 	check_vector_unaligned_access_emulated(NULL);
 	check_vector_unaligned_access(NULL);
-	return 0;
-}
-
-/* Measure unaligned access speed on all CPUs present at boot in parallel. */
-static int __init vec_check_unaligned_access_speed_all_cpus(void *unused __always_unused)
-{
-	schedule_on_each_cpu(check_vector_unaligned_access);
+#endif
 
 	return 0;
 }
-#else /* CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS */
-static int __init vec_check_unaligned_access_speed_all_cpus(void *unused __always_unused)
-{
-	return 0;
-}
-#endif
 
 static int __init check_unaligned_access_all_cpus(void)
 {
@@ -409,10 +412,8 @@ static int __init check_unaligned_access_all_cpus(void)
 	cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "riscv:online",
 				  riscv_online_cpu, riscv_offline_cpu);
 #endif
-#ifdef CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS
 	cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "riscv:online",
 				  riscv_online_cpu_vec, NULL);
-#endif
 
 	return 0;
 }
-- 
2.48.1


WARNING: multiple messages have this Message-ID (diff)
From: Andrew Jones <ajones@ventanamicro.com>
To: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-doc@vger.kernel.org
Cc: paul.walmsley@sifive.com, palmer@dabbelt.com,
	charlie@rivosinc.com, cleger@rivosinc.com, alex@ghiti.fr,
	Anup Patel <apatel@ventanamicro.com>,
	corbet@lwn.net, Alexandre Ghiti <alexghiti@rivosinc.com>
Subject: [PATCH v3 6/8] riscv: Fix set up of vector cpu hotplug callback
Date: Tue,  4 Mar 2025 13:00:21 +0100	[thread overview]
Message-ID: <20250304120014.143628-16-ajones@ventanamicro.com> (raw)
In-Reply-To: <20250304120014.143628-10-ajones@ventanamicro.com>

Whether or not we have RISCV_PROBE_VECTOR_UNALIGNED_ACCESS we need to
set up a cpu hotplug callback to check if we have vector at all,
since, when we don't have vector, we need to set
vector_misaligned_access to unsupported rather than leave it the
default of unknown.

Fixes: e7c9d66e313b ("RISC-V: Report vector unaligned access speed hwprobe")
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
---
 arch/riscv/kernel/unaligned_access_speed.c | 31 +++++++++++-----------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/arch/riscv/kernel/unaligned_access_speed.c b/arch/riscv/kernel/unaligned_access_speed.c
index c9d3237649bb..d9d4ca1fadc7 100644
--- a/arch/riscv/kernel/unaligned_access_speed.c
+++ b/arch/riscv/kernel/unaligned_access_speed.c
@@ -356,6 +356,20 @@ static void check_vector_unaligned_access(struct work_struct *work __always_unus
 	per_cpu(vector_misaligned_access, cpu) = speed;
 }
 
+/* Measure unaligned access speed on all CPUs present at boot in parallel. */
+static int __init vec_check_unaligned_access_speed_all_cpus(void *unused __always_unused)
+{
+	schedule_on_each_cpu(check_vector_unaligned_access);
+
+	return 0;
+}
+#else /* CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS */
+static int __init vec_check_unaligned_access_speed_all_cpus(void *unused __always_unused)
+{
+	return 0;
+}
+#endif
+
 static int riscv_online_cpu_vec(unsigned int cpu)
 {
 	if (!has_vector()) {
@@ -363,27 +377,16 @@ static int riscv_online_cpu_vec(unsigned int cpu)
 		return 0;
 	}
 
+#ifdef CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS
 	if (per_cpu(vector_misaligned_access, cpu) != RISCV_HWPROBE_MISALIGNED_VECTOR_UNKNOWN)
 		return 0;
 
 	check_vector_unaligned_access_emulated(NULL);
 	check_vector_unaligned_access(NULL);
-	return 0;
-}
-
-/* Measure unaligned access speed on all CPUs present at boot in parallel. */
-static int __init vec_check_unaligned_access_speed_all_cpus(void *unused __always_unused)
-{
-	schedule_on_each_cpu(check_vector_unaligned_access);
+#endif
 
 	return 0;
 }
-#else /* CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS */
-static int __init vec_check_unaligned_access_speed_all_cpus(void *unused __always_unused)
-{
-	return 0;
-}
-#endif
 
 static int __init check_unaligned_access_all_cpus(void)
 {
@@ -409,10 +412,8 @@ static int __init check_unaligned_access_all_cpus(void)
 	cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "riscv:online",
 				  riscv_online_cpu, riscv_offline_cpu);
 #endif
-#ifdef CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS
 	cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "riscv:online",
 				  riscv_online_cpu_vec, NULL);
-#endif
 
 	return 0;
 }
-- 
2.48.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  parent reply	other threads:[~2025-03-04 12:00 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-04 12:00 [PATCH v3 0/8] riscv: Unaligned access speed probing fixes and skipping Andrew Jones
2025-03-04 12:00 ` Andrew Jones
2025-03-04 12:00 ` [PATCH v3 1/8] riscv: Annotate unaligned access init functions Andrew Jones
2025-03-04 12:00   ` Andrew Jones
2025-03-04 12:00 ` [PATCH v3 2/8] riscv: Fix riscv_online_cpu_vec Andrew Jones
2025-03-04 12:00   ` Andrew Jones
2025-03-04 12:00 ` [PATCH v3 3/8] riscv: Fix check_unaligned_access_all_cpus Andrew Jones
2025-03-04 12:00   ` Andrew Jones
2025-03-04 12:00 ` [PATCH v3 4/8] riscv: Change check_unaligned_access_speed_all_cpus to void Andrew Jones
2025-03-04 12:00   ` Andrew Jones
2025-03-04 12:00 ` [PATCH v3 5/8] riscv: Fix set up of cpu hotplug callbacks Andrew Jones
2025-03-04 12:00   ` Andrew Jones
2025-03-04 12:00 ` Andrew Jones [this message]
2025-03-04 12:00   ` [PATCH v3 6/8] riscv: Fix set up of vector cpu hotplug callback Andrew Jones
2025-03-04 12:00 ` [PATCH v3 7/8] riscv: Add parameter for skipping access speed tests Andrew Jones
2025-03-04 12:00   ` Andrew Jones
2025-03-17 14:39   ` Alexandre Ghiti
2025-03-17 14:39     ` Alexandre Ghiti
2025-03-18  8:48     ` Andrew Jones
2025-03-18  8:48       ` Andrew Jones
2025-03-18  9:00       ` Andrew Jones
2025-03-18  9:00         ` Andrew Jones
2025-03-18 14:09         ` Clément Léger
2025-03-18 14:09           ` Clément Léger
2025-03-18 14:57           ` Andrew Jones
2025-03-18 14:57             ` Andrew Jones
2025-03-18 12:13       ` Alexandre Ghiti
2025-03-18 12:13         ` Alexandre Ghiti
2025-03-18 12:45         ` Andrew Jones
2025-03-18 12:45           ` Andrew Jones
2025-03-18 12:58           ` Alexandre Ghiti
2025-03-18 12:58             ` Alexandre Ghiti
2025-03-18 13:04             ` Andrew Jones
2025-03-18 13:04               ` Andrew Jones
2025-03-18 14:09               ` Alexandre Ghiti
2025-03-18 14:09                 ` Alexandre Ghiti
2025-03-18 14:22                 ` Clément Léger
2025-03-18 14:22                   ` Clément Léger
2025-03-18 15:09                 ` Andrew Jones
2025-03-18 15:09                   ` Andrew Jones
2025-03-18 15:40                   ` Anup Patel
2025-03-18 15:40                     ` Anup Patel
2025-04-07  9:49   ` Geert Uytterhoeven
2025-04-07  9:49     ` Geert Uytterhoeven
2025-04-07 13:45     ` Andrew Jones
2025-04-07 13:45       ` Andrew Jones
2025-04-08 12:25   ` Geert Uytterhoeven
2025-04-08 12:25     ` Geert Uytterhoeven
2025-04-08 13:03     ` Andrew Jones
2025-04-08 13:03       ` Andrew Jones
2025-04-08 15:32       ` Geert Uytterhoeven
2025-04-08 15:32         ` Geert Uytterhoeven
2025-03-04 12:00 ` [PATCH v3 8/8] Documentation/kernel-parameters: Add riscv unaligned speed parameters Andrew Jones
2025-03-04 12:00   ` Andrew Jones
2025-03-05 22:48 ` [PATCH v3 0/8] riscv: Unaligned access speed probing fixes and skipping Charlie Jenkins
2025-03-05 22:48   ` Charlie Jenkins
2025-03-06  8:13   ` Andrew Jones
2025-03-06  8:13     ` Andrew Jones
2025-03-27  3:24 ` patchwork-bot+linux-riscv
2025-03-27  3:24   ` patchwork-bot+linux-riscv

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=20250304120014.143628-16-ajones@ventanamicro.com \
    --to=ajones@ventanamicro.com \
    --cc=alex@ghiti.fr \
    --cc=alexghiti@rivosinc.com \
    --cc=apatel@ventanamicro.com \
    --cc=charlie@rivosinc.com \
    --cc=cleger@rivosinc.com \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.