Skip to content

Commit 9aa2baa

Browse files
authored
CA-403633: Keep vPCI devices in the same order (#6176)
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. This fix has been manually tested by @freddy77 against an affected VM relying on the ordering
2 parents 4f3f08f + a540ac8 commit 9aa2baa

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

ocaml/xenopsd/lib/xenops_server.ml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,12 +1630,11 @@ let rec atomics_of_operation = function
16301630
]
16311631
; [VM_create_device_model (id, false)]
16321632
(* PCI and USB devices are hot-plugged into HVM guests via QEMU, so the
1633-
following operations occur after creating the device models *)
1634-
; parallel_concat "Devices.plug (qemu)" ~id
1635-
[
1636-
List.map (fun pci -> PCI_plug (pci.Pci.id, true)) pcis_other
1637-
; List.map (fun vusb -> VUSB_plug vusb.Vusb.id) vusbs
1638-
]
1633+
following operations occur after creating the device models.
1634+
The order of PCI devices depends on the order they are plugged, they
1635+
must be kept serialized. *)
1636+
; List.map (fun pci -> PCI_plug (pci.Pci.id, true)) pcis_other
1637+
; List.map (fun vusb -> VUSB_plug vusb.Vusb.id) vusbs
16391638
(* At this point the domain is considered survivable. *)
16401639
; [VM_set_domain_action_request (id, None)]
16411640
]
@@ -1698,10 +1697,10 @@ let rec atomics_of_operation = function
16981697
)
16991698
; [VM_create_device_model (id, true)]
17001699
(* PCI and USB devices are hot-plugged into HVM guests via QEMU, so
1701-
the following operations occur after creating the device models *)
1702-
; parallel_map "PCIs.plug" ~id pcis_other (fun pci ->
1703-
[PCI_plug (pci.Pci.id, true)]
1704-
)
1700+
the following operations occur after creating the device models.
1701+
The order of PCI devices depends on the order they are plugged, they
1702+
must be kept serialized. *)
1703+
; List.map (fun pci -> PCI_plug (pci.Pci.id, true)) pcis_other
17051704
]
17061705
|> List.concat
17071706
| VM_poweroff (id, timeout) ->

0 commit comments

Comments
 (0)