Advertisement
vliaskov

hold lock_device_hotplug throughout hotplug ops

Jul 3rd, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. ---
  2. drivers/xen/cpu_hotplug.c | 7 +++----
  3. 1 file changed, 3 insertions(+), 4 deletions(-)
  4.  
  5. diff --git a/drivers/xen/cpu_hotplug.c b/drivers/xen/cpu_hotplug.c
  6. index 5676aef..ce626a5 100644
  7. --- a/drivers/xen/cpu_hotplug.c
  8. +++ b/drivers/xen/cpu_hotplug.c
  9. @@ -10,23 +10,24 @@
  10.  
  11. static void enable_hotplug_cpu(int cpu)
  12. {
  13. + lock_device_hotplug();
  14. if (!cpu_present(cpu))
  15. xen_arch_register_cpu(cpu);
  16.  
  17. set_cpu_present(cpu, true);
  18. + unlock_device_hotplug();
  19. }
  20.  
  21. static void disable_hotplug_cpu(int cpu)
  22. {
  23. - if (cpu_online(cpu)) {
  24. - lock_device_hotplug();
  25. + lock_device_hotplug();
  26. + if (cpu_online(cpu))
  27. device_offline(get_cpu_device(cpu));
  28. - unlock_device_hotplug();
  29. - }
  30. if (cpu_present(cpu))
  31. xen_arch_unregister_cpu(cpu);
  32.  
  33. set_cpu_present(cpu, false);
  34. + unlock_device_hotplug();
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement