)]}'
{
  "commit": "8aa35bebeeaed19ae57afbc3e110b8e7fe8587d0",
  "tree": "de611af628881e2a01e028797091a4a86aab4e37",
  "parents": [
    "e043be2290ffdd666ad2ab35d2341c137b21a3b4"
  ],
  "author": {
    "name": "Igor Mammedov",
    "email": "imammedo@redhat.com",
    "time": "Tue Dec 10 17:39:44 2024 +0100"
  },
  "committer": {
    "name": "Michael S. Tsirkin",
    "email": "mst@redhat.com",
    "time": "Wed Jan 15 13:05:41 2025 -0500"
  },
  "message": "cpuhp: make sure that remove events are handled within the same SCI\n\nCPU_SCAN_METHOD was processing insert events first and only if insert event was\nnot present then it would check remove event.\n\nNormally it\u0027s not an issue as it doesn\u0027t make much sense tho hotplug and\nimmediately unplug it. In this corner case, which can be reproduced with:\n\n   qemu -smp 1,maxcpus\u003d2 -cpu host -monitor stdio \\\n        -drive if\u003dpflash,format\u003draw,readonly,file\u003dedk2-x86_64-code.fd\n\n   * boot till GRUB prompt and pause guest (either via monitor or stop GRUB\n     from automatic boot)\n   * at monitor prompt add CPU:\n         device_add host-x86_64-cpu,socket-id\u003d0,core-id\u003d1,thread-id\u003d0,id\u003dfoo\n   * let guest OS boot completely, and unplug CPU from monitor prompt:\n         device_del foo\n     which triggers GPE event that leads to CPU_SCAN_METHOD on guest side\n\nas result of above cpu \u0027foo\u0027 will not be hotunplugged, since QEMU sees\ninsert event and ignores remove event (leaving it in pending state) for\nthe GPE event.\n\nAny follow up CPU hotplug/unplug action from QEMU side will handle\npreviously ignored event, so as workaround user can repeat device_del.\n\nFix this corner-case by queuing remove events independently from insert\nevents, aka the same way as we do with insert events. And then go over remove\nqueue to send eject notify events to OSPM within the same GPE event.\n\nPS:\nProcess remove queue after the cpu add queue has been processed 1st\nto ensure that OSPM gets hotadd evets after hotremove ones.\n\nPS2:\nCase where it\u0027s still borken happens when guest OS is Linux and\ndevice_del happens before guest OS initializes ACPI subsystem.\nCulprit in this case though is the guest kernel, which mangles GPE.sts\n(by clearing them up) and thus pending SCI turns to NOP leaving\ninsert/remove events in pending state.\nThat is the guest bug and should be fixed there.\n\nSigned-off-by: Igor Mammedov \u003cimammedo@redhat.com\u003e\nReported-by: Eric Mackay \u003ceric.mackay@oracle.com\u003e\nMessage-Id: \u003c20241210163945.3422623-3-imammedo@redhat.com\u003e\nTested-by: Eric Mackay \u003ceric.mackay@oracle.com\u003e\nReviewed-by: Michael S. Tsirkin \u003cmst@redhat.com\u003e\nSigned-off-by: Michael S. Tsirkin \u003cmst@redhat.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "9d530a24da5f099540bcf4f2443202d87018d2b5",
      "old_mode": 33188,
      "old_path": "hw/acpi/cpu.c",
      "new_id": "f70a2c045e1b7bbd8046ef5b84f6a64065af052e",
      "new_mode": 33188,
      "new_path": "hw/acpi/cpu.c"
    }
  ]
}
