Skip to content

Commit d9b6582

Browse files
author
Alexandre Ghiti
committed
Merge patch series "riscv: Unaligned access speed probing fixes and skipping"
Andrew Jones <ajones@ventanamicro.com> says: The first six patches of this series are fixes and cleanups of the unaligned access speed probing code. The next patch introduces a kernel command line option that allows the probing to be skipped. This command line option is a different approach than Jesse's [1]. [1] takes a cpu-list for a particular speed, supporting heterogeneous platforms. With this approach, the kernel command line should only be used for homogeneous platforms. [1] also only allowed 'fast' and 'slow' to be selected. This parameter also supports 'unsupported', which could be useful for testing code paths gated on that. The final patch adds the documentation. [1] https://lore.kernel.org/linux-riscv/20240805173816.3722002-1-jesse@rivosinc.com/ * patches from https://lore.kernel.org/r/20250304120014.143628-10-ajones@ventanamicro.com: Documentation/kernel-parameters: Add riscv unaligned speed parameters riscv: Add parameter for skipping access speed tests riscv: Fix set up of vector cpu hotplug callback riscv: Fix set up of cpu hotplug callbacks riscv: Change check_unaligned_access_speed_all_cpus to void riscv: Fix check_unaligned_access_all_cpus riscv: Fix riscv_online_cpu_vec riscv: Annotate unaligned access init functions Link: https://lore.kernel.org/r/20250304120014.143628-10-ajones@ventanamicro.com Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
2 parents 5b376a6 + 9fe5853 commit d9b6582

File tree

4 files changed

+168
-103
lines changed

4 files changed

+168
-103
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7477,6 +7477,22 @@
74777477
Note that genuine overcurrent events won't be
74787478
reported either.
74797479

7480+
unaligned_scalar_speed=
7481+
[RISCV]
7482+
Format: {slow | fast | unsupported}
7483+
Allow skipping scalar unaligned access speed tests. This
7484+
is useful for testing alternative code paths and to skip
7485+
the tests in environments where they run too slowly. All
7486+
CPUs must have the same scalar unaligned access speed.
7487+
7488+
unaligned_vector_speed=
7489+
[RISCV]
7490+
Format: {slow | fast | unsupported}
7491+
Allow skipping vector unaligned access speed tests. This
7492+
is useful for testing alternative code paths and to skip
7493+
the tests in environments where they run too slowly. All
7494+
CPUs must have the same vector unaligned access speed.
7495+
74807496
unknown_nmi_panic
74817497
[X86] Cause panic on unknown NMI.
74827498

arch/riscv/include/asm/cpufeature.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void __init riscv_user_isa_enable(void);
6363
#define __RISCV_ISA_EXT_SUPERSET_VALIDATE(_name, _id, _sub_exts, _validate) \
6464
_RISCV_ISA_EXT_DATA(_name, _id, _sub_exts, ARRAY_SIZE(_sub_exts), _validate)
6565

66-
bool check_unaligned_access_emulated_all_cpus(void);
66+
bool __init check_unaligned_access_emulated_all_cpus(void);
6767
#if defined(CONFIG_RISCV_SCALAR_MISALIGNED)
6868
void check_unaligned_access_emulated(struct work_struct *work __always_unused);
6969
void unaligned_emulation_finish(void);
@@ -76,7 +76,7 @@ static inline bool unaligned_ctl_available(void)
7676
}
7777
#endif
7878

79-
bool check_vector_unaligned_access_emulated_all_cpus(void);
79+
bool __init check_vector_unaligned_access_emulated_all_cpus(void);
8080
#if defined(CONFIG_RISCV_VECTOR_MISALIGNED)
8181
void check_vector_unaligned_access_emulated(struct work_struct *work __always_unused);
8282
DECLARE_PER_CPU(long, vector_misaligned_access);

arch/riscv/kernel/traps_misaligned.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -605,16 +605,10 @@ void check_vector_unaligned_access_emulated(struct work_struct *work __always_un
605605
kernel_vector_end();
606606
}
607607

608-
bool check_vector_unaligned_access_emulated_all_cpus(void)
608+
bool __init check_vector_unaligned_access_emulated_all_cpus(void)
609609
{
610610
int cpu;
611611

612-
if (!has_vector()) {
613-
for_each_online_cpu(cpu)
614-
per_cpu(vector_misaligned_access, cpu) = RISCV_HWPROBE_MISALIGNED_VECTOR_UNSUPPORTED;
615-
return false;
616-
}
617-
618612
schedule_on_each_cpu(check_vector_unaligned_access_emulated);
619613

620614
for_each_online_cpu(cpu)
@@ -625,7 +619,7 @@ bool check_vector_unaligned_access_emulated_all_cpus(void)
625619
return true;
626620
}
627621
#else
628-
bool check_vector_unaligned_access_emulated_all_cpus(void)
622+
bool __init check_vector_unaligned_access_emulated_all_cpus(void)
629623
{
630624
return false;
631625
}
@@ -659,7 +653,7 @@ void check_unaligned_access_emulated(struct work_struct *work __always_unused)
659653
}
660654
}
661655

662-
bool check_unaligned_access_emulated_all_cpus(void)
656+
bool __init check_unaligned_access_emulated_all_cpus(void)
663657
{
664658
int cpu;
665659

@@ -684,7 +678,7 @@ bool unaligned_ctl_available(void)
684678
return unaligned_ctl;
685679
}
686680
#else
687-
bool check_unaligned_access_emulated_all_cpus(void)
681+
bool __init check_unaligned_access_emulated_all_cpus(void)
688682
{
689683
return false;
690684
}

0 commit comments

Comments
 (0)