Skip to content

kmorphd: Probe no driver behind an IOMMU that was not claimed - #7

Merged
congwang-mk merged 1 commit into
mainfrom
iommu-unclaimed-no-drivers
Dec 3, 2026
Merged

congwang-mk merged 1 commit into
mainfrom
iommu-unclaimed-no-drivers

Conversation

@congwang-mk

Copy link
Copy Markdown
Contributor

Problem

A successor that does not come to drive the dead host's IOMMUs went on to probe drivers for the devices it adopted. Their interrupts are still remapped by the host's tables, so they never arrive: virtio_blk waits for its first read forever inside its probe, and kmorphd with it. The takeover stays at FENCED.

This happens whenever a device could be neither taken nor quiesced, since kmorphd then leaves every unit to the dead host on purpose, and whenever the kernel refuses a claim.

Change

Unless every unit is claimed, ops_adopt_devices() leaves the adopted devices without a driver and the takeover finishes with the CPUs, the memory and the devices the successor already had.

The bus is also left probing no driver, so that a module loaded later does not bind one of those devices and block the same way. This changes what the existing "host keeps the IOMMU" case leaves behind: drivers_autoprobe stays 0 there.

The README's takeover description says the same.

Testing

  • make check passes, with a new unit test for the case and the existing one updated for drivers_autoprobe.
  • VM takeover with an AMD IOMMU whose claim the kernel refused: reaches TAKEN_OVER where it hung at FENCED before, with 13 adopted devices left without a driver.
  • Normal takeovers (every unit claimed, drivers probed) still pass on an AMD IOMMU VM, an Intel IOMMU VM and arm64 QEMU.

The arm64 and Intel runs cover only the path where the claim succeeds.

A successor that does not come to drive the dead host's IOMMUs went on
to probe drivers for the devices it adopted. Their interrupts are still
remapped by the host's tables, so they never arrive: virtio_blk waits
for its first read forever inside its probe, and kmorphd with it. The
takeover stays at FENCED.

That is the case whenever a device could be neither taken nor quiesced,
since kmorphd then leaves every unit to the dead host on purpose, and
whenever the kernel refuses a claim.

Unless every unit is claimed, leave the adopted devices without a
driver and finish the takeover with the CPUs, the memory and the
devices the successor already had. The bus is left probing no driver,
so that a module loaded later does not bind one of them and block the
same way.

Signed-off-by: Cong Wang <cwang@multikernel.io>
@congwang-mk
congwang-mk merged commit 6689aa4 into main Dec 3, 2026
2 checks passed
@congwang-mk
congwang-mk deleted the iommu-unclaimed-no-drivers branch December 3, 2026 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant