Skip to content

Commit

Permalink
CA-403633: Keep vPCI devices in the same order
Browse files Browse the repository at this point in the history
QEMU orders devices by the time of plugging. Parallelizing them introduces
randomness, which breaks the assumption that devices are ordered in a
deterministic way.

Serialize all PCI and VUSB plugs to restore behaviour.

Signed-off-by: Pau Ruiz Safont <[email protected]>
  • Loading branch information
psafont committed Dec 12, 2024
1 parent 4f3f08f commit a540ac8
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions ocaml/xenopsd/lib/xenops_server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1630,12 +1630,11 @@ let rec atomics_of_operation = function
]
; [VM_create_device_model (id, false)]
(* PCI and USB devices are hot-plugged into HVM guests via QEMU, so the
following operations occur after creating the device models *)
; parallel_concat "Devices.plug (qemu)" ~id
[
List.map (fun pci -> PCI_plug (pci.Pci.id, true)) pcis_other
; List.map (fun vusb -> VUSB_plug vusb.Vusb.id) vusbs
]
following operations occur after creating the device models.
The order of PCI devices depends on the order they are plugged, they
must be kept serialized. *)
; List.map (fun pci -> PCI_plug (pci.Pci.id, true)) pcis_other
; List.map (fun vusb -> VUSB_plug vusb.Vusb.id) vusbs
(* At this point the domain is considered survivable. *)
; [VM_set_domain_action_request (id, None)]
]
Expand Down Expand Up @@ -1698,10 +1697,10 @@ let rec atomics_of_operation = function
)
; [VM_create_device_model (id, true)]
(* PCI and USB devices are hot-plugged into HVM guests via QEMU, so
the following operations occur after creating the device models *)
; parallel_map "PCIs.plug" ~id pcis_other (fun pci ->
[PCI_plug (pci.Pci.id, true)]
)
the following operations occur after creating the device models.
The order of PCI devices depends on the order they are plugged, they
must be kept serialized. *)
; List.map (fun pci -> PCI_plug (pci.Pci.id, true)) pcis_other
]
|> List.concat
| VM_poweroff (id, timeout) ->
Expand Down

0 comments on commit a540ac8

Please sign in to comment.