]> Git Repo - linux.git/commitdiff
arm64: alternatives: Remove READ_ONCE() usage during patch operation
authorWill Deacon <[email protected]>
Tue, 30 Jun 2020 13:06:04 +0000 (14:06 +0100)
committerWill Deacon <[email protected]>
Mon, 9 Nov 2020 21:49:34 +0000 (21:49 +0000)
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: Peter Zijlstra (Intel) <[email protected]>
Acked-by: Mark Rutland <[email protected]>
Signed-off-by: Will Deacon <[email protected]>
arch/arm64/kernel/alternative.c

index 73039949b5ce2f6227f11d0d1591967c38bda8f6..a57cffb752e8955b8b9b9dbc144f632dead81402 100644 (file)
@@ -21,7 +21,8 @@
 #define ALT_ORIG_PTR(a)                __ALT_PTR(a, orig_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);
 
@@ -205,7 +206,7 @@ static int __apply_alternatives_multi_stop(void *unused)
 
        /* We always have a CPU 0 at this point (__init) */
        if (smp_processor_id()) {
-               while (!READ_ONCE(all_alternatives_applied))
+               while (!all_alternatives_applied)
                        cpu_relax();
                isb();
        } else {
@@ -217,7 +218,7 @@ static int __apply_alternatives_multi_stop(void *unused)
                BUG_ON(all_alternatives_applied);
                __apply_alternatives(&region, false, remaining_capabilities);
                /* Barriers provided by the cache flushing */
-               WRITE_ONCE(all_alternatives_applied, 1);
+               all_alternatives_applied = 1;
        }
 
        return 0;
This page took 0.054361 seconds and 4 git commands to generate.