OSDN Git Service

powerpc/pseries: Avoid harmless preempt warning
authorNicholas Piggin <npiggin@gmail.com>
Fri, 20 Mar 2020 15:24:36 +0000 (01:24 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 25 Mar 2020 01:09:39 +0000 (12:09 +1100)
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200320152436.1468651-1-npiggin@gmail.com
arch/powerpc/platforms/pseries/lpar.c

index 3c3da25..e4ed531 100644 (file)
@@ -636,8 +636,16 @@ static const struct proc_ops vcpudispatch_stats_freq_proc_ops = {
 
 static int __init vcpudispatch_stats_procfs_init(void)
 {
-       if (!lppaca_shared_proc(get_lppaca()))
+       /*
+        * Avoid smp_processor_id while preemptible. All CPUs should have
+        * the same value for lppaca_shared_proc.
+        */
+       preempt_disable();
+       if (!lppaca_shared_proc(get_lppaca())) {
+               preempt_enable();
                return 0;
+       }
+       preempt_enable();
 
        if (!proc_create("powerpc/vcpudispatch_stats", 0600, NULL,
                                        &vcpudispatch_stats_proc_ops))