Commit 5af76fb4 authored by Will Deacon's avatar Will Deacon

arm64: alternatives: Remove READ_ONCE() usage during patch operation

In preparation for patching the internals of READ_ONCE() itself, replace
its usage on the alternatives patching patch with a volatile variable
instead.
Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent 364a5a8a
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
#define ALT_ORIG_PTR(a) __ALT_PTR(a, orig_offset) #define ALT_ORIG_PTR(a) __ALT_PTR(a, orig_offset)
#define ALT_REPL_PTR(a) __ALT_PTR(a, alt_offset) #define ALT_REPL_PTR(a) __ALT_PTR(a, alt_offset)
static int all_alternatives_applied; /* Volatile, as we may be patching the guts of READ_ONCE() */
static volatile int all_alternatives_applied;
static DECLARE_BITMAP(applied_alternatives, ARM64_NCAPS); static DECLARE_BITMAP(applied_alternatives, ARM64_NCAPS);
...@@ -205,7 +206,7 @@ static int __apply_alternatives_multi_stop(void *unused) ...@@ -205,7 +206,7 @@ static int __apply_alternatives_multi_stop(void *unused)
/* We always have a CPU 0 at this point (__init) */ /* We always have a CPU 0 at this point (__init) */
if (smp_processor_id()) { if (smp_processor_id()) {
while (!READ_ONCE(all_alternatives_applied)) while (!all_alternatives_applied)
cpu_relax(); cpu_relax();
isb(); isb();
} else { } else {
...@@ -217,7 +218,7 @@ static int __apply_alternatives_multi_stop(void *unused) ...@@ -217,7 +218,7 @@ static int __apply_alternatives_multi_stop(void *unused)
BUG_ON(all_alternatives_applied); BUG_ON(all_alternatives_applied);
__apply_alternatives(&region, false, remaining_capabilities); __apply_alternatives(&region, false, remaining_capabilities);
/* Barriers provided by the cache flushing */ /* Barriers provided by the cache flushing */
WRITE_ONCE(all_alternatives_applied, 1); all_alternatives_applied = 1;
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment