Subject: Re: [PATCH 1/2] powerpc/rtas: use device model APIs and serialization during LPM

From: Nathan Lynch <[email-masked]>
Date: Thu, 18 Jul 2019 14:46:43 -0500

Nathan Lynch <[email-masked]> writes:

> During LPAR migration, cpu hotplug and migration operations can
> interleave like so:
>
> cd /sys/devices/system/cpu/cpu7/ | drmgr -m -c pmig -p pre \
> echo 0 > online                  | -s 0xd7a884f83d830e6d -t 19 \
> echo 1 > online                  | -n -d 1 5
> ---------------------------------+-------------------------------------------
> online_store() {                 |
>   device_offline() {             |
>     cpu_subsys_offline() {       |
>       cpu_down(7);               |
>     }                            |
>     dev->offline = true;         |
>   }                              | migration_store() {
> }                                |   rtas_ibm_suspend_me() {
>                                  |     rtas_online_cpus_mask() {
>                                  |       cpu_up(7);
> 				 |     }
>                                  |     cpu_hotplug_disable();
>                                  |     on_each_cpu(rtas_percpu_suspend_me());
>                                  |     cpu_hotplug_enable();
> online_store() {                 |
>   device_online() {              |
>     cpu_subsys_online() {        |
>       cpu_up(7);                 |
>     }                            |
>     dev->offline = false;        |
>   }                              |     rtas_offline_cpus_mask() {
> }                                |       rtas_cpu_state_change_mask() {
>                                  |         cpu_down(7);
> 				 |       }
> 				 |     }
> 				 |   }
> 				 | }

Actually I think this isn't a correct depiction of the race. I'll
rewrite and resend.