cpu-hotplug.rst 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. .. SPDX-License-Identifier: GPL-2.0
  2. .. _cpuhp_index:
  3. ====================
  4. CPU Hotplug and ACPI
  5. ====================
  6. CPU hotplug in the arm64 world is commonly used to describe the kernel taking
  7. CPUs online/offline using PSCI. This document is about ACPI firmware allowing
  8. CPUs that were not available during boot to be added to the system later.
  9. ``possible`` and ``present`` refer to the state of the CPU as seen by linux.
  10. CPU Hotplug on physical systems - CPUs not present at boot
  11. ----------------------------------------------------------
  12. Physical systems need to mark a CPU that is ``possible`` but not ``present`` as
  13. being ``present``. An example would be a dual socket machine, where the package
  14. in one of the sockets can be replaced while the system is running.
  15. This is not supported.
  16. In the arm64 world CPUs are not a single device but a slice of the system.
  17. There are no systems that support the physical addition (or removal) of CPUs
  18. while the system is running, and ACPI is not able to sufficiently describe
  19. them.
  20. e.g. New CPUs come with new caches, but the platform's cache topology is
  21. described in a static table, the PPTT. How caches are shared between CPUs is
  22. not discoverable, and must be described by firmware.
  23. e.g. The GIC redistributor for each CPU must be accessed by the driver during
  24. boot to discover the system wide supported features. ACPI's MADT GICC
  25. structures can describe a redistributor associated with a disabled CPU, but
  26. can't describe whether the redistributor is accessible, only that it is not
  27. 'always on'.
  28. arm64's ACPI tables assume that everything described is ``present``.
  29. CPU Hotplug on virtual systems - CPUs not enabled at boot
  30. ---------------------------------------------------------
  31. Virtual systems have the advantage that all the properties the system will
  32. ever have can be described at boot. There are no power-domain considerations
  33. as such devices are emulated.
  34. CPU Hotplug on virtual systems is supported. It is distinct from physical
  35. CPU Hotplug as all resources are described as ``present``, but CPUs may be
  36. marked as disabled by firmware. Only the CPU's online/offline behaviour is
  37. influenced by firmware. An example is where a virtual machine boots with a
  38. single CPU, and additional CPUs are added once a cloud orchestrator deploys
  39. the workload.
  40. For a virtual machine, the VMM (e.g. Qemu) plays the part of firmware.
  41. Virtual hotplug is implemented as a firmware policy affecting which CPUs can be
  42. brought online. Firmware can enforce its policy via PSCI's return codes. e.g.
  43. ``DENIED``.
  44. The ACPI tables must describe all the resources of the virtual machine. CPUs
  45. that firmware wishes to disable either from boot (or later) should not be
  46. ``enabled`` in the MADT GICC structures, but should have the ``online capable``
  47. bit set, to indicate they can be enabled later. The boot CPU must be marked as
  48. ``enabled``. The 'always on' GICR structure must be used to describe the
  49. redistributors.
  50. CPUs described as ``online capable`` but not ``enabled`` can be set to enabled
  51. by the DSDT's Processor object's _STA method. On virtual systems the _STA method
  52. must always report the CPU as ``present``. Changes to the firmware policy can
  53. be notified to the OS via device-check or eject-request.
  54. CPUs described as ``enabled`` in the static table, should not have their _STA
  55. modified dynamically by firmware. Soft-restart features such as kexec will
  56. re-read the static properties of the system from these static tables, and
  57. may malfunction if these no longer describe the running system. Linux will
  58. re-discover the dynamic properties of the system from the _STA method later
  59. during boot.