From: Mark Brown <broonie@kernel.org>
To: Palmer Dabbelt <palmer@dabbelt.com>, Paul Walmsley <paul@pwsan.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux Next Mailing List <linux-next@vger.kernel.org>,
Nam Cao <namcao@linutronix.de>, Paul Walmsley <pjw@kernel.org>
Subject: linux-next: manual merge of the risc-v tree with the risc-v-fixes tree
Date: Mon, 8 Jun 2026 11:59:58 +0100 [thread overview]
Message-ID: <aiagrraIGAYbWA5D@sirena.org.uk> (raw)
[-- Attachment #1: Type: text/plain, Size: 4871 bytes --]
Hi all,
Today's linux-next merge of the risc-v tree got a conflict in:
arch/riscv/kernel/unaligned_access_speed.c
between commit:
1e4fcbec3c714 ("riscv: Fix fast_unaligned_access_speed_key not getting initialized")
from the risc-v-fixes tree and commits:
aad60bdd0b5a6 ("riscv: Fix fast_unaligned_access_speed_key not getting initialized")
65e25b3affc92 ("riscv: misaligned: Fix fast_unaligned_access_speed_key init")
from the risc-v tree.
I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.
diff --combined arch/riscv/kernel/unaligned_access_speed.c
index 11c781a4de733,bb57eb5d19dfe..0000000000000
--- a/arch/riscv/kernel/unaligned_access_speed.c
+++ b/arch/riscv/kernel/unaligned_access_speed.c
@@@ -27,8 -27,6 +27,6 @@@ DEFINE_PER_CPU(long, vector_misaligned_
static long unaligned_scalar_speed_param = RISCV_HWPROBE_MISALIGNED_SCALAR_UNKNOWN;
static long unaligned_vector_speed_param = RISCV_HWPROBE_MISALIGNED_VECTOR_UNKNOWN;
- static cpumask_t fast_misaligned_access;
-
static u64 __maybe_unused
measure_cycles(void (*func)(void *dst, const void *src, size_t len),
void *dst, void *src, size_t len)
@@@ -131,13 -129,10 +129,10 @@@ static int check_unaligned_access(struc
* Set the value of fast_misaligned_access of a CPU. These operations
* are atomic to avoid race conditions.
*/
- if (ret) {
+ if (ret)
per_cpu(misaligned_access_speed, cpu) = RISCV_HWPROBE_MISALIGNED_SCALAR_FAST;
- cpumask_set_cpu(cpu, &fast_misaligned_access);
- } else {
+ else
per_cpu(misaligned_access_speed, cpu) = RISCV_HWPROBE_MISALIGNED_SCALAR_SLOW;
- cpumask_clear_cpu(cpu, &fast_misaligned_access);
- }
return 0;
}
@@@ -192,49 -187,24 +187,24 @@@ static void __init check_unaligned_acce
DEFINE_STATIC_KEY_FALSE(fast_unaligned_access_speed_key);
- static void modify_unaligned_access_branches(cpumask_t *mask, int weight)
+ static void modify_unaligned_access_branches(const cpumask_t *mask)
{
- if (cpumask_weight(mask) == weight)
+ bool fast = true;
+ int cpu;
+
+ for_each_cpu(cpu, mask) {
+ if (per_cpu(misaligned_access_speed, cpu) != RISCV_HWPROBE_MISALIGNED_SCALAR_FAST) {
+ fast = false;
+ break;
+ }
+ }
+
+ if (fast)
static_branch_enable_cpuslocked(&fast_unaligned_access_speed_key);
else
static_branch_disable_cpuslocked(&fast_unaligned_access_speed_key);
}
- static void set_unaligned_access_static_branches_except_cpu(int cpu)
- {
- /*
- * Same as set_unaligned_access_static_branches, except excludes the
- * given CPU from the result. When a CPU is hotplugged into an offline
- * state, this function is called before the CPU is set to offline in
- * the cpumask, and thus the CPU needs to be explicitly excluded.
- */
-
- cpumask_t fast_except_me;
-
- cpumask_and(&fast_except_me, &fast_misaligned_access, cpu_online_mask);
- cpumask_clear_cpu(cpu, &fast_except_me);
-
- modify_unaligned_access_branches(&fast_except_me, num_online_cpus() - 1);
- }
-
- static void set_unaligned_access_static_branches(void)
- {
- /*
- * This will be called after check_unaligned_access_all_cpus so the
- * result of unaligned access speed for all CPUs will be available.
- *
- * To avoid the number of online cpus changing between reading
- * cpu_online_mask and calling num_online_cpus, cpus_read_lock must be
- * held before calling this function.
- */
-
- cpumask_t fast_and_online;
-
- cpumask_and(&fast_and_online, &fast_misaligned_access, cpu_online_mask);
-
- modify_unaligned_access_branches(&fast_and_online, num_online_cpus());
- }
-
static int riscv_online_cpu(unsigned int cpu)
{
int ret = cpu_online_unaligned_access_init(cpu);
@@@ -266,14 -236,19 +236,19 @@@
#endif
exit:
- set_unaligned_access_static_branches();
+ modify_unaligned_access_branches(cpu_online_mask);
return 0;
}
static int riscv_offline_cpu(unsigned int cpu)
{
- set_unaligned_access_static_branches_except_cpu(cpu);
+ cpumask_t mask;
+
+ cpumask_copy(&mask, cpu_online_mask);
+ cpumask_clear_cpu(cpu, &mask);
+
+ modify_unaligned_access_branches(&mask);
return 0;
}
@@@ -430,7 -405,7 +405,7 @@@ static int __init check_unaligned_acces
riscv_online_cpu_vec, NULL);
cpus_read_lock();
- set_unaligned_access_static_branches();
+ modify_unaligned_access_branches(cpu_online_mask);
cpus_read_unlock();
return 0;
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next reply other threads:[~2026-06-08 11:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-08 10:59 Mark Brown [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-06-28 13:48 Mark Brown
2023-04-20 12:40 broonie
2023-04-20 13:23 ` Alexandre Ghiti
2023-04-21 11:40 ` Mark Brown
2023-04-21 11:59 ` Mark Brown
2021-06-09 0:26 Stephen Rothwell
2021-06-09 0:37 ` Palmer Dabbelt
2020-10-07 23:13 Stephen Rothwell
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=aiagrraIGAYbWA5D@sirena.org.uk \
--to=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=namcao@linutronix.de \
--cc=palmer@dabbelt.com \
--cc=paul@pwsan.com \
--cc=pjw@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®